fix: collect push bytes from test setup in fuzzer#2929
Conversation
|
unsure if this is related but this now results in Failing tests:
Encountered 2 failing tests in src/test/StdAssertions.t.sol:StdAssertionsTest
[FAIL. Reason: Too many global rejects] testAssertEq_BytesErr_Pass(bytes,bytes) (runs: 31, μ: 20023, ~: 21439)
[FAIL. Reason: Too many global rejects] testAssertEq_Bytes_Pass(bytes,bytes) (runs: 24, μ: 19965, ~: 20697)when running |
|
We had this discussion here: #2724 (comment) We decided to revert the |
|
The Forge Std |
|
Just merged foundry-rs/forge-std#160 which should prevent foundry CI from failing on those now |
51f034b to
54c6c04
Compare
gakonst
left a comment
There was a problem hiding this comment.
Rebased, merging per the forge-std fixes. Flagging for us to keep this PR in mind if people come to us with complaints about the fuzzer error'ing too much.
* fix: collect push bytes from test setup in fuzzer * Update evm/src/fuzz/strategies/state.rs * chore: rustfmt Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Motivation
There's an old report that immutables were not collected in the fuzzer. Immutables are sections in the bytecode of contracts that are replaced by constant values, so we should be collecting them (since we collect push bytes), but it turns out that we were not collecting push bytes in the initial fuzzer DB (i.e. from the state right after
setUp).See #1168
Solution
Also collect push bytes after
setUp. Closes #1168Note: The state dict after
setUpfor the test in #1168 contains about ~120 values. It seems that either one of the tests fail every time (which is what we want), but not super reliably. Increasing the fuzzer runs to 512 makes them both fail reliably, though.