diff --git a/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/init.rs b/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/init.rs index 075435cf86f6..a6a0a1be59d9 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/init.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/init.rs @@ -11,7 +11,7 @@ use crate::{ defaults::LOCAL_RPC_URL, messages::{ MSG_DEPLOY_ECOSYSTEM_PROMPT, MSG_DEPLOY_ERC20_PROMPT, MSG_DEPLOY_PAYMASTER_PROMPT, - MSG_GENESIS_ARGS_HELP, MSG_L1_RPC_URL_HELP, MSG_L1_RPC_URL_INVALID_ERR, + MSG_DEV_ARG_HELP, MSG_GENESIS_ARGS_HELP, MSG_L1_RPC_URL_HELP, MSG_L1_RPC_URL_INVALID_ERR, MSG_L1_RPC_URL_PROMPT, }, }; @@ -29,15 +29,22 @@ pub struct EcosystemArgs { } impl EcosystemArgs { - pub fn fill_values_with_prompt(self, l1_network: L1Network) -> EcosystemArgsFinal { + pub fn fill_values_with_prompt(self, l1_network: L1Network, dev: bool) -> EcosystemArgsFinal { let deploy_ecosystem = self.deploy_ecosystem.unwrap_or_else(|| { - PromptConfirm::new(MSG_DEPLOY_ECOSYSTEM_PROMPT) - .default(true) - .ask() + if dev { + return true; + } else { + PromptConfirm::new(MSG_DEPLOY_ECOSYSTEM_PROMPT) + .default(true) + .ask() + } }); let l1_rpc_url = self.l1_rpc_url.unwrap_or_else(|| { let mut prompt = Prompt::new(MSG_L1_RPC_URL_PROMPT); + if dev { + return LOCAL_RPC_URL.to_string(); + } if l1_network == L1Network::Localhost { prompt = prompt.default(LOCAL_RPC_URL); } @@ -81,27 +88,35 @@ pub struct EcosystemInitArgs { #[clap(flatten, next_help_heading = MSG_GENESIS_ARGS_HELP)] #[serde(flatten)] pub genesis_args: GenesisArgs, + #[clap(long, help = MSG_DEV_ARG_HELP)] + pub dev: bool, } impl EcosystemInitArgs { pub fn fill_values_with_prompt(self, l1_network: L1Network) -> EcosystemInitArgsFinal { - let deploy_paymaster = self.deploy_paymaster.unwrap_or_else(|| { - PromptConfirm::new(MSG_DEPLOY_PAYMASTER_PROMPT) - .default(true) - .ask() - }); - let deploy_erc20 = self.deploy_erc20.unwrap_or_else(|| { - PromptConfirm::new(MSG_DEPLOY_ERC20_PROMPT) - .default(true) - .ask() - }); - let ecosystem = self.ecosystem.fill_values_with_prompt(l1_network); + let (deploy_paymaster, deploy_erc20) = if self.dev { + (true, true) + } else { + let deploy_paymaster = self.deploy_paymaster.unwrap_or_else(|| { + PromptConfirm::new(MSG_DEPLOY_PAYMASTER_PROMPT) + .default(true) + .ask() + }); + let deploy_erc20 = self.deploy_erc20.unwrap_or_else(|| { + PromptConfirm::new(MSG_DEPLOY_ERC20_PROMPT) + .default(true) + .ask() + }); + (deploy_paymaster, deploy_erc20) + }; + let ecosystem = self.ecosystem.fill_values_with_prompt(l1_network, self.dev); EcosystemInitArgsFinal { deploy_paymaster, deploy_erc20, ecosystem, forge_args: self.forge_args.clone(), + dev: self.dev, } } } @@ -112,4 +127,5 @@ pub struct EcosystemInitArgsFinal { pub deploy_erc20: bool, pub ecosystem: EcosystemArgsFinal, pub forge_args: ForgeScriptArgs, + pub dev: bool, } diff --git a/zk_toolbox/crates/zk_inception/src/commands/ecosystem/init.rs b/zk_toolbox/crates/zk_inception/src/commands/ecosystem/init.rs index 26a5a7f4d88b..3943a5449bf8 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/ecosystem/init.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/ecosystem/init.rs @@ -59,7 +59,10 @@ pub async fn run(args: EcosystemInitArgs, shell: &Shell) -> anyhow::Result<()> { Err(_) => create_initial_deployments_config(shell, &ecosystem_config.config)?, }; - let genesis_args = args.genesis_args.clone(); + let mut genesis_args = args.genesis_args.clone(); + if args.dev { + genesis_args.use_default = true; + } let mut final_ecosystem_args = args.fill_values_with_prompt(ecosystem_config.l1_network); logger::info(MSG_INITIALIZING_ECOSYSTEM); diff --git a/zk_toolbox/crates/zk_inception/src/messages.rs b/zk_toolbox/crates/zk_inception/src/messages.rs index aa3ada01e8f1..6582345c2ae1 100644 --- a/zk_toolbox/crates/zk_inception/src/messages.rs +++ b/zk_toolbox/crates/zk_inception/src/messages.rs @@ -36,6 +36,8 @@ pub(super) const MSG_LINK_TO_CODE_SELECTION_PATH: &str = "I have the code alread /// Ecosystem and chain init related messages pub(super) const MSG_L1_RPC_URL_HELP: &str = "L1 RPC URL"; pub(super) const MSG_GENESIS_ARGS_HELP: &str = "Genesis options"; +pub(super) const MSG_DEV_ARG_HELP: &str = + "Deploy ecosystem using all defaults. Suitable for local development"; pub(super) const MSG_DEPLOY_ECOSYSTEM_PROMPT: &str = "Do you want to deploy ecosystem contracts? (Not needed if you already have an existing one)"; pub(super) const MSG_L1_RPC_URL_PROMPT: &str = "What is the RPC URL of the L1 network?";