Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update dependencies #219

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 31 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,41 @@ categories = ["network-programming", "asynchronous"]
exclude = [".gitignore", ".github/*"]

[dependencies]
enr = { version = "0.9.0", features = ["k256", "ed25519"] }
tokio = { version = "1.15.0", features = ["net", "sync", "macros", "rt"] }
libp2p-core = { version = "0.40.0", optional = true }
libp2p-identity = { version = "0.2.1", features = ["ed25519", "secp256k1"], optional = true }
zeroize = { version = "1.4.3", features = ["zeroize_derive"] }
futures = "0.3.19"
uint = { version = "0.9.1", default-features = false }
rlp = "0.5.1"
enr = { version = "0.9", features = ["k256", "ed25519"] }
tokio = { version = "1", features = ["net", "sync", "macros", "rt"] }
libp2p = { version = "0.52", features = ["ed25519", "secp256k1"], optional = true }
zeroize = { version = "1", features = ["zeroize_derive"] }
futures = "0.3"
uint = { version = "0.9", default-features = false }
rlp = "0.5"
# This version must be kept up to date do it uses the same dependencies as ENR
hkdf = "0.12.3"
hex = "0.4.3"
fnv = "1.0.7"
arrayvec = "0.7.2"
rand = { version = "0.8.4", package = "rand" }
socket2 = "0.4.4"
smallvec = "1.7.0"
parking_lot = "0.11.2"
lazy_static = "1.4.0"
aes = { version = "0.7.5", features = ["ctr"] }
aes-gcm = "0.9.4"
tracing = { version = "0.1.29", features = ["log"] }
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
lru = "0.7.1"
hashlink = "0.7.0"
delay_map = "0.3.0"
more-asserts = "0.2.2"
hkdf = "0.12"
hex = "0.4"
fnv = "1"
arrayvec = "0.7"
rand = { version = "0.8", package = "rand" }
socket2 = "0.4"
smallvec = "1"
parking_lot = "0.11"
lazy_static = "1"
aes = { version = "0.7", features = ["ctr"] }
aes-gcm = "0.9"
tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
lru = "0.12"
hashlink = "0.8"
delay_map = "0.3"
more-asserts = "0.3"

[dev-dependencies]
rand_07 = { package = "rand", version = "0.7" }
quickcheck = "0.9.2"
tokio = { version = "1.15.0", features = ["full"] }
rand_xorshift = "0.3.0"
rand_core = "0.6.3"
clap = { version = "3.1", features = ["derive"] }
if-addrs = "0.10.1"
quickcheck = "0.9"
tokio = { version = "1", features = ["full"] }
rand_xorshift = "0.3"
rand_core = "0.6"
clap = { version = "4", features = ["derive"] }
if-addrs = "0.10"

[features]
libp2p = ["libp2p-core", "libp2p-identity"]
libp2p = ["dep:libp2p"]
serde = ["enr/serde"]
1 change: 1 addition & 0 deletions examples/find_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ async fn main() {
}
}

#[derive(Clone)]
pub enum SocketKind {
Ip4,
Ip6,
Expand Down
2 changes: 1 addition & 1 deletion src/discv5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use tokio::sync::{mpsc, oneshot};
use tracing::{debug, warn};

#[cfg(feature = "libp2p")]
use libp2p_core::Multiaddr;
use libp2p::Multiaddr;

// Create lazy static variable for the global permit/ban list
use crate::{
Expand Down
2 changes: 1 addition & 1 deletion src/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ impl Handler {
trace!("Request queued for node: {}", node_address);
self.pending_requests
.entry(node_address)
.or_insert_with(Vec::new)
.or_default()
.push(PendingRequest {
contact,
request_id,
Expand Down
8 changes: 5 additions & 3 deletions src/node_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ use enr::{CombinedPublicKey, NodeId};
use std::net::SocketAddr;

#[cfg(feature = "libp2p")]
use libp2p_core::{multiaddr::Protocol, Multiaddr};
#[cfg(feature = "libp2p")]
use libp2p_identity::{KeyType, PublicKey};
use libp2p::{
identity::{KeyType, PublicKey},
multiaddr::Protocol,
Multiaddr,
};

/// This type relaxes the requirement of having an ENR to connect to a node, to allow for unsigned
/// connection types, such as multiaddrs.
Expand Down
12 changes: 10 additions & 2 deletions src/socket/filter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use lru::LruCache;
use std::{
collections::HashSet,
net::{IpAddr, SocketAddr},
num::NonZeroUsize,
sync::atomic::Ordering,
time::{Duration, Instant},
};
Expand All @@ -19,9 +20,16 @@ pub use config::FilterConfig;
use rate_limiter::{LimitKind, RateLimiter};

/// The maximum number of IPs to retain when calculating the number of nodes per IP.
const KNOWN_ADDRS_SIZE: usize = 500;
const KNOWN_ADDRS_SIZE: NonZeroUsize = match NonZeroUsize::new(500) {
Some(non_zero) => non_zero,
None => unreachable!(),
};
/// The number of IPs to retain at any given time that have banned nodes.
const BANNED_NODES_SIZE: usize = 50;
const BANNED_NODES_SIZE: NonZeroUsize = match NonZeroUsize::new(50) {
Some(non_zero) => non_zero,
None => unreachable!(),
};

/// The maximum number of packets to keep record of for metrics if the rate limiter is not
/// specified.
const DEFAULT_PACKETS_PER_SECOND: usize = 20;
Expand Down