Upgrade libp2p to v0.47.0#3491
Merged
AgeManning merged 31 commits intosigp:libp2p-v0.47.0-upgradefrom Sep 7, 2022
Merged
Conversation
775c866 to
03e016a
Compare
Member
|
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 😁 |
Contributor
Author
|
lmao what an accurate title description the previous one was @michaelsproul. Thanks for fixing it |
This reverts commit c1d4221.
377af9a to
01cf480
Compare
AgeManning
approved these changes
Sep 6, 2022
Member
AgeManning
left a comment
There was a problem hiding this comment.
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 |
Member
There was a problem hiding this comment.
Might as well, while we are here
| 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 { |
Member
There was a problem hiding this comment.
The new libp2p now makes us do this manually? Thats kinda annoying
But your soln here does look cleaner.
Contributor
Author
There was a problem hiding this comment.
yeah this is essentially the core of the required change
5 tasks
bors bot
pushed a commit
that referenced
this pull request
Oct 24, 2022
## 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
macladson
pushed a commit
to macladson/lighthouse
that referenced
this pull request
Jan 5, 2023
## 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
Woodpile37
pushed a commit
to Woodpile37/lighthouse
that referenced
this pull request
Jan 6, 2024
Woodpile37
pushed a commit
to Woodpile37/lighthouse
that referenced
this pull request
Jan 6, 2024
## 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Behaviourstruct that derivesNetworkBehaviour. This generates the eventBehaviourEvent.BehaviourEventrequires debug, so it's now derived for the sub-behaviour events that did not implement it.BehaviourtoNetwork.Network.NetworkBehaviourEventProcessimplementation are moved to functions in theinject_<sub-behaviour>_eventfashion.Libp2pEventintoBehaviourEvent(simply by moving the two extra eventsNewListenAddrandZeroListeners). This is renamed toNetworkEventservice.rsfile 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