Skip to content

Commit

Permalink
refactor(state_keeper): Rename batch executor family of types (matter…
Browse files Browse the repository at this point in the history
…-labs#1065)

## What ❔

- Does a set of renames:
  - `L1BatchExecutorBuilder` -> `BatchExecutor`
  - `MainBatchExecutorBuilder` -> `MainBatchExecutor`
- `BatchExecutor` -> `CommandReceiver` (as it's just a "processing" part
of `MainBatchExecutor`)
  - Similar changes in the framework.
- Moves the implementation of `MainBatchExecutor` to a separate file.
- Removes some temporary misplaced constructor for
`BatchExecutorHandle`.

## Why ❔

- Less Enterprise™
- Better logical structure

## 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`.
- [ ] Spellcheck has been run via `zk spellcheck`.
- [ ] Linkcheck has been run via `zk linkcheck`.
  • Loading branch information
popzxc authored Feb 15, 2024
1 parent 82c788e commit e27e639
Show file tree
Hide file tree
Showing 13 changed files with 472 additions and 486 deletions.
23 changes: 11 additions & 12 deletions core/bin/external_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use zksync_core::{
reorg_detector::ReorgDetector,
setup_sigint_handler,
state_keeper::{
seal_criteria::NoopSealer, L1BatchExecutorBuilder, MainBatchExecutorBuilder,
MiniblockSealer, MiniblockSealerHandle, ZkSyncStateKeeper,
seal_criteria::NoopSealer, BatchExecutor, MainBatchExecutor, MiniblockSealer,
MiniblockSealerHandle, ZkSyncStateKeeper,
},
sync_layer::{
batch_status_updater::BatchStatusUpdater, external_io::ExternalIO,
Expand Down Expand Up @@ -70,16 +70,15 @@ async fn build_state_keeper(
// We only need call traces on the external node if the `debug_` namespace is enabled.
let save_call_traces = config.optional.api_namespaces().contains(&Namespace::Debug);

let batch_executor_base: Box<dyn L1BatchExecutorBuilder> =
Box::new(MainBatchExecutorBuilder::new(
state_keeper_db_path,
connection_pool.clone(),
max_allowed_l2_tx_gas_limit,
save_call_traces,
false,
config.optional.enum_index_migration_chunk_size,
true,
));
let batch_executor_base: Box<dyn BatchExecutor> = Box::new(MainBatchExecutor::new(
state_keeper_db_path,
connection_pool.clone(),
max_allowed_l2_tx_gas_limit,
save_call_traces,
false,
config.optional.enum_index_migration_chunk_size,
true,
));

let main_node_url = config.required.main_node_url()?;
let main_node_client = <dyn MainNodeClient>::json_rpc(&main_node_url)
Expand Down
5 changes: 2 additions & 3 deletions core/lib/zksync_core/src/consensus/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ use crate::{
},
genesis::{ensure_genesis_state, GenesisParams},
state_keeper::{
seal_criteria::NoopSealer, tests::MockBatchExecutorBuilder, MiniblockSealer,
ZkSyncStateKeeper,
seal_criteria::NoopSealer, tests::MockBatchExecutor, MiniblockSealer, ZkSyncStateKeeper,
},
sync_layer::{
sync_action::{ActionQueue, ActionQueueSender, SyncAction},
Expand Down Expand Up @@ -445,7 +444,7 @@ impl StateKeeperRunner {
ZkSyncStateKeeper::new(
stop_receiver,
Box::new(io),
Box::new(MockBatchExecutorBuilder),
Box::new(MockBatchExecutor),
Arc::new(NoopSealer),
)
.run(),
Expand Down
Loading

0 comments on commit e27e639

Please sign in to comment.