feat: add incrementing and decrementing mutator #476
Merged
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.
Ityfuzz uses these standard mutations from libafl
But using a more evm-specific mutator for incrementing or decrementing inputs directly allows faster finding of control flow.
Take this contract
The values of 2097151 and 4194306 and 2 are push values that will be used by
ConstantHintedMutator
. However, copying inputs to these values directly will fail to get past<
and>
flows. Since<
and>
are such common operations on push'd values, I think adding mutators to help pass that is helpful.The
BitFlipMutator
after the ConstantHint is the best chance it has to get past the<
and>
, but it isn't as good as just trying to add or subtract one since the bitflips can be anywhere in the bit space, not just at the end.IncDecMutator
just takes the input and does a wrapping addition or subtractionResults
I ran on this example with debug target mode. Without the pr it takes ~12s and 40k executions. With the pr it's basically instant
WITHOUT
WITH