diff --git a/Cargo.lock b/Cargo.lock index 7656829cf..bb12cde94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6847,6 +6847,7 @@ dependencies = [ name = "reth-downloaders" version = "1.0.7" dependencies = [ + "alloy-primitives", "alloy-rlp", "assert_matches", "futures", @@ -7075,6 +7076,7 @@ dependencies = [ name = "reth-eth-wire" version = "1.0.7" dependencies = [ + "alloy-primitives", "alloy-rlp", "arbitrary", "async-stream", @@ -7110,6 +7112,7 @@ version = "1.0.7" dependencies = [ "alloy-chains", "alloy-genesis", + "alloy-primitives", "alloy-rlp", "arbitrary", "bytes", @@ -7508,6 +7511,7 @@ name = "reth-network" version = "1.0.7" dependencies = [ "alloy-node-bindings", + "alloy-primitives", "alloy-provider", "alloy-rlp", "aquamarine", @@ -7586,6 +7590,7 @@ dependencies = [ name = "reth-network-p2p" version = "1.0.7" dependencies = [ + "alloy-primitives", "auto_impl", "derive_more", "futures", diff --git a/crates/net/downloaders/Cargo.toml b/crates/net/downloaders/Cargo.toml index f17ce036d..35883de00 100644 --- a/crates/net/downloaders/Cargo.toml +++ b/crates/net/downloaders/Cargo.toml @@ -26,7 +26,8 @@ reth-db = { workspace = true, optional = true } reth-db-api = { workspace = true, optional = true } reth-testing-utils = { workspace = true, optional = true } -# eth +# ethereum +alloy-primitives.workspace = true alloy-rlp.workspace = true # async diff --git a/crates/net/downloaders/src/bodies/bodies.rs b/crates/net/downloaders/src/bodies/bodies.rs index 9bbf7a2f1..21b7cd81c 100644 --- a/crates/net/downloaders/src/bodies/bodies.rs +++ b/crates/net/downloaders/src/bodies/bodies.rs @@ -1,5 +1,6 @@ use super::queue::BodiesRequestQueue; use crate::{bodies::task::TaskDownloader, metrics::BodyDownloaderMetrics}; +use alloy_primitives::BlockNumber; use futures::Stream; use futures_util::StreamExt; use reth_config::BodiesConfig; @@ -12,7 +13,7 @@ use reth_network_p2p::{ }, error::{DownloadError, DownloadResult}, }; -use reth_primitives::{BlockNumber, SealedHeader}; +use reth_primitives::SealedHeader; use reth_storage_api::HeaderProvider; use reth_tasks::{TaskSpawner, TokioTaskExecutor}; use std::{ @@ -601,11 +602,12 @@ mod tests { bodies::test_utils::{insert_headers, zip_blocks}, test_utils::{generate_bodies, TestBodiesClient}, }; + use alloy_primitives::B256; use assert_matches::assert_matches; use reth_chainspec::MAINNET; use reth_consensus::test_utils::TestConsensus; use reth_db::test_utils::{create_test_rw_db, create_test_static_files_dir}; - use reth_primitives::{BlockBody, B256}; + use reth_primitives::BlockBody; use reth_provider::{ providers::StaticFileProvider, test_utils::MockNodeTypesWithDB, ProviderFactory, }; diff --git a/crates/net/downloaders/src/bodies/noop.rs b/crates/net/downloaders/src/bodies/noop.rs index b1aa0e2ea..e70c534a0 100644 --- a/crates/net/downloaders/src/bodies/noop.rs +++ b/crates/net/downloaders/src/bodies/noop.rs @@ -1,9 +1,9 @@ +use alloy_primitives::BlockNumber; use futures::Stream; use reth_network_p2p::{ bodies::{downloader::BodyDownloader, response::BlockResponse}, error::{DownloadError, DownloadResult}, }; -use reth_primitives::BlockNumber; use std::ops::RangeInclusive; /// A [`BodyDownloader`] implementation that does nothing. diff --git a/crates/net/downloaders/src/bodies/queue.rs b/crates/net/downloaders/src/bodies/queue.rs index 35e5b4414..db7ff71cf 100644 --- a/crates/net/downloaders/src/bodies/queue.rs +++ b/crates/net/downloaders/src/bodies/queue.rs @@ -1,5 +1,6 @@ use super::request::BodiesRequestFuture; use crate::metrics::BodyDownloaderMetrics; +use alloy_primitives::BlockNumber; use futures::{stream::FuturesUnordered, Stream}; use futures_util::StreamExt; use reth_consensus::Consensus; @@ -7,7 +8,7 @@ use reth_network_p2p::{ bodies::{client::BodiesClient, response::BlockResponse}, error::DownloadResult, }; -use reth_primitives::{BlockNumber, SealedHeader}; +use reth_primitives::SealedHeader; use std::{ pin::Pin, sync::Arc, diff --git a/crates/net/downloaders/src/bodies/request.rs b/crates/net/downloaders/src/bodies/request.rs index 3bcaee9b3..c2b36732b 100644 --- a/crates/net/downloaders/src/bodies/request.rs +++ b/crates/net/downloaders/src/bodies/request.rs @@ -1,4 +1,5 @@ use crate::metrics::{BodyDownloaderMetrics, ResponseMetrics}; +use alloy_primitives::B256; use futures::{Future, FutureExt}; use reth_consensus::Consensus; use reth_network_p2p::{ @@ -7,7 +8,7 @@ use reth_network_p2p::{ priority::Priority, }; use reth_network_peers::{PeerId, WithPeerId}; -use reth_primitives::{BlockBody, GotExpected, SealedBlock, SealedHeader, B256}; +use reth_primitives::{BlockBody, GotExpected, SealedBlock, SealedHeader}; use std::{ collections::VecDeque, mem, diff --git a/crates/net/downloaders/src/bodies/task.rs b/crates/net/downloaders/src/bodies/task.rs index aa5bc2752..eeafb7ab1 100644 --- a/crates/net/downloaders/src/bodies/task.rs +++ b/crates/net/downloaders/src/bodies/task.rs @@ -1,3 +1,4 @@ +use alloy_primitives::BlockNumber; use futures::Stream; use futures_util::{FutureExt, StreamExt}; use pin_project::pin_project; @@ -5,7 +6,6 @@ use reth_network_p2p::{ bodies::downloader::{BodyDownloader, BodyDownloaderResult}, error::DownloadResult, }; -use reth_primitives::BlockNumber; use reth_tasks::{TaskSpawner, TokioTaskExecutor}; use std::{ future::Future, diff --git a/crates/net/downloaders/src/bodies/test_utils.rs b/crates/net/downloaders/src/bodies/test_utils.rs index b730510e8..76d2201f0 100644 --- a/crates/net/downloaders/src/bodies/test_utils.rs +++ b/crates/net/downloaders/src/bodies/test_utils.rs @@ -2,10 +2,11 @@ #![allow(dead_code)] +use alloy_primitives::B256; use reth_db::{tables, DatabaseEnv}; use reth_db_api::{database::Database, transaction::DbTxMut}; use reth_network_p2p::bodies::response::BlockResponse; -use reth_primitives::{Block, BlockBody, SealedBlock, SealedHeader, B256}; +use reth_primitives::{Block, BlockBody, SealedBlock, SealedHeader}; use std::collections::HashMap; pub(crate) fn zip_blocks<'a>( diff --git a/crates/net/downloaders/src/file_client.rs b/crates/net/downloaders/src/file_client.rs index d49fb0a59..8487d2b37 100644 --- a/crates/net/downloaders/src/file_client.rs +++ b/crates/net/downloaders/src/file_client.rs @@ -1,5 +1,6 @@ use std::{collections::HashMap, io, path::Path}; +use alloy_primitives::{BlockHash, BlockNumber, B256}; use futures::Future; use itertools::Either; use reth_network_p2p::{ @@ -10,9 +11,7 @@ use reth_network_p2p::{ priority::Priority, }; use reth_network_peers::PeerId; -use reth_primitives::{ - BlockBody, BlockHash, BlockHashOrNumber, BlockNumber, Header, SealedHeader, B256, -}; +use reth_primitives::{BlockBody, BlockHashOrNumber, Header, SealedHeader}; use thiserror::Error; use tokio::{fs::File, io::AsyncReadExt}; use tokio_stream::StreamExt; diff --git a/crates/net/downloaders/src/file_codec.rs b/crates/net/downloaders/src/file_codec.rs index 156f3316c..3e754f9cf 100644 --- a/crates/net/downloaders/src/file_codec.rs +++ b/crates/net/downloaders/src/file_codec.rs @@ -1,11 +1,9 @@ //! Codec for reading raw block bodies from a file. use crate::file_client::FileClientError; +use alloy_primitives::bytes::{Buf, BytesMut}; use alloy_rlp::{Decodable, Encodable}; -use reth_primitives::{ - bytes::{Buf, BytesMut}, - Block, -}; +use reth_primitives::Block; use tokio_util::codec::{Decoder, Encoder}; /// Codec for reading raw block bodies from a file. diff --git a/crates/net/downloaders/src/headers/reverse_headers.rs b/crates/net/downloaders/src/headers/reverse_headers.rs index 871235f91..c43d3dbd9 100644 --- a/crates/net/downloaders/src/headers/reverse_headers.rs +++ b/crates/net/downloaders/src/headers/reverse_headers.rs @@ -2,6 +2,7 @@ use super::task::TaskDownloader; use crate::metrics::HeaderDownloaderMetrics; +use alloy_primitives::{BlockNumber, B256}; use futures::{stream::Stream, FutureExt}; use futures_util::{stream::FuturesUnordered, StreamExt}; use rayon::prelude::*; @@ -17,7 +18,7 @@ use reth_network_p2p::{ priority::Priority, }; use reth_network_peers::PeerId; -use reth_primitives::{BlockHashOrNumber, BlockNumber, GotExpected, Header, SealedHeader, B256}; +use reth_primitives::{BlockHashOrNumber, GotExpected, Header, SealedHeader}; use reth_tasks::{TaskSpawner, TokioTaskExecutor}; use std::{ cmp::{Ordering, Reverse}, diff --git a/crates/net/downloaders/src/receipt_file_client.rs b/crates/net/downloaders/src/receipt_file_client.rs index 3776886db..6bf095c3b 100644 --- a/crates/net/downloaders/src/receipt_file_client.rs +++ b/crates/net/downloaders/src/receipt_file_client.rs @@ -208,10 +208,9 @@ pub struct ReceiptWithBlockNumber { #[cfg(test)] mod test { + use alloy_primitives::{hex, Address, Bytes, Log, LogData, B256}; use alloy_rlp::{Decodable, RlpDecodable}; - use reth_primitives::{ - hex, Address, Buf, Bytes, BytesMut, Log, LogData, Receipt, TxType, B256, - }; + use reth_primitives::{Buf, BytesMut, Receipt, TxType}; use reth_tracing::init_test_tracing; use tokio_util::codec::Decoder; diff --git a/crates/net/downloaders/src/test_utils/bodies_client.rs b/crates/net/downloaders/src/test_utils/bodies_client.rs index 7b655dae2..be8373f82 100644 --- a/crates/net/downloaders/src/test_utils/bodies_client.rs +++ b/crates/net/downloaders/src/test_utils/bodies_client.rs @@ -1,10 +1,11 @@ +use alloy_primitives::B256; use reth_network_p2p::{ bodies::client::{BodiesClient, BodiesFut}, download::DownloadClient, priority::Priority, }; use reth_network_peers::PeerId; -use reth_primitives::{BlockBody, B256}; +use reth_primitives::BlockBody; use std::{ collections::HashMap, fmt::Debug, diff --git a/crates/net/downloaders/src/test_utils/mod.rs b/crates/net/downloaders/src/test_utils/mod.rs index 320e7ce24..e83b7ee58 100644 --- a/crates/net/downloaders/src/test_utils/mod.rs +++ b/crates/net/downloaders/src/test_utils/mod.rs @@ -3,8 +3,9 @@ #![allow(dead_code)] use crate::{bodies::test_utils::create_raw_bodies, file_codec::BlockFileCodec}; +use alloy_primitives::B256; use futures::SinkExt; -use reth_primitives::{BlockBody, SealedHeader, B256}; +use reth_primitives::{BlockBody, SealedHeader}; use reth_testing_utils::generators::{self, random_block_range, BlockRangeParams}; use std::{collections::HashMap, io::SeekFrom, ops::RangeInclusive}; use tokio::{fs::File, io::AsyncSeekExt}; diff --git a/crates/net/eth-wire-types/Cargo.toml b/crates/net/eth-wire-types/Cargo.toml index a2df98965..4ec0bf8e4 100644 --- a/crates/net/eth-wire-types/Cargo.toml +++ b/crates/net/eth-wire-types/Cargo.toml @@ -19,8 +19,9 @@ reth-primitives.workspace = true # ethereum alloy-chains = { workspace = true, features = ["rlp"] } -alloy-rlp = { workspace = true, features = ["derive"] } alloy-genesis.workspace = true +alloy-primitives.workspace = true +alloy-rlp = { workspace = true, features = ["derive"] } bytes.workspace = true derive_more.workspace = true diff --git a/crates/net/eth-wire-types/src/blocks.rs b/crates/net/eth-wire-types/src/blocks.rs index b0a0d4a74..87344d72d 100644 --- a/crates/net/eth-wire-types/src/blocks.rs +++ b/crates/net/eth-wire-types/src/blocks.rs @@ -2,9 +2,10 @@ //! types. use crate::HeadersDirection; +use alloy_primitives::B256; use alloy_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper}; use reth_codecs_derive::add_arbitrary_tests; -use reth_primitives::{BlockBody, BlockHashOrNumber, Header, B256}; +use reth_primitives::{BlockBody, BlockHashOrNumber, Header}; /// A request for a peer to return block headers starting at the requested block. /// The peer must return at most [`limit`](#structfield.limit) headers. @@ -110,10 +111,10 @@ mod tests { message::RequestPair, BlockBodies, BlockHeaders, GetBlockBodies, GetBlockHeaders, HeadersDirection, }; + use alloy_primitives::{hex, TxKind, U256}; use alloy_rlp::{Decodable, Encodable}; use reth_primitives::{ - hex, BlockHashOrNumber, Header, Signature, Transaction, TransactionSigned, TxKind, - TxLegacy, U256, + BlockHashOrNumber, Header, Signature, Transaction, TransactionSigned, TxLegacy, }; use std::str::FromStr; diff --git a/crates/net/eth-wire-types/src/broadcast.rs b/crates/net/eth-wire-types/src/broadcast.rs index bdd657e9d..9afd244ad 100644 --- a/crates/net/eth-wire-types/src/broadcast.rs +++ b/crates/net/eth-wire-types/src/broadcast.rs @@ -5,11 +5,10 @@ use alloy_rlp::{ Decodable, Encodable, RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper, }; +use alloy_primitives::{Bytes, TxHash, B256, U128}; use derive_more::{Constructor, Deref, DerefMut, From, IntoIterator}; use reth_codecs_derive::add_arbitrary_tests; -use reth_primitives::{ - Block, Bytes, PooledTransactionsElement, TransactionSigned, TxHash, B256, U128, -}; +use reth_primitives::{Block, PooledTransactionsElement, TransactionSigned}; use std::{ collections::{HashMap, HashSet}, @@ -740,7 +739,7 @@ impl FromIterator<(TxHash, Eth68TxMetadata)> for RequestTxHashes { #[cfg(test)] mod tests { use super::*; - use reth_primitives::{b256, hex}; + use alloy_primitives::{b256, hex}; use std::str::FromStr; /// Takes as input a struct / encoded hex message pair, ensuring that we encode to the exact hex diff --git a/crates/net/eth-wire-types/src/disconnect_reason.rs b/crates/net/eth-wire-types/src/disconnect_reason.rs index 81db4945a..1792c5e2a 100644 --- a/crates/net/eth-wire-types/src/disconnect_reason.rs +++ b/crates/net/eth-wire-types/src/disconnect_reason.rs @@ -1,9 +1,9 @@ //! `RLPx` disconnect reason sent to/received from peer +use alloy_primitives::bytes::{Buf, BufMut}; use alloy_rlp::{Decodable, Encodable, Header}; use derive_more::Display; use reth_codecs_derive::add_arbitrary_tests; -use reth_primitives::bytes::{Buf, BufMut}; use thiserror::Error; /// RLPx disconnect reason. diff --git a/crates/net/eth-wire-types/src/header.rs b/crates/net/eth-wire-types/src/header.rs index 6c8d51071..2e2dbcfb1 100644 --- a/crates/net/eth-wire-types/src/header.rs +++ b/crates/net/eth-wire-types/src/header.rs @@ -87,8 +87,9 @@ impl From for bool { #[cfg(test)] mod tests { use super::*; + use alloy_primitives::{address, b256, bloom, bytes, hex, Address, Bytes, B256, U256}; use alloy_rlp::{Decodable, Encodable}; - use reth_primitives::{address, b256, bloom, bytes, hex, Address, Bytes, Header, B256, U256}; + use reth_primitives::Header; use std::str::FromStr; // Test vector from: https://eips.ethereum.org/EIPS/eip-2481 diff --git a/crates/net/eth-wire-types/src/message.rs b/crates/net/eth-wire-types/src/message.rs index 920f48b89..9ef8e6c71 100644 --- a/crates/net/eth-wire-types/src/message.rs +++ b/crates/net/eth-wire-types/src/message.rs @@ -13,8 +13,8 @@ use super::{ }; use crate::{EthVersion, SharedTransactions}; +use alloy_primitives::bytes::{Buf, BufMut}; use alloy_rlp::{length_of_length, Decodable, Encodable, Header}; -use reth_primitives::bytes::{Buf, BufMut}; use std::{fmt::Debug, sync::Arc}; /// [`MAX_MESSAGE_SIZE`] is the maximum cap on the size of a protocol message. @@ -496,8 +496,8 @@ mod tests { use crate::{ message::RequestPair, EthMessage, EthMessageID, GetNodeData, NodeData, ProtocolMessage, }; + use alloy_primitives::hex; use alloy_rlp::{Decodable, Encodable, Error}; - use reth_primitives::hex; fn encode(value: T) -> Vec { let mut buf = vec![]; diff --git a/crates/net/eth-wire-types/src/receipts.rs b/crates/net/eth-wire-types/src/receipts.rs index 3040b3090..db9d6f871 100644 --- a/crates/net/eth-wire-types/src/receipts.rs +++ b/crates/net/eth-wire-types/src/receipts.rs @@ -1,8 +1,9 @@ //! Implements the `GetReceipts` and `Receipts` message types. +use alloy_primitives::B256; use alloy_rlp::{RlpDecodableWrapper, RlpEncodableWrapper}; use reth_codecs_derive::add_arbitrary_tests; -use reth_primitives::{ReceiptWithBloom, B256}; +use reth_primitives::ReceiptWithBloom; /// A request for transaction receipts from the given block hashes. #[derive(Clone, Debug, PartialEq, Eq, RlpEncodableWrapper, RlpDecodableWrapper, Default)] @@ -28,8 +29,9 @@ pub struct Receipts( #[cfg(test)] mod tests { use crate::{message::RequestPair, GetReceipts, Receipts}; + use alloy_primitives::{hex, Log}; use alloy_rlp::{Decodable, Encodable}; - use reth_primitives::{hex, Log, Receipt, ReceiptWithBloom, TxType}; + use reth_primitives::{Receipt, ReceiptWithBloom, TxType}; #[test] fn roundtrip_eip1559() { diff --git a/crates/net/eth-wire-types/src/state.rs b/crates/net/eth-wire-types/src/state.rs index 8aabffb07..16a2959b3 100644 --- a/crates/net/eth-wire-types/src/state.rs +++ b/crates/net/eth-wire-types/src/state.rs @@ -1,8 +1,8 @@ //! Implements the `GetNodeData` and `NodeData` message types. +use alloy_primitives::{Bytes, B256}; use alloy_rlp::{RlpDecodableWrapper, RlpEncodableWrapper}; use reth_codecs_derive::add_arbitrary_tests; -use reth_primitives::{Bytes, B256}; /// A request for state tree nodes corresponding to the given hashes. /// This message was removed in `eth/67`, only clients running `eth/66` or earlier will respond to @@ -26,7 +26,7 @@ pub struct NodeData(pub Vec); #[cfg(test)] mod tests { - use reth_primitives::hex; + use alloy_primitives::hex; use crate::{message::RequestPair, GetNodeData, NodeData}; use alloy_rlp::{Decodable, Encodable}; diff --git a/crates/net/eth-wire-types/src/status.rs b/crates/net/eth-wire-types/src/status.rs index 80e10ddb3..91e4223a3 100644 --- a/crates/net/eth-wire-types/src/status.rs +++ b/crates/net/eth-wire-types/src/status.rs @@ -1,10 +1,11 @@ use crate::EthVersion; use alloy_chains::{Chain, NamedChain}; use alloy_genesis::Genesis; +use alloy_primitives::{hex, B256, U256}; use alloy_rlp::{RlpDecodable, RlpEncodable}; use reth_chainspec::{ChainSpec, MAINNET}; use reth_codecs_derive::add_arbitrary_tests; -use reth_primitives::{hex, EthereumHardfork, ForkId, Head, B256, U256}; +use reth_primitives::{EthereumHardfork, ForkId, Head}; use std::fmt::{Debug, Display}; /// The status message is used in the eth protocol handshake to ensure that peers are on the same @@ -152,9 +153,10 @@ impl Default for Status { /// /// # Example /// ``` +/// use alloy_primitives::{B256, U256}; /// use reth_chainspec::{Chain, EthereumHardfork, MAINNET}; /// use reth_eth_wire_types::{EthVersion, Status}; -/// use reth_primitives::{B256, MAINNET_GENESIS_HASH, U256}; +/// use reth_primitives::MAINNET_GENESIS_HASH; /// /// // this is just an example status message! /// let status = Status::builder() @@ -230,10 +232,11 @@ impl StatusBuilder { mod tests { use crate::{EthVersion, Status}; use alloy_genesis::Genesis; + use alloy_primitives::{hex, B256, U256}; use alloy_rlp::{Decodable, Encodable}; use rand::Rng; use reth_chainspec::{Chain, ChainSpec, ForkCondition, NamedChain}; - use reth_primitives::{hex, EthereumHardfork, ForkHash, ForkId, Head, B256, U256}; + use reth_primitives::{EthereumHardfork, ForkHash, ForkId, Head}; use std::str::FromStr; #[test] diff --git a/crates/net/eth-wire-types/src/transactions.rs b/crates/net/eth-wire-types/src/transactions.rs index 53291b1ae..d307ce43e 100644 --- a/crates/net/eth-wire-types/src/transactions.rs +++ b/crates/net/eth-wire-types/src/transactions.rs @@ -1,10 +1,11 @@ //! Implements the `GetPooledTransactions` and `PooledTransactions` message types. +use alloy_primitives::B256; use alloy_rlp::{RlpDecodableWrapper, RlpEncodableWrapper}; use derive_more::{Constructor, Deref, IntoIterator}; use reth_codecs_derive::add_arbitrary_tests; use reth_primitives::{ - transaction::TransactionConversionError, PooledTransactionsElement, TransactionSigned, B256, + transaction::TransactionConversionError, PooledTransactionsElement, TransactionSigned, }; /// A list of transaction hashes that the peer would like transaction bodies for. @@ -76,11 +77,11 @@ impl FromIterator for PooledTransactions { #[cfg(test)] mod tests { use crate::{message::RequestPair, GetPooledTransactions, PooledTransactions}; + use alloy_primitives::{hex, TxKind, U256}; use alloy_rlp::{Decodable, Encodable}; use reth_chainspec::MIN_TRANSACTION_GAS; use reth_primitives::{ - hex, PooledTransactionsElement, Signature, Transaction, TransactionSigned, TxEip1559, - TxKind, TxLegacy, U256, + PooledTransactionsElement, Signature, Transaction, TransactionSigned, TxEip1559, TxLegacy, }; use std::str::FromStr; diff --git a/crates/net/eth-wire/Cargo.toml b/crates/net/eth-wire/Cargo.toml index 4e1403c22..13224a37a 100644 --- a/crates/net/eth-wire/Cargo.toml +++ b/crates/net/eth-wire/Cargo.toml @@ -21,6 +21,9 @@ alloy-rlp = { workspace = true, features = ["derive"] } reth-eth-wire-types.workspace = true reth-network-peers.workspace = true +# ethereum +alloy-primitives.workspace = true + # metrics reth-metrics.workspace = true diff --git a/crates/net/eth-wire/src/capability.rs b/crates/net/eth-wire/src/capability.rs index 041400948..2a2f43d34 100644 --- a/crates/net/eth-wire/src/capability.rs +++ b/crates/net/eth-wire/src/capability.rs @@ -7,8 +7,8 @@ use crate::{ version::ParseVersionError, Capability, EthMessage, EthMessageID, EthVersion, }; +use alloy_primitives::bytes::Bytes; use derive_more::{Deref, DerefMut}; -use reth_primitives::bytes::Bytes; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::{ diff --git a/crates/net/eth-wire/src/disconnect.rs b/crates/net/eth-wire/src/disconnect.rs index 56a220291..f1f4c1278 100644 --- a/crates/net/eth-wire/src/disconnect.rs +++ b/crates/net/eth-wire/src/disconnect.rs @@ -47,8 +47,8 @@ where #[cfg(test)] mod tests { use crate::{p2pstream::P2PMessage, DisconnectReason}; + use alloy_primitives::hex; use alloy_rlp::{Decodable, Encodable}; - use reth_primitives::hex; fn all_reasons() -> Vec { vec![ diff --git a/crates/net/eth-wire/src/errors/eth.rs b/crates/net/eth-wire/src/errors/eth.rs index 485a4ae2e..557fbd66a 100644 --- a/crates/net/eth-wire/src/errors/eth.rs +++ b/crates/net/eth-wire/src/errors/eth.rs @@ -3,8 +3,9 @@ use crate::{ errors::P2PStreamError, message::MessageError, version::ParseVersionError, DisconnectReason, }; +use alloy_primitives::B256; use reth_chainspec::Chain; -use reth_primitives::{GotExpected, GotExpectedBoxed, ValidationError, B256}; +use reth_primitives::{GotExpected, GotExpectedBoxed, ValidationError}; use std::io; /// Errors when sending/receiving messages diff --git a/crates/net/eth-wire/src/ethstream.rs b/crates/net/eth-wire/src/ethstream.rs index 33ca14e38..9deca99fb 100644 --- a/crates/net/eth-wire/src/ethstream.rs +++ b/crates/net/eth-wire/src/ethstream.rs @@ -4,12 +4,10 @@ use crate::{ p2pstream::HANDSHAKE_TIMEOUT, CanDisconnect, DisconnectReason, EthMessage, EthVersion, ProtocolMessage, Status, }; +use alloy_primitives::bytes::{Bytes, BytesMut}; use futures::{ready, Sink, SinkExt, StreamExt}; use pin_project::pin_project; -use reth_primitives::{ - bytes::{Bytes, BytesMut}, - ForkFilter, GotExpected, -}; +use reth_primitives::{ForkFilter, GotExpected}; use std::{ pin::Pin, task::{Context, Poll}, @@ -353,11 +351,12 @@ mod tests { EthMessage, EthStream, EthVersion, HelloMessageWithProtocols, PassthroughCodec, ProtocolVersion, Status, }; + use alloy_primitives::{B256, U256}; use futures::{SinkExt, StreamExt}; use reth_chainspec::NamedChain; use reth_ecies::stream::ECIESStream; use reth_network_peers::pk2id; - use reth_primitives::{ForkFilter, Head, B256, U256}; + use reth_primitives::{ForkFilter, Head}; use secp256k1::{SecretKey, SECP256K1}; use std::time::Duration; use tokio::net::{TcpListener, TcpStream}; diff --git a/crates/net/eth-wire/src/p2pstream.rs b/crates/net/eth-wire/src/p2pstream.rs index 5d6171f7e..76075838b 100644 --- a/crates/net/eth-wire/src/p2pstream.rs +++ b/crates/net/eth-wire/src/p2pstream.rs @@ -5,15 +5,16 @@ use crate::{ pinger::{Pinger, PingerEvent}, DisconnectReason, HelloMessage, HelloMessageWithProtocols, }; +use alloy_primitives::{ + bytes::{Buf, BufMut, Bytes, BytesMut}, + hex, +}; use alloy_rlp::{Decodable, Encodable, Error as RlpError, EMPTY_LIST_CODE}; use futures::{Sink, SinkExt, StreamExt}; use pin_project::pin_project; use reth_codecs::add_arbitrary_tests; use reth_metrics::metrics::counter; -use reth_primitives::{ - bytes::{Buf, BufMut, Bytes, BytesMut}, - hex, GotExpected, -}; +use reth_primitives::GotExpected; use std::{ collections::VecDeque, io, diff --git a/crates/net/eth-wire/src/test_utils.rs b/crates/net/eth-wire/src/test_utils.rs index 5dfd8d74b..c6827dcac 100644 --- a/crates/net/eth-wire/src/test_utils.rs +++ b/crates/net/eth-wire/src/test_utils.rs @@ -4,9 +4,10 @@ use crate::{ hello::DEFAULT_TCP_PORT, EthVersion, HelloMessageWithProtocols, P2PStream, ProtocolVersion, Status, UnauthedP2PStream, }; +use alloy_primitives::{B256, U256}; use reth_chainspec::Chain; use reth_network_peers::pk2id; -use reth_primitives::{ForkFilter, Head, B256, U256}; +use reth_primitives::{ForkFilter, Head}; use secp256k1::{SecretKey, SECP256K1}; use std::net::SocketAddr; use tokio::net::TcpStream; diff --git a/crates/net/eth-wire/tests/new_block.rs b/crates/net/eth-wire/tests/new_block.rs index a1a6e043e..266752b74 100644 --- a/crates/net/eth-wire/tests/new_block.rs +++ b/crates/net/eth-wire/tests/new_block.rs @@ -1,8 +1,8 @@ //! Decoding tests for [`NewBlock`] +use alloy_primitives::hex; use alloy_rlp::Decodable; use reth_eth_wire::NewBlock; -use reth_primitives::hex; use std::{fs, path::PathBuf}; #[test] diff --git a/crates/net/eth-wire/tests/new_pooled_transactions.rs b/crates/net/eth-wire/tests/new_pooled_transactions.rs index 48022185c..e876a78cd 100644 --- a/crates/net/eth-wire/tests/new_pooled_transactions.rs +++ b/crates/net/eth-wire/tests/new_pooled_transactions.rs @@ -1,8 +1,8 @@ //! Decoding tests for [`NewPooledTransactions`] +use alloy_primitives::hex; use alloy_rlp::Decodable; use reth_eth_wire::NewPooledTransactionHashes66; -use reth_primitives::hex; use std::{fs, path::PathBuf}; #[test] diff --git a/crates/net/eth-wire/tests/pooled_transactions.rs b/crates/net/eth-wire/tests/pooled_transactions.rs index 5f7431f3d..7927384c9 100644 --- a/crates/net/eth-wire/tests/pooled_transactions.rs +++ b/crates/net/eth-wire/tests/pooled_transactions.rs @@ -1,8 +1,9 @@ //! Decoding tests for [`PooledTransactions`] +use alloy_primitives::hex; use alloy_rlp::{Decodable, Encodable}; use reth_eth_wire::{EthVersion, PooledTransactions, ProtocolMessage}; -use reth_primitives::{hex, PooledTransactionsElement}; +use reth_primitives::PooledTransactionsElement; use std::{fs, path::PathBuf}; use test_fuzz::test_fuzz; diff --git a/crates/net/network/Cargo.toml b/crates/net/network/Cargo.toml index 9c616c5ce..5bb5254a9 100644 --- a/crates/net/network/Cargo.toml +++ b/crates/net/network/Cargo.toml @@ -34,8 +34,9 @@ reth-network-peers = { workspace = true, features = ["net"] } reth-network-types.workspace = true # ethereum -enr = { workspace = true, features = ["serde", "rust-secp256k1"] } +alloy-primitives.workspace = true alloy-rlp.workspace = true +enr = { workspace = true, features = ["serde", "rust-secp256k1"] } discv5.workspace = true # async/futures diff --git a/crates/net/network/benches/bench.rs b/crates/net/network/benches/bench.rs index 7f6b37177..ebe14a7ea 100644 --- a/crates/net/network/benches/bench.rs +++ b/crates/net/network/benches/bench.rs @@ -1,11 +1,11 @@ #![allow(missing_docs)] +use alloy_primitives::U256; use criterion::*; use futures::StreamExt; use pprof::criterion::{Output, PProfProfiler}; use rand::thread_rng; use reth_network::{test_utils::Testnet, NetworkEventListenerProvider}; use reth_network_api::Peers; -use reth_primitives::U256; use reth_provider::test_utils::{ExtendedAccount, MockEthProvider}; use reth_transaction_pool::{test_utils::TransactionGenerator, PoolTransaction}; use std::sync::Arc; diff --git a/crates/net/network/src/fetch/client.rs b/crates/net/network/src/fetch/client.rs index 28023c0a2..c47ee5d23 100644 --- a/crates/net/network/src/fetch/client.rs +++ b/crates/net/network/src/fetch/client.rs @@ -5,6 +5,7 @@ use std::sync::{ Arc, }; +use alloy_primitives::B256; use futures::{future, future::Either}; use reth_network_api::test_utils::PeersHandle; use reth_network_p2p::{ @@ -16,7 +17,7 @@ use reth_network_p2p::{ }; use reth_network_peers::PeerId; use reth_network_types::ReputationChangeKind; -use reth_primitives::{Header, B256}; +use reth_primitives::Header; use tokio::sync::{mpsc::UnboundedSender, oneshot}; use crate::{fetch::DownloadRequest, flattened_response::FlattenedResponse}; diff --git a/crates/net/network/src/fetch/mod.rs b/crates/net/network/src/fetch/mod.rs index 31ed4895b..f5c0006bc 100644 --- a/crates/net/network/src/fetch/mod.rs +++ b/crates/net/network/src/fetch/mod.rs @@ -13,6 +13,7 @@ use std::{ task::{Context, Poll}, }; +use alloy_primitives::B256; use futures::StreamExt; use reth_eth_wire::{GetBlockBodies, GetBlockHeaders}; use reth_network_api::test_utils::PeersHandle; @@ -23,7 +24,7 @@ use reth_network_p2p::{ }; use reth_network_peers::PeerId; use reth_network_types::ReputationChangeKind; -use reth_primitives::{BlockBody, Header, B256}; +use reth_primitives::{BlockBody, Header}; use tokio::sync::{mpsc, mpsc::UnboundedSender, oneshot}; use tokio_stream::wrappers::UnboundedReceiverStream; @@ -471,7 +472,8 @@ pub(crate) enum BlockResponseOutcome { mod tests { use super::*; use crate::{peers::PeersManager, PeersConfig}; - use reth_primitives::{SealedHeader, B512}; + use alloy_primitives::B512; + use reth_primitives::SealedHeader; use std::future::poll_fn; #[tokio::test(flavor = "multi_thread")] diff --git a/crates/net/network/src/message.rs b/crates/net/network/src/message.rs index 10f9ddcba..6b8287fe5 100644 --- a/crates/net/network/src/message.rs +++ b/crates/net/network/src/message.rs @@ -8,6 +8,7 @@ use std::{ task::{ready, Context, Poll}, }; +use alloy_primitives::{Bytes, B256}; use futures::FutureExt; use reth_eth_wire::{ capability::RawCapabilityMessage, message::RequestPair, BlockBodies, BlockHeaders, EthMessage, @@ -16,9 +17,7 @@ use reth_eth_wire::{ }; use reth_network_api::PeerRequest; use reth_network_p2p::error::{RequestError, RequestResult}; -use reth_primitives::{ - BlockBody, Bytes, Header, PooledTransactionsElement, ReceiptWithBloom, B256, -}; +use reth_primitives::{BlockBody, Header, PooledTransactionsElement, ReceiptWithBloom}; use tokio::sync::oneshot; /// Internal form of a `NewBlock` message diff --git a/crates/net/network/src/network.rs b/crates/net/network/src/network.rs index 94c2ef92d..de3a0ab74 100644 --- a/crates/net/network/src/network.rs +++ b/crates/net/network/src/network.rs @@ -6,6 +6,7 @@ use std::{ }, }; +use alloy_primitives::B256; use enr::Enr; use parking_lot::Mutex; use reth_discv4::Discv4; @@ -23,7 +24,7 @@ use reth_network_p2p::{ }; use reth_network_peers::{NodeRecord, PeerId}; use reth_network_types::{PeerAddr, PeerKind, Reputation, ReputationChangeKind}; -use reth_primitives::{Head, TransactionSigned, B256}; +use reth_primitives::{Head, TransactionSigned}; use reth_tokio_util::{EventSender, EventStream}; use secp256k1::SecretKey; use tokio::sync::{ diff --git a/crates/net/network/src/peers.rs b/crates/net/network/src/peers.rs index 220fdf18d..bc2b11897 100644 --- a/crates/net/network/src/peers.rs +++ b/crates/net/network/src/peers.rs @@ -1099,6 +1099,7 @@ mod tests { time::Duration, }; + use alloy_primitives::B512; use reth_eth_wire::{ errors::{EthHandshakeError, EthStreamError, P2PHandshakeError, P2PStreamError}, DisconnectReason, @@ -1109,7 +1110,6 @@ mod tests { use reth_network_types::{ peers::reputation::DEFAULT_REPUTATION, BackoffKind, ReputationChangeKind, }; - use reth_primitives::B512; use url::Host; use super::PeersManager; diff --git a/crates/net/network/src/state.rs b/crates/net/network/src/state.rs index a45121363..5caa656a9 100644 --- a/crates/net/network/src/state.rs +++ b/crates/net/network/src/state.rs @@ -12,12 +12,13 @@ use std::{ task::{Context, Poll}, }; +use alloy_primitives::B256; use rand::seq::SliceRandom; use reth_eth_wire::{BlockHashNumber, Capabilities, DisconnectReason, NewBlockHashes, Status}; use reth_network_api::{DiscoveredEvent, DiscoveryEvent, PeerRequest, PeerRequestSender}; use reth_network_peers::PeerId; use reth_network_types::{PeerAddr, PeerKind}; -use reth_primitives::{ForkId, B256}; +use reth_primitives::ForkId; use tokio::sync::oneshot; use tracing::{debug, trace}; @@ -550,11 +551,12 @@ mod tests { sync::{atomic::AtomicU64, Arc}, }; + use alloy_primitives::B256; use reth_eth_wire::{BlockBodies, Capabilities, Capability, EthVersion}; use reth_network_api::PeerRequestSender; use reth_network_p2p::{bodies::client::BodiesClient, error::RequestError}; use reth_network_peers::PeerId; - use reth_primitives::{BlockBody, Header, B256}; + use reth_primitives::{BlockBody, Header}; use reth_provider::test_utils::NoopProvider; use tokio::sync::mpsc; use tokio_stream::{wrappers::ReceiverStream, StreamExt}; diff --git a/crates/net/network/src/transactions/constants.rs b/crates/net/network/src/transactions/constants.rs index 7eef8165c..4213c171e 100644 --- a/crates/net/network/src/transactions/constants.rs +++ b/crates/net/network/src/transactions/constants.rs @@ -81,8 +81,8 @@ pub mod tx_fetcher { /* ==================== RETRIES ==================== */ - /// Default maximum request retires per [`TxHash`](reth_primitives::TxHash). Note, this is - /// reset should the [`TxHash`](reth_primitives::TxHash) re-appear in an announcement after it + /// Default maximum request retires per [`TxHash`](alloy_primitives::TxHash). Note, this is + /// reset should the [`TxHash`](alloy_primitives::TxHash) re-appear in an announcement after it /// has been evicted from the hashes pending fetch cache, i.e. the counter is restarted. If /// this happens, it is likely a very popular transaction, that should and can indeed be /// fetched hence this behaviour is favourable. diff --git a/crates/net/network/src/transactions/fetcher.rs b/crates/net/network/src/transactions/fetcher.rs index f553cfbfd..45dfb3319 100644 --- a/crates/net/network/src/transactions/fetcher.rs +++ b/crates/net/network/src/transactions/fetcher.rs @@ -32,6 +32,7 @@ use std::{ time::Duration, }; +use alloy_primitives::TxHash; use derive_more::{Constructor, Deref}; use futures::{stream::FuturesUnordered, Future, FutureExt, Stream, StreamExt}; use pin_project::pin_project; @@ -42,7 +43,7 @@ use reth_eth_wire::{ use reth_network_api::PeerRequest; use reth_network_p2p::error::{RequestError, RequestResult}; use reth_network_peers::PeerId; -use reth_primitives::{PooledTransactionsElement, TxHash}; +use reth_primitives::PooledTransactionsElement; use schnellru::ByLength; #[cfg(debug_assertions)] use smallvec::{smallvec, SmallVec}; @@ -1337,9 +1338,10 @@ struct TxFetcherSearchDurations { mod test { use std::{collections::HashSet, str::FromStr}; + use alloy_primitives::{hex, B256}; use alloy_rlp::Decodable; use derive_more::IntoIterator; - use reth_primitives::{hex, TransactionSigned, B256}; + use reth_primitives::TransactionSigned; use crate::transactions::tests::{default_cache, new_mock_session}; diff --git a/crates/net/network/src/transactions/mod.rs b/crates/net/network/src/transactions/mod.rs index 16b5d4785..7e3b71aa4 100644 --- a/crates/net/network/src/transactions/mod.rs +++ b/crates/net/network/src/transactions/mod.rs @@ -31,6 +31,7 @@ use std::{ time::{Duration, Instant}, }; +use alloy_primitives::{TxHash, B256}; use futures::{stream::FuturesUnordered, Future, StreamExt}; use reth_eth_wire::{ DedupPayload, EthVersion, GetPooledTransactions, HandleMempoolData, HandleVersionedMempoolData, @@ -47,9 +48,7 @@ use reth_network_p2p::{ }; use reth_network_peers::PeerId; use reth_network_types::ReputationChangeKind; -use reth_primitives::{ - PooledTransactionsElement, TransactionSigned, TransactionSignedEcRecovered, TxHash, B256, -}; +use reth_primitives::{PooledTransactionsElement, TransactionSigned, TransactionSignedEcRecovered}; use reth_tokio_util::EventStream; use reth_transaction_pool::{ error::{PoolError, PoolResult}, @@ -1738,6 +1737,7 @@ struct TxManagerPollDurations { mod tests { use super::*; use crate::{test_utils::Testnet, NetworkConfigBuilder, NetworkManager}; + use alloy_primitives::hex; use alloy_rlp::Decodable; use constants::tx_fetcher::DEFAULT_MAX_COUNT_FALLBACK_PEERS; use futures::FutureExt; @@ -1746,7 +1746,6 @@ mod tests { 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, MockTransactionFactory, TestPool, diff --git a/crates/net/network/src/transactions/validation.rs b/crates/net/network/src/transactions/validation.rs index 6f44d5485..f7f7b8011 100644 --- a/crates/net/network/src/transactions/validation.rs +++ b/crates/net/network/src/transactions/validation.rs @@ -5,12 +5,13 @@ use std::{fmt, fmt::Display, mem}; use crate::metrics::{AnnouncedTxTypesMetrics, TxTypesCounter}; +use alloy_primitives::{Signature, TxHash}; use derive_more::{Deref, DerefMut}; use reth_eth_wire::{ DedupPayload, Eth68TxMetadata, HandleMempoolData, PartiallyValidData, ValidAnnouncementData, MAX_MESSAGE_SIZE, }; -use reth_primitives::{Signature, TxHash, TxType}; +use reth_primitives::TxType; use tracing::trace; /// The size of a decoded signature in bytes. @@ -336,8 +337,8 @@ impl FilterAnnouncement for EthMessageFilter { mod test { use super::*; + use alloy_primitives::B256; use reth_eth_wire::{NewPooledTransactionHashes66, NewPooledTransactionHashes68}; - use reth_primitives::B256; use std::{collections::HashMap, str::FromStr}; #[test] 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 866d94b2d..c4c76409d 100644 --- a/crates/net/network/tests/it/big_pooled_txs_req.rs +++ b/crates/net/network/tests/it/big_pooled_txs_req.rs @@ -1,3 +1,4 @@ +use alloy_primitives::B256; use reth_eth_wire::{GetPooledTransactions, PooledTransactions}; use reth_network::{ test_utils::{NetworkEventStream, Testnet}, @@ -5,7 +6,7 @@ use reth_network::{ }; use reth_network_api::{NetworkInfo, Peers}; use reth_network_p2p::sync::{NetworkSyncUpdater, SyncState}; -use reth_primitives::{Signature, TransactionSigned, B256}; +use reth_primitives::{Signature, TransactionSigned}; use reth_provider::test_utils::MockEthProvider; use reth_transaction_pool::{ test_utils::{testing_pool, MockTransaction}, diff --git a/crates/net/network/tests/it/requests.rs b/crates/net/network/tests/it/requests.rs index d10a3c1f7..394301228 100644 --- a/crates/net/network/tests/it/requests.rs +++ b/crates/net/network/tests/it/requests.rs @@ -3,6 +3,7 @@ use std::sync::Arc; +use alloy_primitives::{Bytes, TxKind, U256}; use rand::Rng; use reth_eth_wire::HeadersDirection; use reth_network::{ @@ -15,8 +16,7 @@ use reth_network_p2p::{ headers::client::{HeadersClient, HeadersRequest}, }; use reth_primitives::{ - Block, BlockBody, Bytes, Header, Signature, Transaction, TransactionSigned, TxEip2930, TxKind, - U256, + Block, BlockBody, Header, Signature, Transaction, TransactionSigned, TxEip2930, }; use reth_provider::test_utils::MockEthProvider; diff --git a/crates/net/network/tests/it/txgossip.rs b/crates/net/network/tests/it/txgossip.rs index 0467f10fe..3833de24d 100644 --- a/crates/net/network/tests/it/txgossip.rs +++ b/crates/net/network/tests/it/txgossip.rs @@ -2,11 +2,12 @@ use std::sync::Arc; +use alloy_primitives::U256; use futures::StreamExt; use rand::thread_rng; use reth_network::{test_utils::Testnet, NetworkEvent, NetworkEventListenerProvider}; use reth_network_api::PeersInfo; -use reth_primitives::{TransactionSigned, TxLegacy, U256}; +use reth_primitives::{TransactionSigned, TxLegacy}; use reth_provider::test_utils::{ExtendedAccount, MockEthProvider}; use reth_transaction_pool::{test_utils::TransactionGenerator, PoolTransaction, TransactionPool}; diff --git a/crates/net/p2p/Cargo.toml b/crates/net/p2p/Cargo.toml index 9969842b2..e7b268c4b 100644 --- a/crates/net/p2p/Cargo.toml +++ b/crates/net/p2p/Cargo.toml @@ -12,6 +12,7 @@ description = "traits and commonly used types for p2p and network communication" workspace = true [dependencies] +# reth reth-primitives.workspace = true reth-eth-wire-types.workspace = true reth-consensus.workspace = true @@ -19,6 +20,9 @@ reth-network-peers.workspace = true reth-network-types.workspace = true reth-storage-errors.workspace = true +# ethereum +alloy-primitives.workspace = true + # async futures.workspace = true tokio = { workspace = true, features = ["sync"] } diff --git a/crates/net/p2p/src/bodies/client.rs b/crates/net/p2p/src/bodies/client.rs index 3a36da500..2a4b57c23 100644 --- a/crates/net/p2p/src/bodies/client.rs +++ b/crates/net/p2p/src/bodies/client.rs @@ -4,8 +4,9 @@ use std::{ }; use crate::{download::DownloadClient, error::PeerRequestResult, priority::Priority}; +use alloy_primitives::B256; use futures::{Future, FutureExt}; -use reth_primitives::{BlockBody, B256}; +use reth_primitives::BlockBody; /// The bodies future type pub type BodiesFut = Pin>> + Send + Sync>>; diff --git a/crates/net/p2p/src/bodies/downloader.rs b/crates/net/p2p/src/bodies/downloader.rs index 414a33fd4..b55229fa2 100644 --- a/crates/net/p2p/src/bodies/downloader.rs +++ b/crates/net/p2p/src/bodies/downloader.rs @@ -1,7 +1,7 @@ use super::response::BlockResponse; use crate::error::DownloadResult; +use alloy_primitives::BlockNumber; use futures::Stream; -use reth_primitives::BlockNumber; use std::ops::RangeInclusive; /// Body downloader return type. diff --git a/crates/net/p2p/src/bodies/response.rs b/crates/net/p2p/src/bodies/response.rs index ae7bd1cf8..8ae840fbf 100644 --- a/crates/net/p2p/src/bodies/response.rs +++ b/crates/net/p2p/src/bodies/response.rs @@ -1,4 +1,5 @@ -use reth_primitives::{BlockNumber, SealedBlock, SealedHeader, U256}; +use alloy_primitives::{BlockNumber, U256}; +use reth_primitives::{SealedBlock, SealedHeader}; /// The block response #[derive(PartialEq, Eq, Debug, Clone)] diff --git a/crates/net/p2p/src/either.rs b/crates/net/p2p/src/either.rs index 5d0014e6f..30650069b 100644 --- a/crates/net/p2p/src/either.rs +++ b/crates/net/p2p/src/either.rs @@ -6,7 +6,7 @@ use crate::{ headers::client::{HeadersClient, HeadersRequest}, priority::Priority, }; -use reth_primitives::B256; +use alloy_primitives::B256; pub use futures::future::Either; diff --git a/crates/net/p2p/src/error.rs b/crates/net/p2p/src/error.rs index a52b9ccda..96fc04420 100644 --- a/crates/net/p2p/src/error.rs +++ b/crates/net/p2p/src/error.rs @@ -1,13 +1,12 @@ use std::ops::RangeInclusive; use super::headers::client::HeadersRequest; +use alloy_primitives::{BlockNumber, B256}; use derive_more::{Display, Error}; use reth_consensus::ConsensusError; use reth_network_peers::WithPeerId; use reth_network_types::ReputationChangeKind; -use reth_primitives::{ - BlockHashOrNumber, BlockNumber, GotExpected, GotExpectedBoxed, Header, B256, -}; +use reth_primitives::{BlockHashOrNumber, GotExpected, GotExpectedBoxed, Header}; 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 148dc0955..07aa34a8d 100644 --- a/crates/net/p2p/src/full_block.rs +++ b/crates/net/p2p/src/full_block.rs @@ -5,10 +5,11 @@ use crate::{ headers::client::{HeadersClient, SingleHeaderRequest}, BlockClient, }; +use alloy_primitives::B256; use reth_consensus::{Consensus, ConsensusError}; use reth_eth_wire_types::HeadersDirection; use reth_network_peers::WithPeerId; -use reth_primitives::{BlockBody, GotExpected, Header, SealedBlock, SealedHeader, B256}; +use reth_primitives::{BlockBody, GotExpected, Header, SealedBlock, SealedHeader}; use std::{ cmp::Reverse, collections::{HashMap, VecDeque}, diff --git a/crates/net/p2p/src/headers/downloader.rs b/crates/net/p2p/src/headers/downloader.rs index a568c7313..f3222d4bd 100644 --- a/crates/net/p2p/src/headers/downloader.rs +++ b/crates/net/p2p/src/headers/downloader.rs @@ -1,8 +1,9 @@ use super::error::HeadersDownloaderResult; use crate::error::{DownloadError, DownloadResult}; +use alloy_primitives::B256; use futures::Stream; use reth_consensus::Consensus; -use reth_primitives::{BlockHashOrNumber, SealedHeader, B256}; +use reth_primitives::{BlockHashOrNumber, SealedHeader}; /// A downloader capable of fetching and yielding block headers. /// /// A downloader represents a distinct strategy for submitting requests to download block headers, diff --git a/crates/net/p2p/src/test_utils/bodies.rs b/crates/net/p2p/src/test_utils/bodies.rs index 7f14133ab..cfd292129 100644 --- a/crates/net/p2p/src/test_utils/bodies.rs +++ b/crates/net/p2p/src/test_utils/bodies.rs @@ -4,8 +4,9 @@ use crate::{ error::PeerRequestResult, priority::Priority, }; +use alloy_primitives::B256; use futures::FutureExt; -use reth_primitives::{BlockBody, B256}; +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 731aa39e7..2749915c7 100644 --- a/crates/net/p2p/src/test_utils/full_block.rs +++ b/crates/net/p2p/src/test_utils/full_block.rs @@ -5,11 +5,12 @@ use crate::{ headers::client::{HeadersClient, HeadersRequest}, priority::Priority, }; +use alloy_primitives::B256; use parking_lot::Mutex; use reth_eth_wire_types::HeadersDirection; use reth_network_peers::{PeerId, WithPeerId}; use reth_primitives::{ - BlockBody, BlockHashOrNumber, BlockNumHash, Header, SealedBlock, SealedHeader, B256, + BlockBody, BlockHashOrNumber, BlockNumHash, Header, SealedBlock, SealedHeader, }; use std::{collections::HashMap, sync::Arc};