diff --git a/Cargo.lock b/Cargo.lock index ac41650c8f82..12e969de1ef1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7244,11 +7244,11 @@ dependencies = [ "reth-dns-discovery", "reth-ecies", "reth-eth-wire", - "reth-interfaces", "reth-metrics", "reth-net-common", "reth-network", "reth-network-api", + "reth-network-p2p", "reth-network-types", "reth-primitives", "reth-provider", diff --git a/crates/net/network/Cargo.toml b/crates/net/network/Cargo.toml index aa6da6ea2913..0c8e079f4da7 100644 --- a/crates/net/network/Cargo.toml +++ b/crates/net/network/Cargo.toml @@ -13,10 +13,10 @@ workspace = true [dependencies] # reth -reth-interfaces.workspace = true reth-primitives.workspace = true reth-net-common.workspace = true reth-network-api.workspace = true +reth-network-p2p.workspace = true reth-discv4.workspace = true reth-discv5.workspace = true reth-dns-discovery.workspace = true @@ -71,12 +71,12 @@ smallvec.workspace = true [dev-dependencies] # reth reth-discv4 = { workspace = true, features = ["test-utils"] } -reth-interfaces = { workspace = true, features = ["test-utils"] } reth-primitives = { workspace = true, features = ["test-utils"] } # we need to enable the test-utils feature in our own crate to use utils in # integration tests reth-network = { workspace = true, features = ["test-utils"] } +reth-network-p2p = { workspace = true, features = ["test-utils"] } reth-provider = { workspace = true, features = ["test-utils"] } reth-tracing.workspace = true diff --git a/crates/net/network/src/eth_requests.rs b/crates/net/network/src/eth_requests.rs index 10821dd804cf..4f54cbdba7be 100644 --- a/crates/net/network/src/eth_requests.rs +++ b/crates/net/network/src/eth_requests.rs @@ -10,7 +10,7 @@ use reth_eth_wire::{ BlockBodies, BlockHeaders, GetBlockBodies, GetBlockHeaders, GetNodeData, GetReceipts, NodeData, Receipts, }; -use reth_interfaces::p2p::error::RequestResult; +use reth_network_p2p::error::RequestResult; use reth_network_types::PeerId; use reth_primitives::{BlockBody, BlockHashOrNumber, Header, HeadersDirection}; use reth_provider::{BlockReader, HeaderProvider, ReceiptProvider}; diff --git a/crates/net/network/src/fetch/client.rs b/crates/net/network/src/fetch/client.rs index 63e22abe00fa..a8a4b9f07c1b 100644 --- a/crates/net/network/src/fetch/client.rs +++ b/crates/net/network/src/fetch/client.rs @@ -3,14 +3,14 @@ use crate::{fetch::DownloadRequest, flattened_response::FlattenedResponse, peers::PeersHandle}; use futures::{future, future::Either}; -use reth_interfaces::p2p::{ +use reth_network_api::ReputationChangeKind; +use reth_network_p2p::{ bodies::client::{BodiesClient, BodiesFut}, download::DownloadClient, error::{PeerRequestResult, RequestError}, headers::client::{HeadersClient, HeadersRequest}, priority::Priority, }; -use reth_network_api::ReputationChangeKind; use reth_network_types::PeerId; use reth_primitives::{Header, B256}; use std::sync::{ diff --git a/crates/net/network/src/fetch/mod.rs b/crates/net/network/src/fetch/mod.rs index 9ad50edb0a27..3a5ebf14b513 100644 --- a/crates/net/network/src/fetch/mod.rs +++ b/crates/net/network/src/fetch/mod.rs @@ -3,12 +3,12 @@ use crate::{message::BlockRequest, peers::PeersHandle}; use futures::StreamExt; use reth_eth_wire::{GetBlockBodies, GetBlockHeaders}; -use reth_interfaces::p2p::{ +use reth_network_api::ReputationChangeKind; +use reth_network_p2p::{ error::{EthResponseValidator, PeerRequestResult, RequestError, RequestResult}, headers::client::HeadersRequest, priority::Priority, }; -use reth_network_api::ReputationChangeKind; use reth_network_types::PeerId; use reth_primitives::{BlockBody, Header, B256}; use std::{ diff --git a/crates/net/network/src/message.rs b/crates/net/network/src/message.rs index 2086fd60ea39..861fb304e736 100644 --- a/crates/net/network/src/message.rs +++ b/crates/net/network/src/message.rs @@ -10,7 +10,7 @@ use reth_eth_wire::{ NewBlockHashes, NewPooledTransactionHashes, NodeData, PooledTransactions, Receipts, SharedTransactions, Transactions, }; -use reth_interfaces::p2p::error::{RequestError, RequestResult}; +use reth_network_p2p::error::{RequestError, RequestResult}; use reth_network_types::PeerId; use reth_primitives::{ BlockBody, Bytes, Header, PooledTransactionsElement, ReceiptWithBloom, B256, diff --git a/crates/net/network/src/network.rs b/crates/net/network/src/network.rs index 8d9b277f4191..b3ec4c761121 100644 --- a/crates/net/network/src/network.rs +++ b/crates/net/network/src/network.rs @@ -7,12 +7,12 @@ use enr::Enr; use parking_lot::Mutex; use reth_discv4::Discv4; use reth_eth_wire::{DisconnectReason, NewBlock, NewPooledTransactionHashes, SharedTransactions}; -use reth_interfaces::sync::{NetworkSyncUpdater, SyncState, SyncStateProvider}; use reth_net_common::bandwidth_meter::BandwidthMeter; use reth_network_api::{ NetworkError, NetworkInfo, PeerInfo, PeerKind, Peers, PeersInfo, Reputation, ReputationChangeKind, }; +use reth_network_p2p::sync::{NetworkSyncUpdater, SyncState, SyncStateProvider}; use reth_network_types::PeerId; use reth_primitives::{Head, NodeRecord, TransactionSigned, B256}; use reth_rpc_types::NetworkStatus; diff --git a/crates/net/network/src/session/active.rs b/crates/net/network/src/session/active.rs index 32bfb72acb31..ce726a78a24e 100644 --- a/crates/net/network/src/session/active.rs +++ b/crates/net/network/src/session/active.rs @@ -18,8 +18,8 @@ use reth_eth_wire::{ message::{EthBroadcastMessage, RequestPair}, DisconnectP2P, DisconnectReason, EthMessage, }; -use reth_interfaces::p2p::error::RequestError; use reth_metrics::common::mpsc::MeteredPollSender; +use reth_network_p2p::error::RequestError; use reth_network_types::PeerId; use std::{ collections::VecDeque, diff --git a/crates/net/network/src/state.rs b/crates/net/network/src/state.rs index b0824e0f348a..e5b477152f95 100644 --- a/crates/net/network/src/state.rs +++ b/crates/net/network/src/state.rs @@ -536,7 +536,7 @@ mod tests { capability::{Capabilities, Capability}, BlockBodies, EthVersion, }; - use reth_interfaces::p2p::{bodies::client::BodiesClient, error::RequestError}; + use reth_network_p2p::{bodies::client::BodiesClient, error::RequestError}; use reth_network_types::PeerId; use reth_primitives::{BlockBody, Header, B256}; use reth_provider::test_utils::NoopProvider; diff --git a/crates/net/network/src/transactions/fetcher.rs b/crates/net/network/src/transactions/fetcher.rs index c5272ecc3aaa..e10cee9bd118 100644 --- a/crates/net/network/src/transactions/fetcher.rs +++ b/crates/net/network/src/transactions/fetcher.rs @@ -40,7 +40,7 @@ use reth_eth_wire::{ DedupPayload, EthVersion, GetPooledTransactions, HandleMempoolData, HandleVersionedMempoolData, PartiallyValidData, RequestTxHashes, ValidAnnouncementData, }; -use reth_interfaces::p2p::error::{RequestError, RequestResult}; +use reth_network_p2p::error::{RequestError, RequestResult}; use reth_network_types::PeerId; use reth_primitives::{PooledTransactionsElement, TxHash}; use schnellru::ByLength; diff --git a/crates/net/network/src/transactions/mod.rs b/crates/net/network/src/transactions/mod.rs index b6b2328e4f8b..7a0fe600da54 100644 --- a/crates/net/network/src/transactions/mod.rs +++ b/crates/net/network/src/transactions/mod.rs @@ -20,12 +20,12 @@ use reth_eth_wire::{ NewPooledTransactionHashes, NewPooledTransactionHashes66, NewPooledTransactionHashes68, PooledTransactions, RequestTxHashes, Transactions, }; -use reth_interfaces::{ - p2p::error::{RequestError, RequestResult}, - sync::SyncStateProvider, -}; use reth_metrics::common::mpsc::UnboundedMeteredReceiver; use reth_network_api::{Peers, ReputationChangeKind}; +use reth_network_p2p::{ + error::{RequestError, RequestResult}, + sync::SyncStateProvider, +}; use reth_network_types::PeerId; use reth_primitives::{ FromRecoveredPooledTransaction, PooledTransactionsElement, TransactionSigned, TxHash, B256, @@ -1619,8 +1619,11 @@ mod tests { use alloy_rlp::Decodable; use constants::tx_fetcher::DEFAULT_MAX_COUNT_FALLBACK_PEERS; use futures::FutureExt; - use reth_interfaces::sync::{NetworkSyncUpdater, SyncState}; use reth_network_api::NetworkInfo; + use reth_network_p2p::{ + error::{RequestError, RequestResult}, + sync::{NetworkSyncUpdater, SyncState}, + }; use reth_primitives::hex; use reth_provider::test_utils::NoopProvider; use reth_transaction_pool::test_utils::{testing_pool, MockTransaction}; diff --git a/crates/net/network/tests/it/big_pooled_txs_req.rs b/crates/net/network/tests/it/big_pooled_txs_req.rs index 5b3a2a0d0049..4ddc0cdd36ee 100644 --- a/crates/net/network/tests/it/big_pooled_txs_req.rs +++ b/crates/net/network/tests/it/big_pooled_txs_req.rs @@ -1,10 +1,10 @@ use reth_eth_wire::{GetPooledTransactions, PooledTransactions}; -use reth_interfaces::sync::{NetworkSyncUpdater, SyncState}; use reth_network::{ test_utils::{NetworkEventStream, Testnet}, NetworkEvents, PeerRequest, }; use reth_network_api::{NetworkInfo, Peers}; +use reth_network_p2p::sync::{NetworkSyncUpdater, SyncState}; use reth_primitives::{Signature, TransactionSigned, B256}; use reth_provider::test_utils::MockEthProvider; use reth_transaction_pool::{ diff --git a/crates/net/network/tests/it/connect.rs b/crates/net/network/tests/it/connect.rs index 7b9c785ebdbe..dc5117433483 100644 --- a/crates/net/network/tests/it/connect.rs +++ b/crates/net/network/tests/it/connect.rs @@ -5,16 +5,16 @@ use alloy_provider::{ext::AdminApi, ProviderBuilder}; use futures::StreamExt; use reth_discv4::Discv4Config; use reth_eth_wire::DisconnectReason; -use reth_interfaces::{ - p2p::headers::client::{HeadersClient, HeadersRequest}, - sync::{NetworkSyncUpdater, SyncState}, -}; use reth_net_common::ban_list::BanList; use reth_network::{ test_utils::{enr_to_peer_id, NetworkEventStream, PeerConfig, Testnet, GETH_TIMEOUT}, NetworkConfigBuilder, NetworkEvent, NetworkEvents, NetworkManager, PeersConfig, }; use reth_network_api::{NetworkInfo, Peers, PeersInfo}; +use reth_network_p2p::{ + headers::client::{HeadersClient, HeadersRequest}, + sync::{NetworkSyncUpdater, SyncState}, +}; use reth_primitives::{mainnet_nodes, HeadersDirection, NodeRecord}; use reth_provider::test_utils::NoopProvider; use reth_transaction_pool::test_utils::testing_pool; diff --git a/crates/net/network/tests/it/requests.rs b/crates/net/network/tests/it/requests.rs index 45c86cb647e8..555acd08b248 100644 --- a/crates/net/network/tests/it/requests.rs +++ b/crates/net/network/tests/it/requests.rs @@ -2,15 +2,15 @@ //! Tests for eth related requests use rand::Rng; -use reth_interfaces::p2p::{ - bodies::client::BodiesClient, - headers::client::{HeadersClient, HeadersRequest}, -}; use reth_network::{ test_utils::{NetworkEventStream, Testnet}, NetworkEvents, }; use reth_network_api::{NetworkInfo, Peers}; +use reth_network_p2p::{ + bodies::client::BodiesClient, + headers::client::{HeadersClient, HeadersRequest}, +}; use reth_primitives::{ Block, BlockBody, Bytes, Header, HeadersDirection, Signature, Transaction, TransactionSigned, TxEip2930, TxKind, U256,