Skip to content

Commit

Permalink
remove fs_commit_changed logic from script (#3960)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo authored Dec 26, 2022
1 parent d3d8c0b commit 02cb1c0
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions cli/src/cmd/forge/script/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,6 @@ impl ScriptRunner {
value: U256,
commit: bool,
) -> eyre::Result<ScriptResult> {
let fs_commit_changed =
if let Some(ref mut cheatcodes) = self.executor.inspector_config_mut().cheatcodes {
let original_fs_commit = cheatcodes.fs_commit;
cheatcodes.fs_commit = false;
original_fs_commit != cheatcodes.fs_commit
} else {
false
};

let mut res = self.executor.call_raw(from, to, calldata.0.clone(), value)?;
let mut gas_used = res.gas_used;

Expand All @@ -286,15 +277,6 @@ impl ScriptRunner {
// Otherwise don't re-execute, or some usecases might be broken: https://github.com/foundry-rs/foundry/issues/3921
if commit {
gas_used = self.search_optimal_gas_usage(&res, from, to, &calldata, value)?;

// if we changed `fs_commit` during gas limit search, re-execute the call with original
// value
if fs_commit_changed {
if let Some(ref mut cheatcodes) = self.executor.inspector_config_mut().cheatcodes {
cheatcodes.fs_commit = !cheatcodes.fs_commit;
}
}

res = self.executor.call_raw_committing(from, to, calldata.0, value)?;
}

Expand Down

0 comments on commit 02cb1c0

Please sign in to comment.