Skip to content

Commit

Permalink
feat(config): Added blobs to commit batches and made da source part o…
Browse files Browse the repository at this point in the history
…f config (#1243)

## What ❔

Added: 
- data needed for commitBatches whether we use calldata or blobs 
- configuration values for how many "da slots"/da source we plan to use

## Why ❔

We want to be flexible in how we decide what DA source we use and
depending on the DA source, the data we send to the l1 contracts differs

## 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`.

---------

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
Co-authored-by: perekopskiy <mikeson.dp@gmail.com>
Co-authored-by: perekopskiy <53865202+perekopskiy@users.noreply.github.com>
  • Loading branch information
4 people committed Feb 28, 2024
1 parent ee94bee commit e01d1b6
Show file tree
Hide file tree
Showing 37 changed files with 647 additions and 132 deletions.
46 changes: 45 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions core/bin/external_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ zksync_utils = { path = "../../lib/utils" }
zksync_state = { path = "../../lib/state" }
zksync_basic_types = { path = "../../lib/basic_types" }
zksync_contracts = { path = "../../lib/contracts" }
zksync_l1_contract_interface = { path = "../../lib/l1_contract_interface" }
zksync_concurrency = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "97d139969476a004c50f8b4a31ece748e5bee14e" }
zksync_consensus_roles = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "97d139969476a004c50f8b4a31ece748e5bee14e" }
zksync_snapshots_applier = { path = "../../lib/snapshots_applier" }
Expand Down
5 changes: 5 additions & 0 deletions core/bin/external_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ use zksync_core::{
};
use zksync_dal::{healthcheck::ConnectionPoolHealthCheck, ConnectionPool};
use zksync_health_check::{AppHealthCheck, HealthStatus, ReactiveHealthCheck};
use zksync_l1_contract_interface::i_executor::commit::kzg::KzgSettings;
use zksync_state::PostgresStorageCaches;
use zksync_storage::RocksDB;
use zksync_utils::wait_for_tasks::wait_for_tasks;
Expand Down Expand Up @@ -229,6 +230,9 @@ async fn init_tasks(
.context("failed initializing metadata calculator")?;
app_health.insert_component(metadata_calculator.tree_health_check());

let kzg_settings = Some(Arc::new(KzgSettings::new(
&config.optional.kzg_trusted_setup_path,
)));
let consistency_checker = ConsistencyChecker::new(
&config
.required
Expand All @@ -239,6 +243,7 @@ async fn init_tasks(
.build()
.await
.context("failed to build connection pool for ConsistencyChecker")?,
kzg_settings,
);
app_health.insert_component(consistency_checker.health_check().clone());
let consistency_checker_handle = tokio::spawn(consistency_checker.run(stop_receiver.clone()));
Expand Down
13 changes: 13 additions & 0 deletions core/lib/config/src/configs/kzg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::path::Path;

use serde::Deserialize;

#[derive(Debug, Deserialize, Clone, PartialEq)]
Expand All @@ -11,4 +13,15 @@ impl KzgConfig {
fn default_trusted_setup_path() -> String {
"./trusted_setup.json".to_owned()
}

pub fn for_tests() -> Self {
let zksync_home = std::env::var("ZKSYNC_HOME").unwrap();
Self {
trusted_setup_path: Path::new(&zksync_home)
.join("trusted_setup.json")
.to_str()
.unwrap()
.to_owned(),
}
}
}
5 changes: 0 additions & 5 deletions core/lib/constants/src/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ pub const PRIORITY_EXPIRATION: u64 = 50000;
pub const MAX_L1_TRANSACTION_GAS_LIMIT: u64 = 300000;
pub const ETHEREUM_ADDRESS: Address = Address::zero();

/// The maximum number of pubdata per L1 batch. This limit is due to the fact that the Ethereum
/// nodes do not accept transactions that have more than 128kb of pubdata.
/// The 18kb margin is left in case of any impreciseness of the pubdata calculation.
pub const MAX_PUBDATA_PER_L1_BATCH: u64 = 110000;

// TODO: import from `zkevm_opcode_defs` once `VM1.3` is supported
pub const MAX_L2_TX_GAS_LIMIT: u64 = 80000000;

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.

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.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE eth_txs_history DROP COLUMN blob_base_fee_per_gas;
ALTER TABLE eth_txs DROP COLUMN blob_sidecar;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE eth_txs_history ADD COLUMN blob_base_fee_per_gas BIGINT;
ALTER TABLE eth_txs ADD COLUMN blob_sidecar BYTEA;
Loading

0 comments on commit e01d1b6

Please sign in to comment.