From 12ab9a63bf1bdfaa4c31924117f5d8a792001504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Mon, 25 Nov 2024 15:21:18 +0000 Subject: [PATCH 1/2] fix(gossipsub): fix mesh/fanout inconsistencies --- protocols/gossipsub/CHANGELOG.md | 6 ++++-- protocols/gossipsub/src/behaviour.rs | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 8d95abc01a2..d51816f4c6a 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,15 +1,17 @@ ## 0.48.0 +- Correct state inconsistencies with the mesh and fanout when unsubscribing. + See [PR XXXX](https://github.com/libp2p/rust-libp2p/pull/XXXX) + - Deprecate `futures-ticker` and use `futures-timer` instead. See [PR 5674](https://github.com/libp2p/rust-libp2p/pull/5674). + - Apply `max_transmit_size` to the inner message instead of the final payload. See [PR 5642](https://github.com/libp2p/rust-libp2p/pull/5642). - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). -## 0.47.1 - - Attempt to publish to at least mesh_n peers when flood publish is disabled. See [PR 5578](https://github.com/libp2p/rust-libp2p/pull/5578). diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index fae45ed452e..075a881db48 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -1962,8 +1962,11 @@ where } } - // remove unsubscribed peers from the mesh if it exists + // remove unsubscribed peers from the mesh and fanout if they exist there. for (peer_id, topic_hash) in unsubscribed_peers { + self.fanout + .get_mut(&topic_hash) + .map(|peers| peers.remove(&peer_id)); self.remove_peer_from_mesh(&peer_id, &topic_hash, None, false, Churn::Unsub); } From 88403f60dfaa28b51e3b60d91acc00410afa8839 Mon Sep 17 00:00:00 2001 From: Darius Clark Date: Tue, 26 Nov 2024 01:08:52 -0500 Subject: [PATCH 2/2] Update protocols/gossipsub/CHANGELOG.md --- protocols/gossipsub/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index d51816f4c6a..ddbbc7fb552 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,7 +1,7 @@ ## 0.48.0 - Correct state inconsistencies with the mesh and fanout when unsubscribing. - See [PR XXXX](https://github.com/libp2p/rust-libp2p/pull/XXXX) + See [PR 5690](https://github.com/libp2p/rust-libp2p/pull/5690) - Deprecate `futures-ticker` and use `futures-timer` instead. See [PR 5674](https://github.com/libp2p/rust-libp2p/pull/5674).