diff --git a/zk_toolbox/crates/config/src/wallet_creation.rs b/zk_toolbox/crates/config/src/wallet_creation.rs index a27d55f6f46b..6cfdf08a36d3 100644 --- a/zk_toolbox/crates/config/src/wallet_creation.rs +++ b/zk_toolbox/crates/config/src/wallet_creation.rs @@ -58,6 +58,10 @@ pub fn create_localhost_wallets( blob_operator: Wallet::from_mnemonic(ð_mnemonic.test_mnemonic, &base_path, 2)?, fee_account: Wallet::from_mnemonic(ð_mnemonic.test_mnemonic, &base_path, 3)?, governor: Wallet::from_mnemonic(ð_mnemonic.test_mnemonic, &base_path, 4)?, - token_multiplier_setter: Wallet::from_mnemonic(ð_mnemonic.test_mnemonic, &base_path, 5)?, + token_multiplier_setter: Some(Wallet::from_mnemonic( + ð_mnemonic.test_mnemonic, + &base_path, + 5, + )?), }) } diff --git a/zk_toolbox/crates/config/src/wallets.rs b/zk_toolbox/crates/config/src/wallets.rs index a2e5be87440a..9c87453954ec 100644 --- a/zk_toolbox/crates/config/src/wallets.rs +++ b/zk_toolbox/crates/config/src/wallets.rs @@ -15,7 +15,7 @@ pub struct WalletsConfig { pub blob_operator: Wallet, pub fee_account: Wallet, pub governor: Wallet, - pub token_multiplier_setter: Wallet, + pub token_multiplier_setter: Option, } impl WalletsConfig { @@ -27,7 +27,7 @@ impl WalletsConfig { blob_operator: Wallet::random(rng), fee_account: Wallet::random(rng), governor: Wallet::random(rng), - token_multiplier_setter: Wallet::random(rng), + token_multiplier_setter: Some(Wallet::random(rng)), } } @@ -39,7 +39,7 @@ impl WalletsConfig { blob_operator: Wallet::empty(), fee_account: Wallet::empty(), governor: Wallet::empty(), - token_multiplier_setter: Wallet::empty(), + token_multiplier_setter: Some(Wallet::empty()), } } pub fn deployer_private_key(&self) -> Option { diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/init.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/init.rs index 793fbbf31aee..a5f57981d583 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/init.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/init.rs @@ -36,7 +36,7 @@ use crate::{ MSG_CHAIN_NOT_FOUND_ERR, MSG_DISTRIBUTING_ETH_SPINNER, MSG_GENESIS_DATABASE_ERR, MSG_MINT_BASE_TOKEN_SPINNER, MSG_PORTAL_FAILED_TO_CREATE_CONFIG_ERR, MSG_REGISTERING_CHAIN_SPINNER, MSG_SELECTED_CONFIG, - MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER, + MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER, MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND, }, utils::forge::{check_the_balance, fill_forge_private_key}, }; @@ -112,22 +112,25 @@ pub async fn init( .await?; spinner.finish(); - let spinner = Spinner::new(MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER); - set_token_multiplier_setter( - shell, - ecosystem_config, - chain_config.get_wallets_config()?.governor_private_key(), - contracts_config.l1.chain_admin_addr, - ecosystem_config - .get_wallets() - .unwrap() - .token_multiplier_setter - .address, - &init_args.forge_args.clone(), - init_args.l1_rpc_url.clone(), - ) - .await?; - spinner.finish(); + if chain_config.base_token != BaseToken::eth() { + let spinner = Spinner::new(MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER); + set_token_multiplier_setter( + shell, + ecosystem_config, + chain_config.get_wallets_config()?.governor_private_key(), + contracts_config.l1.chain_admin_addr, + chain_config + .get_wallets_config() + .unwrap() + .token_multiplier_setter + .context(MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND)? + .address, + &init_args.forge_args.clone(), + init_args.l1_rpc_url.clone(), + ) + .await?; + spinner.finish(); + } deploy_l2_contracts::deploy_l2_contracts( shell, diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/set_token_multiplier_setter.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/set_token_multiplier_setter.rs index 0ab0d451f1f7..f92391c22f47 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/set_token_multiplier_setter.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/set_token_multiplier_setter.rs @@ -15,7 +15,7 @@ use crate::{ messages::{ MSG_CHAIN_NOT_INITIALIZED, MSG_L1_SECRETS_MUST_BE_PRESENTED, MSG_TOKEN_MULTIPLIER_SETTER_UPDATED_TO, MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER, - MSG_WALLETS_CONFIG_MUST_BE_PRESENT, + MSG_WALLETS_CONFIG_MUST_BE_PRESENT, MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND, }, utils::forge::{check_the_balance, fill_forge_private_key}, }; @@ -47,6 +47,7 @@ pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { .get_wallets() .context(MSG_WALLETS_CONFIG_MUST_BE_PRESENT)? .token_multiplier_setter + .context(MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND)? .address; let spinner = Spinner::new(MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER); diff --git a/zk_toolbox/crates/zk_inception/src/messages.rs b/zk_toolbox/crates/zk_inception/src/messages.rs index cca3e3b549b1..e8899ab7f51f 100644 --- a/zk_toolbox/crates/zk_inception/src/messages.rs +++ b/zk_toolbox/crates/zk_inception/src/messages.rs @@ -157,6 +157,8 @@ pub(super) const MSG_CHAIN_ID_VALIDATOR_ERR: &str = "Invalid chain id"; pub(super) const MSG_BASE_TOKEN_ADDRESS_VALIDATOR_ERR: &str = "Invalid base token address"; pub(super) const MSG_WALLET_CREATION_VALIDATOR_ERR: &str = "Localhost wallet is not supported for external networks"; +pub(super) const MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND: &str = + "Token Multiplier Setter not found. Specify it in a wallet config"; /// Chain genesis related messages pub(super) const MSG_L1_SECRETS_MUST_BE_PRESENTED: &str = "L1 secret must be presented";