Skip to content

Commit

Permalink
Improve option name: shrink_sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
grandizzy committed May 3, 2023
1 parent 6d8bf9e commit d4a4546
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ call_override = false
dictionary_weight = 80
include_storage = true
include_push_bytes = true
try_shrinking = true
shrink_failure = true

[fmt]
line_length = 100
Expand Down
4 changes: 2 additions & 2 deletions config/src/invariant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct InvariantConfig {
#[serde(flatten)]
pub dictionary: FuzzDictionaryConfig,
/// Attempt to shrink the failure case to its smallest sequence of calls
pub try_shrinking: bool,
pub shrink_sequence: bool,
}

impl Default for InvariantConfig {
Expand All @@ -30,7 +30,7 @@ impl Default for InvariantConfig {
fail_on_revert: false,
call_override: false,
dictionary: FuzzDictionaryConfig { dictionary_weight: 80, ..Default::default() },
try_shrinking: true,
shrink_sequence: true,
}
}
}
2 changes: 1 addition & 1 deletion config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3374,7 +3374,7 @@ mod tests {
depth = 15
fail_on_revert = false
call_override = false
try_shrinking = true
shrink_sequence = true
"#,
)?;

Expand Down
4 changes: 2 additions & 2 deletions evm/src/fuzz/invariant/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl InvariantFuzzError {
calldata: &[BasicTxDetails],
call_result: RawCallResult,
inner_sequence: &[Option<BasicTxDetails>],
try_shrinking: bool,
shrink_sequence: bool,
) -> Self {
let mut func = None;
let origin: String;
Expand Down Expand Up @@ -80,7 +80,7 @@ impl InvariantFuzzError {
addr: invariant_contract.address,
func,
inner_sequence: inner_sequence.to_vec(),
shrink: try_shrinking,
shrink: shrink_sequence,
}
}

Expand Down
6 changes: 3 additions & 3 deletions evm/src/fuzz/invariant/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl<'a> InvariantExecutor<'a> {
&inputs,
&mut failures.borrow_mut(),
self.config.fail_on_revert,
self.config.try_shrinking,
self.config.shrink_sequence,
);

if !can_continue {
Expand Down Expand Up @@ -559,7 +559,7 @@ fn can_continue(
calldata: &[BasicTxDetails],
failures: &mut InvariantFailures,
fail_on_revert: bool,
try_shrinking: bool,
shrink_sequence: bool,
) -> (bool, Option<BTreeMap<String, RawCallResult>>) {
let mut call_results = None;
if !call_result.reverted {
Expand All @@ -579,7 +579,7 @@ fn can_continue(
calldata,
call_result,
&[],
try_shrinking,
shrink_sequence,
);

failures.revert_reason = Some(error.revert_reason.clone());
Expand Down
2 changes: 1 addition & 1 deletion forge/tests/it/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub static TEST_OPTS: TestOptions = TestOptions {
max_fuzz_dictionary_addresses: 10_000,
max_fuzz_dictionary_values: 10_000,
},
try_shrinking: true,
shrink_sequence: true,
},
};

Expand Down
2 changes: 1 addition & 1 deletion testdata/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ffi = false
force = false
invariant_fail_on_revert = false
invariant_call_override = false
invariant_try_shrinking = true
invariant_shrink_sequence = true
gas_limit = 9223372036854775807
gas_price = 0
gas_reports = ['*']
Expand Down

0 comments on commit d4a4546

Please sign in to comment.