Skip to content

Commit 1094261

Browse files
committed
update libp2p dependency to upstream
1 parent 60df5f4 commit 1094261

File tree

13 files changed

+95
-134
lines changed

13 files changed

+95
-134
lines changed

Cargo.lock

Lines changed: 69 additions & 92 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ fork_choice = { path = "consensus/fork_choice" }
161161
fs2 = "0.4"
162162
futures = "0.3"
163163
genesis = { path = "beacon_node/genesis" }
164-
# This is tracking the sigp-gossipsub branch on sigp/rust-libp2p commit: Aug 20 2025
165-
gossipsub = { package = "libp2p-gossipsub", git = "https://github.com/sigp/rust-libp2p.git", rev = "5acdf89a65d64098f9346efa5769e57bcd19dea9", "features" = ["metrics"] }
166164
graffiti_file = { path = "validator_client/graffiti_file" }
167165
hashlink = "0.9.0"
168166
health_metrics = { path = "common/health_metrics" }
@@ -173,6 +171,8 @@ initialized_validators = { path = "validator_client/initialized_validators" }
173171
int_to_bytes = { path = "consensus/int_to_bytes" }
174172
itertools = "0.10"
175173
kzg = { path = "crypto/kzg" }
174+
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", default-features = false, features = ["identify", "yamux", "noise", "dns", "tcp", "tokio", "secp256k1",
175+
"macros", "ecdsa", "metrics", "quic", "upnp", "gossipsub"] }
176176
libsecp256k1 = "0.7"
177177
lighthouse_network = { path = "beacon_node/lighthouse_network" }
178178
lighthouse_tracing = { path = "beacon_node/lighthouse_tracing" }

beacon_node/lighthouse_network/Cargo.toml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ ethereum_ssz = { workspace = true }
2121
ethereum_ssz_derive = { workspace = true }
2222
fnv = { workspace = true }
2323
futures = { workspace = true }
24-
gossipsub = { workspace = true }
2524
hex = { workspace = true }
2625
itertools = { workspace = true }
27-
libp2p-mplex = "0.43"
26+
libp2p = { workspace = true }
27+
libp2p-mplex = { git = "https://github.com/libp2p/rust-libp2p.git" }
2828
lighthouse_version = { workspace = true }
2929
local-ip-address = "0.6"
3030
logging = { workspace = true }
@@ -51,25 +51,6 @@ tracing-subscriber = { workspace = true }
5151
types = { workspace = true }
5252
unsigned-varint = { version = "0.8", features = ["codec"] }
5353

54-
[dependencies.libp2p]
55-
version = "0.56"
56-
default-features = false
57-
features = [
58-
"identify",
59-
"yamux",
60-
"noise",
61-
"dns",
62-
"tcp",
63-
"tokio",
64-
"plaintext",
65-
"secp256k1",
66-
"macros",
67-
"ecdsa",
68-
"metrics",
69-
"quic",
70-
"upnp",
71-
]
72-
7354
[dev-dependencies]
7455
async-channel = { workspace = true }
7556
logging = { workspace = true }

beacon_node/lighthouse_network/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{Enr, PeerIdSerialized};
55
use directory::{
66
DEFAULT_BEACON_NODE_DIR, DEFAULT_HARDCODED_NETWORK, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR,
77
};
8-
use libp2p::Multiaddr;
8+
use libp2p::{Multiaddr, gossipsub};
99
use local_ip_address::local_ipv6;
1010
use network_utils::listen_addr::{ListenAddr, ListenAddress};
1111
use serde::{Deserialize, Serialize};

