Skip to content
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

fix(invariants): support vm.assume in invariant tests #7309

Merged
merged 5 commits into from
Mar 5, 2024

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Mar 4, 2024

Motivation

Closes #4190

Solution

Catch reverts with MAGIC_ASSUME, regenerate latest calldata and increase assume_rejects_counter. Once counter goes beyond configured max_assume_rejects, test fails.

I've changed InvariantFuzzError to be an enum, because we don't need data it holds right now for MaxAssumeRejects failures.

Also changed invariant_strat a bit, currently it always returns Vec with one element, it seemed a bit confusing at first glance, so I changed it to return just a single input.

@klkvr klkvr changed the title fix(invariants): support vm.assume in invariant tests fix(invariants): support vm.assume in invariant tests Mar 4, 2024
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@klkvr klkvr merged commit ce22450 into foundry-rs:master Mar 5, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: vm.assume support in invariant tests
3 participants