-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Networking] Handling iHave overpromising part-1 #4556
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4556 +/- ##
==========================================
- Coverage 56.25% 54.82% -1.43%
==========================================
Files 653 816 +163
Lines 64699 78639 +13940
==========================================
+ Hits 36396 43114 +6718
- Misses 25362 32102 +6740
- Partials 2941 3423 +482
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the extensive and clear README updates!
I didn't quite get one point: If an under-performing node has its score reduced among the peers, and the peers stop getting messages from this node, how does this node get penalized? In other words, is there a protocol reward for exchanging honest messages that the under-performing node would lose?
// Returns: | ||
// none | ||
func (g *Builder) EnableGossipSubScoringWithOverride(override *p2p.PeerScoringConfigOverride) { | ||
g.gossipSubPeerScoring = true // TODO: we should enable peer scoring by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the TODO
still valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this TODO
means that eventually, peer scoring must be a default setting for the gossipsub
rather than setting it through builder, i.e., every gossipsub
instance we make at our codebase must have the peer scoring enabled, and disabling the peer scoring must not be an option, as it poses a security vulnerability.
Co-authored-by: Tarak Ben Youssef <50252200+tarakby@users.noreply.github.com>
@tarakby, thanks for your review. With these settings, an underperforming node has a reduced score. Hence, we disincentivise the nodes to be free-rider or to spend their resources on spamming (though we have more severe spam prevention mechanisms), or deviating from
|
This PR introduces a comprehensive set of parameters for GossipSub's message delivery scoring mechanism, providing a way to calculate the performance of each peer in a topic mesh. It enables a decay system to keep the score dynamic and relevant and includes measures to prevent any potential message replay attacks.
The parameters are explained as follows:
defaultTopicMeshMessageDeliveriesDecay
): Controls the decay rate of the count of actual message deliveries by a peer in a topic mesh.defaultTopicMeshMessageDeliveriesCap
): Sets an upper limit on the number of actual message deliveries that contribute to the score of a peer.defaultTopicMeshMessageDeliveryThreshold
): Establishes a baseline for the number of actual message deliveries. If the actual count is below this threshold, the peer is penalized.defaultTopicMeshMessageDeliveriesWeight
): Provides the weight for the penalty if a peer underperforms.defaultMeshMessageDeliveriesWindow
): Defines the window size, within which a message delivery counts towards the score of a peer.defaultMeshMessageDeliveriesActivation
): Specifies the time we wait for a new peer to start counting its message deliveries.The scoring mechanism operates per topic and contributes to the overall score of a peer. With the introduction of decay parameters, the score of a peer is continually updated, thus incentivizing active participation. Additionally, the mechanism is equipped to deal with replay attacks, disregarding any message replayed within the same sender's window size.
This PR plays a significant role in our ongoing efforts to mitigate the threat of
iHave
overpromising spam within our network. We've designed the message delivery scoring system to identify and penalize an attacker who overpromisesiHave
messages but consistently under-delivers. Our approach, however, doesn't immediately disconnect from a node solely due to under-performance alone. Instead, we've implemented a strategy where the under-performing node accrues sufficient penalties over time, causing a significant decrease in its overall score. As a result of this cumulative penalization, the under-performing node naturally becomes less preferred by honest nodes when they compare it to other peers with higher scores. This mechanism subtly discourages the participation of such actors, thus promoting overall network integrity and reliability, while still maintaining connections to avoid potential false positives.