From 7ba86435a41ecd4cbededaf3dccd8734b53da8dc Mon Sep 17 00:00:00 2001 From: Andrew Luka Date: Sun, 10 Aug 2025 10:15:28 +0300 Subject: [PATCH 1/4] fix(gossipsub): Changed unsubscribe_backoff to expect Duration --- protocols/gossipsub/src/config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocols/gossipsub/src/config.rs b/protocols/gossipsub/src/config.rs index 366f88f63bf..2b7c770814b 100644 --- a/protocols/gossipsub/src/config.rs +++ b/protocols/gossipsub/src/config.rs @@ -865,8 +865,8 @@ impl ConfigBuilder { /// This is how long to wait before resubscribing to the topic. A short backoff period in case /// of an unsubscribe event allows reaching a healthy mesh in a more timely manner. The default /// is 10 seconds. - pub fn unsubscribe_backoff(&mut self, unsubscribe_backoff: u64) -> &mut Self { - self.config.unsubscribe_backoff = Duration::from_secs(unsubscribe_backoff); + pub fn unsubscribe_backoff(&mut self, unsubscribe_backoff: Duration) -> &mut Self { + self.config.unsubscribe_backoff = unsubscribe_backoff; self } From 97b9c3d7e7a1acd3b8552d5e84f63c5321084b3d Mon Sep 17 00:00:00 2001 From: Andrew Luka Date: Sun, 10 Aug 2025 10:23:23 +0300 Subject: [PATCH 2/4] PR fixes --- protocols/gossipsub/src/behaviour/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/gossipsub/src/behaviour/tests.rs b/protocols/gossipsub/src/behaviour/tests.rs index 85aead47911..04c86bd3df4 100644 --- a/protocols/gossipsub/src/behaviour/tests.rs +++ b/protocols/gossipsub/src/behaviour/tests.rs @@ -2185,7 +2185,7 @@ fn test_unsubscribe_backoff() { .backoff_slack(1) // ensure a prune_backoff > unsubscribe_backoff .prune_backoff(Duration::from_secs(5)) - .unsubscribe_backoff(1) + .unsubscribe_backoff(Duration::from_secs(1)) .heartbeat_interval(HEARTBEAT_INTERVAL) .build() .unwrap(); From cbeeb2c8a6c760f6bca0f468dd003d245c82d4bc Mon Sep 17 00:00:00 2001 From: Andrew Luka Date: Mon, 11 Aug 2025 08:41:27 +0300 Subject: [PATCH 3/4] PR fixes --- protocols/gossipsub/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 3b8f70819ad..c70e75ca572 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -12,6 +12,10 @@ - Fix mesh not being constructed even when not adding any peer. See [PR 6100](https://github.com/libp2p/rust-libp2p/pull/6100) +- Fix `unsubscribe_backoff` expecting number of seconds instead of `Duration` + See [PR 6124](https://github.com/libp2p/rust-libp2p/pull/6124) + + ## 0.49.0 - Feature gate metrics related code. This changes some `Behaviour` constructor methods. From a7eeb71fd4f03137299e6e35a9adc7d3b2ef1312 Mon Sep 17 00:00:00 2001 From: Andrew Luka Date: Wed, 13 Aug 2025 19:36:27 +0300 Subject: [PATCH 4/4] Update CHANGELOG.md --- protocols/gossipsub/CHANGELOG.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 6a2c0f8c8ec..8741f8b4cb4 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) +- Fix `unsubscribe_backoff` expecting number of seconds instead of `Duration` + See [PR 6124](https://github.com/libp2p/rust-libp2p/pull/6124) + ## 0.49.2 - Relax `Behaviour::with_metrics` requirements, do not require DataTransform and TopicSubscriptionFilter to also impl Default @@ -21,10 +24,6 @@ - Fix mesh not being constructed even when not adding any peer. See [PR 6100](https://github.com/libp2p/rust-libp2p/pull/6100) -- Fix `unsubscribe_backoff` expecting number of seconds instead of `Duration` - See [PR 6124](https://github.com/libp2p/rust-libp2p/pull/6124) - - ## 0.49.0 - Feature gate metrics related code. This changes some `Behaviour` constructor methods.