mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
net: replace reth-primitive imports with alloy-eips (#11027)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
committed by
GitHub
parent
4ae286e69f
commit
08bdec9efa
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -6849,6 +6849,7 @@ dependencies = [
|
||||
name = "reth-downloaders"
|
||||
version = "1.0.7"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
"assert_matches",
|
||||
@ -7146,6 +7147,7 @@ name = "reth-eth-wire-types"
|
||||
version = "1.0.7"
|
||||
dependencies = [
|
||||
"alloy-chains",
|
||||
"alloy-eips",
|
||||
"alloy-genesis",
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
@ -7546,6 +7548,7 @@ dependencies = [
|
||||
name = "reth-network"
|
||||
version = "1.0.7"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-node-bindings",
|
||||
"alloy-primitives",
|
||||
"alloy-provider",
|
||||
@ -7626,6 +7629,7 @@ dependencies = [
|
||||
name = "reth-network-p2p"
|
||||
version = "1.0.7"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"auto_impl",
|
||||
"derive_more",
|
||||
|
||||
@ -27,6 +27,7 @@ reth-db-api = { workspace = true, optional = true }
|
||||
reth-testing-utils = { workspace = true, optional = true }
|
||||
|
||||
# ethereum
|
||||
alloy-eips.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
alloy-rlp.workspace = true
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use std::{collections::HashMap, io, path::Path};
|
||||
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
use alloy_primitives::{BlockHash, BlockNumber, B256};
|
||||
use futures::Future;
|
||||
use itertools::Either;
|
||||
@ -11,7 +12,7 @@ use reth_network_p2p::{
|
||||
priority::Priority,
|
||||
};
|
||||
use reth_network_peers::PeerId;
|
||||
use reth_primitives::{BlockBody, BlockHashOrNumber, Header, SealedHeader};
|
||||
use reth_primitives::{BlockBody, Header, SealedHeader};
|
||||
use thiserror::Error;
|
||||
use tokio::{fs::File, io::AsyncReadExt};
|
||||
use tokio_stream::StreamExt;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
use super::task::TaskDownloader;
|
||||
use crate::metrics::HeaderDownloaderMetrics;
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
use alloy_primitives::{BlockNumber, B256};
|
||||
use futures::{stream::Stream, FutureExt};
|
||||
use futures_util::{stream::FuturesUnordered, StreamExt};
|
||||
@ -18,7 +19,7 @@ use reth_network_p2p::{
|
||||
priority::Priority,
|
||||
};
|
||||
use reth_network_peers::PeerId;
|
||||
use reth_primitives::{BlockHashOrNumber, GotExpected, Header, SealedHeader};
|
||||
use reth_primitives::{GotExpected, Header, SealedHeader};
|
||||
use reth_tasks::{TaskSpawner, TokioTaskExecutor};
|
||||
use std::{
|
||||
cmp::{Ordering, Reverse},
|
||||
|
||||
@ -19,6 +19,7 @@ reth-primitives.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-chains = { workspace = true, features = ["rlp"] }
|
||||
alloy-eips.workspace = true
|
||||
alloy-genesis.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
alloy-rlp = { workspace = true, features = ["derive"] }
|
||||
|
||||
@ -2,10 +2,11 @@
|
||||
//! types.
|
||||
|
||||
use crate::HeadersDirection;
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
use alloy_primitives::B256;
|
||||
use alloy_rlp::{RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper};
|
||||
use reth_codecs_derive::add_arbitrary_tests;
|
||||
use reth_primitives::{BlockBody, BlockHashOrNumber, Header};
|
||||
use reth_primitives::{BlockBody, 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.
|
||||
|
||||
@ -57,7 +57,7 @@ pub mod fuzz_rlp {
|
||||
NewPooledTransactionHashes66, NewPooledTransactionHashes68, NodeData, P2PMessage,
|
||||
PooledTransactions, Receipts, Status, Transactions,
|
||||
};
|
||||
use reth_primitives::{BlockHashOrNumber, TransactionSigned};
|
||||
use reth_primitives::TransactionSigned;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use test_fuzz::test_fuzz;
|
||||
|
||||
@ -139,7 +139,7 @@ pub mod fuzz_rlp {
|
||||
impl Default for GetBlockHeadersWrapper {
|
||||
fn default() -> Self {
|
||||
Self(GetBlockHeaders {
|
||||
start_block: BlockHashOrNumber::Number(0),
|
||||
start_block: 0u64.into(),
|
||||
limit: Default::default(),
|
||||
skip: Default::default(),
|
||||
direction: Default::default(),
|
||||
|
||||
@ -34,6 +34,7 @@ reth-network-peers = { workspace = true, features = ["net"] }
|
||||
reth-network-types.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-eips.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
alloy-rlp.workspace = true
|
||||
enr = { workspace = true, features = ["serde", "rust-secp256k1"] }
|
||||
|
||||
@ -7,6 +7,7 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
use alloy_rlp::Encodable;
|
||||
use futures::StreamExt;
|
||||
use reth_eth_wire::{
|
||||
@ -16,7 +17,7 @@ use reth_eth_wire::{
|
||||
use reth_network_api::test_utils::PeersHandle;
|
||||
use reth_network_p2p::error::RequestResult;
|
||||
use reth_network_peers::PeerId;
|
||||
use reth_primitives::{BlockBody, BlockHashOrNumber, Header};
|
||||
use reth_primitives::{BlockBody, Header};
|
||||
use reth_storage_api::{BlockReader, HeaderProvider, ReceiptProvider};
|
||||
use tokio::sync::{mpsc::Receiver, oneshot};
|
||||
use tokio_stream::wrappers::ReceiverStream;
|
||||
|
||||
@ -21,6 +21,7 @@ reth-network-types.workspace = true
|
||||
reth-storage-errors.workspace = true
|
||||
|
||||
# ethereum
|
||||
alloy-eips.workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
|
||||
# async
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
use std::ops::RangeInclusive;
|
||||
|
||||
use super::headers::client::HeadersRequest;
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
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, GotExpected, GotExpectedBoxed, Header};
|
||||
use reth_primitives::{GotExpected, GotExpectedBoxed, Header};
|
||||
use reth_storage_errors::{db::DatabaseError, provider::ProviderError};
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
use crate::{download::DownloadClient, error::PeerRequestResult, priority::Priority};
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
use futures::{Future, FutureExt};
|
||||
pub use reth_eth_wire_types::{BlockHeaders, HeadersDirection};
|
||||
use reth_primitives::{BlockHashOrNumber, Header};
|
||||
use reth_primitives::Header;
|
||||
use std::{
|
||||
fmt::Debug,
|
||||
pin::Pin,
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
use super::error::HeadersDownloaderResult;
|
||||
use crate::error::{DownloadError, DownloadResult};
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
use alloy_primitives::B256;
|
||||
use futures::Stream;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_primitives::{BlockHashOrNumber, SealedHeader};
|
||||
use reth_primitives::SealedHeader;
|
||||
/// A downloader capable of fetching and yielding block headers.
|
||||
///
|
||||
/// A downloader represents a distinct strategy for submitting requests to download block headers,
|
||||
|
||||
@ -5,13 +5,12 @@ use crate::{
|
||||
headers::client::{HeadersClient, HeadersRequest},
|
||||
priority::Priority,
|
||||
};
|
||||
use alloy_eips::{BlockHashOrNumber, BlockNumHash};
|
||||
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,
|
||||
};
|
||||
use reth_primitives::{BlockBody, Header, SealedBlock, SealedHeader};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
/// A headers+bodies client implementation that does nothing.
|
||||
|
||||
@ -108,7 +108,7 @@ impl TestDownload {
|
||||
let request = HeadersRequest {
|
||||
limit: self.limit,
|
||||
direction: HeadersDirection::Rising,
|
||||
start: reth_primitives::BlockHashOrNumber::Number(0), // ignored
|
||||
start: 0u64.into(), // ignored
|
||||
};
|
||||
let client = self.client.clone();
|
||||
self.fut = Some(Box::pin(client.get_headers(request)));
|
||||
|
||||
Reference in New Issue
Block a user