Skip to content

Commit 9f78372

Browse files
committed
fix(zkstack): use vm_option in args properly (#4533)
## What ❔ Allow create zksync_os chain by default ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- The `Why` has to be clear to non-Matter Labs entities running their own ZK Chain --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> ## Is this a breaking change? - [ ] Yes - [ ] No ## Operational changes <!-- Any config changes? Any new flags? Any changes to any scripts? --> <!-- Please add anything that non-Matter Labs entities running their own ZK Chain may need to know --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`. Signed-off-by: Danil <[email protected]>
1 parent b0ebc88 commit 9f78372

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

zkstack_cli/crates/zkstack/src/commands/chain/args/create.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use slugify_rs::slugify;
77
use strum::{Display, EnumIter, IntoEnumIterator};
88
use zkstack_cli_common::{Prompt, PromptConfirm, PromptSelect};
99
use zkstack_cli_config::forge_interface::deploy_ecosystem::output::Erc20Token;
10-
use zkstack_cli_types::{BaseToken, L1BatchCommitmentMode, L1Network, ProverMode, WalletCreation};
10+
use zkstack_cli_types::{
11+
BaseToken, L1BatchCommitmentMode, L1Network, ProverMode, VMOption, WalletCreation,
12+
};
1113
use zksync_basic_types::H160;
1214

1315
use crate::{
@@ -88,6 +90,11 @@ impl ChainCreateArgs {
8890
l1_network: &L1Network,
8991
possible_erc20: Vec<Erc20Token>,
9092
) -> anyhow::Result<ChainCreateArgsFinal> {
93+
let vm_option = if self.zksync_os {
94+
VMOption::ZKSyncOsVM
95+
} else {
96+
VMOption::EraVM
97+
};
9198
let mut chain_name = self
9299
.chain_name
93100
.unwrap_or_else(|| Prompt::new(MSG_CHAIN_NAME_PROMPT).ask());
@@ -247,6 +254,7 @@ impl ChainCreateArgs {
247254
legacy_bridge: self.legacy_bridge,
248255
evm_emulator,
249256
tight_ports: self.tight_ports,
257+
vm_option,
250258
})
251259
}
252260
}
@@ -264,6 +272,7 @@ pub struct ChainCreateArgsFinal {
264272
pub legacy_bridge: bool,
265273
pub evm_emulator: bool,
266274
pub tight_ports: bool,
275+
pub vm_option: VMOption,
267276
}
268277

269278
#[derive(Debug, Clone, EnumIter, Display, PartialEq, Eq)]

zkstack_cli/crates/zkstack/src/commands/chain/create.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use zkstack_cli_config::{
77
create_local_configs_dir, create_wallets, traits::SaveConfigWithBasePath, ChainConfig,
88
EcosystemConfig, GenesisConfig, ZkStackConfig, GENESIS_FILE,
99
};
10-
use zkstack_cli_types::VMOption;
1110
use zksync_basic_types::L2ChainId;
1211

1312
use crate::{
@@ -30,12 +29,6 @@ pub async fn create(
3029
ecosystem_config: &mut EcosystemConfig,
3130
shell: &Shell,
3231
) -> anyhow::Result<()> {
33-
let vm_option = if args.zksync_os {
34-
VMOption::ZKSyncOsVM
35-
} else {
36-
VMOption::EraVM
37-
};
38-
3932
let tokens = ecosystem_config.get_erc20_tokens();
4033
let args = args
4134
.fill_values_with_prompt(
@@ -51,7 +44,7 @@ pub async fn create(
5144
let spinner = Spinner::new(MSG_CREATING_CHAIN_CONFIGURATIONS_SPINNER);
5245
let name = args.chain_name.clone();
5346
let set_as_default = args.set_as_default;
54-
create_chain_inner(args, ecosystem_config, shell, vm_option).await?;
47+
create_chain_inner(args, ecosystem_config, shell).await?;
5548
if set_as_default {
5649
ecosystem_config.set_default_chain(name);
5750
ecosystem_config.save_with_base_path(shell, ".")?;
@@ -67,8 +60,8 @@ pub(crate) async fn create_chain_inner(
6760
args: ChainCreateArgsFinal,
6861
ecosystem_config: &EcosystemConfig,
6962
shell: &Shell,
70-
vm_option: VMOption,
7163
) -> anyhow::Result<()> {
64+
let vm_option = args.vm_option;
7265
if args.legacy_bridge {
7366
logger::warn("WARNING!!! You are creating a chain with legacy bridge, use it only for testing compatibility")
7467
}

zkstack_cli/crates/zkstack/src/commands/ecosystem/create.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use zkstack_cli_config::{
55
create_local_configs_dir, create_wallets, get_default_era_chain_id,
66
traits::SaveConfigWithBasePath, EcosystemConfig, EcosystemConfigFromFileError, ZkStackConfig,
77
};
8-
use zkstack_cli_types::VMOption;
98

109
use crate::{
1110
commands::{
@@ -93,8 +92,7 @@ async fn create(args: EcosystemCreateArgs, shell: &Shell) -> anyhow::Result<()>
9392
spinner.finish();
9493

9594
let spinner = Spinner::new(MSG_CREATING_DEFAULT_CHAIN_SPINNER);
96-
// By default, do not use zksync os for the ecosystem chain
97-
create_chain_inner(chain_config, &ecosystem_config, shell, VMOption::EraVM).await?;
95+
create_chain_inner(chain_config, &ecosystem_config, shell).await?;
9896
spinner.finish();
9997

10098
if args.start_containers {

0 commit comments

Comments
 (0)