Skip to content

Commit

Permalink
fix: remove repeated l1_rpc_url config
Browse files Browse the repository at this point in the history
  • Loading branch information
aon committed May 30, 2024
1 parent e6e0495 commit afeaf1a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
4 changes: 0 additions & 4 deletions zk_toolbox/crates/config/src/ecosystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct EcosystemConfigInternal {
pub chains: PathBuf,
pub config: PathBuf,
pub default_chain: String,
pub l1_rpc_url: String,
pub era_chain_id: ChainId,
pub prover_version: ProverMode,
pub wallet_creation: WalletCreation,
Expand All @@ -43,7 +42,6 @@ pub struct EcosystemConfig {
pub chains: PathBuf,
pub config: PathBuf,
pub default_chain: String,
pub l1_rpc_url: String,
pub era_chain_id: ChainId,
pub prover_version: ProverMode,
pub wallet_creation: WalletCreation,
Expand Down Expand Up @@ -72,7 +70,6 @@ impl<'de> Deserialize<'de> for EcosystemConfig {
chains: config.chains.clone(),
config: config.config.clone(),
default_chain: config.default_chain.clone(),
l1_rpc_url: config.l1_rpc_url,
era_chain_id: config.era_chain_id,
prover_version: config.prover_version,
wallet_creation: config.wallet_creation,
Expand Down Expand Up @@ -194,7 +191,6 @@ impl EcosystemConfig {
chains: self.chains.clone(),
config: self.config.clone(),
default_chain: self.default_chain.clone(),
l1_rpc_url: self.l1_rpc_url.clone(),
era_chain_id: self.era_chain_id,
prover_version: self.prover_version,
wallet_creation: self.wallet_creation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ use strum::IntoEnumIterator;
use strum_macros::{Display, EnumIter};
use types::{L1Network, WalletCreation};

use crate::{
commands::chain::{args::create::ChainCreateArgs, ChainCreateArgsFinal},
defaults::LOCAL_RPC_URL,
};
use url::Url;
use crate::commands::chain::{args::create::ChainCreateArgs, ChainCreateArgsFinal};

#[derive(Debug, Serialize, Deserialize, Parser)]
pub struct EcosystemCreateArgs {
#[arg(long)]
pub ecosystem_name: Option<String>,
#[clap(long, help = "L1 Network", value_enum)]
pub l1_network: Option<L1Network>,
#[clap(long, help = "L1 RPC URL")]
pub l1_rpc_url: Option<String>,
#[clap(long, help = "Code link")]
pub link_to_code: Option<String>,
#[clap(flatten)]
Expand Down Expand Up @@ -51,20 +45,6 @@ impl EcosystemCreateArgs {

let l1_network = PromptSelect::new("Select the L1 network", L1Network::iter()).ask();

let l1_rpc_url = self.l1_rpc_url.unwrap_or_else(|| {
let mut prompt = Prompt::new("What is the RPC URL of the L1 network?");
if l1_network == L1Network::Localhost {
prompt = prompt.default(LOCAL_RPC_URL);
}
prompt
.validate_with(|val: &String| -> Result<(), String> {
Url::parse(val)
.map(|_| ())
.map_err(|_| "Invalid RPC url".to_string())
})
.ask()
});

// Make the only chain as a default one
self.chain.set_as_default = Some(true);

Expand All @@ -84,7 +64,6 @@ impl EcosystemCreateArgs {
link_to_code,
wallet_creation: chain.wallet_creation,
wallet_path: chain.wallet_path.clone(),
l1_rpc_url,
chain_args: chain,
start_containers,
}
Expand All @@ -98,7 +77,6 @@ pub struct EcosystemCreateArgsFinal {
pub link_to_code: String,
pub wallet_creation: WalletCreation,
pub wallet_path: Option<PathBuf>,
pub l1_rpc_url: String,
pub chain_args: ChainCreateArgsFinal,
pub start_containers: bool,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ fn create(args: EcosystemCreateArgs, shell: &Shell) -> anyhow::Result<()> {
config: configs_path,
era_chain_id: get_default_era_chain_id(),
default_chain: default_chain_name.clone(),
l1_rpc_url: args.l1_rpc_url,
prover_version: chain_config.prover_version,
wallet_creation: args.wallet_creation,
shell: shell.clone().into(),
Expand Down

0 comments on commit afeaf1a

Please sign in to comment.