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

refactor: Use earliest batch number to sign (BFT-474) #150

Merged
merged 9 commits into from
Jul 9, 2024

Conversation

aakoshh
Copy link
Contributor

@aakoshh aakoshh commented Jul 8, 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.

@aakoshh aakoshh marked this pull request as ready for review July 8, 2024 19:18
@aakoshh aakoshh changed the title BFT-474: Refactor attestation to use earliest batch number to sign refactor: Use earliest batch number to sign (BFT-474) Jul 8, 2024
node/libs/storage/src/batch_store.rs Outdated Show resolved Hide resolved
@aakoshh aakoshh requested a review from pompon0 as a code owner July 9, 2024 09:21
@aakoshh aakoshh force-pushed the bft-474-earliest-unsigned branch from d0b31f8 to e79137f Compare July 9, 2024 09:23
Base automatically changed from bft-474-batch-vote-publish-loop to main July 9, 2024 09:55
@aakoshh aakoshh force-pushed the bft-474-earliest-unsigned branch from e79137f to 0466e99 Compare July 9, 2024 09:56
aakoshh added 2 commits July 9, 2024 15:32
## What ❔

Adds a `max_batch_size` setting and uses it to set a `max_req_size`
limit in the RPC that deals with `SyncBatch`.

Fixes some of the comments added in
#150

### Alternative configuration

The size of `SyncBatch` depends on how many blocks are in the batch,
plus a fixed size proof. Since we already have a limit for the size of
block payloads, ostensibly we could add a limit on the number of blocks
in the batch; I used 100 in the protobuf reader if the field was
missing. Perhaps this setting is already available somewhere in
zksync-era?


## Why ❔

Tests failed in matter-labs/zksync-era#2340 when
I unintentionally enabled the gossiping of `SyncBatch` due to the large
size of the requests. It turns out they were either hardcoded constants
copied from the block store state gossip (which doesn't depend on the
payload size, only the QC), or they wrongly used the block payload
limit.
@brunoffranca brunoffranca merged commit 7bb6930 into main Jul 9, 2024
5 checks passed
@brunoffranca brunoffranca deleted the bft-474-earliest-unsigned branch July 9, 2024 16:15
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.

3 participants