mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: rm reth_primitives from reth_net_p2p (#14258)
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -7882,9 +7882,9 @@ dependencies = [
|
|||||||
"parking_lot",
|
"parking_lot",
|
||||||
"reth-consensus",
|
"reth-consensus",
|
||||||
"reth-eth-wire-types",
|
"reth-eth-wire-types",
|
||||||
|
"reth-ethereum-primitives",
|
||||||
"reth-network-peers",
|
"reth-network-peers",
|
||||||
"reth-network-types",
|
"reth-network-types",
|
||||||
"reth-primitives",
|
|
||||||
"reth-primitives-traits",
|
"reth-primitives-traits",
|
||||||
"reth-storage-errors",
|
"reth-storage-errors",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|||||||
@ -13,7 +13,7 @@ workspace = true
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# reth
|
# reth
|
||||||
reth-primitives.workspace = true
|
reth-ethereum-primitives.workspace = true
|
||||||
reth-primitives-traits.workspace = true
|
reth-primitives-traits.workspace = true
|
||||||
reth-eth-wire-types.workspace = true
|
reth-eth-wire-types.workspace = true
|
||||||
reth-consensus.workspace = true
|
reth-consensus.workspace = true
|
||||||
@ -48,13 +48,13 @@ test-utils = [
|
|||||||
"reth-consensus/test-utils",
|
"reth-consensus/test-utils",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"reth-network-types/test-utils",
|
"reth-network-types/test-utils",
|
||||||
"reth-primitives/test-utils",
|
"reth-ethereum-primitives/test-utils",
|
||||||
"reth-primitives-traits/test-utils",
|
"reth-primitives-traits/test-utils",
|
||||||
"alloy-primitives/rand",
|
"alloy-primitives/rand",
|
||||||
]
|
]
|
||||||
std = [
|
std = [
|
||||||
"reth-consensus/std",
|
"reth-consensus/std",
|
||||||
"reth-primitives/std",
|
"reth-ethereum-primitives/std",
|
||||||
"alloy-eips/std",
|
"alloy-eips/std",
|
||||||
"alloy-primitives/std",
|
"alloy-primitives/std",
|
||||||
"reth-primitives-traits/std",
|
"reth-primitives-traits/std",
|
||||||
|
|||||||
@ -9,7 +9,7 @@ use futures::{Future, FutureExt};
|
|||||||
use reth_primitives_traits::BlockBody;
|
use reth_primitives_traits::BlockBody;
|
||||||
|
|
||||||
/// The bodies future type
|
/// The bodies future type
|
||||||
pub type BodiesFut<B = reth_primitives::BlockBody> =
|
pub type BodiesFut<B = reth_ethereum_primitives::BlockBody> =
|
||||||
Pin<Box<dyn Future<Output = PeerRequestResult<Vec<B>>> + Send + Sync>>;
|
Pin<Box<dyn Future<Output = PeerRequestResult<Vec<B>>> + Send + Sync>>;
|
||||||
|
|
||||||
/// A client capable of downloading block bodies.
|
/// A client capable of downloading block bodies.
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
use alloy_consensus::BlockHeader;
|
use alloy_consensus::BlockHeader;
|
||||||
use alloy_primitives::{BlockNumber, U256};
|
use alloy_primitives::{BlockNumber, U256};
|
||||||
use reth_primitives::{SealedBlock, SealedHeader};
|
use reth_primitives_traits::{Block, InMemorySize, SealedBlock, SealedHeader};
|
||||||
use reth_primitives_traits::{Block, InMemorySize};
|
|
||||||
/// The block response
|
/// The block response
|
||||||
#[derive(PartialEq, Eq, Debug, Clone)]
|
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||||
pub enum BlockResponse<B: Block> {
|
pub enum BlockResponse<B: Block> {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ use derive_more::{Display, Error};
|
|||||||
use reth_consensus::ConsensusError;
|
use reth_consensus::ConsensusError;
|
||||||
use reth_network_peers::WithPeerId;
|
use reth_network_peers::WithPeerId;
|
||||||
use reth_network_types::ReputationChangeKind;
|
use reth_network_types::ReputationChangeKind;
|
||||||
use reth_primitives::{GotExpected, GotExpectedBoxed};
|
use reth_primitives_traits::{GotExpected, GotExpectedBoxed};
|
||||||
use reth_storage_errors::{db::DatabaseError, provider::ProviderError};
|
use reth_storage_errors::{db::DatabaseError, provider::ProviderError};
|
||||||
use tokio::sync::{mpsc, oneshot};
|
use tokio::sync::{mpsc, oneshot};
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ use alloy_primitives::{Sealable, B256};
|
|||||||
use reth_consensus::{Consensus, ConsensusError};
|
use reth_consensus::{Consensus, ConsensusError};
|
||||||
use reth_eth_wire_types::HeadersDirection;
|
use reth_eth_wire_types::HeadersDirection;
|
||||||
use reth_network_peers::WithPeerId;
|
use reth_network_peers::WithPeerId;
|
||||||
use reth_primitives::{SealedBlock, SealedHeader};
|
use reth_primitives_traits::{SealedBlock, SealedHeader};
|
||||||
use std::{
|
use std::{
|
||||||
cmp::Reverse,
|
cmp::Reverse,
|
||||||
collections::{HashMap, VecDeque},
|
collections::{HashMap, VecDeque},
|
||||||
@ -644,7 +644,7 @@ enum RangeResponseResult<H, B> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use reth_primitives::BlockBody;
|
use reth_ethereum_primitives::BlockBody;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::TestFullBlockClient;
|
use crate::test_utils::TestFullBlockClient;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use alloy_primitives::Sealable;
|
use alloy_primitives::Sealable;
|
||||||
use derive_more::{Display, Error};
|
use derive_more::{Display, Error};
|
||||||
use reth_consensus::ConsensusError;
|
use reth_consensus::ConsensusError;
|
||||||
use reth_primitives::SealedHeader;
|
use reth_primitives_traits::SealedHeader;
|
||||||
|
|
||||||
/// Header downloader result
|
/// Header downloader result
|
||||||
pub type HeadersDownloaderResult<T, H> = Result<T, HeadersDownloaderError<H>>;
|
pub type HeadersDownloaderResult<T, H> = Result<T, HeadersDownloaderError<H>>;
|
||||||
|
|||||||
@ -61,6 +61,6 @@ pub trait BlockClient:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The [`BlockClient`] providing Ethereum block parts.
|
/// The [`BlockClient`] providing Ethereum block parts.
|
||||||
pub trait EthBlockClient: BlockClient<Block = reth_primitives::Block> {}
|
pub trait EthBlockClient: BlockClient<Block = reth_ethereum_primitives::Block> {}
|
||||||
|
|
||||||
impl<T> EthBlockClient for T where T: BlockClient<Block = reth_primitives::Block> {}
|
impl<T> EthBlockClient for T where T: BlockClient<Block = reth_ethereum_primitives::Block> {}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//! Traits used when interacting with the sync status of the network.
|
//! Traits used when interacting with the sync status of the network.
|
||||||
|
|
||||||
use reth_primitives::Head;
|
use alloy_eips::eip2124::Head;
|
||||||
|
|
||||||
/// A type that provides information about whether the node is currently syncing and the network is
|
/// A type that provides information about whether the node is currently syncing and the network is
|
||||||
/// currently serving syncing related requests.
|
/// currently serving syncing related requests.
|
||||||
|
|||||||
@ -6,8 +6,8 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use alloy_primitives::B256;
|
use alloy_primitives::B256;
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
|
use reth_ethereum_primitives::BlockBody;
|
||||||
use reth_network_peers::PeerId;
|
use reth_network_peers::PeerId;
|
||||||
use reth_primitives::BlockBody;
|
|
||||||
use std::fmt::{Debug, Formatter};
|
use std::fmt::{Debug, Formatter};
|
||||||
use tokio::sync::oneshot;
|
use tokio::sync::oneshot;
|
||||||
|
|
||||||
|
|||||||
@ -11,8 +11,9 @@ use alloy_eips::{BlockHashOrNumber, BlockNumHash};
|
|||||||
use alloy_primitives::B256;
|
use alloy_primitives::B256;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use reth_eth_wire_types::HeadersDirection;
|
use reth_eth_wire_types::HeadersDirection;
|
||||||
|
use reth_ethereum_primitives::{Block, BlockBody};
|
||||||
use reth_network_peers::{PeerId, WithPeerId};
|
use reth_network_peers::{PeerId, WithPeerId};
|
||||||
use reth_primitives::{BlockBody, SealedBlock, SealedHeader};
|
use reth_primitives_traits::{SealedBlock, SealedHeader};
|
||||||
use std::{collections::HashMap, sync::Arc};
|
use std::{collections::HashMap, sync::Arc};
|
||||||
|
|
||||||
/// A headers+bodies client implementation that does nothing.
|
/// A headers+bodies client implementation that does nothing.
|
||||||
@ -131,7 +132,7 @@ impl TestFullBlockClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get the block with the highest block number.
|
/// Get the block with the highest block number.
|
||||||
pub fn highest_block(&self) -> Option<SealedBlock> {
|
pub fn highest_block(&self) -> Option<SealedBlock<Block>> {
|
||||||
self.headers.lock().iter().max_by_key(|(_, header)| header.number).and_then(
|
self.headers.lock().iter().max_by_key(|(_, header)| header.number).and_then(
|
||||||
|(hash, header)| {
|
|(hash, header)| {
|
||||||
self.bodies.lock().get(hash).map(|body| {
|
self.bodies.lock().get(hash).map(|body| {
|
||||||
@ -246,5 +247,5 @@ impl BodiesClient for TestFullBlockClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl BlockClient for TestFullBlockClient {
|
impl BlockClient for TestFullBlockClient {
|
||||||
type Block = reth_primitives::Block;
|
type Block = reth_ethereum_primitives::Block;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use futures::{Future, FutureExt, Stream, StreamExt};
|
|||||||
use reth_consensus::{test_utils::TestConsensus, HeaderValidator};
|
use reth_consensus::{test_utils::TestConsensus, HeaderValidator};
|
||||||
use reth_eth_wire_types::HeadersDirection;
|
use reth_eth_wire_types::HeadersDirection;
|
||||||
use reth_network_peers::{PeerId, WithPeerId};
|
use reth_network_peers::{PeerId, WithPeerId};
|
||||||
use reth_primitives::SealedHeader;
|
use reth_primitives_traits::SealedHeader;
|
||||||
use std::{
|
use std::{
|
||||||
fmt,
|
fmt,
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
|
|||||||
Reference in New Issue
Block a user