From 72b126d427394169c4917932d2d0367c1c009cd7 Mon Sep 17 00:00:00 2001 From: royvardhan Date: Wed, 25 Sep 2024 22:27:32 +0530 Subject: [PATCH] feat: push NonceChange to Journal in deduct_caller --- crates/revm/src/handler/mainnet/pre_execution.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/revm/src/handler/mainnet/pre_execution.rs b/crates/revm/src/handler/mainnet/pre_execution.rs index e81f091db8..28c6252e4f 100644 --- a/crates/revm/src/handler/mainnet/pre_execution.rs +++ b/crates/revm/src/handler/mainnet/pre_execution.rs @@ -2,7 +2,7 @@ //! //! They handle initial setup of the EVM, call loop and the final return of the EVM -use crate::{Context, ContextPrecompiles, EvmWiring}; +use crate::{Context, ContextPrecompiles, EvmWiring, JournalEntry}; use bytecode::Bytecode; use precompile::PrecompileSpecId; use primitives::{BLOCKHASH_STORAGE_ADDRESS, U256}; @@ -105,6 +105,20 @@ pub fn deduct_caller( // deduct gas cost from caller's account. deduct_caller_inner::(caller_account.data, &context.evm.inner.env); + // Ensure tx kind is call + if context.evm.inner.env.tx.kind().is_call() { + // Push NonceChange entry + context + .evm + .inner + .journaled_state + .journal + .last_mut() + .unwrap() + .push(JournalEntry::NonceChange { + address: *context.evm.inner.env.tx.caller(), + }); + } Ok(()) }