Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
683 changes: 358 additions & 325 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ fork_choice = { path = "consensus/fork_choice" }
fs2 = "0.4"
futures = "0.3"
genesis = { path = "beacon_node/genesis" }
# This is tracking the sigp-gossipsub branch on sigp/rust-libp2p commit: Aug 20 2025
gossipsub = { package = "libp2p-gossipsub", git = "https://github.com/sigp/rust-libp2p.git", rev = "5acdf89a65d64098f9346efa5769e57bcd19dea9", "features" = ["metrics"] }
graffiti_file = { path = "validator_client/graffiti_file" }
hashlink = "0.9.0"
health_metrics = { path = "common/health_metrics" }
Expand All @@ -168,6 +166,20 @@ initialized_validators = { path = "validator_client/initialized_validators" }
int_to_bytes = { path = "consensus/int_to_bytes" }
itertools = "0.10"
kzg = { path = "crypto/kzg" }
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", default-features = false, features = [
Copy link
Member

Choose a reason for hiding this comment

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

Have you considered pinning this to a specific commit hash? That would make the dependency version explicit and help prevent unintended updates.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi Akihito, yeah, that's what was before.
The pinning is already achieved by Cargo.lock and we are following master it shouldn't bring problems.
I.e if someone updates the libp2p dep nested on a PR that updates Cargo.lock it should be ok.
I feel that's preferable to hardcoding a commit hash that needs a PR every time we need a bump.
Do you prefer to be explicit on Cargo.toml as well?
cc @dknopik

Copy link
Member

Choose a reason for hiding this comment

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

I agree that your point makes sense, and I think relying on Cargo.lock is sufficient in this case.

That said, I believe specifying a tagged release (i.e., a version) would be ideal in the long run, so I just wanted to check whether this is intended as a temporary solution or a longer-term approach.

Copy link
Member

Choose a reason for hiding this comment

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

I don't have a strong preference, but historically, we have explicitly pinned commits that we intend to put out on stable branch.

"identify",
"yamux",
"noise",
"dns",
"tcp",
"tokio",
"secp256k1",
"macros",
"metrics",
"quic",
"upnp",
"gossipsub",
] }
libsecp256k1 = "0.7"
lighthouse_network = { path = "beacon_node/lighthouse_network" }
lighthouse_tracing = { path = "beacon_node/lighthouse_tracing" }
Expand Down
27 changes: 3 additions & 24 deletions beacon_node/lighthouse_network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = { workspace = true }
autotests = false

[features]
libp2p-websocket = []

[dependencies]
alloy-primitives = { workspace = true }
alloy-rlp = { workspace = true }
Expand All @@ -24,10 +21,10 @@ ethereum_ssz_derive = { workspace = true }
fixed_bytes = { workspace = true }
fnv = { workspace = true }
futures = { workspace = true }
gossipsub = { workspace = true }
hex = { workspace = true }
itertools = { workspace = true }
libp2p-mplex = "0.43"
libp2p = { workspace = true }
libp2p-mplex = { git = "https://github.com/libp2p/rust-libp2p.git" }
lighthouse_version = { workspace = true }
local-ip-address = "0.6"
logging = { workspace = true }
Expand All @@ -36,7 +33,7 @@ lru_cache = { workspace = true }
metrics = { workspace = true }
network_utils = { workspace = true }
parking_lot = { workspace = true }
prometheus-client = "0.23.0"
prometheus-client = "0.24.0"
rand = { workspace = true }
regex = { workspace = true }
serde = { workspace = true }
Expand All @@ -55,24 +52,6 @@ typenum = { workspace = true }
types = { workspace = true }
unsigned-varint = { version = "0.8", features = ["codec"] }

[dependencies.libp2p]
version = "0.56"
default-features = false
features = [
"identify",
"yamux",
"noise",
"dns",
"tcp",
"tokio",
"plaintext",
"secp256k1",
"macros",
"metrics",
"quic",
"upnp",
]

