diff --git a/Cargo.lock b/Cargo.lock index ec16d733bc6..6dd6951b5da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,6 +52,18 @@ dependencies = [ "subtle", ] +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -337,7 +349,7 @@ version = "0.1.0" dependencies = [ "clap", "futures", - "libp2p", + "libp2p 0.56.0", "tokio", "tracing-subscriber", ] @@ -348,7 +360,7 @@ version = "0.1.0" dependencies = [ "cfg-if", "clap", - "libp2p", + "libp2p 0.56.0", "opentelemetry-jaeger", "opentelemetry_sdk 0.21.2", "rand 0.8.5", @@ -514,7 +526,7 @@ dependencies = [ "axum", "futures", "js-sys", - "libp2p", + "libp2p 0.56.0", "libp2p-webrtc", "libp2p-webrtc-websys", "mime_guess", @@ -658,7 +670,7 @@ name = "chat-example" version = "0.1.0" dependencies = [ "futures", - "libp2p", + "libp2p 0.56.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio", "tracing-subscriber", ] @@ -1022,7 +1034,7 @@ dependencies = [ "clap", "futures", "futures-timer", - "libp2p", + "libp2p 0.56.0", "tokio", "tracing", "tracing-subscriber", @@ -1125,7 +1137,7 @@ name = "distributed-key-value-store-example" version = "0.1.0" dependencies = [ "futures", - "libp2p", + "libp2p 0.56.0", "tokio", "tracing-subscriber", ] @@ -1320,7 +1332,7 @@ version = "0.1.0" dependencies = [ "clap", "futures", - "libp2p", + "libp2p 0.56.0", "serde", "tokio", "tracing-subscriber", @@ -1660,6 +1672,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.15.2" @@ -1671,6 +1692,15 @@ dependencies = [ "foldhash", ] +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "hashlink" version = "0.10.0" @@ -1795,7 +1825,7 @@ dependencies = [ "either", "env_logger 0.11.8", "futures", - "libp2p", + "libp2p 0.56.0", "redis", "serde", "serde_json", @@ -2088,7 +2118,7 @@ name = "identify-example" version = "0.1.0" dependencies = [ "futures", - "libp2p", + "libp2p 0.56.0", "tokio", "tracing-subscriber", ] @@ -2233,10 +2263,10 @@ dependencies = [ "console_error_panic_hook", "futures", "futures-timer", - "libp2p", + "libp2p 0.56.0", "libp2p-mplex", - "libp2p-noise", - "libp2p-tls", + "libp2p-noise 0.46.1", + "libp2p-tls 0.6.2", "libp2p-webrtc", "libp2p-webrtc-websys", "mime_guess", @@ -2276,7 +2306,7 @@ dependencies = [ "anyhow", "clap", "futures", - "libp2p", + "libp2p 0.56.0", "tokio", "tracing-subscriber", ] @@ -2287,7 +2317,7 @@ version = "0.1.0" dependencies = [ "either", "futures", - "libp2p", + "libp2p 0.56.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio", "tracing-subscriber", ] @@ -2429,59 +2459,106 @@ dependencies = [ "futures", "futures-timer", "getrandom 0.2.15", - "libp2p-allow-block-list", + "libp2p-allow-block-list 0.6.0", "libp2p-autonat", - "libp2p-connection-limits", - "libp2p-core", + "libp2p-connection-limits 0.6.0", + "libp2p-core 0.43.1", "libp2p-dcutr", - "libp2p-dns", + "libp2p-dns 0.44.0", "libp2p-floodsub", - "libp2p-gossipsub", - "libp2p-identify", + "libp2p-gossipsub 0.50.0", + "libp2p-identify 0.47.0", "libp2p-identity", - "libp2p-kad", - "libp2p-mdns", + "libp2p-kad 0.49.0", + "libp2p-mdns 0.48.0", "libp2p-memory-connection-limits", - "libp2p-metrics", + "libp2p-metrics 0.17.0", "libp2p-mplex", - "libp2p-noise", - "libp2p-ping", - "libp2p-plaintext", - "libp2p-pnet", - "libp2p-quic", + "libp2p-noise 0.46.1", + "libp2p-ping 0.47.0", + "libp2p-plaintext 0.43.0", + "libp2p-pnet 0.26.0", + "libp2p-quic 0.13.0", "libp2p-relay", "libp2p-rendezvous", "libp2p-request-response", - "libp2p-swarm", - "libp2p-tcp", - "libp2p-tls", + "libp2p-swarm 0.47.0", + "libp2p-tcp 0.44.0", + "libp2p-tls 0.6.2", "libp2p-uds", - "libp2p-upnp", + "libp2p-upnp 0.5.0", "libp2p-webrtc-websys", - "libp2p-websocket", + "libp2p-websocket 0.45.2", "libp2p-websocket-websys", "libp2p-webtransport-websys", - "libp2p-yamux", + "libp2p-yamux 0.47.0", "multiaddr", "pin-project", - "rw-stream-sink", + "rw-stream-sink 0.4.0", "thiserror 2.0.12", "tokio", "tracing-subscriber", ] +[[package]] +name = "libp2p" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce71348bf5838e46449ae240631117b487073d5f347c06d434caddcb91dceb5a" +dependencies = [ + "bytes", + "either", + "futures", + "futures-timer", + "getrandom 0.2.15", + "libp2p-allow-block-list 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-connection-limits 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-dns 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-gossipsub 0.49.2", + "libp2p-identify 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-kad 0.48.0", + "libp2p-mdns 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-metrics 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-noise 0.46.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-pnet 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-quic 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tcp 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-upnp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-websocket 0.45.1", + "libp2p-yamux 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "multiaddr", + "pin-project", + "rw-stream-sink 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 2.0.12", +] + [[package]] name = "libp2p-allow-block-list" version = "0.6.0" dependencies = [ - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-swarm", - "libp2p-swarm-derive", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0", + "libp2p-swarm-derive 0.35.1", + "libp2p-swarm-test 0.6.0", "tokio", ] +[[package]] +name = "libp2p-allow-block-list" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d16ccf824ee859ca83df301e1c0205270206223fd4b1f2e512a693e1912a8f4a" +dependencies = [ + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "libp2p-autonat" version = "0.15.0" @@ -2492,14 +2569,14 @@ dependencies = [ "futures", "futures-bounded", "futures-timer", - "libp2p-core", - "libp2p-identify", + "libp2p-core 0.43.1", + "libp2p-identify 0.47.0", "libp2p-identity", "libp2p-request-response", - "libp2p-swarm", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", "quick-protobuf", - "quick-protobuf-codec", + "quick-protobuf-codec 0.3.1", "rand 0.8.5", "rand_core 0.6.4", "thiserror 2.0.12", @@ -2513,18 +2590,29 @@ dependencies = [ name = "libp2p-connection-limits" version = "0.6.0" dependencies = [ - "libp2p-core", - "libp2p-identify", + "libp2p-core 0.43.1", + "libp2p-identify 0.47.0", "libp2p-identity", - "libp2p-ping", - "libp2p-swarm", - "libp2p-swarm-derive", - "libp2p-swarm-test", + "libp2p-ping 0.47.0", + "libp2p-swarm 0.47.0", + "libp2p-swarm-derive 0.35.1", + "libp2p-swarm-test 0.6.0", "quickcheck-ext", "rand 0.8.5", "tokio", ] +[[package]] +name = "libp2p-connection-limits" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18b8b607cf3bfa2f8c57db9c7d8569a315d5cc0a282e6bfd5ebfc0a9840b2a0" +dependencies = [ + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "libp2p-core" version = "0.43.1" @@ -2535,19 +2623,44 @@ dependencies = [ "futures-timer", "libp2p-identity", "libp2p-mplex", - "libp2p-noise", + "libp2p-noise 0.46.1", "multiaddr", "multihash", - "multistream-select", + "multistream-select 0.13.0", "parking_lot", "pin-project", "quick-protobuf", "rand 0.8.5", - "rw-stream-sink", + "rw-stream-sink 0.4.0", "thiserror 2.0.12", "tokio", "tracing", - "unsigned-varint", + "unsigned-varint 0.8.0", + "web-time 1.1.0", +] + +[[package]] +name = "libp2p-core" +version = "0.43.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d28e2d2def7c344170f5c6450c0dbe3dfef655610dbfde2f6ac28a527abbe36" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "libp2p-identity", + "multiaddr", + "multihash", + "multistream-select 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot", + "pin-project", + "quick-protobuf", + "rand 0.8.5", + "rw-stream-sink 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 2.0.12", + "tracing", + "unsigned-varint 0.8.0", "web-time 1.1.0", ] @@ -2560,18 +2673,18 @@ dependencies = [ "futures", "futures-bounded", "futures-timer", - "libp2p-core", - "libp2p-identify", + "libp2p-core 0.43.1", + "libp2p-identify 0.47.0", "libp2p-identity", - "libp2p-plaintext", + "libp2p-plaintext 0.43.0", "libp2p-relay", - "libp2p-swarm", - "libp2p-swarm-test", - "libp2p-tcp", - "libp2p-yamux", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", + "libp2p-tcp 0.44.0", + "libp2p-yamux 0.47.0", "lru", "quick-protobuf", - "quick-protobuf-codec", + "quick-protobuf-codec 0.3.1", "thiserror 2.0.12", "tokio", "tracing", @@ -2586,7 +2699,7 @@ dependencies = [ "async-trait", "futures", "hickory-resolver", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", "parking_lot", "smallvec", @@ -2595,6 +2708,22 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "libp2p-dns" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b770c1c8476736ca98c578cba4b505104ff8e842c2876b528925f9766379f9a" +dependencies = [ + "async-trait", + "futures", + "hickory-resolver", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "parking_lot", + "smallvec", + "tracing", +] + [[package]] name = "libp2p-floodsub" version = "0.47.0" @@ -2604,17 +2733,47 @@ dependencies = [ "cuckoofilter", "fnv", "futures", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-swarm", + "libp2p-swarm 0.47.0", "quick-protobuf", - "quick-protobuf-codec", + "quick-protobuf-codec 0.3.1", "rand 0.8.5", "smallvec", "thiserror 2.0.12", "tracing", ] +[[package]] +name = "libp2p-gossipsub" +version = "0.49.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f58e37d8d6848e5c4c9e3c35c6f61133235bff2960c9c00a663b0849301221" +dependencies = [ + "async-channel", + "asynchronous-codec", + "base64", + "byteorder", + "bytes", + "either", + "fnv", + "futures", + "futures-timer", + "getrandom 0.2.15", + "hashlink 0.9.1", + "hex_fmt", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-protobuf", + "quick-protobuf-codec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.8.5", + "regex", + "sha2", + "tracing", + "web-time 1.1.0", +] + [[package]] name = "libp2p-gossipsub" version = "0.50.0" @@ -2629,15 +2788,15 @@ dependencies = [ "futures", "futures-timer", "getrandom 0.2.15", - "hashlink", + "hashlink 0.10.0", "hex_fmt", - "libp2p-core", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", "libp2p-identity", - "libp2p-swarm", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm-test 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "prometheus-client", "quick-protobuf", - "quick-protobuf-codec", + "quick-protobuf-codec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck-ext", "rand 0.8.5", "regex", @@ -2658,12 +2817,12 @@ dependencies = [ "futures", "futures-bounded", "futures-timer", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-swarm", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", "quick-protobuf", - "quick-protobuf-codec", + "quick-protobuf-codec 0.3.1", "smallvec", "thiserror 2.0.12", "tokio", @@ -2671,6 +2830,27 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "libp2p-identify" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ab792a8b68fdef443a62155b01970c81c3aadab5e659621b063ef252a8e65e8" +dependencies = [ + "asynchronous-codec", + "either", + "futures", + "futures-bounded", + "futures-timer", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-protobuf", + "quick-protobuf-codec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec", + "thiserror 2.0.12", + "tracing", +] + [[package]] name = "libp2p-identity" version = "0.2.12" @@ -2698,6 +2878,33 @@ dependencies = [ "zeroize", ] +[[package]] +name = "libp2p-kad" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d3fd632a5872ec804d37e7413ceea20588f69d027a0fa3c46f82574f4dee60" +dependencies = [ + "asynchronous-codec", + "bytes", + "either", + "fnv", + "futures", + "futures-bounded", + "futures-timer", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-protobuf", + "quick-protobuf-codec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.8.5", + "sha2", + "smallvec", + "thiserror 2.0.12", + "tracing", + "uint", + "web-time 1.1.0", +] + [[package]] name = "libp2p-kad" version = "0.49.0" @@ -2709,15 +2916,15 @@ dependencies = [ "futures", "futures-bounded", "futures-timer", - "libp2p-core", - "libp2p-identify", + "libp2p-core 0.43.1", + "libp2p-identify 0.47.0", "libp2p-identity", - "libp2p-noise", - "libp2p-swarm", - "libp2p-swarm-test", - "libp2p-yamux", + "libp2p-noise 0.46.1", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", + "libp2p-yamux 0.47.0", "quick-protobuf", - "quick-protobuf-codec", + "quick-protobuf-codec 0.3.1", "quickcheck-ext", "rand 0.8.5", "serde", @@ -2738,10 +2945,10 @@ dependencies = [ "futures", "hickory-proto", "if-watch", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-swarm", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", "rand 0.8.5", "smallvec", "socket2 0.6.0", @@ -2750,16 +2957,35 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "libp2p-mdns" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66872d0f1ffcded2788683f76931be1c52e27f343edb93bc6d0bcd8887be443" +dependencies = [ + "futures", + "hickory-proto", + "if-watch", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.8.5", + "smallvec", + "socket2 0.5.9", + "tokio", + "tracing", +] + [[package]] name = "libp2p-memory-connection-limits" version = "0.5.0" dependencies = [ - "libp2p-core", - "libp2p-identify", + "libp2p-core 0.43.1", + "libp2p-identify 0.47.0", "libp2p-identity", - "libp2p-swarm", - "libp2p-swarm-derive", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0", + "libp2p-swarm-derive 0.35.1", + "libp2p-swarm-test 0.6.0", "memory-stats", "sysinfo", "tokio", @@ -2771,15 +2997,34 @@ name = "libp2p-metrics" version = "0.17.0" dependencies = [ "futures", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-dcutr", - "libp2p-gossipsub", - "libp2p-identify", + "libp2p-gossipsub 0.50.0", + "libp2p-identify 0.47.0", "libp2p-identity", - "libp2p-kad", - "libp2p-ping", + "libp2p-kad 0.49.0", + "libp2p-ping 0.47.0", "libp2p-relay", - "libp2p-swarm", + "libp2p-swarm 0.47.0", + "pin-project", + "prometheus-client", + "web-time 1.1.0", +] + +[[package]] +name = "libp2p-metrics" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "805a555148522cb3414493a5153451910cb1a146c53ffbf4385708349baf62b7" +dependencies = [ + "futures", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-gossipsub 0.49.2", + "libp2p-identify 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-kad 0.48.0", + "libp2p-ping 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", "pin-project", "prometheus-client", "web-time 1.1.0", @@ -2793,11 +3038,11 @@ dependencies = [ "bytes", "criterion", "futures", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", "libp2p-muxer-test-harness", - "libp2p-plaintext", - "libp2p-tcp", + "libp2p-plaintext 0.43.0", + "libp2p-tcp 0.44.0", "nohash-hasher", "parking_lot", "quickcheck-ext", @@ -2806,7 +3051,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber", - "unsigned-varint", + "unsigned-varint 0.8.0", ] [[package]] @@ -2816,7 +3061,7 @@ dependencies = [ "futures", "futures-timer", "futures_ringbuf", - "libp2p-core", + "libp2p-core 0.43.1", "tracing", ] @@ -2828,7 +3073,7 @@ dependencies = [ "bytes", "futures", "futures_ringbuf", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", "multiaddr", "multihash", @@ -2844,15 +3089,38 @@ dependencies = [ "zeroize", ] +[[package]] +name = "libp2p-noise" +version = "0.46.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc73eacbe6462a0eb92a6527cac6e63f02026e5407f8831bde8293f19217bfbf" +dependencies = [ + "asynchronous-codec", + "bytes", + "futures", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "multiaddr", + "multihash", + "quick-protobuf", + "rand 0.8.5", + "snow", + "static_assertions", + "thiserror 2.0.12", + "tracing", + "x25519-dalek", + "zeroize", +] + [[package]] name = "libp2p-peer-store" version = "0.1.0" dependencies = [ - "libp2p", - "libp2p-core", + "libp2p 0.56.0", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-swarm", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", "lru", "serde_json", "tokio", @@ -2867,14 +3135,14 @@ dependencies = [ "futures", "futures-bounded", "futures-timer", - "libp2p", - "libp2p-core", + "libp2p 0.56.0", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-swarm", - "libp2p-swarm-test", - "libp2p-tcp", - "libp2p-tls", - "libp2p-yamux", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", + "libp2p-tcp 0.44.0", + "libp2p-tls 0.6.2", + "libp2p-yamux 0.47.0", "serde", "serde_json", "thiserror 2.0.12", @@ -2890,10 +3158,10 @@ version = "0.47.0" dependencies = [ "futures", "futures-timer", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-swarm", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", "quickcheck-ext", "rand 0.8.5", "tokio", @@ -2901,6 +3169,22 @@ dependencies = [ "web-time 1.1.0", ] +[[package]] +name = "libp2p-ping" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74bb7fcdfd9fead4144a3859da0b49576f171a8c8c7c0bfc7c541921d25e60d3" +dependencies = [ + "futures", + "futures-timer", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.8.5", + "tracing", + "web-time 1.1.0", +] + [[package]] name = "libp2p-plaintext" version = "0.43.0" @@ -2909,27 +3193,43 @@ dependencies = [ "bytes", "futures", "futures_ringbuf", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", "quick-protobuf", - "quick-protobuf-codec", + "quick-protobuf-codec 0.3.1", "quickcheck-ext", "tracing", "tracing-subscriber", ] +[[package]] +name = "libp2p-plaintext" +version = "0.43.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e659439578fc6d305da8303834beb9d62f155f40e7f5b9d81c9f2b2c69d1926" +dependencies = [ + "asynchronous-codec", + "bytes", + "futures", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "quick-protobuf", + "quick-protobuf-codec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing", +] + [[package]] name = "libp2p-pnet" version = "0.26.0" dependencies = [ "futures", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-noise", - "libp2p-swarm", - "libp2p-tcp", - "libp2p-websocket", - "libp2p-yamux", + "libp2p-noise 0.46.1", + "libp2p-swarm 0.47.0", + "libp2p-tcp 0.44.0", + "libp2p-websocket 0.45.2", + "libp2p-yamux 0.47.0", "pin-project", "quickcheck-ext", "rand 0.8.5", @@ -2939,6 +3239,20 @@ dependencies = [ "tracing", ] +[[package]] +name = "libp2p-pnet" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf240b834dfa3f8b48feb2c4b87bb2cf82751543001b6ee86077f48183b18d52" +dependencies = [ + "futures", + "pin-project", + "rand 0.8.5", + "salsa20", + "sha3", + "tracing", +] + [[package]] name = "libp2p-quic" version = "0.13.0" @@ -2946,13 +3260,13 @@ dependencies = [ "futures", "futures-timer", "if-watch", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", "libp2p-muxer-test-harness", - "libp2p-noise", - "libp2p-tcp", - "libp2p-tls", - "libp2p-yamux", + "libp2p-noise 0.46.1", + "libp2p-tcp 0.44.0", + "libp2p-tls 0.6.2", + "libp2p-yamux 0.47.0", "quickcheck", "quinn", "rand 0.8.5", @@ -2965,6 +3279,28 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "libp2p-quic" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc448b2de9f4745784e3751fe8bc6c473d01b8317edd5ababcb0dec803d843f" +dependencies = [ + "futures", + "futures-timer", + "if-watch", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-tls 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quinn", + "rand 0.8.5", + "ring", + "rustls", + "socket2 0.5.9", + "thiserror 2.0.12", + "tokio", + "tracing", +] + [[package]] name = "libp2p-relay" version = "0.21.0" @@ -2975,15 +3311,15 @@ dependencies = [ "futures", "futures-bounded", "futures-timer", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-ping", - "libp2p-plaintext", - "libp2p-swarm", - "libp2p-swarm-test", - "libp2p-yamux", + "libp2p-ping 0.47.0", + "libp2p-plaintext 0.43.0", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", + "libp2p-yamux 0.47.0", "quick-protobuf", - "quick-protobuf-codec", + "quick-protobuf-codec 0.3.1", "quickcheck-ext", "rand 0.8.5", "static_assertions", @@ -3003,13 +3339,13 @@ dependencies = [ "bimap", "futures", "futures-timer", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", "libp2p-request-response", - "libp2p-swarm", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", "quick-protobuf", - "quick-protobuf-codec", + "quick-protobuf-codec 0.3.1", "rand 0.8.5", "thiserror 2.0.12", "tokio", @@ -3028,10 +3364,10 @@ dependencies = [ "futures", "futures-bounded", "futures_ringbuf", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-swarm", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", "rand 0.8.5", "serde", "serde_json", @@ -3049,7 +3385,7 @@ dependencies = [ "base64", "clap", "futures", - "libp2p", + "libp2p 0.56.0", "prometheus-client", "serde", "serde_json", @@ -3064,10 +3400,10 @@ name = "libp2p-stream" version = "0.4.0-alpha" dependencies = [ "futures", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-swarm", - "libp2p-swarm-test", + "libp2p-swarm 0.47.0", + "libp2p-swarm-test 0.6.0", "rand 0.8.5", "tokio", "tracing", @@ -3084,17 +3420,17 @@ dependencies = [ "futures", "futures-timer", "getrandom 0.2.15", - "libp2p-core", - "libp2p-identify", + "libp2p-core 0.43.1", + "libp2p-identify 0.47.0", "libp2p-identity", - "libp2p-kad", - "libp2p-ping", - "libp2p-plaintext", - "libp2p-swarm-derive", - "libp2p-swarm-test", - "libp2p-yamux", + "libp2p-kad 0.49.0", + "libp2p-ping 0.47.0", + "libp2p-plaintext 0.43.0", + "libp2p-swarm-derive 0.35.1", + "libp2p-swarm-test 0.6.0", + "libp2p-yamux 0.47.0", "lru", - "multistream-select", + "multistream-select 0.13.0", "quickcheck-ext", "rand 0.8.5", "smallvec", @@ -3106,6 +3442,28 @@ dependencies = [ "web-time 1.1.0", ] +[[package]] +name = "libp2p-swarm" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aa762e5215919a34e31c35d4b18bf2e18566ecab7f8a3d39535f4a3068f8b62" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-swarm-derive 0.35.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lru", + "multistream-select 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.8.5", + "smallvec", + "tokio", + "tracing", + "web-time 1.1.0", +] + [[package]] name = "libp2p-swarm-derive" version = "0.35.1" @@ -3115,6 +3473,17 @@ dependencies = [ "syn", ] +[[package]] +name = "libp2p-swarm-derive" +version = "0.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd297cf53f0cb3dee4d2620bb319ae47ef27c702684309f682bdb7e55a18ae9c" +dependencies = [ + "heck", + "quote", + "syn", +] + [[package]] name = "libp2p-swarm-test" version = "0.6.0" @@ -3122,12 +3491,30 @@ dependencies = [ "async-trait", "futures", "futures-timer", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-plaintext", - "libp2p-swarm", - "libp2p-tcp", - "libp2p-yamux", + "libp2p-plaintext 0.43.0", + "libp2p-swarm 0.47.0", + "libp2p-tcp 0.44.0", + "libp2p-yamux 0.47.0", + "tracing", +] + +[[package]] +name = "libp2p-swarm-test" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b149112570d507efe305838c7130835955a0b1147aa8051c1c3867a83175cf6" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-plaintext 0.43.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tcp 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-yamux 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing", ] @@ -3139,13 +3526,29 @@ dependencies = [ "futures-timer", "if-watch", "libc", - "libp2p-core", + "libp2p-core 0.43.1", "socket2 0.6.0", "tokio", "tracing", "tracing-subscriber", ] +[[package]] +name = "libp2p-tcp" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65b4e030c52c46c8d01559b2b8ca9b7c4185f10576016853129ca1fe5cd1a644" +dependencies = [ + "futures", + "futures-timer", + "if-watch", + "libc", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.5.9", + "tokio", + "tracing", +] + [[package]] name = "libp2p-tls" version = "0.6.2" @@ -3153,10 +3556,10 @@ dependencies = [ "futures", "futures-rustls", "hex-literal", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-swarm", - "libp2p-yamux", + "libp2p-swarm 0.47.0", + "libp2p-yamux 0.47.0", "rcgen", "ring", "rustls", @@ -3167,12 +3570,31 @@ dependencies = [ "yasna", ] +[[package]] +name = "libp2p-tls" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96ff65a82e35375cbc31ebb99cacbbf28cb6c4fefe26bf13756ddcf708d40080" +dependencies = [ + "futures", + "futures-rustls", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "rcgen", + "ring", + "rustls", + "rustls-webpki", + "thiserror 2.0.12", + "x509-parser 0.17.0", + "yasna", +] + [[package]] name = "libp2p-uds" version = "0.43.0" dependencies = [ "futures", - "libp2p-core", + "libp2p-core 0.43.1", "tempfile", "tokio", "tracing", @@ -3185,8 +3607,23 @@ dependencies = [ "futures", "futures-timer", "igd-next", - "libp2p-core", - "libp2p-swarm", + "libp2p-core 0.43.1", + "libp2p-swarm 0.47.0", + "tokio", + "tracing", +] + +[[package]] +name = "libp2p-upnp" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4757e65fe69399c1a243bbb90ec1ae5a2114b907467bf09f3575e899815bb8d3" +dependencies = [ + "futures", + "futures-timer", + "igd-next", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.47.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio", "tracing", ] @@ -3200,9 +3637,9 @@ dependencies = [ "futures-timer", "hex", "if-watch", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-noise", + "libp2p-noise 0.46.1", "libp2p-webrtc-utils", "multihash", "quickcheck", @@ -3226,11 +3663,11 @@ dependencies = [ "futures", "hex", "hex-literal", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-noise", + "libp2p-noise 0.46.1", "quick-protobuf", - "quick-protobuf-codec", + "quick-protobuf-codec 0.3.1", "rand 0.8.5", "serde", "sha2", @@ -3247,7 +3684,7 @@ dependencies = [ "getrandom 0.2.15", "hex", "js-sys", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", "libp2p-webrtc-utils", "send_wrapper 0.6.0", @@ -3258,6 +3695,27 @@ dependencies = [ "web-sys", ] +[[package]] +name = "libp2p-websocket" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520e29066a48674c007bc11defe5dce49908c24cafd8fad2f5e1a6a8726ced53" +dependencies = [ + "either", + "futures", + "futures-rustls", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "parking_lot", + "pin-project-lite", + "rw-stream-sink 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "soketto", + "thiserror 2.0.12", + "tracing", + "url", + "webpki-roots", +] + [[package]] name = "libp2p-websocket" version = "0.45.2" @@ -3265,14 +3723,14 @@ dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core", - "libp2p-dns", + "libp2p-core 0.43.1", + "libp2p-dns 0.44.0", "libp2p-identity", - "libp2p-tcp", + "libp2p-tcp 0.44.0", "parking_lot", "pin-project-lite", "rcgen", - "rw-stream-sink", + "rw-stream-sink 0.4.0", "soketto", "thiserror 2.0.12", "tokio", @@ -3288,10 +3746,10 @@ dependencies = [ "bytes", "futures", "js-sys", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-noise", - "libp2p-yamux", + "libp2p-noise 0.46.1", + "libp2p-yamux 0.47.0", "send_wrapper 0.6.0", "thiserror 2.0.12", "tracing", @@ -3305,9 +3763,9 @@ version = "0.5.1" dependencies = [ "futures", "js-sys", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-noise", + "libp2p-noise 0.46.1", "multiaddr", "multibase", "multihash", @@ -3325,7 +3783,7 @@ version = "0.47.0" dependencies = [ "either", "futures", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-muxer-test-harness", "thiserror 2.0.12", "tokio", @@ -3334,6 +3792,21 @@ dependencies = [ "yamux 0.13.4", ] +[[package]] +name = "libp2p-yamux" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f15df094914eb4af272acf9adaa9e287baa269943f32ea348ba29cfb9bfc60d8" +dependencies = [ + "either", + "futures", + "libp2p-core 0.43.1 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 2.0.12", + "tracing", + "yamux 0.12.1", + "yamux 0.13.4", +] + [[package]] name = "libredox" version = "0.1.3" @@ -3456,7 +3929,7 @@ version = "0.1.0" dependencies = [ "axum", "futures", - "libp2p", + "libp2p 0.56.0", "opentelemetry 0.27.1", "opentelemetry-otlp", "opentelemetry_sdk 0.27.1", @@ -3553,7 +4026,7 @@ dependencies = [ "percent-encoding", "serde", "static_assertions", - "unsigned-varint", + "unsigned-varint 0.8.0", "url", ] @@ -3579,7 +4052,7 @@ dependencies = [ "quickcheck", "rand 0.8.5", "serde", - "unsigned-varint", + "unsigned-varint 0.8.0", ] [[package]] @@ -3591,13 +4064,27 @@ dependencies = [ "futures_ringbuf", "pin-project", "quickcheck-ext", - "rw-stream-sink", + "rw-stream-sink 0.4.0", "smallvec", "tokio", "tokio-util", "tracing", "tracing-subscriber", - "unsigned-varint", + "unsigned-varint 0.8.0", +] + +[[package]] +name = "multistream-select" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea0df8e5eec2298a62b326ee4f0d7fe1a6b90a09dfcf9df37b38f947a8c42f19" +dependencies = [ + "bytes", + "futures", + "log", + "pin-project", + "smallvec", + "unsigned-varint 0.7.2", ] [[package]] @@ -4146,7 +4633,7 @@ name = "ping-example" version = "0.1.0" dependencies = [ "futures", - "libp2p", + "libp2p 0.56.0", "tokio", "tracing-subscriber", ] @@ -4347,7 +4834,20 @@ dependencies = [ "quick-protobuf", "quickcheck-ext", "thiserror 2.0.12", - "unsigned-varint", + "unsigned-varint 0.8.0", +] + +[[package]] +name = "quick-protobuf-codec" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15a0580ab32b169745d7a39db2ba969226ca16738931be152a3209b409de2474" +dependencies = [ + "asynchronous-codec", + "bytes", + "quick-protobuf", + "thiserror 1.0.69", + "unsigned-varint 0.8.0", ] [[package]] @@ -4663,7 +5163,7 @@ version = "0.1.0" dependencies = [ "clap", "futures", - "libp2p", + "libp2p 0.56.0", "tokio", "tracing-subscriber", ] @@ -4673,7 +5173,7 @@ name = "rendezvous-example" version = "0.1.0" dependencies = [ "futures", - "libp2p", + "libp2p 0.56.0", "tokio", "tracing", "tracing-subscriber", @@ -4987,6 +5487,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "rw-stream-sink" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8c9026ff5d2f23da5e45bbc283f156383001bfb09c4e44256d02c1a685fe9a1" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + [[package]] name = "ryu" version = "1.0.20" @@ -5356,7 +5867,7 @@ version = "0.1.0" dependencies = [ "anyhow", "futures", - "libp2p", + "libp2p 0.56.0", "libp2p-stream", "rand 0.8.5", "tokio", @@ -6112,6 +6623,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "unsigned-varint" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" + [[package]] name = "unsigned-varint" version = "0.8.0" @@ -6133,7 +6650,7 @@ name = "upnp-example" version = "0.1.0" dependencies = [ "futures", - "libp2p", + "libp2p 0.56.0", "tokio", "tracing-subscriber", ] @@ -6611,9 +7128,9 @@ version = "0.1.0" dependencies = [ "futures", "getrandom 0.2.15", - "libp2p-core", + "libp2p-core 0.43.1", "libp2p-identity", - "libp2p-noise", + "libp2p-noise 0.46.1", "libp2p-webtransport-websys", "multiaddr", "multihash", diff --git a/examples/chat/Cargo.toml b/examples/chat/Cargo.toml index 2e467535d73..a7d02ff2dfb 100644 --- a/examples/chat/Cargo.toml +++ b/examples/chat/Cargo.toml @@ -11,7 +11,7 @@ release = false [dependencies] tokio = { workspace = true, features = ["full"] } futures = { workspace = true } -libp2p = { path = "../../libp2p", features = [ "tokio", "gossipsub", "mdns", "noise", "macros", "tcp", "yamux", "quic"] } +libp2p = { version = "0.56", features = ["tokio", "gossipsub", "mdns", "noise", "macros", "tcp", "yamux", "quic"] } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/examples/ipfs-private/Cargo.toml b/examples/ipfs-private/Cargo.toml index 085eebc85a3..28031c4f9dc 100644 --- a/examples/ipfs-private/Cargo.toml +++ b/examples/ipfs-private/Cargo.toml @@ -12,7 +12,7 @@ release = false tokio = { workspace = true, features = ["rt-multi-thread", "macros", "io-std"] } either = "1.12" futures = { workspace = true } -libp2p = { path = "../../libp2p", features = [ "tokio", "gossipsub", "dns", "identify", "kad", "macros", "noise", "ping", "pnet", "tcp", "websocket", "yamux"] } +libp2p = { version = "0.56", features = ["tokio", "gossipsub", "dns", "identify", "kad", "macros", "noise", "ping", "pnet", "tcp", "websocket", "yamux"] } tracing-subscriber = { workspace = true, features = ["env-filter"] } [lints] diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index f83c554d333..5b8c1aab9e6 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -5,6 +5,9 @@ - Remove `Rpc` from the public API. See [PR 6091](https://github.com/libp2p/rust-libp2p/pull/6091) +- Report peers with Low scores. + See [PR XXXX](https://github.com/libp2p/rust-libp2p/pull/6091) + ## 0.49.2 - Relax `Behaviour::with_metrics` requirements, do not require DataTransform and TopicSubscriptionFilter to also impl Default diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index 911b453f477..1e75a65c143 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -28,23 +28,23 @@ getrandom = { workspace = true } hashlink = { workspace = true } hex_fmt = "0.3.0" web-time = { workspace = true } -libp2p-core = { workspace = true } -libp2p-identity = { workspace = true, features = ["rand"] } -libp2p-swarm = { workspace = true } +# Libp2p crates, updated to use crates.io versions so that we can use this gossipsub fork with +# crates.io libp2p +libp2p-core = "0.43" +libp2p-identity = { version = "0.2", features = ["rand"] } +libp2p-swarm = "0.47" quick-protobuf = "0.8" -quick-protobuf-codec = { workspace = true } +quick-protobuf-codec = "0.3.1" rand = "0.8" regex = "1.10.5" serde = { version = "1", optional = true, features = ["derive"] } sha2 = "0.10.8" tracing = { workspace = true } -# Metrics dependencies -prometheus-client = { workspace = true, optional = true } +prometheus-client = { version = "0.23", optional = true } [dev-dependencies] -libp2p-core = { workspace = true } -libp2p-swarm-test = { path = "../../swarm-test" } +libp2p-swarm-test = { version = "0.6.0", features = ["tokio"] } quickcheck = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } tokio = { workspace = true, features = ["rt", "rt-multi-thread", "time", "macros"] } diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 9d7d6356211..5686e5bc6dc 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -164,6 +164,8 @@ pub enum Event { /// The types and amounts of failed messages that are occurring for this peer. failed_messages: FailedMessages, }, + /// A Peer is below the score threshold. + BelowThresholdPeers { peer_ids: Vec }, } /// A data structure for storing configuration for publishing messages. See [`MessageAuthenticity`] @@ -2139,18 +2141,23 @@ where let mesh_outbound_min = self.config.mesh_outbound_min_for_topic(topic_hash); // drop all peers with negative score, without PX - // if there is at some point a stable retain method for BTreeSet the following can be - // written more efficiently with retain. - let mut to_remove_peers = Vec::new(); - for peer_id in peers.iter() { + // report peers below the score report threshold. + let mut removed_peers = 0; + let mut peers_to_report = vec![]; + peers.retain(|peer_id| { let peer_score = scores.get(peer_id).map(|r| r.score).unwrap_or_default(); - // Record the score per mesh #[cfg(feature = "metrics")] if let Some(metrics) = self.metrics.as_mut() { metrics.observe_mesh_peers_score(topic_hash, peer_score); } + if let Some(threshold) = self.config.score_report_threshold() { + if peer_score < threshold { + peers_to_report.push(*peer_id); + } + } + if peer_score < 0.0 { tracing::debug!( peer=%peer_id, @@ -2162,17 +2169,23 @@ where let current_topic = to_prune.entry(*peer_id).or_insert_with(Vec::new); current_topic.push(topic_hash.clone()); no_px.insert(*peer_id); - to_remove_peers.push(*peer_id); + removed_peers += 1; + return false; } + + true + }); + + if !peers_to_report.is_empty() { + self.events + .push_back(ToSwarm::GenerateEvent(Event::BelowThresholdPeers { + peer_ids: peers_to_report, + })); } #[cfg(feature = "metrics")] if let Some(m) = self.metrics.as_mut() { - m.peers_removed(topic_hash, Churn::BadScore, to_remove_peers.len()) - } - - for peer_id in to_remove_peers { - peers.remove(&peer_id); + m.peers_removed(topic_hash, Churn::BadScore, removed_peers) } // too little peers - add some diff --git a/protocols/gossipsub/src/behaviour/tests.rs b/protocols/gossipsub/src/behaviour/tests.rs index 85aead47911..f1f70e834a3 100644 --- a/protocols/gossipsub/src/behaviour/tests.rs +++ b/protocols/gossipsub/src/behaviour/tests.rs @@ -6787,3 +6787,60 @@ fn test_validation_message_size_within_topic_specific() { _ => panic!("Unexpected event"), } } + +#[test] +fn test_low_score_peer_is_reported() { + let score_report_threshold = -5.0; + + let config = ConfigBuilder::default() + .score_report_threshold(score_report_threshold) + .build() + .expect("valid config"); + + let (mut gs, peers, _receivers, _topics) = inject_nodes1() + .peer_no(3) + .topics(vec!["test".into()]) + .to_subscribe(true) + .gs_config(config) + .scoring(Some(( + PeerScoreParams::default(), + PeerScoreThresholds::default(), + ))) + .create_network(); + + // Reduce the score of the first peer below the threshold + gs.as_peer_score_mut().add_penalty(&peers[0], 10); + + // Reduce the score of the second peer below the threshold + gs.as_peer_score_mut().add_penalty(&peers[1], 8); + + // Verify initial scores are below threshold + assert!(gs.as_peer_score_mut().score_report(&peers[0]).score < score_report_threshold); + assert!(gs.as_peer_score_mut().score_report(&peers[1]).score < score_report_threshold); + assert!(gs.as_peer_score_mut().score_report(&peers[2]).score >= score_report_threshold); + + // Trigger a heartbeat which should generate the LowScorePeers event + gs.heartbeat(); + + // Check for the LowScorePeers event + let low_score_event = gs + .events + .iter() + .find(|event| { + matches!( + event, + ToSwarm::GenerateEvent(Event::BelowThresholdPeers { .. }) + ) + }) + .unwrap(); + + match low_score_event { + ToSwarm::GenerateEvent(Event::BelowThresholdPeers { peer_ids }) => { + assert_eq!(peer_ids.len(), 2); + assert!(peer_ids.contains(&peers[0])); + assert!(peer_ids.contains(&peers[1])); + assert!(!peer_ids.contains(&peers[2])); + } + _ => unreachable!(), + } +} diff --git a/protocols/gossipsub/src/config.rs b/protocols/gossipsub/src/config.rs index ec8b6cac3a4..55cc99afcfd 100644 --- a/protocols/gossipsub/src/config.rs +++ b/protocols/gossipsub/src/config.rs @@ -132,6 +132,7 @@ pub struct Config { connection_handler_forward_duration: Duration, idontwant_message_size_threshold: usize, idontwant_on_publish: bool, + score_report_threshold: Option, topic_configuration: TopicConfigs, } @@ -476,6 +477,12 @@ impl Config { pub fn idontwant_on_publish(&self) -> bool { self.idontwant_on_publish } + + /// Score threshold below which peers should be reported. If set to None, no peer reporting + /// based on score will occur. Default is None. + pub fn score_report_threshold(&self) -> Option { + self.score_report_threshold + } } impl Default for Config { @@ -545,6 +552,7 @@ impl Default for ConfigBuilder { connection_handler_forward_duration: Duration::from_secs(1), idontwant_message_size_threshold: 1000, idontwant_on_publish: false, + score_report_threshold: None, topic_configuration: TopicConfigs::default(), }, invalid_protocol: false, @@ -1040,6 +1048,14 @@ impl ConfigBuilder { self } + /// Sets the score threshold below which peers should be reported. + /// When set, the behaviour will report peers whose score falls below this threshold. + /// Default is None (no reporting). + pub fn score_report_threshold(&mut self, threshold: f64) -> &mut Self { + self.config.score_report_threshold = Some(threshold); + self + } + /// The topic configuration sets mesh parameter sizes for a given topic. Notes on default /// below. ///