Skip to content

feat(fuzz): add cheatcode to populate in-memory corpus#13455

Open
CreeptoGengar wants to merge 8 commits intofoundry-rs:masterfrom
CreeptoGengar:feat/fuzz-add-to-corpus-cheatcode
Open

feat(fuzz): add cheatcode to populate in-memory corpus#13455
CreeptoGengar wants to merge 8 commits intofoundry-rs:masterfrom
CreeptoGengar:feat/fuzz-add-to-corpus-cheatcode

Conversation

@CreeptoGengar
Copy link
Copy Markdown
Contributor

Implements vm.addToCorpus(bytes32 hash) cheatcode that allows users to permanently add the current fuzz input to the in-memory corpus for mutation.

This enables power users to define interesting states with a hash (as fine-or-coarse grained as desired), similar to IJON. The cheatcode marks the current input during execution, and the fuzzer adds it to the corpus unconditionally after the call completes.

Changes:

  • Add addToCorpus(bytes32 hash) cheatcode definition
  • Track current fuzz input in Cheatcodes state
  • Add add_input_unconditionally() method to WorkerCorpus
  • Integrate with both stateless fuzz tests and invariant tests

Closes #12526

Added a function to permanently add fuzz inputs to the in-memory corpus.
Implemented the addToCorpusCall cheatcode to add current fuzz input to the corpus during fuzz testing.
Added handling for current fuzz input and corpus updates.
This function allows unconditional addition of inputs to the corpus, used by the addToCorpus cheatcode. It handles persistence to disk and updates in-memory corpus tracking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

feat(fuzz): cheatcode to populate in-memory corpus

1 participant