From 8c9cd79fd1530b0692fc3fc447fbfc5545c69846 Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Tue, 26 Nov 2024 10:36:55 -0300 Subject: [PATCH 1/2] Add msg_wallet_private_key_not_set --- zkstack_cli/crates/zkstack/src/accept_ownership.rs | 4 ++-- .../src/commands/chain/deploy_l2_contracts.rs | 8 ++++++-- .../zkstack/src/commands/chain/deploy_paymaster.rs | 8 ++++++-- .../zkstack/src/commands/chain/register_chain.rs | 8 ++++++-- .../commands/chain/set_token_multiplier_setter.rs | 4 ++-- .../src/commands/chain/setup_legacy_bridge.rs | 8 ++++++-- .../crates/zkstack/src/commands/ecosystem/common.rs | 8 ++++++-- .../crates/zkstack/src/commands/ecosystem/init.rs | 8 ++++++-- zkstack_cli/crates/zkstack/src/messages.rs | 12 +++++++++++- zkstack_cli/crates/zkstack/src/utils/forge.rs | 10 ++++++++-- 10 files changed, 59 insertions(+), 19 deletions(-) diff --git a/zkstack_cli/crates/zkstack/src/accept_ownership.rs b/zkstack_cli/crates/zkstack/src/accept_ownership.rs index 474e76e599a8..b92cdf2f53f2 100644 --- a/zkstack_cli/crates/zkstack/src/accept_ownership.rs +++ b/zkstack_cli/crates/zkstack/src/accept_ownership.rs @@ -10,7 +10,7 @@ use xshell::Shell; use crate::{ messages::MSG_ACCEPTING_GOVERNANCE_SPINNER, - utils::forge::{check_the_balance, fill_forge_private_key}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, }; lazy_static! { @@ -89,7 +89,7 @@ async fn accept_ownership( governor: &Wallet, mut forge: ForgeScript, ) -> anyhow::Result<()> { - forge = fill_forge_private_key(forge, Some(governor))?; + forge = fill_forge_private_key(forge, Some(governor), WalletType::Governor)?; check_the_balance(&forge).await?; let spinner = Spinner::new(MSG_ACCEPTING_GOVERNANCE_SPINNER); forge.run(shell)?; diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs index 31cfc7f83977..269512d4b9f2 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs @@ -27,7 +27,7 @@ use crate::{ MSG_CHAIN_NOT_INITIALIZED, MSG_DEPLOYING_L2_CONTRACT_SPINNER, MSG_L1_SECRETS_MUST_BE_PRESENTED, }, - utils::forge::{check_the_balance, fill_forge_private_key}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, }; pub enum Deploy2ContractsOption { @@ -311,7 +311,11 @@ async fn call_forge( forge = forge.with_signature(signature); } - forge = fill_forge_private_key(forge, Some(&ecosystem_config.get_wallets()?.governor))?; + forge = fill_forge_private_key( + forge, + Some(&ecosystem_config.get_wallets()?.governor), + WalletType::Governor, + )?; check_the_balance(&forge).await?; forge.run(shell)?; diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs index 4a93fcc089f8..c1e567aaaa26 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs @@ -12,7 +12,7 @@ use xshell::Shell; use crate::{ messages::{MSG_CHAIN_NOT_INITIALIZED, MSG_L1_SECRETS_MUST_BE_PRESENTED}, - utils::forge::{check_the_balance, fill_forge_private_key}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, }; pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { @@ -56,7 +56,11 @@ pub async fn deploy_paymaster( if let Some(address) = sender { forge = forge.with_sender(address); } else { - forge = fill_forge_private_key(forge, Some(&chain_config.get_wallets_config()?.governor))?; + forge = fill_forge_private_key( + forge, + Some(&chain_config.get_wallets_config()?.governor), + WalletType::Governor, + )?; } if broadcast { diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs b/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs index 65ee05a1ea5f..72437a9e34cc 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs @@ -19,7 +19,7 @@ use crate::{ MSG_CHAIN_NOT_INITIALIZED, MSG_CHAIN_REGISTERED, MSG_L1_SECRETS_MUST_BE_PRESENTED, MSG_REGISTERING_CHAIN_SPINNER, }, - utils::forge::{check_the_balance, fill_forge_private_key}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, }; pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { @@ -81,7 +81,11 @@ pub async fn register_chain( if let Some(address) = sender { forge = forge.with_sender(address); } else { - forge = fill_forge_private_key(forge, Some(&config.get_wallets()?.governor))?; + forge = fill_forge_private_key( + forge, + Some(&config.get_wallets()?.governor), + WalletType::Governor, + )?; check_the_balance(&forge).await?; } diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs b/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs index 4a6cd31b2c0a..941d748a7dde 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs @@ -17,7 +17,7 @@ use crate::{ MSG_TOKEN_MULTIPLIER_SETTER_UPDATED_TO, MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER, MSG_WALLETS_CONFIG_MUST_BE_PRESENT, MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND, }, - utils::forge::{check_the_balance, fill_forge_private_key}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, }; lazy_static! { @@ -109,7 +109,7 @@ async fn update_token_multiplier_setter( governor: &Wallet, mut forge: ForgeScript, ) -> anyhow::Result<()> { - forge = fill_forge_private_key(forge, Some(governor))?; + forge = fill_forge_private_key(forge, Some(governor), WalletType::Governor)?; check_the_balance(&forge).await?; forge.run(shell)?; Ok(()) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/setup_legacy_bridge.rs b/zkstack_cli/crates/zkstack/src/commands/chain/setup_legacy_bridge.rs index f61c640ffb6b..bc76087ecadd 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/setup_legacy_bridge.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/setup_legacy_bridge.rs @@ -14,7 +14,7 @@ use xshell::Shell; use crate::{ messages::{MSG_DEPLOYING_PAYMASTER, MSG_L1_SECRETS_MUST_BE_PRESENTED}, - utils::forge::{check_the_balance, fill_forge_private_key}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, }; pub async fn setup_legacy_bridge( @@ -59,7 +59,11 @@ pub async fn setup_legacy_bridge( ) .with_broadcast(); - forge = fill_forge_private_key(forge, Some(&ecosystem_config.get_wallets()?.governor))?; + forge = fill_forge_private_key( + forge, + Some(&ecosystem_config.get_wallets()?.governor), + WalletType::Governor, + )?; let spinner = Spinner::new(MSG_DEPLOYING_PAYMASTER); check_the_balance(&forge).await?; diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs index 00d937bba294..74a625960617 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs @@ -14,7 +14,7 @@ use config::{ use types::{L1Network, ProverMode}; use xshell::Shell; -use crate::utils::forge::{check_the_balance, fill_forge_private_key}; +use crate::utils::forge::{check_the_balance, fill_forge_private_key, WalletType}; pub async fn deploy_l1( shell: &Shell, @@ -54,7 +54,11 @@ pub async fn deploy_l1( if let Some(address) = sender { forge = forge.with_sender(address); } else { - forge = fill_forge_private_key(forge, wallets_config.deployer.as_ref())?; + forge = fill_forge_private_key( + forge, + wallets_config.deployer.as_ref(), + WalletType::Deployer, + )?; } if broadcast { diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs index 06b9b9161112..2a2b5a68af80 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs @@ -43,7 +43,7 @@ use crate::{ MSG_ECOSYSTEM_CONTRACTS_PATH_PROMPT, MSG_INITIALIZING_ECOSYSTEM, MSG_INTALLING_DEPS_SPINNER, }, - utils::forge::{check_the_balance, fill_forge_private_key}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, }; pub async fn run(args: EcosystemInitArgs, shell: &Shell) -> anyhow::Result<()> { @@ -150,7 +150,11 @@ async fn deploy_erc20( .with_rpc_url(l1_rpc_url) .with_broadcast(); - forge = fill_forge_private_key(forge, ecosystem_config.get_wallets()?.deployer.as_ref())?; + forge = fill_forge_private_key( + forge, + ecosystem_config.get_wallets()?.deployer.as_ref(), + WalletType::Deployer, + )?; let spinner = Spinner::new(MSG_DEPLOYING_ERC20_SPINNER); check_the_balance(&forge).await?; diff --git a/zkstack_cli/crates/zkstack/src/messages.rs b/zkstack_cli/crates/zkstack/src/messages.rs index bedcb233b19f..82a6e6f97606 100644 --- a/zkstack_cli/crates/zkstack/src/messages.rs +++ b/zkstack_cli/crates/zkstack/src/messages.rs @@ -7,6 +7,8 @@ use ethers::{ use url::Url; use zksync_consensus_roles::attester; +use crate::utils::forge::WalletType; + pub(super) const MSG_SETUP_KEYS_DOWNLOAD_SELECTION_PROMPT: &str = "Do you want to download the setup keys or generate them?"; pub(super) const MSG_SETUP_KEYS_REGION_PROMPT: &str = @@ -334,7 +336,15 @@ pub(super) fn msg_explorer_chain_not_initialized(chain: &str) -> String { } /// Forge utils related messages -pub(super) const MSG_DEPLOYER_PK_NOT_SET_ERR: &str = "Deployer private key is not set"; +pub(super) fn msg_wallet_private_key_not_set(wallet_type: WalletType) -> String { + format!( + "{} private key is not set", + match wallet_type { + WalletType::Governor => "Governor", + WalletType::Deployer => "Deployer", + } + ) +} pub(super) fn msg_address_doesnt_have_enough_money_prompt( address: &H160, diff --git a/zkstack_cli/crates/zkstack/src/utils/forge.rs b/zkstack_cli/crates/zkstack/src/utils/forge.rs index 355cf7b5f930..99b3f5b5af54 100644 --- a/zkstack_cli/crates/zkstack/src/utils/forge.rs +++ b/zkstack_cli/crates/zkstack/src/utils/forge.rs @@ -4,18 +4,24 @@ use ethers::types::U256; use crate::{ consts::MINIMUM_BALANCE_FOR_WALLET, - messages::{msg_address_doesnt_have_enough_money_prompt, MSG_DEPLOYER_PK_NOT_SET_ERR}, + messages::{msg_address_doesnt_have_enough_money_prompt, msg_wallet_private_key_not_set}, }; +pub enum WalletType { + Governor, + Deployer, +} + pub fn fill_forge_private_key( mut forge: ForgeScript, wallet: Option<&Wallet>, + wallet_type: WalletType, ) -> anyhow::Result { if !forge.wallet_args_passed() { forge = forge.with_private_key( wallet .and_then(|w| w.private_key_h256()) - .context(MSG_DEPLOYER_PK_NOT_SET_ERR)?, + .context(msg_wallet_private_key_not_set(wallet_type))?, ); } Ok(forge) From d0a1bac58ca95dcec1fff869eef6bb6f3c230091 Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Tue, 26 Nov 2024 10:40:28 -0300 Subject: [PATCH 2/2] Rename wallet type for wallet owner --- zkstack_cli/crates/zkstack/src/accept_ownership.rs | 4 ++-- .../zkstack/src/commands/chain/deploy_l2_contracts.rs | 4 ++-- .../zkstack/src/commands/chain/deploy_paymaster.rs | 4 ++-- .../zkstack/src/commands/chain/register_chain.rs | 4 ++-- .../src/commands/chain/set_token_multiplier_setter.rs | 4 ++-- .../zkstack/src/commands/chain/setup_legacy_bridge.rs | 4 ++-- .../crates/zkstack/src/commands/ecosystem/common.rs | 4 ++-- .../crates/zkstack/src/commands/ecosystem/init.rs | 4 ++-- zkstack_cli/crates/zkstack/src/messages.rs | 10 +++++----- zkstack_cli/crates/zkstack/src/utils/forge.rs | 6 +++--- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/zkstack_cli/crates/zkstack/src/accept_ownership.rs b/zkstack_cli/crates/zkstack/src/accept_ownership.rs index b92cdf2f53f2..73dfd8082708 100644 --- a/zkstack_cli/crates/zkstack/src/accept_ownership.rs +++ b/zkstack_cli/crates/zkstack/src/accept_ownership.rs @@ -10,7 +10,7 @@ use xshell::Shell; use crate::{ messages::MSG_ACCEPTING_GOVERNANCE_SPINNER, - utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner}, }; lazy_static! { @@ -89,7 +89,7 @@ async fn accept_ownership( governor: &Wallet, mut forge: ForgeScript, ) -> anyhow::Result<()> { - forge = fill_forge_private_key(forge, Some(governor), WalletType::Governor)?; + forge = fill_forge_private_key(forge, Some(governor), WalletOwner::Governor)?; check_the_balance(&forge).await?; let spinner = Spinner::new(MSG_ACCEPTING_GOVERNANCE_SPINNER); forge.run(shell)?; diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs index 269512d4b9f2..4164f9a05a2a 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_l2_contracts.rs @@ -27,7 +27,7 @@ use crate::{ MSG_CHAIN_NOT_INITIALIZED, MSG_DEPLOYING_L2_CONTRACT_SPINNER, MSG_L1_SECRETS_MUST_BE_PRESENTED, }, - utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner}, }; pub enum Deploy2ContractsOption { @@ -314,7 +314,7 @@ async fn call_forge( forge = fill_forge_private_key( forge, Some(&ecosystem_config.get_wallets()?.governor), - WalletType::Governor, + WalletOwner::Governor, )?; check_the_balance(&forge).await?; diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs index c1e567aaaa26..4bcfd6c08099 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs @@ -12,7 +12,7 @@ use xshell::Shell; use crate::{ messages::{MSG_CHAIN_NOT_INITIALIZED, MSG_L1_SECRETS_MUST_BE_PRESENTED}, - utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner}, }; pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { @@ -59,7 +59,7 @@ pub async fn deploy_paymaster( forge = fill_forge_private_key( forge, Some(&chain_config.get_wallets_config()?.governor), - WalletType::Governor, + WalletOwner::Governor, )?; } diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs b/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs index 72437a9e34cc..42b3bbd59c71 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs @@ -19,7 +19,7 @@ use crate::{ MSG_CHAIN_NOT_INITIALIZED, MSG_CHAIN_REGISTERED, MSG_L1_SECRETS_MUST_BE_PRESENTED, MSG_REGISTERING_CHAIN_SPINNER, }, - utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner}, }; pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { @@ -84,7 +84,7 @@ pub async fn register_chain( forge = fill_forge_private_key( forge, Some(&config.get_wallets()?.governor), - WalletType::Governor, + WalletOwner::Governor, )?; check_the_balance(&forge).await?; } diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs b/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs index 941d748a7dde..326aa393f8f2 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/set_token_multiplier_setter.rs @@ -17,7 +17,7 @@ use crate::{ MSG_TOKEN_MULTIPLIER_SETTER_UPDATED_TO, MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER, MSG_WALLETS_CONFIG_MUST_BE_PRESENT, MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND, }, - utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner}, }; lazy_static! { @@ -109,7 +109,7 @@ async fn update_token_multiplier_setter( governor: &Wallet, mut forge: ForgeScript, ) -> anyhow::Result<()> { - forge = fill_forge_private_key(forge, Some(governor), WalletType::Governor)?; + forge = fill_forge_private_key(forge, Some(governor), WalletOwner::Governor)?; check_the_balance(&forge).await?; forge.run(shell)?; Ok(()) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/setup_legacy_bridge.rs b/zkstack_cli/crates/zkstack/src/commands/chain/setup_legacy_bridge.rs index bc76087ecadd..a05ef04eee3e 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/setup_legacy_bridge.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/setup_legacy_bridge.rs @@ -14,7 +14,7 @@ use xshell::Shell; use crate::{ messages::{MSG_DEPLOYING_PAYMASTER, MSG_L1_SECRETS_MUST_BE_PRESENTED}, - utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner}, }; pub async fn setup_legacy_bridge( @@ -62,7 +62,7 @@ pub async fn setup_legacy_bridge( forge = fill_forge_private_key( forge, Some(&ecosystem_config.get_wallets()?.governor), - WalletType::Governor, + WalletOwner::Governor, )?; let spinner = Spinner::new(MSG_DEPLOYING_PAYMASTER); diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs index 74a625960617..074913d79fa2 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs @@ -14,7 +14,7 @@ use config::{ use types::{L1Network, ProverMode}; use xshell::Shell; -use crate::utils::forge::{check_the_balance, fill_forge_private_key, WalletType}; +use crate::utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner}; pub async fn deploy_l1( shell: &Shell, @@ -57,7 +57,7 @@ pub async fn deploy_l1( forge = fill_forge_private_key( forge, wallets_config.deployer.as_ref(), - WalletType::Deployer, + WalletOwner::Deployer, )?; } diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs index 2a2b5a68af80..7b01abf03b9a 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs @@ -43,7 +43,7 @@ use crate::{ MSG_ECOSYSTEM_CONTRACTS_PATH_PROMPT, MSG_INITIALIZING_ECOSYSTEM, MSG_INTALLING_DEPS_SPINNER, }, - utils::forge::{check_the_balance, fill_forge_private_key, WalletType}, + utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner}, }; pub async fn run(args: EcosystemInitArgs, shell: &Shell) -> anyhow::Result<()> { @@ -153,7 +153,7 @@ async fn deploy_erc20( forge = fill_forge_private_key( forge, ecosystem_config.get_wallets()?.deployer.as_ref(), - WalletType::Deployer, + WalletOwner::Deployer, )?; let spinner = Spinner::new(MSG_DEPLOYING_ERC20_SPINNER); diff --git a/zkstack_cli/crates/zkstack/src/messages.rs b/zkstack_cli/crates/zkstack/src/messages.rs index 82a6e6f97606..14b89be773f1 100644 --- a/zkstack_cli/crates/zkstack/src/messages.rs +++ b/zkstack_cli/crates/zkstack/src/messages.rs @@ -7,7 +7,7 @@ use ethers::{ use url::Url; use zksync_consensus_roles::attester; -use crate::utils::forge::WalletType; +use crate::utils::forge::WalletOwner; pub(super) const MSG_SETUP_KEYS_DOWNLOAD_SELECTION_PROMPT: &str = "Do you want to download the setup keys or generate them?"; @@ -336,12 +336,12 @@ pub(super) fn msg_explorer_chain_not_initialized(chain: &str) -> String { } /// Forge utils related messages -pub(super) fn msg_wallet_private_key_not_set(wallet_type: WalletType) -> String { +pub(super) fn msg_wallet_private_key_not_set(wallet_owner: WalletOwner) -> String { format!( "{} private key is not set", - match wallet_type { - WalletType::Governor => "Governor", - WalletType::Deployer => "Deployer", + match wallet_owner { + WalletOwner::Governor => "Governor", + WalletOwner::Deployer => "Deployer", } ) } diff --git a/zkstack_cli/crates/zkstack/src/utils/forge.rs b/zkstack_cli/crates/zkstack/src/utils/forge.rs index 99b3f5b5af54..76f045f82b9e 100644 --- a/zkstack_cli/crates/zkstack/src/utils/forge.rs +++ b/zkstack_cli/crates/zkstack/src/utils/forge.rs @@ -7,7 +7,7 @@ use crate::{ messages::{msg_address_doesnt_have_enough_money_prompt, msg_wallet_private_key_not_set}, }; -pub enum WalletType { +pub enum WalletOwner { Governor, Deployer, } @@ -15,13 +15,13 @@ pub enum WalletType { pub fn fill_forge_private_key( mut forge: ForgeScript, wallet: Option<&Wallet>, - wallet_type: WalletType, + wallet_owner: WalletOwner, ) -> anyhow::Result { if !forge.wallet_args_passed() { forge = forge.with_private_key( wallet .and_then(|w| w.private_key_h256()) - .context(msg_wallet_private_key_not_set(wallet_type))?, + .context(msg_wallet_private_key_not_set(wallet_owner))?, ); } Ok(forge)