Upgrade to libp2p 0.51.3 (#13587)

* client/network: upgrade to libp2p 0.51.0

* make discovery.rs compile

* make peer_info.rs compile

* changes to notifications and request-response proto

* make service.rs compile

* towards making request_responses.rs compile

* make request_responses.rs compile

* make request_responses.rs compile

* fix notifications/behaviour.rs tests

* fix warnings

* remove old code

* allow deprecated code (temporary)

* upgrade to libp2p 0.51.1

* add TODO for behaviour tests

* return empty vec if peer_id is absent

https://github.com/paritytech/substrate/pull/13587#discussion_r1141695167

fyi: I don't really know what the old behaviour was.

* update comment to reflect new defaults

Closes #13338

* Revert "update comment to reflect new defaults"

This reverts commit 7a981abd69308e9d522ec94905f181439a1b1dba.

* remove config.rs (from wrong merge)

* upgrade to libp2p 0.51.2

* fix formatting

* use handle_pending_outbound_connection in networt_state RPC

* update deps

* use re-exports when we use other libp2p packages

* Apply suggestions from code review

Co-authored-by: Dmitry Markin <dmitry@markin.tech>

* format code

* handle potential errors in network_state RPC

* only update libp2p crate

* update libp2p-core

* fix docs

* use libp2p-identity instead of libp2p

where it's possible. libp2p-identity is much smaller, hence makes sense
to use it instead of larger libp2p crate.

* Update client/network/src/discovery.rs

Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com>

* update Cargo.lock

* add comment for per_connection_event_buffer_size

current value is somewhat arbitrary and needs to be tweaked depending on
memory usage and network worker sleep stats.

* fix link format

* update Cargo.lock

* upgrade to libp2p 0.51.3

* deprecate mplex

* Revert "deprecate mplex"

This reverts commit 9e25820e706e464a0e962a8604861fcb2a7641eb.

* Revert "upgrade to libp2p 0.51.3"

This reverts commit 6544dd4138e2f89517bd7c7281fc78a638ec7040.

* use new libp2p version in `statement` crate

* pin version temporarily

* libp2p 0.51.3

* deprecate mplex

* deprecate legacy noise handshake

* fix build error

* update libp2p-identity

* enable libp2p-identity:ed25519 feature in sc-consensus

* enable ed25519 for peerset as well

---------

Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
Anton
2023-05-12 11:12:51 +04:00
committed by GitHub
parent 56940bc874
commit e4b1aa1811
48 changed files with 1005 additions and 927 deletions
+135 -175
View File
@@ -514,12 +514,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "asn1_der"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "155a5a185e42c6b77ac7b88a15143d930a9e9727a5b7b77eed417404ab15c247"
[[package]]
name = "assert_cmd"
version = "2.0.11"
@@ -4097,22 +4091,24 @@ checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"
[[package]]
name = "libp2p"
version = "0.50.1"
version = "0.51.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c7b0104790be871edcf97db9bd2356604984e623a08d825c3f27852290266b8"
checksum = "f210d259724eae82005b5c48078619b7745edb7b76de370b03f8ba59ea103097"
dependencies = [
"bytes",
"futures",
"futures-timer",
"getrandom 0.2.9",
"instant",
"libp2p-core 0.38.0",
"libp2p-allow-block-list",
"libp2p-connection-limits",
"libp2p-core",
"libp2p-dns",
"libp2p-identify",
"libp2p-identity",
"libp2p-kad",
"libp2p-mdns",
"libp2p-metrics",
"libp2p-mplex",
"libp2p-noise",
"libp2p-ping",
"libp2p-quic",
@@ -4123,44 +4119,32 @@ dependencies = [
"libp2p-webrtc",
"libp2p-websocket",
"libp2p-yamux",
"multiaddr 0.16.0",
"parking_lot 0.12.1",
"multiaddr",
"pin-project",
"smallvec",
]
[[package]]
name = "libp2p-core"
version = "0.38.0"
name = "libp2p-allow-block-list"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6a8fcd392ff67af6cc3f03b1426c41f7f26b6b9aff2dc632c1c56dd649e571f"
checksum = "510daa05efbc25184458db837f6f9a5143888f1caa742426d92e1833ddd38a50"
dependencies = [
"asn1_der",
"bs58",
"ed25519-dalek",
"either",
"fnv",
"futures",
"futures-timer",
"instant",
"log",
"multiaddr 0.16.0",
"multihash 0.16.3",
"multistream-select",
"once_cell",
"parking_lot 0.12.1",
"pin-project",
"prost",
"prost-build",
"rand 0.8.5",
"rw-stream-sink",
"sec1 0.3.0",
"sha2 0.10.6",
"smallvec",
"thiserror",
"unsigned-varint",
"libp2p-core",
"libp2p-identity",
"libp2p-swarm",
"void",
]
[[package]]
name = "libp2p-connection-limits"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4caa33f1d26ed664c4fe2cca81a08c8e07d4c1c04f2f4ac7655c2dd85467fda0"
dependencies = [
"libp2p-core",
"libp2p-identity",
"libp2p-swarm",
"void",
"zeroize",
]
[[package]]
@@ -4176,7 +4160,7 @@ dependencies = [
"instant",
"libp2p-identity",
"log",
"multiaddr 0.17.1",
"multiaddr",
"multihash 0.17.0",
"multistream-select",
"once_cell",
@@ -4193,12 +4177,12 @@ dependencies = [
[[package]]
name = "libp2p-dns"
version = "0.38.0"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e42a271c1b49f789b92f7fc87749fa79ce5c7bdc88cbdfacb818a4bca47fec5"
checksum = "146ff7034daae62077c415c2376b8057368042df6ab95f5432ad5e88568b1554"
dependencies = [
"futures",
"libp2p-core 0.38.0",
"libp2p-core",
"log",
"parking_lot 0.12.1",
"smallvec",
@@ -4207,20 +4191,21 @@ dependencies = [
[[package]]
name = "libp2p-identify"
version = "0.41.1"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c052d0026f4817b44869bfb6810f4e1112f43aec8553f2cb38881c524b563abf"
checksum = "5455f472243e63b9c497ff320ded0314254a9eb751799a39c283c6f20b793f3c"
dependencies = [
"asynchronous-codec",
"either",
"futures",
"futures-timer",
"libp2p-core 0.38.0",
"libp2p-core",
"libp2p-identity",
"libp2p-swarm",
"log",
"lru",
"prost",
"prost-build",
"prost-codec",
"lru 0.10.0",
"quick-protobuf",
"quick-protobuf-codec",
"smallvec",
"thiserror",
"void",
@@ -4235,7 +4220,7 @@ dependencies = [
"bs58",
"ed25519-dalek",
"log",
"multiaddr 0.17.1",
"multiaddr",
"multihash 0.17.0",
"quick-protobuf",
"rand 0.8.5",
@@ -4246,9 +4231,9 @@ dependencies = [
[[package]]
name = "libp2p-kad"
version = "0.42.1"
version = "0.43.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2766dcd2be8c87d5e1f35487deb22d765f49c6ae1251b3633efe3b25698bd3d2"
checksum = "39d5ef876a2b2323d63c258e63c2f8e36f205fe5a11f0b3095d59635650790ff"
dependencies = [
"arrayvec 0.7.2",
"asynchronous-codec",
@@ -4258,11 +4243,11 @@ dependencies = [
"futures",
"futures-timer",
"instant",
"libp2p-core 0.38.0",
"libp2p-core",
"libp2p-identity",
"libp2p-swarm",
"log",
"prost",
"prost-build",
"quick-protobuf",
"rand 0.8.5",
"sha2 0.10.6",
"smallvec",
@@ -4274,14 +4259,15 @@ dependencies = [
[[package]]
name = "libp2p-mdns"
version = "0.42.0"
version = "0.43.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04f378264aade9872d6ccd315c0accc18be3a35d15fc1b9c36e5b6f983b62b5b"
checksum = "19983e1f949f979a928f2c603de1cf180cc0dc23e4ac93a62651ccb18341460b"
dependencies = [
"data-encoding",
"futures",
"if-watch",
"libp2p-core 0.38.0",
"libp2p-core",
"libp2p-identity",
"libp2p-swarm",
"log",
"rand 0.8.5",
@@ -4294,11 +4280,11 @@ dependencies = [
[[package]]
name = "libp2p-metrics"
version = "0.11.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ad8a64f29da86005c86a4d2728b8a0719e9b192f4092b609fd8790acb9dec55"
checksum = "a42ec91e227d7d0dafa4ce88b333cdf5f277253873ab087555c92798db2ddd46"
dependencies = [
"libp2p-core 0.38.0",
"libp2p-core",
"libp2p-identify",
"libp2p-kad",
"libp2p-ping",
@@ -4306,38 +4292,20 @@ dependencies = [
"prometheus-client",
]
[[package]]
name = "libp2p-mplex"
version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03805b44107aa013e7cbbfa5627b31c36cbedfdfb00603c0311998882bc4bace"
dependencies = [
"asynchronous-codec",
"bytes",
"futures",
"libp2p-core 0.38.0",
"log",
"nohash-hasher",
"parking_lot 0.12.1",
"rand 0.8.5",
"smallvec",
"unsigned-varint",
]
[[package]]
name = "libp2p-noise"
version = "0.41.0"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a978cb57efe82e892ec6f348a536bfbd9fee677adbe5689d7a93ad3a9bffbf2e"
checksum = "9c3673da89d29936bc6435bafc638e2f184180d554ce844db65915113f86ec5e"
dependencies = [
"bytes",
"curve25519-dalek 3.2.0",
"futures",
"libp2p-core 0.38.0",
"libp2p-core",
"libp2p-identity",
"log",
"once_cell",
"prost",
"prost-build",
"quick-protobuf",
"rand 0.8.5",
"sha2 0.10.6",
"snow",
@@ -4349,14 +4317,15 @@ dependencies = [
[[package]]
name = "libp2p-ping"
version = "0.41.0"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "929fcace45a112536e22b3dcfd4db538723ef9c3cb79f672b98be2cc8e25f37f"
checksum = "3e57759c19c28a73ef1eb3585ca410cefb72c1a709fcf6de1612a378e4219202"
dependencies = [
"either",
"futures",
"futures-timer",
"instant",
"libp2p-core 0.38.0",
"libp2p-core",
"libp2p-swarm",
"log",
"rand 0.8.5",
@@ -4365,15 +4334,16 @@ dependencies = [
[[package]]
name = "libp2p-quic"
version = "0.7.0-alpha"
version = "0.7.0-alpha.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01e7c867e95c8130667b24409d236d37598270e6da69b3baf54213ba31ffca59"
checksum = "c6b26abd81cd2398382a1edfe739b539775be8a90fa6914f39b2ab49571ec735"
dependencies = [
"bytes",
"futures",
"futures-timer",
"if-watch",
"libp2p-core 0.38.0",
"libp2p-core",
"libp2p-identity",
"libp2p-tls",
"log",
"parking_lot 0.12.1",
@@ -4386,49 +4356,46 @@ dependencies = [
[[package]]
name = "libp2p-request-response"
version = "0.23.0"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3236168796727bfcf4927f766393415361e2c644b08bedb6a6b13d957c9a4884"
checksum = "7ffdb374267d42dc5ed5bc53f6e601d4a64ac5964779c6e40bb9e4f14c1e30d5"
dependencies = [
"async-trait",
"bytes",
"futures",
"instant",
"libp2p-core 0.38.0",
"libp2p-core",
"libp2p-identity",
"libp2p-swarm",
"log",
"rand 0.8.5",
"smallvec",
"unsigned-varint",
]
[[package]]
name = "libp2p-swarm"
version = "0.41.1"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2a35472fe3276b3855c00f1c032ea8413615e030256429ad5349cdf67c6e1a0"
checksum = "903b3d592d7694e56204d211f29d31bc004be99386644ba8731fc3e3ef27b296"
dependencies = [
"either",
"fnv",
"futures",
"futures-timer",
"instant",
"libp2p-core 0.38.0",
"libp2p-core",
"libp2p-identity",
"libp2p-swarm-derive",
"log",
"pin-project",
"rand 0.8.5",
"smallvec",
"thiserror",
"tokio",
"void",
]
[[package]]
name = "libp2p-swarm-derive"
version = "0.31.0"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d527d5827582abd44a6d80c07ff8b50b4ee238a8979e05998474179e79dc400"
checksum = "0fba456131824ab6acd4c7bf61e9c0f0a3014b5fc9868ccb8e10d344594cdc4f"
dependencies = [
"heck",
"quote",
@@ -4437,15 +4404,15 @@ dependencies = [
[[package]]
name = "libp2p-tcp"
version = "0.38.0"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4b257baf6df8f2df39678b86c578961d48cc8b68642a12f0f763f56c8e5858d"
checksum = "33d33698596d7722d85d3ab0c86c2c322254fce1241e91208e3679b4eb3026cf"
dependencies = [
"futures",
"futures-timer",
"if-watch",
"libc",
"libp2p-core 0.38.0",
"libp2p-core",
"log",
"socket2",
"tokio",
@@ -4459,7 +4426,7 @@ checksum = "ff08d13d0dc66e5e9ba6279c1de417b84fa0d0adc3b03e5732928c180ec02781"
dependencies = [
"futures",
"futures-rustls",
"libp2p-core 0.39.2",
"libp2p-core",
"libp2p-identity",
"rcgen 0.10.0",
"ring",
@@ -4472,13 +4439,13 @@ dependencies = [
[[package]]
name = "libp2p-wasm-ext"
version = "0.38.0"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bb1a35299860e0d4b3c02a3e74e3b293ad35ae0cee8a056363b0c862d082069"
checksum = "77dff9d32353a5887adb86c8afc1de1a94d9e8c3bc6df8b2201d7cdf5c848f43"
dependencies = [
"futures",
"js-sys",
"libp2p-core 0.38.0",
"libp2p-core",
"parity-send-wrapper",
"wasm-bindgen",
"wasm-bindgen-futures",
@@ -4486,9 +4453,9 @@ dependencies = [
[[package]]
name = "libp2p-webrtc"
version = "0.4.0-alpha"
version = "0.4.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb6cd86dd68cba72308ea05de1cebf3ba0ae6e187c40548167955d4e3970f6a"
checksum = "dba48592edbc2f60b4bc7c10d65445b0c3964c07df26fdf493b6880d33be36f8"
dependencies = [
"async-trait",
"asynchronous-codec",
@@ -4497,13 +4464,13 @@ dependencies = [
"futures-timer",
"hex",
"if-watch",
"libp2p-core 0.38.0",
"libp2p-core",
"libp2p-identity",
"libp2p-noise",
"log",
"multihash 0.16.3",
"prost",
"prost-build",
"prost-codec",
"multihash 0.17.0",
"quick-protobuf",
"quick-protobuf-codec",
"rand 0.8.5",
"rcgen 0.9.3",
"serde",
@@ -4517,14 +4484,14 @@ dependencies = [
[[package]]
name = "libp2p-websocket"
version = "0.40.0"
version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d705506030d5c0aaf2882437c70dab437605f21c5f9811978f694e6917a3b54"
checksum = "111273f7b3d3510524c752e8b7a5314b7f7a1fee7e68161c01a7d72cbb06db9f"
dependencies = [
"either",
"futures",
"futures-rustls",
"libp2p-core 0.38.0",
"libp2p-core",
"log",
"parking_lot 0.12.1",
"quicksink",
@@ -4536,14 +4503,13 @@ dependencies = [
[[package]]
name = "libp2p-yamux"
version = "0.42.0"
version = "0.43.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f63594a0aa818642d9d4915c791945053877253f08a3626f13416b5cd928a29"
checksum = "4dcd21d950662700a385d4c6d68e2f5f54d778e97068cdd718522222ef513bda"
dependencies = [
"futures",
"libp2p-core 0.38.0",
"libp2p-core",
"log",
"parking_lot 0.12.1",
"thiserror",
"yamux",
]
@@ -4728,6 +4694,15 @@ dependencies = [
"hashbrown 0.12.3",
]
[[package]]
name = "lru"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03f1160296536f10c833a82dca22267d5486734230d47bf00bf435885814ba1e"
dependencies = [
"hashbrown 0.13.2",
]
[[package]]
name = "lru-cache"
version = "0.1.2"
@@ -5001,24 +4976,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "multiaddr"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4aebdb21e90f81d13ed01dc84123320838e53963c2ca94b60b305d3fa64f31e"
dependencies = [
"arrayref",
"byteorder",
"data-encoding",
"multibase",
"multihash 0.16.3",
"percent-encoding",
"serde",
"static_assertions",
"unsigned-varint",
"url",
]
[[package]]
name = "multiaddr"
version = "0.17.1"
@@ -5073,7 +5030,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40"
dependencies = [
"core2",
"digest 0.10.6",
"multihash-derive",
"sha2 0.10.6",
"unsigned-varint",
]
@@ -8024,21 +7983,21 @@ dependencies = [
[[package]]
name = "prometheus-client"
version = "0.18.1"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c"
checksum = "5d6fa99d535dd930d1249e6c79cb3c2915f9172a540fe2b02a4c8f9ca954721e"
dependencies = [
"dtoa",
"itoa",
"parking_lot 0.12.1",
"prometheus-client-derive-text-encode",
"prometheus-client-derive-encode",
]
[[package]]
name = "prometheus-client-derive-text-encode"
version = "0.3.0"
name = "prometheus-client-derive-encode"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd"
checksum = "72b6a5217beb0ad503ee7fa752d451c905113d70721b937126158f3106a48cc1"
dependencies = [
"proc-macro2",
"quote",
@@ -8077,19 +8036,6 @@ dependencies = [
"which",
]
[[package]]
name = "prost-codec"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dc34979ff898b6e141106178981ce2596c387ea6e62533facfc61a37fc879c0"
dependencies = [
"asynchronous-codec",
"bytes",
"prost",
"thiserror",
"unsigned-varint",
]
[[package]]
name = "prost-derive"
version = "0.11.9"
@@ -8136,6 +8082,19 @@ dependencies = [
"byteorder",
]
[[package]]
name = "quick-protobuf-codec"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1693116345026436eb2f10b677806169c1a1260c1c60eaaffe3fb5a29ae23d8b"
dependencies = [
"asynchronous-codec",
"bytes",
"quick-protobuf",
"thiserror",
"unsigned-varint",
]
[[package]]
name = "quickcheck"
version = "1.0.3"
@@ -8754,6 +8713,7 @@ dependencies = [
"ip_network",
"libp2p",
"log",
"multihash 0.17.0",
"parity-scale-codec",
"prost",
"prost-build",
@@ -8853,7 +8813,7 @@ dependencies = [
"fdlimit",
"futures",
"futures-timer",
"libp2p",
"libp2p-identity",
"log",
"names",
"parity-scale-codec",
@@ -8954,7 +8914,7 @@ dependencies = [
"async-trait",
"futures",
"futures-timer",
"libp2p",
"libp2p-identity",
"log",
"mockall",
"parking_lot 0.12.1",
@@ -9320,7 +9280,7 @@ dependencies = [
"assert_matches",
"criterion",
"env_logger 0.9.3",
"lru",
"lru 0.8.1",
"num_cpus",
"parity-scale-codec",
"parking_lot 0.12.1",
@@ -9447,7 +9407,7 @@ dependencies = [
"libp2p",
"linked_hash_set",
"log",
"lru",
"lru 0.8.1",
"mockall",
"multistream-select",
"parity-scale-codec",
@@ -9491,7 +9451,7 @@ version = "0.10.0-dev"
dependencies = [
"cid",
"futures",
"libp2p",
"libp2p-identity",
"log",
"prost",
"prost-build",
@@ -9521,7 +9481,7 @@ dependencies = [
"bytes",
"futures",
"futures-timer",
"libp2p",
"libp2p-identity",
"parity-scale-codec",
"prost-build",
"sc-consensus",
@@ -9548,7 +9508,7 @@ dependencies = [
"futures-timer",
"libp2p",
"log",
"lru",
"lru 0.8.1",
"quickcheck",
"sc-network",
"sc-network-common",
@@ -9566,7 +9526,7 @@ version = "0.10.0-dev"
dependencies = [
"array-bytes 4.2.0",
"futures",
"libp2p",
"libp2p-identity",
"log",
"parity-scale-codec",
"prost",
@@ -9612,7 +9572,7 @@ dependencies = [
"futures-timer",
"libp2p",
"log",
"lru",
"lru 0.8.1",
"mockall",
"parity-scale-codec",
"prost",
@@ -9734,7 +9694,7 @@ name = "sc-peerset"
version = "4.0.0-dev"
dependencies = [
"futures",
"libp2p",
"libp2p-identity",
"log",
"rand 0.8.5",
"sc-utils",
@@ -10780,7 +10740,7 @@ version = "4.0.0-dev"
dependencies = [
"futures",
"log",
"lru",
"lru 0.8.1",
"parity-scale-codec",
"parking_lot 0.12.1",
"sp-api",