-
Notifications
You must be signed in to change notification settings - Fork 109
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
feat(dot/sync): prevent block sync request spamming #3953
base: development
Are you sure you want to change the base?
Conversation
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.
great work! One question but lgtm
|
||
numOfRequests := s.seenBlockSyncRequests.Get(requestHash) | ||
|
||
if numOfRequests > maxNumberOfSameRequestPerPeer { |
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.
if numOfRequests > maxNumberOfSameRequestPerPeer { | |
if numOfRequests + 1 > maxNumberOfSameRequestPerPeer { |
Shouldn't we increment this now to report the peer and exit early instead of waiting for the 3rd message spam to do this?
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.
but then Gossamer will punish w/o reason, I'm mean, if someone reach the limit that is not a bad thing so should not be punished, however if it goes beyond the limit then it should be punished and have its reputation decreased. That's why we should wait for the third message imo
Changes
/sync/2
protocol IDsync
package, which is responsible for responding any sync requests takes the peer ID as well as the request message and hash them and insert in a LRU caching layer with the number of this peer and request was seen, if it reaches the max number then the peer is reported and the message is ignoredTests
WIP
Issues
Primary Reviewer
@timwu20