Skip to content

Commit

Permalink
Use l1_wallets_path in chain init
Browse files Browse the repository at this point in the history
  • Loading branch information
matias-gonz committed Nov 22, 2024
1 parent c025a75 commit 9010f44
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 16 deletions.
13 changes: 0 additions & 13 deletions zkstack_cli/crates/zkstack/src/commands/chain/args/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use crate::{
MSG_DEPLOY_PAYMASTER_PROMPT, MSG_DEV_ARG_HELP, MSG_ECOSYSTEM_CONTRACTS_PATH_HELP,
MSG_L1_RPC_URL_HELP, MSG_L1_RPC_URL_INVALID_ERR, MSG_L1_RPC_URL_PROMPT,
MSG_NO_PORT_REALLOCATION_HELP, MSG_SERVER_DB_NAME_HELP, MSG_SERVER_DB_URL_HELP,
MSG_WALLETS_PATH_HELP, MSG_WALLETS_PATH_PROMPT,
},
};

Expand All @@ -41,8 +40,6 @@ pub struct InitArgs {
pub no_port_reallocation: bool,
#[clap(long, help = MSG_ECOSYSTEM_CONTRACTS_PATH_HELP)]
pub ecosystem_contracts_path: Option<String>,
#[clap(long, help = MSG_WALLETS_PATH_HELP)]
pub wallets_path: Option<String>,
#[clap(long, help = MSG_DEV_ARG_HELP)]
pub dev: bool,
}
Expand Down Expand Up @@ -108,22 +105,13 @@ impl InitArgs {
get_ecosystem_contracts_path(self.ecosystem_contracts_path, ecosystem.clone(), chain)?
};

let wallets_path = ecosystem.map_or_else(
|| {
self.wallets_path
.map_or_else(|| Prompt::new(MSG_WALLETS_PATH_PROMPT).ask(), PathBuf::from)
},
|e| e.get_wallets_path(),
);

Ok(InitArgsFinal {
forge_args: self.forge_args,
genesis_args: genesis.fill_values_with_prompt(chain),
deploy_paymaster,
l1_rpc_url,
no_port_reallocation: self.no_port_reallocation,
ecosystem_contracts_path,
wallets_path,
dev: self.dev,
})
}
Expand All @@ -137,6 +125,5 @@ pub struct InitArgsFinal {
pub l1_rpc_url: String,
pub no_port_reallocation: bool,
pub ecosystem_contracts_path: PathBuf,
pub wallets_path: PathBuf,
pub dev: bool,
}
2 changes: 1 addition & 1 deletion zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub async fn init(
init_configs_args.no_port_reallocation = true;
}
let mut contracts_config = init_configs(&init_configs_args, shell, chain_config).await?;
let wallets = WalletsConfig::read(shell, init_args.wallets_path.clone())?;
let wallets = WalletsConfig::read(shell, chain_config.l1_wallets_path.clone())?;

// Fund some wallet addresses with ETH or base token (only for Localhost)
distribute_eth(chain_config, init_args.l1_rpc_url.clone(), &wallets).await?;
Expand Down
2 changes: 0 additions & 2 deletions zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ async fn init_chains(
}
let ecosystem_contracts_path =
Some(ecosystem_config.get_contracts_path().display().to_string());
let wallets_path = Some(ecosystem_config.get_wallets_path().display().to_string());
logger::debug(format!(
"Ecosystem contracts path: {:?}",
ecosystem_contracts_path
Expand All @@ -372,7 +371,6 @@ async fn init_chains(
no_port_reallocation: final_init_args.no_port_reallocation,
dev: final_init_args.dev,
ecosystem_contracts_path: ecosystem_contracts_path.clone(),
wallets_path: wallets_path.clone(),
};
let final_chain_init_args = chain_init_args
.fill_values_with_prompt(Some(ecosystem_config.clone()), &chain_config)?;
Expand Down

0 comments on commit 9010f44

Please sign in to comment.