-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Setting for include_storage
in invariant tests seems to leak into fuzz tests settings
#7462
Comments
you should not get those if you set foundry/crates/evm/evm/src/executors/fuzz/mod.rs Lines 85 to 89 in e5318c3
|
I believe foundry/crates/evm/fuzz/src/strategies/state.rs Lines 95 to 100 in e5acbcf
However, I don't think that has changed recently so I'm unsure why the behavior appears to have changed. cc @DaniPopes @klkvr |
ping @apbendi, would be great if you could retest this if this still occurs, if not we can mark this as resolved |
Hey @zerosnacks, we ended up working around this in the UniStaker codebase, but I just went back and checked out the commit before that fix was merged and ran 1,000,000 fuzz runs with version |
Thanks for retesting @apbendi! Optimistically marking this ticket as resolved, feel free to re-open if you do end up encountering it in the future |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (1a4960d 2024-03-20T00:19:54.542150000Z)
What command(s) is the bug in?
No response
Operating System
macOS (Apple Silicon)
Describe the bug
Our code in the UniStaker repo has unit tests that will fail if certain addresses are selected from storage by the fuzzer so we turned off
include_storage
in our foundry toml. This has worked fine for a long time. When we added invariant tests, we turned it on for those tests as the same restriction didn't exists. This worked fine across many thousands of fuzz runs locally and in CI.Sometime recently, something seems to have changed. Now, we see CI failures where the fuzzer is clearly selecting values from storage for our unit tests.
Here's how you can reproduce.
.env.template
to.env
and put in a valid RPC URL (we can avoid actually hitting it by not running integration tests) and deployer private key (it can be the default anvil account)[profile.default]
section addfuzz = { runs = 100000 }
forge test --mt testFuzz_CalculatesCorrectEarningsForFourUsersWhenTwoStakeMorePartiallyThroughTheDurationAndOneBeneficiary
Using older values of Foundry this didn't occur.
Edit: Updated this to remove some comments about the settings in the
invariant
section impacting the fuzz runs. This seems not to be the case. It simply seems like we're getting values picked from storage now (despite the setting) when previously we weren't.The text was updated successfully, but these errors were encountered: