mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
net: replace reth-primitive imports (#11023)
This commit is contained in:
committed by
GitHub
parent
883975dc90
commit
ae9b13f4a1
5
Cargo.lock
generated
5
Cargo.lock
generated
@ -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",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
};
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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>(
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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},
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -87,8 +87,9 @@ impl From<HeadersDirection> 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
|
||||
|
||||
@ -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<T: Encodable>(value: T) -> Vec<u8> {
|
||||
let mut buf = vec![];
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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<Bytes>);
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use reth_primitives::hex;
|
||||
use alloy_primitives::hex;
|
||||
|
||||
use crate::{message::RequestPair, GetNodeData, NodeData};
|
||||
use alloy_rlp::{Decodable, Encodable};
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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<PooledTransactionsElement> 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;
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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::{
|
||||
|
||||
@ -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<DisconnectReason> {
|
||||
vec![
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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")]
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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::{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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};
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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},
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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};
|
||||
|
||||
|
||||
@ -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"] }
|
||||
|
||||
@ -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<Box<dyn Future<Output = PeerRequestResult<Vec<BlockBody>>> + Send + Sync>>;
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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)]
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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};
|
||||
|
||||
|
||||
@ -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},
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user