-
Notifications
You must be signed in to change notification settings - Fork 116
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
Handle duplicate blocks in zebra-state #1198
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.
This looks really good, I like how neat the implementation is.
I'd like @hdevalence to double-check the channel stuff.
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.
Edit: This error was due to #1041.
Edit: This error was due to #1041. |
Just to back up a second, why do we need to handle duplicate blocks idempotently? |
@hdevalence previous discussion #1101 (comment) |
Thanks for the pointer! |
Co-authored-by: teor <teor@riseup.net>
Co-authored-by: teor <teor@riseup.net>
Co-authored-by: teor <teor@riseup.net>
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.
LGTM
Clippy failures are unrelated to this PR |
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.
👍
Motivation
The zebra-state service needs to be able to handle duplicate blocks
idempotently. When we receive aCommitBlock
request for a block that hasalready been queued we should subscribe to the existing channel for sending the
result of commiting that block. If we receive a block that has already been
succesfully committed to the non-finalized or finalized state we should
immediately respond to the request that the block was committed succesfully.
Solution
This implements changes already outlined by The State
RFC. We check for
successfully committed blocks first, since interacting with the queued blocks
struct at this point just complicates the implimentation. If the block has not
already been committed we then check if the block has already been queued, if
not we handle the block normally (normally here being the bit we already had
implemented).
Documentation Changes
Add newly added functions to the state rfcDecided not to do this because they're minor getters that don't influence the rest of the design and aren't exposed as part of the APITesting
Related Issues