fix(service-disco): apply advertExpiry cap after retry-time subtraction, not before#2839
Merged
Merged
Conversation
tinniaru3005
requested review from
richard-ramos and
vladopajic
and removed request for
a team
July 16, 2026 08:42
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
vladopajic
approved these changes
Jul 16, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix--wait-time-cap #2839 +/- ##
=====================================================
Coverage ? 81.23%
=====================================================
Files ? 170
Lines ? 30741
Branches ? 12
=====================================================
Hits ? 24971
Misses ? 5770
Partials ? 0
🚀 New features to boost your workflow:
|
richard-ramos
approved these changes
Jul 16, 2026
SionoiS
requested changes
Jul 16, 2026
SionoiS
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Just need a clean-up. Thank you.
gmelodie
approved these changes
Jul 16, 2026
SionoiS
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
waitingTime()capped the wait atadvertExpirybeforeregistration()subtracted the elapsed retry time (
updateWaitAfterRetry()). That's thewrong order: the cap collapses to the elapsed-time subtraction on every
retry instead of the other way around.
Fix:
waitingTime()no longer caps byadvertExpiry— it returns the raw,un-accumulated wait, as it must for
registration()to subtract elapsedretry time correctly.
registration()appliesmin(max(advertExpiry, ZeroDuration), tWait)after
updateWaitAfterRetry(), right before the ticket is built. Themax(..., ZeroDuration)also guards against a misconfigured negativeadvertExpiryproducing a negativetWaitFor.Affected Areas
Gossipsub
Transports
Peer Management / Discovery
Protocol Logic
Build / Tooling
Other
Compatibility & Downstream Validation
Reference PRs / branches / commits demonstrating successful integration:
Nimbus:
Waku:
Codex:
Impact on Library Users
Risk Assessment
References
Additional Notes