net: replace reth-primitive imports (#11023)

This commit is contained in:
Håvard Anda Estensen
2024-09-19 10:29:01 +02:00
committed by GitHub
parent 883975dc90
commit ae9b13f4a1
59 changed files with 139 additions and 96 deletions

View File

@ -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

View File

@ -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::{

View File

@ -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![

View File

@ -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

View File

@ -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};

View File

@ -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,

View File

@ -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;

View File

@ -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]

View File

@ -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]

View File

@ -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;