diff --git a/.github/workflows/ci-core-reusable.yml b/.github/workflows/ci-core-reusable.yml
index 03ede7fa732..3bbb1bbf5d2 100644
--- a/.github/workflows/ci-core-reusable.yml
+++ b/.github/workflows/ci-core-reusable.yml
@@ -118,8 +118,13 @@ jobs:
ci_run sccache --show-stats
ci_run cat /tmp/sccache_log.txt
integration:
- runs-on: [matterlabs-ci-runner]
+ strategy:
+ matrix:
+ consensus: [false,true]
+ env:
+ SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,basic_witness_input_producer${{ matrix.consensus && ',consensus' || '' }}"
+ runs-on: [matterlabs-ci-runner]
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
@@ -179,7 +184,7 @@ jobs:
# `sleep 5` because we need to wait until server started properly
- name: Run server
run: |
- ci_run zk server &>server.log &
+ ci_run zk server --components=$SERVER_COMPONENTS &>server.log &
ci_run sleep 5
- name: Run contract verifier
@@ -197,7 +202,7 @@ jobs:
run: |
ci_run pkill zksync_server || true
ci_run sleep 2
- ci_run zk test i revert
+ ENABLE_CONSENSUS=${{ matrix.consensus }} PASSED_ENV_VARS=ENABLE_CONSENSUS ci_run zk test i revert
# This test should be the last one as soon as it
# finished bootloader will be different
@@ -230,7 +235,14 @@ jobs:
ci_run cat /tmp/sccache_log.txt
external-node:
+ strategy:
+ matrix:
+ consensus: [false,true]
runs-on: [matterlabs-ci-runner]
+
+ env:
+ SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,basic_witness_input_producer${{ matrix.consensus && ',consensus' || '' }}"
+ EXT_NODE_FLAGS: "${{ matrix.consensus && '--enable-consensus' || '' }}"
steps:
- name: Checkout code # Checks out the repository under $GITHUB_WORKSPACE, so the job can access it.
@@ -291,14 +303,14 @@ jobs:
# `sleep 30` because we need to wait until server started properly
- name: Run server
run: |
- ci_run zk server &>server.log &
+ ci_run zk server --components=$SERVER_COMPONENTS &>server.log &
ci_run sleep 30
-
+
- name: Run external node
run: |
ci_run zk env ext-node-docker
ci_run zk db setup
- ci_run zk external-node &>ext-node.log &
+ ci_run zk external-node $EXT_NODE_FLAGS &>ext-node.log &
ci_run sleep 30
# TODO(PLA-653): Restore bridge tests for EN.
@@ -315,14 +327,14 @@ jobs:
ci_run pkill zksync_server || true
ci_run sleep 2
ci_run zk env
- ci_run zk test i revert
+ ENABLE_CONSENSUS=${{ matrix.consensus }} PASSED_ENV_VARS=ENABLE_CONSENSUS ci_run zk test i revert
# Check that the rollback was performed on the EN
ci_run sleep 20
ci_run grep -q 'Rollback successfully completed' ext-node.log
# Restart the EN
- ci_run zk server &>>server.log &
+ ci_run zk server --components=$SERVER_COMPONENTS &>>server.log &
ci_run sleep 30
- ZKSYNC_ENV=ext-node-docker ci_run zk external-node &>>ext-node.log &
+ ZKSYNC_ENV=ext-node-docker ci_run zk external-node $EXT_NODE_FLAGS &>>ext-node.log &
ci_run sleep 30
- name: Run upgrade test
diff --git a/.gitignore b/.gitignore
index 20c5973e8f4..c2878f7f734 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,8 @@ Cargo.lock
!/etc/env/docker.toml
!/etc/env/ext-node.toml
!/etc/env/ext-node-docker.toml
+!/etc/env/consensus_config.json
+!/etc/env/en_consensus_config.json
/etc/tokens/localhost.json
/etc/zksolc-bin/*
/etc/zkvyper-bin/*
diff --git a/Cargo.lock b/Cargo.lock
index 5d00d9a8b09..b2bd58bd359 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8271,7 +8271,7 @@ dependencies = [
[[package]]
name = "zksync_concurrency"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"once_cell",
@@ -8298,7 +8298,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_bft"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"async-trait",
@@ -8319,7 +8319,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_crypto"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"blst",
@@ -8337,7 +8337,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_executor"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"rand 0.8.5",
@@ -8351,12 +8351,13 @@ dependencies = [
"zksync_consensus_storage",
"zksync_consensus_sync_blocks",
"zksync_consensus_utils",
+ "zksync_protobuf",
]
[[package]]
name = "zksync_consensus_network"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"async-trait",
@@ -8372,6 +8373,7 @@ dependencies = [
"zksync_concurrency",
"zksync_consensus_crypto",
"zksync_consensus_roles",
+ "zksync_consensus_storage",
"zksync_consensus_utils",
"zksync_protobuf",
"zksync_protobuf_build",
@@ -8380,7 +8382,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_roles"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"bit-vec",
@@ -8400,7 +8402,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_storage"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"async-trait",
@@ -8418,7 +8420,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_sync_blocks"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"thiserror",
@@ -8433,7 +8435,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_utils"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"thiserror",
"zksync_concurrency",
@@ -8536,6 +8538,7 @@ dependencies = [
"zksync_consensus_utils",
"zksync_contracts",
"zksync_dal",
+ "zksync_env_config",
"zksync_eth_client",
"zksync_eth_signer",
"zksync_health_check",
@@ -8544,6 +8547,7 @@ dependencies = [
"zksync_mini_merkle_tree",
"zksync_object_store",
"zksync_protobuf",
+ "zksync_protobuf_build",
"zksync_queued_job_processor",
"zksync_state",
"zksync_storage",
@@ -8670,7 +8674,9 @@ dependencies = [
"vise",
"vlog",
"zksync_basic_types",
+ "zksync_concurrency",
"zksync_config",
+ "zksync_consensus_roles",
"zksync_contracts",
"zksync_core",
"zksync_dal",
@@ -8787,7 +8793,7 @@ dependencies = [
[[package]]
name = "zksync_protobuf"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"bit-vec",
@@ -8805,7 +8811,7 @@ dependencies = [
[[package]]
name = "zksync_protobuf_build"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"heck 0.4.1",
@@ -8837,11 +8843,16 @@ dependencies = [
"anyhow",
"clap 4.4.6",
"futures 0.3.28",
+ "serde_json",
"tikv-jemallocator",
"tokio",
"tracing",
"vlog",
+ "zksync_concurrency",
"zksync_config",
+ "zksync_consensus_crypto",
+ "zksync_consensus_executor",
+ "zksync_consensus_roles",
"zksync_core",
"zksync_env_config",
"zksync_storage",
diff --git a/checks-config/era.dic b/checks-config/era.dic
index fd14c003385..66480ebb51f 100644
--- a/checks-config/era.dic
+++ b/checks-config/era.dic
@@ -306,6 +306,7 @@ tokenomics
validator
validator's
validator
+validators
Validators
CHAINID
PREVRANDAO
@@ -804,6 +805,7 @@ hacky
ceil
Infura
synth
+proto
AUTOGENERATED
x19Ethereum
diff --git a/core/bin/external_node/Cargo.toml b/core/bin/external_node/Cargo.toml
index 272bcfc081c..725ad5a5699 100644
--- a/core/bin/external_node/Cargo.toml
+++ b/core/bin/external_node/Cargo.toml
@@ -20,6 +20,9 @@ zksync_state = { path = "../../lib/state" }
zksync_basic_types = { path = "../../lib/basic_types" }
zksync_contracts = { path = "../../lib/contracts" }
+zksync_concurrency = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_consensus_roles = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+
prometheus_exporter = { path = "../../lib/prometheus_exporter" }
zksync_health_check = { path = "../../lib/health_check" }
zksync_web3_decl = { path = "../../lib/web3_decl" }
diff --git a/core/bin/external_node/src/config/mod.rs b/core/bin/external_node/src/config/mod.rs
index 6bf06f04930..a4d23db44de 100644
--- a/core/bin/external_node/src/config/mod.rs
+++ b/core/bin/external_node/src/config/mod.rs
@@ -4,9 +4,13 @@ use anyhow::Context;
use serde::Deserialize;
use url::Url;
use zksync_basic_types::{Address, L1ChainId, L2ChainId};
-use zksync_core::api_server::{
- tx_sender::TxSenderConfig,
- web3::{state::InternalApiConfig, Namespace},
+use zksync_consensus_roles::node;
+use zksync_core::{
+ api_server::{
+ tx_sender::TxSenderConfig,
+ web3::{state::InternalApiConfig, Namespace},
+ },
+ consensus,
};
use zksync_types::api::BridgeAddresses;
use zksync_web3_decl::{
@@ -75,6 +79,12 @@ impl RemoteENConfig {
}
}
+#[derive(Debug, Deserialize, Clone, PartialEq)]
+pub enum BlockFetcher {
+ ServerAPI,
+ Consensus,
+}
+
/// This part of the external node config is completely optional to provide.
/// It can tweak limits of the API, delay intervals of certain components, etc.
/// If any of the fields are not provided, the default values will be used.
@@ -406,14 +416,32 @@ impl PostgresConfig {
}
}
+fn read_operator_address() -> anyhow::Result
{
+ Ok(std::env::var("EN_OPERATOR_ADDR")?.parse()?)
+}
+
+pub(crate) fn read_consensus_config() -> anyhow::Result {
+ let path = std::env::var("EN_CONSENSUS_CONFIG_PATH")
+ .context("EN_CONSENSUS_CONFIG_PATH env variable is not set")?;
+ let cfg = std::fs::read_to_string(&path).context(path)?;
+ let cfg: consensus::config::Config =
+ consensus::config::decode_json(&cfg).context("failed decoding JSON")?;
+ let node_key: node::SecretKey = consensus::config::read_secret("EN_CONSENSUS_NODE_KEY")?;
+ Ok(consensus::FetcherConfig {
+ executor: cfg.executor_config(node_key),
+ operator_address: read_operator_address().context("read_operator_address()")?,
+ })
+}
+
/// External Node Config contains all the configuration required for the EN operation.
/// It is split into three parts: required, optional and remote for easier navigation.
-#[derive(Debug, Deserialize, Clone, PartialEq)]
+#[derive(Debug, Clone)]
pub struct ExternalNodeConfig {
pub required: RequiredENConfig,
pub postgres: PostgresConfig,
pub optional: OptionalENConfig,
pub remote: RemoteENConfig,
+ pub consensus: Option,
}
impl ExternalNodeConfig {
@@ -434,7 +462,6 @@ impl ExternalNodeConfig {
let remote = RemoteENConfig::fetch(&client)
.await
.context("Unable to fetch required config values from the main node")?;
-
// We can query them from main node, but it's better to set them explicitly
// as well to avoid connecting to wrong environment variables unintentionally.
let eth_chain_id = HttpClientBuilder::default()
@@ -479,6 +506,7 @@ impl ExternalNodeConfig {
postgres,
required,
optional,
+ consensus: None,
})
}
}
diff --git a/core/bin/external_node/src/main.rs b/core/bin/external_node/src/main.rs
index 8b65bbc5cf0..a57404410c2 100644
--- a/core/bin/external_node/src/main.rs
+++ b/core/bin/external_node/src/main.rs
@@ -7,6 +7,7 @@ use metrics::EN_METRICS;
use prometheus_exporter::PrometheusExporterConfig;
use tokio::{sync::watch, task, time::sleep};
use zksync_basic_types::{Address, L2ChainId};
+use zksync_concurrency::{ctx, scope};
use zksync_config::configs::database::MerkleTreeMode;
use zksync_core::{
api_server::{
@@ -16,6 +17,7 @@ use zksync_core::{
web3::{ApiBuilder, Namespace},
},
block_reverter::{BlockReverter, BlockReverterFlags, L1ExecutedBatchesRevert},
+ consensus,
consistency_checker::ConsistencyChecker,
l1_gas_price::MainNodeFeeParamsFetcher,
metadata_calculator::{MetadataCalculator, MetadataCalculatorConfig},
@@ -169,22 +171,57 @@ async fn init_tasks(
let main_node_client = ::json_rpc(&main_node_url)
.context("Failed creating JSON-RPC client for main node")?;
let singleton_pool_builder = ConnectionPool::singleton(&config.postgres.database_url);
- let fetcher_cursor = {
- let pool = singleton_pool_builder
- .build()
- .await
- .context("failed to build a connection pool for `MainNodeFetcher`")?;
- let mut storage = pool.access_storage_tagged("sync_layer").await?;
- FetcherCursor::new(&mut storage)
- .await
- .context("failed to load `MainNodeFetcher` cursor from Postgres")?
+
+ let fetcher_handle = match config.consensus.clone() {
+ None => {
+ let fetcher_cursor = {
+ let pool = singleton_pool_builder
+ .build()
+ .await
+ .context("failed to build a connection pool for `MainNodeFetcher`")?;
+ let mut storage = pool.access_storage_tagged("sync_layer").await?;
+ FetcherCursor::new(&mut storage)
+ .await
+ .context("failed to load `MainNodeFetcher` cursor from Postgres")?
+ };
+ let fetcher = fetcher_cursor.into_fetcher(
+ Box::new(main_node_client),
+ action_queue_sender,
+ sync_state.clone(),
+ stop_receiver.clone(),
+ );
+ tokio::spawn(fetcher.run())
+ }
+ Some(cfg) => {
+ let pool = connection_pool.clone();
+ let mut stop_receiver = stop_receiver.clone();
+ let sync_state = sync_state.clone();
+ #[allow(clippy::redundant_locals)]
+ tokio::spawn(async move {
+ let sync_state = sync_state;
+ let main_node_client = main_node_client;
+ scope::run!(&ctx::root(), |ctx, s| async {
+ s.spawn_bg(async {
+ let res = cfg.run(ctx, pool, action_queue_sender).await;
+ tracing::info!("Consensus actor stopped");
+ res
+ });
+ // TODO: information about the head block of the validators
+ // (currently just the main node)
+ // should also be provided over the gossip network.
+ s.spawn_bg(async {
+ consensus::run_main_node_state_fetcher(ctx, &main_node_client, &sync_state)
+ .await?;
+ Ok(())
+ });
+ ctx.wait(stop_receiver.wait_for(|stop| *stop)).await??;
+ Ok(())
+ })
+ .await
+ .context("consensus actor")
+ })
+ }
};
- let fetcher = fetcher_cursor.into_fetcher(
- Box::new(main_node_client),
- action_queue_sender,
- sync_state.clone(),
- stop_receiver.clone(),
- );
let metadata_calculator_config = MetadataCalculatorConfig {
db_path: config.required.merkle_tree_path.clone(),
@@ -234,7 +271,6 @@ async fn init_tasks(
let updater_handle = task::spawn(batch_status_updater.run(stop_receiver.clone()));
let sk_handle = task::spawn(state_keeper.run());
- let fetcher_handle = tokio::spawn(fetcher.run());
let fee_params_fetcher_handle =
tokio::spawn(fee_params_fetcher.clone().run(stop_receiver.clone()));
@@ -347,6 +383,8 @@ async fn shutdown_components(
struct Cli {
#[arg(long)]
revert_pending_l1_batch: bool,
+ #[arg(long)]
+ enable_consensus: bool,
}
#[tokio::main]
@@ -377,9 +415,13 @@ async fn main() -> anyhow::Result<()> {
tracing::info!("No sentry URL was provided");
}
- let config = ExternalNodeConfig::collect()
+ let mut config = ExternalNodeConfig::collect()
.await
.context("Failed to load external node config")?;
+ if opt.enable_consensus {
+ config.consensus =
+ Some(config::read_consensus_config().context("read_consensus_config()")?);
+ }
let main_node_url = config
.required
.main_node_url()
diff --git a/core/bin/zksync_server/Cargo.toml b/core/bin/zksync_server/Cargo.toml
index a1de2ef057a..33835ba0952 100644
--- a/core/bin/zksync_server/Cargo.toml
+++ b/core/bin/zksync_server/Cargo.toml
@@ -17,10 +17,18 @@ zksync_storage = { path = "../../lib/storage" }
zksync_utils = { path = "../../lib/utils" }
zksync_types = { path = "../../lib/types" }
zksync_core = { path = "../../lib/zksync_core" }
+
+# Consensus dependenices
+zksync_consensus_crypto = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_consensus_roles = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_consensus_executor = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_concurrency = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+
vlog = { path = "../../lib/vlog" }
anyhow = "1.0"
clap = { version = "4.2.4", features = ["derive"] }
+serde_json = "1.0"
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
futures = "0.3"
diff --git a/core/bin/zksync_server/src/config.rs b/core/bin/zksync_server/src/config.rs
new file mode 100644
index 00000000000..4a9e099563d
--- /dev/null
+++ b/core/bin/zksync_server/src/config.rs
@@ -0,0 +1,23 @@
+use anyhow::Context as _;
+use zksync_consensus_roles::{node, validator};
+use zksync_core::consensus;
+use zksync_types::Address;
+
+fn read_operator_address() -> anyhow::Result {
+ Ok(std::env::var("CHAIN_STATE_KEEPER_FEE_ACCOUNT_ADDR")?.parse()?)
+}
+
+pub(crate) fn read_consensus_config() -> anyhow::Result {
+ let path = std::env::var("CONSENSUS_CONFIG_PATH").context("CONSENSUS_CONFIG_PATH")?;
+ let cfg = std::fs::read_to_string(&path).context(path)?;
+ let cfg: consensus::config::Config =
+ consensus::config::decode_json(&cfg).context("failed decoding JSON")?;
+ let validator_key: validator::SecretKey =
+ consensus::config::read_secret("CONSENSUS_VALIDATOR_KEY")?;
+ let node_key: node::SecretKey = consensus::config::read_secret("CONSENSUS_NODE_KEY")?;
+ Ok(consensus::MainNodeConfig {
+ executor: cfg.executor_config(node_key),
+ validator: cfg.validator_config(validator_key),
+ operator_address: read_operator_address().context("read_operator_address()")?,
+ })
+}
diff --git a/core/bin/zksync_server/src/main.rs b/core/bin/zksync_server/src/main.rs
index ffaa08ea090..f9f18a11c05 100644
--- a/core/bin/zksync_server/src/main.rs
+++ b/core/bin/zksync_server/src/main.rs
@@ -25,6 +25,8 @@ use zksync_env_config::FromEnv;
use zksync_storage::RocksDB;
use zksync_utils::wait_for_tasks::wait_for_tasks;
+mod config;
+
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
@@ -93,7 +95,7 @@ async fn main() -> anyhow::Result<()> {
// Right now, we are trying to deserialize all the configs that may be needed by `zksync_core`.
// "May" is the key word here, since some configs are only used by certain component configuration,
// hence we are using `Option`s.
- let configs: TempConfigStore = TempConfigStore {
+ let mut configs: TempConfigStore = TempConfigStore {
postgres_config: PostgresConfig::from_env().ok(),
health_check_config: HealthCheckConfig::from_env().ok(),
merkle_tree_api_config: MerkleTreeApiConfig::from_env().ok(),
@@ -105,7 +107,7 @@ async fn main() -> anyhow::Result<()> {
state_keeper_config: StateKeeperConfig::from_env().ok(),
house_keeper_config: HouseKeeperConfig::from_env().ok(),
fri_proof_compressor_config: FriProofCompressorConfig::from_env().ok(),
- fri_prover_config: FriProverConfig::from_env().ok(),
+ fri_prover_config: Some(FriProverConfig::from_env().context("fri_prover_config")?),
fri_prover_group_config: FriProverGroupConfig::from_env().ok(),
fri_witness_generator_config: FriWitnessGeneratorConfig::from_env().ok(),
prometheus_config: PrometheusConfig::from_env().ok(),
@@ -119,8 +121,14 @@ async fn main() -> anyhow::Result<()> {
eth_watch_config: ETHWatchConfig::from_env().ok(),
gas_adjuster_config: GasAdjusterConfig::from_env().ok(),
object_store_config: ObjectStoreConfig::from_env().ok(),
+ consensus_config: None,
};
+ if opt.components.0.contains(&Component::Consensus) {
+ configs.consensus_config =
+ Some(config::read_consensus_config().context("read_consensus_config()")?);
+ }
+
let postgres_config = configs.postgres_config.clone().context("PostgresConfig")?;
if opt.genesis || is_genesis_needed(&postgres_config).await {
diff --git a/core/lib/dal/Cargo.toml b/core/lib/dal/Cargo.toml
index 6af26113360..c686ee291de 100644
--- a/core/lib/dal/Cargo.toml
+++ b/core/lib/dal/Cargo.toml
@@ -18,9 +18,9 @@ zksync_system_constants = { path = "../constants" }
zksync_contracts = { path = "../contracts" }
zksync_types = { path = "../types" }
zksync_health_check = { path = "../health_check" }
-zksync_consensus_roles = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
-zksync_consensus_storage = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
-zksync_protobuf = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
+zksync_consensus_roles = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_consensus_storage = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_protobuf = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
itertools = "0.10.1"
thiserror = "1.0"
@@ -55,4 +55,4 @@ tracing = "0.1"
assert_matches = "1.5.0"
[build-dependencies]
-zksync_protobuf_build = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
+zksync_protobuf_build = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
diff --git a/core/lib/env_config/src/lib.rs b/core/lib/env_config/src/lib.rs
index fa2bb237191..5186b6e4198 100644
--- a/core/lib/env_config/src/lib.rs
+++ b/core/lib/env_config/src/lib.rs
@@ -32,7 +32,7 @@ pub trait FromEnv: Sized {
/// Convenience function that loads the structure from the environment variable given the prefix.
/// Panics if the config cannot be loaded from the environment variables.
-pub(crate) fn envy_load(name: &str, prefix: &str) -> anyhow::Result {
+pub fn envy_load(name: &str, prefix: &str) -> anyhow::Result {
envy::prefixed(prefix)
.from_env()
.with_context(|| format!("Cannot load config <{name}>"))
diff --git a/core/lib/object_store/Cargo.toml b/core/lib/object_store/Cargo.toml
index ec42f47c6bf..d09fe10975e 100644
--- a/core/lib/object_store/Cargo.toml
+++ b/core/lib/object_store/Cargo.toml
@@ -13,7 +13,7 @@ categories = ["cryptography"]
vise = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev = "1c9cc500e92cf9ea052b230e114a6f9cce4fb2c1" }
zksync_config = { path = "../config" }
zksync_types = { path = "../types" }
-zksync_protobuf = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
+zksync_protobuf = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
anyhow = "1.0"
async-trait = "0.1"
diff --git a/core/lib/types/Cargo.toml b/core/lib/types/Cargo.toml
index 032843cbd00..ec8bc1cb88c 100644
--- a/core/lib/types/Cargo.toml
+++ b/core/lib/types/Cargo.toml
@@ -20,7 +20,7 @@ zksync_config = { path = "../config" }
# We need this import because we wanat DAL to be responsible for (de)serialization
codegen = { git = "https://github.com/matter-labs/solidity_plonk_verifier.git", branch = "dev" }
zkevm_test_harness = { git = "https://github.com/matter-labs/era-zkevm_test_harness.git", branch = "v1.3.3" }
-zksync_protobuf = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
+zksync_protobuf = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
anyhow = "1.0.75"
chrono = { version = "0.4", features = ["serde"] }
@@ -45,4 +45,4 @@ tokio = { version = "1", features = ["rt", "macros"] }
serde_with = { version = "1", features = ["hex"] }
[build-dependencies]
-zksync_protobuf_build = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
+zksync_protobuf_build = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
diff --git a/core/lib/zksync_core/Cargo.toml b/core/lib/zksync_core/Cargo.toml
index ad422261334..1470ce11a4a 100644
--- a/core/lib/zksync_core/Cargo.toml
+++ b/core/lib/zksync_core/Cargo.toml
@@ -9,6 +9,8 @@ license = "MIT OR Apache-2.0"
keywords = ["blockchain", "zksync"]
categories = ["cryptography"]
+links = "zksync_core_proto"
+
[dependencies]
vise = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev = "1c9cc500e92cf9ea052b230e114a6f9cce4fb2c1" }
zksync_state = { path = "../state" }
@@ -16,6 +18,7 @@ vm_utils = { path = "../vm_utils" }
zksync_types = { path = "../types" }
zksync_dal = { path = "../dal" }
zksync_config = { path = "../config" }
+zksync_env_config = { path = "../env_config" }
zksync_utils = { path = "../utils" }
zksync_contracts = { path = "../contracts" }
zksync_system_constants = { path = "../../lib/constants" }
@@ -39,14 +42,14 @@ vlog = { path = "../vlog" }
multivm = { path = "../multivm" }
# Consensus dependenices
-zksync_concurrency = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
-zksync_consensus_crypto = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
-zksync_consensus_roles = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
-zksync_consensus_storage = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
-zksync_consensus_executor = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
-zksync_consensus_bft = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
-zksync_consensus_utils = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
-zksync_protobuf = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5727a3e0b22470bb90092388f9125bcb366df613" }
+zksync_concurrency = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_consensus_crypto = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_consensus_roles = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_consensus_storage = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_consensus_executor = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_consensus_bft = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_consensus_utils = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
+zksync_protobuf = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
prost = "0.12.1"
serde = { version = "1.0", features = ["derive"] }
@@ -92,3 +95,6 @@ assert_matches = "1.5"
jsonrpsee = "0.21.0"
tempfile = "3.0.2"
test-casing = "0.1.2"
+
+[build-dependencies]
+zksync_protobuf_build = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "5b3d383d7a65b0fbe2a771fecf4313f5083be9ae" }
diff --git a/core/lib/zksync_core/build.rs b/core/lib/zksync_core/build.rs
new file mode 100644
index 00000000000..25b323b9ff1
--- /dev/null
+++ b/core/lib/zksync_core/build.rs
@@ -0,0 +1,12 @@
+//! Generates rust code from protobufs.
+fn main() {
+ zksync_protobuf_build::Config {
+ input_root: "src/consensus/proto".into(),
+ proto_root: "zksync/core/consensus".into(),
+ dependencies: vec![],
+ protobuf_crate: "::zksync_protobuf".parse().unwrap(),
+ is_public: true,
+ }
+ .generate()
+ .unwrap();
+}
diff --git a/core/lib/zksync_core/src/consensus/config.rs b/core/lib/zksync_core/src/consensus/config.rs
new file mode 100644
index 00000000000..649a90ebc76
--- /dev/null
+++ b/core/lib/zksync_core/src/consensus/config.rs
@@ -0,0 +1,149 @@
+//! Configuration utilities for the consensus component.
+use std::collections::{BTreeMap, BTreeSet};
+
+use anyhow::Context as _;
+use zksync_consensus_crypto::{read_required_text, Text, TextFmt};
+use zksync_consensus_executor as executor;
+use zksync_consensus_roles::{node, validator};
+use zksync_protobuf::{required, ProtoFmt};
+
+use crate::consensus::proto;
+
+/// Decodes a proto message from json for arbitrary `ProtoFmt`.
+pub fn decode_json(json: &str) -> anyhow::Result {
+ let mut d = serde_json::Deserializer::from_str(json);
+ let p: T = zksync_protobuf::serde::deserialize(&mut d)?;
+ d.end()?;
+ Ok(p)
+}
+
+/// Decodes a secret of type T from an env var with name `var_name`.
+/// It makes sure that the error message doesn't contain the secret.
+pub fn read_secret(var_name: &str) -> anyhow::Result {
+ let raw = std::env::var(var_name).map_err(|_| anyhow::anyhow!("{var_name} not set"))?;
+ Text::new(&raw)
+ .decode()
+ .map_err(|_| anyhow::anyhow!("{var_name} has invalid format"))
+}
+
+/// Config (shared between main node and external node).
+#[derive(Clone, Debug, PartialEq)]
+pub struct Config {
+ /// Local socket address to listen for the incoming connections.
+ pub server_addr: std::net::SocketAddr,
+ /// Public address of this node (should forward to `server_addr`)
+ /// that will be advertised to peers, so that they can connect to this
+ /// node.
+ pub public_addr: std::net::SocketAddr,
+
+ /// Validators participating in consensus.
+ pub validators: validator::ValidatorSet,
+
+ /// Maximal allowed size of the payload in bytes.
+ pub max_payload_size: usize,
+
+ /// Limit on the number of inbound connections outside
+ /// of the `static_inbound` set.
+ pub gossip_dynamic_inbound_limit: usize,
+ /// Inbound gossip connections that should be unconditionally accepted.
+ pub gossip_static_inbound: BTreeSet,
+ /// Outbound gossip connections that the node should actively try to
+ /// establish and maintain.
+ pub gossip_static_outbound: BTreeMap,
+}
+
+impl Config {
+ pub fn executor_config(&self, node_key: node::SecretKey) -> executor::Config {
+ executor::Config {
+ server_addr: self.server_addr,
+ validators: self.validators.clone(),
+ max_payload_size: self.max_payload_size,
+ node_key,
+ gossip_dynamic_inbound_limit: self.gossip_dynamic_inbound_limit,
+ gossip_static_inbound: self.gossip_static_inbound.clone().into_iter().collect(),
+ gossip_static_outbound: self.gossip_static_outbound.clone().into_iter().collect(),
+ }
+ }
+
+ pub fn validator_config(
+ &self,
+ validator_key: validator::SecretKey,
+ ) -> executor::ValidatorConfig {
+ executor::ValidatorConfig {
+ public_addr: self.public_addr,
+ key: validator_key,
+ }
+ }
+}
+
+impl ProtoFmt for Config {
+ type Proto = proto::ConsensusConfig;
+ fn read(r: &Self::Proto) -> anyhow::Result {
+ let validators = r
+ .validators
+ .iter()
+ .enumerate()
+ .map(|(i, v)| {
+ Text::new(v)
+ .decode()
+ .with_context(|| format!("validators[{i}]"))
+ })
+ .collect::, _>>()?;
+ let validators = validator::ValidatorSet::new(validators).context("validators")?;
+
+ let mut gossip_static_inbound = BTreeSet::new();
+ for (i, v) in r.gossip_static_inbound.iter().enumerate() {
+ gossip_static_inbound.insert(
+ Text::new(v)
+ .decode()
+ .with_context(|| format!("gossip_static_inbound[{i}]"))?,
+ );
+ }
+ let mut gossip_static_outbound = BTreeMap::new();
+ for (i, e) in r.gossip_static_outbound.iter().enumerate() {
+ let key = read_required_text(&e.key)
+ .with_context(|| format!("gossip_static_outbound[{i}].key"))?;
+ let addr = read_required_text(&e.addr)
+ .with_context(|| format!("gossip_static_outbound[{i}].addr"))?;
+ gossip_static_outbound.insert(key, addr);
+ }
+ Ok(Self {
+ server_addr: read_required_text(&r.server_addr).context("server_addr")?,
+ public_addr: read_required_text(&r.public_addr).context("public_addr")?,
+ validators,
+ max_payload_size: required(&r.max_payload_size)
+ .and_then(|x| Ok((*x).try_into()?))
+ .context("max_payload_size")?,
+ gossip_dynamic_inbound_limit: required(&r.gossip_dynamic_inbound_limit)
+ .and_then(|x| Ok((*x).try_into()?))
+ .context("gossip_dynamic_inbound_limit")?,
+ gossip_static_inbound,
+ gossip_static_outbound,
+ })
+ }
+
+ fn build(&self) -> Self::Proto {
+ Self::Proto {
+ server_addr: Some(self.server_addr.encode()),
+ public_addr: Some(self.public_addr.encode()),
+ validators: self.validators.iter().map(TextFmt::encode).collect(),
+ max_payload_size: Some(self.max_payload_size.try_into().unwrap()),
+ gossip_static_inbound: self
+ .gossip_static_inbound
+ .iter()
+ .map(TextFmt::encode)
+ .collect(),
+ gossip_static_outbound: self
+ .gossip_static_outbound
+ .iter()
+ .map(|(key, addr)| proto::NodeAddr {
+ key: Some(TextFmt::encode(key)),
+ addr: Some(TextFmt::encode(addr)),
+ })
+ .collect(),
+ gossip_dynamic_inbound_limit: Some(
+ self.gossip_dynamic_inbound_limit.try_into().unwrap(),
+ ),
+ }
+ }
+}
diff --git a/core/lib/zksync_core/src/consensus/mod.rs b/core/lib/zksync_core/src/consensus/mod.rs
index 423ef75b7ce..db98b061547 100644
--- a/core/lib/zksync_core/src/consensus/mod.rs
+++ b/core/lib/zksync_core/src/consensus/mod.rs
@@ -1,118 +1,23 @@
//! Consensus-related functionality.
#![allow(clippy::redundant_locals)]
-use std::collections::{HashMap, HashSet};
-
-use anyhow::Context as _;
-use serde::de::Error;
-use zksync_concurrency::{ctx, error::Wrap as _, scope};
-use zksync_consensus_crypto::{Text, TextFmt};
+use zksync_concurrency::{ctx, error::Wrap as _, scope, time};
use zksync_consensus_executor as executor;
-use zksync_consensus_roles::{node, validator};
+use zksync_consensus_roles::validator;
use zksync_consensus_storage::BlockStore;
use zksync_dal::ConnectionPool;
use zksync_types::Address;
use self::storage::Store;
-use crate::sync_layer::sync_action::ActionQueueSender;
+use crate::sync_layer::{sync_action::ActionQueueSender, MainNodeClient, SyncState};
+pub mod config;
+pub mod proto;
mod storage;
#[cfg(test)]
pub(crate) mod testonly;
#[cfg(test)]
mod tests;
-#[derive(PartialEq, Eq, Hash)]
-pub struct SerdeText(pub T);
-
-impl<'de, T: TextFmt> serde::Deserialize<'de> for SerdeText {
- fn deserialize>(d: D) -> Result {
- Ok(Self(
- T::decode(Text::new(<&str>::deserialize(d)?)).map_err(Error::custom)?,
- ))
- }
-}
-
-/// Config (shared between main node and external node) which implements `serde` encoding
-/// and therefore can be flattened into env vars.
-#[derive(serde::Deserialize)]
-pub struct SerdeConfig {
- /// Local socket address to listen for the incoming connections.
- pub server_addr: std::net::SocketAddr,
- /// Public address of this node (should forward to `server_addr`)
- /// that will be advertised to peers, so that they can connect to this
- /// node.
- pub public_addr: std::net::SocketAddr,
-
- /// Validator private key. Should be set only for the validator node.
- pub validator_key: Option>,
-
- /// Validators participating in consensus.
- pub validator_set: Vec>,
-
- /// Key of this node. It uniquely identifies the node.
- pub node_key: SerdeText,
- /// Limit on the number of inbound connections outside
- /// of the `static_inbound` set.
- pub gossip_dynamic_inbound_limit: u64,
- /// Inbound gossip connections that should be unconditionally accepted.
- pub gossip_static_inbound: HashSet>,
- /// Outbound gossip connections that the node should actively try to
- /// establish and maintain.
- pub gossip_static_outbound: HashMap, std::net::SocketAddr>,
-
- pub operator_address: Option,
-}
-
-impl SerdeConfig {
- /// Extracts consensus executor config from the `SerdeConfig`.
- fn executor(&self) -> anyhow::Result {
- Ok(executor::Config {
- server_addr: self.server_addr,
- validators: validator::ValidatorSet::new(
- self.validator_set.iter().map(|k| k.0.clone()),
- )
- .context("validator_set")?,
- node_key: self.node_key.0.clone(),
- gossip_dynamic_inbound_limit: self.gossip_dynamic_inbound_limit,
- gossip_static_inbound: self
- .gossip_static_inbound
- .iter()
- .map(|k| k.0.clone())
- .collect(),
- gossip_static_outbound: self
- .gossip_static_outbound
- .iter()
- .map(|(k, v)| (k.0.clone(), *v))
- .collect(),
- })
- }
-
- /// Extracts a validator config from the `SerdeConfig`.
- pub(crate) fn validator(&self) -> anyhow::Result {
- let key = self
- .validator_key
- .as_ref()
- .context("validator_key is required")?;
- Ok(executor::ValidatorConfig {
- key: key.0.clone(),
- public_addr: self.public_addr,
- })
- }
-}
-
-impl TryFrom for MainNodeConfig {
- type Error = anyhow::Error;
- fn try_from(cfg: SerdeConfig) -> anyhow::Result {
- Ok(Self {
- executor: cfg.executor()?,
- validator: cfg.validator()?,
- operator_address: cfg
- .operator_address
- .context("operator_address is required")?,
- })
- }
-}
-
/// Main node consensus config.
#[derive(Debug, Clone)]
pub struct MainNodeConfig {
@@ -156,23 +61,34 @@ impl MainNodeConfig {
}
}
+/// Periodically fetches the head of the main node
+/// and updates `SyncState` accordingly.
+pub async fn run_main_node_state_fetcher(
+ ctx: &ctx::Ctx,
+ client: &dyn MainNodeClient,
+ sync_state: &SyncState,
+) -> ctx::OrCanceled<()> {
+ const DELAY_INTERVAL: time::Duration = time::Duration::milliseconds(500);
+ const RETRY_DELAY_INTERVAL: time::Duration = time::Duration::seconds(5);
+ loop {
+ match ctx.wait(client.fetch_l2_block_number()).await? {
+ Ok(head) => {
+ sync_state.set_main_node_block(head);
+ ctx.sleep(DELAY_INTERVAL).await?;
+ }
+ Err(err) => {
+ tracing::warn!("main_node_client.fetch_l2_block_number(): {err}");
+ ctx.sleep(RETRY_DELAY_INTERVAL).await?;
+ }
+ }
+ }
+}
+
/// External node consensus config.
#[derive(Debug, Clone)]
pub struct FetcherConfig {
- executor: executor::Config,
- operator_address: Address,
-}
-
-impl TryFrom for FetcherConfig {
- type Error = anyhow::Error;
- fn try_from(cfg: SerdeConfig) -> anyhow::Result {
- Ok(Self {
- executor: cfg.executor()?,
- operator_address: cfg
- .operator_address
- .context("operator_address is required")?,
- })
- }
+ pub executor: executor::Config,
+ pub operator_address: Address,
}
impl FetcherConfig {
@@ -183,12 +99,6 @@ impl FetcherConfig {
pool: ConnectionPool,
actions: ActionQueueSender,
) -> anyhow::Result<()> {
- tracing::info!(
- "Starting gossip fetcher with {:?} and node key {:?}",
- self.executor,
- self.executor.node_key.public(),
- );
-
scope::run!(ctx, |ctx, s| async {
let store = Store::new(pool, self.operator_address);
let mut block_store = store.clone().into_block_store();
diff --git a/core/lib/zksync_core/src/consensus/proto/mod.proto b/core/lib/zksync_core/src/consensus/proto/mod.proto
new file mode 100644
index 00000000000..a943f9470e9
--- /dev/null
+++ b/core/lib/zksync_core/src/consensus/proto/mod.proto
@@ -0,0 +1,53 @@
+// For config readability and ease of use, some of the primitive types are
+// encoded as strings. Fields of these types have a comment with the name of the type.
+// Here is the list of string-encoded types and their corresponding string formats:
+//
+// IpAddr - TCP socket address, encoded as a string of the form "IP:port".
+// Both IPv4 and IPv6 are supported
+// (note that opening IPv6 ports may not work depending on the VM capabilities).
+// examples: "203.0.113.7:3456", "[2001:DB8::1]:4567"
+//
+// ValidatorPublicKey - public key of the validator (consensus participant) of the form "validator:public::"
+// Currently only bn254 signature scheme is supported for validators.
+// example: "validator:public:bn254:4b0c4697f0a35eab30f63684ae4611f3c1d631eecfd97237e2345a9b3d0c472dbb16c49b793beceaab0cdd89cda6ff1099bd1aaf1ad6cabde9a15793cc09b407"
+//
+// NodePublicKey - public key of the node (gossip network participant) of the form "node:public::"
+// Currently only ed25519 signature scheme is supported for nodes.
+// example: "node:public:ed25519:d36607699a0a3fbe3de16947928cf299484219ff62ca20f387795b0859dbe501"
+syntax = "proto3";
+
+package zksync.core.consensus;
+
+// (public key, ip address) of a gossip network node.
+message NodeAddr {
+ optional string key = 1; // required; NodePublicKey
+ optional string addr = 2; // required; IpAddr
+}
+
+message ConsensusConfig {
+ // IP:port to listen on, for incoming TCP connections.
+ // Use `0.0.0.0:` to listen on all network interfaces (i.e. on all IPs exposed by this VM).
+ optional string server_addr = 1; // required; IpAddr
+
+ // Public IP:port to advertise, should forward to server_addr.
+ // Can be `127.0.0.1:` for local tests.
+ optional string public_addr = 2; // required; IpAddr
+
+ // Public keys of all validators.
+ // Currently it has to be a singleton with a public key corresponding to secret key in CONSENSUS_VALIDATOR_KEY env var.
+ repeated string validators = 3; // required; ValidatorPublicKey
+
+ // Maximal allowed size of the payload.
+ optional uint64 max_payload_size = 4; // required; bytes
+
+ // Inbound connections that should be unconditionally accepted on the gossip network.
+ repeated string gossip_static_inbound = 5; // required; NodePublicKey
+
+ // Limit on the number of gossip network inbound connections outside
+ // of the `gossip_static_inbound` set.
+ optional uint64 gossip_dynamic_inbound_limit = 6; // required
+
+ // Outbound gossip network connections that the node should actively try to
+ // establish and maintain.
+ repeated NodeAddr gossip_static_outbound = 7;
+}
diff --git a/core/lib/zksync_core/src/consensus/proto/mod.rs b/core/lib/zksync_core/src/consensus/proto/mod.rs
new file mode 100644
index 00000000000..f5b556c455c
--- /dev/null
+++ b/core/lib/zksync_core/src/consensus/proto/mod.rs
@@ -0,0 +1,3 @@
+#![allow(warnings)]
+
+include!(concat!(env!("OUT_DIR"), "/src/consensus/proto/gen.rs"));
diff --git a/core/lib/zksync_core/src/consensus/storage/mod.rs b/core/lib/zksync_core/src/consensus/storage/mod.rs
index 516ba7eb19c..bafcf3d235c 100644
--- a/core/lib/zksync_core/src/consensus/storage/mod.rs
+++ b/core/lib/zksync_core/src/consensus/storage/mod.rs
@@ -255,14 +255,22 @@ impl BlockStore {
.await
.wrap("payload()")?
.context("miniblock disappeared")?;
- let (genesis, _) = zksync_consensus_bft::testonly::make_genesis(
- &[validator_key.clone()],
- payload.encode(),
- number,
- );
- txn.insert_certificate(ctx, &genesis.justification, self.inner.operator_address)
- .await
- .wrap("insert_certificate()")?;
+ let mut genesis = validator::GenesisSetup {
+ keys: vec![validator_key.clone()],
+ blocks: vec![],
+ };
+ genesis
+ .next_block()
+ .block_number(number)
+ .payload(payload.encode())
+ .push();
+ txn.insert_certificate(
+ ctx,
+ &genesis.blocks[0].justification,
+ self.inner.operator_address,
+ )
+ .await
+ .wrap("insert_certificate()")?;
txn.commit(ctx).await.wrap("commit()")
}
@@ -407,7 +415,15 @@ impl PayloadManager for Store {
.await
.wrap("payload()")?
{
- return Ok(payload.encode());
+ let encoded_payload = payload.encode();
+ if encoded_payload.0.len() > 1 << 20 {
+ tracing::warn!(
+ "large payload ({}B) with {} transactions",
+ encoded_payload.0.len(),
+ payload.transactions.len()
+ );
+ }
+ return Ok(encoded_payload);
}
drop(storage);
ctx.sleep(POLL_INTERVAL).await?;
diff --git a/core/lib/zksync_core/src/consensus/testonly.rs b/core/lib/zksync_core/src/consensus/testonly.rs
index ebbd43ee920..e38bd5142a5 100644
--- a/core/lib/zksync_core/src/consensus/testonly.rs
+++ b/core/lib/zksync_core/src/consensus/testonly.rs
@@ -1,8 +1,11 @@
//! Utilities for testing the consensus module.
use anyhow::Context as _;
-use rand::Rng;
+use rand::{
+ distributions::{Distribution, Standard},
+ Rng,
+};
use zksync_concurrency::{ctx, error::Wrap as _, scope, sync, time};
-use zksync_consensus_roles::validator;
+use zksync_consensus_roles::{node, validator};
use zksync_contracts::{BaseSystemContractsHashes, SystemContractCode};
use zksync_dal::ConnectionPool;
use zksync_types::{
@@ -12,6 +15,7 @@ use zksync_types::{
use crate::{
consensus::{
+ config::Config,
storage::{BlockStore, CtxStorage},
Store,
},
@@ -27,6 +31,30 @@ use crate::{
utils::testonly::{create_l1_batch_metadata, create_l2_transaction},
};
+fn make_addr(rng: &mut R) -> std::net::SocketAddr {
+ std::net::SocketAddr::new(std::net::IpAddr::from(rng.gen::<[u8; 16]>()), rng.gen())
+}
+
+fn make_node_key(rng: &mut R) -> node::PublicKey {
+ rng.gen::().public()
+}
+
+impl Distribution for Standard {
+ fn sample(&self, rng: &mut R) -> Config {
+ Config {
+ server_addr: make_addr(rng),
+ public_addr: make_addr(rng),
+ validators: rng.gen(),
+ max_payload_size: usize::MAX,
+ gossip_dynamic_inbound_limit: rng.gen(),
+ gossip_static_inbound: (0..3).map(|_| make_node_key(rng)).collect(),
+ gossip_static_outbound: (0..5)
+ .map(|_| (make_node_key(rng), make_addr(rng)))
+ .collect(),
+ }
+ }
+}
+
#[derive(Debug, Default)]
pub(crate) struct MockMainNodeClient {
prev_miniblock_hash: H256,
diff --git a/core/lib/zksync_core/src/consensus/tests.rs b/core/lib/zksync_core/src/consensus/tests.rs
index dddac56f99d..f4acfd83fc5 100644
--- a/core/lib/zksync_core/src/consensus/tests.rs
+++ b/core/lib/zksync_core/src/consensus/tests.rs
@@ -1,5 +1,6 @@
use std::ops::Range;
+use anyhow::Context as _;
use tracing::Instrument as _;
use zksync_concurrency::{ctx, scope};
use zksync_consensus_executor::testonly::{connect_full_node, ValidatorNode};
@@ -7,6 +8,7 @@ use zksync_consensus_storage as storage;
use zksync_consensus_storage::PersistentBlockStore as _;
use zksync_consensus_utils::no_copy::NoCopy;
use zksync_dal::{connection::TestTemplate, ConnectionPool};
+use zksync_protobuf::testonly::test_encode_random;
use zksync_types::Address;
use super::*;
@@ -101,7 +103,7 @@ async fn test_validator() {
.await
.context("sk.wait_for_miniblocks(<1st phase>)")?;
- let cfg = ValidatorNode::for_single_validator(&mut ctx.rng());
+ let cfg = ValidatorNode::new(&mut ctx.rng());
let validators = cfg.node.validators.clone();
// Restart consensus actor a couple times, making it process a bunch of blocks each time.
@@ -164,7 +166,7 @@ async fn test_fetcher() {
// topology:
// validator <-> fetcher <-> fetcher <-> ...
- let cfg = ValidatorNode::for_single_validator(rng);
+ let cfg = ValidatorNode::new(rng);
let validators = cfg.node.validators.clone();
let mut cfg = MainNodeConfig {
executor: cfg.node,
@@ -260,7 +262,7 @@ async fn test_fetcher_backfill_certs() {
let ctx = &ctx::test_root(&ctx::AffineClock::new(10.));
let rng = &mut ctx.rng();
- let cfg = ValidatorNode::for_single_validator(rng);
+ let cfg = ValidatorNode::new(rng);
let mut cfg = MainNodeConfig {
executor: cfg.node,
validator: cfg.validator,
@@ -324,3 +326,10 @@ async fn test_fetcher_backfill_certs() {
.await
.unwrap();
}
+
+#[test]
+fn test_schema_encoding() {
+ let ctx = ctx::test_root(&ctx::RealClock);
+ let rng = &mut ctx.rng();
+ test_encode_random::(rng);
+}
diff --git a/core/lib/zksync_core/src/lib.rs b/core/lib/zksync_core/src/lib.rs
index 1fd5af883d7..89bbf7f818e 100644
--- a/core/lib/zksync_core/src/lib.rs
+++ b/core/lib/zksync_core/src/lib.rs
@@ -12,6 +12,7 @@ use zksync_circuit_breaker::{
l1_txs::FailedL1TransactionChecker, replication_lag::ReplicationLagChecker, CircuitBreaker,
CircuitBreakerChecker, CircuitBreakerError,
};
+use zksync_concurrency::{ctx, scope};
use zksync_config::{
configs::{
api::{MerkleTreeApiConfig, Web3JsonRpcConfig},
@@ -230,6 +231,8 @@ pub enum Component {
Housekeeper,
/// Component for exposing APIs to prover for providing proof generation data and accepting proofs.
ProofDataHandler,
+ /// Component generating BFT consensus certificates for miniblocks.
+ Consensus,
}
#[derive(Debug)]
@@ -264,6 +267,7 @@ impl FromStr for Components {
"eth_tx_aggregator" => Ok(Components(vec![Component::EthTxAggregator])),
"eth_tx_manager" => Ok(Components(vec![Component::EthTxManager])),
"proof_data_handler" => Ok(Components(vec![Component::ProofDataHandler])),
+ "consensus" => Ok(Components(vec![Component::Consensus])),
other => Err(format!("{} is not a valid component name", other)),
}
}
@@ -505,6 +509,39 @@ pub async fn initialize_components(
tracing::info!("initialized State Keeper in {elapsed:?}");
}
+ if components.contains(&Component::Consensus) {
+ let cfg = configs
+ .consensus_config
+ .clone()
+ .context("consensus component's config is missing")?;
+ let started_at = Instant::now();
+ tracing::info!("initializing Consensus");
+ let pool = connection_pool.clone();
+ let mut stop_receiver = stop_receiver.clone();
+ task_futures.push(tokio::spawn(async move {
+ scope::run!(&ctx::root(), |ctx, s| async {
+ s.spawn_bg(async {
+ // Consensus is a new component.
+ // For now in case of error we just log it and allow the server
+ // to continue running.
+ if let Err(err) = cfg.run(ctx, pool).await {
+ tracing::error!(%err, "Consensus actor failed");
+ } else {
+ tracing::info!("Consensus actor stopped");
+ }
+ Ok(())
+ });
+ let _ = stop_receiver.wait_for(|stop| *stop).await?;
+ Ok(())
+ })
+ .await
+ }));
+
+ let elapsed = started_at.elapsed();
+ APP_METRICS.init_latency[&InitStage::Consensus].set(elapsed);
+ tracing::info!("initialized Consensus in {elapsed:?}");
+ }
+
let main_zksync_contract_address = contracts_config.diamond_proxy_addr;
if components.contains(&Component::EthWatcher) {
let started_at = Instant::now();
diff --git a/core/lib/zksync_core/src/metrics.rs b/core/lib/zksync_core/src/metrics.rs
index 2c1559aae27..56e8223b893 100644
--- a/core/lib/zksync_core/src/metrics.rs
+++ b/core/lib/zksync_core/src/metrics.rs
@@ -18,6 +18,7 @@ pub(crate) enum InitStage {
EthTxManager,
Tree,
BasicWitnessInputProducer,
+ Consensus,
}
impl fmt::Display for InitStage {
@@ -32,6 +33,7 @@ impl fmt::Display for InitStage {
Self::EthTxManager => formatter.write_str("eth_tx_manager"),
Self::Tree => formatter.write_str("tree"),
Self::BasicWitnessInputProducer => formatter.write_str("basic_witness_input_producer"),
+ Self::Consensus => formatter.write_str("consensus"),
}
}
}
diff --git a/core/lib/zksync_core/src/sync_layer/sync_state.rs b/core/lib/zksync_core/src/sync_layer/sync_state.rs
index 78b78d4aa4d..32a5c29c198 100644
--- a/core/lib/zksync_core/src/sync_layer/sync_state.rs
+++ b/core/lib/zksync_core/src/sync_layer/sync_state.rs
@@ -36,7 +36,7 @@ impl SyncState {
self.inner.read().unwrap().local_block.unwrap_or_default()
}
- pub(super) fn set_main_node_block(&self, block: MiniblockNumber) {
+ pub(crate) fn set_main_node_block(&self, block: MiniblockNumber) {
let mut inner = self.inner.write().unwrap();
if let Some(local_block) = inner.local_block {
if block.0 < local_block.0 {
diff --git a/core/lib/zksync_core/src/temp_config_store.rs b/core/lib/zksync_core/src/temp_config_store.rs
index cfa9ceed379..d50460a0924 100644
--- a/core/lib/zksync_core/src/temp_config_store.rs
+++ b/core/lib/zksync_core/src/temp_config_store.rs
@@ -14,6 +14,8 @@ use zksync_config::{
GasAdjusterConfig, ObjectStoreConfig, PostgresConfig,
};
+use crate::consensus;
+
// TODO (QIT-22): This structure is going to be removed when components will be responsible for their own configs.
/// A temporary config store allowing to pass deserialized configs from `zksync_server` to `zksync_core`.
/// All the configs are optional, since for some component combination it is not needed to pass all the configs.
@@ -44,4 +46,5 @@ pub struct TempConfigStore {
pub eth_watch_config: Option,
pub gas_adjuster_config: Option,
pub object_store_config: Option,
+ pub consensus_config: Option,
}
diff --git a/core/tests/revert-test/tests/revert-and-restart.test.ts b/core/tests/revert-test/tests/revert-and-restart.test.ts
index bbbd5136859..9911a5b06b5 100644
--- a/core/tests/revert-test/tests/revert-and-restart.test.ts
+++ b/core/tests/revert-test/tests/revert-and-restart.test.ts
@@ -60,6 +60,12 @@ describe('Block reverting test', function () {
let blocksCommittedBeforeRevert: number;
let logs: fs.WriteStream;
+ let enable_consensus = process.env.ENABLE_CONSENSUS == 'true';
+ let components = 'api,tree,eth,state_keeper';
+ if (enable_consensus) {
+ components += ',consensus';
+ }
+
before('create test wallet', async () => {
tester = await Tester.init(process.env.CHAIN_ETH_NETWORK || 'localhost');
alice = tester.emptyWallet();
@@ -76,7 +82,7 @@ describe('Block reverting test', function () {
process.env.DATABASE_MERKLE_TREE_MODE = 'full';
// Run server in background.
- const components = 'api,tree,eth,state_keeper';
+
utils.background(`zk server --components ${components}`, [null, logs, logs]);
// Server may need some time to recompile if it's a cold run, so wait for it.
let iter = 0;
@@ -172,7 +178,7 @@ describe('Block reverting test', function () {
process.env.ETH_SENDER_SENDER_AGGREGATED_BLOCK_EXECUTE_DEADLINE = '1';
// Run server.
- utils.background('zk server --components api,tree,eth,state_keeper', [null, logs, logs]);
+ utils.background(`zk server --components ${components}`, [null, logs, logs]);
await utils.sleep(10);
const balanceBefore = await alice.getBalance();
@@ -209,7 +215,7 @@ describe('Block reverting test', function () {
await killServerAndWaitForShutdown(tester);
// Run again.
- utils.background(`zk server --components=api,tree,eth,state_keeper`, [null, logs, logs]);
+ utils.background(`zk server --components=${components}`, [null, logs, logs]);
await utils.sleep(10);
// Trying to send a transaction from the same address again
diff --git a/etc/env/base/private.toml b/etc/env/base/private.toml
index 60d5bfb2d9c..0a6ff7eeb2d 100644
--- a/etc/env/base/private.toml
+++ b/etc/env/base/private.toml
@@ -11,6 +11,14 @@ operator_private_key="0x27593fea79697e947890ecbecce7901b0008345e5d7259710d0dd5e5
# Derived from the `OPERATOR_PRIVATE_KEY`.
operator_commit_eth_addr="0xde03a0B5963f75f1C8485B355fF6D30f3093BDE7"
+[consensus]
+config_path = "etc/env/consensus_config.json"
+# generated with zksync_consensus_tools/src/bin/keys.rs
+# node:public:ed25519:ee717abba6aec5baae5e09d457bd2ffc2f121b576cf4170ce15a68163ce4c868
+node_key="node:secret:ed25519:b6666c3be2703e15028bbebd220d2678fde7431038641f36c52f02849595a8ab"
+# validator:public:bn254:8b0ff0ad1a250e64b0209277148ccee3b64534d8fa60cf25ba0bcc8b65d4d89309cdae79197c2db873d351401093fa0542a5a2071c1a247f2e1abe56d08cbabb
+validator_key="validator:secret:bn254:038ec13f4dca210c9d3525204422f0584e1653a5684bff47f98316d9e64b6746"
+
[misc]
# Private key for the fee seller account
fee_account_private_key="0x27593fea79697e947890ecbecce7901b0008345e5d7259710d0dd5e500d040be"
diff --git a/etc/env/base/rust.toml b/etc/env/base/rust.toml
index 0374867630d..adc79ff05e6 100644
--- a/etc/env/base/rust.toml
+++ b/etc/env/base/rust.toml
@@ -5,6 +5,9 @@
# `RUST_LOG` environment variable for `env_logger`
# Here we use TOML multiline strings: newlines will be trimmed.
RUST_LOG="""\
+zksync_consensus_bft=info,\
+zksync_consensus_network=info,\
+zksync_consensus_storage=info,\
zksync_core=debug,\
zksync_server=debug,\
zksync_contract_verifier=debug,\
diff --git a/etc/env/consensus_config.json b/etc/env/consensus_config.json
new file mode 100644
index 00000000000..4dc62be7324
--- /dev/null
+++ b/etc/env/consensus_config.json
@@ -0,0 +1,13 @@
+{
+ "server_addr": "127.0.0.1:3054",
+ "public_addr": "127.0.0.1:3054",
+ "validators": [
+ "validator:public:bn254:8b0ff0ad1a250e64b0209277148ccee3b64534d8fa60cf25ba0bcc8b65d4d89309cdae79197c2db873d351401093fa0542a5a2071c1a247f2e1abe56d08cbabb"
+ ],
+ "max_payload_size": 5000000,
+ "gossip_static_outbound": [],
+ "gossip_static_inbound": [
+ "node:public:ed25519:147bb71be895846e1d6f5b1c6a8be53848b82bdafcf66e9dfe6ca65581076a1d"
+ ],
+ "gossip_dynamic_inbound_limit": 0
+}
diff --git a/etc/env/en_consensus_config.json b/etc/env/en_consensus_config.json
new file mode 100644
index 00000000000..29ec0ca1e9a
--- /dev/null
+++ b/etc/env/en_consensus_config.json
@@ -0,0 +1,16 @@
+{
+ "server_addr": "127.0.0.1:3055",
+ "public_addr": "127.0.0.1:3055",
+ "validators": [
+ "validator:public:bn254:8b0ff0ad1a250e64b0209277148ccee3b64534d8fa60cf25ba0bcc8b65d4d89309cdae79197c2db873d351401093fa0542a5a2071c1a247f2e1abe56d08cbabb"
+ ],
+ "max_payload_size": 5000000,
+ "gossip_static_outbound": [
+ {
+ "key": "node:public:ed25519:ee717abba6aec5baae5e09d457bd2ffc2f121b576cf4170ce15a68163ce4c868",
+ "addr": "127.0.0.1:3054"
+ }
+ ],
+ "gossip_static_inbound": [],
+ "gossip_dynamic_inbound_limit": 0
+}
diff --git a/etc/env/ext-node-docker.toml b/etc/env/ext-node-docker.toml
index cf7332ee6e4..be32233311f 100644
--- a/etc/env/ext-node-docker.toml
+++ b/etc/env/ext-node-docker.toml
@@ -36,11 +36,23 @@ api_namespaces = ["eth", "web3", "net", "pubsub", "zks", "en", "debug"]
bootloader_hash="0x0100038581be3d0e201b3cc45d151ef5cc59eb3a0f146ad44f0f72abf00b594c"
default_aa_hash="0x0100038dc66b69be75ec31653c64cb931678299b9b659472772b2550b703f41c"
+# Should be the same as chain.state_keeper.fee_account_addr.
+operator_addr="0xde03a0B5963f75f1C8485B355fF6D30f3093BDE7"
+
+[en.consensus]
+config_path="etc/env/en_consensus_config.json"
+# generated with zksync_consensus_tools/src/bin/keys.rs
+# node:public:ed25519:147bb71be895846e1d6f5b1c6a8be53848b82bdafcf66e9dfe6ca65581076a1d
+node_key="node:secret:ed25519:d56de77c738326c305c64c25bffe1cc94ea7c639cf71ca3ff94229df27f167ac"
+
[rust]
# `RUST_LOG` environment variable for `env_logger`
# Here we use TOML multiline strings: newlines will be trimmed.
log="""\
warn,\
+zksync_consensus_bft=info,\
+zksync_consensus_network=info,\
+zksync_consensus_storage=info,\
zksync_core=debug,\
zksync_dal=info,\
zksync_eth_client=info,\
diff --git a/etc/env/ext-node.toml b/etc/env/ext-node.toml
index 9feabe84247..fab7b90564f 100644
--- a/etc/env/ext-node.toml
+++ b/etc/env/ext-node.toml
@@ -36,11 +36,23 @@ api_namespaces = ["eth", "web3", "net", "pubsub", "zks", "en", "debug"]
bootloader_hash="0x0100038581be3d0e201b3cc45d151ef5cc59eb3a0f146ad44f0f72abf00b594c"
default_aa_hash="0x0100038dc66b69be75ec31653c64cb931678299b9b659472772b2550b703f41c"
+# Should be the same as chain.state_keeper.fee_account_addr.
+operator_addr="0xde03a0B5963f75f1C8485B355fF6D30f3093BDE7"
+
+[en.consensus]
+config_path="etc/env/en_consensus_config.json"
+# generated with zksync_consensus_tools/src/bin/keys.rs
+# node:public:ed25519:147bb71be895846e1d6f5b1c6a8be53848b82bdafcf66e9dfe6ca65581076a1d
+node_key="node:secret:ed25519:d56de77c738326c305c64c25bffe1cc94ea7c639cf71ca3ff94229df27f167ac"
+
[rust]
# `RUST_LOG` environment variable for `env_logger`
# Here we use TOML multiline strings: newlines will be trimmed.
log="""\
warn,\
+zksync_consensus_bft=info,\
+zksync_consensus_network=info,\
+zksync_consensus_storage=info,\
zksync_core=debug,\
zksync_dal=info,\
zksync_eth_client=info,\
diff --git a/infrastructure/zk/src/lint.ts b/infrastructure/zk/src/lint.ts
index fc83655b48f..7f6065600af 100644
--- a/infrastructure/zk/src/lint.ts
+++ b/infrastructure/zk/src/lint.ts
@@ -30,12 +30,12 @@ async function lintContracts(check: boolean = false) {
async function clippy() {
process.chdir(process.env.ZKSYNC_HOME!);
- await utils.spawn('cargo clippy --tests -- -D warnings');
+ await utils.spawn('cargo clippy --tests --locked -- -D warnings');
}
async function proverClippy() {
process.chdir(process.env.ZKSYNC_HOME! + '/prover');
- await utils.spawn('cargo clippy --tests -- -D warnings -A incomplete_features');
+ await utils.spawn('cargo clippy --tests --locked -- -D warnings -A incomplete_features');
}
const ARGS = [...EXTENSIONS, 'rust', 'prover', 'contracts'];
diff --git a/infrastructure/zk/src/server.ts b/infrastructure/zk/src/server.ts
index e7ae689057f..52b3e66c744 100644
--- a/infrastructure/zk/src/server.ts
+++ b/infrastructure/zk/src/server.ts
@@ -25,7 +25,7 @@ export async function server(rebuildTree: boolean, uring: boolean, components?:
await utils.spawn(`cargo run --bin zksync_server --release ${options}`);
}
-export async function externalNode(reinit: boolean = false) {
+export async function externalNode(reinit: boolean = false, enableConsensus: boolean = false) {
if (process.env.ZKSYNC_ENV != 'ext-node') {
console.warn(`WARNING: using ${process.env.ZKSYNC_ENV} environment for external node`);
console.warn('If this is a mistake, set $ZKSYNC_ENV to "ext-node" or other environment');
@@ -45,7 +45,11 @@ export async function externalNode(reinit: boolean = false) {
clean(path.dirname(process.env.EN_MERKLE_TREE_PATH!));
}
- await utils.spawn('cargo run --release --bin zksync_external_node');
+ let options = '';
+ if (enableConsensus) {
+ options += ' --enable-consensus';
+ }
+ await utils.spawn(`cargo run --release --bin zksync_external_node -- ${options}`);
}
async function create_genesis(cmd: string) {
@@ -135,6 +139,7 @@ export const serverCommand = new Command('server')
export const enCommand = new Command('external-node')
.description('start zksync external node')
.option('--reinit', 'reset postgres and rocksdb before starting')
+ .option('--enable-consensus', 'enables consensus component')
.action(async (cmd: Command) => {
- await externalNode(cmd.reinit);
+ await externalNode(cmd.reinit, cmd.enableConsensus);
});
diff --git a/infrastructure/zk/src/test/test.ts b/infrastructure/zk/src/test/test.ts
index 7bcdd813514..b5c7f28f5d0 100644
--- a/infrastructure/zk/src/test/test.ts
+++ b/infrastructure/zk/src/test/test.ts
@@ -12,7 +12,7 @@ export async function l1Contracts() {
export async function prover() {
process.chdir(process.env.ZKSYNC_HOME! + '/prover');
- await utils.spawn('cargo test --release --workspace');
+ await utils.spawn('cargo test --release --workspace --locked');
}
export async function js() {
diff --git a/prover/Cargo.lock b/prover/Cargo.lock
index 8818baf5ede..b972377545c 100644
--- a/prover/Cargo.lock
+++ b/prover/Cargo.lock
@@ -28,56 +28,13 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
-[[package]]
-name = "aes"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561"
-dependencies = [
- "aes-soft",
- "aesni",
- "cipher",
-]
-
-[[package]]
-name = "aes-ctr"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7729c3cde54d67063be556aeac75a81330d802f0259500ca40cb52967f975763"
-dependencies = [
- "aes-soft",
- "aesni",
- "cipher",
- "ctr",
-]
-
-[[package]]
-name = "aes-soft"
-version = "0.6.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072"
-dependencies = [
- "cipher",
- "opaque-debug",
-]
-
-[[package]]
-name = "aesni"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce"
-dependencies = [
- "cipher",
- "opaque-debug",
-]
-
[[package]]
name = "ahash"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd"
dependencies = [
- "getrandom 0.2.12",
+ "getrandom",
"once_cell",
"version_check",
]
@@ -89,7 +46,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01"
dependencies = [
"cfg-if 1.0.0",
- "getrandom 0.2.12",
+ "getrandom",
"once_cell",
"version_check",
"zerocopy",
@@ -263,15 +220,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "autocfg"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78"
-dependencies = [
- "autocfg 1.1.0",
-]
-
[[package]]
name = "autocfg"
version = "1.1.0"
@@ -473,28 +421,16 @@ dependencies = [
"serde",
]
-[[package]]
-name = "bitvec"
-version = "0.20.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848"
-dependencies = [
- "funty 1.1.0",
- "radium 0.6.2",
- "tap",
- "wyz 0.2.0",
-]
-
[[package]]
name = "bitvec"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
dependencies = [
- "funty 2.0.0",
- "radium 0.7.0",
+ "funty",
+ "radium",
"tap",
- "wyz 0.5.1",
+ "wyz",
]
[[package]]
@@ -503,7 +439,7 @@ version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174"
dependencies = [
- "crypto-mac 0.8.0",
+ "crypto-mac",
"digest 0.9.0",
"opaque-debug",
]
@@ -586,16 +522,6 @@ dependencies = [
"generic-array",
]
-[[package]]
-name = "block-modes"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0"
-dependencies = [
- "block-padding",
- "cipher",
-]
-
[[package]]
name = "block-padding"
version = "0.2.1"
@@ -628,7 +554,7 @@ dependencies = [
"crypto-bigint 0.5.5",
"cs_derive 0.1.0 (git+https://github.com/matter-labs/era-boojum?branch=main)",
"derivative",
- "ethereum-types 0.14.1",
+ "ethereum-types",
"firestorm",
"itertools 0.10.5",
"lazy_static",
@@ -862,15 +788,6 @@ dependencies = [
"half",
]
-[[package]]
-name = "cipher"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801"
-dependencies = [
- "generic-array",
-]
-
[[package]]
name = "circuit_definitions"
version = "0.1.0"
@@ -958,15 +875,6 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
-[[package]]
-name = "cloudabi"
-version = "0.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
-dependencies = [
- "bitflags 1.3.2",
-]
-
[[package]]
name = "cmake"
version = "0.1.50"
@@ -981,7 +889,7 @@ name = "codegen"
version = "0.1.0"
source = "git+https://github.com/matter-labs/solidity_plonk_verifier.git?branch=dev#82f96b7156551087f1c9bfe4f0ea68845b6debfc"
dependencies = [
- "ethereum-types 0.14.1",
+ "ethereum-types",
"franklin-crypto 0.0.5 (git+https://github.com/matter-labs/franklin-crypto?branch=dev)",
"handlebars",
"hex",
@@ -1227,7 +1135,7 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"cfg-if 0.1.10",
"crossbeam-utils 0.7.2",
"lazy_static",
@@ -1271,7 +1179,7 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"cfg-if 0.1.10",
"lazy_static",
]
@@ -1332,16 +1240,6 @@ dependencies = [
"subtle",
]
-[[package]]
-name = "crypto-mac"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a"
-dependencies = [
- "generic-array",
- "subtle",
-]
-
[[package]]
name = "cs_derive"
version = "0.1.0"
@@ -1365,15 +1263,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "ctr"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f"
-dependencies = [
- "cipher",
-]
-
[[package]]
name = "ctrlc"
version = "3.4.2"
@@ -1798,7 +1687,7 @@ version = "18.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898"
dependencies = [
- "ethereum-types 0.14.1",
+ "ethereum-types",
"hex",
"once_cell",
"regex",
@@ -1809,19 +1698,6 @@ dependencies = [
"uint",
]
-[[package]]
-name = "ethbloom"
-version = "0.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfb684ac8fa8f6c5759f788862bb22ec6fe3cb392f6bfd08e3c64b603661e3f8"
-dependencies = [
- "crunchy",
- "fixed-hash 0.7.0",
- "impl-rlp",
- "impl-serde 0.3.2",
- "tiny-keccak 2.0.2",
-]
-
[[package]]
name = "ethbloom"
version = "0.13.0"
@@ -1829,37 +1705,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60"
dependencies = [
"crunchy",
- "fixed-hash 0.8.0",
+ "fixed-hash",
"impl-rlp",
- "impl-serde 0.4.0",
+ "impl-serde",
"tiny-keccak 2.0.2",
]
-[[package]]
-name = "ethereum-types"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05136f7057fe789f06e6d41d07b34e6f70d8c86e5693b60f97aaa6553553bdaf"
-dependencies = [
- "ethbloom 0.11.1",
- "fixed-hash 0.7.0",
- "impl-rlp",
- "impl-serde 0.3.2",
- "primitive-types 0.10.1",
- "uint",
-]
-
[[package]]
name = "ethereum-types"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee"
dependencies = [
- "ethbloom 0.13.0",
- "fixed-hash 0.8.0",
+ "ethbloom",
+ "fixed-hash",
"impl-rlp",
- "impl-serde 0.4.0",
- "primitive-types 0.12.2",
+ "impl-serde",
+ "primitive-types",
"uint",
]
@@ -1953,18 +1815,6 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c5f6c2c942da57e2aaaa84b8a521489486f14e75e7fa91dab70aba913975f98"
-[[package]]
-name = "fixed-hash"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c"
-dependencies = [
- "byteorder",
- "rand 0.8.5",
- "rustc-hex",
- "static_assertions",
-]
-
[[package]]
name = "fixed-hash"
version = "0.8.0"
@@ -2102,12 +1952,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
-[[package]]
-name = "funty"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
-
[[package]]
name = "funty"
version = "2.0.0"
@@ -2239,17 +2083,6 @@ dependencies = [
"zeroize",
]
-[[package]]
-name = "getrandom"
-version = "0.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
-dependencies = [
- "cfg-if 1.0.0",
- "libc",
- "wasi 0.9.0+wasi-snapshot-preview1",
-]
-
[[package]]
name = "getrandom"
version = "0.2.12"
@@ -2258,7 +2091,7 @@ checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
dependencies = [
"cfg-if 1.0.0",
"libc",
- "wasi 0.11.0+wasi-snapshot-preview1",
+ "wasi",
]
[[package]]
@@ -2513,17 +2346,7 @@ version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"
dependencies = [
- "hmac 0.12.1",
-]
-
-[[package]]
-name = "hmac"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15"
-dependencies = [
- "crypto-mac 0.10.1",
- "digest 0.9.0",
+ "hmac",
]
[[package]]
@@ -2695,22 +2518,13 @@ dependencies = [
"unicode-normalization",
]
-[[package]]
-name = "impl-codec"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443"
-dependencies = [
- "parity-scale-codec 2.3.1",
-]
-
[[package]]
name = "impl-codec"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f"
dependencies = [
- "parity-scale-codec 3.6.9",
+ "parity-scale-codec",
]
[[package]]
@@ -2722,15 +2536,6 @@ dependencies = [
"rlp",
]
-[[package]]
-name = "impl-serde"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c"
-dependencies = [
- "serde",
-]
-
[[package]]
name = "impl-serde"
version = "0.4.0"
@@ -2757,7 +2562,7 @@ version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"hashbrown 0.12.3",
]
@@ -3030,7 +2835,7 @@ version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"scopeguard",
]
@@ -3124,7 +2929,7 @@ version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
]
[[package]]
@@ -3258,7 +3063,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
dependencies = [
"libc",
- "wasi 0.11.0+wasi-snapshot-preview1",
+ "wasi",
"windows-sys 0.48.0",
]
@@ -3407,7 +3212,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"num-integer",
"num-traits",
]
@@ -3418,7 +3223,7 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"num-integer",
"num-traits",
"serde",
@@ -3488,7 +3293,7 @@ version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"num-traits",
]
@@ -3498,7 +3303,7 @@ version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"num-integer",
"num-traits",
]
@@ -3519,7 +3324,7 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"num-bigint 0.3.3",
"num-integer",
"num-traits",
@@ -3531,7 +3336,7 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"num-bigint 0.4.4",
"num-integer",
"num-traits",
@@ -3544,7 +3349,7 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
"libm",
]
@@ -3723,44 +3528,6 @@ dependencies = [
"serde",
]
-[[package]]
-name = "parity-crypto"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b92ea9ddac0d6e1db7c49991e7d397d34a9fd814b4c93cda53788e8eef94e35"
-dependencies = [
- "aes",
- "aes-ctr",
- "block-modes",
- "digest 0.9.0",
- "ethereum-types 0.12.1",
- "hmac 0.10.1",
- "lazy_static",
- "pbkdf2 0.7.5",
- "ripemd160",
- "rustc-hex",
- "scrypt",
- "secp256k1 0.20.3",
- "sha2 0.9.9",
- "subtle",
- "tiny-keccak 2.0.2",
- "zeroize",
-]
-
-[[package]]
-name = "parity-scale-codec"
-version = "2.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909"
-dependencies = [
- "arrayvec 0.7.4",
- "bitvec 0.20.4",
- "byte-slice-cast",
- "impl-trait-for-tuples",
- "parity-scale-codec-derive 2.3.1",
- "serde",
-]
-
[[package]]
name = "parity-scale-codec"
version = "3.6.9"
@@ -3768,25 +3535,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe"
dependencies = [
"arrayvec 0.7.4",
- "bitvec 1.0.1",
+ "bitvec",
"byte-slice-cast",
"impl-trait-for-tuples",
- "parity-scale-codec-derive 3.6.9",
+ "parity-scale-codec-derive",
"serde",
]
-[[package]]
-name = "parity-scale-codec-derive"
-version = "2.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27"
-dependencies = [
- "proc-macro-crate 1.3.1",
- "proc-macro2 1.0.76",
- "quote 1.0.35",
- "syn 1.0.109",
-]
-
[[package]]
name = "parity-scale-codec-derive"
version = "3.6.9"
@@ -3822,44 +3577,12 @@ dependencies = [
"windows-targets 0.48.5",
]
-[[package]]
-name = "password-hash"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54986aa4bfc9b98c6a5f40184223658d187159d7b3c6af33f2b2aa25ae1db0fa"
-dependencies = [
- "base64ct",
- "rand_core 0.6.4",
-]
-
[[package]]
name = "paste"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
-[[package]]
-name = "pbkdf2"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b3b8c0d71734018084da0c0354193a5edfb81b20d2d57a92c5b154aefc554a4a"
-dependencies = [
- "crypto-mac 0.10.1",
-]
-
-[[package]]
-name = "pbkdf2"
-version = "0.7.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf916dd32dd26297907890d99dc2740e33f6bd9073965af4ccff2967962f5508"
-dependencies = [
- "base64ct",
- "crypto-mac 0.10.1",
- "hmac 0.10.1",
- "password-hash",
- "sha2 0.9.9",
-]
-
[[package]]
name = "peeking_take_while"
version = "0.1.2"
@@ -4076,29 +3799,16 @@ dependencies = [
"syn 2.0.48",
]
-[[package]]
-name = "primitive-types"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373"
-dependencies = [
- "fixed-hash 0.7.0",
- "impl-codec 0.5.1",
- "impl-rlp",
- "impl-serde 0.3.2",
- "uint",
-]
-
[[package]]
name = "primitive-types"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2"
dependencies = [
- "fixed-hash 0.8.0",
- "impl-codec 0.6.0",
+ "fixed-hash",
+ "impl-codec",
"impl-rlp",
- "impl-serde 0.4.0",
+ "impl-serde",
"uint",
]
@@ -4225,8 +3935,8 @@ dependencies = [
"lazy_static",
"num-traits",
"rand 0.8.5",
- "rand_chacha 0.3.1",
- "rand_xorshift 0.3.0",
+ "rand_chacha",
+ "rand_xorshift",
"regex-syntax 0.8.2",
"rusty-fork",
"tempfile",
@@ -4372,7 +4082,7 @@ dependencies = [
"mach2",
"once_cell",
"raw-cpuid",
- "wasi 0.11.0+wasi-snapshot-preview1",
+ "wasi",
"web-sys",
"winapi",
]
@@ -4416,12 +4126,6 @@ dependencies = [
"proc-macro2 1.0.76",
]
-[[package]]
-name = "radium"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb"
-
[[package]]
name = "radium"
version = "0.7.0"
@@ -4441,36 +4145,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "rand"
-version = "0.6.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
-dependencies = [
- "autocfg 0.1.8",
- "libc",
- "rand_chacha 0.1.1",
- "rand_core 0.4.2",
- "rand_hc 0.1.0",
- "rand_isaac",
- "rand_jitter",
- "rand_os",
- "rand_pcg",
- "rand_xorshift 0.1.1",
- "winapi",
-]
-
-[[package]]
-name = "rand"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
-dependencies = [
- "rand_chacha 0.2.2",
- "rand_core 0.5.1",
- "rand_hc 0.2.0",
-]
-
[[package]]
name = "rand"
version = "0.8.5"
@@ -4478,30 +4152,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
- "rand_chacha 0.3.1",
+ "rand_chacha",
"rand_core 0.6.4",
]
-[[package]]
-name = "rand_chacha"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
-dependencies = [
- "autocfg 0.1.8",
- "rand_core 0.3.1",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
-dependencies = [
- "ppv-lite86",
- "rand_core 0.5.1",
-]
-
[[package]]
name = "rand_chacha"
version = "0.3.1"
@@ -4527,93 +4181,13 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
-[[package]]
-name = "rand_core"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
-dependencies = [
- "getrandom 0.1.16",
-]
-
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
- "getrandom 0.2.12",
-]
-
-[[package]]
-name = "rand_hc"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
-dependencies = [
- "rand_core 0.3.1",
-]
-
-[[package]]
-name = "rand_hc"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
-dependencies = [
- "rand_core 0.5.1",
-]
-
-[[package]]
-name = "rand_isaac"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
-dependencies = [
- "rand_core 0.3.1",
-]
-
-[[package]]
-name = "rand_jitter"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
-dependencies = [
- "libc",
- "rand_core 0.4.2",
- "winapi",
-]
-
-[[package]]
-name = "rand_os"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
-dependencies = [
- "cloudabi",
- "fuchsia-cprng",
- "libc",
- "rand_core 0.4.2",
- "rdrand",
- "winapi",
-]
-
-[[package]]
-name = "rand_pcg"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
-dependencies = [
- "autocfg 0.1.8",
- "rand_core 0.4.2",
-]
-
-[[package]]
-name = "rand_xorshift"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
-dependencies = [
- "rand_core 0.3.1",
+ "getrandom",
]
[[package]]
@@ -4820,7 +4394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb"
dependencies = [
"crypto-bigint 0.4.9",
- "hmac 0.12.1",
+ "hmac",
"zeroize",
]
@@ -4830,7 +4404,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"
dependencies = [
- "hmac 0.12.1",
+ "hmac",
"subtle",
]
@@ -4856,31 +4430,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74"
dependencies = [
"cc",
- "getrandom 0.2.12",
+ "getrandom",
"libc",
"spin 0.9.8",
"untrusted 0.9.0",
"windows-sys 0.48.0",
]
-[[package]]
-name = "ripemd160"
-version = "0.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251"
-dependencies = [
- "block-buffer 0.9.0",
- "digest 0.9.0",
- "opaque-debug",
-]
-
[[package]]
name = "rkyv"
version = "0.7.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5"
dependencies = [
- "bitvec 1.0.1",
+ "bitvec",
"bytecheck",
"bytes",
"hashbrown 0.12.3",
@@ -5054,15 +4617,6 @@ version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
-[[package]]
-name = "salsa20"
-version = "0.7.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "399f290ffc409596022fce5ea5d4138184be4784f2b28c62c59f0d8389059a15"
-dependencies = [
- "cipher",
-]
-
[[package]]
name = "same-file"
version = "1.0.6"
@@ -5087,22 +4641,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
-[[package]]
-name = "scrypt"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8da492dab03f925d977776a0b7233d7b934d6dc2b94faead48928e2e9bacedb9"
-dependencies = [
- "base64 0.13.1",
- "hmac 0.10.1",
- "pbkdf2 0.6.0",
- "rand 0.7.3",
- "rand_core 0.5.1",
- "salsa20",
- "sha2 0.9.9",
- "subtle",
-]
-
[[package]]
name = "sct"
version = "0.7.1"
@@ -5147,32 +4685,13 @@ dependencies = [
"zeroize",
]
-[[package]]
-name = "secp256k1"
-version = "0.20.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a"
-dependencies = [
- "rand 0.6.5",
- "secp256k1-sys 0.4.2",
-]
-
[[package]]
name = "secp256k1"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f"
dependencies = [
- "secp256k1-sys 0.8.1",
-]
-
-[[package]]
-name = "secp256k1-sys"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036"
-dependencies = [
- "cc",
+ "secp256k1-sys",
]
[[package]]
@@ -5590,7 +5109,7 @@ version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
- "autocfg 1.1.0",
+ "autocfg",
]
[[package]]
@@ -5806,7 +5325,7 @@ dependencies = [
"generic-array",
"hex",
"hkdf",
- "hmac 0.12.1",
+ "hmac",
"itoa",
"log",
"md-5",
@@ -5848,7 +5367,7 @@ dependencies = [
"futures-util",
"hex",
"hkdf",
- "hmac 0.12.1",
+ "hmac",
"home",
"ipnetwork",
"itoa",
@@ -6751,12 +6270,6 @@ dependencies = [
"try-lock",
]
-[[package]]
-name = "wasi"
-version = "0.9.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
-
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@@ -6863,7 +6376,7 @@ dependencies = [
"bytes",
"derive_more",
"ethabi",
- "ethereum-types 0.14.1",
+ "ethereum-types",
"futures 0.3.30",
"futures-timer",
"headers",
@@ -6876,7 +6389,7 @@ dependencies = [
"pin-project",
"reqwest",
"rlp",
- "secp256k1 0.27.0",
+ "secp256k1",
"serde",
"serde_json",
"tiny-keccak 2.0.2",
@@ -7098,12 +6611,6 @@ dependencies = [
"windows-sys 0.48.0",
]
-[[package]]
-name = "wyz"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
-
[[package]]
name = "wyz"
version = "0.5.1"
@@ -7340,7 +6847,7 @@ version = "1.3.1"
source = "git+https://github.com/matter-labs/era-zkevm_opcode_defs.git?branch=v1.3.1#00d4ad2292bd55374a0fa10fe11686d7a109d8a0"
dependencies = [
"bitflags 1.3.2",
- "ethereum-types 0.14.1",
+ "ethereum-types",
"lazy_static",
"sha2 0.10.8",
]
@@ -7352,7 +6859,7 @@ source = "git+https://github.com/matter-labs/era-zkevm_opcode_defs.git?branch=v1
dependencies = [
"bitflags 2.4.1",
"blake2 0.10.6 (git+https://github.com/RustCrypto/hashes.git?rev=1f727ce37ff40fa0cce84eb8543a45bdd3ca4a4e)",
- "ethereum-types 0.14.1",
+ "ethereum-types",
"k256 0.11.6",
"lazy_static",
"sha2 0.10.6",
@@ -7366,7 +6873,7 @@ source = "git+https://github.com/matter-labs/era-zkevm_opcode_defs.git?branch=v1
dependencies = [
"bitflags 2.4.1",
"blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "ethereum-types 0.14.1",
+ "ethereum-types",
"k256 0.13.3",
"lazy_static",
"sha2 0.10.8",
@@ -7464,7 +6971,7 @@ dependencies = [
[[package]]
name = "zksync_concurrency"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"once_cell",
@@ -7491,7 +6998,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_crypto"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"blst",
@@ -7509,7 +7016,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_roles"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"bit-vec",
@@ -7529,7 +7036,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_storage"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"async-trait",
@@ -7547,7 +7054,7 @@ dependencies = [
[[package]]
name = "zksync_consensus_utils"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"thiserror",
"zksync_concurrency",
@@ -7697,7 +7204,7 @@ dependencies = [
[[package]]
name = "zksync_protobuf"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"bit-vec",
@@ -7715,7 +7222,7 @@ dependencies = [
[[package]]
name = "zksync_protobuf_build"
version = "0.1.0"
-source = "git+https://github.com/matter-labs/era-consensus.git?rev=5727a3e0b22470bb90092388f9125bcb366df613#5727a3e0b22470bb90092388f9125bcb366df613"
+source = "git+https://github.com/matter-labs/era-consensus.git?rev=5b3d383d7a65b0fbe2a771fecf4313f5083be9ae#5b3d383d7a65b0fbe2a771fecf4313f5083be9ae"
dependencies = [
"anyhow",
"heck 0.4.1",
@@ -7870,22 +7377,18 @@ dependencies = [
"blake2 0.10.6 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono",
"codegen 0.1.0",
- "ethereum-types 0.12.1",
"hex",
"num 0.4.1",
"num_enum",
"once_cell",
- "parity-crypto",
"prost",
"rlp",
+ "secp256k1",
"serde",
"serde_json",
"serde_with",
"strum",
"thiserror",
- "zk_evm 1.3.3 (git+https://github.com/matter-labs/era-zk_evm.git?tag=v1.3.3-rc2)",
- "zk_evm 1.4.0",
- "zk_evm 1.4.1",
"zkevm_test_harness 1.3.3",
"zksync_basic_types",
"zksync_config",