From ba16fa86c6f11f5e8a963b147180d074d4e80a65 Mon Sep 17 00:00:00 2001 From: Antonio Date: Wed, 5 Aug 2026 14:50:26 +0200 Subject: [PATCH] fix: libp2p-gossipsub vulnerability (#3267) --- Cargo.lock | 234 ++++++++---------- Cargo.toml | 6 +- .../core/with_core/behaviour/handler/mod.rs | 6 - .../core/with_edge/behaviour/handler/mod.rs | 4 - .../src/backends/libp2p/swarm/gossipsub.rs | 2 +- .../network/src/backends/libp2p/swarm/mod.rs | 15 +- 6 files changed, 111 insertions(+), 156 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e16aedc3d..82da26951 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -488,17 +488,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "async-recursion" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.118", -] - [[package]] name = "async-stream" version = "0.3.6" @@ -551,17 +540,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "attohttpc" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" -dependencies = [ - "http 0.2.12", - "log", - "url", -] - [[package]] name = "attohttpc" version = "0.30.1" @@ -569,7 +547,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16e2cdb6d5ed835199484bb92bb8b3edd526effe995c61732580439c1a67e2e9" dependencies = [ "base64 0.22.1", - "http 1.4.2", + "http", "log", "url", ] @@ -590,7 +568,7 @@ dependencies = [ "axum-core 0.4.5", "bytes", "futures-util", - "http 1.4.2", + "http", "http-body", "http-body-util", "hyper", @@ -622,7 +600,7 @@ dependencies = [ "axum-core 0.5.6", "bytes", "futures-util", - "http 1.4.2", + "http", "http-body", "http-body-util", "itoa", @@ -647,7 +625,7 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.4.2", + "http", "http-body", "http-body-util", "mime", @@ -666,7 +644,7 @@ checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" dependencies = [ "bytes", "futures-core", - "http 1.4.2", + "http", "http-body", "http-body-util", "mime", @@ -1332,6 +1310,12 @@ dependencies = [ "itertools 0.10.5", ] +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + [[package]] name = "crossbeam-channel" version = "0.5.15" @@ -2018,6 +2002,18 @@ dependencies = [ "once_cell", ] +[[package]] +name = "fastbloom" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7f34442dbe69c60fe8eaf58a8cafff81a1f278816d8ab4db255b3bef4ac3c4" +dependencies = [ + "getrandom 0.3.4", + "libm", + "rand 0.9.4", + "siphasher", +] + [[package]] name = "fastrand" version = "2.4.1" @@ -2420,7 +2416,7 @@ dependencies = [ "fnv", "futures-core", "futures-sink", - "http 1.4.2", + "http", "indexmap", "slab", "tokio", @@ -2455,7 +2451,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "allocator-api2", - "equivalent", "foldhash 0.1.5", ] @@ -2491,6 +2486,15 @@ dependencies = [ "hashbrown 0.14.5", ] +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + [[package]] name = "hdrhistogram" version = "7.5.4" @@ -2530,11 +2534,10 @@ checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" [[package]] name = "hickory-proto" -version = "0.25.0-alpha.5" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d00147af6310f4392a31680db52a3ed45a2e0f68eb18e8c3fe5537ecc96d9e2" +checksum = "f8a6fe56c0038198998a6f217ca4e7ef3a5e51f46163bd6dd60b5c71ca6c6502" dependencies = [ - "async-recursion", "async-trait", "cfg-if", "data-encoding", @@ -2546,6 +2549,7 @@ dependencies = [ "ipnet", "once_cell", "rand 0.9.4", + "ring", "socket2 0.5.10", "thiserror 2.0.18", "tinyvec", @@ -2556,9 +2560,9 @@ dependencies = [ [[package]] name = "hickory-resolver" -version = "0.25.0-alpha.5" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5762f69ebdbd4ddb2e975cd24690bf21fe6b2604039189c26acddbc427f12887" +checksum = "dc62a9a99b0bfb44d2ab95a7208ac952d31060efc16241c87eaf36406fecf87a" dependencies = [ "cfg-if", "futures-util", @@ -2624,17 +2628,6 @@ dependencies = [ "windows-link 0.2.1", ] -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.4.2" @@ -2652,7 +2645,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.4.2", + "http", ] [[package]] @@ -2663,7 +2656,7 @@ checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", "futures-core", - "http 1.4.2", + "http", "http-body", "pin-project-lite", ] @@ -2706,7 +2699,7 @@ dependencies = [ "futures-channel", "futures-core", "h2", - "http 1.4.2", + "http", "http-body", "httparse", "httpdate", @@ -2723,7 +2716,7 @@ version = "0.27.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" dependencies = [ - "http 1.4.2", + "http", "hyper", "hyper-util", "log", @@ -2774,7 +2767,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.4.2", + "http", "http-body", "hyper", "ipnet", @@ -2953,27 +2946,6 @@ dependencies = [ "windows 0.62.2", ] -[[package]] -name = "igd-next" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76b0d7d4541def58a37bf8efc559683f21edce7c82f0d866c93ac21f7e098f93" -dependencies = [ - "async-trait", - "attohttpc 0.24.1", - "bytes", - "futures", - "http 1.4.2", - "http-body-util", - "hyper", - "hyper-util", - "log", - "rand 0.8.6", - "tokio", - "url", - "xmltree", -] - [[package]] name = "igd-next" version = "0.16.2" @@ -2981,10 +2953,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "516893339c97f6011282d5825ac94fc1c7aad5cad26bdc2d0cee068c0bf97f97" dependencies = [ "async-trait", - "attohttpc 0.30.1", + "attohttpc", "bytes", "futures", - "http 1.4.2", + "http", "http-body-util", "hyper", "hyper-util", @@ -3336,7 +3308,7 @@ dependencies = [ "bytes", "either", "futures", - "http 1.4.2", + "http", "http-body", "http-body-util", "hyper", @@ -3369,7 +3341,7 @@ checksum = "f126d2db7a8b532ec1d839ece2a71e2485dc3bbca6cc3c3f929becaa810e719e" dependencies = [ "derive_more", "form_urlencoded", - "http 1.4.2", + "http", "jiff", "json-patch", "k8s-openapi", @@ -3436,9 +3408,9 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libp2p" -version = "0.55.0" +version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72dc443ddd0254cb49a794ed6b6728400ee446a0f7ab4a07d0209ee98de20e9" +checksum = "ce71348bf5838e46449ae240631117b487073d5f347c06d434caddcb91dceb5a" dependencies = [ "bytes", "either", @@ -3470,9 +3442,9 @@ dependencies = [ [[package]] name = "libp2p-allow-block-list" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38944b7cb981cc93f2f0fb411ff82d0e983bd226fbcc8d559639a3a73236568b" +checksum = "d16ccf824ee859ca83df301e1c0205270206223fd4b1f2e512a693e1912a8f4a" dependencies = [ "libp2p-core", "libp2p-identity", @@ -3481,9 +3453,9 @@ dependencies = [ [[package]] name = "libp2p-autonat" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e297bfc6cabb70c6180707f8fa05661b77ecb9cb67e8e8e1c469301358fa21d0" +checksum = "fab5e25c49a7d48dac83d95d8f3bac0a290d8a5df717012f6e34ce9886396c0b" dependencies = [ "async-trait", "asynchronous-codec", @@ -3506,9 +3478,9 @@ dependencies = [ [[package]] name = "libp2p-connection-limits" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efe9323175a17caa8a2ed4feaf8a548eeef5e0b72d03840a0eab4bcb0210ce1c" +checksum = "a18b8b607cf3bfa2f8c57db9c7d8569a315d5cc0a282e6bfd5ebfc0a9840b2a0" dependencies = [ "libp2p-core", "libp2p-identity", @@ -3542,9 +3514,9 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b780a1150214155b0ed1cdf09fbd2e1b0442604f9146a431d1b21d23eef7bd7" +checksum = "0b770c1c8476736ca98c578cba4b505104ff8e842c2876b528925f9766379f9a" dependencies = [ "async-trait", "futures", @@ -3558,9 +3530,9 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.48.0" +version = "0.49.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d558548fa3b5a8e9b66392f785921e363c57c05dcadfda4db0d41ae82d313e4a" +checksum = "3573f3d8e30bd62cda336df5c7c1041a1caa40a648376b8e1e274d585c0ed25c" dependencies = [ "async-channel", "asynchronous-codec", @@ -3572,12 +3544,11 @@ dependencies = [ "futures", "futures-timer", "getrandom 0.2.17", - "hashlink", + "hashlink 0.9.1", "hex_fmt", "libp2p-core", "libp2p-identity", "libp2p-swarm", - "prometheus-client", "quick-protobuf", "quick-protobuf-codec", "rand 0.8.6", @@ -3590,9 +3561,9 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.46.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c06862544f02d05d62780ff590cc25a75f5c2b9df38ec7a370dcae8bb873cf" +checksum = "8ab792a8b68fdef443a62155b01970c81c3aadab5e659621b063ef252a8e65e8" dependencies = [ "asynchronous-codec", "either", @@ -3632,9 +3603,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bab0466a27ebe955bcbc27328fae5429c5b48c915fd6174931414149802ec23" +checksum = "13d3fd632a5872ec804d37e7413ceea20588f69d027a0fa3c46f82574f4dee60" dependencies = [ "asynchronous-codec", "bytes", @@ -3660,9 +3631,9 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d0ba095e1175d797540e16b62e7576846b883cb5046d4159086837b36846cc" +checksum = "c66872d0f1ffcded2788683f76931be1c52e27f343edb93bc6d0bcd8887be443" dependencies = [ "futures", "hickory-proto", @@ -3679,9 +3650,9 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ce58c64292e87af624fcb86465e7dd8342e46a388d71e8fec0ab37ee789630a" +checksum = "805a555148522cb3414493a5153451910cb1a146c53ffbf4385708349baf62b7" dependencies = [ "futures", "libp2p-core", @@ -3713,9 +3684,9 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.12.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41432a159b00424a0abaa2c80d786cddff81055ac24aa127e0cf375f7858d880" +checksum = "9dcc597d70bf7f6f30cbe07081802c836184e48416e89e9ce73a0ba2c56a319e" dependencies = [ "futures", "futures-timer", @@ -3724,6 +3695,7 @@ dependencies = [ "libp2p-identity", "libp2p-tls", "quinn", + "quinn-proto", "rand 0.8.6", "ring", "rustls", @@ -3735,9 +3707,9 @@ dependencies = [ [[package]] name = "libp2p-request-response" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "548fe44a80ff275d400f1b26b090d441d83ef73efabbeb6415f4ce37e5aed865" +checksum = "a9f1cca83488b90102abac7b67d5c36fc65bc02ed47620228af7ed002e6a1478" dependencies = [ "async-trait", "futures", @@ -3752,9 +3724,9 @@ dependencies = [ [[package]] name = "libp2p-stream" -version = "0.3.0-alpha" +version = "0.4.0-alpha" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826716f1ee125895f1fb44911413cba023485b552ff96c7a2159bd037ac619bb" +checksum = "1d6bd8025c80205ec2810cfb28b02f362ab48a01bee32c50ab5f12761e033464" dependencies = [ "futures", "libp2p-core", @@ -3766,20 +3738,19 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.46.0" +version = "0.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "803399b4b6f68adb85e63ab573ac568154b193e9a640f03e0f2890eabbcb37f8" +checksum = "ce88c6c4bf746c8482480345ea3edfd08301f49e026889d1cbccfa1808a9ed9e" dependencies = [ "either", "fnv", "futures", "futures-timer", + "hashlink 0.10.0", "libp2p-core", "libp2p-identity", "libp2p-swarm-derive", - "lru", "multistream-select", - "once_cell", "rand 0.8.6", "smallvec", "tokio", @@ -3789,21 +3760,20 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.35.0" +version = "0.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206e0aa0ebe004d778d79fb0966aa0de996c19894e2c0605ba2f8524dd4443d8" +checksum = "dd297cf53f0cb3dee4d2620bb319ae47ef27c702684309f682bdb7e55a18ae9c" dependencies = [ "heck", - "proc-macro2", "quote", "syn 2.0.118", ] [[package]] name = "libp2p-swarm-test" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb6354e3a50496d750805f6cf33679bd698850d535602f42c61e465e0734d0b" +checksum = "7b149112570d507efe305838c7130835955a0b1147aa8051c1c3867a83175cf6" dependencies = [ "async-trait", "futures", @@ -3819,16 +3789,16 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.43.0" +version = "0.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65346fb4d36035b23fec4e7be4c320436ba53537ce9b6be1d1db1f70c905cad0" +checksum = "fb6585b9309699f58704ec9ab0bb102eca7a3777170fa91a8678d73ca9cafa93" dependencies = [ "futures", "futures-timer", "if-watch", "libc", "libp2p-core", - "socket2 0.5.10", + "socket2 0.6.4", "tokio", "tracing", ] @@ -3854,13 +3824,13 @@ dependencies = [ [[package]] name = "libp2p-upnp" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d457b9ecceb66e7199f049926fad447f1f17f040e8d29d690c086b4cab8ed14a" +checksum = "4757e65fe69399c1a243bbb90ec1ae5a2114b907467bf09f3575e899815bb8d3" dependencies = [ "futures", "futures-timer", - "igd-next 0.15.1", + "igd-next", "libp2p-core", "libp2p-swarm", "tokio", @@ -4772,7 +4742,7 @@ dependencies = [ "either", "futures", "hex", - "igd-next 0.16.2", + "igd-next", "libp2p", "libp2p-swarm-test", "logos-blockchain-cryptarchia-sync", @@ -4872,7 +4842,7 @@ dependencies = [ "dhat", "futures", "hex", - "http 1.4.2", + "http", "libp2p", "logos-blockchain-api-service", "logos-blockchain-blend", @@ -5434,9 +5404,6 @@ name = "lru" version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" -dependencies = [ - "hashbrown 0.15.5", -] [[package]] name = "lru-slab" @@ -6092,6 +6059,10 @@ name = "once_cell" version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +dependencies = [ + "critical-section", + "portable-atomic", +] [[package]] name = "once_cell_polyfill" @@ -6181,7 +6152,7 @@ checksum = "d7a6d09a73194e6b66df7c8f1b680f156d916a1a942abf2de06823dd02b7855d" dependencies = [ "async-trait", "bytes", - "http 1.4.2", + "http", "opentelemetry", "reqwest", ] @@ -6192,7 +6163,7 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f69cd6acbb9af919df949cd1ec9e5e7fdc2ef15d234b6b795aaa525cc02f71f" dependencies = [ - "http 1.4.2", + "http", "opentelemetry", "opentelemetry-http", "opentelemetry-proto", @@ -6690,9 +6661,9 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.22.3" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504ee9ff529add891127c4827eb481bd69dc0ebc72e9a682e187db4caa60c3ca" +checksum = "cf41c1a7c32ed72abe5082fb19505b969095c12da9f5732a4bc9878757fd087c" dependencies = [ "dtoa", "itoa", @@ -6955,6 +6926,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fcb935c5bec503c2f0e306bdd3e58bb9029dcb14fa8d9ac76e3a5256ac0763e" dependencies = [ "bytes", + "fastbloom", "getrandom 0.3.4", "lru-slab", "rand 0.9.4", @@ -7234,7 +7206,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http 1.4.2", + "http", "http-body", "http-body-util", "hyper", @@ -8810,7 +8782,7 @@ dependencies = [ "base64 0.22.1", "bytes", "h2", - "http 1.4.2", + "http", "http-body", "http-body-util", "hyper", @@ -8883,7 +8855,7 @@ dependencies = [ "bitflags 2.13.0", "bytes", "futures-util", - "http 1.4.2", + "http", "http-body", "http-body-util", "mime", @@ -9222,7 +9194,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e994ba84b0bd1b1b0cf92878b7ef898a5c1760108fe7b6010327e274917a808c" dependencies = [ "base64 0.22.1", - "http 1.4.2", + "http", "httparse", "log", ] diff --git a/Cargo.toml b/Cargo.toml index 504d991be..9383b0008 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -217,9 +217,9 @@ humantime = { default-features = false, version = "2.1" igd-next = { default-features = false, version = "0.16.1" } indexmap = { default-features = false, version = "2.14.0" } itertools = { default-features = false, version = "0.14" } -libp2p = { default-features = false, version = "0.55" } -libp2p-stream = { default-features = false, version = "0.3.0-alpha" } -libp2p-swarm-test = { default-features = false, version = "0.5" } +libp2p = { default-features = false, version = "0.56" } +libp2p-stream = { default-features = false, version = "0.4.0-alpha" } +libp2p-swarm-test = { default-features = false, version = "0.6" } log = { default-features = false, version = "0.4" } lru = { default-features = false, version = "0.12" } multiaddr = { default-features = false, version = "0.18" } diff --git a/blend/network/src/core/with_core/behaviour/handler/mod.rs b/blend/network/src/core/with_core/behaviour/handler/mod.rs index aa7b4d0a4..b8141a849 100644 --- a/blend/network/src/core/with_core/behaviour/handler/mod.rs +++ b/blend/network/src/core/with_core/behaviour/handler/mod.rs @@ -162,12 +162,10 @@ where type OutboundProtocol = ReadyUpgrade; type OutboundOpenInfo = (); - #[expect(deprecated, reason = "Self::InboundOpenInfo is deprecated")] fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(ReadyUpgrade::new(self.protocol_name.clone()), ()) } - #[expect(deprecated, reason = "Self::OutboundOpenInfo is deprecated")] #[expect(clippy::too_many_lines, reason = "TODO: Address this at some point.")] #[expect( clippy::cognitive_complexity, @@ -346,10 +344,6 @@ where } } - #[expect( - deprecated, - reason = "Self::InboundOpenInfo and Self::OutboundOpenInfo are deprecated" - )] #[expect( clippy::cognitive_complexity, reason = "TODO: address this in a dedicated refactor" diff --git a/blend/network/src/core/with_edge/behaviour/handler/mod.rs b/blend/network/src/core/with_edge/behaviour/handler/mod.rs index 4bd760805..6f51285df 100644 --- a/blend/network/src/core/with_edge/behaviour/handler/mod.rs +++ b/blend/network/src/core/with_edge/behaviour/handler/mod.rs @@ -29,7 +29,6 @@ const LOG_TARGET: &str = blend::network::core::handler::CORE_EDGE; type TimerFuture = Pin + Send>>; type MessageReceiveFuture = Pin, io::Error>> + Send>>; -#[expect(deprecated, reason = "Self::InboundOpenInfo is deprecated")] type PollResult = ( Poll< ConnectionHandlerEvent< @@ -40,7 +39,6 @@ type PollResult = ( >, T, ); -#[expect(deprecated, reason = "Self::InboundOpenInfo is deprecated")] type ConnectionEvent<'a> = libp2p::swarm::handler::ConnectionEvent< 'a, ::InboundProtocol, @@ -147,7 +145,6 @@ impl libp2p::swarm::ConnectionHandler for ConnectionHandler { type OutboundProtocol = DeniedUpgrade; type OutboundOpenInfo = (); - #[expect(deprecated, reason = "Self::InboundOpenInfo is deprecated")] fn listen_protocol(&self) -> SubstreamProtocol { SubstreamProtocol::new(ReadyUpgrade::new(self.protocol_name.clone()), ()) } @@ -171,7 +168,6 @@ impl libp2p::swarm::ConnectionHandler for ConnectionHandler { self.state = Some(state.on_connection_event(event)); } - #[expect(deprecated, reason = "Self::InboundOpenInfo is deprecated")] fn poll( &mut self, cx: &mut Context<'_>, diff --git a/services/network/src/backends/libp2p/swarm/gossipsub.rs b/services/network/src/backends/libp2p/swarm/gossipsub.rs index 9717833f6..31eeaf944 100644 --- a/services/network/src/backends/libp2p/swarm/gossipsub.rs +++ b/services/network/src/backends/libp2p/swarm/gossipsub.rs @@ -81,7 +81,7 @@ impl SwarmHandler { })); } } - Err(gossipsub::PublishError::InsufficientPeers) if retry_count < MAX_RETRY => { + Err(gossipsub::PublishError::NoPeersSubscribedToTopic) if retry_count < MAX_RETRY => { let wait = exp_backoff(retry_count); tracing::trace!( target: LOG_TARGET, diff --git a/services/network/src/backends/libp2p/swarm/mod.rs b/services/network/src/backends/libp2p/swarm/mod.rs index af96c1518..1e5e545b6 100644 --- a/services/network/src/backends/libp2p/swarm/mod.rs +++ b/services/network/src/backends/libp2p/swarm/mod.rs @@ -201,8 +201,8 @@ impl SwarmHandler { // (not our own `connect()`), so they have no `pending_dials` // entry and would otherwise be re-dialed forever. Evict the // stale address from Kademlia immediately instead of retrying. - DialError::WrongPeerId { obtained, endpoint } => { - let dial_addr = endpoint.get_remote_address(); + DialError::WrongPeerId { obtained, address } => { + let dial_addr = &address; tracing::debug!( target: LOG_TARGET, "Evicting stale address after WrongPeerId (expected {peer_id:?}, obtained {obtained}): {dial_addr}" @@ -371,10 +371,7 @@ const fn exp_backoff(retry: usize) -> Duration { mod tests { use std::{collections::HashSet, net::Ipv4Addr, sync::Once, time::Instant}; - use lb_libp2p::{ - libp2p::core::{ConnectedPoint, Endpoint, transport::PortUse}, - protocol_name::StreamProtocol, - }; + use lb_libp2p::protocol_name::StreamProtocol; use lb_utils::net::get_available_udp_port; use rand::rngs::OsRng; use tracing_subscriber::EnvFilter; @@ -719,11 +716,7 @@ mod tests { connection_id: ConnectionId::new_unchecked(1), error: DialError::WrongPeerId { obtained: obtained_peer, - endpoint: ConnectedPoint::Dialer { - address: remote_addr.clone(), - role_override: Endpoint::Dialer, - port_use: PortUse::Reuse, - }, + address: remote_addr.clone(), }, };