Spec
specs/pubsub/gossipsub/gossipsub-v1.1.md, Peer Scoring:
the score is retained for some period of time when a peer disconnects, so that malicious peers cannot easily reset their score when it drops to negative.
The configured duration is RetainScore.
Current state
PeerScoreParams defines pspRetainScore (default one hour), but the value has no consumer. Router.removePeer immediately deletes the complete PeerState, including all P1-P7 counters. Reconnecting therefore resets a negative score to zero.
Separately, expired entries in gsBackoff are checked as inactive but never removed, so the (peer, topic) map grows monotonically over long-running/high-churn workloads.
Scope
- Separate connected-peer state from retained scoring state, or mark a peer disconnected with an expiry time.
- Preserve relevant P1-P7 counters for
pspRetainScore after disconnect.
- Continue applying configured decay while the score is retained.
- Restore the retained score when the peer reconnects before expiry.
- Remove retained state after expiry.
- Remove expired
gsBackoff entries during heartbeat maintenance.
- Keep mesh/fanout membership, IP-colocation membership, promises, and connection-only state cleaned up immediately on disconnect.
Acceptance tests
- A negatively scored peer disconnects/reconnects and keeps its penalty.
- Retained counters continue decaying while disconnected.
- A peer reconnecting after
RetainScore starts with fresh score state.
- Disconnect immediately removes mesh/fanout and IP membership.
- Expired backoff entries are physically removed from the map.
- Repeated unique peer/topic churn does not grow retained maps past their expiry windows.
Spec
specs/pubsub/gossipsub/gossipsub-v1.1.md, Peer Scoring:The configured duration is
RetainScore.Current state
PeerScoreParamsdefinespspRetainScore(default one hour), but the value has no consumer.Router.removePeerimmediately deletes the completePeerState, including all P1-P7 counters. Reconnecting therefore resets a negative score to zero.Separately, expired entries in
gsBackoffare checked as inactive but never removed, so the(peer, topic)map grows monotonically over long-running/high-churn workloads.Scope
pspRetainScoreafter disconnect.gsBackoffentries during heartbeat maintenance.Acceptance tests
RetainScorestarts with fresh score state.