From 7e084a201097749d4bede9b1d2f69622c636efc9 Mon Sep 17 00:00:00 2001 From: Alexander Melnikov Date: Tue, 1 Oct 2024 11:29:49 -0600 Subject: [PATCH] load_current_chain --- .../src/commands/chain/accept_chain_ownership.rs | 5 ++--- .../crates/zk_inception/src/commands/chain/genesis/mod.rs | 5 ++--- .../crates/zk_inception/src/commands/chain/genesis/server.rs | 4 +--- .../crates/zk_inception/src/commands/chain/init/configs.rs | 5 ++--- .../crates/zk_inception/src/commands/chain/init/mod.rs | 2 +- .../crates/zk_inception/src/commands/chain/register_chain.rs | 4 +--- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/accept_chain_ownership.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/accept_chain_ownership.rs index bfa91063004c..37d69fcf5bcc 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/accept_chain_ownership.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/accept_chain_ownership.rs @@ -1,5 +1,5 @@ use anyhow::Context; -use common::{config::global_config, forge::ForgeScriptArgs, logger, spinner::Spinner}; +use common::{forge::ForgeScriptArgs, logger, spinner::Spinner}; use config::EcosystemConfig; use xshell::Shell; @@ -12,10 +12,9 @@ use crate::{ }; pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { - let chain_name = global_config().chain_name.clone(); let ecosystem_config = EcosystemConfig::from_file(shell)?; let chain_config = ecosystem_config - .load_chain(chain_name) + .load_current_chain() .context(MSG_CHAIN_NOT_INITIALIZED)?; let contracts = chain_config.get_contracts_config()?; let secrets = chain_config.get_secrets_config()?; diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/genesis/mod.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/genesis/mod.rs index f40da2cdfc92..01842c2916ae 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/genesis/mod.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/genesis/mod.rs @@ -1,6 +1,6 @@ use anyhow::Context; use clap::{command, Parser, Subcommand}; -use common::{config::global_config, logger, spinner::Spinner}; +use common::{logger, spinner::Spinner}; use config::{ChainConfig, EcosystemConfig}; use xshell::Shell; @@ -46,10 +46,9 @@ pub(crate) async fn run(args: GenesisCommand, shell: &Shell) -> anyhow::Result<( } pub async fn run_genesis(args: GenesisArgs, shell: &Shell) -> anyhow::Result<()> { - let chain_name = global_config().chain_name.clone(); let ecosystem_config = EcosystemConfig::from_file(shell)?; let chain_config = ecosystem_config - .load_chain(chain_name) + .load_current_chain() .context(MSG_CHAIN_NOT_INITIALIZED)?; let args = args.fill_values_with_prompt(&chain_config); diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/genesis/server.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/genesis/server.rs index bf682f139daf..50a74b7ea9e4 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/genesis/server.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/genesis/server.rs @@ -1,6 +1,5 @@ use anyhow::Context; use common::{ - config::global_config, logger, server::{Server, ServerMode}, spinner::Spinner, @@ -17,10 +16,9 @@ use crate::messages::{ }; pub async fn run(shell: &Shell) -> anyhow::Result<()> { - let chain_name = global_config().chain_name.clone(); let ecosystem_config = EcosystemConfig::from_file(shell)?; let chain_config = ecosystem_config - .load_chain(chain_name) + .load_current_chain() .context(MSG_CHAIN_NOT_INITIALIZED)?; let spinner = Spinner::new(MSG_STARTING_GENESIS_SPINNER); diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/init/configs.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/init/configs.rs index 0c3a7694732e..8edcd9d1c7ce 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/init/configs.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/init/configs.rs @@ -1,5 +1,5 @@ use anyhow::Context; -use common::{config::global_config, logger}; +use common::logger; use config::{ copy_configs, set_l1_rpc_url, update_from_chain_config, ChainConfig, ContractsConfig, EcosystemConfig, @@ -29,10 +29,9 @@ use crate::{ }; pub async fn run(args: InitConfigsArgs, shell: &Shell) -> anyhow::Result<()> { - let chain_name = global_config().chain_name.clone(); let ecosystem_config = EcosystemConfig::from_file(shell)?; let chain_config = ecosystem_config - .load_chain(chain_name) + .load_current_chain() .context(MSG_CHAIN_NOT_FOUND_ERR)?; let args = args.fill_values_with_prompt(&chain_config); diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/init/mod.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/init/mod.rs index 8527f9a03a24..8a36f4e32b2f 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/init/mod.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/init/mod.rs @@ -136,7 +136,7 @@ pub async fn init( spinner.finish(); } - // Deploy L2 contracts: L2 Shared Bridge, L2 Default Upgrader, etc. (run by L2 Governor) + // Deploy L2 contracts: L2SharedBridge, L2DefaultUpgrader, ... (run by L1 Governor) deploy_l2_contracts::deploy_l2_contracts( shell, chain_config, diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/register_chain.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/register_chain.rs index e2ce133dfa83..9f2ff41f897e 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/register_chain.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/register_chain.rs @@ -1,6 +1,5 @@ use anyhow::Context; use common::{ - config::global_config, forge::{Forge, ForgeScriptArgs}, logger, spinner::Spinner, @@ -24,10 +23,9 @@ use crate::{ }; pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { - let chain_name = global_config().chain_name.clone(); let ecosystem_config = EcosystemConfig::from_file(shell)?; let chain_config = ecosystem_config - .load_chain(chain_name) + .load_current_chain() .context(MSG_CHAIN_NOT_INITIALIZED)?; let mut contracts = chain_config.get_contracts_config()?; let secrets = chain_config.get_secrets_config()?;