Skip to content

Commit

Permalink
fix(eip2935): Preload blockchash storage address (bluealloy#1395)
Browse files Browse the repository at this point in the history
  • Loading branch information
rakita authored May 11, 2024
1 parent 7286dc5 commit aeefcda
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions crates/revm/src/handler/mainnet/pre_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::{
primitives::{
db::Database,
Account, EVMError, Env, Spec,
SpecId::{CANCUN, SHANGHAI},
TransactTo, U256,
SpecId::{CANCUN, PRAGUE, SHANGHAI},
TransactTo, BLOCKHASH_STORAGE_ADDRESS, U256,
},
Context, ContextPrecompiles,
};
Expand Down Expand Up @@ -39,6 +39,16 @@ pub fn load_accounts<SPEC: Spec, EXT, DB: Database>(
)?;
}

// Load blockhash storage address
// EIP-2935: Serve historical block hashes from state
if SPEC::enabled(PRAGUE) {
context.evm.inner.journaled_state.initial_account_load(
BLOCKHASH_STORAGE_ADDRESS,
&[],
&mut context.evm.inner.db,
)?;
}

context.evm.load_access_list()?;
Ok(())
}
Expand Down

0 comments on commit aeefcda

Please sign in to comment.