Skip to content

Commit

Permalink
feat(commitment): Commitment component (matter-labs#1024)
Browse files Browse the repository at this point in the history
## What ❔

- Adding new component that calculate commitment for L1 batches.
- Metadata calculator now only calculates things that require tree, i.e.
root hash and merkle paths in case full tree mode is on.
- Soft removal of some `l1_batches` columns: `parent_hash`,
`l2_l1_compressed_messages`, `compressed_write_logs`,
`compressed_contracts`.
- Fixed field `factory_deps` of `L1BatchWithMetadata`, it's renamed to
`raw_published_factory_deps`, now it represents all published bytecodes
for pre-boojum batches and published uncompressed bytecodes for
post-boojum batches (compressed bytecodes are published as a part of
long L2 to L1 messages).

## Why ❔

- To follow the single responsibility principle
- To improve the performance of full tree which directly affects EN
performance

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Tests for the changes have been added / updated.
- [x] Documentation comments have been added / updated.
- [x] Code has been formatted via `zk fmt` and `zk lint`.
- [x] Spellcheck has been run via `zk spellcheck`.
- [x] Linkcheck has been run via `zk linkcheck`.
  • Loading branch information
perekopskiy authored Feb 13, 2024
1 parent 9b21d7f commit 60305ba
Show file tree
Hide file tree
Showing 63 changed files with 3,559 additions and 2,251 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
matrix:
consensus: [false,true]
env:
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,basic_witness_input_producer${{ matrix.consensus && ',consensus' || '' }}"
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,basic_witness_input_producer,commitment_generator${{ matrix.consensus && ',consensus' || '' }}"

runs-on: [matterlabs-ci-runner]
steps:
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
runs-on: [matterlabs-ci-runner]

env:
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,basic_witness_input_producer${{ matrix.consensus && ',consensus' || '' }}"
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,basic_witness_input_producer,commitment_generator${{ matrix.consensus && ',consensus' || '' }}"
EXT_NODE_FLAGS: "${{ matrix.consensus && '--enable-consensus' || '' }}"

steps:
Expand Down
10 changes: 10 additions & 0 deletions core/bin/external_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use zksync_core::{
web3::{ApiBuilder, Namespace},
},
block_reverter::{BlockReverter, BlockReverterFlags, L1ExecutedBatchesRevert},
commitment_generator::CommitmentGenerator,
consensus,
consistency_checker::ConsistencyChecker,
l1_gas_price::MainNodeFeeParamsFetcher,
Expand Down Expand Up @@ -264,6 +265,14 @@ async fn init_tasks(
.context("failed to build a tree_pool")?;
let tree_handle = task::spawn(metadata_calculator.run(tree_pool, tree_stop_receiver));

let commitment_generator_pool = singleton_pool_builder
.build()
.await
.context("failed to build a commitment_generator_pool")?;
let commitment_generator =
CommitmentGenerator::new(commitment_generator_pool, stop_receiver.clone());
let commitment_generator_handle = tokio::spawn(commitment_generator.run());

let consistency_checker_handle = tokio::spawn(consistency_checker.run(stop_receiver.clone()));

let updater_handle = task::spawn(batch_status_updater.run(stop_receiver.clone()));
Expand Down Expand Up @@ -360,6 +369,7 @@ async fn init_tasks(
tree_handle,
consistency_checker_handle,
fee_params_fetcher_handle,
commitment_generator_handle,
]);

Ok((task_handles, stop_sender, healthcheck_handle, stop_receiver))
Expand Down
2 changes: 1 addition & 1 deletion core/bin/zksync_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct Cli {
/// Comma-separated list of components to launch.
#[arg(
long,
default_value = "api,tree,eth,state_keeper,housekeeper,basic_witness_input_producer"
default_value = "api,tree,eth,state_keeper,housekeeper,basic_witness_input_producer,commitment_generator"
)]
components: ComponentsToRun,
}
Expand Down

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

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

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

This file was deleted.

Loading

0 comments on commit 60305ba

Please sign in to comment.