-
Notifications
You must be signed in to change notification settings - Fork 55
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
GossipSub: Better IWANT handling #875
Conversation
else: | ||
let deIwants = iwants.deduplicate() |
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.
I've remove deduplication since this now happens naturally, though the computation is a tad more expensive
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## unstable #875 +/- ##
============================================
+ Coverage 83.83% 83.86% +0.02%
============================================
Files 86 86
Lines 14969 14977 +8
============================================
+ Hits 12550 12560 +10
+ Misses 2419 2417 -2
|
what's the upper bound on memory usage for this? |
Everytime we send an IHAVE, the message id will be stored for Plugging in realistic values (for eth2 with all subnets): 1300 * 4.2 * 20 * 32 = 3.49 MB, as a worst case scenario |
Having this data is also useful for future bandwidth optimization (and already optimize a bit, since a peer can now only IWANT us a single time per message, instead of multiple times currently) |
yeah, I was thinking about that vs a simple counter that per-peer says how many IHAVE's we've sent them recently, but if it's in the single-digit MB range it seems reasonable |
I started this PR using a counter, but then with wildly different messages size it gets pretty bad (I send you 10 IHAVE for 100 bytes msgs, you reply with 10 IWANT for 1 mb msgs) |
Currently, IWANTs are only limited by the budget (25 messages per heartbeat)
That's quite random, and causes some issues when peer are asking for more than 25 messages per HB
This PR changes the spam protection to only allow one IWANT per message sent in each IHAVE
In the future, we could also avoid sending an IHAVE twice for the same message. This PR opens the door to that