-
Notifications
You must be signed in to change notification settings - Fork 2.6k
chore: update libp2p to 0.52.1 #14429
chore: update libp2p to 0.52.1 #14429
Conversation
also LocalProtocolsChange and RemoteProtocolsChange
also fix pending_events
also use `Behaviour::with_codec`
rename ConnectionHandlerUpgrErr to StreamUpgradeError
client/network/src/service.rs
Outdated
if let Some(metrics) = self.metrics.as_ref() { | ||
let direction = match endpoint { | ||
ConnectedPoint::Dialer { .. } => "out", | ||
ConnectedPoint::Listener { .. } => "in", | ||
}; | ||
let reason = match cause { | ||
Some(ConnectionError::IO(_)) => "transport-error", | ||
// Some(ConnectionError::Handler(Either::Left(Either::Left( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no such variant seems to exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PingFailure
doesn't exist?
What does ConnectionError::Handler(Either::Left(Either::Left(Either::Left(Either::Right
contain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let reason = match cause {
| ----- this expression has type `std::option::Option<ConnectionError<either::Either<either::Either<either::Either<either::Either<NotifsHandlerError, either::Either<void::Void, std::io::Error>>, std::io::Error>, void::Void>, void::Void>>>`
std::io::Error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are sure that this io::Error
is handling the case for ping failure, may be we should still report it as "ping-failure"
and not as default "protocol-error"
?
in attempt to compile polkadot
This comment was marked as resolved.
This comment was marked as resolved.
// Set the Kademlia mode to server so that it can accept incoming requests. | ||
// | ||
// Note: the server mode is set automatically when the node learns its external | ||
// address, but that does not happen in tests => hence we set it manually. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about another test with one server and one client, just to verify that such a scenario also works?
// }; | ||
|
||
// handler.on_connection_event(handler::ConnectionEvent::FullyNegotiatedInbound( | ||
// handler::FullyNegotiatedInbound { protocol: (notif_in, 0), info: () }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC the reason these were commented out was because something in libp2p was made private. What was the exact reason @melekes?
You will appreciate then that lots of engineering hours have already gone and will continue to go into making as few breaking changes as possible:
You can discover more things by following the links in the above issues. Esp. the 0.52 release hardened many many APIs in rust-libp2p that allow us to make improvements without making more breaking changes :) |
self.kademlia.on_swarm_event(FromSwarm::NewListenAddr(e)); | ||
|
||
if let Some(ref mut mdns) = self.mdns { | ||
mdns.on_swarm_event(FromSwarm::NewListenAddr(e)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use libp2p_swarm::behaviour::toggle::Toggle instead of Option<TokioMdns>
. It will remove ifs because they are hidden inside Toggle::on_*
methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea 👍 Will do in a separate PR
bot merge |
Error: Github API says paritytech/cumulus#2838 is not mergeable |
bot merge |
Error: "Check reviews" status is not passing for paritytech/cumulus#2838 |
bot merge |
* update libp2p to 0.52.0 * proto name now must implement `AsRef<str>` * update libp2p version everywhere * ToSwarm, FromBehaviour, ToBehaviour also LocalProtocolsChange and RemoteProtocolsChange * new NetworkBehaviour invariants * replace `Vec<u8>` with `StreamProtocol` * rename ConnectionHandlerEvent::Custom to NotifyBehaviour * remove DialError & ListenError invariants also fix pending_events * use connection_limits::Behaviour See libp2p/rust-libp2p#3885 * impl `void::Void` for `BehaviourOut` also use `Behaviour::with_codec` * KademliaHandler no longer public * fix StreamProtocol construction * update libp2p-identify to 0.2.0 * remove non-existing methods from PollParameters rename ConnectionHandlerUpgrErr to StreamUpgradeError * `P2p` now contains `PeerId`, not `Multihash` * use multihash-codetable crate * update Cargo.lock * reformat text * comment out tests for now * remove `.into()` from P2p * confirm observed addr manually See https://github.com/libp2p/rust-libp2p/blob/master/protocols/identify/CHANGELOG.md#0430 * remove SwarmEvent::Banned since we're not using `ban_peer_id`, this can be safely removed. we may want to introduce `libp2p::allow_block_list` module in the future. * fix imports * replace `libp2p` with smaller deps in network-gossip * bring back tests * finish rewriting tests * uncomment handler tests * Revert "uncomment handler tests" This reverts commit 720a068. * add a fixme * update Cargo.lock * remove extra From * make void uninhabited * fix discovery test * use autonat protocols confirming external addresses manually is unsafe in open networks * fix SyncNotificationsClogged invariant * only set server mode manually in tests doubt that we need to set it on node since we're adding public addresses * address @dmitry-markin comments * remove autonat * removed unused var * fix EOL * update smallvec and sha2 in attempt to compile polkadot * bump k256 in attempt to build cumulus --------- Co-authored-by: parity-processbot <>
changelog: https://github.com/libp2p/rust-libp2p/releases/tag/libp2p-v0.52.0
polkadot companion: paritytech/polkadot#7472
cumulus companion: paritytech/cumulus#2838