bug(cheatcodes
): slot of contract with arbitrary storage set to 0 in setUp
, but goes back to being arbitrary in the test
#10108
Labels
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge Version: 1.0.0-stable
Commit SHA: e144b82
Build Timestamp: 2025-02-13T20:03:31.026474817Z (1739477011)
Build Profile: maxperf
What version of Foundryup are you on?
foundryup: 1.0.1
What command(s) is the bug in?
forge test
Operating System
Linux
Describe the bug
Copied from foundry-rs/forge-std#667
I'm trying to write a
setUp
function that first uses thesetArbitraryStorage
cheatcode to make the storage of a contract arbitrary, then usesstore
to set a single storage slot to 0. This seems to work inside thesetUp
, but when the test itself is executed, the value of the storage slot goes back to being a random number. This seems to only happen when the value is 0.Minimal Example
The test fails and this is what the logs show:
However, if
DEFAULT_VALUE
is changed to 1, the result is correct:The text was updated successfully, but these errors were encountered: