Skip to content

Commit

Permalink
Fix consensus port allocation in chain init
Browse files Browse the repository at this point in the history
  • Loading branch information
matias-gonz committed Sep 26, 2024
1 parent 91ab676 commit 364229c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions zk_toolbox/crates/zk_inception/src/commands/chain/init.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use anyhow::Context;
use common::{config::global_config, git, logger, spinner::Spinner};
use config::{
copy_configs, get_consensus_port, set_l1_rpc_url, traits::SaveConfigWithBasePath,
update_from_chain_config, ChainConfig, EcosystemConfig,
copy_configs, set_l1_rpc_url, traits::SaveConfigWithBasePath, update_from_chain_config,
ChainConfig, EcosystemConfig, DEFAULT_CONSENSUS_PORT,
};
use types::BaseToken;
use xshell::Shell;
Expand All @@ -20,6 +20,7 @@ use crate::{
},
portal::update_portal_config,
},
defaults::PORT_RANGE_END,
messages::{
msg_initializing_chain, MSG_ACCEPTING_ADMIN_SPINNER, MSG_CHAIN_INITIALIZED,
MSG_CHAIN_NOT_FOUND_ERR, MSG_DEPLOYING_PAYMASTER, MSG_GENESIS_DATABASE_ERR,
Expand Down Expand Up @@ -68,7 +69,10 @@ pub async fn init(
}
let mut general_config = chain_config.get_general_config()?;

let consensus_port = get_consensus_port(&general_config);
let consensus_port = ecosystem_ports.allocate_port(
(DEFAULT_CONSENSUS_PORT + (chain_config.id * 100) as u16)..PORT_RANGE_END,
"Consensus".to_string(),
)?;

let consensus_keys = generate_consensus_keys();
let consensus_config = get_consensus_config(
Expand Down

0 comments on commit 364229c

Please sign in to comment.