Skip to content

Commit f8d8ae9

Browse files
authored
feat: push NonceChange to Journal in deduct_caller (#1804)
1 parent e477c7f commit f8d8ae9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

crates/revm/src/handler/mainnet/pre_execution.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! They handle initial setup of the EVM, call loop and the final return of the EVM
44
5-
use crate::{Context, ContextPrecompiles, EvmWiring};
5+
use crate::{Context, ContextPrecompiles, EvmWiring, JournalEntry};
66
use bytecode::Bytecode;
77
use precompile::PrecompileSpecId;
88
use primitives::{BLOCKHASH_STORAGE_ADDRESS, U256};
@@ -105,6 +105,20 @@ pub fn deduct_caller<EvmWiringT: EvmWiring, SPEC: Spec>(
105105
// deduct gas cost from caller's account.
106106
deduct_caller_inner::<EvmWiringT, SPEC>(caller_account.data, &context.evm.inner.env);
107107

108+
// Ensure tx kind is call
109+
if context.evm.inner.env.tx.kind().is_call() {
110+
// Push NonceChange entry
111+
context
112+
.evm
113+
.inner
114+
.journaled_state
115+
.journal
116+
.last_mut()
117+
.unwrap()
118+
.push(JournalEntry::NonceChange {
119+
address: *context.evm.inner.env.tx.caller(),
120+
});
121+
}
108122
Ok(())
109123
}
110124

0 commit comments

Comments
 (0)