From ba90e45d0a2484f79a2133e51518d3bbc4e13187 Mon Sep 17 00:00:00 2001 From: guillaumemichel Date: Tue, 26 Mar 2024 14:02:53 +0100 Subject: [PATCH 1/2] FIND_NODE for own peer id returns closest peers --- protocols/kad/src/behaviour.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/protocols/kad/src/behaviour.rs b/protocols/kad/src/behaviour.rs index b1701ed9339..6e55b008eb9 100644 --- a/protocols/kad/src/behaviour.rs +++ b/protocols/kad/src/behaviour.rs @@ -1180,16 +1180,12 @@ where target: &kbucket::Key, source: &PeerId, ) -> Vec { - if target == self.kbuckets.local_key() { - Vec::new() - } else { - self.kbuckets - .closest(target) - .filter(|e| e.node.key.preimage() != source) - .take(self.queries.config().replication_factor.get()) - .map(KadPeer::from) - .collect() - } + self.kbuckets + .closest(target) + .filter(|e| e.node.key.preimage() != source) + .take(self.queries.config().replication_factor.get()) + .map(KadPeer::from) + .collect() } /// Collects all peers who are known to be providers of the value for a given `Multihash`. From 307ec2eaf2e2bcac8f14ab8226245d56b407f176 Mon Sep 17 00:00:00 2001 From: guillaumemichel Date: Thu, 28 Mar 2024 11:21:47 +0100 Subject: [PATCH 2/2] version bump & changelog entry --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- libp2p/CHANGELOG.md | 6 ++++++ libp2p/Cargo.toml | 2 +- protocols/kad/CHANGELOG.md | 5 +++++ protocols/kad/Cargo.toml | 2 +- 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 671b05ce61c..a48e6570cb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2521,7 +2521,7 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libp2p" -version = "0.53.2" +version = "0.54.0" dependencies = [ "async-std", "async-trait", @@ -2819,7 +2819,7 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.45.4" +version = "0.46.0" dependencies = [ "arrayvec", "async-std", diff --git a/Cargo.toml b/Cargo.toml index ce33cec2ba0..d0234747e06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,7 +73,7 @@ rust-version = "1.73.0" [workspace.dependencies] asynchronous-codec = { version = "0.7.0" } futures-bounded = { version = "0.2.3" } -libp2p = { version = "0.53.2", path = "libp2p" } +libp2p = { version = "0.54.0", path = "libp2p" } libp2p-allow-block-list = { version = "0.3.0", path = "misc/allow-block-list" } libp2p-autonat = { version = "0.12.0", path = "protocols/autonat" } libp2p-connection-limits = { version = "0.3.1", path = "misc/connection-limits" } @@ -84,7 +84,7 @@ libp2p-floodsub = { version = "0.44.0", path = "protocols/floodsub" } libp2p-gossipsub = { version = "0.46.1", path = "protocols/gossipsub" } libp2p-identify = { version = "0.44.2", path = "protocols/identify" } libp2p-identity = { version = "0.2.8" } -libp2p-kad = { version = "0.45.4", path = "protocols/kad" } +libp2p-kad = { version = "0.46.0", path = "protocols/kad" } libp2p-mdns = { version = "0.45.1", path = "protocols/mdns" } libp2p-memory-connection-limits = { version = "0.2.0", path = "misc/memory-connection-limits" } libp2p-metrics = { version = "0.14.1", path = "misc/metrics" } diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index 80b32c35643..afb7f7444f8 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.54.0 -- unreleased + +- Update individual crates. + - Update to [`libp2p-kad` `v0.46.0`](protocols/kad/CHANGELOG.md#0460). + + ## 0.53.2 - Allow `SwarmBuilder::with_bandwidth_metrics` after `SwarmBuilder::with_websocket`. diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index 9dc9667be10..fcec353e3f6 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p" edition = "2021" rust-version = { workspace = true } description = "Peer-to-peer networking library" -version = "0.53.2" +version = "0.54.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 0e781c18916..b97282be62a 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.46.0 -- unreleased + +- Changed `FIND_NODE` response: now includes a list of closest peers when querying the recipient peer ID. Previously, this request yielded an empty response. + See [PR 5270](https://github.com/libp2p/rust-libp2p/pull/5270) + ## 0.45.4 - Add periodic and automatic bootstrap. diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index ed7f255ccd8..5b46642d1ea 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-kad" edition = "2021" rust-version = { workspace = true } description = "Kademlia protocol for libp2p" -version = "0.45.4" +version = "0.46.0" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p"