From 38353aeda258010c6d834520334e4d98ae557dd8 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Thu, 9 Nov 2023 03:35:49 +0200 Subject: [PATCH] Update libp2p to 0.53.0 --- Cargo.lock | 964 +++++++++++------- crates/pallet-subspace/Cargo.toml | 2 +- crates/sc-consensus-subspace-rpc/Cargo.toml | 2 +- crates/sc-consensus-subspace/Cargo.toml | 2 +- crates/sc-proof-of-time/Cargo.toml | 2 +- crates/sc-subspace-block-relay/Cargo.toml | 2 +- crates/sp-domains-fraud-proof/Cargo.toml | 2 +- crates/sp-lightclient/Cargo.toml | 2 +- crates/subspace-farmer-components/Cargo.toml | 4 +- crates/subspace-farmer/Cargo.toml | 4 +- crates/subspace-networking/Cargo.toml | 8 +- crates/subspace-networking/src/behavior.rs | 2 +- crates/subspace-networking/src/constructor.rs | 56 +- .../src/constructor/transport.rs | 9 +- crates/subspace-networking/src/node_runner.rs | 11 +- .../src/protocols/connected_peers.rs | 107 +- .../src/protocols/connected_peers/handler.rs | 51 +- .../src/protocols/connected_peers/tests.rs | 46 +- .../src/protocols/peer_info.rs | 19 +- .../src/protocols/peer_info/handler.rs | 73 +- .../request_response_factory.rs | 93 +- .../request_response_factory/tests.rs | 458 ++++----- .../src/protocols/reserved_peers.rs | 37 +- .../src/protocols/reserved_peers/handler.rs | 29 +- .../src/protocols/reserved_peers/tests.rs | 55 +- .../src/utils/unique_record_binary_heap.rs | 20 +- .../utils/unique_record_binary_heap/tests.rs | 26 +- crates/subspace-node/Cargo.toml | 2 +- crates/subspace-service/Cargo.toml | 4 +- .../cross-domain-message-gossip/Cargo.toml | 2 +- domains/client/domain-operator/Cargo.toml | 2 +- domains/client/eth-service/Cargo.toml | 2 +- domains/client/relayer/Cargo.toml | 2 +- domains/client/subnet-gossip/Cargo.toml | 2 +- domains/service/Cargo.toml | 2 +- shared/subspace-metrics/Cargo.toml | 2 +- test/subspace-test-client/Cargo.toml | 2 +- test/subspace-test-service/Cargo.toml | 2 +- 38 files changed, 1130 insertions(+), 980 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14b7760cfa..8709491d06 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,7 +40,7 @@ dependencies = [ "actix-service", "actix-utils", "ahash 0.8.3", - "base64 0.21.4", + "base64 0.21.5", "bitflags 2.4.0", "brotli", "bytes", @@ -75,7 +75,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -113,7 +113,7 @@ dependencies = [ "futures-core", "futures-util", "mio", - "socket2 0.5.4", + "socket2 0.5.5", "tokio", "tracing", ] @@ -174,7 +174,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "smallvec", - "socket2 0.5.4", + "socket2 0.5.5", "time", "url", ] @@ -188,7 +188,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -883,6 +883,32 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-channel", + "async-global-executor", + "async-io", + "async-lock", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite 0.2.13", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + [[package]] name = "async-task" version = "4.4.0" @@ -891,13 +917,13 @@ checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -913,6 +939,19 @@ dependencies = [ "pin-project-lite 0.2.13", ] +[[package]] +name = "asynchronous-codec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a860072022177f903e59730004fb5dc13db9275b79bb2aef7ba8ce831956c233" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite 0.2.13", +] + [[package]] name = "atomic" version = "0.5.3" @@ -934,6 +973,17 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" +[[package]] +name = "attohttpc" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" +dependencies = [ + "http", + "log", + "url", +] + [[package]] name = "atty" version = "0.2.14" @@ -1009,7 +1059,7 @@ dependencies = [ "rand_chacha 0.3.1", "rand_core 0.6.4", "ring 0.1.0", - "sha2 0.10.7", + "sha2 0.10.8", "zeroize", ] @@ -1045,9 +1095,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -1326,9 +1376,9 @@ checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -1583,7 +1633,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -2077,9 +2127,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.0" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622178105f911d937a42cdb140730ba4a3ed2becd8ae6ce39c7d28b5d75d4588" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ "cfg-if", "cpufeatures", @@ -2100,7 +2150,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -2127,7 +2177,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -2144,7 +2194,7 @@ checksum = "2fa16a70dd58129e4dfffdff535fb1bce66673f7bbeec4a5a1765a504e1ccd84" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -2435,7 +2485,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -2476,7 +2526,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.32", + "syn 2.0.39", "termcolor", "toml 0.7.8", "walkdir", @@ -2912,11 +2962,11 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek 4.1.0", + "curve25519-dalek 4.1.1", "ed25519 2.2.2", "rand_core 0.6.4", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "zeroize", ] @@ -3002,6 +3052,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "enum-as-inner" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "env_logger" version = "0.10.0" @@ -3285,7 +3347,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -3877,7 +3939,7 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -3889,7 +3951,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -3899,7 +3961,7 @@ source = "git+https://github.com/subspace/polkadot-sdk?rev=892bf8e938c6bd2b893d3 dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -3991,9 +4053,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -4004,11 +4066,20 @@ dependencies = [ "futures-util", ] +[[package]] +name = "futures-bounded" +version = "0.2.1" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" +dependencies = [ + "futures-timer", + "futures-util", +] + [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -4016,15 +4087,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -4034,9 +4105,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-lite" @@ -4055,13 +4126,13 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -4091,20 +4162,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35bd3cf68c183738046838e300353e4716c674dc5e56890de4826801a6622a28" dependencies = [ "futures-io", - "rustls 0.21.7", + "rustls 0.21.8", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-ticker" @@ -4129,9 +4200,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -4465,6 +4536,52 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b6e75c860d4216ac53f9ac88b25c99eaedba075b3a7b2ed31f2adc51a74fffd" +[[package]] +name = "hickory-proto" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "091a6fbccf4860009355e3efc52ff4acf37a63489aad7435372d44ceeb6fbbcf" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner 0.6.0", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand 0.8.5", + "socket2 0.5.5", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35b8f021164e6a984c9030023544c57789c51760065cd510572fedcfb04164e8" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot 0.12.1", + "rand 0.8.5", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "hkdf" version = "0.12.3" @@ -4614,7 +4731,7 @@ dependencies = [ "http", "hyper", "log", - "rustls 0.21.7", + "rustls 0.21.8", "rustls-native-certs", "tokio", "tokio-rustls", @@ -4683,9 +4800,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "3.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9465340214b296cd17a0009acdb890d6160010b8adf8f78a00d0d7ab270f79f" +checksum = "bbb892e5777fe09e16f3d44de7802f4daa7267ecbe8c466f19d94e25bb0c303e" dependencies = [ "async-io", "core-foundation", @@ -4698,7 +4815,26 @@ dependencies = [ "smol", "system-configuration", "tokio", - "windows 0.34.0", + "windows 0.51.1", +] + +[[package]] +name = "igd-next" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57e065e90a518ab5fedf79aa1e4b784e10f8e484a834f6bda85c42633a2cb7af" +dependencies = [ + "async-trait", + "attohttpc", + "bytes", + "futures", + "http", + "hyper", + "log", + "rand 0.8.5", + "tokio", + "url", + "xmltree", ] [[package]] @@ -4849,7 +4985,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2 0.5.4", + "socket2 0.5.5", "widestring", "windows-sys 0.48.0", "winreg", @@ -5083,7 +5219,7 @@ dependencies = [ "ecdsa 0.16.8", "elliptic-curve 0.13.5", "once_cell", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -5095,6 +5231,15 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "kvdb" version = "0.13.0" @@ -5120,7 +5265,7 @@ version = "0.1.0" source = "git+https://github.com/sifraitech/rust-kzg?rev=c34b73916af9b8a699a74bd0186f82f25e72861c#c34b73916af9b8a699a74bd0186f82f25e72861c" dependencies = [ "blst", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -5137,9 +5282,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libmimalloc-sys" @@ -5187,35 +5332,39 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.52.3" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.53.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "bytes", + "either", "futures", "futures-timer", "getrandom 0.2.10", "instant", - "libp2p-allow-block-list 0.2.0", + "libp2p-allow-block-list 0.3.0", "libp2p-autonat", - "libp2p-connection-limits 0.2.1", - "libp2p-core 0.40.0", - "libp2p-dns 0.40.0", + "libp2p-connection-limits 0.3.0", + "libp2p-core 0.41.1", + "libp2p-dns 0.41.0", "libp2p-gossipsub", - "libp2p-identify 0.43.0", - "libp2p-identity 0.2.3", - "libp2p-kad 0.44.4", - "libp2p-mdns 0.44.0", - "libp2p-metrics 0.13.1", - "libp2p-noise 0.43.1", - "libp2p-ping 0.43.0", + "libp2p-identify 0.44.0", + "libp2p-identity 0.2.7", + "libp2p-kad 0.45.0", + "libp2p-mdns 0.45.0", + "libp2p-metrics 0.14.0", + "libp2p-noise 0.44.0", + "libp2p-ping 0.44.0", "libp2p-plaintext", - "libp2p-quic 0.9.3", - "libp2p-request-response 0.25.1", - "libp2p-swarm 0.43.3", - "libp2p-tcp 0.40.0", - "libp2p-yamux 0.44.1", + "libp2p-quic 0.10.0", + "libp2p-request-response 0.26.0", + "libp2p-swarm 0.44.0", + "libp2p-tcp 0.41.0", + "libp2p-upnp", + "libp2p-yamux 0.45.0", "multiaddr 0.18.0", "pin-project", + "rw-stream-sink 0.4.0", + "thiserror", ] [[package]] @@ -5232,31 +5381,33 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" -version = "0.2.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.3.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-swarm 0.43.3", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-swarm 0.44.0", "void", ] [[package]] name = "libp2p-autonat" -version = "0.11.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.12.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "async-trait", + "asynchronous-codec 0.6.2", "futures", "futures-timer", "instant", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-request-response 0.25.1", - "libp2p-swarm 0.43.3", - "log", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-request-response 0.26.0", + "libp2p-swarm 0.44.0", "quick-protobuf", + "quick-protobuf-codec 0.2.0", "rand 0.8.5", + "tracing", ] [[package]] @@ -5273,12 +5424,12 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" -version = "0.2.1" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.3.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-swarm 0.43.3", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-swarm 0.44.0", "void", ] @@ -5312,16 +5463,15 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.40.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.41.1" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-identity 0.2.3", - "log", + "libp2p-identity 0.2.7", "multiaddr 0.18.0", "multihash 0.19.1", "multistream-select 0.13.0", @@ -5334,6 +5484,7 @@ dependencies = [ "serde", "smallvec", "thiserror", + "tracing", "unsigned-varint", "void", ] @@ -5354,25 +5505,26 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.40.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.41.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ + "async-trait", "futures", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "log", + "hickory-resolver", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", "parking_lot 0.12.1", "smallvec", - "trust-dns-resolver", + "tracing", ] [[package]] name = "libp2p-gossipsub" -version = "0.45.1" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.46.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ - "asynchronous-codec", - "base64 0.21.4", + "asynchronous-codec 0.6.2", + "base64 0.21.5", "byteorder", "bytes", "either", @@ -5382,18 +5534,18 @@ dependencies = [ "getrandom 0.2.10", "hex_fmt", "instant", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-swarm 0.43.3", - "log", - "prometheus-client 0.21.2", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-swarm 0.44.0", + "prometheus-client 0.22.0", "quick-protobuf", "quick-protobuf-codec 0.2.0", "rand 0.8.5", "regex", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "smallvec", + "tracing", "unsigned-varint", "void", ] @@ -5404,7 +5556,7 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5455f472243e63b9c497ff320ded0314254a9eb751799a39c283c6f20b793f3c" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.2", "either", "futures", "futures-timer", @@ -5422,22 +5574,23 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.43.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.44.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.2", "either", "futures", + "futures-bounded", "futures-timer", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-swarm 0.43.3", - "log", - "lru 0.11.1", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-swarm 0.44.0", + "lru 0.12.0", "quick-protobuf", "quick-protobuf-codec 0.2.0", "smallvec", "thiserror", + "tracing", "void", ] @@ -5454,25 +5607,26 @@ dependencies = [ "multihash 0.17.0", "quick-protobuf", "rand 0.8.5", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", "zeroize", ] [[package]] name = "libp2p-identity" -version = "0.2.3" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686e73aff5e23efbb99bc85340ea6fd8686986aa7b283a881ba182cfca535ca9" +checksum = "cdd6317441f361babc74c2989c6484eb0726045399b6648de039e1805ea96972" dependencies = [ "bs58 0.5.0", "ed25519-dalek 2.0.0", + "hkdf", "log", "multihash 0.19.1", "quick-protobuf", "rand 0.8.5", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", "zeroize", ] @@ -5484,7 +5638,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39d5ef876a2b2323d63c258e63c2f8e36f205fe5a11f0b3095d59635650790ff" dependencies = [ "arrayvec 0.7.4", - "asynchronous-codec", + "asynchronous-codec 0.6.2", "bytes", "either", "fnv", @@ -5497,7 +5651,7 @@ dependencies = [ "log", "quick-protobuf", "rand 0.8.5", - "sha2 0.10.7", + "sha2 0.10.8", "smallvec", "thiserror", "uint", @@ -5507,27 +5661,28 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.44.4" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.45.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "arrayvec 0.7.4", - "asynchronous-codec", + "asynchronous-codec 0.6.2", "bytes", "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-swarm 0.43.3", - "log", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-swarm 0.44.0", "quick-protobuf", + "quick-protobuf-codec 0.2.0", "rand 0.8.5", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "smallvec", "thiserror", + "tracing", "uint", "unsigned-varint", "void", @@ -5556,21 +5711,21 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.44.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.45.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "data-encoding", "futures", + "hickory-proto", "if-watch", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-swarm 0.43.3", - "log", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-swarm 0.44.0", "rand 0.8.5", "smallvec", - "socket2 0.5.4", + "socket2 0.5.5", "tokio", - "trust-dns-proto", + "tracing", "void", ] @@ -5590,19 +5745,18 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.13.1" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.14.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "instant", - "libp2p-core 0.40.0", + "libp2p-core 0.41.1", "libp2p-gossipsub", - "libp2p-identify 0.43.0", - "libp2p-identity 0.2.3", - "libp2p-kad 0.44.4", - "libp2p-ping 0.43.0", - "libp2p-swarm 0.43.3", - "once_cell", - "prometheus-client 0.21.2", + "libp2p-identify 0.44.0", + "libp2p-identity 0.2.7", + "libp2p-kad 0.45.0", + "libp2p-ping 0.44.0", + "libp2p-swarm 0.44.0", + "prometheus-client 0.22.0", ] [[package]] @@ -5620,7 +5774,7 @@ dependencies = [ "once_cell", "quick-protobuf", "rand 0.8.5", - "sha2 0.10.7", + "sha2 0.10.8", "snow", "static_assertions", "thiserror", @@ -5630,25 +5784,26 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.43.1" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.44.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ + "asynchronous-codec 0.7.0", "bytes", - "curve25519-dalek 4.1.0", + "curve25519-dalek 4.1.1", "futures", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "log", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", "multiaddr 0.18.0", "multihash 0.19.1", "once_cell", "quick-protobuf", "rand 0.8.5", - "sha2 0.10.7", + "sha2 0.10.8", "snow", "static_assertions", "thiserror", - "x25519-dalek 1.1.1", + "tracing", + "x25519-dalek 2.0.0", "zeroize", ] @@ -5671,34 +5826,34 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.43.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.44.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "either", "futures", "futures-timer", "instant", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-swarm 0.43.3", - "log", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-swarm 0.44.0", "rand 0.8.5", + "tracing", "void", ] [[package]] name = "libp2p-plaintext" -version = "0.40.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.41.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.2", "bytes", "futures", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "log", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", "quick-protobuf", - "unsigned-varint", + "quick-protobuf-codec 0.2.0", + "tracing", ] [[package]] @@ -5725,24 +5880,25 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.9.3" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.10.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "bytes", "futures", "futures-timer", "if-watch", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-tls 0.2.1", - "log", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-tls 0.3.0", "parking_lot 0.12.1", "quinn", "rand 0.8.5", - "rustls 0.21.7", - "socket2 0.5.4", + "ring 0.16.20", + "rustls 0.21.8", + "socket2 0.5.5", "thiserror", "tokio", + "tracing", ] [[package]] @@ -5763,18 +5919,20 @@ dependencies = [ [[package]] name = "libp2p-request-response" -version = "0.25.1" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.26.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "async-trait", "futures", + "futures-bounded", + "futures-timer", "instant", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-swarm 0.43.3", - "log", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-swarm 0.44.0", "rand 0.8.5", "smallvec", + "tracing", "void", ] @@ -5801,23 +5959,24 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.43.3" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.44.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ + "async-std", "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "libp2p-swarm-derive 0.33.0", - "log", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "libp2p-swarm-derive 0.34.0", "multistream-select 0.13.0", "once_cell", "rand 0.8.5", "smallvec", "tokio", + "tracing", "void", ] @@ -5834,32 +5993,31 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.33.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.34.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "heck", - "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] name = "libp2p-swarm-test" -version = "0.2.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.3.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "async-trait", "futures", "futures-timer", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", "libp2p-plaintext", - "libp2p-swarm 0.43.3", - "libp2p-tcp 0.40.0", - "libp2p-yamux 0.44.1", - "log", + "libp2p-swarm 0.44.0", + "libp2p-tcp 0.41.0", + "libp2p-yamux 0.45.0", "rand 0.8.5", + "tracing", ] [[package]] @@ -5880,19 +6038,19 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.40.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.41.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "async-io", "futures", "futures-timer", "if-watch", "libc", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "log", - "socket2 0.5.4", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "socket2 0.5.5", "tokio", + "tracing", ] [[package]] @@ -5916,22 +6074,37 @@ dependencies = [ [[package]] name = "libp2p-tls" -version = "0.2.1" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.3.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "futures", "futures-rustls 0.24.0", - "libp2p-core 0.40.0", - "libp2p-identity 0.2.3", - "rcgen 0.10.0", + "libp2p-core 0.41.1", + "libp2p-identity 0.2.7", + "rcgen 0.11.3", "ring 0.16.20", - "rustls 0.21.7", - "rustls-webpki 0.101.5", + "rustls 0.21.8", + "rustls-webpki 0.101.7", "thiserror", "x509-parser 0.15.1", "yasna", ] +[[package]] +name = "libp2p-upnp" +version = "0.2.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" +dependencies = [ + "futures", + "futures-timer", + "igd-next", + "libp2p-core 0.41.1", + "libp2p-swarm 0.44.0", + "tokio", + "tracing", + "void", +] + [[package]] name = "libp2p-wasm-ext" version = "0.39.0" @@ -5953,7 +6126,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dba48592edbc2f60b4bc7c10d65445b0c3964c07df26fdf493b6880d33be36f8" dependencies = [ "async-trait", - "asynchronous-codec", + "asynchronous-codec 0.6.2", "bytes", "futures", "futures-timer", @@ -6011,13 +6184,13 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.44.1" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +version = "0.45.0" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "futures", - "libp2p-core 0.40.0", - "log", + "libp2p-core 0.41.1", "thiserror", + "tracing", "yamux 0.12.0", ] @@ -6164,6 +6337,9 @@ name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +dependencies = [ + "value-bag", +] [[package]] name = "lru" @@ -6183,6 +6359,15 @@ dependencies = [ "hashbrown 0.14.0", ] +[[package]] +name = "lru" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efa59af2ddfad1854ae27d75009d538d0998b4b2fd47083e743ac1a10e46c60" +dependencies = [ + "hashbrown 0.14.0", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -6230,7 +6415,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -6244,7 +6429,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -6255,7 +6440,7 @@ checksum = "c12469fc165526520dff2807c2975310ab47cf7190a45b99b49a7dc8befab17b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -6266,7 +6451,7 @@ checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -6508,7 +6693,7 @@ dependencies = [ "arrayref", "byteorder", "data-encoding", - "libp2p-identity 0.2.3", + "libp2p-identity 0.2.7", "multibase", "multihash 0.19.1", "percent-encoding", @@ -6541,7 +6726,7 @@ dependencies = [ "core2", "digest 0.10.7", "multihash-derive", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "unsigned-varint", ] @@ -6594,13 +6779,13 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.13.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "bytes", "futures", - "log", "pin-project", "smallvec", + "tracing", "unsigned-varint", ] @@ -6865,7 +7050,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -6977,7 +7162,7 @@ checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" dependencies = [ "ecdsa 0.14.8", "elliptic-curve 0.12.3", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -6988,7 +7173,7 @@ checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" dependencies = [ "ecdsa 0.14.8", "elliptic-curve 0.12.3", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -7647,6 +7832,16 @@ dependencies = [ "base64 0.13.1", ] +[[package]] +name = "pem" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3163d2912b7c3b52d651a055f2c7eec9ba5cd22d26ef75b8dd3a59980b185923" +dependencies = [ + "base64 0.21.5", + "serde", +] + [[package]] name = "pem-rfc7468" version = "0.6.0" @@ -7693,7 +7888,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -7704,7 +7899,7 @@ checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" dependencies = [ "once_cell", "pest", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -7734,7 +7929,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -7974,14 +8169,14 @@ checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -8014,9 +8209,9 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c99afa9a01501019ac3a14d71d9f94050346f55ca471ce90c799a15c58f61e2" +checksum = "510c4f1c9d81d556458f94c98f857748130ea9737bbd6053da497503b26ea63c" dependencies = [ "dtoa", "itoa", @@ -8032,7 +8227,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -8119,7 +8314,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1693116345026436eb2f10b677806169c1a1260c1c60eaaffe3fb5a29ae23d8b" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.2", "bytes", "quick-protobuf", "thiserror", @@ -8129,9 +8324,9 @@ dependencies = [ [[package]] name = "quick-protobuf-codec" version = "0.2.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.2", "bytes", "quick-protobuf", "thiserror", @@ -8161,7 +8356,7 @@ dependencies = [ "quinn-proto 0.10.6", "quinn-udp", "rustc-hash", - "rustls 0.21.7", + "rustls 0.21.8", "thiserror", "tokio", "tracing", @@ -8195,7 +8390,7 @@ dependencies = [ "rand 0.8.5", "ring 0.16.20", "rustc-hash", - "rustls 0.21.7", + "rustls 0.21.8", "slab", "thiserror", "tinyvec", @@ -8210,7 +8405,7 @@ checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" dependencies = [ "bytes", "libc", - "socket2 0.5.4", + "socket2 0.5.5", "tracing", "windows-sys 0.48.0", ] @@ -8342,7 +8537,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" dependencies = [ - "pem", + "pem 1.1.1", "ring 0.16.20", "time", "x509-parser 0.13.2", @@ -8355,7 +8550,19 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ - "pem", + "pem 1.1.1", + "ring 0.16.20", + "time", + "yasna", +] + +[[package]] +name = "rcgen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c4f3084aa3bc7dfbba4eff4fab2a54db4324965d8872ab933565e6fbd83bc6" +dependencies = [ + "pem 3.0.2", "ring 0.16.20", "time", "yasna", @@ -8407,7 +8614,7 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -8424,14 +8631,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.5" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.8", - "regex-syntax 0.7.5", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -8445,13 +8652,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.8" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.5", + "regex-syntax 0.8.2", ] [[package]] @@ -8462,9 +8669,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "resolv-conf" @@ -8523,11 +8730,25 @@ dependencies = [ "libc", "once_cell", "spin 0.5.2", - "untrusted", + "untrusted 0.7.1", "web-sys", "winapi", ] +[[package]] +name = "ring" +version = "0.17.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +dependencies = [ + "cc", + "getrandom 0.2.10", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.48.0", +] + [[package]] name = "ripemd" version = "0.1.3" @@ -8576,7 +8797,7 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05225752ca6ede4cb1b73aa37ce3904affd042e98f28246f56f438ebfd47a810" dependencies = [ - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -8750,13 +8971,13 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", - "ring 0.16.20", - "rustls-webpki 0.101.5", + "ring 0.17.5", + "rustls-webpki 0.101.7", "sct 0.7.0", ] @@ -8778,7 +8999,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", ] [[package]] @@ -8788,17 +9009,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f6a5fc258f1c1276dfe3016516945546e2d5383911efc0fc4f1cdc5df3a4ae3" dependencies = [ "ring 0.16.20", - "untrusted", + "untrusted 0.7.1", ] [[package]] name = "rustls-webpki" -version = "0.101.5" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a27e3b59326c16e23d30aeb7a36a24cc0d29e71d68ff611cdfb4a01d013bed" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.16.20", - "untrusted", + "ring 0.17.5", + "untrusted 0.9.0", ] [[package]] @@ -8821,7 +9042,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.4.0" -source = "git+https://github.com/subspace/rust-libp2p?rev=7a9328fc0a5f9e28575192d5f4f8663fde6752af#7a9328fc0a5f9e28575192d5f4f8663fde6752af" +source = "git+https://github.com/subspace/rust-libp2p?rev=64f3baf300f68a861acf9de644fe980529c5618a#64f3baf300f68a861acf9de644fe980529c5618a" dependencies = [ "futures", "pin-project", @@ -8928,7 +9149,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -9259,7 +9480,7 @@ dependencies = [ "array-bytes", "async-channel", "async-trait", - "asynchronous-codec", + "asynchronous-codec 0.6.2", "atomic", "bytes", "either", @@ -9786,7 +10007,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -9929,7 +10150,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" dependencies = [ "ring 0.16.20", - "untrusted", + "untrusted 0.7.1", ] [[package]] @@ -9939,7 +10160,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ "ring 0.16.20", - "untrusted", + "untrusted 0.7.1", ] [[package]] @@ -10094,7 +10315,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -10180,9 +10401,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -10283,9 +10504,9 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "smol" @@ -10319,11 +10540,11 @@ dependencies = [ "aes-gcm 0.9.4", "blake2", "chacha20poly1305", - "curve25519-dalek 4.1.0", + "curve25519-dalek 4.1.1", "rand_core 0.6.4", "ring 0.16.20", "rustc_version", - "sha2 0.10.7", + "sha2 0.10.8", "subtle", ] @@ -10339,9 +10560,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -10396,7 +10617,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -10616,7 +10837,7 @@ dependencies = [ "blake2b_simd", "byteorder", "digest 0.10.7", - "sha2 0.10.7", + "sha2 0.10.8", "sha3", "twox-hash", ] @@ -10628,7 +10849,7 @@ source = "git+https://github.com/subspace/polkadot-sdk?rev=892bf8e938c6bd2b893d3 dependencies = [ "quote", "sp-core-hashing", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -10647,7 +10868,7 @@ source = "git+https://github.com/subspace/polkadot-sdk?rev=892bf8e938c6bd2b893d3 dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -10950,7 +11171,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -11009,13 +11230,13 @@ version = "4.0.0-dev" source = "git+https://github.com/subspace/polkadot-sdk?rev=892bf8e938c6bd2b893d3827d1093cd81baa59a1#892bf8e938c6bd2b893d3827d1093cd81baa59a1" dependencies = [ "aes-gcm 0.10.2", - "curve25519-dalek 4.1.0", + "curve25519-dalek 4.1.1", "ed25519-dalek 2.0.0", "hkdf", "parity-scale-codec", "rand 0.8.5", "scale-info", - "sha2 0.10.7", + "sha2 0.10.8", "sp-api", "sp-application-crypto", "sp-core", @@ -11142,7 +11363,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -11301,7 +11522,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -11406,7 +11627,7 @@ dependencies = [ "mimalloc", "parity-scale-codec", "parking_lot 0.12.1", - "prometheus-client 0.21.2", + "prometheus-client 0.22.0", "rand 0.8.5", "rayon", "schnorrkel", @@ -11471,7 +11692,7 @@ dependencies = [ "actix-web", "parking_lot 0.12.1", "prometheus", - "prometheus-client 0.21.2", + "prometheus-client 0.22.0", "tracing", ] @@ -11492,7 +11713,7 @@ dependencies = [ "futures", "futures-timer", "hex", - "libp2p 0.52.3", + "libp2p 0.53.0", "libp2p-swarm-test", "lru 0.11.1", "memmap2 0.7.1", @@ -11500,7 +11721,7 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "pin-project", - "prometheus-client 0.21.2", + "prometheus-client 0.22.0", "rand 0.8.5", "serde", "serde_json", @@ -11584,7 +11805,7 @@ dependencies = [ "rand 0.8.5", "rayon", "seq-macro", - "sha2 0.10.7", + "sha2 0.10.8", "subspace-chiapos", "subspace-core-primitives", ] @@ -11695,7 +11916,7 @@ dependencies = [ "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "parking_lot 0.12.1", - "prometheus-client 0.21.2", + "prometheus-client 0.22.0", "sc-basic-authorship", "sc-chain-spec", "sc-client-api", @@ -12079,9 +12300,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.32" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -12163,22 +12384,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -12246,7 +12467,7 @@ dependencies = [ "pbkdf2 0.11.0", "rand 0.8.5", "rustc-hash", - "sha2 0.10.7", + "sha2 0.10.8", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -12289,9 +12510,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes", @@ -12301,7 +12522,7 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite 0.2.13", "signal-hook-registry", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] @@ -12314,7 +12535,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -12323,7 +12544,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.7", + "rustls 0.21.8", "tokio", ] @@ -12459,7 +12680,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] @@ -12585,7 +12806,7 @@ dependencies = [ "async-trait", "cfg-if", "data-encoding", - "enum-as-inner", + "enum-as-inner 0.5.1", "futures-channel", "futures-io", "futures-util", @@ -12661,7 +12882,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", "digest 0.10.7", - "rand 0.7.3", + "rand 0.8.5", "static_assertions", ] @@ -12758,7 +12979,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.2", "bytes", "futures-io", "futures-util", @@ -12770,6 +12991,12 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.4.1" @@ -12802,6 +13029,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "value-bag" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a72e1902dde2bd6441347de2b70b7f5d59bf157c6c62f0c44572607a1d55bbe" + [[package]] name = "vcpkg" version = "0.2.15" @@ -12887,7 +13120,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -12921,7 +13154,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -13050,14 +13283,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c86437fa68626fe896e5afc69234bb2b5894949083586535f200385adfd71213" dependencies = [ "anyhow", - "base64 0.21.4", + "base64 0.21.5", "bincode", "directories-next", "file-per-thread-logger", "log", "rustix 0.36.15", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "toml 0.5.11", "windows-sys 0.45.0", "zstd 0.11.2+zstd.1.5.2", @@ -13218,7 +13451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" dependencies = [ "ring 0.16.20", - "untrusted", + "untrusted 0.7.1", ] [[package]] @@ -13228,7 +13461,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e" dependencies = [ "ring 0.16.20", - "untrusted", + "untrusted 0.7.1", ] [[package]] @@ -13278,7 +13511,7 @@ dependencies = [ "sdp", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "stun", "thiserror", "time", @@ -13340,7 +13573,7 @@ dependencies = [ "sec1 0.3.0", "serde", "sha1", - "sha2 0.10.7", + "sha2 0.10.8", "signature 1.6.4", "subtle", "thiserror", @@ -13524,22 +13757,28 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.34.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45296b64204227616fdbf2614cefa4c236b98ee64dfaaaa435207ed99fe7829f" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows_aarch64_msvc 0.34.0", - "windows_i686_gnu 0.34.0", - "windows_i686_msvc 0.34.0", - "windows_x86_64_gnu 0.34.0", - "windows_x86_64_msvc 0.34.0", + "windows-targets 0.48.5", ] [[package]] name = "windows" -version = "0.48.0" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" +dependencies = [ + "windows-core", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ "windows-targets 0.48.5", ] @@ -13604,12 +13843,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" -[[package]] -name = "windows_aarch64_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -13622,12 +13855,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" -[[package]] -name = "windows_i686_gnu" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" - [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -13640,12 +13867,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" -[[package]] -name = "windows_i686_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" - [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -13658,12 +13879,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" -[[package]] -name = "windows_x86_64_gnu" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -13688,12 +13903,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" -[[package]] -name = "windows_x86_64_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -13751,7 +13960,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 4.1.0", + "curve25519-dalek 4.1.1", "rand_core 0.6.4", "serde", "zeroize", @@ -13811,6 +14020,21 @@ dependencies = [ "time", ] +[[package]] +name = "xml-rs" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" + +[[package]] +name = "xmltree" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d8a75eaf6557bb84a65ace8609883db44a29951042ada9b393151532e41fcb" +dependencies = [ + "xml-rs", +] + [[package]] name = "yamux" version = "0.10.2" @@ -13866,7 +14090,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.39", ] [[package]] diff --git a/crates/pallet-subspace/Cargo.toml b/crates/pallet-subspace/Cargo.toml index d0e6a36e81..f516da212a 100644 --- a/crates/pallet-subspace/Cargo.toml +++ b/crates/pallet-subspace/Cargo.toml @@ -32,7 +32,7 @@ subspace-verification = { version = "0.1.0", path = "../subspace-verification", [dev-dependencies] env_logger = "0.10.0" -futures = "0.3.28" +futures = "0.3.29" pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } pallet-offences-subspace = { version = "0.1.0", path = "../pallet-offences-subspace" } rand = { version = "0.8.5", features = ["min_const_gen"] } diff --git a/crates/sc-consensus-subspace-rpc/Cargo.toml b/crates/sc-consensus-subspace-rpc/Cargo.toml index 0aaf6e8da8..4e2810305b 100644 --- a/crates/sc-consensus-subspace-rpc/Cargo.toml +++ b/crates/sc-consensus-subspace-rpc/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] async-oneshot = "0.5.0" -futures = "0.3.28" +futures = "0.3.29" futures-timer = "3.0.2" jsonrpsee = { version = "0.16.3", features = ["server", "macros"] } lru = "0.11.0" diff --git a/crates/sc-consensus-subspace/Cargo.toml b/crates/sc-consensus-subspace/Cargo.toml index bd4286089a..0ed40ecee8 100644 --- a/crates/sc-consensus-subspace/Cargo.toml +++ b/crates/sc-consensus-subspace/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] async-trait = "0.1.73" codec = { package = "parity-scale-codec", version = "3.6.5", features = ["derive"] } -futures = "0.3.28" +futures = "0.3.29" log = "0.4.20" lru = "0.11.0" parking_lot = "0.12.1" diff --git a/crates/sc-proof-of-time/Cargo.toml b/crates/sc-proof-of-time/Cargo.toml index 584a31f9d1..8fbcf082e0 100644 --- a/crates/sc-proof-of-time/Cargo.toml +++ b/crates/sc-proof-of-time/Cargo.toml @@ -14,7 +14,7 @@ include = [ atomic = "0.5.3" core_affinity = "0.8.1" derive_more = "0.99.17" -futures = "0.3.28" +futures = "0.3.29" lru = "0.11.0" parity-scale-codec = { version = "3.6.1", features = ["derive"] } sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } diff --git a/crates/sc-subspace-block-relay/Cargo.toml b/crates/sc-subspace-block-relay/Cargo.toml index dc56e08b23..9918b82230 100644 --- a/crates/sc-subspace-block-relay/Cargo.toml +++ b/crates/sc-subspace-block-relay/Cargo.toml @@ -15,7 +15,7 @@ async-channel = "1.9.0" async-trait = "0.1.73" codec = { package = "parity-scale-codec", version = "3.6.5", default-features = false, features = ["derive"] } derive_more = "0.99.17" -futures = "0.3.28" +futures = "0.3.29" parking_lot = "0.12.1" sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } diff --git a/crates/sp-domains-fraud-proof/Cargo.toml b/crates/sp-domains-fraud-proof/Cargo.toml index caf77bf6f4..b947395e04 100644 --- a/crates/sp-domains-fraud-proof/Cargo.toml +++ b/crates/sp-domains-fraud-proof/Cargo.toml @@ -40,7 +40,7 @@ thiserror = { version = "1.0.48", optional = true } domain-block-builder = { version = "0.1.0", path = "../../domains/client/block-builder" } domain-block-preprocessor = { version = "0.1.0", path = "../../domains/client/block-preprocessor" } domain-test-service = { version = "0.1.0", path = "../../domains/test/service" } -futures = "0.3.28" +futures = "0.3.29" pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } sc-cli = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1", default-features = false } sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1", default-features = false } diff --git a/crates/sp-lightclient/Cargo.toml b/crates/sp-lightclient/Cargo.toml index d5f42492da..89a82579c8 100644 --- a/crates/sp-lightclient/Cargo.toml +++ b/crates/sp-lightclient/Cargo.toml @@ -30,7 +30,7 @@ subspace-verification = { version = "0.1.0", path = "../subspace-verification", [dev-dependencies] frame-support = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } -futures = "0.3.28" +futures = "0.3.29" rand = { version = "0.8.5", features = ["min_const_gen"] } sp-io = { version = "23.0.0", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } subspace-archiving = { version = "0.1.0", path = "../subspace-archiving"} diff --git a/crates/subspace-farmer-components/Cargo.toml b/crates/subspace-farmer-components/Cargo.toml index 64645a2292..c44a7be73f 100644 --- a/crates/subspace-farmer-components/Cargo.toml +++ b/crates/subspace-farmer-components/Cargo.toml @@ -21,7 +21,7 @@ async-trait = "0.1.73" backoff = { version = "0.4.0", features = ["futures", "tokio"] } bitvec = "1.0.1" fs2 = "0.4.3" -futures = "0.3.28" +futures = "0.3.29" hex = "0.4.3" libc = "0.2.146" parity-scale-codec = "3.6.5" @@ -44,7 +44,7 @@ winapi = "0.3.9" [dev-dependencies] criterion = "0.5.1" -futures = "0.3.28" +futures = "0.3.29" parking_lot = "0.12.1" subspace-archiving = { version = "0.1.0", path = "../subspace-archiving" } subspace-proof-of-space = { version = "0.1.0", path = "../subspace-proof-of-space" } diff --git a/crates/subspace-farmer/Cargo.toml b/crates/subspace-farmer/Cargo.toml index 1a8374b1b5..1aa98a3398 100644 --- a/crates/subspace-farmer/Cargo.toml +++ b/crates/subspace-farmer/Cargo.toml @@ -25,14 +25,14 @@ criterion = { version = "0.5.1", default-features = false, features = ["rayon", derive_more = "0.99.17" event-listener-primitives = "2.0.1" fdlimit = "0.2" -futures = "0.3.28" +futures = "0.3.29" hex = { version = "0.4.3", features = ["serde"] } jsonrpsee = { version = "0.16.3", features = ["client"] } lru = "0.11.0" mimalloc = "0.1.39" parity-scale-codec = "3.6.5" parking_lot = "0.12.1" -prometheus-client = "0.21.2" +prometheus-client = "0.22.0" rand = "0.8.5" rayon = "1.8.0" schnorrkel = "0.9.1" diff --git a/crates/subspace-networking/Cargo.toml b/crates/subspace-networking/Cargo.toml index 21fdcda8ab..128a39bf45 100644 --- a/crates/subspace-networking/Cargo.toml +++ b/crates/subspace-networking/Cargo.toml @@ -26,7 +26,7 @@ derive_more = "0.99.17" either = "1.8.1" event-listener-primitives = "2.0.1" fs2 = "0.4.3" -futures = "0.3.28" +futures = "0.3.29" futures-timer = "3.0.2" hex = "0.4.3" lru = "0.11.0" @@ -35,7 +35,7 @@ nohash-hasher = "0.2.0" parity-scale-codec = "3.6.5" parking_lot = "0.12.1" pin-project = "1.1.3" -prometheus-client = "0.21.2" +prometheus-client = "0.22.0" rand = "0.8.5" serde = { version = "1.0.183", features = ["derive"] } serde_json = "1.0.106" @@ -50,7 +50,7 @@ void = "1.0.2" [dependencies.libp2p] git = "https://github.com/subspace/rust-libp2p" -rev = "7a9328fc0a5f9e28575192d5f4f8663fde6752af" +rev = "64f3baf300f68a861acf9de644fe980529c5618a" default-features = false features = [ "autonat", @@ -73,4 +73,4 @@ features = [ [dev-dependencies] rand = "0.8.5" -libp2p-swarm-test = { git = "https://github.com/subspace/rust-libp2p", rev = "7a9328fc0a5f9e28575192d5f4f8663fde6752af" } +libp2p-swarm-test = { git = "https://github.com/subspace/rust-libp2p", rev = "64f3baf300f68a861acf9de644fe980529c5618a" } diff --git a/crates/subspace-networking/src/behavior.rs b/crates/subspace-networking/src/behavior.rs index 20d87321f3..aeae2315fb 100644 --- a/crates/subspace-networking/src/behavior.rs +++ b/crates/subspace-networking/src/behavior.rs @@ -24,7 +24,7 @@ use libp2p::gossipsub::{ Behaviour as Gossipsub, Config as GossipsubConfig, Event as GossipsubEvent, MessageAuthenticity, }; use libp2p::identify::{Behaviour as Identify, Config as IdentifyConfig, Event as IdentifyEvent}; -use libp2p::kad::{Kademlia, KademliaConfig, KademliaEvent}; +use libp2p::kad::{Behaviour as Kademlia, Config as KademliaConfig, Event as KademliaEvent}; use libp2p::ping::{Behaviour as Ping, Event as PingEvent}; use libp2p::swarm::behaviour::toggle::Toggle; use libp2p::swarm::NetworkBehaviour; diff --git a/crates/subspace-networking/src/constructor.rs b/crates/subspace-networking/src/constructor.rs index 777f50f3dd..367b4ed10e 100644 --- a/crates/subspace-networking/src/constructor.rs +++ b/crates/subspace-networking/src/constructor.rs @@ -28,14 +28,13 @@ use libp2p::gossipsub::{ use libp2p::identify::Config as IdentifyConfig; use libp2p::kad::store::RecordStore; use libp2p::kad::{ - store, KademliaBucketInserts, KademliaConfig, KademliaStoreInserts, Mode, ProviderRecord, - Record, RecordKey, + store, BucketInserts, Config as KademliaConfig, Mode, ProviderRecord, Record, RecordKey, + StoreInserts, }; use libp2p::metrics::Metrics; use libp2p::multiaddr::Protocol; -use libp2p::swarm::SwarmBuilder; use libp2p::yamux::Config as YamuxConfig; -use libp2p::{identity, Multiaddr, PeerId, StreamProtocol, TransportError}; +use libp2p::{identity, Multiaddr, PeerId, StreamProtocol, SwarmBuilder, TransportError}; use parking_lot::Mutex; use std::borrow::Cow; use std::iter::Empty; @@ -61,6 +60,8 @@ const SPECIAL_CONNECTED_PEERS_PROTOCOL_LOG_TARGET: &str = "special-connected-pee /// Defines max_negotiating_inbound_streams constant for the swarm. /// It must be set for large plots. const SWARM_MAX_NEGOTIATING_INBOUND_STREAMS: usize = 100000; +/// How long will connection be allowed to be open without any usage +const IDLE_CONNECTION_TIMEOUT: Duration = Duration::from_secs(10); /// The default maximum established incoming connection number for the swarm. const SWARM_MAX_ESTABLISHED_INCOMING_CONNECTIONS: u32 = 100; /// The default maximum established incoming connection number for the swarm. @@ -306,8 +307,8 @@ where .expect("Manual protocol name creation.")]) .disjoint_query_paths(true) .set_max_packet_size(2 * Piece::SIZE) - .set_kbucket_inserts(KademliaBucketInserts::Manual) - .set_record_filtering(KademliaStoreInserts::FilterBoth) + .set_kbucket_inserts(BucketInserts::Manual) + .set_record_filtering(StoreInserts::FilterBoth) // We don't use records and providers publication. .set_provider_record_ttl(None) .set_provider_publication_interval(None) @@ -397,6 +398,11 @@ pub enum CreationError { /// I/O error. #[error("I/O error: {0}")] Io(#[from] io::Error), + /// Transport creation error. + #[error("Transport creation error: {0}")] + // TODO: Restore `#[from] TransportError` once https://github.com/libp2p/rust-libp2p/issues/4824 + // is resolved + TransportCreationError(Box), /// Transport error when attempting to listen on multiaddr. #[error("Transport error when attempting to listen on multiaddr: {0}")] TransportError(#[from] TransportError), @@ -453,18 +459,6 @@ where } = config; let local_peer_id = peer_id(&keypair); - let temporary_bans = Arc::new(Mutex::new(TemporaryBans::new( - temporary_bans_cache_size, - temporary_ban_backoff, - ))); - let transport = build_transport( - allow_non_global_addresses_in_dht, - &keypair, - Arc::clone(&temporary_bans), - timeout, - yamux_config, - )?; - info!( %allow_non_global_addresses_in_dht, peer_id = %local_peer_id, @@ -521,8 +515,30 @@ where }), }); - let mut swarm = SwarmBuilder::with_tokio_executor(transport, behaviour, local_peer_id) - .max_negotiating_inbound_streams(SWARM_MAX_NEGOTIATING_INBOUND_STREAMS) + let temporary_bans = Arc::new(Mutex::new(TemporaryBans::new( + temporary_bans_cache_size, + temporary_ban_backoff, + ))); + + let mut swarm = SwarmBuilder::with_existing_identity(keypair) + .with_tokio() + .with_other_transport(|keypair| { + Ok(build_transport( + allow_non_global_addresses_in_dht, + keypair, + Arc::clone(&temporary_bans), + timeout, + yamux_config, + )?) + }) + .map_err(|error| CreationError::TransportCreationError(error.into()))? + .with_behaviour(move |_keypair| Ok(behaviour)) + .expect("Not fallible; qed") + .with_swarm_config(|config| { + config + .with_max_negotiating_inbound_streams(SWARM_MAX_NEGOTIATING_INBOUND_STREAMS) + .with_idle_connection_timeout(IDLE_CONNECTION_TIMEOUT) + }) .build(); // Setup listen_on addresses diff --git a/crates/subspace-networking/src/constructor/transport.rs b/crates/subspace-networking/src/constructor/transport.rs index 25f2579389..9761e4dff4 100644 --- a/crates/subspace-networking/src/constructor/transport.rs +++ b/crates/subspace-networking/src/constructor/transport.rs @@ -1,11 +1,10 @@ use crate::constructor::temporary_bans::TemporaryBans; -use crate::CreationError; use futures::future::Either; use libp2p::core::multiaddr::{Multiaddr, Protocol}; use libp2p::core::muxing::StreamMuxerBox; use libp2p::core::transport::{Boxed, ListenerId, TransportError, TransportEvent}; use libp2p::core::Transport; -use libp2p::dns::TokioDnsConfig; +use libp2p::dns::tokio::Transport as TokioTransport; use libp2p::quic::tokio::Transport as QuicTransport; use libp2p::quic::Config as QuicConfig; use libp2p::tcp::tokio::Transport as TokioTcpTransport; @@ -27,7 +26,7 @@ pub(super) fn build_transport( temporary_bans: Arc>, timeout: Duration, yamux_config: YamuxConfig, -) -> Result, CreationError> { +) -> io::Result> { let wrapped_tcp = { let tcp_config = GenTcpConfig::default().nodelay(true); @@ -68,9 +67,7 @@ pub(super) fn build_transport( Either::Right((peer_id, muxer)) => (peer_id, muxer), }); - let dns_wrapped_upgraded_quic_tcp = TokioDnsConfig::system(quic_tcp)?; - - Ok(dns_wrapped_upgraded_quic_tcp.boxed()) + Ok(TokioTransport::system(quic_tcp)?.boxed()) } #[derive(Debug, Clone)] diff --git a/crates/subspace-networking/src/node_runner.rs b/crates/subspace-networking/src/node_runner.rs index 165828b9d4..f6f9313097 100644 --- a/crates/subspace-networking/src/node_runner.rs +++ b/crates/subspace-networking/src/node_runner.rs @@ -27,9 +27,10 @@ use libp2p::core::{address_translation, ConnectedPoint}; use libp2p::gossipsub::{Event as GossipsubEvent, TopicHash}; use libp2p::identify::Event as IdentifyEvent; use libp2p::kad::{ - BootstrapOk, GetClosestPeersError, GetClosestPeersOk, GetProvidersError, GetProvidersOk, - GetRecordError, GetRecordOk, InboundRequest, Kademlia, KademliaEvent, Mode, PeerRecord, - ProgressStep, PutRecordOk, QueryId, QueryResult, Quorum, Record, + Behaviour as Kademlia, BootstrapOk, Event as KademliaEvent, GetClosestPeersError, + GetClosestPeersOk, GetProvidersError, GetProvidersOk, GetRecordError, GetRecordOk, + InboundRequest, Mode, PeerRecord, ProgressStep, PutRecordOk, QueryId, QueryResult, Quorum, + Record, }; use libp2p::metrics::{Metrics, Recorder}; use libp2p::swarm::{DialError, SwarmEvent}; @@ -410,7 +411,7 @@ where .remove_address(&event.peer_id, &remove_p2p_suffix(event.address)); } - async fn handle_swarm_event(&mut self, swarm_event: SwarmEvent) { + async fn handle_swarm_event(&mut self, swarm_event: SwarmEvent) { match swarm_event { SwarmEvent::Behaviour(Event::Identify(event)) => { self.handle_identify_event(event).await; @@ -1482,7 +1483,7 @@ where .remove_all_known_peer_addresses(peer_id); } - fn register_event_metrics(&mut self, swarm_event: &SwarmEvent) { + fn register_event_metrics(&mut self, swarm_event: &SwarmEvent) { if let Some(ref mut metrics) = self.metrics { match swarm_event { SwarmEvent::Behaviour(Event::Ping(ping_event)) => { diff --git a/crates/subspace-networking/src/protocols/connected_peers.rs b/crates/subspace-networking/src/protocols/connected_peers.rs index 24614a90fe..cdcecae7be 100644 --- a/crates/subspace-networking/src/protocols/connected_peers.rs +++ b/crates/subspace-networking/src/protocols/connected_peers.rs @@ -36,14 +36,13 @@ use libp2p::core::{Endpoint, Multiaddr}; use libp2p::swarm::behaviour::{ConnectionEstablished, FromSwarm}; use libp2p::swarm::dial_opts::DialOpts; use libp2p::swarm::{ - ConnectionClosed, ConnectionDenied, ConnectionId, DialFailure, KeepAlive, NetworkBehaviour, - NotifyHandler, PollParameters, THandler, THandlerInEvent, THandlerOutEvent, ToSwarm, + ConnectionClosed, ConnectionDenied, ConnectionId, DialFailure, NetworkBehaviour, NotifyHandler, + THandler, THandlerInEvent, THandlerOutEvent, ToSwarm, }; use libp2p::PeerId; use std::collections::hash_map::Entry; use std::collections::HashMap; use std::marker::PhantomData; -use std::ops::Add; use std::task::{Context, Poll, Waker}; use std::time::{Duration, Instant}; use tracing::{debug, trace}; @@ -144,7 +143,7 @@ pub enum Event { #[derive(Debug, Clone, PartialEq, Eq)] struct PeerConnectionDecisionUpdate { peer_id: PeerId, - keep_alive: KeepAlive, + keep_alive: handler::KeepAlive, connection_id: ConnectionId, } @@ -202,30 +201,30 @@ impl Behaviour { /// Create a connection handler for the protocol. fn new_connection_handler(&mut self, peer_id: &PeerId, connection_id: ConnectionId) -> Handler { - let default_until = Instant::now().add(self.config.decision_timeout); - let default_keep_alive_until = KeepAlive::Until(default_until); - let keep_alive = if let Some(connection_state) = self.known_peers.get_mut(peer_id) { - match connection_state { - ConnectionState::Preparing { .. } | ConnectionState::Connecting { .. } => { - // Connection attempt was successful. - *connection_state = ConnectionState::Deciding { connection_id }; - - default_keep_alive_until + let default_keep_alive_until = Instant::now() + self.config.decision_timeout; + let (keep_alive, keep_alive_until) = + if let Some(connection_state) = self.known_peers.get_mut(peer_id) { + match connection_state { + ConnectionState::Preparing { .. } | ConnectionState::Connecting { .. } => { + // Connection attempt was successful. + *connection_state = ConnectionState::Deciding { connection_id }; + + (true, Some(default_keep_alive_until)) + } + ConnectionState::Deciding { .. } => (false, None), // We're already have a connection + ConnectionState::Permanent { .. } => (false, None), // We're already have a connection + ConnectionState::NotInterested => (false, None), } - ConnectionState::Deciding { .. } => KeepAlive::No, // We're already have a connection - ConnectionState::Permanent { .. } => KeepAlive::No, // We're already have a connection - ConnectionState::NotInterested => KeepAlive::No, - } - } else { - // Connection from other protocols. - self.known_peers - .insert(*peer_id, ConnectionState::Deciding { connection_id }); + } else { + // Connection from other protocols. + self.known_peers + .insert(*peer_id, ConnectionState::Deciding { connection_id }); - default_keep_alive_until - }; + (true, Some(default_keep_alive_until)) + }; self.wake(); - Handler::new(keep_alive) + Handler::new(keep_alive, keep_alive_until) } /// Specifies the whether we should keep connections to the peer alive. The decision could @@ -247,9 +246,9 @@ impl Behaviour { // Check whether we have enough connected peers already and a positive decision let (new_connection_state, keep_alive_handler) = if not_enough_connected_peers && keep_alive { - (ConnectionState::Permanent { connection_id }, KeepAlive::Yes) + (ConnectionState::Permanent { connection_id }, true) } else { - (ConnectionState::NotInterested, KeepAlive::No) + (ConnectionState::NotInterested, false) }; *connection_state = new_connection_state; @@ -365,7 +364,7 @@ impl NetworkBehaviour for Behaviour { Ok(self.new_connection_handler(&peer_id, connection_id)) } - fn on_swarm_event(&mut self, event: FromSwarm) { + fn on_swarm_event(&mut self, event: FromSwarm) { match event { FromSwarm::ConnectionEstablished(ConnectionEstablished { peer_id, @@ -420,39 +419,32 @@ impl NetworkBehaviour for Behaviour { } }; } - FromSwarm::DialFailure(DialFailure { peer_id, error, .. }) => { - if let Some(peer_id) = peer_id { - let other_connections = self - .known_peers - .get(&peer_id) - .map(|connection_state| connection_state.connected()) - .unwrap_or(false); - if !other_connections { - let old_peer_decision = self.known_peers.remove(&peer_id); - - if old_peer_decision.is_some() { - debug!( - %peer_id, - ?old_peer_decision, - ?error, - "Dialing error to known peer" - ); - } - } + FromSwarm::DialFailure(DialFailure { + peer_id: Some(peer_id), + error, + .. + }) => { + let other_connections = self + .known_peers + .get(&peer_id) + .map(|connection_state| connection_state.connected()) + .unwrap_or(false); + if !other_connections { + let old_peer_decision = self.known_peers.remove(&peer_id); - self.wake(); + if old_peer_decision.is_some() { + debug!( + %peer_id, + ?old_peer_decision, + ?error, + "Dialing error to known peer" + ); + } } + + self.wake(); } - FromSwarm::AddressChange(_) - | FromSwarm::ListenFailure(_) - | FromSwarm::NewListener(_) - | FromSwarm::NewListenAddr(_) - | FromSwarm::ExpiredListenAddr(_) - | FromSwarm::ListenerError(_) - | FromSwarm::ListenerClosed(_) - | FromSwarm::NewExternalAddrCandidate(_) - | FromSwarm::ExternalAddrConfirmed(_) - | FromSwarm::ExternalAddrExpired(_) => {} + _ => {} } } @@ -467,7 +459,6 @@ impl NetworkBehaviour for Behaviour { fn poll( &mut self, cx: &mut Context<'_>, - _: &mut impl PollParameters, ) -> Poll>> { // Notify handlers about received connection decision. if let Some(change) = self.peer_decision_changes.pop() { diff --git a/crates/subspace-networking/src/protocols/connected_peers/handler.rs b/crates/subspace-networking/src/protocols/connected_peers/handler.rs index 9799d22788..c4a2cd8bff 100644 --- a/crates/subspace-networking/src/protocols/connected_peers/handler.rs +++ b/crates/subspace-networking/src/protocols/connected_peers/handler.rs @@ -1,11 +1,15 @@ +use futures::pin_mut; use libp2p::core::upgrade::DeniedUpgrade; use libp2p::swarm::handler::ConnectionEvent; -use libp2p::swarm::{ConnectionHandler, ConnectionHandlerEvent, KeepAlive, SubstreamProtocol}; -use std::error::Error; -use std::fmt; +use libp2p::swarm::{ConnectionHandler, ConnectionHandlerEvent, SubstreamProtocol}; +use std::future::Future; +use std::pin::Pin; use std::task::{Context, Poll}; +use std::time::Instant; use tracing::trace; +pub type KeepAlive = bool; + /// Connection handler for managing connections within our `connected peers` protocol. /// /// This `Handler` is part of our custom protocol designed to maintain a target number of persistent @@ -20,30 +24,27 @@ use tracing::trace; pub struct Handler { /// Specifies whether we should keep the connection alive. keep_alive: KeepAlive, + /// Optional future that keeps connection alive for a certain amount of time. + keep_alive_timeout_future: Option + Send + 'static>>>, } impl Handler { /// Builds a new [`Handler`]. - pub fn new(keep_alive: KeepAlive) -> Self { - Handler { keep_alive } - } -} - -#[derive(Debug)] -pub struct ConnectedPeersError; + pub fn new(keep_alive: KeepAlive, keep_alive_until: Option) -> Self { + let keep_alive_timeout_future = keep_alive_until.map(|keep_alive_until| { + Box::pin(async move { tokio::time::sleep_until(keep_alive_until.into()).await }) as _ + }); -impl fmt::Display for ConnectedPeersError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "Connected peers protocol error.") + Handler { + keep_alive, + keep_alive_timeout_future, + } } } -impl Error for ConnectedPeersError {} - impl ConnectionHandler for Handler { type FromBehaviour = KeepAlive; type ToBehaviour = (); - type Error = ConnectedPeersError; type InboundProtocol = DeniedUpgrade; type OutboundProtocol = DeniedUpgrade; type OutboundOpenInfo = (); @@ -57,6 +58,8 @@ impl ConnectionHandler for Handler { trace!(?keep_alive, "Behaviour event arrived."); self.keep_alive = keep_alive; + // Drop timeout future + self.keep_alive_timeout_future.take(); } fn connection_keep_alive(&self) -> KeepAlive { @@ -65,8 +68,20 @@ impl ConnectionHandler for Handler { fn poll( &mut self, - _: &mut Context<'_>, - ) -> Poll> { + cx: &mut Context<'_>, + ) -> Poll> { + { + let maybe_keep_alive_timeout_future = &mut self.keep_alive_timeout_future; + if let Some(keep_alive_timeout_future) = maybe_keep_alive_timeout_future { + pin_mut!(keep_alive_timeout_future); + + if matches!(keep_alive_timeout_future.poll(cx), Poll::Ready(())) { + maybe_keep_alive_timeout_future.take(); + self.keep_alive = false; + } + } + } + Poll::Pending } diff --git a/crates/subspace-networking/src/protocols/connected_peers/tests.rs b/crates/subspace-networking/src/protocols/connected_peers/tests.rs index fb79ec9d59..091dbedc13 100644 --- a/crates/subspace-networking/src/protocols/connected_peers/tests.rs +++ b/crates/subspace-networking/src/protocols/connected_peers/tests.rs @@ -3,10 +3,9 @@ use futures::{select, FutureExt}; use libp2p::core::transport::MemoryTransport; use libp2p::core::upgrade::Version; use libp2p::core::Transport; -use libp2p::identity::{Keypair, PeerId}; -use libp2p::plaintext::PlainText2Config; -use libp2p::swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent}; -use libp2p::{yamux, Swarm}; +use libp2p::plaintext::Config as PlainTextConfig; +use libp2p::swarm::{NetworkBehaviour, SwarmEvent}; +use libp2p::{yamux, Swarm, SwarmBuilder}; use libp2p_swarm_test::SwarmExt; use std::time::Duration; use tokio::time::sleep; @@ -43,7 +42,7 @@ async fn test_connection_breaks_after_timeout_without_decision() { }), ); - peer2.listen().await; + peer2.listen().with_memory_addr_external().await; peer1.connect(&mut peer2).await; loop { @@ -79,7 +78,7 @@ async fn test_connection_decision() { }), ); - peer2.listen().await; + peer2.listen().with_memory_addr_external().await; peer1.connect(&mut peer2).await; peer1 @@ -122,7 +121,7 @@ async fn test_connection_decision_symmetry() { }), ); - peer2.listen().await; + peer2.listen().with_memory_addr_external().await; peer1.connect(&mut peer2).await; peer1 @@ -160,7 +159,7 @@ async fn test_new_peer_request() { }), ); - peer1.listen().await; + peer1.listen().with_memory_addr_external().await; let waiting_for_event_fut = async { while !matches!( @@ -217,8 +216,8 @@ async fn test_target_connected_peer_limit_number() { }), ); - peer2.listen().await; - peer3.listen().await; + peer2.listen().with_memory_addr_external().await; + peer3.listen().with_memory_addr_external().await; peer1.connect(&mut peer2).await; peer1.connect(&mut peer3).await; @@ -272,18 +271,19 @@ async fn test_target_connected_peer_limit_number() { } fn new_ephemeral(connection_timeout: Duration, behaviour: NB) -> Swarm { - let identity = Keypair::generate_ed25519(); - let peer_id = PeerId::from(identity.public()); - - let transport = MemoryTransport::default() - .or_transport(libp2p::tcp::tokio::Transport::default()) - .upgrade(Version::V1) - .authenticate(PlainText2Config { - local_public_key: identity.public(), + SwarmBuilder::with_new_identity() + .with_tokio() + .with_other_transport(|keypair| { + MemoryTransport::default() + .or_transport(libp2p::tcp::tokio::Transport::default()) + .upgrade(Version::V1) + .authenticate(PlainTextConfig::new(keypair)) + .multiplex(yamux::Config::default()) + .timeout(connection_timeout) + .boxed() }) - .multiplex(yamux::Config::default()) - .timeout(connection_timeout) - .boxed(); - - SwarmBuilder::without_executor(transport, behaviour, peer_id).build() + .unwrap() + .with_behaviour(move |_keypair| behaviour) + .unwrap() + .build() } diff --git a/crates/subspace-networking/src/protocols/peer_info.rs b/crates/subspace-networking/src/protocols/peer_info.rs index e3e2039216..7ff7e2cc98 100644 --- a/crates/subspace-networking/src/protocols/peer_info.rs +++ b/crates/subspace-networking/src/protocols/peer_info.rs @@ -7,8 +7,8 @@ pub use handler::{Config, PeerInfoError, PeerInfoSuccess}; use libp2p::core::{Endpoint, Multiaddr}; use libp2p::swarm::behaviour::{ConnectionEstablished, FromSwarm}; use libp2p::swarm::{ - ConnectionClosed, ConnectionDenied, ConnectionId, NetworkBehaviour, NotifyHandler, - PollParameters, THandler, THandlerInEvent, THandlerOutEvent, ToSwarm, + ConnectionClosed, ConnectionDenied, ConnectionId, NetworkBehaviour, NotifyHandler, THandler, + THandlerInEvent, THandlerOutEvent, ToSwarm, }; use libp2p::PeerId; use parity_scale_codec::{Decode, Encode}; @@ -200,7 +200,6 @@ impl NetworkBehaviour for Behaviour { fn poll( &mut self, cx: &mut Context<'_>, - _: &mut impl PollParameters, ) -> Poll>> { if let Some(e) = self.events.pop_back() { let Event { result, peer_id } = &e; @@ -233,7 +232,7 @@ impl NetworkBehaviour for Behaviour { Poll::Pending } - fn on_swarm_event(&mut self, event: FromSwarm) { + fn on_swarm_event(&mut self, event: FromSwarm) { match event { FromSwarm::ConnectionEstablished(ConnectionEstablished { peer_id, @@ -258,17 +257,7 @@ impl NetworkBehaviour for Behaviour { self.connected_peers.remove(&peer_id); } } - FromSwarm::AddressChange(_) - | FromSwarm::DialFailure(_) - | FromSwarm::ListenFailure(_) - | FromSwarm::NewListener(_) - | FromSwarm::NewListenAddr(_) - | FromSwarm::ExpiredListenAddr(_) - | FromSwarm::ListenerError(_) - | FromSwarm::ListenerClosed(_) - | FromSwarm::NewExternalAddrCandidate(_) - | FromSwarm::ExternalAddrConfirmed(_) - | FromSwarm::ExternalAddrExpired(_) => {} + _ => {} } } } diff --git a/crates/subspace-networking/src/protocols/peer_info/handler.rs b/crates/subspace-networking/src/protocols/peer_info/handler.rs index ab6a18c94b..3c716cfa30 100644 --- a/crates/subspace-networking/src/protocols/peer_info/handler.rs +++ b/crates/subspace-networking/src/protocols/peer_info/handler.rs @@ -7,10 +7,10 @@ use libp2p::swarm::handler::{ ListenUpgradeError, StreamUpgradeError as ConnectionHandlerUpgrErr, }; use libp2p::swarm::{ - ConnectionHandler, ConnectionHandlerEvent, KeepAlive, Stream as NegotiatedSubstream, - SubstreamProtocol, + ConnectionHandler, ConnectionHandlerEvent, Stream as NegotiatedSubstream, SubstreamProtocol, }; use libp2p::StreamProtocol; +use std::collections::VecDeque; use std::error::Error; use std::io; use std::sync::Arc; @@ -40,8 +40,8 @@ impl Config { } /// Sets the protocol timeout. - pub fn with_timeout(mut self, d: Duration) -> Self { - self.timeout = d; + pub fn with_timeout(mut self, timeout: Duration) -> Self { + self.timeout = timeout; self } } @@ -86,8 +86,14 @@ pub struct Handler { outbound: Option, /// The inbound request future. inbound: Option, - /// Last peer-info error. - error: Option, + /// Queue of events to return when polled. + queued_events: VecDeque< + ConnectionHandlerEvent< + ::OutboundProtocol, + ::OutboundOpenInfo, + ::ToBehaviour, + >, + >, /// Future waker. waker: Option, } @@ -99,7 +105,7 @@ impl Handler { config, outbound: None, inbound: None, - error: None, + queued_events: VecDeque::default(), waker: None, } } @@ -114,7 +120,6 @@ impl Handler { impl ConnectionHandler for Handler { type FromBehaviour = HandlerInEvent; type ToBehaviour = Result; - type Error = PeerInfoError; type InboundProtocol = ReadyUpgrade; type OutboundProtocol = ReadyUpgrade; type OutboundOpenInfo = Arc; @@ -138,10 +143,6 @@ impl ConnectionHandler for Handler { self.wake(); } - fn connection_keep_alive(&self) -> KeepAlive { - KeepAlive::No - } - fn poll( &mut self, cx: &mut Context<'_>, @@ -150,23 +151,25 @@ impl ConnectionHandler for Handler { ReadyUpgrade, Self::OutboundOpenInfo, Result, - Self::Error, >, > { - if let Some(error) = self.error.take() { - return Poll::Ready(ConnectionHandlerEvent::Close(error)); + // Return queued events. + if let Some(event) = self.queued_events.pop_front() { + return Poll::Ready(event); } // Respond to inbound requests. if let Some(fut) = self.inbound.as_mut() { match fut.poll_unpin(cx) { Poll::Pending => {} - Poll::Ready(Err(err)) => { - debug!(?err, "Peer info handler: inbound peer info error."); + Poll::Ready(Err(error)) => { + debug!(?error, "Peer info handler: inbound peer info error."); - return Poll::Ready(ConnectionHandlerEvent::Close(PeerInfoError::Other { - error: Box::new(err), - })); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err( + PeerInfoError::Other { + error: Box::new(error), + }, + ))); } Poll::Ready(Ok((stream, peer_info))) => { debug!(?peer_info, "Inbound peer info"); @@ -196,9 +199,11 @@ impl ConnectionHandler for Handler { Poll::Ready(Err(error)) => { debug!(?error, "Outbound peer info error.",); - self.error = Some(PeerInfoError::Other { - error: Box::new(error), - }); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour(Err( + PeerInfoError::Other { + error: Box::new(error), + }, + ))); } } } @@ -257,19 +262,25 @@ impl ConnectionHandler for Handler { | ConnectionHandlerUpgrErr::Apply(..) => { debug!(?error, "Peer-info protocol dial upgrade failed"); } - e => { - self.error = Some(PeerInfoError::Other { error: Box::new(e) }); + error => { + self.queued_events + .push_back(ConnectionHandlerEvent::NotifyBehaviour(Err( + PeerInfoError::Other { + error: Box::new(error), + }, + ))); } }; } ConnectionEvent::ListenUpgradeError(ListenUpgradeError { error, .. }) => { - self.error = Some(PeerInfoError::Other { - error: Box::new(error), - }); + self.queued_events + .push_back(ConnectionHandlerEvent::NotifyBehaviour(Err( + PeerInfoError::Other { + error: Box::new(error), + }, + ))); } - ConnectionEvent::AddressChange(_) => {} - ConnectionEvent::LocalProtocolsChange(_) => {} - ConnectionEvent::RemoteProtocolsChange(_) => {} + _ => {} } self.wake(); } diff --git a/crates/subspace-networking/src/protocols/request_response/request_response_factory.rs b/crates/subspace-networking/src/protocols/request_response/request_response_factory.rs index 9123caa509..366de04bd9 100644 --- a/crates/subspace-networking/src/protocols/request_response/request_response_factory.rs +++ b/crates/subspace-networking/src/protocols/request_response/request_response_factory.rs @@ -44,15 +44,14 @@ use libp2p::core::{Endpoint, Multiaddr}; use libp2p::identity::PeerId; use libp2p::request_response::{ Behaviour as RequestResponse, Codec as RequestResponseCodec, Config as RequestResponseConfig, - Event as RequestResponseEvent, Message as RequestResponseMessage, ProtocolSupport, - ResponseChannel, + Event as RequestResponseEvent, InboundRequestId, Message as RequestResponseMessage, + OutboundRequestId, ProtocolSupport, ResponseChannel, }; -pub use libp2p::request_response::{InboundFailure, OutboundFailure, RequestId}; +pub use libp2p::request_response::{InboundFailure, OutboundFailure}; use libp2p::swarm::behaviour::{ConnectionClosed, DialFailure, FromSwarm, ListenFailure}; use libp2p::swarm::handler::multi::MultiHandler; use libp2p::swarm::{ - ConnectionDenied, ConnectionId, NetworkBehaviour, PollParameters, THandlerInEvent, - THandlerOutEvent, ToSwarm, + ConnectionDenied, ConnectionId, NetworkBehaviour, THandlerInEvent, THandlerOutEvent, ToSwarm, }; use libp2p::StreamProtocol; use std::borrow::Cow; @@ -217,7 +216,7 @@ pub enum Event { /// Duration the request took. duration: Duration, /// Result of the request. - result: Result<(), RequestFailure>, + result: Result<(), String>, }, } @@ -230,12 +229,12 @@ pub enum Event { #[derive(Debug, Clone, PartialEq, Eq, Hash)] struct ProtocolRequestId { protocol: Cow<'static, str>, - request_id: RequestId, + request_id: OutboundRequestId, } -impl From<(Cow<'static, str>, RequestId)> for ProtocolRequestId { +impl From<(Cow<'static, str>, OutboundRequestId)> for ProtocolRequestId { #[inline] - fn from((protocol, request_id): (Cow<'static, str>, RequestId)) -> Self { + fn from((protocol, request_id): (Cow<'static, str>, OutboundRequestId)) -> Self { Self { protocol, request_id, @@ -300,7 +299,7 @@ pub struct RequestResponseFactoryBehaviour { // This is a state of processing incoming request Message. struct MessageRequest { peer: PeerId, - request_id: RequestId, + request_id: InboundRequestId, request: Vec, channel: ResponseChannel, ()>>, protocol: String, @@ -309,7 +308,7 @@ struct MessageRequest { /// Generated by the response builder and waiting to be processed. struct RequestProcessingOutcome { - request_id: RequestId, + request_id: InboundRequestId, protocol: Cow<'static, str>, inner_channel: ResponseChannel, ()>>, response: OutgoingResponse, @@ -326,10 +325,6 @@ impl RequestResponseFactoryBehaviour { for mut handler in list { let config = handler.protocol_config(); - let mut cfg = RequestResponseConfig::default(); - cfg.set_connection_keep_alive(Duration::from_secs(10)); - cfg.set_request_timeout(config.request_timeout); - let protocol_support = if config.inbound_queue.is_some() { ProtocolSupport::Full } else { @@ -342,7 +337,7 @@ impl RequestResponseFactoryBehaviour { max_response_size: config.max_response_size, }, iter::once(StreamProtocol::new(config.name)).zip(iter::repeat(protocol_support)), - cfg, + RequestResponseConfig::default().with_request_timeout(config.request_timeout), ); match protocols.entry(Cow::Borrowed(config.name)) { @@ -481,7 +476,7 @@ impl NetworkBehaviour for RequestResponseFactoryBehaviour { } /// Informs the behaviour about an event from the [`Swarm`](crate::Swarm). - fn on_swarm_event(&mut self, event: FromSwarm) { + fn on_swarm_event(&mut self, event: FromSwarm) { match event { FromSwarm::ConnectionEstablished(inner) => { for (protocol, _) in self.protocols.values_mut() { @@ -489,23 +484,13 @@ impl NetworkBehaviour for RequestResponseFactoryBehaviour { } } FromSwarm::ConnectionClosed(inner) => { - for (p_name, handler) in inner.handler.into_iter() { - if let Some((protocol, _)) = self.protocols.get_mut(p_name.as_str()) { - protocol.on_swarm_event(FromSwarm::ConnectionClosed(ConnectionClosed { - peer_id: inner.peer_id, - connection_id: inner.connection_id, - endpoint: inner.endpoint, - handler, - remaining_established: inner.remaining_established, - })); - } else { - error!( - target: LOG_TARGET, - "inject_connection_closed: no request-response instance registered \ - for protocol {:?}", - p_name, - ) - } + for (protocol, _) in self.protocols.values_mut() { + protocol.on_swarm_event(FromSwarm::ConnectionClosed(ConnectionClosed { + peer_id: inner.peer_id, + connection_id: inner.connection_id, + endpoint: inner.endpoint, + remaining_established: inner.remaining_established, + })); } } FromSwarm::AddressChange(inner) => { @@ -572,6 +557,12 @@ impl NetworkBehaviour for RequestResponseFactoryBehaviour { protocol.on_swarm_event(FromSwarm::ExternalAddrExpired(inner)); } } + event => { + warn!( + ?event, + "New event must be forwarded to request response protocols" + ); + } }; } @@ -592,11 +583,7 @@ impl NetworkBehaviour for RequestResponseFactoryBehaviour { ) } - fn poll( - &mut self, - cx: &mut Context, - params: &mut impl PollParameters, - ) -> Poll>> { + fn poll(&mut self, cx: &mut Context) -> Poll>> { 'poll_all: loop { if let Some(message_request) = self.message_request.take() { let MessageRequest { @@ -684,10 +671,10 @@ impl NetworkBehaviour for RequestResponseFactoryBehaviour { // Poll request-responses protocols. for (protocol, (behaviour, response_builder)) in &mut self.protocols { - while let Poll::Ready(ev) = behaviour.poll(cx, params) { - let ev = match ev { + while let Poll::Ready(event) = behaviour.poll(cx) { + let event = match event { // Main events we are interested in. - ToSwarm::GenerateEvent(ev) => ev, + ToSwarm::GenerateEvent(event) => event, // Other events generated by the underlying behaviour are transparently // passed through. @@ -735,9 +722,17 @@ impl NetworkBehaviour for RequestResponseFactoryBehaviour { ToSwarm::RemoveListener { id } => { return Poll::Ready(ToSwarm::RemoveListener { id }) } + event => { + warn!( + ?event, + "New event from request response protocol must be send up" + ); + + continue; + } }; - match ev { + match event { // Received a request from a remote. RequestResponseEvent::Message { peer, @@ -778,7 +773,7 @@ impl NetworkBehaviour for RequestResponseFactoryBehaviour { Some((started, pending_response)) => { let delivered = pending_response .send(response.map_err(|()| RequestFailure::Refused)) - .map_err(|_| RequestFailure::Obsolete); + .map_err(|_| RequestFailure::Obsolete.to_string()); (started, delivered) } None => { @@ -809,20 +804,21 @@ impl NetworkBehaviour for RequestResponseFactoryBehaviour { error, .. } => { + let error_string = error.to_string(); let started = match self .pending_requests .remove(&(protocol.clone(), request_id).into()) { Some((started, pending_response)) => { if pending_response - .send(Err(RequestFailure::Network(error.clone()))) + .send(Err(RequestFailure::Network(error))) .is_err() { debug!( target: LOG_TARGET, %request_id, - "Request failed. At the same time local \ - node is no longer interested in the result.", + "Request failed. At the same time local node is no longer interested in \ + the result", ); } started @@ -832,7 +828,6 @@ impl NetworkBehaviour for RequestResponseFactoryBehaviour { target: LOG_TARGET, %request_id, "Received `RequestResponseEvent::Message` with unexpected request", - ); debug_assert!(false); continue; @@ -843,7 +838,7 @@ impl NetworkBehaviour for RequestResponseFactoryBehaviour { peer, protocol: protocol.clone(), duration: started.elapsed(), - result: Err(RequestFailure::Network(error)), + result: Err(error_string), }; return Poll::Ready(ToSwarm::GenerateEvent(out)); diff --git a/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs b/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs index 91d4bdde67..05395cd666 100644 --- a/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs +++ b/crates/subspace-networking/src/protocols/request_response/request_response_factory/tests.rs @@ -4,16 +4,15 @@ use crate::protocols::request_response::request_response_factory::{ }; use async_trait::async_trait; use futures::channel::{mpsc, oneshot}; -use futures::executor::LocalPool; -use futures::task::Spawn; -use futures::{FutureExt, StreamExt}; +use futures::stream::FuturesUnordered; +use futures::StreamExt; use libp2p::core::transport::{MemoryTransport, Transport}; use libp2p::core::upgrade; -use libp2p::identity::Keypair; -use libp2p::swarm::{Swarm, SwarmBuilder, SwarmEvent}; -use libp2p::{noise, Multiaddr}; -use std::iter; +use libp2p::swarm::{Swarm, SwarmEvent}; +use libp2p::{noise, SwarmBuilder}; +use libp2p_swarm_test::SwarmExt; use std::time::Duration; +use std::{io, iter}; #[derive(Clone)] struct MockRunner(ProtocolConfig); @@ -35,59 +34,55 @@ impl RequestHandler for MockRunner { } } -fn build_swarm( +async fn build_swarm( list: impl Iterator, -) -> (Swarm, Multiaddr) { - let keypair = Keypair::generate_ed25519(); - - let transport = MemoryTransport::new() - .upgrade(upgrade::Version::V1) - .authenticate(noise::Config::new(&keypair).unwrap()) - .multiplex(libp2p::yamux::Config::default()) - .boxed(); - +) -> Swarm { let configs = list .into_iter() .map(|config| Box::new(MockRunner(config)) as Box) .collect::>(); let behaviour = RequestResponseFactoryBehaviour::new(configs).unwrap(); - let mut swarm = - SwarmBuilder::with_tokio_executor(transport, behaviour, keypair.public().to_peer_id()) - .build(); - let listen_addr: Multiaddr = format!("/memory/{}", rand::random::()) - .parse() - .unwrap(); + let mut swarm = SwarmBuilder::with_new_identity() + .with_tokio() + .with_other_transport(|keypair| { + MemoryTransport::default() + .or_transport(libp2p::tcp::tokio::Transport::default()) + .upgrade(upgrade::Version::V1) + .authenticate(noise::Config::new(keypair).unwrap()) + .multiplex(libp2p::yamux::Config::default()) + .boxed() + }) + .unwrap() + .with_behaviour(move |_keypair| behaviour) + .unwrap() + // Make sure connections stay alive + .with_swarm_config(|config| config.with_idle_connection_timeout(Duration::from_secs(10))) + .build(); + + swarm.listen().with_memory_addr_external().await; - swarm.listen_on(listen_addr.clone()).unwrap(); - (swarm, listen_addr) + swarm } #[tokio::test(flavor = "multi_thread")] async fn basic_request_response_works() { let protocol_name = "/test/req-resp/1"; - let mut pool = LocalPool::new(); // Build swarms whose behaviour is `RequestResponsesBehaviour`. let mut swarms = (0..2) - .map(|_| { + .map(|_| async { let (tx, mut rx) = mpsc::channel::(64); - pool.spawner() - .spawn_obj( - async move { - while let Some(rq) = rx.next().await { - assert_eq!(rq.payload, b"this is a request"); - let _ = rq.pending_response.send(OutgoingResponse { - result: Ok(b"this is a response".to_vec()), - sent_feedback: None, - }); - } - } - .boxed() - .into(), - ) - .unwrap(); + tokio::spawn(async move { + while let Some(rq) = rx.next().await { + assert_eq!(rq.payload, b"this is a request"); + let _ = rq.pending_response.send(OutgoingResponse { + result: Ok(b"this is a response".to_vec()), + sent_feedback: None, + }); + } + }); let protocol_config = ProtocolConfig { name: protocol_name, @@ -97,96 +92,72 @@ async fn basic_request_response_works() { inbound_queue: Some(tx), }; - build_swarm(iter::once(protocol_config)) + build_swarm(iter::once(protocol_config)).await }) - .collect::>(); - - // Ask `swarm[0]` to dial `swarm[1]`. There isn't any discovery mechanism in place in - // this test, so they wouldn't connect to each other. - { - let dial_addr = swarms[1].1.clone(); - Swarm::dial(&mut swarms[0].0, dial_addr).unwrap(); - } + .collect::>() + .collect::>() + .await; - let (mut swarm, _) = swarms.remove(0); - - // Running `swarm[0]` in the background. - pool.spawner() - .spawn_obj({ - async move { - loop { - if let SwarmEvent::Behaviour(Event::InboundRequest { result, .. }) = - swarm.select_next_some().await - { - result.unwrap(); - } - } - } - .boxed() - .into() - }) - .unwrap(); + let mut swarm_0 = swarms.remove(0); + let mut swarm_1 = swarms.remove(0); - // Remove and run the remaining swarm. - let (mut swarm, _) = swarms.remove(0); + // Ask `swarm_0` to dial `swarm_1`. There isn't any discovery mechanism in place in this test, so they wouldn't + // connect to each other. + swarm_0.connect(&mut swarm_1).await; - pool.run_until(async move { - let mut response_receiver = None; + let peer_id_0 = *swarm_0.local_peer_id(); + // Running `swarm_0` in the background. + tokio::spawn(async move { loop { - match swarm.select_next_some().await { - SwarmEvent::ConnectionEstablished { peer_id, .. } => { - let (sender, receiver) = oneshot::channel(); - swarm.behaviour_mut().send_request( - &peer_id, - protocol_name, - b"this is a request".to_vec(), - sender, - IfDisconnected::ImmediateError, - ); - assert!(response_receiver.is_none()); - response_receiver = Some(receiver); - } - SwarmEvent::Behaviour(Event::RequestFinished { result, .. }) => { - result.unwrap(); - break; - } - _ => {} + if let SwarmEvent::Behaviour(Event::InboundRequest { result, .. }) = + swarm_0.select_next_some().await + { + result.unwrap(); } } - - assert_eq!( - response_receiver.unwrap().await.unwrap().unwrap(), - b"this is a response" - ); }); + + let (sender, receiver) = oneshot::channel(); + // Send request + swarm_1.behaviour_mut().send_request( + &peer_id_0, + protocol_name, + b"this is a request".to_vec(), + sender, + IfDisconnected::ImmediateError, + ); + // Wait for request to finish + loop { + if let SwarmEvent::Behaviour(Event::RequestFinished { result, .. }) = + swarm_1.select_next_some().await + { + result.unwrap(); + break; + } + } + // Expect response + assert_eq!(receiver.await.unwrap().unwrap(), b"this is a response"); } #[tokio::test(flavor = "multi_thread")] async fn max_response_size_exceeded() { let protocol_name = "/test/req-resp/1"; - let mut pool = LocalPool::new(); // Build swarms whose behaviour is `RequestResponsesBehaviour`. let mut swarms = (0..2) - .map(|_| { + .map(|_| async { let (tx, mut rx) = mpsc::channel::(64); - pool.spawner() - .spawn_obj( - async move { - while let Some(rq) = rx.next().await { - assert_eq!(rq.payload, b"this is a request"); - let _ = rq.pending_response.send(OutgoingResponse { - result: Ok(b"this response exceeds the limit".to_vec()), - sent_feedback: None, - }); - } - } - .boxed() - .into(), - ) - .unwrap(); + tokio::spawn(async move { + while let Some(rq) = rx.next().await { + assert_eq!(rq.payload, b"this is a request"); + let _ = rq.pending_response.send(OutgoingResponse { + result: Ok(b"this response exceeds the limit".to_vec()), + sent_feedback: None, + }); + } + }); let protocol_config = ProtocolConfig { name: protocol_name, @@ -196,71 +167,63 @@ async fn max_response_size_exceeded() { inbound_queue: Some(tx), }; - build_swarm(iter::once(protocol_config)) + build_swarm(iter::once(protocol_config)).await }) - .collect::>(); - - // Ask `swarm[0]` to dial `swarm[1]`. There isn't any discovery mechanism in place in - // this test, so they wouldn't connect to each other. - { - let dial_addr = swarms[1].1.clone(); - Swarm::dial(&mut swarms[0].0, dial_addr).unwrap(); - } + .collect::>() + .collect::>() + .await; - // Running `swarm[0]` in the background until a `InboundRequest` event happens, - // which is a hint about the test having ended. - let (mut swarm, _) = swarms.remove(0); - - pool.spawner() - .spawn_obj({ - async move { - loop { - if let SwarmEvent::Behaviour(Event::InboundRequest { result, .. }) = - swarm.select_next_some().await - { - assert!(result.is_ok()); - break; - } - } - } - .boxed() - .into() - }) - .unwrap(); + let mut swarm_0 = swarms.remove(0); + let mut swarm_1 = swarms.remove(0); - // Remove and run the remaining swarm. - let (mut swarm, _) = swarms.remove(0); + // Ask `swarm_0` to dial `swarm_1`. There isn't any discovery mechanism in place in this test, so they wouldn't + // connect to each other. + swarm_0.connect(&mut swarm_1).await; - pool.run_until(async move { - let mut response_receiver = None; + let peer_id_0 = *swarm_0.local_peer_id(); + // Running `swarm_0` in the background until a `InboundRequest` event happens, which is a hint about the test + // having ended. + tokio::spawn(async move { loop { - match swarm.select_next_some().await { - SwarmEvent::ConnectionEstablished { peer_id, .. } => { - let (sender, receiver) = oneshot::channel(); - swarm.behaviour_mut().send_request( - &peer_id, - protocol_name, - b"this is a request".to_vec(), - sender, - IfDisconnected::ImmediateError, - ); - assert!(response_receiver.is_none()); - response_receiver = Some(receiver); - } - SwarmEvent::Behaviour(Event::RequestFinished { result, .. }) => { - assert!(result.is_err()); - break; - } - _ => {} + if let SwarmEvent::Behaviour(Event::InboundRequest { result, .. }) = + swarm_0.select_next_some().await + { + assert!(result.is_ok()); } } + }); - match response_receiver.unwrap().await.unwrap().unwrap_err() { - RequestFailure::Network(OutboundFailure::ConnectionClosed) => {} - _ => panic!(), + // Run the remaining swarm. + let (sender, receiver) = oneshot::channel(); + // Send request + swarm_1.behaviour_mut().send_request( + &peer_id_0, + protocol_name, + b"this is a request".to_vec(), + sender, + IfDisconnected::ImmediateError, + ); + // Wait for request to finish + loop { + if let SwarmEvent::Behaviour(Event::RequestFinished { result, .. }) = + swarm_1.select_next_some().await + { + assert!(result.is_err()); + break; } - }); + } + // Expect response + match receiver.await.unwrap().unwrap_err() { + RequestFailure::Network(OutboundFailure::Io(error)) => { + if error.kind() != io::ErrorKind::InvalidInput + || error.to_string() != "Response size exceeds limit: 31 > 8" + { + panic!("Unexpected I/O error: {error}") + } + } + error => panic!("Unexpected error: {error}"), + } } /// A [`RequestId`] is a unique identifier among either all inbound or all outbound requests for @@ -277,7 +240,6 @@ async fn max_response_size_exceeded() { async fn request_id_collision() { let protocol_name_1 = "/test/req-resp-1/1"; let protocol_name_2 = "/test/req-resp-2/1"; - let mut pool = LocalPool::new(); let mut swarm_1 = { let protocol_configs = vec![ @@ -297,10 +259,10 @@ async fn request_id_collision() { }, ]; - build_swarm(protocol_configs.into_iter()).0 + build_swarm(protocol_configs.into_iter()).await }; - let (mut swarm_2, mut swarm_2_handler_1, mut swarm_2_handler_2, listen_add_2) = { + let (mut swarm_2, mut swarm_2_handler_1, mut swarm_2_handler_2) = { let (tx_1, rx_1) = mpsc::channel(64); let (tx_2, rx_2) = mpsc::channel(64); @@ -321,109 +283,87 @@ async fn request_id_collision() { }, ]; - let (swarm, listen_addr) = build_swarm(protocol_configs.into_iter()); + let swarm = build_swarm(protocol_configs.into_iter()).await; - (swarm, rx_1, rx_2, listen_addr) + (swarm, rx_1, rx_2) }; // Ask swarm 1 to dial swarm 2. There isn't any discovery mechanism in place in this test, // so they wouldn't connect to each other. - swarm_1.dial(listen_add_2).unwrap(); + swarm_1.connect(&mut swarm_2).await; + + let peer_id_2 = *swarm_2.local_peer_id(); // Run swarm 2 in the background, receiving two requests. - pool.spawner() - .spawn_obj( - async move { - loop { - if let SwarmEvent::Behaviour(Event::InboundRequest { result, .. }) = - swarm_2.select_next_some().await - { - result.unwrap(); - } - } + tokio::spawn(async move { + loop { + if let SwarmEvent::Behaviour(Event::InboundRequest { result, .. }) = + swarm_2.select_next_some().await + { + result.unwrap(); } - .boxed() - .into(), - ) - .unwrap(); + } + }); // Handle both requests sent by swarm 1 to swarm 2 in the background. // // Make sure both requests overlap, by answering the first only after receiving the // second. - pool.spawner() - .spawn_obj( - async move { - let protocol_1_request = swarm_2_handler_1.next().await; - let protocol_2_request = swarm_2_handler_2.next().await; - - protocol_1_request - .unwrap() - .pending_response - .send(OutgoingResponse { - result: Ok(b"this is a response".to_vec()), - sent_feedback: None, - }) - .unwrap(); - protocol_2_request - .unwrap() - .pending_response - .send(OutgoingResponse { - result: Ok(b"this is a response".to_vec()), - sent_feedback: None, - }) - .unwrap(); - } - .boxed() - .into(), - ) - .unwrap(); + tokio::spawn(async move { + let protocol_1_request = swarm_2_handler_1.next().await; + let protocol_2_request = swarm_2_handler_2.next().await; + + protocol_1_request + .unwrap() + .pending_response + .send(OutgoingResponse { + result: Ok(b"this is a response 1".to_vec()), + sent_feedback: None, + }) + .unwrap(); + protocol_2_request + .unwrap() + .pending_response + .send(OutgoingResponse { + result: Ok(b"this is a response 2".to_vec()), + sent_feedback: None, + }) + .unwrap(); + }); // Have swarm 1 send two requests to swarm 2 and await responses. - pool.run_until(async move { - let mut response_receivers = None; - let mut num_responses = 0; - - loop { - match swarm_1.select_next_some().await { - SwarmEvent::ConnectionEstablished { peer_id, .. } => { - let (sender_1, receiver_1) = oneshot::channel(); - let (sender_2, receiver_2) = oneshot::channel(); - swarm_1.behaviour_mut().send_request( - &peer_id, - protocol_name_1, - b"this is a request".to_vec(), - sender_1, - IfDisconnected::ImmediateError, - ); - swarm_1.behaviour_mut().send_request( - &peer_id, - protocol_name_2, - b"this is a request".to_vec(), - sender_2, - IfDisconnected::ImmediateError, - ); - assert!(response_receivers.is_none()); - response_receivers = Some((receiver_1, receiver_2)); - } - SwarmEvent::Behaviour(Event::RequestFinished { result, .. }) => { - num_responses += 1; - result.unwrap(); - if num_responses == 2 { - break; - } - } - _ => {} + let mut num_responses = 0; + + let (sender_1, receiver_1) = oneshot::channel(); + let (sender_2, receiver_2) = oneshot::channel(); + // Send two requests + swarm_1.behaviour_mut().send_request( + &peer_id_2, + protocol_name_1, + b"this is a request 1".to_vec(), + sender_1, + IfDisconnected::ImmediateError, + ); + swarm_1.behaviour_mut().send_request( + &peer_id_2, + protocol_name_2, + b"this is a request 2".to_vec(), + sender_2, + IfDisconnected::ImmediateError, + ); + // Expect both to finish + loop { + if let SwarmEvent::Behaviour(Event::RequestFinished { result, .. }) = + swarm_1.select_next_some().await + { + num_responses += 1; + result.unwrap(); + if num_responses == 2 { + break; } } - let (response_receiver_1, response_receiver_2) = response_receivers.unwrap(); - assert_eq!( - response_receiver_1.await.unwrap().unwrap(), - b"this is a response" - ); - assert_eq!( - response_receiver_2.await.unwrap().unwrap(), - b"this is a response" - ); - }); + } + // Expect two responses + assert_eq!(receiver_1.await.unwrap().unwrap(), b"this is a response 1"); + assert_eq!(receiver_2.await.unwrap().unwrap(), b"this is a response 2"); } diff --git a/crates/subspace-networking/src/protocols/reserved_peers.rs b/crates/subspace-networking/src/protocols/reserved_peers.rs index 88ab0fb4f5..49857472c2 100644 --- a/crates/subspace-networking/src/protocols/reserved_peers.rs +++ b/crates/subspace-networking/src/protocols/reserved_peers.rs @@ -9,8 +9,8 @@ use libp2p::core::{Endpoint, Multiaddr}; use libp2p::swarm::behaviour::{ConnectionEstablished, FromSwarm}; use libp2p::swarm::dial_opts::DialOpts; use libp2p::swarm::{ - ConnectionClosed, ConnectionDenied, ConnectionId, DialFailure, NetworkBehaviour, - PollParameters, THandler, THandlerInEvent, THandlerOutEvent, ToSwarm, + ConnectionClosed, ConnectionDenied, ConnectionId, DialFailure, NetworkBehaviour, THandler, + THandlerInEvent, THandlerOutEvent, ToSwarm, }; use libp2p::PeerId; use std::collections::HashMap; @@ -166,7 +166,7 @@ impl NetworkBehaviour for Behaviour { Ok(self.new_reserved_peers_handler(&peer_id)) } - fn on_swarm_event(&mut self, event: FromSwarm) { + fn on_swarm_event(&mut self, event: FromSwarm) { match event { FromSwarm::ConnectionEstablished(ConnectionEstablished { peer_id, .. }) => { if let Some(state) = self.reserved_peers_state.get_mut(&peer_id) { @@ -190,28 +190,20 @@ impl NetworkBehaviour for Behaviour { } } } - FromSwarm::DialFailure(DialFailure { peer_id, .. }) => { - if let Some(peer_id) = peer_id { - if let Some(state) = self.reserved_peers_state.get_mut(&peer_id) { - if state.connection_status == ConnectionStatus::PendingConnection { - state.connection_status = ConnectionStatus::NotConnected; - }; + FromSwarm::DialFailure(DialFailure { + peer_id: Some(peer_id), + .. + }) => { + if let Some(state) = self.reserved_peers_state.get_mut(&peer_id) { + if state.connection_status == ConnectionStatus::PendingConnection { + state.connection_status = ConnectionStatus::NotConnected; + }; - debug!(peer_id=%state.peer_id, "Reserved peer dialing failed."); - self.wake(); - } + debug!(peer_id=%state.peer_id, "Reserved peer dialing failed."); + self.wake(); } } - FromSwarm::AddressChange(_) - | FromSwarm::ListenFailure(_) - | FromSwarm::NewListener(_) - | FromSwarm::NewListenAddr(_) - | FromSwarm::ExpiredListenAddr(_) - | FromSwarm::ListenerError(_) - | FromSwarm::ListenerClosed(_) - | FromSwarm::NewExternalAddrCandidate(_) - | FromSwarm::ExternalAddrConfirmed(_) - | FromSwarm::ExternalAddrExpired(_) => {} + _ => {} } } @@ -226,7 +218,6 @@ impl NetworkBehaviour for Behaviour { fn poll( &mut self, cx: &mut Context<'_>, - _: &mut impl PollParameters, ) -> Poll>> { // Schedule new peer dialing. match self.dialing_delay.poll_unpin(cx) { diff --git a/crates/subspace-networking/src/protocols/reserved_peers/handler.rs b/crates/subspace-networking/src/protocols/reserved_peers/handler.rs index 3548f5a1ee..dd5b7cf21c 100644 --- a/crates/subspace-networking/src/protocols/reserved_peers/handler.rs +++ b/crates/subspace-networking/src/protocols/reserved_peers/handler.rs @@ -1,8 +1,6 @@ use libp2p::core::upgrade::DeniedUpgrade; use libp2p::swarm::handler::ConnectionEvent; -use libp2p::swarm::{ConnectionHandler, ConnectionHandlerEvent, KeepAlive, SubstreamProtocol}; -use std::error::Error; -use std::fmt; +use libp2p::swarm::{ConnectionHandler, ConnectionHandlerEvent, SubstreamProtocol}; use std::task::{Context, Poll}; use void::Void; @@ -33,21 +31,9 @@ impl Handler { } } -#[derive(Debug)] -pub struct ReservedPeersError; - -impl fmt::Display for ReservedPeersError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "Reserved peers error.") - } -} - -impl Error for ReservedPeersError {} - impl ConnectionHandler for Handler { type FromBehaviour = Void; type ToBehaviour = (); - type Error = ReservedPeersError; type InboundProtocol = DeniedUpgrade; type OutboundProtocol = DeniedUpgrade; type OutboundOpenInfo = (); @@ -59,18 +45,11 @@ impl ConnectionHandler for Handler { fn on_behaviour_event(&mut self, _: Void) {} - fn connection_keep_alive(&self) -> KeepAlive { - if self.connected_to_reserved_peer { - KeepAlive::Yes - } else { - KeepAlive::No - } + fn connection_keep_alive(&self) -> bool { + self.connected_to_reserved_peer } - fn poll( - &mut self, - _: &mut Context<'_>, - ) -> Poll> { + fn poll(&mut self, _: &mut Context<'_>) -> Poll> { Poll::Pending } diff --git a/crates/subspace-networking/src/protocols/reserved_peers/tests.rs b/crates/subspace-networking/src/protocols/reserved_peers/tests.rs index 82cf3f1b4f..4df7b3adaf 100644 --- a/crates/subspace-networking/src/protocols/reserved_peers/tests.rs +++ b/crates/subspace-networking/src/protocols/reserved_peers/tests.rs @@ -3,10 +3,10 @@ use futures::{select, FutureExt}; use libp2p::core::transport::MemoryTransport; use libp2p::core::upgrade::Version; use libp2p::core::Transport; -use libp2p::identity::{Keypair, PeerId}; -use libp2p::plaintext::PlainText2Config; -use libp2p::swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent}; -use libp2p::{yamux, Swarm}; +use libp2p::identity::Keypair; +use libp2p::plaintext::Config as PlainTextConfig; +use libp2p::swarm::{NetworkBehaviour, SwarmEvent}; +use libp2p::{yamux, Swarm, SwarmBuilder}; use libp2p_swarm_test::SwarmExt; use std::time::Duration; use tokio::time::sleep; @@ -41,8 +41,8 @@ async fn test_connection_breaks_after_timeout_without_reservation() { }), ); - peer1.listen().await; - peer2.listen().await; + peer1.listen().with_memory_addr_external().await; + peer2.listen().with_memory_addr_external().await; peer1.connect(&mut peer2).await; loop { @@ -89,8 +89,8 @@ async fn test_connection_reservation() { }), ); - peer1.listen().await; - peer2.listen().await; + peer1.listen().with_memory_addr_external().await; + peer2.listen().with_memory_addr_external().await; peer1.connect(&mut peer2).await; loop { @@ -116,28 +116,27 @@ async fn test_connection_reservation_symmetry() { let identity1 = Keypair::generate_ed25519(); let identity2 = Keypair::generate_ed25519(); - let peer2_address = format!("/memory/0/p2p/{}", identity2.public().to_peer_id()); - let mut peer1 = new_ephemeral( identity1, connection_timeout, Behaviour::new(Config { - reserved_peers: vec![peer2_address.parse().unwrap()], + reserved_peers: vec![], dialing_interval: DIALING_INTERVAL_IN_SECS, }), ); + let (peer_1_memory_address, _) = peer1.listen().with_memory_addr_external().await; + let mut peer2 = new_ephemeral( identity2, connection_timeout, Behaviour::new(Config { - reserved_peers: Vec::new(), + reserved_peers: vec![peer_1_memory_address], dialing_interval: DIALING_INTERVAL_IN_SECS, }), ); - peer1.listen().await; - peer2.listen().await; + peer2.listen().with_memory_addr_external().await; peer1.connect(&mut peer2).await; loop { @@ -175,7 +174,7 @@ async fn test_reserved_peers_dial_event() { }), ); - peer1.listen().await; + peer1.listen().with_memory_addr_external().await; select! { event = peer1.next_swarm_event().fuse() => { @@ -196,17 +195,19 @@ fn new_ephemeral( connection_timeout: Duration, behaviour: NB, ) -> Swarm { - let peer_id = PeerId::from(identity.public()); - - let transport = MemoryTransport::default() - .or_transport(libp2p::tcp::tokio::Transport::default()) - .upgrade(Version::V1) - .authenticate(PlainText2Config { - local_public_key: identity.public(), + SwarmBuilder::with_existing_identity(identity) + .with_tokio() + .with_other_transport(|identity| { + MemoryTransport::default() + .or_transport(libp2p::tcp::tokio::Transport::default()) + .upgrade(Version::V1) + .authenticate(PlainTextConfig::new(identity)) + .multiplex(yamux::Config::default()) + .timeout(connection_timeout) + .boxed() }) - .multiplex(yamux::Config::default()) - .timeout(connection_timeout) - .boxed(); - - SwarmBuilder::without_executor(transport, behaviour, peer_id).build() + .unwrap() + .with_behaviour(move |_keypair| behaviour) + .unwrap() + .build() } diff --git a/crates/subspace-networking/src/utils/unique_record_binary_heap.rs b/crates/subspace-networking/src/utils/unique_record_binary_heap.rs index 3aab363241..f66163d29f 100644 --- a/crates/subspace-networking/src/utils/unique_record_binary_heap.rs +++ b/crates/subspace-networking/src/utils/unique_record_binary_heap.rs @@ -2,8 +2,8 @@ mod tests; use crate::utils::multihash::ToMultihash; -pub use libp2p::kad::record::Key; use libp2p::kad::KBucketDistance; +pub use libp2p::kad::RecordKey; pub use libp2p::PeerId; use std::cmp::Ordering; use std::collections::BTreeSet; @@ -20,7 +20,7 @@ struct RecordHeapKey { impl RecordHeapKey where - Key: From, + RecordKey: From, K: Clone, { fn peer_distance(&self) -> KBucketDistance { @@ -28,21 +28,21 @@ where } fn new(peer_key: &KademliaBucketKey, key: K) -> Self { - let peer_distance = KademliaBucketKey::new(Key::from(key.clone())).distance(peer_key); + let peer_distance = KademliaBucketKey::new(RecordKey::from(key.clone())).distance(peer_key); Self { peer_distance, key } } } impl Eq for RecordHeapKey where - Key: From, + RecordKey: From, K: Clone, { } impl PartialEq for RecordHeapKey where - Key: From, + RecordKey: From, K: Clone, { fn eq(&self, other: &Self) -> bool { @@ -52,7 +52,7 @@ where impl PartialOrd for RecordHeapKey where - Key: From, + RecordKey: From, K: Clone, { fn partial_cmp(&self, other: &Self) -> Option { @@ -62,7 +62,7 @@ where impl Ord for RecordHeapKey where - Key: From, + RecordKey: From, K: Clone, { fn cmp(&self, other: &Self) -> Ordering { @@ -75,7 +75,7 @@ where #[derive(Debug, Copy, Clone)] pub struct KeyWrapper(pub T); -impl From> for Key { +impl From> for RecordKey { fn from(value: KeyWrapper) -> Self { value.0.to_multihash().into() } @@ -87,7 +87,7 @@ impl From> for Key { /// It maintains limited size and evicts (pops) items when this limited is exceeded. /// Unique keys are only inserted once. #[derive(Clone, Debug)] -pub struct UniqueRecordBinaryHeap { +pub struct UniqueRecordBinaryHeap { peer_key: KademliaBucketKey, set: BTreeSet>, limit: usize, @@ -95,7 +95,7 @@ pub struct UniqueRecordBinaryHeap { impl UniqueRecordBinaryHeap where - Key: From, + RecordKey: From, K: Clone, { /// Constructs a heap with given PeerId and size limit. diff --git a/crates/subspace-networking/src/utils/unique_record_binary_heap/tests.rs b/crates/subspace-networking/src/utils/unique_record_binary_heap/tests.rs index 7da88e956e..a26bdb87dc 100644 --- a/crates/subspace-networking/src/utils/unique_record_binary_heap/tests.rs +++ b/crates/subspace-networking/src/utils/unique_record_binary_heap/tests.rs @@ -1,6 +1,6 @@ use crate::utils::multihash::Multihash; use crate::utils::unique_record_binary_heap::UniqueRecordBinaryHeap; -use libp2p::kad::record::Key; +use libp2p::kad::RecordKey; use libp2p::PeerId; #[test] @@ -10,8 +10,8 @@ fn binary_heap_insert_works() { assert_eq!(heap.size(), 0); - let key1 = Key::from(vec![1]); - let key2 = Key::from(vec![2]); + let key1 = RecordKey::from(vec![1]); + let key2 = RecordKey::from(vec![2]); heap.insert(key1); assert_eq!(heap.size(), 1); @@ -29,8 +29,8 @@ fn binary_heap_remove_works() { let peer_id = PeerId::random(); let mut heap = UniqueRecordBinaryHeap::new(peer_id, 10); - let key1 = Key::from(vec![1]); - let key2 = Key::from(vec![2]); + let key1 = RecordKey::from(vec![1]); + let key2 = RecordKey::from(vec![2]); heap.insert(key1.clone()); assert_eq!(heap.size(), 1); @@ -47,8 +47,8 @@ fn binary_heap_limit_works() { let peer_id = PeerId::from_multihash(Multihash::wrap(0, [0u8].as_slice()).unwrap()).unwrap(); let mut heap = UniqueRecordBinaryHeap::new(peer_id, 1); - let key1 = Key::from(vec![1]); - let key2 = Key::from(vec![2]); + let key1 = RecordKey::from(vec![1]); + let key2 = RecordKey::from(vec![2]); let evicted = heap.insert(key1); assert!(evicted.is_none()); @@ -66,16 +66,16 @@ fn binary_heap_eviction_works() { let peer_id = PeerId::from_multihash(Multihash::wrap(0, [0u8].as_slice()).unwrap()).unwrap(); let mut heap = UniqueRecordBinaryHeap::new(peer_id, 1); - let key1 = Key::from(vec![1]); - let key2 = Key::from(vec![2]); + let key1 = RecordKey::from(vec![1]); + let key2 = RecordKey::from(vec![2]); heap.insert(key1.clone()); let should_be_evicted = heap.should_include_key(key2.clone()); let evicted = heap.insert(key2.clone()); assert!(evicted.is_some()); - let bucket_key1: KademliaBucketKey = KademliaBucketKey::new(key1.clone()); - let bucket_key2: KademliaBucketKey = KademliaBucketKey::new(key2.clone()); + let bucket_key1 = KademliaBucketKey::::new(key1.clone()); + let bucket_key2 = KademliaBucketKey::::new(key2.clone()); let evicted = evicted.unwrap(); if bucket_key1.distance::>(&KademliaBucketKey::from(peer_id)) @@ -95,7 +95,7 @@ fn binary_heap_should_include_key_works() { let mut heap = UniqueRecordBinaryHeap::new(peer_id, 1); // Limit not reached - let key1 = Key::from(vec![1]); + let key1 = RecordKey::from(vec![1]); assert!(heap.should_include_key(key1.clone())); // Limit reached and key is not "less" than top key @@ -103,6 +103,6 @@ fn binary_heap_should_include_key_works() { assert!(!heap.should_include_key(key1)); // Limit reached and key is "less" than top key - let key2 = Key::from(vec![2]); + let key2 = RecordKey::from(vec![2]); assert!(heap.should_include_key(key2)); } diff --git a/crates/subspace-node/Cargo.toml b/crates/subspace-node/Cargo.toml index 29e9cb7b2b..5d75269848 100644 --- a/crates/subspace-node/Cargo.toml +++ b/crates/subspace-node/Cargo.toml @@ -33,7 +33,7 @@ fp-evm = { version = "3.0.0-dev", git = "https://github.com/subspace/frontier", frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1", default-features = false } frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1", default-features = false } frame-support = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } -futures = "0.3.28" +futures = "0.3.29" hex = "0.4.3" hex-literal = "0.4.1" log = "0.4.20" diff --git a/crates/subspace-service/Cargo.toml b/crates/subspace-service/Cargo.toml index a4003c9c36..340e3633f5 100644 --- a/crates/subspace-service/Cargo.toml +++ b/crates/subspace-service/Cargo.toml @@ -20,13 +20,13 @@ async-trait = "0.1.73" atomic = "0.5.3" cross-domain-message-gossip = { version = "0.1.0", path = "../../domains/client/cross-domain-message-gossip" } domain-runtime-primitives = { version = "0.1.0", path = "../../domains/primitives/runtime" } -futures = "0.3.28" +futures = "0.3.29" hex = "0.4.3" jsonrpsee = { version = "0.16.3", features = ["server"] } pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } parity-scale-codec = "3.6.5" parking_lot = "0.12.1" -prometheus-client = "0.21.2" +prometheus-client = "0.22.0" sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } diff --git a/domains/client/cross-domain-message-gossip/Cargo.toml b/domains/client/cross-domain-message-gossip/Cargo.toml index 91f1b6d017..3cc8534e2a 100644 --- a/domains/client/cross-domain-message-gossip/Cargo.toml +++ b/domains/client/cross-domain-message-gossip/Cargo.toml @@ -12,7 +12,7 @@ include = [ ] [dependencies] -futures = "0.3.28" +futures = "0.3.29" parity-scale-codec = { version = "3.6.5", features = ["derive"] } parking_lot = "0.12.1" sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } diff --git a/domains/client/domain-operator/Cargo.toml b/domains/client/domain-operator/Cargo.toml index b64c8ed5ad..36fd5a21b4 100644 --- a/domains/client/domain-operator/Cargo.toml +++ b/domains/client/domain-operator/Cargo.toml @@ -9,7 +9,7 @@ codec = { package = "parity-scale-codec", version = "3.6.5", features = ["derive domain-block-builder = { version = "0.1.0", path = "../block-builder" } domain-block-preprocessor = { version = "0.1.0", path = "../block-preprocessor" } domain-runtime-primitives = { version = "0.1.0", path = "../../primitives/runtime" } -futures = "0.3.28" +futures = "0.3.29" futures-timer = "3.0.1" parking_lot = "0.12.1" sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } diff --git a/domains/client/eth-service/Cargo.toml b/domains/client/eth-service/Cargo.toml index 41c2d31af0..2bacd8f6c2 100644 --- a/domains/client/eth-service/Cargo.toml +++ b/domains/client/eth-service/Cargo.toml @@ -22,7 +22,7 @@ fc-rpc = { version = "2.0.0-dev", git = "https://github.com/subspace/frontier", fc-rpc-core = { version = "1.1.0-dev", git = "https://github.com/subspace/frontier", rev = "56086daa77802eaa285894bfe4b811be66629c89" } fc-storage = { version = "1.0.0-dev", git = "https://github.com/subspace/frontier", rev = "56086daa77802eaa285894bfe4b811be66629c89" } fp-rpc = { version = "3.0.0-dev", git = "https://github.com/subspace/frontier", rev = "56086daa77802eaa285894bfe4b811be66629c89", features = ['default'] } -futures = "0.3.28" +futures = "0.3.29" jsonrpsee = { version = "0.16.3", features = ["server"] } pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } diff --git a/domains/client/relayer/Cargo.toml b/domains/client/relayer/Cargo.toml index 81bd2f7aa5..ac4e7928a3 100644 --- a/domains/client/relayer/Cargo.toml +++ b/domains/client/relayer/Cargo.toml @@ -14,7 +14,7 @@ include = [ [dependencies] async-channel = "1.9.0" cross-domain-message-gossip = { path = "../../client/cross-domain-message-gossip" } -futures = "0.3.28" +futures = "0.3.29" parity-scale-codec = { version = "3.6.5", features = ["derive"] } sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } sc-utils = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } diff --git a/domains/client/subnet-gossip/Cargo.toml b/domains/client/subnet-gossip/Cargo.toml index 1542ee27dc..8ddad5bf03 100644 --- a/domains/client/subnet-gossip/Cargo.toml +++ b/domains/client/subnet-gossip/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Liu-Cheng Xu "] edition = "2021" [dependencies] -futures = "0.3.28" +futures = "0.3.29" parity-scale-codec = { version = "3.6.5", features = ["derive"] } parking_lot = "0.12.1" sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } diff --git a/domains/service/Cargo.toml b/domains/service/Cargo.toml index 18cd013d0d..d3b4caf5bd 100644 --- a/domains/service/Cargo.toml +++ b/domains/service/Cargo.toml @@ -21,7 +21,7 @@ domain-client-message-relayer = { version = "0.1.0", path = "../client/relayer" domain-client-operator = { version = "0.1.0", path = "../client/domain-operator" } domain-client-subnet-gossip = { version = "0.1.0", path = "../client/subnet-gossip" } domain-runtime-primitives = { version = "0.1.0", path = "../primitives/runtime" } -futures = "0.3.28" +futures = "0.3.29" jsonrpsee = { version = "0.16.3", features = ["server"] } log = "0.4.20" pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } diff --git a/shared/subspace-metrics/Cargo.toml b/shared/subspace-metrics/Cargo.toml index ff35b0d048..e33028740d 100644 --- a/shared/subspace-metrics/Cargo.toml +++ b/shared/subspace-metrics/Cargo.toml @@ -18,5 +18,5 @@ include = [ actix-web = "4.3.1" parking_lot = "0.12.1" prometheus = { version = "0.13.0", default-features = false } -prometheus-client = "0.21.2" +prometheus-client = "0.22.0" tracing = "0.1.37" diff --git a/test/subspace-test-client/Cargo.toml b/test/subspace-test-client/Cargo.toml index f4620c23a4..679bb26614 100644 --- a/test/subspace-test-client/Cargo.toml +++ b/test/subspace-test-client/Cargo.toml @@ -18,7 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.6.5", features = ["derive"] } evm-domain-test-runtime = { version = "0.1.0", path = "../../domains/test/runtime/evm" } fp-evm = { version = "3.0.0-dev", git = "https://github.com/subspace/frontier", rev = "56086daa77802eaa285894bfe4b811be66629c89" } -futures = "0.3.28" +futures = "0.3.29" schnorrkel = "0.9.1" sc-chain-spec = { git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } sc-client-api = { git = "https://github.com/subspace/polkadot-sdk", rev = "892bf8e938c6bd2b893d3827d1093cd81baa59a1" } diff --git a/test/subspace-test-service/Cargo.toml b/test/subspace-test-service/Cargo.toml index 9212a2a625..3c1a2f474f 100644 --- a/test/subspace-test-service/Cargo.toml +++ b/test/subspace-test-service/Cargo.toml @@ -19,7 +19,7 @@ async-trait = "0.1.73" cross-domain-message-gossip = { version = "0.1.0", path = "../../domains/client/cross-domain-message-gossip" } codec = { package = "parity-scale-codec", version = "3.2.1", features = ["derive"] } domain-runtime-primitives = { version = "0.1.0", path = "../../domains/primitives/runtime" } -futures = "0.3.28" +futures = "0.3.29" futures-timer = "3.0.1" jsonrpsee = { version = "0.16.3", features = ["server"] } rand = "0.8.5"