Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Bump libp2p to 0.40.0 #10035

Merged
merged 41 commits into from
Nov 25, 2021
Merged

Bump libp2p to 0.40.0 #10035

merged 41 commits into from
Nov 25, 2021

Conversation

kpp
Copy link
Contributor

@kpp kpp commented Oct 15, 2021

  • What does it do?

Updates libp2p to a 0.40.0 version.

@github-actions github-actions bot added the A3-in_progress Pull request is in progress. No review needed at this stage. label Oct 15, 2021
@kpp kpp changed the title Bump libp2p to 0.40.0-rc.1 Bump libp2p to 0.40.0-rc Oct 15, 2021
@gilescope
Copy link
Contributor

excellent. this will be one more dep not using an old rand version.

@kpp kpp added B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Oct 21, 2021
@dvdplm
Copy link
Contributor

dvdplm commented Nov 4, 2021

@kpp Any news on this? Now that 0.40 is out this could use an update?

@kpp
Copy link
Contributor Author

kpp commented Nov 4, 2021

Yes, I will update it.
News: there are burn-ins running - https://grafana.parity-mgmt.parity.io/explore?orgId=1&left=%5B%22now-1h%22%2C%22now%22%2C%22loki-polkadot.stakingops-logs%22%2C%7B%22expr%22%3A%22%7Bhost%3D%5C%22polkadot-burnin-fullnode-1%5C%22%7D%22%7D%5D , we should review them.

@kpp kpp changed the title Bump libp2p to 0.40.0-rc Bump libp2p to 0.40.0 Nov 8, 2021
@kpp kpp requested review from tomaka and bkchr November 8, 2021 09:32
@tomaka
Copy link
Contributor

tomaka commented Nov 16, 2021

I think that some methods have been added to the NetworkBehaviour trait in libp2p 0.40
https://docs.rs/libp2p/0.40.0/libp2p/swarm/trait.NetworkBehaviour.html

Could you make sure that all our implementations of this trait have all the methods when necessary?
I see that inject_address_change is missing in discovery.rs.

@kpp
Copy link
Contributor Author

kpp commented Nov 16, 2021

inject_address_change is missing in discovery.rs

It was introduced in libp2p-swarm in 0.20.0 [2020-07-01].

I made a diff of methods of NetworkBehaviour:

$ diff 0.39.txt 0.40.txt 
3d2
< inject_addr_reach_failure
13a13
> inject_listen_failure

So only NetworkBehaviour::inject_listen_failure should be addressed in this PR. Will fix.

for k in self.kademlias.values_mut() {
NetworkBehaviour::inject_connection_closed(k, peer_id, conn, endpoint)
}
// NetworkBehaviour::inject_connection_closed on Kademlia<MemoryStore> does nothing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not really future-proof. Maybe in a future version it will do something.
We need a way to deconstruct a MultiHandler and libp2p doesn't provide any. When this PR is merged, could you open an issue in libp2p and in Substrate and follow up with a fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mxinden can you take a look at this one? ^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a way to deconstruct a MultiHandler and libp2p doesn't provide any.

Any road blockers to contributing this upstream (rust-libp2p)?

@@ -649,6 +689,10 @@ impl NetworkBehaviour for DiscoveryBehaviour {
}
}

fn inject_listen_failure(&mut self, _: &Multiaddr, _: &Multiaddr, _: Self::ProtocolsHandler) {
// NetworkBehaviour::inject_listen_failure on Kademlia<MemoryStore> does nothing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark as above

client/network/src/discovery.rs Outdated Show resolved Hide resolved
client/network/src/peer_info.rs Outdated Show resolved Hide resolved
client/network/src/peer_info.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@tomaka tomaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM provided we fix my two remaining review comments in the near future.

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just needs master merge

@tomaka
Copy link
Contributor

tomaka commented Nov 25, 2021

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 4617267 into master Nov 25, 2021
@paritytech-processbot paritytech-processbot bot deleted the kpp-libp2p-0.40.0-rc1 branch November 25, 2021 08:33
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
* Bump libp2p to 0.40.0-rc.1

* Fix PingFailure import

* Reduce the number of compilation errors (this is a FIXME commit)

* Bump libp2p to 0.40.0-rc.2

* Fix sc-network::Behaviour to inject events into fields

* Fix some NetworkBehaviourAction types

* More fixes

* More fixes

* More fixes

* Fix DiscoveryBehaviour

* Fix PeerInfoBehaviour

* Fix RequestResponsesBehaviour

* Fix RequestResponsesBehaviour

* Fix Notifications

* Fix NetworkWorker

* Fix Behaviour

* Please borrowchk

* Please borrowchk

* Please borrowchk

* Fix fmt

* Cover all cases in matches

* Fix some clippy warnings

* Fix into_peer_id -> to_peer_id

* Fix some warnings

* Fix some inject_dial_failure FIXMEs

* Fix DiscoveryBehaviour::inject_dial_failure

* Fix RequestResponsesBehaviour::inject_dial_failure

* Fix the order of inject_connection_closed PeerInfoBehaviour events

* Make KademliaEvent with filtering unreachable

* Fix Notifications::inject_dial_failure

* Use concurrent_dial_errors in NetworkWorker

* Remove commented-out RequestResponsesBehaviour::inject_addr_reach_failure

* Fix tests

* Dont report new PendingConnectionError and DialError variants to metrics

* Bump libp2p to 0.40.0

* Add fn inject_listen_failure and inject_address_change

* Review fixes
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* Bump libp2p to 0.40.0-rc.1

* Fix PingFailure import

* Reduce the number of compilation errors (this is a FIXME commit)

* Bump libp2p to 0.40.0-rc.2

* Fix sc-network::Behaviour to inject events into fields

* Fix some NetworkBehaviourAction types

* More fixes

* More fixes

* More fixes

* Fix DiscoveryBehaviour

* Fix PeerInfoBehaviour

* Fix RequestResponsesBehaviour

* Fix RequestResponsesBehaviour

* Fix Notifications

* Fix NetworkWorker

* Fix Behaviour

* Please borrowchk

* Please borrowchk

* Please borrowchk

* Fix fmt

* Cover all cases in matches

* Fix some clippy warnings

* Fix into_peer_id -> to_peer_id

* Fix some warnings

* Fix some inject_dial_failure FIXMEs

* Fix DiscoveryBehaviour::inject_dial_failure

* Fix RequestResponsesBehaviour::inject_dial_failure

* Fix the order of inject_connection_closed PeerInfoBehaviour events

* Make KademliaEvent with filtering unreachable

* Fix Notifications::inject_dial_failure

* Use concurrent_dial_errors in NetworkWorker

* Remove commented-out RequestResponsesBehaviour::inject_addr_reach_failure

* Fix tests

* Dont report new PendingConnectionError and DialError variants to metrics

* Bump libp2p to 0.40.0

* Add fn inject_listen_failure and inject_address_change

* Review fixes
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants