Skip to content
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
1,674 changes: 842 additions & 832 deletions Cargo.lock

Large diffs are not rendered by default.

65 changes: 32 additions & 33 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,26 @@ ssv_types = { path = "anchor/common/ssv_types" }
subnet_tracker = { path = "anchor/subnet_tracker" }
version = { path = "anchor/common/version" }

beacon_node_fallback = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
bls = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
eth2 = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
eth2_config = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
eth2_network_config = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
health_metrics = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
lighthouse_network = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
metrics = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
safe_arith = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
sensitive_url = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
slashing_protection = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
slot_clock = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
task_executor = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2", default-features = false, features = [
"tracing",
] }
types = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
unused_port = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
validator_metrics = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
validator_services = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
validator_store = { git = "https://github.com/sigp/lighthouse", rev = "b71b5f2" }
beacon_node_fallback = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
bls = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
eth2 = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
eth2_config = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
eth2_network_config = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
health_metrics = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
lighthouse_network = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
metrics = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
safe_arith = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
sensitive_url = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
slashing_protection = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
slot_clock = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
task_executor = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
types = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
unused_port = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
validator_metrics = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
validator_services = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }
validator_store = { git = "https://github.com/sigp/lighthouse", rev = "397eb3e" }

alloy = { version = "0.11.0", features = [
alloy = { version = "0.12.0", features = [
"sol-types",
"transports",
"json",
Expand All @@ -92,31 +90,33 @@ blst = "0.3.14"
blstrs_plus = { git = "https://github.com/dknopik/blstrs", branch = "pls" }
clap = { version = "4.5.15", features = ["derive", "wrap_help"] }
dashmap = "6.1.0"
derive_more = { version = "1.0.0", features = ["full"] }
derive_more = { version = "2.0.1", features = ["full"] }
dirs = "6.0.0"
discv5 = "0.9.0"
either = "1.13.0"
enr = "0.13.0"
ethereum_ssz = "0.7"
ethereum_ssz_derive = "0.7.0"
ethereum_ssz = "0.8"
ethereum_ssz_derive = "0.8"
futures = "0.3.30"
gossipsub = { package = "libp2p-gossipsub", git = "https://github.com/sigp/rust-libp2p.git", branch = "sigp-gossipsub" }
hex = "0.4.3"
hyper = "1.4"
indexmap = "2.7.0"
libp2p = { version = "0.55", default-features = false }
multiaddr = "0.18.2"
num_cpus = "1"
openssl = "0.10.68"
parking_lot = "0.12"
r2d2 = "0.8.10"
r2d2_sqlite = "0.21.0"
rand = "0.8.5"
rand = "0.9"
reqwest = "0.12.12"
rusqlite = "0.28.0"
serde = { version = "1.0.208", features = ["derive"] }
serde_json = "1.0.140"
serde_yaml = "0.9"
sha2 = "0.10.8"
strum = { version = "0.26.3", features = ["derive"] }
strum = { version = "0.27.0", features = ["derive"] }
thiserror = "2.0.11"
tokio = { version = "1.39.2", features = [
"rt",
Expand All @@ -128,16 +128,15 @@ tokio = { version = "1.39.2", features = [
tower-http = { version = "0.6", features = ["cors"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["fmt", "env-filter"] }
tree_hash = "0.8"
tree_hash_derive = "0.8"
tree_hash = "0.9"
tree_hash_derive = "0.9"
vsss-rs = "5.1.0"
zeroize = "1.8.1"

[patch.crates-io]
# todo: remove when libp2p versions are aligned again. this is only needed because cargo audit crashes otherwise
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", rev = "082eb16" }
libp2p-mplex = { git = "https://github.com/libp2p/rust-libp2p.git", rev = "082eb16" }
quick-protobuf-codec = { git = "https://github.com/libp2p/rust-libp2p.git", rev = "082eb16" }
# todo: remove when there is a proper release for peer-store.
[patch.'https://github.com/libp2p/rust-libp2p.git']
libp2p-core = "0.43.0"
libp2p-swarm = "0.46.0"

[profile.maxperf]
inherits = "release"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ install-audit:
cargo install --force cargo-audit

audit-CI:
cargo audit --ignore RUSTSEC-2025-0009 --ignore RUSTSEC-2024-0437
cargo audit

# Runs `cargo vendor` to make sure dependencies can be vendored for packaging, reproducibility and archival purpose.
vendor:
Expand Down
2 changes: 1 addition & 1 deletion anchor/common/bls_lagrange/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
bls = { workspace = true }
blst = { workspace = true, optional = true }
blstrs_plus = { workspace = true, optional = true }
rand = { workspace = true }
rand = "0.8.5"
vsss-rs = { workspace = true, optional = true }
zeroize = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion anchor/common/bls_lagrange/src/blst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub fn split_with_rng(
}
Ok((
id,
bls::SecretKey::from_point(mem::transmute::<blst_scalar, SecretKey>(y)),
bls::SecretKey::from_point(&mem::transmute::<blst_scalar, SecretKey>(y)),
))
})
.collect()
Expand Down
2 changes: 1 addition & 1 deletion anchor/common/bls_lagrange/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub(crate) fn random_key(rng: &mut (impl CryptoRng + Rng)) -> Result<SecretKey,
let ikm = zeroize::Zeroizing::new(rng.gen::<[u8; 32]>());
let sk =
::blst::min_pk::SecretKey::key_gen(ikm.as_ref(), &[]).map_err(|_| Error::InternalError)?;
Ok(SecretKey::from_point(sk))
Ok(SecretKey::from_point(&sk))
}

#[cfg(test)]
Expand Down
6 changes: 3 additions & 3 deletions anchor/database/src/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub mod generators {

// Generate a random cluster with a specific number of operators
pub fn random(num_operators: u64) -> Cluster {
let cluster_id: [u8; 32] = rand::thread_rng().gen();
let cluster_id: [u8; 32] = rand::rng().random();
let cluster_id = ClusterId(cluster_id);
let members = (0..num_operators).map(OperatorId).collect();
let owner_recipient = Address::random();
Expand All @@ -137,7 +137,7 @@ pub mod generators {

// Generate a cluster with a specific set of operators
pub fn with_operators(operators: &[Operator]) -> Cluster {
let cluster_id: [u8; 32] = rand::thread_rng().gen();
let cluster_id: [u8; 32] = rand::rng().random();
let cluster_id = ClusterId(cluster_id);
let members = operators.iter().map(|op| op.id).collect();
let owner_recipient = Address::random();
Expand Down Expand Up @@ -199,7 +199,7 @@ pub mod generators {
ValidatorMetadata {
public_key: pubkey::random(),
cluster_id,
index: ValidatorIndex(rand::thread_rng().gen_range(0..100)),
index: ValidatorIndex(rand::rng().random_range(0..100)),
graffiti: Graffiti::default(),
}
}
Expand Down
5 changes: 2 additions & 3 deletions anchor/message_receiver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ authors = ["Sigma Prime <contact@sigmaprime.io>"]

[dependencies]
database = { workspace = true }
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", rev = "082eb16", default-features = false, features = [
"gossipsub",
] }
gossipsub = { workspace = true }
libp2p = { workspace = true }
message_validator = { workspace = true }
processor = { workspace = true }
qbft_manager = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion anchor/message_receiver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod manager;
pub mod testing;

pub use crate::manager::*;
use libp2p::gossipsub::{Message, MessageId};
use gossipsub::{Message, MessageId};
use libp2p::PeerId;

pub trait MessageReceiver: Send + Sync {
Expand Down
2 changes: 1 addition & 1 deletion anchor/message_receiver/src/manager.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::MessageReceiver;
use database::{NetworkState, UniqueIndex};
use libp2p::gossipsub::{Message, MessageAcceptance, MessageId};
use gossipsub::{Message, MessageAcceptance, MessageId};
use libp2p::PeerId;
use message_validator::{ValidatedMessage, ValidatedSSVMessage, ValidatorService};
use processor::Error;
Expand Down
2 changes: 1 addition & 1 deletion anchor/message_receiver/src/testing.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::MessageReceiver;
use libp2p::gossipsub::{Message, MessageId};
use gossipsub::{Message, MessageId};
use libp2p::PeerId;
use message_validator::ValidatorService;
use processor::Error;
Expand Down
4 changes: 1 addition & 3 deletions anchor/message_validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ authors = ["Sigma Prime <contact@sigmaprime.io>"]
[dependencies]
database = { workspace = true }
ethereum_ssz = { workspace = true }
gossipsub = { workspace = true }
hex = { workspace = true }
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", rev = "082eb16", default-features = false, features = [
"gossipsub",
] }
processor = { workspace = true }
sha2 = { workspace = true }
ssv_types = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion anchor/message_validator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use database::NetworkStateService;
use libp2p::gossipsub::MessageAcceptance;
use gossipsub::MessageAcceptance;
use sha2::{Digest, Sha256};
use ssv_types::consensus::{QbftMessage, QbftMessageType};
use ssv_types::message::{MsgType, SSVMessage, SignedSSVMessage};
Expand Down
11 changes: 5 additions & 6 deletions anchor/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ dirs = { workspace = true }
discv5 = { workspace = true }
ethereum_ssz = { workspace = true }
futures = { workspace = true }
gossipsub = { workspace = true }
hex = "0.4.3"
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", rev = "082eb16", default-features = false, features = [
libp2p = { workspace = true, default-features = false, features = [
"identify",
"yamux",
"noise",
"secp256k1",
"tcp",
"tokio",
"macros",
"gossipsub",
"quic",
"ping",
"peer-store",
"request-response",
] }
lighthouse_network = { workspace = true }
message_receiver = { workspace = true }
message_validator = { workspace = true }
peer-store = { package = "libp2p-peer-store", git = "https://github.com/libp2p/rust-libp2p.git", rev = "082eb16" }
quick-protobuf = "0.8.1"
rand = { workspace = true }
serde = { workspace = true }
serde_json = "1.0.137"
ssv_types = { workspace = true }
ssz_types = "0.8"
ssz_types = "0.10"
subnet_tracker = { workspace = true }
task_executor = { workspace = true }
thiserror = { workspace = true }
Expand All @@ -43,8 +43,7 @@ version = { workspace = true }

[dev-dependencies]
async-channel = { workspace = true }
libp2p-swarm = { git = "https://github.com/libp2p/rust-libp2p.git", rev = "082eb16", features = ["macros"] }
libp2p-swarm-test = { git = "https://github.com/libp2p/rust-libp2p.git", rev = "082eb16" }
libp2p-swarm-test = "0.5.0"
message_receiver = { workspace = true, features = ["testing"] }
tokio = { workspace = true, features = ["rt", "macros", "time"] }
tracing-subscriber = { workspace = true }
2 changes: 1 addition & 1 deletion anchor/network/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::discovery::Discovery;
use crate::handshake;
use crate::peer_manager::PeerManager;
use libp2p::swarm::NetworkBehaviour;
use libp2p::{gossipsub, identify, ping};
use libp2p::{identify, ping};

#[derive(NetworkBehaviour)]
pub struct AnchorBehaviour {
Expand Down
6 changes: 5 additions & 1 deletion anchor/network/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ impl Discovery {

if let Err(err) = self.discv5.enr_insert("subnets", &subnets.as_ssz_bytes()) {
error!(?err, "Unable to update ENR");
} else {
debug!(enr=?self.discv5.local_enr(), "Updated subnets in ENR");
}
}

Expand Down Expand Up @@ -361,7 +363,9 @@ impl Discovery {

// General predicate
let predicate: Box<dyn Fn(&Enr) -> bool + Send> = Box::new(move |enr: &Enr| {
tcp_predicate(enr) && domain_type_predicate(enr) && additional_predicate(enr)
let ok = tcp_predicate(enr) && domain_type_predicate(enr) && additional_predicate(enr);
trace!(?enr, ok, "considered ENR for discovery");
ok
});

// Build the future
Expand Down
2 changes: 1 addition & 1 deletion anchor/network/src/handshake/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ mod tests {
use super::*;
use crate::handshake::node_info::NodeMetadata;
use discv5::libp2p_identity::Keypair;
use libp2p_swarm::{Swarm, SwarmEvent};
use libp2p::swarm::{Swarm, SwarmEvent};
use libp2p_swarm_test::SwarmExt;
use std::sync::LazyLock;
use tokio::select;
Expand Down
8 changes: 3 additions & 5 deletions anchor/network/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ use std::pin::Pin;
use std::time::{Duration, Instant};

use futures::StreamExt;
use gossipsub::{ConfigBuilderError, IdentTopic, MessageAuthenticity, ValidationMode};
use libp2p::core::muxing::StreamMuxerBox;
use libp2p::core::transport::Boxed;
use libp2p::core::ConnectedPoint;
use libp2p::gossipsub::{ConfigBuilderError, IdentTopic, MessageAuthenticity, ValidationMode};
use libp2p::identity::Keypair;
use libp2p::multiaddr::Protocol;
use libp2p::swarm::SwarmEvent;
use libp2p::{
futures, gossipsub, identify, ping, Multiaddr, PeerId, Swarm, SwarmBuilder, TransportError,
};
use libp2p::{futures, identify, ping, Multiaddr, PeerId, Swarm, SwarmBuilder, TransportError};
use lighthouse_network::discovery::DiscoveredPeers;
use lighthouse_network::discv5::enr::k256::sha2::{Digest, Sha256};
use subnet_tracker::{SubnetEvent, SubnetId};
Expand Down Expand Up @@ -457,7 +455,7 @@ mod test {
let handle = tokio::runtime::Handle::current();
let (_signal, exit) = async_channel::bounded(1);
let (shutdown_tx, _) = futures::channel::mpsc::channel(1);
let task_executor = TaskExecutor::new(handle, exit, shutdown_tx);
let task_executor = TaskExecutor::new(handle, exit, shutdown_tx, "network_test".into());
let subnet_tracker = test_tracker(task_executor.clone(), vec![], Duration::ZERO);
let (_, message_rx) = mpsc::channel(1);
let (_, results_rx) = mpsc::channel(1);
Expand Down
8 changes: 4 additions & 4 deletions anchor/network/src/peer_manager.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use crate::{Config, Enr};
use discv5::libp2p_identity::PeerId;
use discv5::multiaddr::Multiaddr;
use libp2p::connection_limits;
use libp2p::connection_limits::ConnectionLimits;
use libp2p::core::transport::PortUse;
use libp2p::core::Endpoint;
use libp2p::peer_store::memory_store::{MemoryStore, PeerRecord};
use libp2p::peer_store::{memory_store, Store};
use libp2p::swarm::behaviour::ConnectionEstablished;
use libp2p::swarm::dial_opts::{DialOpts, PeerCondition};
use libp2p::swarm::{
dummy, ConnectionClosed, ConnectionDenied, ConnectionId, FromSwarm, NetworkBehaviour, THandler,
THandlerInEvent, THandlerOutEvent, ToSwarm,
};
use libp2p::{connection_limits, peer_store};
use lighthouse_network::EnrExt;
use peer_store::memory_store::{MemoryStore, PeerRecord};
use peer_store::{memory_store, Store};
use rand::seq::SliceRandom;
use ssz::Decode;
use ssz_types::length::Fixed;
Expand Down Expand Up @@ -204,7 +204,7 @@ impl PeerManager {
!self.connected.contains(peer) && record.addresses().next().is_some()
})
.collect::<Vec<_>>();
peers.shuffle(&mut rand::thread_rng());
peers.shuffle(&mut rand::rng());
peers
}

Expand Down
2 changes: 1 addition & 1 deletion anchor/processor/tests/processor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async fn test_max_workers() -> Result<(), Box<dyn Error>> {
let handle = tokio::runtime::Handle::current();
let (_signal, exit) = async_channel::bounded(1);
let (shutdown_tx, _) = futures::channel::mpsc::channel(1);
let executor = TaskExecutor::new(handle, exit, shutdown_tx);
let executor = TaskExecutor::new(handle, exit, shutdown_tx, "processor_test".into());

let config = processor::Config { max_workers: 3 };

Expand Down
2 changes: 1 addition & 1 deletion anchor/qbft_manager/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ mod manager_tests {
let handle = tokio::runtime::Handle::current();
let (signal, exit) = async_channel::bounded(1);
let (shutdown, _) = futures::channel::mpsc::channel(1);
let executor = TaskExecutor::new(handle, exit, shutdown.clone());
let executor = TaskExecutor::new(handle, exit, shutdown.clone(), "qbft_tests".into());

// setup the slot clock
let slot_duration = Duration::from_secs(12);
Expand Down
1 change: 1 addition & 0 deletions anchor/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ impl Environment {
Arc::downgrade(self.runtime()),
self.exit.clone(),
self.signal_tx.clone(),
"anchor".into(),
)
}

Expand Down
Loading