-
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
feat: vm.assume
support in invariant tests
#4190
Labels
T-feature
Type: feature
Comments
This was referenced Jan 26, 2023
For historical context on this issue, see the discussion here: |
What are good ways to work around this issue for now? I'm considering using |
The only workarounds for now are:
if (value == address(0) {
return;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Component
Forge
Describe the feature you would like
Invariant tests support this cheat, which I believe is because
assume
was added before invariant tests. There are two ways we should support:vm.assume
directly in afunction invariant_MyInvariantTest()
method. Currently a failed assume here fails the test with[FAIL. Reason: Assertion failed.]
. To be fair this usage is a bit limited since you can't make assumptions on fuzzed inputs, but still seems worthwhile to supportvm.assume
in a handler contract. This lets you reject e.g. owner addresses from a fuzzed owner input. I tried putting a quick test together and it seems these are just ignored since the cheat isn't being called in a test methodAdditional context
No response
The text was updated successfully, but these errors were encountered: