Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the ability to modify an Echidna or Medusa corpus based on certain conditions, save a corpus into a corpus "history" file, and restore a previously saved corpus.
It includes the following changes:
modify-corpus
: Modifies an existing corpus based on the fuzzer configuration or data provided via flags. The available conditions are:--fuzzer-config
: Fetches the maximum time delay, maximum block delay, or blacklisted functions defined in the fuzzer configuration file. Calls or call sequences that use a larger time/block delay than defined, or use a blacklisted function, are discarded.--modify-senders
LIST: Takes in a list of the format0xoldAddress=0xnewAddress,...
, and replaces the caller for all calls that use theoldAddress
withnewAddress
--filter-functions
: Removes calls or call sequences that call functions that no longer exist. Currently supports only one target contract.--mode
delete_sequence
|delete_calls
: Defines how filtering is done,delete_sequence
deletes the entire call sequence file if any call within it is invalid per the included rules.delete_calls
only deletes the invalid call.snapshot
: Saves the provided corpus directory into ahistory.json
file so it can be easily retrieved. E.g., in case we want to rollback the changes we made to the corpus. Available flags:--corpus-dir
,--fuzzer
restore
: Restores a corpus from thehistory.json
file, it will override the directory where it was previously saved. Available flags:--list-history
(lists all saved corpora with their hashes),--hash
STR (takes in a hash of the corpus we want to restore)CorpusModifier
were added to support the above features.pyYAML
was added as a dependancy so we can process echidna.yaml
config filesBefore merging this PR further work should be done to:
--filter-functions
Note: This is non-trivial in the case where we have multiple target contracts that might have functions with the same name.delete_sequences
delete_calls
and modifying senders