Skip to content

Commit 3d95f80

Browse files
authored
chore(cheat): load and touch new origin in broadcast call (#12096)
* fix(cheat): load and touch new origin in broadcast call * fmt
1 parent f111fb1 commit 3d95f80

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

crates/cheatcodes/src/inspector.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,6 @@ impl Cheatcodes {
893893
is_fixed_gas_limit = false;
894894
}
895895
let input = TransactionInput::new(call.input.bytes(ecx));
896-
// Ensure account is touched.
897-
ecx.journaled_state.touch(broadcast.new_origin);
898896

899897
let account =
900898
ecx.journaled_state.inner.state().get_mut(&broadcast.new_origin).unwrap();
@@ -1680,9 +1678,6 @@ impl Inspector<EthEvmContext<&mut dyn DatabaseExt>> for Cheatcodes {
16801678

16811679
input.set_caller(broadcast.new_origin);
16821680

1683-
// Ensure account is touched.
1684-
ecx.journaled_state.touch(broadcast.new_origin);
1685-
16861681
let account = &ecx.journaled_state.inner.state()[&broadcast.new_origin];
16871682
self.broadcastable_transactions.push_back(BroadcastableTransaction {
16881683
rpc: ecx.journaled_state.database.active_fork_url(),

crates/cheatcodes/src/script.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Implementations of [`Scripting`](spec::Group::Scripting) cheatcodes.
22
3-
use crate::{Cheatcode, CheatsCtxt, Result, Vm::*};
3+
use crate::{Cheatcode, CheatsCtxt, Result, Vm::*, evm::journaled_account};
44
use alloy_consensus::{SidecarBuilder, SimpleCoder};
55
use alloy_primitives::{Address, B256, U256, Uint};
66
use alloy_rpc_types::Authorization;
@@ -375,9 +375,12 @@ fn broadcast(ccx: &mut CheatsCtxt, new_origin: Option<&Address>, single_call: bo
375375
}
376376
}
377377
}
378+
let new_origin = new_origin.unwrap_or(ccx.ecx.tx.caller);
379+
// Ensure new origin is loaded and touched.
380+
let _ = journaled_account(ccx.ecx, new_origin)?;
378381

379382
let broadcast = Broadcast {
380-
new_origin: new_origin.unwrap_or(ccx.ecx.tx.caller),
383+
new_origin,
381384
original_caller: ccx.caller,
382385
original_origin: ccx.ecx.tx.caller,
383386
depth,

0 commit comments

Comments
 (0)