-
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
Invariants feat: add config option to turn off shrinking #4868
Conversation
…uce number of calls in scenario to min - when set to false test will just error with the original number of calls in scenario
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smol nit, otherwise lgtm
evm/src/fuzz/invariant/error.rs
Outdated
let _calls = match self.test_error { | ||
// Don't use at the moment. | ||
TestError::Abort(_) => return Ok(None), | ||
TestError::Fail(_, ref calls) => calls, | ||
TestError::Fail(_, ref _calls) => _calls, | ||
}; | ||
|
||
let calls = self.try_shrinking(calls, &executor); | ||
if self.shrink { | ||
let _calls = self.try_shrinking(_calls, &executor); | ||
} else { | ||
trace!(target: "forge::test", "Shrinking disabled."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove _
prefix
yep, added such to avoid |
but
so I think it should be |
oops, right, changing |
fixed with 0226461 |
hey @mattsse just bumping this, when you have time please check the change, would really love to get this in. thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, tysm!
lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -61,6 +64,7 @@ impl InlineConfigParser for InvariantConfig { | |||
"depth" => conf_clone.depth = parse_config_u32(key, value)?, | |||
"fail-on-revert" => conf_clone.fail_on_revert = parse_config_bool(key, value)?, | |||
"call-override" => conf_clone.call_override = parse_config_bool(key, value)?, | |||
"shrink-sequence" => conf_clone.shrink_sequence = parse_config_bool(key, value)?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added the new shrink-sequence
key to the invariant inlineconfigparser so it works with #4744
thank you all! |
Motivation
See #4867, when running invariants test with many runs and depth (1000) the test hangs in shrinking scenario (performed for each invariant). In this case sometimes is preferable to fail fast and address the issue.
Solution
invariant_shrink_sequence
option, default true, tries to reduce number of calls in scenario to min