Documentation
¶
Index ¶
- type Corpus
- func (c *Corpus) ActiveCallSequenceCount() int
- func (c *Corpus) AddCallSequence(seq calls.CallSequence, weight *big.Int, flushImmediately bool) error
- func (c *Corpus) AddCallSequenceIfCoverageChanged(callSequence calls.CallSequence, weight *big.Int, flushImmediately bool) error
- func (c *Corpus) CallSequenceCount() int
- func (c *Corpus) CallSequencesDirectory() string
- func (c *Corpus) CoverageMaps() *coverage.CoverageMaps
- func (c *Corpus) Flush() error
- func (c *Corpus) Initialize(baseTestChain *chain.TestChain, contractDefinitions contracts.Contracts) error
- func (c *Corpus) RandomCallSequence() (calls.CallSequence, error)
- func (c *Corpus) StorageDirectory() string
- func (c *Corpus) UnexecutedCallSequence() *calls.CallSequence
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Corpus ¶
type Corpus struct {
// contains filtered or unexported fields
}
Corpus describes an archive of fuzzer-generated artifacts used to further fuzzing efforts. These artifacts are reusable across fuzzer runs. Changes to the fuzzer/chain configuration or definitions within smart contracts may create incompatibilities with corpus items.
func NewCorpus ¶
NewCorpus initializes a new Corpus object, reading artifacts from the provided directory. If the directory refers to an empty path, artifacts will not be persistently stored.
func (*Corpus) ActiveCallSequenceCount ¶
ActiveCallSequenceCount returns the count of call sequences recorded in the corpus which have been validated and are ready for use by RandomCallSequence.
func (*Corpus) AddCallSequence ¶
func (c *Corpus) AddCallSequence(seq calls.CallSequence, weight *big.Int, flushImmediately bool) error
AddCallSequence adds a call sequence to the corpus and returns an error in case of an issue
func (*Corpus) AddCallSequenceIfCoverageChanged ¶
func (c *Corpus) AddCallSequenceIfCoverageChanged(callSequence calls.CallSequence, weight *big.Int, flushImmediately bool) error
AddCallSequenceIfCoverageChanged checks if the most recent call executed in the provided call sequence achieved coverage the Corpus did not with any of its call sequences. If it did, the call sequence is added to the corpus and the Corpus coverage maps are updated accordingly. Returns an error if one occurs.
func (*Corpus) CallSequenceCount ¶
CallSequenceCount returns the total number of call sequences in the corpus, some of which may be inactive/not in use.
func (*Corpus) CallSequencesDirectory ¶
CallSequencesDirectory returns the directory path where coverage increasing call sequences should be stored. This is a subdirectory of StorageDirectory. If StorageDirectory is empty, this is as well, indicating persistent storage will not be used.
func (*Corpus) CoverageMaps ¶
func (c *Corpus) CoverageMaps() *coverage.CoverageMaps
CoverageMaps exposes coverage details for all call sequences known to the corpus.
func (*Corpus) Initialize ¶
func (c *Corpus) Initialize(baseTestChain *chain.TestChain, contractDefinitions contracts.Contracts) error
Initialize initializes any runtime data needed for a Corpus on startup. Call sequences are replayed on the post-setup (deployment) test chain to calculate coverage, while resolving references to compiled contracts.
func (*Corpus) RandomCallSequence ¶
func (c *Corpus) RandomCallSequence() (calls.CallSequence, error)
RandomCallSequence returns a weighted random call sequence from the Corpus, or an error if one occurs.
func (*Corpus) StorageDirectory ¶
StorageDirectory returns the root directory path of the corpus. If this is empty, it indicates persistent storage will not be used.
func (*Corpus) UnexecutedCallSequence ¶
func (c *Corpus) UnexecutedCallSequence() *calls.CallSequence
UnexecutedCallSequence returns a call sequence loaded from disk which has not yet been returned by this method. It is intended to be used by the fuzzer to run all un-executed call sequences (without mutations) to check for test failures. If a call sequence is returned, it will not be returned by this method again. Returns a call sequence loaded from disk which has not yet been executed, to check for test failures. If all sequences in the corpus have been executed, this will return nil.