beacon_node/lighthouse_network/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ pub use prometheus_client;
107107
pub use config::Config as NetworkConfig;
108108
pub use discovery::Eth2Enr;
109109
pub use discv5;
110-
pub use gossipsub::{IdentTopic, MessageAcceptance, MessageId, Topic, TopicHash};
111110
pub use libp2p;
111+
pub use libp2p::gossipsub::{IdentTopic, MessageAcceptance, MessageId, Topic, TopicHash};
112112
pub use libp2p::{Multiaddr, multiaddr};
113113
pub use libp2p::{PeerId, Swarm, core::ConnectedPoint};
114114
pub use peer_manager::{

beacon_node/lighthouse_network/src/service/gossipsub_scoring_parameters.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use crate::TopicHash;
22
use crate::types::{GossipEncoding, GossipKind, GossipTopic};
3-
use gossipsub::{IdentTopic as Topic, PeerScoreParams, PeerScoreThresholds, TopicScoreParams};
3+
use libp2p::gossipsub::{
4+
IdentTopic as Topic, PeerScoreParams, PeerScoreThresholds, TopicScoreParams,
5+
};
46
use std::cmp::max;
57
use std::collections::HashMap;
68
use std::marker::PhantomData;

beacon_node/lighthouse_network/src/service/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ use crate::types::{
2121
use crate::{Enr, NetworkGlobals, PubsubMessage, TopicHash, metrics};
2222
use api_types::{AppRequestId, Response};
2323
use futures::stream::StreamExt;
24-
use gossipsub::{
25-
IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, PublishError,
24+
use gossipsub_scoring_parameters::{PeerScoreSettings, lighthouse_gossip_thresholds};
25+
use libp2p::gossipsub::{
26+
self, IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, PublishError,
2627
TopicScoreParams,
2728
};
28-
use gossipsub_scoring_parameters::{PeerScoreSettings, lighthouse_gossip_thresholds};
2929
use libp2p::multiaddr::{self, Multiaddr, Protocol as MProtocol};
3030
use libp2p::swarm::behaviour::toggle::Toggle;
3131
use libp2p::swarm::{NetworkBehaviour, Swarm, SwarmEvent};
@@ -1764,9 +1764,9 @@ impl<E: EthSpec> Network<E> {
17641764

17651765
fn inject_upnp_event(&mut self, event: libp2p::upnp::Event) {
17661766
match event {
1767-
libp2p::upnp::Event::NewExternalAddr(addr) => {
1768-
info!(%addr, "UPnP route established");
1769-
let mut iter = addr.iter();
1767+
libp2p::upnp::Event::NewExternalAddr { external_addr, .. } => {
1768+
info!(%external_addr, "UPnP route established");
1769+
let mut iter = external_addr.iter();
17701770
let is_ip6 = {
17711771
let addr = iter.next();
17721772
matches!(addr, Some(MProtocol::Ip6(_)))
@@ -1781,7 +1781,7 @@ impl<E: EthSpec> Network<E> {
17811781
}
17821782
}
17831783
_ => {
1784-
trace!(%addr, "UPnP address mapped multiaddr from unknown transport");
1784+
trace!(%external_addr, "UPnP address mapped multiaddr from unknown transport");
17851785
}
17861786
},
17871787
Some(multiaddr::Protocol::Tcp(tcp_port)) => {
@@ -1790,11 +1790,11 @@ impl<E: EthSpec> Network<E> {
17901790
}
17911791
}
17921792
_ => {
1793-
trace!(%addr, "UPnP address mapped multiaddr from unknown transport");
1793+
trace!(%external_addr, "UPnP address mapped multiaddr from unknown transport");
17941794
}
17951795
}
17961796
}
1797-
libp2p::upnp::Event::ExpiredExternalAddr(_) => {}
1797+
libp2p::upnp::Event::ExpiredExternalAddr { .. } => {}
17981798
libp2p::upnp::Event::GatewayNotFound => {
17991799
info!("UPnP not available");
18001800
}

beacon_node/lighthouse_network/src/service/utils.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ use crate::rpc::{MetaData, MetaDataV2, MetaDataV3};
33
use crate::types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield, GossipEncoding, GossipKind};
44
use crate::{GossipTopic, NetworkConfig};
55
use futures::future::Either;
6-
use gossipsub;
76
use libp2p::core::{multiaddr::Multiaddr, muxing::StreamMuxerBox, transport::Boxed};
87
use libp2p::identity::{Keypair, secp256k1};
98
use libp2p::metrics::Registry;
10-
use libp2p::{PeerId, Transport, core, noise, yamux};
9+
use libp2p::{PeerId, Transport, core, gossipsub, noise, yamux};
1110
use ssz::Decode;
1211
use std::collections::HashSet;
1312
use std::fs::File;
@@ -41,7 +40,7 @@ pub fn build_transport(
4140
quic_support: bool,
4241
) -> std::io::Result<BoxedTransport> {
4342
// mplex config
44-
let mut mplex_config = libp2p_mplex::MplexConfig::new();
43+
let mut mplex_config = libp2p_mplex::Config::new();
4544
mplex_config.set_max_buffer_size(256);
4645
mplex_config.set_max_buffer_behaviour(libp2p_mplex::MaxBufferBehaviour::Block);
4746

beacon_node/lighthouse_network/src/types/pubsub.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use crate::TopicHash;
44
use crate::types::{GossipEncoding, GossipKind, GossipTopic};
5+
use libp2p::gossipsub;
56
use snap::raw::{Decoder, Encoder, decompress_len};
67
use ssz::{Decode, Encode};
78
use std::io::{Error, ErrorKind};

beacon_node/lighthouse_network/src/types/topics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use gossipsub::{IdentTopic as Topic, TopicHash};
1+
use libp2p::gossipsub::{IdentTopic as Topic, TopicHash};
22
use serde::{Deserialize, Serialize};
33
use std::collections::HashSet;
44
use strum::AsRefStr;

0 commit comments

Comments
 (0)