Skip to content

Commit

Permalink
update libp2p to 0.55 (#6889)
Browse files Browse the repository at this point in the history
Updates libp2p to `0.55`.
Will address the deprecations in a subsequent PR
  • Loading branch information
jxs authored Jan 31, 2025
1 parent b6db213 commit ddb845d
Show file tree
Hide file tree
Showing 9 changed files with 350 additions and 158 deletions.
471 changes: 333 additions & 138 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions beacon_node/lighthouse_network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ futures = { workspace = true }
gossipsub = { workspace = true }
hex = { workspace = true }
itertools = { workspace = true }
libp2p-mplex = "0.42"
libp2p-mplex = "0.43"
lighthouse_version = { workspace = true }
lru = { workspace = true }
lru_cache = { workspace = true }
Expand Down Expand Up @@ -50,7 +50,7 @@ unused_port = { workspace = true }
void = "1.0.2"

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

Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/gossipsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ futures-timer = "3.0.2"
getrandom = "0.2.12"
hashlink = { workspace = true }
hex_fmt = "0.3.0"
libp2p = { version = "0.54", default-features = false }
libp2p = { version = "0.55", default-features = false }
prometheus-client = "0.22.0"
quick-protobuf = "0.8"
quick-protobuf-codec = "0.3"
Expand Down
18 changes: 5 additions & 13 deletions beacon_node/lighthouse_network/gossipsub/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ impl EnabledHandler {
&mut self,
FullyNegotiatedOutbound { protocol, .. }: FullyNegotiatedOutbound<
<Handler as ConnectionHandler>::OutboundProtocol,
<Handler as ConnectionHandler>::OutboundOpenInfo,
>,
) {
let (substream, peer_kind) = protocol;
Expand All @@ -217,7 +216,7 @@ impl EnabledHandler {
) -> Poll<
ConnectionHandlerEvent<
<Handler as ConnectionHandler>::OutboundProtocol,
<Handler as ConnectionHandler>::OutboundOpenInfo,
(),
<Handler as ConnectionHandler>::ToBehaviour,
>,
> {
Expand Down Expand Up @@ -423,7 +422,7 @@ impl ConnectionHandler for Handler {
type OutboundOpenInfo = ();
type OutboundProtocol = ProtocolConfig;

fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, Self::InboundOpenInfo> {
fn listen_protocol(&self) -> SubstreamProtocol<Self::InboundProtocol, ()> {
match self {
Handler::Enabled(handler) => {
SubstreamProtocol::new(either::Either::Left(handler.listen_protocol.clone()), ())
Expand Down Expand Up @@ -458,9 +457,7 @@ impl ConnectionHandler for Handler {
fn poll(
&mut self,
cx: &mut Context<'_>,
) -> Poll<
ConnectionHandlerEvent<Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour>,
> {
) -> Poll<ConnectionHandlerEvent<Self::OutboundProtocol, (), Self::ToBehaviour>> {
match self {
Handler::Enabled(handler) => handler.poll(cx),
Handler::Disabled(DisabledHandler::ProtocolUnsupported { peer_kind_sent }) => {
Expand All @@ -479,12 +476,7 @@ impl ConnectionHandler for Handler {

fn on_connection_event(
&mut self,
event: ConnectionEvent<
Self::InboundProtocol,
Self::OutboundProtocol,
Self::InboundOpenInfo,
Self::OutboundOpenInfo,
>,
event: ConnectionEvent<Self::InboundProtocol, Self::OutboundProtocol>,
) {
match self {
Handler::Enabled(handler) => {
Expand Down Expand Up @@ -521,7 +513,7 @@ impl ConnectionHandler for Handler {
}) => match protocol {
Either::Left(protocol) => handler.on_fully_negotiated_inbound(protocol),
#[allow(unreachable_patterns)]
Either::Right(v) => void::unreachable(v),
Either::Right(v) => libp2p::core::util::unreachable(v),
},
ConnectionEvent::FullyNegotiatedOutbound(fully_negotiated_outbound) => {
handler.on_fully_negotiated_outbound(fully_negotiated_outbound)
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/src/discovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ impl<E: EthSpec> NetworkBehaviour for Discovery<E> {
&mut self,
_peer_id: PeerId,
_connection_id: ConnectionId,
_event: void::Void,
_event: std::convert::Infallible,
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ impl<E: EthSpec> NetworkBehaviour for PeerManager<E> {
// no events from the dummy handler
}

fn poll(&mut self, cx: &mut Context<'_>) -> Poll<ToSwarm<Self::ToSwarm, void::Void>> {
fn poll(
&mut self,
cx: &mut Context<'_>,
) -> Poll<ToSwarm<Self::ToSwarm, std::convert::Infallible>> {
// perform the heartbeat when necessary
while self.heartbeat.poll_tick(cx).is_ready() {
self.heartbeat();
Expand Down
2 changes: 2 additions & 0 deletions beacon_node/lighthouse_network/src/rpc/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ where
!matches!(self.state, HandlerState::Deactivated)
}

#[allow(deprecated)]
fn poll(
&mut self,
cx: &mut Context<'_>,
Expand Down Expand Up @@ -814,6 +815,7 @@ where
Poll::Pending
}

#[allow(deprecated)]
fn on_connection_event(
&mut self,
event: ConnectionEvent<
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@ impl<E: EthSpec> Network<E> {
None
}
#[allow(unreachable_patterns)]
BehaviourEvent::ConnectionLimits(le) => void::unreachable(le),
BehaviourEvent::ConnectionLimits(le) => libp2p::core::util::unreachable(le),
},
SwarmEvent::ConnectionEstablished { .. } => None,
SwarmEvent::ConnectionClosed { .. } => None,
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 @@ -31,7 +31,7 @@ execution_layer = { workspace = true }
fnv = { workspace = true }
futures = { workspace = true }
hex = { workspace = true }
igd-next = "0.14"
igd-next = { version = "0.16", features = ["aio_tokio"] }
itertools = { workspace = true }
lighthouse_network = { workspace = true }
logging = { workspace = true }
Expand Down

0 comments on commit ddb845d

Please sign in to comment.