-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Comments about SyncBatch vs L1 and wait for batch persisted (BFT…
…-474) (#154) ## What ❔ * Fixes the comments I made about `SyncBatch::proof` requiring L1 inclusion - that was based on a misunderstanding that the `proof` was a Merkle proof starting from the L1 state root hash, rather than a field inside the zksync system contract on L1. We only need an L1 client to validate the proof, but we can produce it offline as soon as we have the commitment locally. * Changed the loop in `AttesterRunner` so that it waits for `persisted` state of the `BatchStore` to indicate that the next batch number is available. This will be when the `SyncBatch` can be constructed, so it's when the commitment is ready too (or will be, not currently) and we're ready to sign the payload. * Removed `BatchStore::last_batch_number`; I wanted to use `persisted.last`, which can be `None` in the beginning until `SyncBatch::proof` is available, with a fallback to `PersistentBatchStore::last_batch` which just looks at the latest `l1_batches` record, but I wasn't sure whether a next batch can be created before the commitment for the previous one is available, which would cause a regression in the value returned. Instead we just use `BatchStore::wait_for_persisted(0)` to tell us what the starting value is after the first batch is ready. ## Why ❔ To remove misleading comments, and to reduce unneeded polling of the database itself - now we wait until the memory indicates it's worth hitting the DB.
- Loading branch information
Showing
3 changed files
with
19 additions
and
45 deletions.
There are no files selected for viewing
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
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
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