update libp2p dependency to upstream (#8200)

Co-Authored-By: João Oliveira <hello@jxs.pt>
This commit is contained in:
João Oliveira
2026-01-20 19:45:48 +00:00
committed by GitHub
parent f78757bc4f
commit 33e41d3f44
13 changed files with 407 additions and 380 deletions

707
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -156,8 +156,6 @@ fork_choice = { path = "consensus/fork_choice" }
fs2 = "0.4" fs2 = "0.4"
futures = "0.3" futures = "0.3"
genesis = { path = "beacon_node/genesis" } 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" } graffiti_file = { path = "validator_client/graffiti_file" }
hashlink = "0.9.0" hashlink = "0.9.0"
health_metrics = { path = "common/health_metrics" } health_metrics = { path = "common/health_metrics" }
@@ -168,6 +166,20 @@ initialized_validators = { path = "validator_client/initialized_validators" }
int_to_bytes = { path = "consensus/int_to_bytes" } int_to_bytes = { path = "consensus/int_to_bytes" }
itertools = "0.10" itertools = "0.10"
kzg = { path = "crypto/kzg" } kzg = { path = "crypto/kzg" }
libp2p = { git = "https://github.com/libp2p/rust-libp2p.git", default-features = false, features = [
"identify",
"yamux",
"noise",
"dns",
"tcp",
"tokio",
"secp256k1",
"macros",
"metrics",
"quic",
"upnp",
"gossipsub",
] }
libsecp256k1 = "0.7" libsecp256k1 = "0.7"
lighthouse_network = { path = "beacon_node/lighthouse_network" } lighthouse_network = { path = "beacon_node/lighthouse_network" }
lighthouse_tracing = { path = "beacon_node/lighthouse_tracing" } lighthouse_tracing = { path = "beacon_node/lighthouse_tracing" }

View File

@@ -5,9 +5,6 @@ authors = ["Sigma Prime <contact@sigmaprime.io>"]
edition = { workspace = true } edition = { workspace = true }
autotests = false autotests = false
[features]
libp2p-websocket = []
[dependencies] [dependencies]
alloy-primitives = { workspace = true } alloy-primitives = { workspace = true }
alloy-rlp = { workspace = true } alloy-rlp = { workspace = true }
@@ -24,10 +21,10 @@ ethereum_ssz_derive = { workspace = true }
fixed_bytes = { workspace = true } fixed_bytes = { workspace = true }
fnv = { workspace = true } fnv = { workspace = true }
futures = { workspace = true } futures = { workspace = true }
gossipsub = { workspace = true }
hex = { workspace = true } hex = { workspace = true }
itertools = { 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 } lighthouse_version = { workspace = true }
local-ip-address = "0.6" local-ip-address = "0.6"
logging = { workspace = true } logging = { workspace = true }
@@ -36,7 +33,7 @@ lru_cache = { workspace = true }
metrics = { workspace = true } metrics = { workspace = true }
network_utils = { workspace = true } network_utils = { workspace = true }
parking_lot = { workspace = true } parking_lot = { workspace = true }
prometheus-client = "0.23.0" prometheus-client = "0.24.0"
rand = { workspace = true } rand = { workspace = true }
regex = { workspace = true } regex = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
@@ -55,24 +52,6 @@ typenum = { workspace = true }
types = { workspace = true } types = { workspace = true }
unsigned-varint = { version = "0.8", features = ["codec"] } 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] [dev-dependencies]
async-channel = { workspace = true } async-channel = { workspace = true }
logging = { workspace = true } logging = { workspace = true }

View File

