diff --git a/Cargo.lock b/Cargo.lock index 97d937233..1ae37d55c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7882,9 +7882,9 @@ dependencies = [ "parking_lot", "reth-consensus", "reth-eth-wire-types", + "reth-ethereum-primitives", "reth-network-peers", "reth-network-types", - "reth-primitives", "reth-primitives-traits", "reth-storage-errors", "tokio", diff --git a/crates/net/p2p/Cargo.toml b/crates/net/p2p/Cargo.toml index 292753d45..da208d48b 100644 --- a/crates/net/p2p/Cargo.toml +++ b/crates/net/p2p/Cargo.toml @@ -13,7 +13,7 @@ workspace = true [dependencies] # reth -reth-primitives.workspace = true +reth-ethereum-primitives.workspace = true reth-primitives-traits.workspace = true reth-eth-wire-types.workspace = true reth-consensus.workspace = true @@ -48,13 +48,13 @@ test-utils = [ "reth-consensus/test-utils", "parking_lot", "reth-network-types/test-utils", - "reth-primitives/test-utils", + "reth-ethereum-primitives/test-utils", "reth-primitives-traits/test-utils", "alloy-primitives/rand", ] std = [ "reth-consensus/std", - "reth-primitives/std", + "reth-ethereum-primitives/std", "alloy-eips/std", "alloy-primitives/std", "reth-primitives-traits/std", diff --git a/crates/net/p2p/src/bodies/client.rs b/crates/net/p2p/src/bodies/client.rs index b31954ff1..c97b9ab53 100644 --- a/crates/net/p2p/src/bodies/client.rs +++ b/crates/net/p2p/src/bodies/client.rs @@ -9,7 +9,7 @@ use futures::{Future, FutureExt}; use reth_primitives_traits::BlockBody; /// The bodies future type -pub type BodiesFut = +pub type BodiesFut = Pin>> + Send + Sync>>; /// A client capable of downloading block bodies. diff --git a/crates/net/p2p/src/bodies/response.rs b/crates/net/p2p/src/bodies/response.rs index d53ca32eb..20287a4b4 100644 --- a/crates/net/p2p/src/bodies/response.rs +++ b/crates/net/p2p/src/bodies/response.rs @@ -1,7 +1,6 @@ use alloy_consensus::BlockHeader; use alloy_primitives::{BlockNumber, U256}; -use reth_primitives::{SealedBlock, SealedHeader}; -use reth_primitives_traits::{Block, InMemorySize}; +use reth_primitives_traits::{Block, InMemorySize, SealedBlock, SealedHeader}; /// The block response #[derive(PartialEq, Eq, Debug, Clone)] pub enum BlockResponse { diff --git a/crates/net/p2p/src/error.rs b/crates/net/p2p/src/error.rs index db765a9ab..d650763b4 100644 --- a/crates/net/p2p/src/error.rs +++ b/crates/net/p2p/src/error.rs @@ -8,7 +8,7 @@ use derive_more::{Display, Error}; use reth_consensus::ConsensusError; use reth_network_peers::WithPeerId; use reth_network_types::ReputationChangeKind; -use reth_primitives::{GotExpected, GotExpectedBoxed}; +use reth_primitives_traits::{GotExpected, GotExpectedBoxed}; use reth_storage_errors::{db::DatabaseError, provider::ProviderError}; use tokio::sync::{mpsc, oneshot}; diff --git a/crates/net/p2p/src/full_block.rs b/crates/net/p2p/src/full_block.rs index c8b5154cd..f8c09dbc7 100644 --- a/crates/net/p2p/src/full_block.rs +++ b/crates/net/p2p/src/full_block.rs @@ -10,7 +10,7 @@ use alloy_primitives::{Sealable, B256}; use reth_consensus::{Consensus, ConsensusError}; use reth_eth_wire_types::HeadersDirection; use reth_network_peers::WithPeerId; -use reth_primitives::{SealedBlock, SealedHeader}; +use reth_primitives_traits::{SealedBlock, SealedHeader}; use std::{ cmp::Reverse, collections::{HashMap, VecDeque}, @@ -644,7 +644,7 @@ enum RangeResponseResult { #[cfg(test)] mod tests { - use reth_primitives::BlockBody; + use reth_ethereum_primitives::BlockBody; use super::*; use crate::test_utils::TestFullBlockClient; diff --git a/crates/net/p2p/src/headers/error.rs b/crates/net/p2p/src/headers/error.rs index 5adf016c7..bc9b09194 100644 --- a/crates/net/p2p/src/headers/error.rs +++ b/crates/net/p2p/src/headers/error.rs @@ -1,7 +1,7 @@ use alloy_primitives::Sealable; use derive_more::{Display, Error}; use reth_consensus::ConsensusError; -use reth_primitives::SealedHeader; +use reth_primitives_traits::SealedHeader; /// Header downloader result pub type HeadersDownloaderResult = Result>; diff --git a/crates/net/p2p/src/lib.rs b/crates/net/p2p/src/lib.rs index bef537bdc..0c5e1e326 100644 --- a/crates/net/p2p/src/lib.rs +++ b/crates/net/p2p/src/lib.rs @@ -61,6 +61,6 @@ pub trait BlockClient: } /// The [`BlockClient`] providing Ethereum block parts. -pub trait EthBlockClient: BlockClient {} +pub trait EthBlockClient: BlockClient {} -impl EthBlockClient for T where T: BlockClient {} +impl EthBlockClient for T where T: BlockClient {} diff --git a/crates/net/p2p/src/sync.rs b/crates/net/p2p/src/sync.rs index 94d40dac0..c7c43befc 100644 --- a/crates/net/p2p/src/sync.rs +++ b/crates/net/p2p/src/sync.rs @@ -1,6 +1,6 @@ //! Traits used when interacting with the sync status of the network. -use reth_primitives::Head; +use alloy_eips::eip2124::Head; /// A type that provides information about whether the node is currently syncing and the network is /// currently serving syncing related requests. diff --git a/crates/net/p2p/src/test_utils/bodies.rs b/crates/net/p2p/src/test_utils/bodies.rs index a51ca1ea0..7570756d0 100644 --- a/crates/net/p2p/src/test_utils/bodies.rs +++ b/crates/net/p2p/src/test_utils/bodies.rs @@ -6,8 +6,8 @@ use crate::{ }; use alloy_primitives::B256; use futures::FutureExt; +use reth_ethereum_primitives::BlockBody; use reth_network_peers::PeerId; -use reth_primitives::BlockBody; use std::fmt::{Debug, Formatter}; use tokio::sync::oneshot; diff --git a/crates/net/p2p/src/test_utils/full_block.rs b/crates/net/p2p/src/test_utils/full_block.rs index 2165ddbf5..60bcaad4e 100644 --- a/crates/net/p2p/src/test_utils/full_block.rs +++ b/crates/net/p2p/src/test_utils/full_block.rs @@ -11,8 +11,9 @@ use alloy_eips::{BlockHashOrNumber, BlockNumHash}; use alloy_primitives::B256; use parking_lot::Mutex; use reth_eth_wire_types::HeadersDirection; +use reth_ethereum_primitives::{Block, BlockBody}; use reth_network_peers::{PeerId, WithPeerId}; -use reth_primitives::{BlockBody, SealedBlock, SealedHeader}; +use reth_primitives_traits::{SealedBlock, SealedHeader}; use std::{collections::HashMap, sync::Arc}; /// A headers+bodies client implementation that does nothing. @@ -131,7 +132,7 @@ impl TestFullBlockClient { } /// Get the block with the highest block number. - pub fn highest_block(&self) -> Option { + pub fn highest_block(&self) -> Option> { self.headers.lock().iter().max_by_key(|(_, header)| header.number).and_then( |(hash, header)| { self.bodies.lock().get(hash).map(|body| { @@ -246,5 +247,5 @@ impl BodiesClient for TestFullBlockClient { } impl BlockClient for TestFullBlockClient { - type Block = reth_primitives::Block; + type Block = reth_ethereum_primitives::Block; } diff --git a/crates/net/p2p/src/test_utils/headers.rs b/crates/net/p2p/src/test_utils/headers.rs index 15adc3bed..3ac441dec 100644 --- a/crates/net/p2p/src/test_utils/headers.rs +++ b/crates/net/p2p/src/test_utils/headers.rs @@ -15,7 +15,7 @@ use futures::{Future, FutureExt, Stream, StreamExt}; use reth_consensus::{test_utils::TestConsensus, HeaderValidator}; use reth_eth_wire_types::HeadersDirection; use reth_network_peers::{PeerId, WithPeerId}; -use reth_primitives::SealedHeader; +use reth_primitives_traits::SealedHeader; use std::{ fmt, pin::Pin,