-
Notifications
You must be signed in to change notification settings - Fork 71
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
fix(p2p): avoid receiving duplicated blocks #818
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #818 +/- ##
==========================================
- Coverage 40.44% 39.83% -0.62%
==========================================
Files 120 118 -2
Lines 18935 18740 -195
==========================================
- Hits 7659 7465 -194
- Misses 10201 10226 +25
+ Partials 1075 1049 -26 ☔ View full report in Codecov by Sentry. |
446fc64
to
22ddcf6
Compare
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.
not sure if I understood what is the point of this pr?
There was too much demand for the mutex before?
it avoids receiving extra duplicates from gossipsub protocol by passing extra options in p2p/client.go, this reduces the demand of the mutex. also it avoids adding already received blocks to the cache, in case it happens. |
p2p/client.go
Outdated
|
||
ps, err := pubsub.NewGossipSub(ctx, c.Host) | ||
//We add WithSeenMessagesTTL (with 1 year time) option to avoid ever requesting already seen blocks | ||
ps, err := pubsub.NewGossipSub(ctx, c.Host, pubsub.WithSeenMessagesTTL(8760*time.Hour)) |
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.
can u explain this 1 year time? previously u had
time.Duration(int(c.blockTime.Nanoseconds()*int64(c.conf.GossipCacheSize))))
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 removed the ttl option and replaced gossipsub version with a new version where seen packets are not expiring
Co-authored-by: Daniel T <[email protected]>
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.
nice!
@mtsitrin can we merge? |
Co-authored-by: Daniel T <[email protected]>
PR Standards
This PR is aimed at preventing the reception of duplicated blocks from p2p network, by updating Gossipsub router configuration. It also prevents adding blocks to cache when already received. This improves performance and syncing times, because receiving too many packets from p2p may block applying blocks received from DA.
Opening a pull request should be able to meet the following requirements
Close #795 #803
<-- Briefly describe the content of this pull request -->
For Author:
godoc
commentsFor Reviewer:
After reviewer approval: