Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#991 Deterministic Fuzzer with RNG Seeding #1658

Merged
merged 10 commits into from
Jul 30, 2022

Conversation

Bind
Copy link
Contributor

@Bind Bind commented May 18, 2022

Motivation

Allow users to set a RNG seed to get deterministic fuzzing as outlined in #issue-991

Solution

This PR specifically handles RNG-Seeding which simply pipes a uint256 from the foundry.toml or --fuzz-seed cli arg into the TestRunner initialization.

Open Questions

How should I best leverage the built-in test macros to validate fuzzing is deterministic on per test basis regardless of changes to the contract being tested? (Is there an existing set of tests I should reference while building this?)

@Bind Bind changed the title Bind/#991 RNG seeding #991 RNG Seeding May 18, 2022
@Bind Bind changed the title #991 RNG Seeding #991 Deterministic Fuzzer with RNG Seeding May 18, 2022
@onbjerg onbjerg added the T-feature Type: feature label May 19, 2022
@onbjerg onbjerg linked an issue May 19, 2022 that may be closed by this pull request
@gakonst
Copy link
Member

gakonst commented May 23, 2022

Hey @Bind just checking up on what your plans for next steps are here! @mattsse can provide some guidance regarding how to test this, but I'd check how we do it in the integration tests: https://github.com/foundry-rs/foundry/blob/master/cli/tests/it/test_cmd.rs#L236-L279.

@gakonst gakonst force-pushed the master branch 4 times, most recently from e4cdc0a to 8112635 Compare May 24, 2022 07:21
@Bind
Copy link
Contributor Author

Bind commented May 25, 2022

@gakonst Lets see what type of tests I can get done this week otherwise (if someone else is chomping at the bit) might be best for me to bow out for now!

@gakonst
Copy link
Member

gakonst commented Jun 4, 2022

hi @Bind just bumping this again :D

@mattsse
Copy link
Member

mattsse commented Jul 28, 2022

This is ready now @gakonst

blocked by gakonst/ethers-rs#1524

@mattsse mattsse marked this pull request as ready for review July 28, 2022 16:42
Copy link
Member

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Clean.

iFrostizz pushed a commit to iFrostizz/foundry that referenced this pull request Nov 9, 2022
* feat: basic rng seeding

* chore: bump u32 to U256

* feat(config): add additional helper macro

* feat: finish fuzz seed impl

* bump ethers

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
@0xKarl98
Copy link

0xKarl98 commented Feb 27, 2023

the fuzz_seed is just an uint256 value ?
here is what i've found :
pub fuzz_seed: Option ,

@mds1
Copy link
Collaborator

mds1 commented Feb 27, 2023

yes exactly, in your config file you can use something like

[fuzz]
seed = 10

And leave out the seed key to set no fuzz seed

https://book.getfoundry.sh/reference/config/testing#seed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: enable saving and loading of corpus for deterministic fuzzing
6 participants