Skip to content

Commit

Permalink
Changes after review + ensure test shrinked sequence is 3 or less
Browse files Browse the repository at this point in the history
  • Loading branch information
grandizzy committed Feb 28, 2024
1 parent 70cbf68 commit 9d2b073
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/evm/evm/src/executors/invariant/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ impl InvariantFuzzError {

// Checks the invariant. If we revert or fail before the last call, all the better.
if let Some(func) = &self.func {
let call_result = executor
let mut call_result = executor
.call_raw(CALLER, self.addr, func.clone(), U256::ZERO)
.expect("bad call to evm");
let is_success = executor.is_raw_call_success(
self.addr,
call_result.state_changeset.clone().unwrap(),
call_result.state_changeset.take().unwrap(),
&call_result,
false,
);
Expand Down
4 changes: 2 additions & 2 deletions crates/forge/tests/it/invariant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ async fn test_invariant_assert_shrink() {
let mut opts = test_opts();
opts.fuzz.seed = Some(U256::from(119u32));

// ensure assert and require shrinks to same sequence of 3
// ensure assert and require shrinks to same sequence of 3 or less
test_shrink(opts.clone(), "InvariantShrinkWithAssert").await;
test_shrink(opts.clone(), "InvariantShrinkWithRequire").await;
}
Expand Down Expand Up @@ -322,7 +322,7 @@ async fn test_shrink(opts: TestOptions, contract_pattern: &str) {
match counter {
CounterExample::Single(_) => panic!("CounterExample should be a sequence."),
CounterExample::Sequence(sequence) => {
assert_eq!(sequence.len(), 3);
assert!(sequence.len() <= 3);
}
};
}

0 comments on commit 9d2b073

Please sign in to comment.