chore(deps): replace reth-primitives in discv4 (#8813)

This commit is contained in:
Matthias Seitz
2024-06-13 23:16:11 +02:00
committed by GitHub
parent 23fc18db25
commit a568535b85
7 changed files with 22 additions and 13 deletions

2
Cargo.lock generated
View File

@ -6695,6 +6695,7 @@ dependencies = [
name = "reth-discv4"
version = "1.0.0-rc.1"
dependencies = [
"alloy-primitives",
"alloy-rlp",
"assert_matches",
"discv5",
@ -6702,6 +6703,7 @@ dependencies = [
"generic-array",
"parking_lot 0.12.3",
"rand 0.8.5",
"reth-ethereum-forks",
"reth-net-common",
"reth-net-nat",
"reth-network-peers",

View File

@ -13,12 +13,13 @@ workspace = true
[dependencies]
# reth
reth-primitives.workspace = true
reth-net-common.workspace = true
reth-ethereum-forks.workspace = true
reth-net-nat.workspace = true
reth-network-peers = { workspace = true, features = ["secp256k1"] }
# ethereum
alloy-primitives.workspace = true
alloy-rlp = { workspace = true, features = ["derive"] }
discv5.workspace = true
secp256k1 = { workspace = true, features = [
@ -28,6 +29,7 @@ secp256k1 = { workspace = true, features = [
"serde",
] }
enr.workspace = true
# async/futures
tokio = { workspace = true, features = ["io-util", "net", "time"] }
tokio-stream.workspace = true
@ -42,6 +44,7 @@ generic-array.workspace = true
serde = { workspace = true, optional = true }
[dev-dependencies]
reth-primitives.workspace = true
assert_matches.workspace = true
rand.workspace = true
tokio = { workspace = true, features = ["macros"] }

View File

@ -3,10 +3,11 @@
//! This basis of this file has been taken from the discv5 codebase:
//! <https://github.com/sigp/discv5>
use alloy_primitives::bytes::Bytes;
use alloy_rlp::Encodable;
use reth_net_common::ban_list::BanList;
use reth_net_nat::{NatResolver, ResolveNatInterval};
use reth_primitives::{bytes::Bytes, NodeRecord};
use reth_network_peers::NodeRecord;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::{

View File

@ -28,6 +28,7 @@ use crate::{
error::{DecodePacketError, Discv4Error},
proto::{FindNode, Message, Neighbours, Packet, Ping, Pong},
};
use alloy_primitives::{bytes::Bytes, hex, B256};
use discv5::{
kbucket,
kbucket::{
@ -39,8 +40,8 @@ use discv5::{
use enr::Enr;
use parking_lot::Mutex;
use proto::{EnrRequest, EnrResponse};
use reth_ethereum_forks::ForkId;
use reth_network_peers::{pk2id, PeerId};
use reth_primitives::{bytes::Bytes, hex, ForkId, B256};
use secp256k1::SecretKey;
use std::{
cell::RefCell,
@ -76,7 +77,7 @@ use node::{kad_key, NodeKey};
mod table;
// reexport NodeRecord primitive
pub use reth_primitives::NodeRecord;
pub use reth_network_peers::NodeRecord;
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;

View File

@ -1,6 +1,6 @@
use alloy_primitives::keccak256;
use generic_array::GenericArray;
use reth_network_peers::PeerId;
use reth_primitives::{keccak256, NodeRecord};
use reth_network_peers::{NodeRecord, PeerId};
/// The key type for the table.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]

View File

@ -1,13 +1,14 @@
//! Discovery v4 protocol implementation.
use crate::{error::DecodePacketError, MAX_PACKET_SIZE, MIN_PACKET_SIZE};
use alloy_primitives::{
bytes::{Buf, BufMut, Bytes, BytesMut},
keccak256, B256,
};
use alloy_rlp::{Decodable, Encodable, Error as RlpError, Header, RlpDecodable, RlpEncodable};
use enr::Enr;
use reth_network_peers::{pk2id, PeerId};
use reth_primitives::{
bytes::{Buf, BufMut, Bytes, BytesMut},
keccak256, EnrForkIdEntry, ForkId, NodeRecord, B256,
};
use reth_ethereum_forks::{EnrForkIdEntry, ForkId};
use reth_network_peers::{pk2id, NodeRecord, PeerId};
use secp256k1::{
ecdsa::{RecoverableSignature, RecoveryId},
SecretKey, SECP256K1,

View File

@ -5,9 +5,10 @@ use crate::{
receive_loop, send_loop, Discv4, Discv4Config, Discv4Service, EgressSender, IngressEvent,
IngressReceiver, PeerId, SAFE_MAX_DATAGRAM_NEIGHBOUR_RECORDS,
};
use alloy_primitives::{hex, B256};
use rand::{thread_rng, Rng, RngCore};
use reth_network_peers::pk2id;
use reth_primitives::{hex, ForkHash, ForkId, NodeRecord, B256};
use reth_ethereum_forks::{ForkHash, ForkId};
use reth_network_peers::{pk2id, NodeRecord};
use secp256k1::{SecretKey, SECP256K1};
use std::{
collections::{HashMap, HashSet},