@@ -5,7 +5,7 @@ use crate::{Enr, PeerIdSerialized};
use directory::{ use directory::{
DEFAULT_BEACON_NODE_DIR, DEFAULT_HARDCODED_NETWORK, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR, 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 local_ip_address::local_ipv6;
use network_utils::listen_addr::{ListenAddr, ListenAddress}; use network_utils::listen_addr::{ListenAddr, ListenAddress};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View File

@@ -107,8 +107,8 @@ pub use prometheus_client;
pub use config::Config as NetworkConfig; pub use config::Config as NetworkConfig;
pub use discovery::Eth2Enr; pub use discovery::Eth2Enr;
pub use discv5; pub use discv5;
pub use gossipsub::{IdentTopic, MessageAcceptance, MessageId, Topic, TopicHash};
pub use libp2p; pub use libp2p;
pub use libp2p::gossipsub::{IdentTopic, MessageAcceptance, MessageId, Topic, TopicHash};
pub use libp2p::{Multiaddr, identity, multiaddr}; pub use libp2p::{Multiaddr, identity, multiaddr};
pub use libp2p::{PeerId, Swarm, core::ConnectedPoint}; pub use libp2p::{PeerId, Swarm, core::ConnectedPoint};
pub use peer_manager::{ pub use peer_manager::{

View File

@@ -1,6 +1,8 @@
use crate::TopicHash; use crate::TopicHash;
use crate::types::{GossipEncoding, GossipKind, GossipTopic}; 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::cmp::max;
use std::collections::HashMap; use std::collections::HashMap;
use std::marker::PhantomData; use std::marker::PhantomData;

View File

@@ -21,11 +21,11 @@ use crate::types::{
use crate::{Enr, NetworkGlobals, PubsubMessage, TopicHash, metrics}; use crate::{Enr, NetworkGlobals, PubsubMessage, TopicHash, metrics};
use api_types::{AppRequestId, Response}; use api_types::{AppRequestId, Response};
use futures::stream::StreamExt; use futures::stream::StreamExt;
use gossipsub::{ use gossipsub_scoring_parameters::{PeerScoreSettings, lighthouse_gossip_thresholds};
IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, PublishError, use libp2p::gossipsub::{
self, IdentTopic as Topic, MessageAcceptance, MessageAuthenticity, MessageId, PublishError,
TopicScoreParams, TopicScoreParams,
}; };
use gossipsub_scoring_parameters::{PeerScoreSettings, lighthouse_gossip_thresholds};
use libp2p::identity::Keypair; use libp2p::identity::Keypair;
use libp2p::multiaddr::{self, Multiaddr, Protocol as MProtocol}; use libp2p::multiaddr::{self, Multiaddr, Protocol as MProtocol};
use libp2p::swarm::behaviour::toggle::Toggle; use libp2p::swarm::behaviour::toggle::Toggle;
@@ -1764,9 +1764,9 @@ impl<E: EthSpec> Network<E> {
fn inject_upnp_event(&mut self, event: libp2p::upnp::Event) { fn inject_upnp_event(&mut self, event: libp2p::upnp::Event) {
match event { match event {
libp2p::upnp::Event::NewExternalAddr(addr) => { libp2p::upnp::Event::NewExternalAddr { external_addr, .. } => {
info!(%addr, "UPnP route established"); info!(%external_addr, "UPnP route established");
let mut iter = addr.iter(); let mut iter = external_addr.iter();
let is_ip6 = { let is_ip6 = {
let addr = iter.next(); let addr = iter.next();
matches!(addr, Some(MProtocol::Ip6(_))) matches!(addr, Some(MProtocol::Ip6(_)))
@@ -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)) => { Some(multiaddr::Protocol::Tcp(tcp_port)) => {
@@ -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 => { libp2p::upnp::Event::GatewayNotFound => {
info!("UPnP not available"); info!("UPnP not available");
} }

View File

@@ -3,11 +3,10 @@ use crate::rpc::{MetaData, MetaDataV2, MetaDataV3};
use crate::types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield, GossipEncoding, GossipKind}; use crate::types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield, GossipEncoding, GossipKind};
use crate::{GossipTopic, NetworkConfig}; use crate::{GossipTopic, NetworkConfig};
use futures::future::Either; use futures::future::Either;
use gossipsub;
use libp2p::core::{multiaddr::Multiaddr, muxing::StreamMuxerBox, transport::Boxed}; use libp2p::core::{multiaddr::Multiaddr, muxing::StreamMuxerBox, transport::Boxed};
use libp2p::identity::{Keypair, secp256k1}; use libp2p::identity::{Keypair, secp256k1};
use libp2p::metrics::Registry; use libp2p::metrics::Registry;
use libp2p::{PeerId, Transport, core, noise, yamux}; use libp2p::{PeerId, Transport, core, gossipsub, noise, yamux};
use ssz::Decode; use ssz::Decode;
use std::collections::HashSet; use std::collections::HashSet;
use std::fs::File; use std::fs::File;

View File

@@ -2,6 +2,7 @@
use crate::TopicHash; use crate::TopicHash;
use crate::types::{GossipEncoding, GossipKind, GossipTopic}; use crate::types::{GossipEncoding, GossipKind, GossipTopic};
use libp2p::gossipsub;
use snap::raw::{Decoder, Encoder, decompress_len}; use snap::raw::{Decoder, Encoder, decompress_len};
use ssz::{Decode, Encode}; use ssz::{Decode, Encode};
use std::io::{Error, ErrorKind}; use std::io::{Error, ErrorKind};

View File

@@ -1,4 +1,4 @@
use gossipsub::{IdentTopic as Topic, TopicHash}; use libp2p::gossipsub::{IdentTopic as Topic, TopicHash};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashSet; use std::collections::HashSet;
use strum::AsRefStr; use strum::AsRefStr;

View File

@@ -54,9 +54,9 @@ bls = { workspace = true }
eth2 = { workspace = true } eth2 = { workspace = true }
eth2_network_config = { workspace = true } eth2_network_config = { workspace = true }
genesis = { workspace = true } genesis = { workspace = true }
gossipsub = { workspace = true }
k256 = "0.13.4" k256 = "0.13.4"
kzg = { workspace = true } kzg = { workspace = true }
libp2p = { workspace = true }
matches = "0.1.8" matches = "0.1.8"
rand_08 = { package = "rand", version = "0.8.5" } rand_08 = { package = "rand", version = "0.8.5" }
rand_chacha = "0.9.0" rand_chacha = "0.9.0"

View File

@@ -19,8 +19,8 @@ use beacon_chain::test_utils::{
}; };
use beacon_chain::{BeaconChain, WhenSlotSkipped}; use beacon_chain::{BeaconChain, WhenSlotSkipped};
use beacon_processor::{work_reprocessing_queue::*, *}; use beacon_processor::{work_reprocessing_queue::*, *};
use gossipsub::MessageAcceptance;
use itertools::Itertools; use itertools::Itertools;
use libp2p::gossipsub::MessageAcceptance;
use lighthouse_network::rpc::InboundRequestId; use lighthouse_network::rpc::InboundRequestId;
use lighthouse_network::rpc::methods::{ use lighthouse_network::rpc::methods::{
BlobsByRangeRequest, BlobsByRootRequest, DataColumnsByRangeRequest, MetaDataV3, BlobsByRangeRequest, BlobsByRootRequest, DataColumnsByRangeRequest, MetaDataV3,

View File

@@ -6,6 +6,7 @@ use beacon_chain::BeaconChainTypes;
use beacon_chain::test_utils::BeaconChainHarness; use beacon_chain::test_utils::BeaconChainHarness;
use beacon_processor::{BeaconProcessorChannels, BeaconProcessorConfig}; use beacon_processor::{BeaconProcessorChannels, BeaconProcessorConfig};
use futures::StreamExt; use futures::StreamExt;
use libp2p::gossipsub;
use lighthouse_network::identity::secp256k1; use lighthouse_network::identity::secp256k1;
use lighthouse_network::types::{GossipEncoding, GossipKind}; use lighthouse_network::types::{GossipEncoding, GossipKind};
use lighthouse_network::{Enr, GossipTopic}; use lighthouse_network::{Enr, GossipTopic};