feat: add SealedBlock in reth-primitives-traits (#13735)

This commit is contained in:
Matthias Seitz
2025-01-15 02:12:43 +01:00
committed by GitHub
parent 1267718c7e
commit 83b2fb9b41
171 changed files with 3231 additions and 2866 deletions

View File

@ -3,6 +3,7 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
use alloy_consensus::BlockHeader;
use alloy_eips::{eip4895::Withdrawal, eip7685::Requests};
use alloy_sol_macro::sol;
use alloy_sol_types::SolCall;
@ -26,7 +27,7 @@ use reth_evm::execute::{
};
use reth_evm_ethereum::EthEvmConfig;
use reth_node_ethereum::{node::EthereumAddOns, BasicBlockExecutorProvider, EthereumNode};
use reth_primitives::{BlockWithSenders, EthPrimitives, Receipt};
use reth_primitives::{EthPrimitives, Receipt, RecoveredBlock};
use std::{fmt::Display, sync::Arc};
pub const SYSTEM_ADDRESS: Address = address!("fffffffffffffffffffffffffffffffffffffffe");
@ -125,10 +126,13 @@ where
type Primitives = EthPrimitives;
type Error = BlockExecutionError;
fn apply_pre_execution_changes(&mut self, block: &BlockWithSenders) -> Result<(), Self::Error> {
fn apply_pre_execution_changes(
&mut self,
block: &RecoveredBlock<reth_primitives::Block>,
) -> 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);
(*self.chain_spec).is_spurious_dragon_active_at_block(block.number());
self.state.set_state_clear_flag(state_clear_flag);
Ok(())
@ -136,19 +140,19 @@ where
fn execute_transactions(
&mut self,
_block: &BlockWithSenders,
_block: &RecoveredBlock<reth_primitives::Block>,
) -> Result<ExecuteOutput<Receipt>, Self::Error> {
Ok(ExecuteOutput { receipts: vec![], gas_used: 0 })
}
fn apply_post_execution_changes(
&mut self,
block: &BlockWithSenders,
block: &RecoveredBlock<reth_primitives::Block>,
_receipts: &[Receipt],
) -> Result<Requests, Self::Error> {
let mut evm = self.evm_config.evm_for_block(&mut self.state, &block.header);
let mut evm = self.evm_config.evm_for_block(&mut self.state, block.header());
if let Some(withdrawals) = block.body.withdrawals.as_ref() {
if let Some(withdrawals) = block.body().withdrawals.as_ref() {
apply_withdrawals_contract_call(withdrawals, &mut evm)?;
}