Skip to content
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: Comments about SyncBatch vs L1 and wait for batch persisted (BFT-474) #154

Merged
merged 2 commits into from
Jul 11, 2024

Conversation

aakoshh
Copy link
Contributor

@aakoshh aakoshh commented Jul 11, 2024

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.

@aakoshh aakoshh changed the title BFT-474: Fix comments about SyncBatch vs L1 and wait for persisted. fix: Comments about SyncBatch vs L1 and wait for batch persisted (BFT-474) Jul 11, 2024
@aakoshh aakoshh force-pushed the bft-474-can-use-persisted branch from 77a4a3c to 1d8b7d6 Compare July 11, 2024 09:56
@brunoffranca brunoffranca merged commit 30a725d into main Jul 11, 2024
5 checks passed
@brunoffranca brunoffranca deleted the bft-474-can-use-persisted branch July 11, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants