-
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
Invariant violation not found on simple 2 step owner transfer test #5868
Comments
Wonder if we're now able to catch this with #6530 cc @brockelmore |
Nope the shrinking change is only relevant post-finding a counterexample |
fails right away here with |
@grandizzy I run with failing on revert doesn't make sense for this invariant test, I am trying to see if benchmark can successfully find the sequence of 2 calls that actually transfer ownership. It is expected that most runs will revert (because of the |
@karmacoma-eth got it, thanks, that makes sense. I assume you tweaked invariant |
I did not, I run it with defaults |
gotcha, I should have some time this week to try more variations here too and debug, there's also the the |
- added `FuzzDictionaryConfig.max_calldata_fuzz_dictionary_addresses` option to specify how many random addresses to generate and to randomly select from when fuzzing calldata. If option is not specified then current behavior applies - to narrow down number of runs / addresses involved in invariant test the `CalldataFuzzDictionaryConfig` is populated with random addresses plus all accounts from db (from `EvmFuzzState`) - added `fuzz_calldata_with_config` fn that accepts `Option<CalldataFuzzDictionary>` as param. Non invariants tests use existing `fuzz_calldata` fn and pass None as config arg
managed to make some tests, pls see #7240 |
…ry (#7240) * issue #5868 - added `FuzzDictionaryConfig.max_calldata_fuzz_dictionary_addresses` option to specify how many random addresses to generate and to randomly select from when fuzzing calldata. If option is not specified then current behavior applies - to narrow down number of runs / addresses involved in invariant test the `CalldataFuzzDictionaryConfig` is populated with random addresses plus all accounts from db (from `EvmFuzzState`) - added `fuzz_calldata_with_config` fn that accepts `Option<CalldataFuzzDictionary>` as param. Non invariants tests use existing `fuzz_calldata` fn and pass None as config arg * max_calldata_fuzz_dictionary_addresses usize * Add test from issue 5868 * Changes after review - comments, wrap Arc as CalldataFuzzDictionary.inner, code cleanup
@karmacoma-eth this is now merged, pls retest by setting the number of random addresses to recycle (in addition to known state addresses as handlers) e.g.
If not specified or set to 0 then current behavior is applied, (unbounded number of fuzzed addresses) |
in latest builds this is caught with default settings but run depth increased (
I think this one can be closed, @mds1 wdyt? |
From my testing, trying to flesh out depth vs. runs relationship a bit:
So:
|
Agree, we should revisit all defaults and update them to more relevant values, like
Worth mentioning that this kind of failure will be identified must faster when we implement per type fuzzing from state, so new owner address will be exercised right away. |
Awesome, created #7848 to track and will close this one |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (ec3f9bd 2023-09-19T13:48:52.205431000Z)
What command(s) is the bug in?
forge test
Operating System
macOS (Intel)
Describe the bug
take the following src contract:
and the following test:
There is no trick here, this is a kind of sanity check for invariant testing. Note the
test_successful_transfer
test, all that is needed to violate the invariant is to chain these two call:However:
forge test --mc TwoStepOwnershipTest
yields no violationcc @horsefacts who helped investigate (https://twitter.com/eth_call/status/1704304001292914782)
cc @mds1 who asked for the issue
The text was updated successfully, but these errors were encountered: