Invariants feat: add config option to turn off shrinking#4868
Invariants feat: add config option to turn off shrinking#4868mattsse merged 6 commits intofoundry-rs:masterfrom
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
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."); |
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! |
| "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.
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_sequenceoption, default true, tries to reduce number of calls in scenario to min