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

Sync Committee: BlockStorage Capacity Limit #453

Merged
merged 2 commits into from
Mar 4, 2025

Conversation

zadykian
Copy link
Member

@zadykian zadykian commented Mar 4, 2025

Sync Committee: BlockStorage Capacity Limit

In case if number of blocks stored in the BlockStorage increases a certain amount, state reset process failed due to
violation of Badger transaction size limit: Txn is too big to fit into one request

We need to prevent Sync Committee storage from growing indefinitely in case the prover network is down or unresponsive by introducing a capacity limit for the storage:

  • Introduced a configurable capacity limit for BlockStorage with default settings and validation logic. Stored blocks counted is increased in SetBlockBatch and decreased in two scenarios:
    a) Once block is proposed and removed from the storage - in BlockStorage.SetBlockAsProposed(...) method;
    b) During state reset process when BlockStorage is fully or partially purged;

  • Improved Aggregator to handle new ErrCapacityLimitReached error. The core changes in behavior are defined in the Test_Block_Storage_Capacity_Exceeded test.
    It is expected that if the capacity limit is reached, newly generated batches are not handled by Aggregator:

    • No new tasks are created
    • The latest fetched values are not updated

In case if number of blocks stored in the `BlockStorage` increases a certain amount, state reset process failed due to violation of Badger transaction size limit: `Txn is too big to fit into one request`

We need to prevent Sync Committee storage from growing indefinitely in case the prover network is down or unresponsive by introducing a capacity limit for the storage:

* Introduced a configurable capacity limit for `BlockStorage` with default settings and validation logic. Stored blocks counted is increased in `SetBlockBatch` and decreased in two scenarios:
a) Once block is proposed and removed from the storage - in `BlockStorage.SetBlockAsProposed(...)` method;
b) During state reset process when `BlockStorage` is fully or partially purged;
Copy link

Previous commit introduces capacity limit for the `BlockStorage`.
This commit contains improvements of `Aggregator` to handle new `ErrCapacityLimitReached` error.

The core changes in behaviour are defined in the `Test_Block_Storage_Capacity_Exceeded` test.
It's expected that, in case if capacity limit is reached, new generated batches are not handled by `Aggregator`:

1. No new tasks are created;
2. Latest fetched values are not updated;
@zadykian zadykian force-pushed the sc/fix/storage-capacity-limit branch from 347bbad to 98fad98 Compare March 4, 2025 14:55
@zadykian zadykian requested review from akokoshn, oclaw and x-mass March 4, 2025 14:57
@zadykian zadykian marked this pull request as ready for review March 4, 2025 14:57
@zadykian zadykian added this pull request to the merge queue Mar 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 4, 2025
@zadykian zadykian added this pull request to the merge queue Mar 4, 2025
Merged via the queue into main with commit 6dfe558 Mar 4, 2025
14 checks passed
@zadykian zadykian deleted the sc/fix/storage-capacity-limit branch March 4, 2025 17:17
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