This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
forked from matter-labs/zksync-era
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Unify and port node storage initialization (matter-labs#2363)
## What ❔ - Introduces the `zksync_node_storage_init` crate: a unified approach to the node storage initialization. Key moments: - Storage initializer is a structure that makes sure that, well, the storage is initialized. - Initializer understands what does initialized storage means, but defers any real initialization actions to the implementation of the `NodeRole` trait. Currently we have two `NodeRole` implementations: `MainNodeRole` and `ExternalNodeRole`. - `MainNodeRole` can only perform genesis. It does not support snapshot recovery or automatic rollbacks. - `ExternalNodeRole` can perform either genesis or snapshot recovery; it can also detect reorg and perform a rollback is required. - Framework integration consists of three parts: `NodeRole` resource, and `NodeStorageInitializer` task and precondition. - Old genesis code for the main node is fully replaced with the framework. - The init code is integrated into the EN, but the old code is left for the time being. - Makes snapshot recovery aware of stop signals. It isn't integrated for the old code, but I assume that since the snapshot recovery happens before we setup sigint handler, it implicitly works out of the box. - Integrated `reorg_detector` into the EN via framework. ## Why ❔ - Unify codebases and approach to the storage initialization. - Define the interfaces for future extensions. - Part of porting the codebase to the framework. ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] 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 `zk fmt` and `zk lint`.
- Loading branch information
Showing
30 changed files
with
1,210 additions
and
136 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.