chore: remove reth-primitives dependency from discv5, discv4 and etl crates (#8900)

This commit is contained in:
joshieDo
2024-06-17 19:47:54 +02:00
committed by GitHub
parent f967f9eb40
commit d05be8a467
11 changed files with 20 additions and 16 deletions

6
Cargo.lock generated
View File

@ -6702,7 +6702,6 @@ dependencies = [
"reth-net-common",
"reth-net-nat",
"reth-network-peers",
"reth-primitives",
"reth-tracing",
"schnellru",
"secp256k1",
@ -6717,6 +6716,7 @@ dependencies = [
name = "reth-discv5"
version = "1.0.0-rc.1"
dependencies = [
"alloy-primitives",
"alloy-rlp",
"derive_more",
"discv5",
@ -6728,9 +6728,9 @@ dependencies = [
"multiaddr",
"rand 0.8.5",
"reth-chainspec",
"reth-ethereum-forks",
"reth-metrics",
"reth-network-peers",
"reth-primitives",
"reth-tracing",
"secp256k1",
"thiserror",
@ -7003,9 +7003,9 @@ dependencies = [
name = "reth-etl"
version = "1.0.0-rc.1"
dependencies = [
"alloy-primitives",
"rayon",
"reth-db-api",
"reth-primitives",
"tempfile",
]

View File

@ -13,4 +13,4 @@ reth-db-api.workspace = true
rayon.workspace = true
[dev-dependencies]
reth-primitives.workspace = true
alloy-primitives.workspace = true

View File

@ -271,7 +271,7 @@ impl EtlFile {
#[cfg(test)]
mod tests {
use reth_primitives::{TxHash, TxNumber};
use alloy_primitives::{TxHash, TxNumber};
use super::*;

View File

@ -45,7 +45,6 @@ serde = { workspace = true, optional = true }
[dev-dependencies]
reth-chainspec.workspace = true
reth-primitives.workspace = true
assert_matches.workspace = true
rand.workspace = true
tokio = { workspace = true, features = ["macros"] }

View File

@ -2285,10 +2285,11 @@ pub enum DiscoveryUpdate {
mod tests {
use super::*;
use crate::test_utils::{create_discv4, create_discv4_with_config, rng_endpoint, rng_record};
use alloy_primitives::hex;
use alloy_rlp::{Decodable, Encodable};
use rand::{thread_rng, Rng};
use reth_chainspec::net::mainnet_nodes;
use reth_primitives::{hex, EnrForkIdEntry, ForkHash};
use reth_ethereum_forks::{EnrForkIdEntry, ForkHash};
use std::future::poll_fn;
#[tokio::test]

View File

@ -542,10 +542,11 @@ mod tests {
test_utils::{rng_endpoint, rng_ipv4_record, rng_ipv6_record, rng_message},
DEFAULT_DISCOVERY_PORT, SAFE_MAX_DATAGRAM_NEIGHBOUR_RECORDS,
};
use alloy_primitives::hex;
use assert_matches::assert_matches;
use enr::EnrPublicKey;
use rand::{thread_rng, Rng, RngCore};
use reth_primitives::{hex, ForkHash};
use reth_ethereum_forks::ForkHash;
#[test]
fn test_endpoint_ipv_v4() {

View File

@ -14,11 +14,12 @@ workspace = true
[dependencies]
# reth
reth-chainspec.workspace = true
reth-primitives.workspace = true
reth-ethereum-forks.workspace = true
reth-metrics.workspace = true
reth-network-peers = { workspace = true, features = ["secp256k1"] }
# ethereum
alloy-primitives.workspace = true
alloy-rlp.workspace = true
discv5 = { workspace = true, features = ["libp2p"] }
enr.workspace = true

View File

@ -6,11 +6,12 @@ use std::{
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
};
use alloy_primitives::Bytes;
use derive_more::Display;
use discv5::ListenConfig;
use multiaddr::{Multiaddr, Protocol};
use reth_ethereum_forks::{EnrForkIdEntry, ForkId};
use reth_network_peers::NodeRecord;
use reth_primitives::{Bytes, EnrForkIdEntry, ForkId};
use tracing::warn;
use crate::{enr::discv4_id_to_multiaddr_id, filter::MustNotIncludeKeys, NetworkStackId};
@ -448,7 +449,7 @@ impl BootNode {
mod test {
use std::net::SocketAddrV4;
use reth_primitives::hex;
use alloy_primitives::hex;
use super::*;

View File

@ -17,7 +17,7 @@ pub enum Error {
/// Missing key used to identify rlpx network.
#[error("fork missing on enr, key missing")]
ForkMissing(&'static [u8]),
/// Failed to decode [`ForkId`](reth_primitives::ForkId) rlp value.
/// Failed to decode [`ForkId`](reth_ethereum_forks::ForkId) rlp value.
#[error("failed to decode fork id, 'eth': {0:?}")]
ForkIdDecodeError(#[from] alloy_rlp::Error),
/// Peer is unreachable over discovery.

View File

@ -17,13 +17,14 @@ use std::{
};
use ::enr::Enr;
use alloy_primitives::bytes::Bytes;
use discv5::ListenConfig;
use enr::{discv4_id_to_discv5_id, EnrCombinedKeyWrapper};
use futures::future::join_all;
use itertools::Itertools;
use rand::{Rng, RngCore};
use reth_ethereum_forks::{EnrForkIdEntry, ForkId};
use reth_network_peers::{NodeRecord, PeerId};
use reth_primitives::{bytes::Bytes, EnrForkIdEntry, ForkId};
use secp256k1::SecretKey;
use tokio::{sync::mpsc, task};
use tracing::{debug, error, trace};
@ -777,11 +778,11 @@ mod test {
#[allow(unused)]
#[allow(clippy::assign_op_pattern)]
mod sigp {
use alloy_primitives::U256;
use enr::{
k256::sha2::digest::generic_array::{typenum::U32, GenericArray},
NodeId,
};
use reth_primitives::U256;
/// A `Key` is a cryptographic hash, identifying both the nodes participating in
/// the Kademlia DHT, as well as records stored in the DHT.

View File

@ -1,5 +1,5 @@
//! Keys of ENR [`ForkId`](reth_primitives::ForkId) kv-pair. Identifies which network stack a node
//! belongs to.
//! Keys of ENR [`ForkId`](reth_ethereum_forks::ForkId) kv-pair. Identifies which network stack a
//! node belongs to.
use reth_chainspec::ChainSpec;