-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
Currently, hevm's implementation of vm.assume(bool) returns successfully (via doStop) when the condition is false, rather than reverting with the magic code "FOUNDRY::ASSUME". This breaks Foundry test compatibility and makes it impossible for fuzzers to properly filter out invalid inputs:
Lines 1833 to 1838 in 1f02fd8
| , action "assume(bool)" $ | |
| \sig input -> case decodeStaticArgs 0 1 input of | |
| [c] -> do | |
| modifying #constraints ((:) (PEq (Lit 1) c)) | |
| doStop | |
| _ -> vmError (BadCheatCode "assume(bool) parameter decoding failed." sig) |
When vm.assume(false) is called, it should revert with the magic string "FOUNDRY::ASSUME\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0".
This is how Foundry implements it: https://github.com/foundry-rs/foundry/blob/e589ccfc404f878b77c1e6a5ea85023ad99482b6/crates/cheatcodes/src/test/assume.rs#L46-L51
Proposed fix:
vmError (Revert (ConcreteBuf "FOUNDRY::ASSUME\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"))Identified this together with @gustavo-grieco when working on Echdina's Foundry test generation feature.
gustavo-grieco and moodmosaic
Metadata
Metadata
Assignees
Labels
No labels