-
Notifications
You must be signed in to change notification settings - Fork 39
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: Batch vote publish loop (BFT-474) #148
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aakoshh
changed the title
BFT-474: Batch vote publish loop
feat: Batch vote publish loop (BFT-474)
Jul 8, 2024
11 tasks
brunoffranca
approved these changes
Jul 8, 2024
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.
Approved!
aakoshh
force-pushed
the
bft-474-batch-vote-publish-loop
branch
from
July 8, 2024 18:17
e7693d7
to
49dc942
Compare
brunoffranca
pushed a commit
that referenced
this pull request
Jul 9, 2024
## What ❔ Followup for some design discussions in #148 * Removes `BatchStore::unsigned_batch_numbers` * Add `BatchStore::earliest_batch_number_to_sign` * Add `BatchStore::latest_batch_number` * Changes `AttesterRunner` to have a mutable range of `earliest_batch_number` and `latest_batch_number` instead of querying `unsigned_batch_numbers` and filtering it with a `min_batch_number` ## Why ❔ This might be more intuitive than the original version. Another motivation was that the current implementation of `unsigned_batch_numbers` in matter-labs/zksync-era#2399 has to do two queries: 1) to figure out the latest batch number and 2) to find all batches without certificates within a limited range of the latest batch. Here we only query the latest batch number in each loop, and we forego the check on whether a QC already exists, otherwise we'd be back at doing two queries, or some ugly book keeping to only check it on the first loop after a restart. It should be cheap enough to publish a duplicate vote.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What ❔
BatchStore::unsigned_batch_numbers
to queryBatchNumber
s that still need a QCBatchStore::batch_to_sign
to fetch theBatch
with the correctBatchHash
that needs to be signedPersistentBatchStore::unsigned_batch_numbers
to implement the abovePersistentBatchStore::batch_to_sign
to implement the aboveAttesterRunner
to periodically queryunsigned_batch_numbers
, retrieve the data withbatch_to_sign
and publish theSigned<Batch>
to the gossip network.AttesterRunner
inExecutor
if the node has anAttester
key.The code will re-submit the node's signature after a restart to a number of batches to be determined by the database query. We can say we'll re-publish the top 10 unsigned batches, or we can say we'll only look for the ones which follow the last finalised batch observed the Main node. It is enough to publish a vote once because of the way
BatchVotes
works (gossip peers will pull the data they need when they connect). Because we'll always have the batches in order, we can take note of the highest number we have published a vote for and never publish it again (until a restart), to save ourselves the trouble of repeatedly retrieving and signing the payload. That said it is assumed thatbatch_to_sign
is cheap as it just needs to look up a hash in the DB.Follow up steps
The ticket will need a counterpart in
zksync-era
to implement the newPersistentBatchStore
operations by querying Postgres. Need figuring out which column needs to go into the hash.Why ❔
To publish the attestations over L1 batches to the gossip network, so that a QC can be formed in #145