Skip to content

Commit

Permalink
chore: remove Block generic from apply_pre_execution_changes (#13743)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected authored Jan 9, 2025
1 parent ceaa3d3 commit fd092a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion crates/engine/invalid-block-hooks/src/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ where
SystemCaller::new(self.evm_config.clone(), self.provider.chain_spec());

// Apply pre-block system contract calls.
system_caller.apply_pre_execution_changes(&block.clone().unseal().block, &mut evm)?;
system_caller.apply_pre_execution_changes(block.header(), &mut evm)?;

// Re-execute all of the transactions in the block to load all touched accounts into
// the cache DB.
Expand Down
8 changes: 4 additions & 4 deletions crates/ethereum/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
EthEvmConfig,
};
use alloc::{boxed::Box, sync::Arc, vec::Vec};
use alloy_consensus::Transaction as _;
use alloy_consensus::Transaction;
use alloy_eips::{eip6110, eip7685::Requests};
use core::fmt::Display;
use reth_chainspec::{ChainSpec, EthereumHardfork, EthereumHardforks, MAINNET};
Expand Down Expand Up @@ -116,14 +116,14 @@ where
impl<DB, EvmConfig> EthExecutionStrategy<DB, EvmConfig>
where
DB: Database<Error: Into<ProviderError> + Display>,
EvmConfig: ConfigureEvm<Header = alloy_consensus::Header>,
EvmConfig: ConfigureEvm,
{
/// Configures a new evm configuration and block environment for the given block.
///
/// # Caution
///
/// This does not initialize the tx environment.
fn evm_env_for_block(&self, header: &alloy_consensus::Header) -> EnvWithHandlerCfg {
fn evm_env_for_block(&self, header: &EvmConfig::Header) -> EnvWithHandlerCfg {
let EvmEnv { cfg_env_with_handler_cfg, block_env } =
self.evm_config.cfg_and_block_env(header);
EnvWithHandlerCfg::new_with_cfg_env(cfg_env_with_handler_cfg, block_env, Default::default())
Expand Down Expand Up @@ -156,7 +156,7 @@ where
let env = self.evm_env_for_block(&block.header);
let mut evm = self.evm_config.evm_with_env(&mut self.state, env);

self.system_caller.apply_pre_execution_changes(&block.block, &mut evm)?;
self.system_caller.apply_pre_execution_changes(&block.header, &mut evm)?;

Ok(())
}
Expand Down
17 changes: 8 additions & 9 deletions crates/evm/src/system_calls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,25 @@ where
Chainspec: EthereumHardforks,
{
/// Apply pre execution changes.
pub fn apply_pre_execution_changes<DB, Ext, Block>(
pub fn apply_pre_execution_changes<DB, Ext>(
&mut self,
block: &Block,
header: &EvmConfig::Header,
evm: &mut Evm<'_, Ext, DB>,
) -> Result<(), BlockExecutionError>
where
DB: Database + DatabaseCommit,
DB::Error: Display,
Block: reth_primitives_traits::Block<Header = EvmConfig::Header>,
{
self.apply_blockhashes_contract_call(
block.header().timestamp(),
block.header().number(),
block.header().parent_hash(),
header.timestamp(),
header.number(),
header.parent_hash(),
evm,
)?;
self.apply_beacon_root_contract_call(
block.header().timestamp(),
block.header().number(),
block.header().parent_beacon_block_root(),
header.timestamp(),
header.number(),
header.parent_beacon_block_root(),
evm,
)?;

Expand Down

0 comments on commit fd092a2

Please sign in to comment.