Skip to content

Commit

Permalink
feat: push NonceChange to Journal in deduct_caller (#1804)
Browse files Browse the repository at this point in the history
  • Loading branch information
royvardhan authored Sep 25, 2024
1 parent e477c7f commit f8d8ae9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion crates/revm/src/handler/mainnet/pre_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -105,6 +105,20 @@ pub fn deduct_caller<EvmWiringT: EvmWiring, SPEC: Spec>(
// deduct gas cost from caller's account.
deduct_caller_inner::<EvmWiringT, SPEC>(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(())
}

Expand Down

0 comments on commit f8d8ae9

Please sign in to comment.