-
Notifications
You must be signed in to change notification settings - Fork 743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade libp2p to v0.47.0 #3491
Upgrade libp2p to v0.47.0 #3491
Conversation
775c866
to
03e016a
Compare
I couldn't help updating the title - we can change it back to upg-rage if that was an accurate description of writing this PR 😁 |
lmao what an accurate title description the previous one was @michaelsproul. Thanks for fixing it |
This reverts commit c1d4221.
377af9a
to
01cf480
Compare
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.
Yeah I like this. The majority of code changes seem to be just re-organising structure.
It all looks fine to me.
Ok((network, network_globals)) | ||
} | ||
|
||
// TODO: docs |
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.
Might as well, while we are here
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.
done in 1e5694f
pub fn poll_network(&mut self, cx: &mut Context) -> Poll<NetworkEvent<AppReqId, TSpec>> { | ||
while let Poll::Ready(Some(swarm_event)) = self.swarm.poll_next_unpin(cx) { | ||
let maybe_event = match swarm_event { | ||
SwarmEvent::Behaviour(behaviour_event) => match behaviour_event { |
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.
The new libp2p now makes us do this manually? Thats kinda annoying
But your soln here does look cleaner.
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.
yeah this is essentially the core of the required change
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.
Ok, lets dooo it
## Issue Addressed I missed this from #3491. peers were being banned at the behaviour level only. The identify errors are explained by this as well ## Proposed Changes Add banning and unbanning ## Additional Info Befor,e having tests that catch this was hard because the swarm was outside the behaviour. We could now have tests that prevent something like this in the future
## Issue Addressed I missed this from sigp#3491. peers were being banned at the behaviour level only. The identify errors are explained by this as well ## Proposed Changes Add banning and unbanning ## Additional Info Befor,e having tests that catch this was hard because the swarm was outside the behaviour. We could now have tests that prevent something like this in the future
## Issue Addressed I missed this from sigp#3491. peers were being banned at the behaviour level only. The identify errors are explained by this as well ## Proposed Changes Add banning and unbanning ## Additional Info Befor,e having tests that catch this was hard because the swarm was outside the behaviour. We could now have tests that prevent something like this in the future
Issue Addressed
Upgrades libp2p to v0.47.0. Addresses the deprecation of some traits and parts of the derive macro that force handling behaviour events above the swarm level. See libp2p swarm release notes
Contains #3495 and #3497 so better to give those a pass to make reading this easier.
This upgrade also requires an explicit/manual installation of protoc. See 0.47.0 release notes
Proposed Changes
Behaviour
struct that derivesNetworkBehaviour
. This generates the eventBehaviourEvent
.BehaviourEvent
requires debug, so it's now derived for the sub-behaviour events that did not implement it.Behaviour
toNetwork
.Network
.NetworkBehaviourEventProcess
implementation are moved to functions in theinject_<sub-behaviour>_event
fashion.Libp2pEvent
intoBehaviourEvent
(simply by moving the two extra eventsNewListenAddr
andZeroListeners
). This is renamed toNetworkEvent
service.rs
file had only utility functions for building the swarm, so this file is moved and renamed toservice/utils.rs
. Noting this change here explicitly because git does not recognize the file as moved but as deleted.Additional Info
na