feat(ethereum-forks): remove total difficulty for hardfork check (#13362)

Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
This commit is contained in:
Kunal Arora
2024-12-20 20:58:05 +05:30
committed by GitHub
parent dc6394b05b
commit 82af170687
44 changed files with 382 additions and 646 deletions

View File

@ -129,12 +129,8 @@ where
/// # Caution
///
/// This does not initialize the tx environment.
fn evm_env_for_block(
&self,
header: &alloy_consensus::Header,
total_difficulty: U256,
) -> EnvWithHandlerCfg {
let evm_env = self.evm_config.cfg_and_block_env(header, total_difficulty);
fn evm_env_for_block(&self, header: &alloy_consensus::Header) -> EnvWithHandlerCfg {
let evm_env = self.evm_config.cfg_and_block_env(header);
let EvmEnv { cfg_env_with_handler_cfg, block_env } = evm_env;
EnvWithHandlerCfg::new_with_cfg_env(cfg_env_with_handler_cfg, block_env, Default::default())
}
@ -148,11 +144,7 @@ where
type Primitives = EthPrimitives;
type Error = BlockExecutionError;
fn apply_pre_execution_changes(
&mut self,
block: &BlockWithSenders,
_total_difficulty: U256,
) -> Result<(), Self::Error> {
fn apply_pre_execution_changes(&mut self, block: &BlockWithSenders) -> Result<(), Self::Error> {
// Set state clear flag if the block is after the Spurious Dragon hardfork.
let state_clear_flag =
(*self.chain_spec).is_spurious_dragon_active_at_block(block.header.number);
@ -164,7 +156,6 @@ where
fn execute_transactions(
&mut self,
_block: &BlockWithSenders,
_total_difficulty: U256,
) -> Result<ExecuteOutput<Receipt>, Self::Error> {
Ok(ExecuteOutput { receipts: vec![], gas_used: 0 })
}
@ -172,10 +163,9 @@ where
fn apply_post_execution_changes(
&mut self,
block: &BlockWithSenders,
total_difficulty: U256,
_receipts: &[Receipt],
) -> Result<Requests, Self::Error> {
let env = self.evm_env_for_block(&block.header, total_difficulty);
let env = self.evm_env_for_block(&block.header);
let mut evm = self.evm_config.evm_with_env(&mut self.state, env);
if let Some(withdrawals) = block.body.withdrawals.as_ref() {