From 39f89aa587b3abd1c0a9c378dcdd4a6224bde883 Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Mon, 28 Oct 2024 17:30:34 +0700 Subject: [PATCH 01/13] bet --- .../rpc-types-compat/src/transaction/mod.rs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/rpc/rpc-types-compat/src/transaction/mod.rs b/crates/rpc/rpc-types-compat/src/transaction/mod.rs index f8b46454dc23..075646510176 100644 --- a/crates/rpc/rpc-types-compat/src/transaction/mod.rs +++ b/crates/rpc/rpc-types-compat/src/transaction/mod.rs @@ -160,3 +160,25 @@ pub fn transaction_to_call_request(tx: TransactionSignedEcRecovered) -> Transact authorization_list, } } + +/// Convert [`reth_primitives::TxType`] to [`alloy_consensus::TxType`] +pub const fn tx_type_to_alloy(tx_type: TxType) -> alloy_consensus::TxType { + match tx_type { + TxType::Legacy => alloy_consensus::TxType::Legacy, + TxType::Eip2930 => alloy_consensus::TxType::Eip2930, + TxType::Eip1559 => alloy_consensus::TxType::Eip1559, + TxType::Eip4844 => alloy_consensus::TxType::Eip4844, + TxType::Eip7702 => alloy_consensus::TxType::Eip7702, + } +} + +/// Convert [`alloy_consensus::TxType`] to [`reth_primitives::TxType`] +pub const fn tx_type_from_alloy(tx_type: alloy_consensus::TxType) -> TxType { + match tx_type { + alloy_consensus::TxType::Legacy => TxType::Legacy, + alloy_consensus::TxType::Eip2930 => TxType::Eip2930, + alloy_consensus::TxType::Eip1559 => TxType::Eip1559, + alloy_consensus::TxType::Eip4844 => TxType::Eip4844, + alloy_consensus::TxType::Eip7702 => TxType::Eip7702, + } +} \ No newline at end of file From 5cc82b6acdfacbdc910101d579d5fdab1586b45a Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Mon, 28 Oct 2024 17:37:43 +0700 Subject: [PATCH 02/13] lint --- crates/rpc/rpc-types-compat/src/transaction/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rpc/rpc-types-compat/src/transaction/mod.rs b/crates/rpc/rpc-types-compat/src/transaction/mod.rs index 075646510176..ae13d6e2e024 100644 --- a/crates/rpc/rpc-types-compat/src/transaction/mod.rs +++ b/crates/rpc/rpc-types-compat/src/transaction/mod.rs @@ -181,4 +181,4 @@ pub const fn tx_type_from_alloy(tx_type: alloy_consensus::TxType) -> TxType { alloy_consensus::TxType::Eip4844 => TxType::Eip4844, alloy_consensus::TxType::Eip7702 => TxType::Eip7702, } -} \ No newline at end of file +} From bff715a83066250c5e53a6b91fd7424d11a10511 Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Tue, 29 Oct 2024 00:17:05 +0700 Subject: [PATCH 03/13] refactor --- crates/rpc/rpc-types-compat/Cargo.toml | 5 ++++- .../rpc-types-compat/src/transaction/mod.rs | 20 ++++--------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/crates/rpc/rpc-types-compat/Cargo.toml b/crates/rpc/rpc-types-compat/Cargo.toml index 7d5eac9dbb91..006845484caf 100644 --- a/crates/rpc/rpc-types-compat/Cargo.toml +++ b/crates/rpc/rpc-types-compat/Cargo.toml @@ -30,4 +30,7 @@ alloy-consensus.workspace = true serde.workspace = true [dev-dependencies] -serde_json.workspace = true \ No newline at end of file +serde_json.workspace = true + +[features] +optimism = [] \ No newline at end of file diff --git a/crates/rpc/rpc-types-compat/src/transaction/mod.rs b/crates/rpc/rpc-types-compat/src/transaction/mod.rs index ae13d6e2e024..1264b0e01292 100644 --- a/crates/rpc/rpc-types-compat/src/transaction/mod.rs +++ b/crates/rpc/rpc-types-compat/src/transaction/mod.rs @@ -162,23 +162,11 @@ pub fn transaction_to_call_request(tx: TransactionSignedEcRecovered) -> Transact } /// Convert [`reth_primitives::TxType`] to [`alloy_consensus::TxType`] -pub const fn tx_type_to_alloy(tx_type: TxType) -> alloy_consensus::TxType { - match tx_type { - TxType::Legacy => alloy_consensus::TxType::Legacy, - TxType::Eip2930 => alloy_consensus::TxType::Eip2930, - TxType::Eip1559 => alloy_consensus::TxType::Eip1559, - TxType::Eip4844 => alloy_consensus::TxType::Eip4844, - TxType::Eip7702 => alloy_consensus::TxType::Eip7702, - } +pub fn tx_type_to_alloy(tx_type: TxType) -> alloy_consensus::TxType { + Into::::into(tx_type).try_into().unwrap() } /// Convert [`alloy_consensus::TxType`] to [`reth_primitives::TxType`] -pub const fn tx_type_from_alloy(tx_type: alloy_consensus::TxType) -> TxType { - match tx_type { - alloy_consensus::TxType::Legacy => TxType::Legacy, - alloy_consensus::TxType::Eip2930 => TxType::Eip2930, - alloy_consensus::TxType::Eip1559 => TxType::Eip1559, - alloy_consensus::TxType::Eip4844 => TxType::Eip4844, - alloy_consensus::TxType::Eip7702 => TxType::Eip7702, - } +pub fn tx_type_from_alloy(tx_type: alloy_consensus::TxType) -> TxType { + Into::::into(tx_type).try_into().unwrap() } From 6cef5eabcf475bf3761c8b60366b51ab354ced40 Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Tue, 29 Oct 2024 00:26:48 +0700 Subject: [PATCH 04/13] remove feature --- crates/rpc/rpc-types-compat/Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/crates/rpc/rpc-types-compat/Cargo.toml b/crates/rpc/rpc-types-compat/Cargo.toml index 006845484caf..a7b1fa4fedfc 100644 --- a/crates/rpc/rpc-types-compat/Cargo.toml +++ b/crates/rpc/rpc-types-compat/Cargo.toml @@ -31,6 +31,3 @@ serde.workspace = true [dev-dependencies] serde_json.workspace = true - -[features] -optimism = [] \ No newline at end of file From a3d6279024087e48f9766b6023cb90a0f4e10b1e Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Tue, 29 Oct 2024 16:06:06 +0700 Subject: [PATCH 05/13] add comment, refactor conversion --- crates/rpc/rpc-types-compat/src/transaction/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/rpc/rpc-types-compat/src/transaction/mod.rs b/crates/rpc/rpc-types-compat/src/transaction/mod.rs index 1264b0e01292..f0deb1686315 100644 --- a/crates/rpc/rpc-types-compat/src/transaction/mod.rs +++ b/crates/rpc/rpc-types-compat/src/transaction/mod.rs @@ -162,11 +162,12 @@ pub fn transaction_to_call_request(tx: TransactionSignedEcRecovered) -> Transact } /// Convert [`reth_primitives::TxType`] to [`alloy_consensus::TxType`] +/// Will panics if the `TxType` is `TxType::Deposit` (when optimism feature is enabled) pub fn tx_type_to_alloy(tx_type: TxType) -> alloy_consensus::TxType { - Into::::into(tx_type).try_into().unwrap() + u8::from(tx_type).try_into().unwrap() } /// Convert [`alloy_consensus::TxType`] to [`reth_primitives::TxType`] pub fn tx_type_from_alloy(tx_type: alloy_consensus::TxType) -> TxType { - Into::::into(tx_type).try_into().unwrap() + u8::from(tx_type).try_into().unwrap() } From 25b2bc32153c1ddb7c9f7f41bf3a0708fb226b27 Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Tue, 29 Oct 2024 16:33:46 +0700 Subject: [PATCH 06/13] change comment --- crates/rpc/rpc-types-compat/src/transaction/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rpc/rpc-types-compat/src/transaction/mod.rs b/crates/rpc/rpc-types-compat/src/transaction/mod.rs index f0deb1686315..0e80ddcf789b 100644 --- a/crates/rpc/rpc-types-compat/src/transaction/mod.rs +++ b/crates/rpc/rpc-types-compat/src/transaction/mod.rs @@ -162,7 +162,7 @@ pub fn transaction_to_call_request(tx: TransactionSignedEcRecovered) -> Transact } /// Convert [`reth_primitives::TxType`] to [`alloy_consensus::TxType`] -/// Will panics if the `TxType` is `TxType::Deposit` (when optimism feature is enabled) +/// Will panics if the `TxType` is `TxType::Deposit` (Optimism Deposit transaction) pub fn tx_type_to_alloy(tx_type: TxType) -> alloy_consensus::TxType { u8::from(tx_type).try_into().unwrap() } From ebe3d3a63a440a97b0ceb3f79743629a564eecb0 Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Wed, 30 Oct 2024 22:48:00 +0700 Subject: [PATCH 07/13] bet --- Cargo.lock | 4 +++ crates/net/downloaders/Cargo.toml | 1 + crates/net/downloaders/src/bodies/bodies.rs | 1 + crates/net/downloaders/src/bodies/request.rs | 1 + crates/net/p2p/Cargo.toml | 2 +- crates/net/p2p/src/bodies/response.rs | 21 +++++++------ crates/primitives-traits/src/header/sealed.rs | 6 +++- crates/primitives-traits/src/lib.rs | 4 +++ crates/primitives-traits/src/size.rs | 5 +++ crates/primitives/src/block.rs | 23 +++++++++----- crates/primitives/src/transaction/mod.rs | 31 ++++++++++--------- crates/prune/prune/Cargo.toml | 1 + .../src/segments/user/receipts_by_logs.rs | 4 ++- crates/transaction-pool/Cargo.toml | 1 + crates/transaction-pool/src/lib.rs | 1 + .../transaction-pool/src/test_utils/mock.rs | 4 ++- 16 files changed, 75 insertions(+), 35 deletions(-) create mode 100644 crates/primitives-traits/src/size.rs diff --git a/Cargo.lock b/Cargo.lock index 6762da237cd6..3cbc9da1a0bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7014,6 +7014,7 @@ dependencies = [ "reth-network-p2p", "reth-network-peers", "reth-primitives", + "reth-primitives-traits", "reth-provider", "reth-storage-api", "reth-tasks", @@ -7797,6 +7798,7 @@ dependencies = [ "reth-network-peers", "reth-network-types", "reth-primitives", + "reth-primitives-traits", "reth-storage-errors", "tokio", "tracing", @@ -8534,6 +8536,7 @@ dependencies = [ "reth-errors", "reth-exex-types", "reth-metrics", + "reth-primitives-traits", "reth-provider", "reth-prune-types", "reth-stages", @@ -9156,6 +9159,7 @@ dependencies = [ "reth-fs-util", "reth-metrics", "reth-primitives", + "reth-primitives-traits", "reth-provider", "reth-storage-api", "reth-tasks", diff --git a/crates/net/downloaders/Cargo.toml b/crates/net/downloaders/Cargo.toml index 272db6fc6d1c..27eb3c84a187 100644 --- a/crates/net/downloaders/Cargo.toml +++ b/crates/net/downloaders/Cargo.toml @@ -18,6 +18,7 @@ reth-consensus.workspace = true reth-network-p2p.workspace = true reth-network-peers.workspace = true reth-primitives.workspace = true +reth-primitives-traits.workspace = true reth-storage-api.workspace = true reth-tasks.workspace = true diff --git a/crates/net/downloaders/src/bodies/bodies.rs b/crates/net/downloaders/src/bodies/bodies.rs index 314f3a09084c..408dc2549713 100644 --- a/crates/net/downloaders/src/bodies/bodies.rs +++ b/crates/net/downloaders/src/bodies/bodies.rs @@ -14,6 +14,7 @@ use reth_network_p2p::{ error::{DownloadError, DownloadResult}, }; use reth_primitives::SealedHeader; +use reth_primitives_traits::size::HeuristicSize; use reth_storage_api::HeaderProvider; use reth_tasks::{TaskSpawner, TokioTaskExecutor}; use std::{ diff --git a/crates/net/downloaders/src/bodies/request.rs b/crates/net/downloaders/src/bodies/request.rs index c2b36732b51d..01494cddd8d0 100644 --- a/crates/net/downloaders/src/bodies/request.rs +++ b/crates/net/downloaders/src/bodies/request.rs @@ -9,6 +9,7 @@ use reth_network_p2p::{ }; use reth_network_peers::{PeerId, WithPeerId}; use reth_primitives::{BlockBody, GotExpected, SealedBlock, SealedHeader}; +use reth_primitives_traits::HeuristicSize; use std::{ collections::VecDeque, mem, diff --git a/crates/net/p2p/Cargo.toml b/crates/net/p2p/Cargo.toml index 3b6d74c9dbeb..1d98dffe8221 100644 --- a/crates/net/p2p/Cargo.toml +++ b/crates/net/p2p/Cargo.toml @@ -14,6 +14,7 @@ workspace = true [dependencies] # reth reth-primitives.workspace = true +reth-primitives-traits.workspace = true reth-eth-wire-types.workspace = true reth-consensus.workspace = true reth-network-peers.workspace = true @@ -32,7 +33,6 @@ tokio = { workspace = true, features = ["sync"] } auto_impl.workspace = true tracing.workspace = true derive_more.workspace = true - parking_lot = { workspace = true, optional = true } [dev-dependencies] diff --git a/crates/net/p2p/src/bodies/response.rs b/crates/net/p2p/src/bodies/response.rs index 8ae840fbf669..fce08096493a 100644 --- a/crates/net/p2p/src/bodies/response.rs +++ b/crates/net/p2p/src/bodies/response.rs @@ -1,5 +1,6 @@ use alloy_primitives::{BlockNumber, U256}; use reth_primitives::{SealedBlock, SealedHeader}; +use reth_primitives_traits::HeuristicSize; /// The block response #[derive(PartialEq, Eq, Debug, Clone)] @@ -19,15 +20,6 @@ impl BlockResponse { } } - /// Calculates a heuristic for the in-memory size of the [`BlockResponse`]. - #[inline] - pub fn size(&self) -> usize { - match self { - Self::Full(block) => SealedBlock::size(block), - Self::Empty(header) => SealedHeader::size(header), - } - } - /// Return the block number pub fn block_number(&self) -> BlockNumber { self.header().number @@ -41,3 +33,14 @@ impl BlockResponse { } } } + +impl HeuristicSize for BlockResponse { + /// Calculates a heuristic for the in-memory size of the [`BlockResponse`]. + #[inline] + fn size(&self) -> usize { + match self { + Self::Full(block) => SealedBlock::size(block), + Self::Empty(header) => SealedHeader::size(header), + } + } +} diff --git a/crates/primitives-traits/src/header/sealed.rs b/crates/primitives-traits/src/header/sealed.rs index 7119a37e742a..c6420ec23992 100644 --- a/crates/primitives-traits/src/header/sealed.rs +++ b/crates/primitives-traits/src/header/sealed.rs @@ -1,3 +1,5 @@ +use crate::HeuristicSize; + use super::Header; use alloy_eips::BlockNumHash; use alloy_primitives::{keccak256, BlockHash, Sealable}; @@ -58,10 +60,12 @@ impl SealedHeader { pub fn num_hash(&self) -> BlockNumHash { BlockNumHash::new(self.number, self.hash) } +} +impl HeuristicSize for SealedHeader { /// Calculates a heuristic for the in-memory size of the [`SealedHeader`]. #[inline] - pub fn size(&self) -> usize { + fn size(&self) -> usize { self.header.size() + mem::size_of::() } } diff --git a/crates/primitives-traits/src/lib.rs b/crates/primitives-traits/src/lib.rs index 57d1119b0351..35617cae4f0a 100644 --- a/crates/primitives-traits/src/lib.rs +++ b/crates/primitives-traits/src/lib.rs @@ -61,3 +61,7 @@ pub use header::{BlockHeader, Header, HeaderError, SealedHeader}; pub mod serde_bincode_compat { pub use super::header::{serde_bincode_compat as header, serde_bincode_compat::*}; } + +/// Heuristic size trait +pub mod size; +pub use size::HeuristicSize; diff --git a/crates/primitives-traits/src/size.rs b/crates/primitives-traits/src/size.rs new file mode 100644 index 000000000000..c8975054743d --- /dev/null +++ b/crates/primitives-traits/src/size.rs @@ -0,0 +1,5 @@ +/// Trait for calculating a heuristic for the in-memory size of a struct. +pub trait HeuristicSize { + /// Returns a heuristic for the in-memory size of a struct. + fn size(&self) -> usize; +} diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index a06979300acd..b1c357f75b17 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -11,6 +11,7 @@ use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable}; use derive_more::{Deref, DerefMut}; #[cfg(any(test, feature = "arbitrary"))] pub use reth_primitives_traits::test_utils::{generate_valid_header, valid_header_strategy}; +use reth_primitives_traits::HeuristicSize; use serde::{Deserialize, Serialize}; /// Ethereum full block. @@ -89,10 +90,12 @@ impl Block { let senders = self.senders()?; Some(BlockWithSenders { block: self, senders }) } +} +impl HeuristicSize for Block { /// Calculates a heuristic for the in-memory size of the [`Block`]. #[inline] - pub fn size(&self) -> usize { + fn size(&self) -> usize { self.header.size() + self.body.size() } } @@ -380,12 +383,6 @@ impl SealedBlock { Block { header: self.header.unseal(), body: self.body } } - /// Calculates a heuristic for the in-memory size of the [`SealedBlock`]. - #[inline] - pub fn size(&self) -> usize { - self.header.size() + self.body.size() - } - /// Calculates the total gas used by blob transactions in the sealed block. pub fn blob_gas_used(&self) -> u64 { self.blob_transactions().iter().filter_map(|tx| tx.blob_gas_used()).sum() @@ -435,6 +432,14 @@ impl SealedBlock { } } +impl HeuristicSize for SealedBlock { + /// Calculates a heuristic for the in-memory size of the [`SealedBlock`]. + #[inline] + fn size(&self) -> usize { + self.header.size() + self.body.size() + } +} + impl From for Block { fn from(block: SealedBlock) -> Self { block.unseal() @@ -608,10 +613,12 @@ impl BlockBody { pub fn transactions(&self) -> impl Iterator + '_ { self.transactions.iter() } +} +impl HeuristicSize for BlockBody { /// Calculates a heuristic for the in-memory size of the [`BlockBody`]. #[inline] - pub fn size(&self) -> usize { + fn size(&self) -> usize { self.transactions.iter().map(TransactionSigned::size).sum::() + self.transactions.capacity() * core::mem::size_of::() + self.ommers.iter().map(Header::size).sum::() + diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index 3a5c3674166c..55fc8829c4e4 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -19,6 +19,7 @@ use once_cell as _; #[cfg(not(feature = "std"))] use once_cell::sync::Lazy as LazyLock; use rayon::prelude::{IntoParallelIterator, ParallelIterator}; +use reth_primitives_traits::HeuristicSize; use serde::{Deserialize, Serialize}; use signature::{decode_with_eip155_chain_id, with_eip155_parity}; #[cfg(feature = "std")] @@ -486,20 +487,6 @@ impl Transaction { } } - /// Calculates a heuristic for the in-memory size of the [Transaction]. - #[inline] - pub fn size(&self) -> usize { - match self { - Self::Legacy(tx) => tx.size(), - Self::Eip2930(tx) => tx.size(), - Self::Eip1559(tx) => tx.size(), - Self::Eip4844(tx) => tx.size(), - Self::Eip7702(tx) => tx.size(), - #[cfg(feature = "optimism")] - Self::Deposit(tx) => tx.size(), - } - } - /// Returns true if the transaction is a legacy transaction. #[inline] pub const fn is_legacy(&self) -> bool { @@ -571,6 +558,22 @@ impl Transaction { } } +impl HeuristicSize for Transaction { + /// Calculates a heuristic for the in-memory size of the [Transaction]. + #[inline] + fn size(&self) -> usize { + match self { + Self::Legacy(tx) => tx.size(), + Self::Eip2930(tx) => tx.size(), + Self::Eip1559(tx) => tx.size(), + Self::Eip4844(tx) => tx.size(), + Self::Eip7702(tx) => tx.size(), + #[cfg(feature = "optimism")] + Self::Deposit(tx) => tx.size(), + } + } +} + #[cfg(any(test, feature = "reth-codec"))] impl reth_codecs::Compact for Transaction { // Serializes the TxType to the buffer if necessary, returning 2 bits of the type as an diff --git a/crates/prune/prune/Cargo.toml b/crates/prune/prune/Cargo.toml index 2f2a37d5ba66..a420ccf63cb4 100644 --- a/crates/prune/prune/Cargo.toml +++ b/crates/prune/prune/Cargo.toml @@ -21,6 +21,7 @@ reth-errors.workspace = true reth-provider.workspace = true reth-tokio-util.workspace = true reth-config.workspace = true +reth-primitives-traits.workspace = true reth-prune-types.workspace = true reth-static-file-types.workspace = true diff --git a/crates/prune/prune/src/segments/user/receipts_by_logs.rs b/crates/prune/prune/src/segments/user/receipts_by_logs.rs index ee2accee1b34..ce0c77bb4cc3 100644 --- a/crates/prune/prune/src/segments/user/receipts_by_logs.rs +++ b/crates/prune/prune/src/segments/user/receipts_by_logs.rs @@ -4,13 +4,14 @@ use crate::{ PrunerError, }; use reth_db::{tables, transaction::DbTxMut}; +#[allow(unused_imports)] +use reth_primitives_traits::HeuristicSize; use reth_provider::{BlockReader, DBProvider, PruneCheckpointWriter, TransactionsProvider}; use reth_prune_types::{ PruneCheckpoint, PruneMode, PruneProgress, PrunePurpose, PruneSegment, ReceiptsLogPruneConfig, SegmentOutput, MINIMUM_PRUNING_DISTANCE, }; use tracing::{instrument, trace}; - #[derive(Debug)] pub struct ReceiptsByLogs { config: ReceiptsLogPruneConfig, @@ -223,6 +224,7 @@ mod tests { use assert_matches::assert_matches; use reth_db::tables; use reth_db_api::{cursor::DbCursorRO, transaction::DbTx}; + use reth_primitives_traits::HeuristicSize; use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader, TransactionsProvider}; use reth_prune_types::{PruneLimiter, PruneMode, PruneSegment, ReceiptsLogPruneConfig}; use reth_stages::test_utils::{StorageKind, TestStageDB}; diff --git a/crates/transaction-pool/Cargo.toml b/crates/transaction-pool/Cargo.toml index 1bfb10d86d77..7447c63318d6 100644 --- a/crates/transaction-pool/Cargo.toml +++ b/crates/transaction-pool/Cargo.toml @@ -17,6 +17,7 @@ reth-chain-state.workspace = true reth-chainspec.workspace = true reth-eth-wire-types.workspace = true reth-primitives = { workspace = true, features = ["c-kzg", "secp256k1"] } +reth-primitives-traits.workspace = true reth-execution-types.workspace = true reth-fs-util.workspace = true reth-storage-api.workspace = true diff --git a/crates/transaction-pool/src/lib.rs b/crates/transaction-pool/src/lib.rs index 2cffcd33fa8b..caef7b947b4e 100644 --- a/crates/transaction-pool/src/lib.rs +++ b/crates/transaction-pool/src/lib.rs @@ -157,6 +157,7 @@ use aquamarine as _; use reth_eth_wire_types::HandleMempoolData; use reth_execution_types::ChangedAccount; use reth_primitives::{BlobTransactionSidecar, PooledTransactionsElement}; +use reth_primitives_traits as _; use reth_storage_api::StateProviderFactory; use std::{collections::HashSet, sync::Arc}; use tokio::sync::mpsc::Receiver; diff --git a/crates/transaction-pool/src/test_utils/mock.rs b/crates/transaction-pool/src/test_utils/mock.rs index a3cddaf0a71b..fd8fd2ab678b 100644 --- a/crates/transaction-pool/src/test_utils/mock.rs +++ b/crates/transaction-pool/src/test_utils/mock.rs @@ -23,9 +23,11 @@ use reth_primitives::{ BlobTransactionValidationError, PooledTransactionsElementEcRecovered, Signature, Transaction, TransactionSigned, TransactionSignedEcRecovered, TxType, }; - use std::{ops::Range, sync::Arc, time::Instant, vec::IntoIter}; +#[cfg(any(test, feature = "arbitrary"))] +use reth_primitives_traits::HeuristicSize; + /// A transaction pool implementation using [`MockOrdering`] for transaction ordering. /// /// This type is an alias for [`TxPool`]. From 081d3f1d591cc173241f05139410c141f18502c0 Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Wed, 30 Oct 2024 23:17:23 +0700 Subject: [PATCH 08/13] fix feature propagation --- crates/net/downloaders/Cargo.toml | 3 ++- crates/net/p2p/Cargo.toml | 6 ++++-- crates/transaction-pool/Cargo.toml | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/net/downloaders/Cargo.toml b/crates/net/downloaders/Cargo.toml index 27eb3c84a187..69a59f698de8 100644 --- a/crates/net/downloaders/Cargo.toml +++ b/crates/net/downloaders/Cargo.toml @@ -81,5 +81,6 @@ test-utils = [ "reth-chainspec/test-utils", "reth-primitives/test-utils", "reth-db-api?/test-utils", - "reth-provider/test-utils" + "reth-provider/test-utils", + "reth-primitives-traits/test-utils" ] diff --git a/crates/net/p2p/Cargo.toml b/crates/net/p2p/Cargo.toml index 1d98dffe8221..89855396925d 100644 --- a/crates/net/p2p/Cargo.toml +++ b/crates/net/p2p/Cargo.toml @@ -47,11 +47,13 @@ test-utils = [ "reth-consensus/test-utils", "parking_lot", "reth-network-types/test-utils", - "reth-primitives/test-utils" + "reth-primitives/test-utils", + "reth-primitives-traits/test-utils" ] std = [ "reth-consensus/std", "reth-primitives/std", "alloy-eips/std", - "alloy-primitives/std" + "alloy-primitives/std", + "reth-primitives-traits/std" ] diff --git a/crates/transaction-pool/Cargo.toml b/crates/transaction-pool/Cargo.toml index 7447c63318d6..2e6aef2b63f9 100644 --- a/crates/transaction-pool/Cargo.toml +++ b/crates/transaction-pool/Cargo.toml @@ -95,7 +95,8 @@ test-utils = [ "reth-chainspec/test-utils", "reth-primitives/test-utils", "reth-provider/test-utils", - "revm/test-utils" + "revm/test-utils", + "reth-primitives-traits/test-utils" ] arbitrary = [ "proptest", @@ -108,7 +109,8 @@ arbitrary = [ "alloy-primitives/arbitrary", "bitflags/arbitrary", "revm/arbitrary", - "smallvec/arbitrary" + "smallvec/arbitrary", + "reth-primitives-traits/arbitrary" ] [[bench]] From 1dc630c7aa72150d19ba27b6a45d627b5473b24e Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Sat, 2 Nov 2024 23:47:54 +0700 Subject: [PATCH 09/13] bet --- crates/rpc/rpc-types-compat/src/transaction/mod.rs | 11 ----------- crates/transaction-pool/src/lib.rs | 1 - 2 files changed, 12 deletions(-) diff --git a/crates/rpc/rpc-types-compat/src/transaction/mod.rs b/crates/rpc/rpc-types-compat/src/transaction/mod.rs index 0e80ddcf789b..f8b46454dc23 100644 --- a/crates/rpc/rpc-types-compat/src/transaction/mod.rs +++ b/crates/rpc/rpc-types-compat/src/transaction/mod.rs @@ -160,14 +160,3 @@ pub fn transaction_to_call_request(tx: TransactionSignedEcRecovered) -> Transact authorization_list, } } - -/// Convert [`reth_primitives::TxType`] to [`alloy_consensus::TxType`] -/// Will panics if the `TxType` is `TxType::Deposit` (Optimism Deposit transaction) -pub fn tx_type_to_alloy(tx_type: TxType) -> alloy_consensus::TxType { - u8::from(tx_type).try_into().unwrap() -} - -/// Convert [`alloy_consensus::TxType`] to [`reth_primitives::TxType`] -pub fn tx_type_from_alloy(tx_type: alloy_consensus::TxType) -> TxType { - u8::from(tx_type).try_into().unwrap() -} diff --git a/crates/transaction-pool/src/lib.rs b/crates/transaction-pool/src/lib.rs index caef7b947b4e..2cffcd33fa8b 100644 --- a/crates/transaction-pool/src/lib.rs +++ b/crates/transaction-pool/src/lib.rs @@ -157,7 +157,6 @@ use aquamarine as _; use reth_eth_wire_types::HandleMempoolData; use reth_execution_types::ChangedAccount; use reth_primitives::{BlobTransactionSidecar, PooledTransactionsElement}; -use reth_primitives_traits as _; use reth_storage_api::StateProviderFactory; use std::{collections::HashSet, sync::Arc}; use tokio::sync::mpsc::Receiver; From 94b6a154f01703b4dcf2e4dff609876db70ceb11 Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Sat, 2 Nov 2024 23:54:42 +0700 Subject: [PATCH 10/13] bet --- crates/net/downloaders/src/bodies/bodies.rs | 2 +- crates/net/downloaders/src/bodies/request.rs | 2 +- crates/net/p2p/src/bodies/response.rs | 4 ++-- crates/primitives-traits/src/header/sealed.rs | 4 ++-- crates/primitives-traits/src/lib.rs | 2 +- crates/primitives-traits/src/size.rs | 2 +- crates/primitives/src/block.rs | 8 ++++---- crates/primitives/src/transaction/mod.rs | 4 ++-- crates/prune/prune/Cargo.toml | 2 +- crates/prune/prune/src/segments/user/receipts_by_logs.rs | 4 +--- crates/transaction-pool/Cargo.toml | 9 +++++---- crates/transaction-pool/src/test_utils/mock.rs | 2 +- 12 files changed, 22 insertions(+), 23 deletions(-) diff --git a/crates/net/downloaders/src/bodies/bodies.rs b/crates/net/downloaders/src/bodies/bodies.rs index 408dc2549713..af113fdb38b2 100644 --- a/crates/net/downloaders/src/bodies/bodies.rs +++ b/crates/net/downloaders/src/bodies/bodies.rs @@ -14,7 +14,7 @@ use reth_network_p2p::{ error::{DownloadError, DownloadResult}, }; use reth_primitives::SealedHeader; -use reth_primitives_traits::size::HeuristicSize; +use reth_primitives_traits::size::InMemorySize; use reth_storage_api::HeaderProvider; use reth_tasks::{TaskSpawner, TokioTaskExecutor}; use std::{ diff --git a/crates/net/downloaders/src/bodies/request.rs b/crates/net/downloaders/src/bodies/request.rs index 01494cddd8d0..5ab44ed08110 100644 --- a/crates/net/downloaders/src/bodies/request.rs +++ b/crates/net/downloaders/src/bodies/request.rs @@ -9,7 +9,7 @@ use reth_network_p2p::{ }; use reth_network_peers::{PeerId, WithPeerId}; use reth_primitives::{BlockBody, GotExpected, SealedBlock, SealedHeader}; -use reth_primitives_traits::HeuristicSize; +use reth_primitives_traits::InMemorySize; use std::{ collections::VecDeque, mem, diff --git a/crates/net/p2p/src/bodies/response.rs b/crates/net/p2p/src/bodies/response.rs index fce08096493a..0a45008acd84 100644 --- a/crates/net/p2p/src/bodies/response.rs +++ b/crates/net/p2p/src/bodies/response.rs @@ -1,6 +1,6 @@ use alloy_primitives::{BlockNumber, U256}; use reth_primitives::{SealedBlock, SealedHeader}; -use reth_primitives_traits::HeuristicSize; +use reth_primitives_traits::InMemorySize; /// The block response #[derive(PartialEq, Eq, Debug, Clone)] @@ -34,7 +34,7 @@ impl BlockResponse { } } -impl HeuristicSize for BlockResponse { +impl InMemorySize for BlockResponse { /// Calculates a heuristic for the in-memory size of the [`BlockResponse`]. #[inline] fn size(&self) -> usize { diff --git a/crates/primitives-traits/src/header/sealed.rs b/crates/primitives-traits/src/header/sealed.rs index c6420ec23992..2a7d8b669fdb 100644 --- a/crates/primitives-traits/src/header/sealed.rs +++ b/crates/primitives-traits/src/header/sealed.rs @@ -1,4 +1,4 @@ -use crate::HeuristicSize; +use crate::InMemorySize; use super::Header; use alloy_eips::BlockNumHash; @@ -62,7 +62,7 @@ impl SealedHeader { } } -impl HeuristicSize for SealedHeader { +impl InMemorySize for SealedHeader { /// Calculates a heuristic for the in-memory size of the [`SealedHeader`]. #[inline] fn size(&self) -> usize { diff --git a/crates/primitives-traits/src/lib.rs b/crates/primitives-traits/src/lib.rs index 35617cae4f0a..465319739da7 100644 --- a/crates/primitives-traits/src/lib.rs +++ b/crates/primitives-traits/src/lib.rs @@ -64,4 +64,4 @@ pub mod serde_bincode_compat { /// Heuristic size trait pub mod size; -pub use size::HeuristicSize; +pub use size::InMemorySize; diff --git a/crates/primitives-traits/src/size.rs b/crates/primitives-traits/src/size.rs index c8975054743d..173f8cedc9e2 100644 --- a/crates/primitives-traits/src/size.rs +++ b/crates/primitives-traits/src/size.rs @@ -1,5 +1,5 @@ /// Trait for calculating a heuristic for the in-memory size of a struct. -pub trait HeuristicSize { +pub trait InMemorySize { /// Returns a heuristic for the in-memory size of a struct. fn size(&self) -> usize; } diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs index b1c357f75b17..4609ef98b8af 100644 --- a/crates/primitives/src/block.rs +++ b/crates/primitives/src/block.rs @@ -11,7 +11,7 @@ use alloy_rlp::{Decodable, Encodable, RlpDecodable, RlpEncodable}; use derive_more::{Deref, DerefMut}; #[cfg(any(test, feature = "arbitrary"))] pub use reth_primitives_traits::test_utils::{generate_valid_header, valid_header_strategy}; -use reth_primitives_traits::HeuristicSize; +use reth_primitives_traits::InMemorySize; use serde::{Deserialize, Serialize}; /// Ethereum full block. @@ -92,7 +92,7 @@ impl Block { } } -impl HeuristicSize for Block { +impl InMemorySize for Block { /// Calculates a heuristic for the in-memory size of the [`Block`]. #[inline] fn size(&self) -> usize { @@ -432,7 +432,7 @@ impl SealedBlock { } } -impl HeuristicSize for SealedBlock { +impl InMemorySize for SealedBlock { /// Calculates a heuristic for the in-memory size of the [`SealedBlock`]. #[inline] fn size(&self) -> usize { @@ -615,7 +615,7 @@ impl BlockBody { } } -impl HeuristicSize for BlockBody { +impl InMemorySize for BlockBody { /// Calculates a heuristic for the in-memory size of the [`BlockBody`]. #[inline] fn size(&self) -> usize { diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index 55fc8829c4e4..cf3f4626cf05 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -19,7 +19,7 @@ use once_cell as _; #[cfg(not(feature = "std"))] use once_cell::sync::Lazy as LazyLock; use rayon::prelude::{IntoParallelIterator, ParallelIterator}; -use reth_primitives_traits::HeuristicSize; +use reth_primitives_traits::InMemorySize; use serde::{Deserialize, Serialize}; use signature::{decode_with_eip155_chain_id, with_eip155_parity}; #[cfg(feature = "std")] @@ -558,7 +558,7 @@ impl Transaction { } } -impl HeuristicSize for Transaction { +impl InMemorySize for Transaction { /// Calculates a heuristic for the in-memory size of the [Transaction]. #[inline] fn size(&self) -> usize { diff --git a/crates/prune/prune/Cargo.toml b/crates/prune/prune/Cargo.toml index a420ccf63cb4..4df9ace81338 100644 --- a/crates/prune/prune/Cargo.toml +++ b/crates/prune/prune/Cargo.toml @@ -21,7 +21,6 @@ reth-errors.workspace = true reth-provider.workspace = true reth-tokio-util.workspace = true reth-config.workspace = true -reth-primitives-traits.workspace = true reth-prune-types.workspace = true reth-static-file-types.workspace = true @@ -42,6 +41,7 @@ rustc-hash.workspace = true # reth reth-db = { workspace = true, features = ["test-utils"] } reth-stages = { workspace = true, features = ["test-utils"] } +reth-primitives-traits = { workspace = true, features = ["arbitrary"] } reth-testing-utils.workspace = true reth-tracing.workspace = true diff --git a/crates/prune/prune/src/segments/user/receipts_by_logs.rs b/crates/prune/prune/src/segments/user/receipts_by_logs.rs index ce0c77bb4cc3..ee404b074c3c 100644 --- a/crates/prune/prune/src/segments/user/receipts_by_logs.rs +++ b/crates/prune/prune/src/segments/user/receipts_by_logs.rs @@ -4,8 +4,6 @@ use crate::{ PrunerError, }; use reth_db::{tables, transaction::DbTxMut}; -#[allow(unused_imports)] -use reth_primitives_traits::HeuristicSize; use reth_provider::{BlockReader, DBProvider, PruneCheckpointWriter, TransactionsProvider}; use reth_prune_types::{ PruneCheckpoint, PruneMode, PruneProgress, PrunePurpose, PruneSegment, ReceiptsLogPruneConfig, @@ -224,7 +222,7 @@ mod tests { use assert_matches::assert_matches; use reth_db::tables; use reth_db_api::{cursor::DbCursorRO, transaction::DbTx}; - use reth_primitives_traits::HeuristicSize; + use reth_primitives_traits::InMemorySize; use reth_provider::{DatabaseProviderFactory, PruneCheckpointReader, TransactionsProvider}; use reth_prune_types::{PruneLimiter, PruneMode, PruneSegment, ReceiptsLogPruneConfig}; use reth_stages::test_utils::{StorageKind, TestStageDB}; diff --git a/crates/transaction-pool/Cargo.toml b/crates/transaction-pool/Cargo.toml index 2e6aef2b63f9..c1bbbc11843e 100644 --- a/crates/transaction-pool/Cargo.toml +++ b/crates/transaction-pool/Cargo.toml @@ -17,7 +17,6 @@ reth-chain-state.workspace = true reth-chainspec.workspace = true reth-eth-wire-types.workspace = true reth-primitives = { workspace = true, features = ["c-kzg", "secp256k1"] } -reth-primitives-traits.workspace = true reth-execution-types.workspace = true reth-fs-util.workspace = true reth-storage-api.workspace = true @@ -59,6 +58,8 @@ proptest-arbitrary-interop = { workspace = true, optional = true } [dev-dependencies] reth-primitives = { workspace = true, features = ["arbitrary"] } +reth-primitives-traits = { workspace = true, features = ["arbitrary"] } + reth-provider = { workspace = true, features = ["test-utils"] } reth-tracing.workspace = true paste.workspace = true @@ -85,7 +86,7 @@ serde = [ "parking_lot/serde", "rand?/serde", "revm/serde", - "smallvec/serde" + "smallvec/serde", ] test-utils = [ "rand", @@ -96,7 +97,7 @@ test-utils = [ "reth-primitives/test-utils", "reth-provider/test-utils", "revm/test-utils", - "reth-primitives-traits/test-utils" + "reth-primitives-traits/test-utils", ] arbitrary = [ "proptest", @@ -110,7 +111,7 @@ arbitrary = [ "bitflags/arbitrary", "revm/arbitrary", "smallvec/arbitrary", - "reth-primitives-traits/arbitrary" + "reth-primitives-traits/arbitrary", ] [[bench]] diff --git a/crates/transaction-pool/src/test_utils/mock.rs b/crates/transaction-pool/src/test_utils/mock.rs index fd8fd2ab678b..000d0cfc100a 100644 --- a/crates/transaction-pool/src/test_utils/mock.rs +++ b/crates/transaction-pool/src/test_utils/mock.rs @@ -26,7 +26,7 @@ use reth_primitives::{ use std::{ops::Range, sync::Arc, time::Instant, vec::IntoIter}; #[cfg(any(test, feature = "arbitrary"))] -use reth_primitives_traits::HeuristicSize; +use reth_primitives_traits::InMemorySize; /// A transaction pool implementation using [`MockOrdering`] for transaction ordering. /// From 9b4891512f7716883ac75f57f6c4a510886354dc Mon Sep 17 00:00:00 2001 From: Tuan Tran Date: Sun, 10 Nov 2024 01:41:14 +0700 Subject: [PATCH 11/13] bet --- crates/transaction-pool/Cargo.toml | 3 ++- crates/transaction-pool/src/test_utils/mock.rs | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/transaction-pool/Cargo.toml b/crates/transaction-pool/Cargo.toml index c1bbbc11843e..e0359929ac46 100644 --- a/crates/transaction-pool/Cargo.toml +++ b/crates/transaction-pool/Cargo.toml @@ -17,6 +17,7 @@ reth-chain-state.workspace = true reth-chainspec.workspace = true reth-eth-wire-types.workspace = true reth-primitives = { workspace = true, features = ["c-kzg", "secp256k1"] } +reth-primitives-traits = { workspace = true, features = ["arbitrary"] } reth-execution-types.workspace = true reth-fs-util.workspace = true reth-storage-api.workspace = true @@ -50,6 +51,7 @@ bitflags.workspace = true auto_impl.workspace = true smallvec.workspace = true + # testing rand = { workspace = true, optional = true } paste = { workspace = true, optional = true } @@ -58,7 +60,6 @@ proptest-arbitrary-interop = { workspace = true, optional = true } [dev-dependencies] reth-primitives = { workspace = true, features = ["arbitrary"] } -reth-primitives-traits = { workspace = true, features = ["arbitrary"] } reth-provider = { workspace = true, features = ["test-utils"] } reth-tracing.workspace = true diff --git a/crates/transaction-pool/src/test_utils/mock.rs b/crates/transaction-pool/src/test_utils/mock.rs index 000d0cfc100a..1e2ff368a011 100644 --- a/crates/transaction-pool/src/test_utils/mock.rs +++ b/crates/transaction-pool/src/test_utils/mock.rs @@ -11,6 +11,7 @@ use alloy_consensus::{ constants::{EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, LEGACY_TX_TYPE_ID}, TxEip1559, TxEip2930, TxEip4844, TxLegacy, }; + use alloy_eips::{eip1559::MIN_PROTOCOL_BASE_FEE, eip2930::AccessList, eip4844::DATA_GAS_PER_BLOB}; use alloy_primitives::{Address, Bytes, ChainId, TxHash, TxKind, B256, U256}; use paste::paste; @@ -25,9 +26,6 @@ use reth_primitives::{ }; use std::{ops::Range, sync::Arc, time::Instant, vec::IntoIter}; -#[cfg(any(test, feature = "arbitrary"))] -use reth_primitives_traits::InMemorySize; - /// A transaction pool implementation using [`MockOrdering`] for transaction ordering. /// /// This type is an alias for [`TxPool`]. @@ -1004,6 +1002,7 @@ impl proptest::arbitrary::Arbitrary for MockTransaction { fn arbitrary_with(_: Self::Parameters) -> Self::Strategy { use proptest::prelude::Strategy; use proptest_arbitrary_interop::arb; + use reth_primitives_traits::size::InMemorySize; arb::<(Transaction, Address, B256)>() .prop_map(|(tx, sender, tx_hash)| match &tx { From ba032e35b025f6ee714c529764195ad7a2cb4d8d Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 11 Nov 2024 17:15:48 +0100 Subject: [PATCH 12/13] clippy --- crates/transaction-pool/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/transaction-pool/Cargo.toml b/crates/transaction-pool/Cargo.toml index e0359929ac46..aa8134811b9d 100644 --- a/crates/transaction-pool/Cargo.toml +++ b/crates/transaction-pool/Cargo.toml @@ -17,7 +17,7 @@ reth-chain-state.workspace = true reth-chainspec.workspace = true reth-eth-wire-types.workspace = true reth-primitives = { workspace = true, features = ["c-kzg", "secp256k1"] } -reth-primitives-traits = { workspace = true, features = ["arbitrary"] } +reth-primitives-traits = { workspace = true, features = ["arbitrary"], optional = true } reth-execution-types.workspace = true reth-fs-util.workspace = true reth-storage-api.workspace = true @@ -60,7 +60,7 @@ proptest-arbitrary-interop = { workspace = true, optional = true } [dev-dependencies] reth-primitives = { workspace = true, features = ["arbitrary"] } - +reth-primitives-traits = { workspace = true, features = ["arbitrary"] } reth-provider = { workspace = true, features = ["test-utils"] } reth-tracing.workspace = true paste.workspace = true @@ -112,7 +112,7 @@ arbitrary = [ "bitflags/arbitrary", "revm/arbitrary", "smallvec/arbitrary", - "reth-primitives-traits/arbitrary", + "reth-primitives-traits", ] [[bench]] From 5e1783142c326b6a2d6023103510011fa50460f6 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 11 Nov 2024 17:23:04 +0100 Subject: [PATCH 13/13] clippy --- crates/transaction-pool/Cargo.toml | 5 ++--- crates/transaction-pool/src/validate/eth.rs | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/transaction-pool/Cargo.toml b/crates/transaction-pool/Cargo.toml index aa8134811b9d..7c760c81c540 100644 --- a/crates/transaction-pool/Cargo.toml +++ b/crates/transaction-pool/Cargo.toml @@ -17,7 +17,7 @@ reth-chain-state.workspace = true reth-chainspec.workspace = true reth-eth-wire-types.workspace = true reth-primitives = { workspace = true, features = ["c-kzg", "secp256k1"] } -reth-primitives-traits = { workspace = true, features = ["arbitrary"], optional = true } +reth-primitives-traits.workspace = true reth-execution-types.workspace = true reth-fs-util.workspace = true reth-storage-api.workspace = true @@ -60,7 +60,6 @@ proptest-arbitrary-interop = { workspace = true, optional = true } [dev-dependencies] reth-primitives = { workspace = true, features = ["arbitrary"] } -reth-primitives-traits = { workspace = true, features = ["arbitrary"] } reth-provider = { workspace = true, features = ["test-utils"] } reth-tracing.workspace = true paste.workspace = true @@ -111,8 +110,8 @@ arbitrary = [ "alloy-primitives/arbitrary", "bitflags/arbitrary", "revm/arbitrary", + "reth-primitives-traits/arbitrary", "smallvec/arbitrary", - "reth-primitives-traits", ] [[bench]] diff --git a/crates/transaction-pool/src/validate/eth.rs b/crates/transaction-pool/src/validate/eth.rs index 62e9f3f2917d..d5f7101eb550 100644 --- a/crates/transaction-pool/src/validate/eth.rs +++ b/crates/transaction-pool/src/validate/eth.rs @@ -17,7 +17,8 @@ use alloy_consensus::constants::{ }; use alloy_eips::eip4844::MAX_BLOBS_PER_BLOCK; use reth_chainspec::{ChainSpec, EthereumHardforks}; -use reth_primitives::{GotExpected, InvalidTransactionError, SealedBlock}; +use reth_primitives::{InvalidTransactionError, SealedBlock}; +use reth_primitives_traits::GotExpected; use reth_storage_api::{AccountReader, StateProviderFactory}; use reth_tasks::TaskSpawner; use revm::{