Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(zk_toolbox): Add external_node consensus support #2821

Merged
merged 42 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6e0d8a5
Copy consensus secrets
matias-gonz Sep 6, 2024
8049f39
Copy consensus config
matias-gonz Sep 6, 2024
f0c0dc2
Add consensus to external_node::run
matias-gonz Sep 6, 2024
068f191
Merge branch 'main' into matias-zki-consensus
matias-gonz Sep 6, 2024
f277585
Fix consensus secrets
matias-gonz Sep 6, 2024
15b1a54
Merge branch 'matias-zki-consensus' of github.com:matter-labs/zksync-…
matias-gonz Sep 6, 2024
a51a3e3
Add generate_consensus_secrets
matias-gonz Sep 9, 2024
e5bf82f
Add consensus config
matias-gonz Sep 9, 2024
c0b6053
Set en consensus config
matias-gonz Sep 9, 2024
b3866ba
impl SaveConfig for ConsensusConfig
matias-gonz Sep 10, 2024
ecae56e
Generate consensus_secrets
matias-gonz Sep 10, 2024
a1bb148
Remove unused CONSENSUS_SECRETS_PATH
matias-gonz Sep 10, 2024
b6a99e1
Fix public addr parse
matias-gonz Sep 10, 2024
f54c1cf
set correct key configs
Deniallugo Sep 10, 2024
7892527
Merge pull request #2831 from matter-labs/deniallugo-set-correct-key-…
matias-gonz Sep 10, 2024
b8523bf
remove unused params
matias-gonz Sep 10, 2024
8f5b3aa
Switch order
matias-gonz Sep 10, 2024
a3bafe3
Update public and server address
matias-gonz Sep 10, 2024
ec7dbb4
move consensus keys
matias-gonz Sep 10, 2024
149fafb
Fix main node server and public address ports
matias-gonz Sep 10, 2024
b580b11
Make consensus config optional
matias-gonz Sep 10, 2024
9b4fb26
Add update_port_in_host
matias-gonz Sep 10, 2024
ace46fa
Merge branch 'main' of github.com:matter-labs/zksync-era into matias-…
matias-gonz Sep 10, 2024
90d6305
Merge branch 'main' into matias-zki-consensus
matias-gonz Sep 11, 2024
1a1c47a
Add consensus to ci
matias-gonz Sep 11, 2024
ef57ee7
Merge branch 'matias-zki-consensus' of github.com:matter-labs/zksync-…
matias-gonz Sep 11, 2024
36b46e6
Add basic_witness_input_producer to RocksDbs
matias-gonz Sep 11, 2024
69bf960
Create consensus chain with custom token
matias-gonz Sep 11, 2024
318b240
Create consensus utils
matias-gonz Sep 11, 2024
5ed80d7
Update consensus utils
matias-gonz Sep 11, 2024
82068e0
Add get_consensus_config
matias-gonz Sep 11, 2024
c3fe95e
Make strucs pub
matias-gonz Sep 11, 2024
5a2a394
Use Url::parse in update_port_in_host
matias-gonz Sep 11, 2024
e3b4052
Use SocketAddr instead of strings
matias-gonz Sep 11, 2024
fabd6b9
Update constants
matias-gonz Sep 11, 2024
43bcc1a
Merge branch 'main' into matias-zki-consensus
Deniallugo Sep 11, 2024
76d5574
Update constants
matias-gonz Sep 12, 2024
fc4bd6a
Merge branch 'matias-zki-consensus' of github.com:matter-labs/zksync-…
matias-gonz Sep 12, 2024
7df30b6
Change SecretKeys to ConsensusSecretKeys
matias-gonz Sep 12, 2024
3ee92a1
Change let if to map
matias-gonz Sep 12, 2024
8c1c48d
fmt
matias-gonz Sep 12, 2024
729388e
Merge branch 'main' into matias-zki-consensus
Deniallugo Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions core/bin/external_node/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use zksync_node_api_server::{
tx_sender::TxSenderConfig,
web3::{state::InternalApiConfig, Namespace},
};
use zksync_protobuf_config::proto;
use zksync_protobuf_config::proto::{self};
Deniallugo marked this conversation as resolved.
Show resolved Hide resolved
use zksync_snapshots_applier::SnapshotsApplierConfig;
use zksync_types::{
api::BridgeAddresses, commitment::L1BatchCommitmentMode, url::SensitiveUrl, Address,
Expand Down Expand Up @@ -1217,6 +1217,7 @@ pub(crate) struct ExternalNodeConfig<R = RemoteENConfig> {
pub observability: ObservabilityENConfig,
pub experimental: ExperimentalENConfig,
pub consensus: Option<ConsensusConfig>,
pub consensus_secrets: Option<ConsensusSecrets>,
pub api_component: ApiComponentConfig,
pub tree_component: TreeComponentConfig,
pub remote: R,
Expand All @@ -1240,6 +1241,8 @@ impl ExternalNodeConfig<()> {
tree_component: envy::prefixed("EN_TREE_")
.from_env::<TreeComponentConfig>()
.context("could not load external node config (tree component params)")?,
consensus_secrets: read_consensus_secrets()
.context("config::read_consensus_secrets()")?,
remote: (),
})
}
Expand All @@ -1262,7 +1265,7 @@ impl ExternalNodeConfig<()> {
.map(read_yaml_repr::<proto::consensus::Config>)
.transpose()
.context("failed decoding consensus YAML config")?;

let consensus_secrets = secrets_config.consensus.clone();
let required = RequiredENConfig::from_configs(
&general_config,
&external_node_config,
Expand Down Expand Up @@ -1298,6 +1301,7 @@ impl ExternalNodeConfig<()> {
consensus,
api_component,
tree_component,
consensus_secrets,
remote: (),
})
}
Expand Down Expand Up @@ -1332,6 +1336,7 @@ impl ExternalNodeConfig<()> {
consensus: self.consensus,
tree_component: self.tree_component,
api_component: self.api_component,
consensus_secrets: self.consensus_secrets,
remote,
})
}
Expand All @@ -1348,6 +1353,7 @@ impl ExternalNodeConfig {
observability: ObservabilityENConfig::default(),
experimental: ExperimentalENConfig::mock(),
consensus: None,
consensus_secrets: None,
api_component: ApiComponentConfig {
tree_api_remote_url: None,
},
Expand Down
9 changes: 2 additions & 7 deletions core/bin/external_node/src/node_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ use zksync_node_framework::{
};
use zksync_state::RocksdbStorageOptions;

use crate::{
config::{self, ExternalNodeConfig},
metrics::framework::ExternalNodeMetricsLayer,
Component,
};
use crate::{config::ExternalNodeConfig, metrics::framework::ExternalNodeMetricsLayer, Component};

/// Builder for the external node.
#[derive(Debug)]
Expand Down Expand Up @@ -240,8 +236,7 @@ impl ExternalNodeBuilder {

fn add_consensus_layer(mut self) -> anyhow::Result<Self> {
let config = self.config.consensus.clone();
let secrets =
config::read_consensus_secrets().context("config::read_consensus_secrets()")?;
let secrets = self.config.consensus_secrets.clone();
let layer = ExternalNodeConsensusLayer { config, secrets };
self.node.add_layer(layer);
Ok(self)
Expand Down
3 changes: 2 additions & 1 deletion core/lib/config/src/configs/consensus.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::{BTreeMap, BTreeSet};

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

Expand Down
Loading
Loading