diff --git a/Cargo.lock b/Cargo.lock index 9b816c131..978517f83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6629,6 +6629,7 @@ dependencies = [ "reth-node-events", "reth-node-metrics", "reth-primitives", + "reth-primitives-traits", "reth-provider", "reth-prune", "reth-prune-types", diff --git a/crates/cli/commands/Cargo.toml b/crates/cli/commands/Cargo.toml index 8cd60c318..7bf89c845 100644 --- a/crates/cli/commands/Cargo.toml +++ b/crates/cli/commands/Cargo.toml @@ -48,6 +48,7 @@ reth-static-file.workspace = true reth-trie = { workspace = true, features = ["metrics"] } reth-trie-db = { workspace = true, features = ["metrics"] } reth-trie-common = { workspace = true, optional = true } +reth-primitives-traits.workspace = true # ethereum alloy-eips.workspace = true @@ -109,4 +110,5 @@ arbitrary = [ "reth-stages-types?/arbitrary", "reth-trie-common?/arbitrary", "alloy-consensus/arbitrary", + "reth-primitives-traits/arbitrary", ] diff --git a/crates/cli/commands/src/init_state/without_evm.rs b/crates/cli/commands/src/init_state/without_evm.rs index 7f94a8168..56182dd14 100644 --- a/crates/cli/commands/src/init_state/without_evm.rs +++ b/crates/cli/commands/src/init_state/without_evm.rs @@ -4,6 +4,7 @@ use alloy_rlp::Decodable; use reth_codecs::Compact; use reth_node_builder::NodePrimitives; use reth_primitives::{SealedBlock, SealedHeader, StaticFileSegment}; +use reth_primitives_traits::SealedHeaderFor; use reth_provider::{ providers::StaticFileProvider, BlockWriter, StageCheckpointWriter, StaticFileProviderFactory, StaticFileWriter, StorageLocation, @@ -59,7 +60,7 @@ where /// height. fn append_first_block( provider_rw: &Provider, - header: &SealedHeader<::BlockHeader>, + header: &SealedHeaderFor, total_difficulty: U256, ) -> Result<(), eyre::Error> where diff --git a/crates/rpc/rpc/src/validation.rs b/crates/rpc/rpc/src/validation.rs index 787ad53d9..dbeeab40b 100644 --- a/crates/rpc/rpc/src/validation.rs +++ b/crates/rpc/rpc/src/validation.rs @@ -18,8 +18,10 @@ use reth_engine_primitives::PayloadValidator; use reth_errors::{BlockExecutionError, ConsensusError, ProviderError}; use reth_evm::execute::{BlockExecutorProvider, Executor}; use reth_metrics::{metrics, metrics::Gauge, Metrics}; -use reth_primitives::{GotExpected, NodePrimitives, RecoveredBlock, SealedHeader}; -use reth_primitives_traits::{constants::GAS_LIMIT_BOUND_DIVISOR, BlockBody, SealedBlock}; +use reth_primitives::{GotExpected, NodePrimitives, RecoveredBlock}; +use reth_primitives_traits::{ + constants::GAS_LIMIT_BOUND_DIVISOR, BlockBody, SealedBlock, SealedHeaderFor, +}; use reth_provider::{BlockExecutionOutput, BlockReaderIdExt, StateProviderFactory}; use reth_revm::{cached::CachedReads, database::StateProviderDatabase}; use reth_rpc_api::BlockSubmissionValidationApiServer; @@ -144,7 +146,6 @@ where } self.consensus.validate_header_against_parent(block.sealed_header(), &latest_header)?; self.validate_gas_limit(registered_gas_limit, &latest_header, block.sealed_header())?; - let latest_header_hash = latest_header.hash(); let state_provider = self.provider.state_by_block_hash(latest_header_hash)?; @@ -191,10 +192,10 @@ where Ok(()) } - /// Ensures that fields of [`BidTrace`] match the fields of the [`SealedHeader`]. + /// Ensures that fields of [`BidTrace`] match the fields of the [`SealedHeaderFor`]. fn validate_message_against_header( &self, - header: &SealedHeader<::BlockHeader>, + header: &SealedHeaderFor, message: &BidTrace, ) -> Result<(), ValidationApiError> { if header.hash() != message.block_hash { @@ -229,8 +230,8 @@ where fn validate_gas_limit( &self, registered_gas_limit: u64, - parent_header: &SealedHeader<::BlockHeader>, - header: &SealedHeader<::BlockHeader>, + parent_header: &SealedHeaderFor, + header: &SealedHeaderFor, ) -> Result<(), ValidationApiError> { let max_gas_limit = parent_header.gas_limit() + parent_header.gas_limit() / GAS_LIMIT_BOUND_DIVISOR - 1;