From 2d2d132d3d674f150e762b1dcb2c82e13635b481 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 12 Dec 2024 14:54:39 +0100 Subject: [PATCH 1/2] wip: relax on new head --- crates/optimism/node/src/txpool.rs | 8 +++++++- crates/transaction-pool/src/validate/eth.rs | 8 ++++++-- crates/transaction-pool/src/validate/mod.rs | 8 +++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/crates/optimism/node/src/txpool.rs b/crates/optimism/node/src/txpool.rs index a3e474a60760..34eb91ac04d7 100644 --- a/crates/optimism/node/src/txpool.rs +++ b/crates/optimism/node/src/txpool.rs @@ -2,6 +2,8 @@ use alloy_eips::eip2718::Encodable2718; use parking_lot::RwLock; use reth_chainspec::ChainSpec; +use reth_node_api::BlockBody; +use reth_node_core::primitives::BlockHeader; use reth_optimism_evm::RethL1BlockInfo; use reth_primitives::{ Block, GotExpected, InvalidTransactionError, SealedBlock, TransactionSigned, @@ -215,7 +217,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: BlockHeader, + B: BlockBody, + { self.inner.on_new_head_block(new_tip_block); self.update_l1_block_info(&new_tip_block.clone().unseal()); } diff --git a/crates/transaction-pool/src/validate/eth.rs b/crates/transaction-pool/src/validate/eth.rs index 3c93b384c734..e68d54b79a64 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 40f2deeafe83..2bf64a296dd0 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 From dbd7688e2051de918acaa9e4254357590340db11 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 13 Dec 2024 14:45:19 +0100 Subject: [PATCH 2/2] features --- crates/optimism/node/Cargo.toml | 39 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/crates/optimism/node/Cargo.toml b/crates/optimism/node/Cargo.toml index 99a36276aeee..3c3ebb57039f 100644 --- a/crates/optimism/node/Cargo.toml +++ b/crates/optimism/node/Cargo.toml @@ -111,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",