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 1 commit
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 = "1"
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
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
5 changes: 3 additions & 2 deletions src/socket/filter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use enr::NodeId;
use lru::LruCache;
use std::{
collections::HashSet,
convert::TryInto,
net::{IpAddr, SocketAddr},
sync::atomic::Ordering,
time::{Duration, Instant},
Expand Down Expand Up @@ -67,8 +68,8 @@ impl Filter {
expected_packets_per_second,
METRICS.moving_window,
),
known_addrs: LruCache::new(KNOWN_ADDRS_SIZE),
banned_nodes: LruCache::new(BANNED_NODES_SIZE),
known_addrs: LruCache::new(KNOWN_ADDRS_SIZE.try_into().unwrap()),
banned_nodes: LruCache::new(BANNED_NODES_SIZE.try_into().unwrap()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither of those should be a runtime error (if it was then we should be using expect instead of unwrap)
you can instead change the declarations to

const KNOWN_ADDRS_SIZE: NonZeroUsize = match NonZeroUsize::new(500) {
    Some(non_zero) => non_zero,
    None => panic!("clearly non zero"),
};

to get a compile time check via const-panic

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks Diva, yeah I assumed not being able to unwrap meant one couldn't panic!() in const fns but it's possible, I used unreachable!() intead of panic!()inc ptal.

ban_duration,
max_nodes_per_ip: config.max_nodes_per_ip,
max_bans_per_ip: config.max_bans_per_ip,
Expand Down
Loading