Skip to content

Commit 84eaf39

Browse files
committed
correct nonce after setUp if necessary
1 parent 8b51055 commit 84eaf39

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cli/src/cmd/forge/script/runner.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ impl<DB: DatabaseRef> Runner<DB> {
9696
.extend(setup_traces.map(|traces| (TraceKind::Setup, traces)).into_iter());
9797
logs.extend_from_slice(&setup_logs);
9898

99+
// We call the `setUp()` function with self.sender, and if there haven't been
100+
// any broadcasts, then the EVM cheatcode module hasn't corrected the nonce
101+
if let Some(ref txes) = transactions {
102+
if txes.is_empty() {
103+
self.executor.set_nonce(self.sender, sender_nonce.as_u64());
104+
}
105+
} else {
106+
self.executor.set_nonce(self.sender, sender_nonce.as_u64());
107+
}
108+
99109
(
100110
!reverted,
101111
gas,

0 commit comments

Comments
 (0)