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

feat: Extract block_reverter into separate crate #1632

Merged
merged 5 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ members = [
"core/bin/genesis_generator",
# Node services
"core/node/node_framework",
"core/node/block_reverter",
"core/node/commitment_generator",
# Libraries
"core/lib/db_connection",
Expand Down Expand Up @@ -223,4 +224,5 @@ zksync_crypto_primitives = { path = "core/lib/crypto_primitives" }
zksync_node_framework = { path = "core/node/node_framework" }
zksync_eth_watch = { path = "core/node/eth_watch" }
zksync_shared_metrics = { path = "core/node/shared_metrics" }
zksync_block_reverter = { path = "core/node/block_reverter"}
AnastasiiaVashchuk marked this conversation as resolved.
Show resolved Hide resolved
zksync_commitment_generator = { path = "core/node/commitment_generator" }
2 changes: 1 addition & 1 deletion core/bin/block_reverter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ zksync_config.workspace = true
zksync_env_config.workspace = true
zksync_dal.workspace = true
zksync_types.workspace = true
zksync_core.workspace = true
zksync_block_reverter.workspace = true
vlog.workspace = true

anyhow.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions core/bin/block_reverter/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use anyhow::Context as _;
use clap::{Parser, Subcommand};
use tokio::io::{self, AsyncReadExt};
use zksync_block_reverter::{
BlockReverter, BlockReverterEthConfig, BlockReverterFlags, L1ExecutedBatchesRevert, NodeRole,
};
use zksync_config::{
configs::ObservabilityConfig, ContractsConfig, DBConfig, EthConfig, PostgresConfig,
};
use zksync_core::block_reverter::{
BlockReverter, BlockReverterEthConfig, BlockReverterFlags, L1ExecutedBatchesRevert, NodeRole,
};
use zksync_dal::{ConnectionPool, Core};
use zksync_env_config::FromEnv;
use zksync_types::{Address, L1BatchNumber, U256};
Expand Down
1 change: 1 addition & 0 deletions core/bin/external_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ prometheus_exporter.workspace = true
zksync_health_check.workspace = true
zksync_web3_decl.workspace = true
zksync_types.workspace = true
zksync_block_reverter.workspace = true
vlog.workspace = true

zksync_concurrency.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion core/bin/external_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use tokio::{
sync::{watch, RwLock},
task::{self, JoinHandle},
};
use zksync_block_reverter::{BlockReverter, BlockReverterFlags, L1ExecutedBatchesRevert, NodeRole};
use zksync_commitment_generator::CommitmentGenerator;
use zksync_concurrency::{ctx, scope};
use zksync_config::configs::{
Expand All @@ -21,7 +22,6 @@ use zksync_core::{
tx_sender::{proxy::TxProxy, ApiContracts, TxSenderBuilder},
web3::{mempool_cache::MempoolCache, ApiBuilder, Namespace},
},
block_reverter::{BlockReverter, BlockReverterFlags, L1ExecutedBatchesRevert, NodeRole},
consensus,
consistency_checker::ConsistencyChecker,
db_pruner::{
Expand Down
1 change: 0 additions & 1 deletion core/lib/zksync_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ use crate::{

pub mod api_server;
pub mod basic_witness_input_producer;
pub mod block_reverter;
pub mod consensus;
pub mod consistency_checker;
pub mod db_pruner;
Expand Down
25 changes: 25 additions & 0 deletions core/node/block_reverter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "zksync_block_reverter"
version = "0.1.0"
edition.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
license.workspace = true
keywords.workspace = true
categories.workspace = true

[dependencies]
zksync_types.workspace = true
zksync_dal.workspace = true
zksync_config.workspace = true
zksync_contracts.workspace = true
zksync_storage.workspace = true
zksync_eth_signer.workspace = true
zksync_state.workspace = true
zksync_merkle_tree.workspace = true

tokio = { workspace = true, features = ["time"] }
bitflags.workspace = true
serde.workspace = true
tracing.workspace = true
3 changes: 3 additions & 0 deletions core/node/block_reverter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# zkSync Era Block reverter

This crate contains functionality for zkSync state rollback.
1 change: 1 addition & 0 deletions core/node/node_framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ zksync_utils.workspace = true
zksync_circuit_breaker.workspace = true
zksync_concurrency.workspace = true
zksync_eth_watch.workspace = true
zksync_block_reverter.workspace = true
zksync_commitment_generator.workspace = true

tracing.workspace = true
Expand Down
Loading