-
Notifications
You must be signed in to change notification settings - Fork 44
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: allow ignoring PublishError.Duplicate #404
feat: allow ignoring PublishError.Duplicate #404
Conversation
Codecov ReportBase: 83.41% // Head: 83.31% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #404 +/- ##
==========================================
- Coverage 83.41% 83.31% -0.11%
==========================================
Files 48 48
Lines 11766 11800 +34
Branches 1266 1271 +5
==========================================
+ Hits 9815 9831 +16
- Misses 1951 1969 +18
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I'm not clear about the context in that issue, if we publish same message to multiple topics, we also need to modify the @dapplion do we need an array of topics or just an option to ignore duplicate check is enough? |
|
Thanks for reviewing @tuyennhv I have made the requested updates. I think we could probably address #272 in a separate PR since the issue was raised in a different context. |
This isn't right. -1 for the AI |
if (this.seenCache.has(msgIdStr)) { | ||
// This message has already been seen. We don't re-publish messages that have already | ||
// been published on the network. | ||
if (allowPublishDuplicateMessages) { | ||
this.metrics?.onPublishDuplicateMsg(topic) | ||
return { recipients: [] } |
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.
@tuyennhv correct me if i'm wrong, this isn't what we want?
I thought we want to actually follow the same flow and actually send messages to peers?
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.
in this case some other nodes already published this same message and it's around in the topic peers already, I found it's not helpful to send to topic peers again - some nodes already saw that message and sent it to us, they may already had it in their seen cache too.
In lodestar's scenario, builder published the block, then the node receives the message and try to publish again and it throws error. The published block was spread to the network successfully, only our api throws error.
Technically it was correct because we where returning early / an empty message which was the original intention in #402 i.e. option to publish api to return early and ignore the error As @tuyennhv mentioned it's not helpful to republish to those peers again since some nodes already would've seen that message, thus they may have already had it in their seen cache too. So with that in mind I posit that |
Reason I'm not a fan of "ignoreDuplicateMessages" naming is that its too general and the terms feel overloaded. "allowPublishDuplicateMessage" follows the naming of the other "suppress a publish error" option - "allowPublishToZeroPeers" - generally "allowPublishErrorname". Imo the core feature here is suppressing / avoiding a publish error. Probably there's some other name that can clearly articulate this. |
Understood. I think |
Closes #402
When
ignoreDuplicatePublishError
is set, instead of throwing withPublishError.Duplicate
, simply return.