Skip to content

Commit

Permalink
feat: attester committees data extractor (BFT-434) (matter-labs#2684)
Browse files Browse the repository at this point in the history
Extraction of the attester committee from consensus registry state. If
consensus registry address is not specified, we fall back to attester
committee from genesis. This pr does NOT enable the dynamic attestation,
as the registry address needs to be added to the main node config first.

---------

Co-authored-by: Moshe Shababo <17073733+moshababo@users.noreply.github.com>
Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
  • Loading branch information
3 people authored Sep 10, 2024
1 parent fb57d05 commit 92dde03
Show file tree
Hide file tree
Showing 57 changed files with 1,845 additions and 559 deletions.
67 changes: 39 additions & 28 deletions Cargo.lock

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

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,16 @@ zk_evm_1_5_0 = { package = "zk_evm", version = "=0.150.4" }
vm2 = { git = "https://github.com/matter-labs/vm2.git", rev = "4ef15d46410ffc11744771a3a6c7c09dd9470c90" }

# Consensus dependencies.
zksync_concurrency = "=0.1.0-rc.11"
zksync_consensus_bft = "=0.1.0-rc.11"
zksync_consensus_crypto = "=0.1.0-rc.11"
zksync_consensus_executor = "=0.1.0-rc.11"
zksync_consensus_network = "=0.1.0-rc.11"
zksync_consensus_roles = "=0.1.0-rc.11"
zksync_consensus_storage = "=0.1.0-rc.11"
zksync_consensus_utils = "=0.1.0-rc.11"
zksync_protobuf = "=0.1.0-rc.11"
zksync_protobuf_build = "=0.1.0-rc.11"
zksync_concurrency = "=0.1.0-rc.12"
zksync_consensus_bft = "=0.1.0-rc.12"
zksync_consensus_crypto = "=0.1.0-rc.12"
zksync_consensus_executor = "=0.1.0-rc.12"
zksync_consensus_network = "=0.1.0-rc.12"
zksync_consensus_roles = "=0.1.0-rc.12"
zksync_consensus_storage = "=0.1.0-rc.12"
zksync_consensus_utils = "=0.1.0-rc.12"
zksync_protobuf = "=0.1.0-rc.12"
zksync_protobuf_build = "=0.1.0-rc.12"

# "Local" dependencies
zksync_multivm = { version = "0.1.0", path = "core/lib/multivm" }
Expand Down
8 changes: 7 additions & 1 deletion core/bin/external_node/src/node_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,13 @@ impl ExternalNodeBuilder {
let config = self.config.consensus.clone();
let secrets =
config::read_consensus_secrets().context("config::read_consensus_secrets()")?;
let layer = ExternalNodeConsensusLayer { config, secrets };
let layer = ExternalNodeConsensusLayer {
build_version: crate::metadata::SERVER_VERSION
.parse()
.context("CRATE_VERSION.parse()")?,
config,
secrets,
};
self.node.add_layer(layer);
Ok(self)
}
Expand Down
4 changes: 3 additions & 1 deletion core/lib/config/src/configs/consensus.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::{BTreeMap, BTreeSet};

use secrecy::{ExposeSecret as _, Secret};
use zksync_basic_types::L2ChainId;
use zksync_basic_types::{ethabi, L2ChainId};
use zksync_concurrency::{limiter, time};

/// `zksync_consensus_crypto::TextFmt` representation of `zksync_consensus_roles::validator::PublicKey`.
Expand Down Expand Up @@ -89,6 +89,8 @@ pub struct GenesisSpec {
/// Leader of the committee. Represents
/// `zksync_consensus_roles::validator::LeaderSelectionMode::Sticky`.
pub leader: ValidatorPublicKey,
/// Address of the registry contract.
pub registry_address: Option<ethabi::Address>,
}

#[derive(Clone, Debug, PartialEq, Default)]
Expand Down
19 changes: 10 additions & 9 deletions core/lib/config/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,17 @@ impl Distribution<configs::ContractsConfig> for EncodeDist {
default_upgrade_addr: rng.gen(),
diamond_proxy_addr: rng.gen(),
validator_timelock_addr: rng.gen(),
l1_erc20_bridge_proxy_addr: rng.gen(),
l2_erc20_bridge_addr: rng.gen(),
l1_shared_bridge_proxy_addr: rng.gen(),
l2_shared_bridge_addr: rng.gen(),
l1_weth_bridge_proxy_addr: rng.gen(),
l2_weth_bridge_addr: rng.gen(),
l2_testnet_paymaster_addr: rng.gen(),
l1_erc20_bridge_proxy_addr: self.sample_opt(|| rng.gen()),
l2_erc20_bridge_addr: self.sample_opt(|| rng.gen()),
l1_shared_bridge_proxy_addr: self.sample_opt(|| rng.gen()),
l2_shared_bridge_addr: self.sample_opt(|| rng.gen()),
l1_weth_bridge_proxy_addr: self.sample_opt(|| rng.gen()),
l2_weth_bridge_addr: self.sample_opt(|| rng.gen()),
l2_testnet_paymaster_addr: self.sample_opt(|| rng.gen()),
l1_multicall3_addr: rng.gen(),
base_token_addr: rng.gen(),
chain_admin_addr: rng.gen(),
ecosystem_contracts: self.sample(rng),
base_token_addr: self.sample_opt(|| rng.gen()),
chain_admin_addr: self.sample_opt(|| rng.gen()),
}
}
}
Expand Down Expand Up @@ -777,6 +777,7 @@ impl Distribution<configs::consensus::GenesisSpec> for EncodeDist {
validators: self.sample_collect(rng),
attesters: self.sample_collect(rng),
leader: ValidatorPublicKey(self.sample(rng)),
registry_address: self.sample_opt(|| rng.gen()),
}
}
}
Expand Down

This file was deleted.

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

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

Loading

0 comments on commit 92dde03

Please sign in to comment.