diff --git a/Cargo.lock b/Cargo.lock index 3b12780ecc..a70018cd9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8530,6 +8530,7 @@ dependencies = [ "reth-payload-util", "reth-payload-validator", "reth-primitives", + "reth-primitives-traits", "reth-provider", "reth-revm", "reth-rpc-server-types", diff --git a/crates/optimism/node/Cargo.toml b/crates/optimism/node/Cargo.toml index b833342282..3c3ebb5703 100644 --- a/crates/optimism/node/Cargo.toml +++ b/crates/optimism/node/Cargo.toml @@ -16,6 +16,7 @@ reth-chainspec.workspace = true reth-db.workspace = true reth-engine-local.workspace = true reth-primitives.workspace = true +reth-primitives-traits.workspace = true reth-payload-builder.workspace = true reth-payload-util.workspace = true reth-payload-validator.workspace = true @@ -110,25 +111,26 @@ js-tracer = [ "reth-node-builder/js-tracer" ] test-utils = [ - "reth-tasks", - "reth-e2e-test-utils", - "alloy-genesis", - "tokio", - "reth-node-builder/test-utils", - "reth-chainspec/test-utils", - "reth-consensus/test-utils", - "reth-evm/test-utils", - "reth-network/test-utils", - "reth-payload-builder/test-utils", - "reth-primitives/test-utils", - "reth-revm/test-utils", - "reth-db/test-utils", - "reth-provider/test-utils", - "reth-transaction-pool/test-utils", - "reth-trie-db/test-utils", - "revm/test-utils", - "reth-optimism-node/test-utils", - "reth-optimism-primitives/arbitrary", + "reth-tasks", + "reth-e2e-test-utils", + "alloy-genesis", + "tokio", + "reth-node-builder/test-utils", + "reth-chainspec/test-utils", + "reth-consensus/test-utils", + "reth-evm/test-utils", + "reth-network/test-utils", + "reth-payload-builder/test-utils", + "reth-primitives/test-utils", + "reth-revm/test-utils", + "reth-db/test-utils", + "reth-provider/test-utils", + "reth-transaction-pool/test-utils", + "reth-trie-db/test-utils", + "revm/test-utils", + "reth-optimism-node/test-utils", + "reth-optimism-primitives/arbitrary", + "reth-primitives-traits/test-utils" ] reth-codec = [ "reth-primitives/reth-codec", diff --git a/crates/optimism/node/src/txpool.rs b/crates/optimism/node/src/txpool.rs index 6ccc38c2d2..d07f402025 100644 --- a/crates/optimism/node/src/txpool.rs +++ b/crates/optimism/node/src/txpool.rs @@ -222,7 +222,11 @@ where self.validate_all(transactions) } - fn on_new_head_block(&self, new_tip_block: &SealedBlock) { + fn on_new_head_block(&self, new_tip_block: &SealedBlock) + where + H: reth_primitives_traits::BlockHeader, + B: BlockBody, + { self.inner.on_new_head_block(new_tip_block); self.update_l1_block_info( new_tip_block.header(), diff --git a/crates/transaction-pool/src/validate/eth.rs b/crates/transaction-pool/src/validate/eth.rs index a78578a322..4f768e6cd6 100644 --- a/crates/transaction-pool/src/validate/eth.rs +++ b/crates/transaction-pool/src/validate/eth.rs @@ -24,7 +24,7 @@ use alloy_eips::{ }; use reth_chainspec::{ChainSpec, EthereumHardforks}; use reth_primitives::{InvalidTransactionError, SealedBlock}; -use reth_primitives_traits::GotExpected; +use reth_primitives_traits::{BlockBody, GotExpected}; use reth_storage_api::{AccountReader, StateProviderFactory}; use reth_tasks::TaskSpawner; use std::{ @@ -106,7 +106,11 @@ where self.validate_all(transactions) } - fn on_new_head_block(&self, new_tip_block: &SealedBlock) { + fn on_new_head_block(&self, new_tip_block: &SealedBlock) + where + H: reth_primitives_traits::BlockHeader, + B: BlockBody, + { self.inner.on_new_head_block(new_tip_block.header()) } } diff --git a/crates/transaction-pool/src/validate/mod.rs b/crates/transaction-pool/src/validate/mod.rs index 40f2deeafe..cb8f98660c 100644 --- a/crates/transaction-pool/src/validate/mod.rs +++ b/crates/transaction-pool/src/validate/mod.rs @@ -26,6 +26,7 @@ pub use task::{TransactionValidationTaskExecutor, ValidationTask}; pub use constants::{ DEFAULT_MAX_TX_INPUT_BYTES, MAX_CODE_BYTE_SIZE, MAX_INIT_CODE_BYTE_SIZE, TX_SLOT_BYTE_SIZE, }; +use reth_primitives_traits::{BlockBody, BlockHeader}; /// A Result type returned after checking a transaction's validity. #[derive(Debug)] @@ -206,7 +207,12 @@ pub trait TransactionValidator: Send + Sync { /// Invoked when the head block changes. /// /// This can be used to update fork specific values (timestamp). - fn on_new_head_block(&self, _new_tip_block: &SealedBlock) {} + fn on_new_head_block(&self, _new_tip_block: &SealedBlock) + where + H: BlockHeader, + B: BlockBody, + { + } } impl TransactionValidator for Either @@ -237,7 +243,11 @@ where } } - fn on_new_head_block(&self, new_tip_block: &SealedBlock) { + fn on_new_head_block(&self, new_tip_block: &SealedBlock) + where + H: BlockHeader, + Body: BlockBody, + { match self { Self::Left(v) => v.on_new_head_block(new_tip_block), Self::Right(v) => v.on_new_head_block(new_tip_block), diff --git a/crates/transaction-pool/src/validate/task.rs b/crates/transaction-pool/src/validate/task.rs index 8bb592cf6a..766752ef4b 100644 --- a/crates/transaction-pool/src/validate/task.rs +++ b/crates/transaction-pool/src/validate/task.rs @@ -9,6 +9,7 @@ use crate::{ use futures_util::{lock::Mutex, StreamExt}; use reth_chainspec::ChainSpec; use reth_primitives::SealedBlock; +use reth_primitives_traits::{BlockBody, BlockHeader}; use reth_tasks::TaskSpawner; use std::{future::Future, pin::Pin, sync::Arc}; use tokio::{ @@ -205,7 +206,11 @@ where } } - fn on_new_head_block(&self, new_tip_block: &SealedBlock) { + fn on_new_head_block(&self, new_tip_block: &SealedBlock) + where + H: BlockHeader, + B: BlockBody, + { self.validator.on_new_head_block(new_tip_block) } }