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(en): Fix race condition in EN storage initialization #3515

Merged

Conversation

slowli
Copy link
Contributor

@slowli slowli commented Jan 22, 2025

What ❔

Reworks NodeStorageInitializer::is_chain_tip_correct() so that it performs the minimum amount of work possible, i.e. detects whether the latest L1 batch / L2 block diverge or not.

Why ❔

EN storage initialization is prone to a data race: the "is storage initialized" check calls NodeStorageInitializer::is_chain_tip_correct(), which internally performs the entire iteration of the reorg detector (in particular, binary search for the first diverged block). This can lead to a data race with block revert logic, which may be executed concurrently. This data race was observed on the revert integration tests.

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via zkstack dev fmt and zkstack dev lint.

@slowli slowli marked this pull request as ready for review January 22, 2025 12:56
@slowli slowli added this pull request to the merge queue Jan 23, 2025
Merged via the queue into main with commit c916797 Jan 23, 2025
35 checks passed
@slowli slowli deleted the aov-pla-1083-fix-race-condition-in-en-storage-initialization branch January 23, 2025 09:36
github-merge-queue bot pushed a commit that referenced this pull request Jan 24, 2025
🤖 I have created a release *beep* *boop*
---


##
[26.2.0](core-v26.1.0...core-v26.2.0)
(2025-01-24)


### Features

* Compressor optimizations
([#3476](#3476))
([3e931be](3e931be))


### Bug Fixes

* **en:** better defaults, i.e. the same as used by main node
([#3521](#3521))
([2b5fe98](2b5fe98))
* **en:** Fix race condition in EN storage initialization
([#3515](#3515))
([c916797](c916797))
* JSON proof serialization
([#3514](#3514))
([516e521](516e521))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: zksync-era-bot <[email protected]>
Co-authored-by: Anton Baliasnikov <[email protected]>
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