Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces bounded, per-peer control-plane limits for Gossipsub to reduce abuse potential and to align behavior with protocol expectations around IHAVE/IWANT/IDONTWANT handling, including tracking and penalizing unmet IWANT “promises”.
Changes:
- Adds configurable caps for IHAVE intake, IWANT retransmission, and IWANT response byte size, plus bounded IWANT promise sampling and IDONTWANT TTL behavior.
- Introduces per-peer control state (
PeerControlState) and anIwantPromiseTrackerto support bounded suppression/retransmission and behavioral penalties. - Adds unit tests covering the new control-plane limits and validations.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/libp2p/Libp2p.Protocols.Pubsub/PubSubSettings.cs | Adds new Gossipsub control-plane limit settings (IHAVE/IWANT/IDONTWANT/promise tracking). |
| src/libp2p/Libp2p.Protocols.Pubsub/PubsubRouter.Rpc.cs | Enforces new per-peer limits when handling IHAVE/IWANT/IDONTWANT; fulfills IWANT promises on message arrival. |
| src/libp2p/Libp2p.Protocols.Pubsub/PubsubRouter.cs | Wires in control settings validation, IWANT promise penalty application, and per-heartbeat reset of peer control counters. |
| src/libp2p/Libp2p.Protocols.Pubsub/PeerControlState.cs | New bounded per-peer state for counting envelopes/IDs, suppressing unwanted IDs, and limiting IWANT retransmissions. |
| src/libp2p/Libp2p.Protocols.Pubsub/IwantPromiseTracker.cs | New bounded sampler for IHAVE→IWANT promise tracking and expiry-based penalty accounting. |
| src/libp2p/Libp2p.Protocols.Pubsub.Tests/GossipsubControlLimitsTests.cs | Adds unit tests validating the new control limits and promise tracking behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
flcl42
force-pushed
the
gossipsub-control-limits
branch
from
August 24, 2026 09:38
252e858 to
7cd7bf5
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Suppressed comments (1)
src/libp2p/Libp2p.Protocols.Pubsub/PubsubRouter.Rpc.cs:130
- IWANT promises are fulfilled for Accepted/Rejected/Ignored outcomes, but the signature-verification failure path still doesn't fulfill the promise. This can cause broken-promise penalties even though the message arrived (it just failed signature validation).
_seenMessages.Add(messageId);
_messageCache.Put(messageId, message);
_iwantPromises.Fulfill(messageId);
flcl42
force-pushed
the
gossipsub-control-limits
branch
from
August 24, 2026 10:34
680e43e to
95e5e5d
Compare
flcl42
force-pushed
the
gossipsub-control-limits
branch
from
August 24, 2026 10:47
95e5e5d to
3013d10
Compare
flcl42
force-pushed
the
gossipsub-control-limits
branch
from
August 24, 2026 11:15
83cd299 to
4427464
Compare
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
Validation