[dev-dependencies]
async-channel = { workspace = true }
logging = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{Enr, PeerIdSerialized};
use directory::{
DEFAULT_BEACON_NODE_DIR, DEFAULT_HARDCODED_NETWORK, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR,
};
use libp2p::Multiaddr;
use libp2p::{Multiaddr, gossipsub};
use local_ip_address::local_ipv6;
use network_utils::listen_addr::{ListenAddr, ListenAddress};
use serde::{Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ pub use prometheus_client;
pub use config::Config as NetworkConfig;
pub use discovery::Eth2Enr;
pub use discv5;
pub use gossipsub::{IdentTopic, MessageAcceptance, MessageId, Topic, TopicHash};
pub use libp2p;
pub use libp2p::gossipsub::{IdentTopic, MessageAcceptance, MessageId, Topic, TopicHash};
pub use libp2p::{Multiaddr, identity, multiaddr};
pub use libp2p::{PeerId, Swarm, core::ConnectedPoint};
pub use peer_manager::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use crate::TopicHash;
use crate::types::{GossipEncoding, GossipKind, GossipTopic};
use gossipsub::{IdentTopic as Topic, PeerScoreParams, PeerScoreThresholds, TopicScoreParams};
use libp2p::gossipsub::{
IdentTopic as Topic, PeerScoreParams, PeerScoreThresholds, TopicScoreParams,
};
use std::cmp::max;
use std::collections::HashMap;
use std::marker::PhantomData;
Expand Down
18 changes: 9 additions & 9 deletions beacon_node/lighthouse_network/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ use crate::types::{
use crate::{Enr, NetworkGlobals, PubsubMessage, TopicHash, metrics};
use api_types::{AppRequestId, Response};
use futures::stream::StreamExt;
use gossipsub::{
IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, PublishError,
use gossipsub_scoring_parameters::{PeerScoreSettings, lighthouse_gossip_thresholds};
use libp2p::gossipsub::{
self, IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, PublishError,
TopicScoreParams,
};
use gossipsub_scoring_parameters::{PeerScoreSettings, lighthouse_gossip_thresholds};
use libp2p::identity::Keypair;
use libp2p::multiaddr::{self, Multiaddr, Protocol as MProtocol};
use libp2p::swarm::behaviour::toggle::Toggle;
Expand Down Expand Up @@ -1764,9 +1764,9 @@ impl<E: EthSpec> Network<E> {

fn inject_upnp_event(&mut self, event: libp2p::upnp::Event) {
match event {
libp2p::upnp::Event::NewExternalAddr(addr) => {
info!(%addr, "UPnP route established");
let mut iter = addr.iter();
libp2p::upnp::Event::NewExternalAddr { external_addr, .. } => {
info!(%external_addr, "UPnP route established");
let mut iter = external_addr.iter();
let is_ip6 = {
let addr = iter.next();
matches!(addr, Some(MProtocol::Ip6(_)))
Expand All @@ -1781,7 +1781,7 @@ impl<E: EthSpec> Network<E> {
}
}
_ => {
trace!(%addr, "UPnP address mapped multiaddr from unknown transport");
trace!(%external_addr, "UPnP address mapped multiaddr from unknown transport");
}
},
Some(multiaddr::Protocol::Tcp(tcp_port)) => {
Expand All @@ -1790,11 +1790,11 @@ impl<E: EthSpec> Network<E> {
}
}
_ => {
trace!(%addr, "UPnP address mapped multiaddr from unknown transport");
trace!(%external_addr, "UPnP address mapped multiaddr from unknown transport");
}
}
}
libp2p::upnp::Event::ExpiredExternalAddr(_) => {}
libp2p::upnp::Event::ExpiredExternalAddr { .. } => {}
libp2p::upnp::Event::GatewayNotFound => {
info!("UPnP not available");
}
Expand Down
3 changes: 1 addition & 2 deletions beacon_node/lighthouse_network/src/service/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ use crate::rpc::{MetaData, MetaDataV2, MetaDataV3};
use crate::types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield, GossipEncoding, GossipKind};
use crate::{GossipTopic, NetworkConfig};
use futures::future::Either;
use gossipsub;
use libp2p::core::{multiaddr::Multiaddr, muxing::StreamMuxerBox, transport::Boxed};
use libp2p::identity::{Keypair, secp256k1};
use libp2p::metrics::Registry;
use libp2p::{PeerId, Transport, core, noise, yamux};
use libp2p::{PeerId, Transport, core, gossipsub, noise, yamux};
use ssz::Decode;
use std::collections::HashSet;
use std::fs::File;
Expand Down
1 change: 1 addition & 0 deletions beacon_node/lighthouse_network/src/types/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use crate::TopicHash;
use crate::types::{GossipEncoding, GossipKind, GossipTopic};
use libp2p::gossipsub;
use snap::raw::{Decoder, Encoder, decompress_len};
use ssz::{Decode, Encode};
use std::io::{Error, ErrorKind};
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/src/types/topics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use gossipsub::{IdentTopic as Topic, TopicHash};
use libp2p::gossipsub::{IdentTopic as Topic, TopicHash};
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use strum::AsRefStr;
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ bls = { workspace = true }
eth2 = { workspace = true }
eth2_network_config = { workspace = true }
genesis = { workspace = true }
gossipsub = { workspace = true }
k256 = "0.13.4"
kzg = { workspace = true }
libp2p = { workspace = true }
matches = "0.1.8"
rand_08 = { package = "rand", version = "0.8.5" }
rand_chacha = "0.9.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use beacon_chain::test_utils::{
};
use beacon_chain::{BeaconChain, WhenSlotSkipped};
use beacon_processor::{work_reprocessing_queue::*, *};
use gossipsub::MessageAcceptance;
use itertools::Itertools;
use libp2p::gossipsub::MessageAcceptance;
use lighthouse_network::rpc::InboundRequestId;
use lighthouse_network::rpc::methods::{
BlobsByRangeRequest, BlobsByRootRequest, DataColumnsByRangeRequest, MetaDataV3,
Expand Down
1 change: 1 addition & 0 deletions beacon_node/network/src/service/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use beacon_chain::BeaconChainTypes;
use beacon_chain::test_utils::BeaconChainHarness;
use beacon_processor::{BeaconProcessorChannels, BeaconProcessorConfig};
use futures::StreamExt;
use libp2p::gossipsub;
use lighthouse_network::identity::secp256k1;
use lighthouse_network::types::{GossipEncoding, GossipKind};
use lighthouse_network::{Enr, GossipTopic};
Expand Down