From 7adb612d1b78098281b7fa657423eade16c8f26e Mon Sep 17 00:00:00 2001 From: Anton Baliasnikov Date: Thu, 9 Jan 2025 08:35:16 +0000 Subject: [PATCH] refactor: rename zkstack crates with unique names for publishing (#3443) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ * [x] Rename `zkstack_cli` crates with unique names for publishing. * [x] Set individual versions of the `zkstack_cli` workspace crates to the common workspace version. ## Why ❔ To allow publishing to crates.io. ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [x] Tests for the changes have been added / updated. - [x] Documentation comments have been added / updated. - [x] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`. --- zkstack_cli/Cargo.lock | 148 +++++++++--------- zkstack_cli/Cargo.toml | 8 +- zkstack_cli/crates/common/Cargo.toml | 8 +- zkstack_cli/crates/common/src/ethereum.rs | 2 +- zkstack_cli/crates/common/src/version.rs | 8 +- zkstack_cli/crates/common/src/wallets.rs | 2 +- zkstack_cli/crates/config/Cargo.toml | 8 +- zkstack_cli/crates/config/src/chain.rs | 2 +- zkstack_cli/crates/config/src/ecosystem.rs | 4 +- .../crates/config/src/explorer_compose.rs | 2 +- .../deploy_gateway_ctm/input.rs | 2 +- .../gateway_chain_upgrade/input.rs | 2 +- .../forge_interface/register_chain/input.rs | 2 +- zkstack_cli/crates/config/src/general.rs | 2 +- zkstack_cli/crates/config/src/portal.rs | 2 +- zkstack_cli/crates/config/src/secrets.rs | 2 +- zkstack_cli/crates/config/src/traits.rs | 6 +- .../crates/config/src/wallet_creation.rs | 4 +- zkstack_cli/crates/config/src/wallets.rs | 2 +- .../crates/git_version_macro/Cargo.toml | 2 +- zkstack_cli/crates/types/Cargo.toml | 4 +- zkstack_cli/crates/zkstack/Cargo.toml | 8 +- .../crates/zkstack/src/accept_ownership.rs | 18 +-- .../zkstack/src/commands/args/containers.rs | 2 +- .../crates/zkstack/src/commands/args/wait.rs | 2 +- .../zkstack/src/commands/autocomplete.rs | 2 +- .../commands/chain/accept_chain_ownership.rs | 4 +- .../commands/chain/args/build_transactions.rs | 2 +- .../zkstack/src/commands/chain/args/create.rs | 6 +- .../src/commands/chain/args/genesis.rs | 4 +- .../src/commands/chain/args/init/configs.rs | 6 +- .../src/commands/chain/args/init/mod.rs | 8 +- .../src/commands/chain/build_transactions.rs | 8 +- .../zkstack/src/commands/chain/common.rs | 10 +- .../src/commands/chain/convert_to_gateway.rs | 10 +- .../zkstack/src/commands/chain/create.rs | 6 +- .../src/commands/chain/deploy_l2_contracts.rs | 6 +- .../src/commands/chain/deploy_paymaster.rs | 6 +- .../src/commands/chain/enable_evm_emulator.rs | 4 +- .../src/commands/chain/gateway_upgrade.rs | 24 +-- .../src/commands/chain/genesis/database.rs | 8 +- .../zkstack/src/commands/chain/genesis/mod.rs | 4 +- .../src/commands/chain/genesis/server.rs | 6 +- .../src/commands/chain/init/configs.rs | 8 +- .../zkstack/src/commands/chain/init/mod.rs | 6 +- .../commands/chain/migrate_from_gateway.rs | 26 +-- .../src/commands/chain/migrate_to_gateway.rs | 26 +-- .../crates/zkstack/src/commands/chain/mod.rs | 2 +- .../src/commands/chain/register_chain.rs | 6 +- .../chain/set_token_multiplier_setter.rs | 12 +- .../src/commands/chain/setup_legacy_bridge.rs | 6 +- .../zkstack/src/commands/consensus/mod.rs | 12 +- .../crates/zkstack/src/commands/containers.rs | 9 +- .../commands/contract_verifier/args/init.rs | 2 +- .../contract_verifier/args/releases.rs | 2 +- .../src/commands/contract_verifier/build.rs | 4 +- .../src/commands/contract_verifier/init.rs | 4 +- .../src/commands/contract_verifier/run.rs | 4 +- .../src/commands/contract_verifier/wait.rs | 4 +- .../src/commands/dev/commands/clean/mod.rs | 4 +- .../commands/dev/commands/config_writer.rs | 4 +- .../src/commands/dev/commands/contracts.rs | 6 +- .../commands/database/args/new_migration.rs | 2 +- .../dev/commands/database/check_sqlx_data.rs | 4 +- .../commands/dev/commands/database/drop.rs | 4 +- .../commands/dev/commands/database/migrate.rs | 4 +- .../dev/commands/database/new_migration.rs | 4 +- .../commands/dev/commands/database/prepare.rs | 4 +- .../commands/dev/commands/database/reset.rs | 4 +- .../commands/dev/commands/database/setup.rs | 4 +- .../zkstack/src/commands/dev/commands/fmt.rs | 4 +- .../src/commands/dev/commands/genesis.rs | 4 +- .../zkstack/src/commands/dev/commands/lint.rs | 4 +- .../dev/commands/prover/args/insert_batch.rs | 4 +- .../commands/prover/args/insert_version.rs | 12 +- .../src/commands/dev/commands/prover/info.rs | 4 +- .../dev/commands/prover/insert_batch.rs | 4 +- .../dev/commands/prover/insert_version.rs | 4 +- .../commands/send_transactions/args/mod.rs | 2 +- .../dev/commands/send_transactions/mod.rs | 4 +- .../src/commands/dev/commands/snapshot.rs | 4 +- .../src/commands/dev/commands/sql_fmt.rs | 2 +- .../src/commands/dev/commands/status/args.rs | 2 +- .../src/commands/dev/commands/status/mod.rs | 2 +- .../src/commands/dev/commands/test/build.rs | 2 +- .../src/commands/dev/commands/test/db.rs | 2 +- .../src/commands/dev/commands/test/fees.rs | 4 +- .../commands/dev/commands/test/integration.rs | 4 +- .../dev/commands/test/l1_contracts.rs | 4 +- .../commands/dev/commands/test/loadtest.rs | 4 +- .../src/commands/dev/commands/test/prover.rs | 4 +- .../commands/dev/commands/test/recovery.rs | 4 +- .../src/commands/dev/commands/test/revert.rs | 4 +- .../src/commands/dev/commands/test/rust.rs | 4 +- .../src/commands/dev/commands/test/upgrade.rs | 4 +- .../src/commands/dev/commands/test/utils.rs | 6 +- .../src/commands/dev/commands/test/wallet.rs | 4 +- .../crates/zkstack/src/commands/dev/dals.rs | 2 +- .../ecosystem/args/build_transactions.rs | 2 +- .../src/commands/ecosystem/args/create.rs | 4 +- .../ecosystem/args/gateway_upgrade.rs | 4 +- .../src/commands/ecosystem/args/init.rs | 4 +- .../commands/ecosystem/build_transactions.rs | 4 +- .../src/commands/ecosystem/change_default.rs | 4 +- .../zkstack/src/commands/ecosystem/common.rs | 8 +- .../zkstack/src/commands/ecosystem/create.rs | 6 +- .../src/commands/ecosystem/create_configs.rs | 4 +- .../zkstack/src/commands/ecosystem/init.rs | 8 +- .../commands/ecosystem/setup_observability.rs | 4 +- .../zkstack/src/commands/ecosystem/utils.rs | 2 +- .../zkstack/src/commands/explorer/backend.rs | 4 +- .../zkstack/src/commands/explorer/init.rs | 10 +- .../zkstack/src/commands/explorer/run.rs | 4 +- .../external_node/args/prepare_configs.rs | 4 +- .../src/commands/external_node/build.rs | 4 +- .../src/commands/external_node/init.rs | 8 +- .../commands/external_node/prepare_configs.rs | 6 +- .../zkstack/src/commands/external_node/run.rs | 4 +- .../src/commands/external_node/wait.rs | 4 +- .../crates/zkstack/src/commands/portal.rs | 10 +- .../commands/prover/args/compressor_keys.rs | 2 +- .../zkstack/src/commands/prover/args/init.rs | 4 +- .../commands/prover/args/init_bellman_cuda.rs | 2 +- .../zkstack/src/commands/prover/args/run.rs | 4 +- .../src/commands/prover/args/setup_keys.rs | 2 +- .../src/commands/prover/compressor_keys.rs | 4 +- .../crates/zkstack/src/commands/prover/gcs.rs | 4 +- .../zkstack/src/commands/prover/init.rs | 6 +- .../src/commands/prover/init_bellman_cuda.rs | 6 +- .../crates/zkstack/src/commands/prover/run.rs | 4 +- .../zkstack/src/commands/prover/setup_keys.rs | 6 +- .../crates/zkstack/src/commands/server.rs | 6 +- .../crates/zkstack/src/commands/update.rs | 6 +- zkstack_cli/crates/zkstack/src/defaults.rs | 2 +- .../crates/zkstack/src/enable_evm_emulator.rs | 10 +- .../crates/zkstack/src/external_node.rs | 6 +- zkstack_cli/crates/zkstack/src/main.rs | 6 +- .../crates/zkstack/src/utils/consensus.rs | 2 +- zkstack_cli/crates/zkstack/src/utils/forge.rs | 4 +- .../crates/zkstack/src/utils/link_to_code.rs | 6 +- zkstack_cli/crates/zkstack/src/utils/ports.rs | 8 +- .../crates/zkstack/src/utils/rocks_db.rs | 2 +- 142 files changed, 446 insertions(+), 429 deletions(-) diff --git a/zkstack_cli/Cargo.lock b/zkstack_cli/Cargo.lock index dd700ea548d0..1ea38d968073 100644 --- a/zkstack_cli/Cargo.lock +++ b/zkstack_cli/Cargo.lock @@ -798,35 +798,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "common" -version = "0.1.0" -dependencies = [ - "anyhow", - "async-trait", - "clap", - "cliclack", - "console", - "ethers", - "futures", - "git_version_macro", - "once_cell", - "serde", - "serde_json", - "serde_yaml", - "sqlx", - "strum", - "thiserror", - "tokio", - "toml", - "types", - "url", - "xshell", - "zksync_system_constants", - "zksync_types", - "zksync_web3_decl", -] - [[package]] name = "common-path" version = "1.0.0" @@ -848,29 +819,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "config" -version = "0.1.0" -dependencies = [ - "anyhow", - "clap", - "common", - "ethers", - "rand", - "serde", - "serde_json", - "serde_yaml", - "strum", - "thiserror", - "types", - "url", - "xshell", - "zksync_basic_types", - "zksync_config", - "zksync_protobuf", - "zksync_protobuf_config", -] - [[package]] name = "configparser" version = "3.1.0" @@ -2094,13 +2042,6 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" -[[package]] -name = "git_version_macro" -version = "0.1.0" -dependencies = [ - "chrono", -] - [[package]] name = "glob" version = "0.3.1" @@ -6282,18 +6223,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "types" -version = "0.1.0" -dependencies = [ - "clap", - "ethers", - "serde", - "strum", - "thiserror", - "zksync_basic_types", -] - [[package]] name = "uint" version = "0.9.5" @@ -7124,8 +7053,6 @@ dependencies = [ "clap-markdown", "clap_complete", "cliclack", - "common", - "config", "dirs", "ethers", "futures", @@ -7144,9 +7071,11 @@ dependencies = [ "thiserror", "tokio", "toml", - "types", "url", "xshell", + "zkstack_cli_common", + "zkstack_cli_config", + "zkstack_cli_types", "zksync_basic_types", "zksync_config", "zksync_consensus_crypto", @@ -7160,6 +7089,77 @@ dependencies = [ "zksync_web3_decl", ] +[[package]] +name = "zkstack_cli_common" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "clap", + "cliclack", + "console", + "ethers", + "futures", + "once_cell", + "serde", + "serde_json", + "serde_yaml", + "sqlx", + "strum", + "thiserror", + "tokio", + "toml", + "url", + "xshell", + "zkstack_cli_git_version_macro", + "zkstack_cli_types", + "zksync_system_constants", + "zksync_types", + "zksync_web3_decl", +] + +[[package]] +name = "zkstack_cli_config" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "ethers", + "rand", + "serde", + "serde_json", + "serde_yaml", + "strum", + "thiserror", + "url", + "xshell", + "zkstack_cli_common", + "zkstack_cli_types", + "zksync_basic_types", + "zksync_config", + "zksync_protobuf", + "zksync_protobuf_config", +] + +[[package]] +name = "zkstack_cli_git_version_macro" +version = "0.1.0" +dependencies = [ + "chrono", +] + +[[package]] +name = "zkstack_cli_types" +version = "0.1.0" +dependencies = [ + "clap", + "ethers", + "serde", + "strum", + "thiserror", + "zksync_basic_types", +] + [[package]] name = "zksync_basic_types" version = "0.1.0" diff --git a/zkstack_cli/Cargo.toml b/zkstack_cli/Cargo.toml index c382e2059007..6d18d1a531d7 100644 --- a/zkstack_cli/Cargo.toml +++ b/zkstack_cli/Cargo.toml @@ -21,10 +21,10 @@ keywords = ["zk", "cryptography", "blockchain", "ZKStack", "ZKsync"] [workspace.dependencies] # Local dependencies -common = { path = "crates/common" } -config = { path = "crates/config" } -types = { path = "crates/types" } -git_version_macro = { path = "crates/git_version_macro" } +zkstack_cli_common = { path = "crates/common" } +zkstack_cli_config = { path = "crates/config" } +zkstack_cli_types = { path = "crates/types" } +zkstack_cli_git_version_macro = { path = "crates/git_version_macro" } # ZkSync deps zksync_config = { path = "../core/lib/config" } diff --git a/zkstack_cli/crates/common/Cargo.toml b/zkstack_cli/crates/common/Cargo.toml index c906c3d28d04..7af8fab92bb8 100644 --- a/zkstack_cli/crates/common/Cargo.toml +++ b/zkstack_cli/crates/common/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "common" -version = "0.1.0" +name = "zkstack_cli_common" +version.workspace = true edition.workspace = true homepage.workspace = true license.workspace = true @@ -24,12 +24,12 @@ serde_yaml.workspace = true sqlx.workspace = true tokio.workspace = true toml.workspace = true -types.workspace = true +zkstack_cli_types.workspace = true url.workspace = true xshell.workspace = true thiserror.workspace = true strum.workspace = true -git_version_macro.workspace = true +zkstack_cli_git_version_macro.workspace = true async-trait.workspace = true zksync_system_constants.workspace = true zksync_types.workspace = true diff --git a/zkstack_cli/crates/common/src/ethereum.rs b/zkstack_cli/crates/common/src/ethereum.rs index 2100746fecff..96ec8b4f3597 100644 --- a/zkstack_cli/crates/common/src/ethereum.rs +++ b/zkstack_cli/crates/common/src/ethereum.rs @@ -8,7 +8,7 @@ use ethers::{ providers::Middleware, types::{Address, TransactionRequest}, }; -use types::TokenInfo; +use zkstack_cli_types::TokenInfo; use crate::{logger, wallets::Wallet}; diff --git a/zkstack_cli/crates/common/src/version.rs b/zkstack_cli/crates/common/src/version.rs index 43be7a07b7ee..f21018a0d7dd 100644 --- a/zkstack_cli/crates/common/src/version.rs +++ b/zkstack_cli/crates/common/src/version.rs @@ -1,7 +1,7 @@ -const GIT_VERSION: &str = git_version_macro::build_git_revision!(); -const GIT_BRANCH: &str = git_version_macro::build_git_branch!(); -const GIT_SUBMODULES: &[(&str, &str)] = git_version_macro::build_git_submodules!(); -const BUILD_TIMESTAMP: &str = git_version_macro::build_timestamp!(); +const GIT_VERSION: &str = zkstack_cli_git_version_macro::build_git_revision!(); +const GIT_BRANCH: &str = zkstack_cli_git_version_macro::build_git_branch!(); +const GIT_SUBMODULES: &[(&str, &str)] = zkstack_cli_git_version_macro::build_git_submodules!(); +const BUILD_TIMESTAMP: &str = zkstack_cli_git_version_macro::build_timestamp!(); /// Returns a multi-line version message that includes: /// - provided crate version diff --git a/zkstack_cli/crates/common/src/wallets.rs b/zkstack_cli/crates/common/src/wallets.rs index 43a9864474cc..ba1f6d239724 100644 --- a/zkstack_cli/crates/common/src/wallets.rs +++ b/zkstack_cli/crates/common/src/wallets.rs @@ -4,7 +4,7 @@ use ethers::{ types::{Address, H256}, }; use serde::{Deserialize, Serialize}; -use types::parse_h256; +use zkstack_cli_types::parse_h256; #[derive(Serialize, Deserialize)] struct WalletSerde { diff --git a/zkstack_cli/crates/config/Cargo.toml b/zkstack_cli/crates/config/Cargo.toml index 9320beffef22..5ddf36c2d30b 100644 --- a/zkstack_cli/crates/config/Cargo.toml +++ b/zkstack_cli/crates/config/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "config" -version = "0.1.0" +name = "zkstack_cli_config" +version.workspace = true edition.workspace = true homepage.workspace = true license.workspace = true @@ -13,7 +13,7 @@ keywords.workspace = true [dependencies] anyhow.workspace = true clap.workspace = true -common.workspace = true +zkstack_cli_common.workspace = true ethers.workspace = true rand.workspace = true serde.workspace = true @@ -21,7 +21,7 @@ serde_json.workspace = true serde_yaml.workspace = true strum.workspace = true thiserror.workspace = true -types.workspace = true +zkstack_cli_types.workspace = true url.workspace = true xshell.workspace = true diff --git a/zkstack_cli/crates/config/src/chain.rs b/zkstack_cli/crates/config/src/chain.rs index cd93299cfc41..edd6199511d7 100644 --- a/zkstack_cli/crates/config/src/chain.rs +++ b/zkstack_cli/crates/config/src/chain.rs @@ -4,8 +4,8 @@ use std::{ }; use serde::{Deserialize, Serialize, Serializer}; -use types::{BaseToken, L1BatchCommitmentMode, L1Network, ProverMode, WalletCreation}; use xshell::Shell; +use zkstack_cli_types::{BaseToken, L1BatchCommitmentMode, L1Network, ProverMode, WalletCreation}; use zksync_basic_types::L2ChainId; use zksync_config::configs::{GatewayChainConfig, GatewayConfig}; diff --git a/zkstack_cli/crates/config/src/ecosystem.rs b/zkstack_cli/crates/config/src/ecosystem.rs index 5fe85b175de4..906cf8dd012b 100644 --- a/zkstack_cli/crates/config/src/ecosystem.rs +++ b/zkstack_cli/crates/config/src/ecosystem.rs @@ -3,11 +3,11 @@ use std::{ path::{Path, PathBuf}, }; -use common::{config::global_config, logger}; use serde::{Deserialize, Serialize, Serializer}; use thiserror::Error; -use types::{L1Network, ProverMode, WalletCreation}; use xshell::Shell; +use zkstack_cli_common::{config::global_config, logger}; +use zkstack_cli_types::{L1Network, ProverMode, WalletCreation}; use zksync_basic_types::L2ChainId; use crate::{ diff --git a/zkstack_cli/crates/config/src/explorer_compose.rs b/zkstack_cli/crates/config/src/explorer_compose.rs index 13dd665d2e3d..5c6593cd7a46 100644 --- a/zkstack_cli/crates/config/src/explorer_compose.rs +++ b/zkstack_cli/crates/config/src/explorer_compose.rs @@ -4,9 +4,9 @@ use std::{ }; use anyhow::Context; -use common::{db, docker::adjust_localhost_for_docker}; use serde::{Deserialize, Serialize}; use url::Url; +use zkstack_cli_common::{db, docker::adjust_localhost_for_docker}; use crate::{ consts::{ diff --git a/zkstack_cli/crates/config/src/forge_interface/deploy_gateway_ctm/input.rs b/zkstack_cli/crates/config/src/forge_interface/deploy_gateway_ctm/input.rs index 8f35180077a2..4143a286da62 100644 --- a/zkstack_cli/crates/config/src/forge_interface/deploy_gateway_ctm/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/deploy_gateway_ctm/input.rs @@ -1,7 +1,7 @@ /// TODO(EVM-927): Note that the contents of this file are not useable without Gateway contracts. use ethers::abi::Address; use serde::{Deserialize, Serialize}; -use types::ProverMode; +use zkstack_cli_types::ProverMode; use zksync_basic_types::{H256, U256}; use zksync_config::GenesisConfig; diff --git a/zkstack_cli/crates/config/src/forge_interface/gateway_chain_upgrade/input.rs b/zkstack_cli/crates/config/src/forge_interface/gateway_chain_upgrade/input.rs index 5fce7ebe3388..9bedabf59a2d 100644 --- a/zkstack_cli/crates/config/src/forge_interface/gateway_chain_upgrade/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/gateway_chain_upgrade/input.rs @@ -1,7 +1,7 @@ /// TODO(EVM-927): Note that the contents of this file are not useable without Gateway contracts. use ethers::types::Address; use serde::{Deserialize, Serialize}; -use types::L1BatchCommitmentMode; +use zkstack_cli_types::L1BatchCommitmentMode; use zksync_basic_types::L2ChainId; use crate::{traits::ZkStackConfig, ChainConfig}; diff --git a/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs b/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs index 7d30c7f49a70..1e6a31009506 100644 --- a/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs @@ -1,7 +1,7 @@ use ethers::types::Address; use rand::Rng; use serde::{Deserialize, Serialize}; -use types::L1BatchCommitmentMode; +use zkstack_cli_types::L1BatchCommitmentMode; use zksync_basic_types::L2ChainId; use crate::{traits::ZkStackConfig, ChainConfig, ContractsConfig}; diff --git a/zkstack_cli/crates/config/src/general.rs b/zkstack_cli/crates/config/src/general.rs index 0079105b66ca..c1639d6bea15 100644 --- a/zkstack_cli/crates/config/src/general.rs +++ b/zkstack_cli/crates/config/src/general.rs @@ -1,9 +1,9 @@ use std::path::{Path, PathBuf}; use anyhow::Context; -use common::yaml::merge_yaml; use url::Url; use xshell::Shell; +use zkstack_cli_common::yaml::merge_yaml; use zksync_config::configs::object_store::ObjectStoreMode; pub use zksync_config::configs::GeneralConfig; use zksync_protobuf_config::{encode_yaml_repr, read_yaml_repr}; diff --git a/zkstack_cli/crates/config/src/portal.rs b/zkstack_cli/crates/config/src/portal.rs index 2b6f0ffd5156..ab121e8e177d 100644 --- a/zkstack_cli/crates/config/src/portal.rs +++ b/zkstack_cli/crates/config/src/portal.rs @@ -1,8 +1,8 @@ use std::path::{Path, PathBuf}; use serde::{Deserialize, Serialize}; -use types::TokenInfo; use xshell::Shell; +use zkstack_cli_types::TokenInfo; use crate::{ consts::{ diff --git a/zkstack_cli/crates/config/src/secrets.rs b/zkstack_cli/crates/config/src/secrets.rs index cf0a9927c560..91e8964b4651 100644 --- a/zkstack_cli/crates/config/src/secrets.rs +++ b/zkstack_cli/crates/config/src/secrets.rs @@ -1,8 +1,8 @@ use std::{path::Path, str::FromStr}; use anyhow::Context; -use common::db::DatabaseConfig; use xshell::Shell; +use zkstack_cli_common::db::DatabaseConfig; use zksync_basic_types::url::SensitiveUrl; pub use zksync_config::configs::Secrets as SecretsConfig; use zksync_protobuf_config::{encode_yaml_repr, read_yaml_repr}; diff --git a/zkstack_cli/crates/config/src/traits.rs b/zkstack_cli/crates/config/src/traits.rs index a4a4ad22c613..d21641e33ff5 100644 --- a/zkstack_cli/crates/config/src/traits.rs +++ b/zkstack_cli/crates/config/src/traits.rs @@ -1,12 +1,12 @@ use std::path::{Path, PathBuf}; use anyhow::{bail, Context}; -use common::files::{ - read_json_file, read_toml_file, read_yaml_file, save_json_file, save_toml_file, save_yaml_file, -}; use serde::{de::DeserializeOwned, Serialize}; use url::Url; use xshell::Shell; +use zkstack_cli_common::files::{ + read_json_file, read_toml_file, read_yaml_file, save_json_file, save_toml_file, save_yaml_file, +}; // Configs that we use only inside ZK Stack CLI, we don't have protobuf implementation for them. pub trait ZkStackConfig {} diff --git a/zkstack_cli/crates/config/src/wallet_creation.rs b/zkstack_cli/crates/config/src/wallet_creation.rs index 6cfdf08a36d3..547b3a0e1c90 100644 --- a/zkstack_cli/crates/config/src/wallet_creation.rs +++ b/zkstack_cli/crates/config/src/wallet_creation.rs @@ -1,9 +1,9 @@ use std::path::{Path, PathBuf}; -use common::wallets::Wallet; use rand::thread_rng; -use types::WalletCreation; use xshell::Shell; +use zkstack_cli_common::wallets::Wallet; +use zkstack_cli_types::WalletCreation; use crate::{ consts::{BASE_PATH, TEST_CONFIG_PATH}, diff --git a/zkstack_cli/crates/config/src/wallets.rs b/zkstack_cli/crates/config/src/wallets.rs index 735848f6e34d..edd12b16bfe6 100644 --- a/zkstack_cli/crates/config/src/wallets.rs +++ b/zkstack_cli/crates/config/src/wallets.rs @@ -1,6 +1,6 @@ -use common::wallets::Wallet; use rand::{CryptoRng, Rng}; use serde::{Deserialize, Serialize}; +use zkstack_cli_common::wallets::Wallet; use crate::{ consts::WALLETS_FILE, diff --git a/zkstack_cli/crates/git_version_macro/Cargo.toml b/zkstack_cli/crates/git_version_macro/Cargo.toml index eb70b450a4cf..3a8352abafc1 100644 --- a/zkstack_cli/crates/git_version_macro/Cargo.toml +++ b/zkstack_cli/crates/git_version_macro/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "git_version_macro" +name = "zkstack_cli_git_version_macro" edition = "2021" description = "Procedural macro to generate metainformation about build in compile time" version.workspace = true diff --git a/zkstack_cli/crates/types/Cargo.toml b/zkstack_cli/crates/types/Cargo.toml index 97e00e1ba46b..2ce034f1cbd5 100644 --- a/zkstack_cli/crates/types/Cargo.toml +++ b/zkstack_cli/crates/types/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "types" -version = "0.1.0" +name = "zkstack_cli_types" +version.workspace = true edition.workspace = true homepage.workspace = true license.workspace = true diff --git a/zkstack_cli/crates/zkstack/Cargo.toml b/zkstack_cli/crates/zkstack/Cargo.toml index a19ced3f39c4..96d1dbf25be6 100644 --- a/zkstack_cli/crates/zkstack/Cargo.toml +++ b/zkstack_cli/crates/zkstack/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zkstack" -version = "0.1.0" +version.workspace = true edition.workspace = true homepage.workspace = true license.workspace = true @@ -17,8 +17,8 @@ clap.workspace = true clap_complete.workspace = true clap-markdown.workspace = true cliclack.workspace = true -common.workspace = true -config.workspace = true +zkstack_cli_common.workspace = true +zkstack_cli_config.workspace = true dirs.workspace = true ethers.workspace = true futures.workspace = true @@ -34,7 +34,7 @@ sqruff-lib = "0.19.0" thiserror.workspace = true tokio.workspace = true toml.workspace = true -types.workspace = true +zkstack_cli_types.workspace = true url.workspace = true xshell.workspace = true zksync_basic_types.workspace = true diff --git a/zkstack_cli/crates/zkstack/src/accept_ownership.rs b/zkstack_cli/crates/zkstack/src/accept_ownership.rs index ab13661d6adb..cde1a365e8a0 100644 --- a/zkstack_cli/crates/zkstack/src/accept_ownership.rs +++ b/zkstack_cli/crates/zkstack/src/accept_ownership.rs @@ -1,13 +1,4 @@ use anyhow::Context; -use common::{ - forge::{Forge, ForgeScript, ForgeScriptArgs}, - spinner::Spinner, - wallets::Wallet, -}; -use config::{ - forge_interface::script_params::ACCEPT_GOVERNANCE_SCRIPT_PARAMS, ChainConfig, ContractsConfig, - EcosystemConfig, -}; use ethers::{ abi::{parse_abi, Token}, contract::BaseContract, @@ -15,6 +6,15 @@ use ethers::{ }; use lazy_static::lazy_static; use xshell::Shell; +use zkstack_cli_common::{ + forge::{Forge, ForgeScript, ForgeScriptArgs}, + spinner::Spinner, + wallets::Wallet, +}; +use zkstack_cli_config::{ + forge_interface::script_params::ACCEPT_GOVERNANCE_SCRIPT_PARAMS, ChainConfig, ContractsConfig, + EcosystemConfig, +}; use zksync_basic_types::U256; use crate::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/args/containers.rs b/zkstack_cli/crates/zkstack/src/commands/args/containers.rs index c996d65598ff..bff596f93cfe 100644 --- a/zkstack_cli/crates/zkstack/src/commands/args/containers.rs +++ b/zkstack_cli/crates/zkstack/src/commands/args/containers.rs @@ -16,7 +16,7 @@ pub struct ContainersArgsFinal { impl ContainersArgs { pub fn fill_values_with_prompt(self) -> ContainersArgsFinal { let observability = self.observability.unwrap_or_else(|| { - common::PromptConfirm::new(MSG_OBSERVABILITY_RUN_PROMPT) + zkstack_cli_common::PromptConfirm::new(MSG_OBSERVABILITY_RUN_PROMPT) .default(true) .ask() }); diff --git a/zkstack_cli/crates/zkstack/src/commands/args/wait.rs b/zkstack_cli/crates/zkstack/src/commands/args/wait.rs index a3a7e32ae8b4..315552cdb72a 100644 --- a/zkstack_cli/crates/zkstack/src/commands/args/wait.rs +++ b/zkstack_cli/crates/zkstack/src/commands/args/wait.rs @@ -2,10 +2,10 @@ use std::{fmt, future::Future, time::Duration}; use anyhow::Context as _; use clap::Parser; -use common::logger; use reqwest::StatusCode; use serde::{Deserialize, Serialize}; use tokio::time::MissedTickBehavior; +use zkstack_cli_common::logger; use crate::messages::{ msg_wait_connect_err, msg_wait_non_successful_response, msg_wait_not_healthy, diff --git a/zkstack_cli/crates/zkstack/src/commands/autocomplete.rs b/zkstack_cli/crates/zkstack/src/commands/autocomplete.rs index 0f2105cd5efa..ee6526e5aa80 100644 --- a/zkstack_cli/crates/zkstack/src/commands/autocomplete.rs +++ b/zkstack_cli/crates/zkstack/src/commands/autocomplete.rs @@ -6,7 +6,7 @@ use std::{ use anyhow::Context; use clap::CommandFactory; use clap_complete::{generate, Generator}; -use common::logger; +use zkstack_cli_common::logger; use super::args::AutocompleteArgs; use crate::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/accept_chain_ownership.rs b/zkstack_cli/crates/zkstack/src/commands/chain/accept_chain_ownership.rs index cf3e2981b3c7..46b92248ae3f 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/accept_chain_ownership.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/accept_chain_ownership.rs @@ -1,7 +1,7 @@ use anyhow::Context; -use common::{forge::ForgeScriptArgs, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::Shell; +use zkstack_cli_common::{forge::ForgeScriptArgs, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use crate::{ accept_ownership::accept_admin, diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/args/build_transactions.rs b/zkstack_cli/crates/zkstack/src/commands/chain/args/build_transactions.rs index 793bea487f7e..ab92c91bbda3 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/args/build_transactions.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/args/build_transactions.rs @@ -1,9 +1,9 @@ use std::path::PathBuf; use clap::Parser; -use common::{config::global_config, forge::ForgeScriptArgs, Prompt}; use serde::{Deserialize, Serialize}; use url::Url; +use zkstack_cli_common::{config::global_config, forge::ForgeScriptArgs, Prompt}; use crate::{ consts::DEFAULT_UNSIGNED_TRANSACTIONS_DIR, diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/args/create.rs b/zkstack_cli/crates/zkstack/src/commands/chain/args/create.rs index 5310a46d23c4..c29696b92dec 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/args/create.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/args/create.rs @@ -2,12 +2,12 @@ use std::{path::PathBuf, str::FromStr}; use anyhow::{bail, Context}; use clap::{Parser, ValueEnum, ValueHint}; -use common::{Prompt, PromptConfirm, PromptSelect}; -use config::forge_interface::deploy_ecosystem::output::Erc20Token; use serde::{Deserialize, Serialize}; use slugify_rs::slugify; use strum::{Display, EnumIter, IntoEnumIterator}; -use types::{BaseToken, L1BatchCommitmentMode, L1Network, ProverMode, WalletCreation}; +use zkstack_cli_common::{Prompt, PromptConfirm, PromptSelect}; +use zkstack_cli_config::forge_interface::deploy_ecosystem::output::Erc20Token; +use zkstack_cli_types::{BaseToken, L1BatchCommitmentMode, L1Network, ProverMode, WalletCreation}; use zksync_basic_types::H160; use crate::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/args/genesis.rs b/zkstack_cli/crates/zkstack/src/commands/chain/args/genesis.rs index f990cbfd77da..ef98a777352e 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/args/genesis.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/args/genesis.rs @@ -1,10 +1,10 @@ use anyhow::Context; use clap::Parser; -use common::{db::DatabaseConfig, Prompt}; -use config::ChainConfig; use serde::{Deserialize, Serialize}; use slugify_rs::slugify; use url::Url; +use zkstack_cli_common::{db::DatabaseConfig, Prompt}; +use zkstack_cli_config::ChainConfig; use crate::{ defaults::{generate_db_names, DBNames, DATABASE_SERVER_URL}, diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/args/init/configs.rs b/zkstack_cli/crates/zkstack/src/commands/chain/args/init/configs.rs index b34809643cf5..adfb5ffaf9b7 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/args/init/configs.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/args/init/configs.rs @@ -1,9 +1,9 @@ use clap::Parser; -use common::Prompt; -use config::ChainConfig; use serde::{Deserialize, Serialize}; -use types::L1Network; use url::Url; +use zkstack_cli_common::Prompt; +use zkstack_cli_config::ChainConfig; +use zkstack_cli_types::L1Network; use crate::{ commands::chain::args::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/args/init/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/args/init/mod.rs index 59810964d2c3..23e32306519c 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/args/init/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/args/init/mod.rs @@ -1,9 +1,9 @@ use clap::Parser; -use common::{forge::ForgeScriptArgs, Prompt}; -use config::ChainConfig; use serde::{Deserialize, Serialize}; -use types::L1Network; use url::Url; +use zkstack_cli_common::{forge::ForgeScriptArgs, Prompt}; +use zkstack_cli_config::ChainConfig; +use zkstack_cli_types::L1Network; use crate::{ commands::chain::args::genesis::{GenesisArgs, GenesisArgsFinal}, @@ -58,7 +58,7 @@ impl InitArgs { true } else { self.deploy_paymaster.unwrap_or_else(|| { - common::PromptConfirm::new(MSG_DEPLOY_PAYMASTER_PROMPT) + zkstack_cli_common::PromptConfirm::new(MSG_DEPLOY_PAYMASTER_PROMPT) .default(true) .ask() }) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs b/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs index d3953c656596..2e25d15b0fab 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs @@ -1,10 +1,10 @@ use anyhow::Context; -use common::{git, logger, spinner::Spinner}; -use config::{ - copy_configs, traits::SaveConfigWithBasePath, update_from_chain_config, EcosystemConfig, -}; use ethers::utils::hex::ToHex; use xshell::Shell; +use zkstack_cli_common::{git, logger, spinner::Spinner}; +use zkstack_cli_config::{ + copy_configs, traits::SaveConfigWithBasePath, update_from_chain_config, EcosystemConfig, +}; use crate::{ commands::chain::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/common.rs b/zkstack_cli/crates/zkstack/src/commands/chain/common.rs index 0c35b3ee4fe0..e14c2460afcd 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/common.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/common.rs @@ -1,6 +1,6 @@ -use common::spinner::Spinner; -use config::{ChainConfig, EcosystemConfig}; -use types::{BaseToken, L1Network, WalletCreation}; +use zkstack_cli_common::spinner::Spinner; +use zkstack_cli_config::{ChainConfig, EcosystemConfig}; +use zkstack_cli_types::{BaseToken, L1Network, WalletCreation}; use crate::{ consts::AMOUNT_FOR_DISTRIBUTION_TO_WALLETS, @@ -30,7 +30,7 @@ pub async fn distribute_eth( if let Some(setter) = chain_wallets.token_multiplier_setter { addresses.push(setter.address) } - common::ethereum::distribute_eth( + zkstack_cli_common::ethereum::distribute_eth( wallets.operator, addresses, l1_rpc_url, @@ -59,7 +59,7 @@ pub async fn mint_base_token( let addresses = vec![wallets.governor.address, chain_wallets.governor.address]; let amount = AMOUNT_FOR_DISTRIBUTION_TO_WALLETS * base_token.nominator as u128 / base_token.denominator as u128; - common::ethereum::mint_token( + zkstack_cli_common::ethereum::mint_token( wallets.governor, base_token.address, addresses, diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/convert_to_gateway.rs b/zkstack_cli/crates/zkstack/src/commands/chain/convert_to_gateway.rs index 3043f3a52837..0ac534382a26 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/convert_to_gateway.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/convert_to_gateway.rs @@ -1,11 +1,14 @@ /// TODO(EVM-927): Note that the contents of this file are not useable without Gateway contracts. use anyhow::Context; -use common::{ +use ethers::{abi::parse_abi, contract::BaseContract, types::Bytes, utils::hex}; +use lazy_static::lazy_static; +use xshell::Shell; +use zkstack_cli_common::{ config::global_config, forge::{Forge, ForgeScriptArgs}, wallets::Wallet, }; -use config::{ +use zkstack_cli_config::{ forge_interface::{ deploy_ecosystem::input::InitialDeploymentConfig, deploy_gateway_ctm::{input::DeployGatewayCTMInput, output::DeployGatewayCTMOutput}, @@ -15,9 +18,6 @@ use config::{ traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath}, ChainConfig, EcosystemConfig, GenesisConfig, }; -use ethers::{abi::parse_abi, contract::BaseContract, types::Bytes, utils::hex}; -use lazy_static::lazy_static; -use xshell::Shell; use zksync_basic_types::H256; use zksync_config::configs::GatewayConfig; diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/create.rs b/zkstack_cli/crates/zkstack/src/commands/chain/create.rs index 367dddd95884..fa5ee1a59df7 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/create.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/create.rs @@ -1,13 +1,13 @@ use std::cell::OnceCell; use anyhow::Context; -use common::{logger, spinner::Spinner}; -use config::{ +use xshell::Shell; +use zkstack_cli_common::{logger, spinner::Spinner}; +use zkstack_cli_config::{ create_local_configs_dir, create_wallets, traits::{ReadConfigWithBasePath, SaveConfigWithBasePath}, ChainConfig, EcosystemConfig, GenesisConfig, }; -use xshell::Shell; use zksync_basic_types::L2ChainId; use crate::{ 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 09732145d1db..d404b29b5a98 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 @@ -1,12 +1,13 @@ use std::path::Path; use anyhow::Context; -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ contracts::build_l2_contracts, forge::{Forge, ForgeScriptArgs}, spinner::Spinner, }; -use config::{ +use zkstack_cli_config::{ forge_interface::{ deploy_l2_contracts::{ input::DeployL2ContractsInput, @@ -20,7 +21,6 @@ use config::{ traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath}, ChainConfig, ContractsConfig, EcosystemConfig, }; -use xshell::Shell; use crate::{ messages::{ 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 c6b48ca87856..1c103ea29910 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs @@ -1,6 +1,7 @@ use anyhow::Context; -use common::forge::{Forge, ForgeScriptArgs}; -use config::{ +use xshell::Shell; +use zkstack_cli_common::forge::{Forge, ForgeScriptArgs}; +use zkstack_cli_config::{ forge_interface::{ paymaster::{DeployPaymasterInput, DeployPaymasterOutput}, script_params::DEPLOY_PAYMASTER_SCRIPT_PARAMS, @@ -8,7 +9,6 @@ use config::{ traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath}, ChainConfig, ContractsConfig, EcosystemConfig, }; -use xshell::Shell; use crate::{ messages::{MSG_CHAIN_NOT_INITIALIZED, MSG_L1_SECRETS_MUST_BE_PRESENTED}, diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/enable_evm_emulator.rs b/zkstack_cli/crates/zkstack/src/commands/chain/enable_evm_emulator.rs index a6bbd2c9dc70..e15cdbacf103 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/enable_evm_emulator.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/enable_evm_emulator.rs @@ -1,7 +1,7 @@ use anyhow::Context; -use common::{forge::ForgeScriptArgs, logger}; -use config::{traits::ReadConfigWithBasePath, EcosystemConfig, GenesisConfig}; use xshell::Shell; +use zkstack_cli_common::{forge::ForgeScriptArgs, logger}; +use zkstack_cli_config::{traits::ReadConfigWithBasePath, EcosystemConfig, GenesisConfig}; use crate::{ enable_evm_emulator::enable_evm_emulator, diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/gateway_upgrade.rs b/zkstack_cli/crates/zkstack/src/commands/chain/gateway_upgrade.rs index 8153bcfb0b7e..ed84df9d13c4 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/gateway_upgrade.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/gateway_upgrade.rs @@ -1,11 +1,20 @@ /// TODO(EVM-927): Note that the contents of this file are not useable without Gateway contracts. use anyhow::Context; use clap::{Parser, ValueEnum}; -use common::{ +use ethers::{ + abi::{encode, parse_abi}, + contract::BaseContract, + utils::hex, +}; +use lazy_static::lazy_static; +use serde::{Deserialize, Serialize}; +use strum::EnumIter; +use xshell::Shell; +use zkstack_cli_common::{ config::global_config, forge::{Forge, ForgeScriptArgs}, }; -use config::{ +use zkstack_cli_config::{ forge_interface::{ gateway_chain_upgrade::{ input::GatewayChainUpgradeInput, output::GatewayChainUpgradeOutput, @@ -16,16 +25,7 @@ use config::{ traits::{ReadConfig, ReadConfigWithBasePath, SaveConfig, SaveConfigWithBasePath}, ChainConfig, EcosystemConfig, }; -use ethers::{ - abi::{encode, parse_abi}, - contract::BaseContract, - utils::hex, -}; -use lazy_static::lazy_static; -use serde::{Deserialize, Serialize}; -use strum::EnumIter; -use types::L1BatchCommitmentMode; -use xshell::Shell; +use zkstack_cli_types::L1BatchCommitmentMode; use zksync_basic_types::{H256, U256}; use zksync_types::{web3::keccak256, Address, L2_NATIVE_TOKEN_VAULT_ADDRESS}; diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/genesis/database.rs b/zkstack_cli/crates/zkstack/src/commands/chain/genesis/database.rs index edf480946be1..fe12bc017a45 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/genesis/database.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/genesis/database.rs @@ -1,17 +1,17 @@ use std::path::PathBuf; use anyhow::Context; -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ config::global_config, db::{drop_db_if_exists, init_db, migrate_db, DatabaseConfig}, logger, }; -use config::{ +use zkstack_cli_config::{ override_config, set_file_artifacts, set_rocks_db_config, set_server_database, traits::SaveConfigWithBasePath, ChainConfig, EcosystemConfig, FileArtifacts, }; -use types::ProverMode; -use xshell::Shell; +use zkstack_cli_types::ProverMode; use zksync_basic_types::commitment::L1BatchCommitmentMode; use crate::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/genesis/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/genesis/mod.rs index c1cc03174aeb..5cb289d32609 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/genesis/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/genesis/mod.rs @@ -1,8 +1,8 @@ use anyhow::Context; use clap::{command, Parser, Subcommand}; -use common::{logger, spinner::Spinner}; -use config::{ChainConfig, EcosystemConfig}; use xshell::Shell; +use zkstack_cli_common::{logger, spinner::Spinner}; +use zkstack_cli_config::{ChainConfig, EcosystemConfig}; use crate::{ commands::chain::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/genesis/server.rs b/zkstack_cli/crates/zkstack/src/commands/chain/genesis/server.rs index 090792e8007a..9a52595c978c 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/genesis/server.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/genesis/server.rs @@ -1,14 +1,14 @@ use anyhow::Context; -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ logger, server::{Server, ServerMode}, spinner::Spinner, }; -use config::{ +use zkstack_cli_config::{ traits::FileConfigWithDefaultName, ChainConfig, ContractsConfig, EcosystemConfig, GeneralConfig, GenesisConfig, SecretsConfig, WalletsConfig, }; -use xshell::Shell; use crate::messages::{ MSG_CHAIN_NOT_INITIALIZED, MSG_FAILED_TO_RUN_SERVER_ERR, MSG_GENESIS_COMPLETED, diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs b/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs index 31c5c681e7d3..5a27f903a72f 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs @@ -1,11 +1,11 @@ use anyhow::Context; -use common::logger; -use config::{ +use ethers::types::Address; +use xshell::Shell; +use zkstack_cli_common::logger; +use zkstack_cli_config::{ copy_configs, set_l1_rpc_url, traits::SaveConfigWithBasePath, update_from_chain_config, ChainConfig, ContractsConfig, EcosystemConfig, }; -use ethers::types::Address; -use xshell::Shell; use crate::{ commands::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs index a4c21b5bc5d1..4100fee22d89 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs @@ -1,9 +1,9 @@ use anyhow::Context; use clap::{command, Parser, Subcommand}; -use common::{git, logger, spinner::Spinner}; -use config::{traits::SaveConfigWithBasePath, ChainConfig, EcosystemConfig}; -use types::BaseToken; use xshell::Shell; +use zkstack_cli_common::{git, logger, spinner::Spinner}; +use zkstack_cli_config::{traits::SaveConfigWithBasePath, ChainConfig, EcosystemConfig}; +use zkstack_cli_types::BaseToken; use crate::{ accept_ownership::accept_admin, diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/migrate_from_gateway.rs b/zkstack_cli/crates/zkstack/src/commands/chain/migrate_from_gateway.rs index 71521e62c3e6..573dcf56345f 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/migrate_from_gateway.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/migrate_from_gateway.rs @@ -1,13 +1,23 @@ /// TODO(EVM-927): Note that the contents of this file are not useable without Gateway contracts. use anyhow::Context; use clap::Parser; -use common::{ +use ethers::{ + abi::parse_abi, + contract::BaseContract, + providers::{Http, Middleware, Provider}, + types::Bytes, + utils::hex, +}; +use lazy_static::lazy_static; +use serde::{Deserialize, Serialize}; +use xshell::Shell; +use zkstack_cli_common::{ config::global_config, forge::{Forge, ForgeScriptArgs}, wallets::Wallet, zks_provider::ZKSProvider, }; -use config::{ +use zkstack_cli_config::{ forge_interface::{ gateway_preparation::{input::GatewayPreparationConfig, output::GatewayPreparationOutput}, script_params::GATEWAY_PREPARATION, @@ -15,17 +25,7 @@ use config::{ traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath}, EcosystemConfig, }; -use ethers::{ - abi::parse_abi, - contract::BaseContract, - providers::{Http, Middleware, Provider}, - types::Bytes, - utils::hex, -}; -use lazy_static::lazy_static; -use serde::{Deserialize, Serialize}; -use types::L1BatchCommitmentMode; -use xshell::Shell; +use zkstack_cli_types::L1BatchCommitmentMode; use zksync_basic_types::{ pubdata_da::PubdataSendingMode, settlement::SettlementMode, H256, U256, U64, }; diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/migrate_to_gateway.rs b/zkstack_cli/crates/zkstack/src/commands/chain/migrate_to_gateway.rs index e5202c570183..f6bb25613039 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/migrate_to_gateway.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/migrate_to_gateway.rs @@ -1,11 +1,21 @@ use anyhow::Context; use clap::Parser; -use common::{ +use ethers::{ + abi::parse_abi, + contract::BaseContract, + providers::{Http, Middleware, Provider}, + types::Bytes, + utils::hex, +}; +use lazy_static::lazy_static; +use serde::{Deserialize, Serialize}; +use xshell::Shell; +use zkstack_cli_common::{ config::global_config, forge::{Forge, ForgeScriptArgs}, wallets::Wallet, }; -use config::{ +use zkstack_cli_config::{ forge_interface::{ gateway_preparation::{input::GatewayPreparationConfig, output::GatewayPreparationOutput}, script_params::GATEWAY_PREPARATION, @@ -13,17 +23,7 @@ use config::{ traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath}, EcosystemConfig, }; -use ethers::{ - abi::parse_abi, - contract::BaseContract, - providers::{Http, Middleware, Provider}, - types::Bytes, - utils::hex, -}; -use lazy_static::lazy_static; -use serde::{Deserialize, Serialize}; -use types::L1BatchCommitmentMode; -use xshell::Shell; +use zkstack_cli_types::L1BatchCommitmentMode; use zksync_basic_types::{ pubdata_da::PubdataSendingMode, settlement::SettlementMode, Address, H256, U256, U64, }; diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs index 474f1c779016..7bbe8acf99f3 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs @@ -1,4 +1,4 @@ -use ::common::forge::ForgeScriptArgs; +use ::zkstack_cli_common::forge::ForgeScriptArgs; use args::build_transactions::BuildTransactionsArgs; pub(crate) use args::create::ChainCreateArgsFinal; use clap::{command, Subcommand}; 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 6269b0af0ea9..626d25438385 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs @@ -1,10 +1,11 @@ use anyhow::Context; -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ forge::{Forge, ForgeScriptArgs}, logger, spinner::Spinner, }; -use config::{ +use zkstack_cli_config::{ forge_interface::{ register_chain::{input::RegisterChainL1Config, output::RegisterChainOutput}, script_params::REGISTER_CHAIN_SCRIPT_PARAMS, @@ -12,7 +13,6 @@ use config::{ traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath}, ChainConfig, ContractsConfig, EcosystemConfig, }; -use xshell::Shell; use crate::{ messages::{ 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 bff3cfe467b5..69a823f8f852 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 @@ -1,14 +1,16 @@ use anyhow::Context; -use common::{ +use ethers::{abi::parse_abi, contract::BaseContract, utils::hex}; +use lazy_static::lazy_static; +use xshell::Shell; +use zkstack_cli_common::{ forge::{Forge, ForgeScript, ForgeScriptArgs}, logger, spinner::Spinner, wallets::Wallet, }; -use config::{forge_interface::script_params::ACCEPT_GOVERNANCE_SCRIPT_PARAMS, EcosystemConfig}; -use ethers::{abi::parse_abi, contract::BaseContract, utils::hex}; -use lazy_static::lazy_static; -use xshell::Shell; +use zkstack_cli_config::{ + forge_interface::script_params::ACCEPT_GOVERNANCE_SCRIPT_PARAMS, EcosystemConfig, +}; use zksync_basic_types::Address; use crate::{ 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 8973fccced86..631dffffac41 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 @@ -1,16 +1,16 @@ use anyhow::Context; -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ forge::{Forge, ForgeScriptArgs}, spinner::Spinner, }; -use config::{ +use zkstack_cli_config::{ forge_interface::{ script_params::SETUP_LEGACY_BRIDGE, setup_legacy_bridge::SetupLegacyBridgeInput, }, traits::SaveConfig, ChainConfig, ContractsConfig, EcosystemConfig, }; -use xshell::Shell; use crate::{ messages::{MSG_DEPLOYING_PAYMASTER, MSG_L1_SECRETS_MUST_BE_PRESENTED}, diff --git a/zkstack_cli/crates/zkstack/src/commands/consensus/mod.rs b/zkstack_cli/crates/zkstack/src/commands/consensus/mod.rs index 7a998efedbf2..ad64207b481c 100644 --- a/zkstack_cli/crates/zkstack/src/commands/consensus/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/consensus/mod.rs @@ -3,8 +3,6 @@ use std::{borrow::Borrow, collections::HashMap, path::PathBuf, sync::Arc}; /// Consensus registry contract operations. /// Includes code duplicated from `zksync_node_consensus::registry::abi`. use anyhow::Context as _; -use common::{config::global_config, logger, wallets::Wallet}; -use config::EcosystemConfig; use conv::*; use ethers::{ abi::Detokenize, @@ -16,6 +14,8 @@ use ethers::{ }; use tokio::time::MissedTickBehavior; use xshell::Shell; +use zkstack_cli_common::{config::global_config, logger, wallets::Wallet}; +use zkstack_cli_config::EcosystemConfig; use zksync_consensus_crypto::ByteFmt; use zksync_consensus_roles::{attester, validator}; @@ -144,10 +144,10 @@ fn print_attesters(committee: &attester::Committee) { } struct Setup { - chain: config::ChainConfig, - contracts: config::ContractsConfig, - general: config::GeneralConfig, - genesis: config::GenesisConfig, + chain: zkstack_cli_config::ChainConfig, + contracts: zkstack_cli_config::ContractsConfig, + general: zkstack_cli_config::GeneralConfig, + genesis: zkstack_cli_config::GenesisConfig, } impl Setup { diff --git a/zkstack_cli/crates/zkstack/src/commands/containers.rs b/zkstack_cli/crates/zkstack/src/commands/containers.rs index 8367289bd67f..8469365a295f 100644 --- a/zkstack_cli/crates/zkstack/src/commands/containers.rs +++ b/zkstack_cli/crates/zkstack/src/commands/containers.rs @@ -1,9 +1,9 @@ use std::path::PathBuf; use anyhow::{anyhow, Context}; -use common::{docker, logger, spinner::Spinner}; -use config::{EcosystemConfig, DOCKER_COMPOSE_FILE, ERA_OBSERVABILITY_COMPOSE_FILE}; use xshell::Shell; +use zkstack_cli_common::{docker, logger, spinner::Spinner}; +use zkstack_cli_config::{EcosystemConfig, DOCKER_COMPOSE_FILE, ERA_OBSERVABILITY_COMPOSE_FILE}; use super::args::ContainersArgs; use crate::{ @@ -46,7 +46,10 @@ pub fn initialize_docker(shell: &Shell, ecosystem: &EcosystemConfig) -> anyhow:: fn start_container(shell: &Shell, compose_file: &str, retry_msg: &str) -> anyhow::Result<()> { while let Err(err) = docker::up(shell, compose_file, true) { logger::error(err.to_string()); - if !common::PromptConfirm::new(retry_msg).default(true).ask() { + if !zkstack_cli_common::PromptConfirm::new(retry_msg) + .default(true) + .ask() + { return Err(err); } } diff --git a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/args/init.rs b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/args/init.rs index 7ba7d3cb40cf..a3aadfbce4ae 100644 --- a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/args/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/args/init.rs @@ -1,7 +1,7 @@ use anyhow::Context; use clap::Parser; -use common::PromptSelect; use xshell::Shell; +use zkstack_cli_common::PromptSelect; use super::releases::{get_releases_with_arch, Arch, Version}; use crate::messages::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/args/releases.rs b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/args/releases.rs index ab169220f299..a8199372fc2c 100644 --- a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/args/releases.rs +++ b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/args/releases.rs @@ -1,8 +1,8 @@ use std::str::FromStr; -use common::spinner::Spinner; use serde::Deserialize; use xshell::Shell; +use zkstack_cli_common::spinner::Spinner; use crate::messages::{MSG_INVALID_ARCH_ERR, MSG_NO_RELEASES_FOUND_ERR}; diff --git a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/build.rs b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/build.rs index 0ba72f6b2257..384e9a389265 100644 --- a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/build.rs +++ b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/build.rs @@ -1,7 +1,7 @@ use anyhow::Context; -use common::{cmd::Cmd, logger}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger}; +use zkstack_cli_config::EcosystemConfig; use crate::messages::{ MSG_BUILDING_CONTRACT_VERIFIER, MSG_CHAIN_NOT_FOUND_ERR, diff --git a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/init.rs b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/init.rs index b173ad9bbb7f..56f02745050c 100644 --- a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/init.rs @@ -1,8 +1,8 @@ use std::path::{Path, PathBuf}; -use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use super::args::{init::InitContractVerifierArgs, releases::Version}; use crate::messages::{msg_binary_already_exists, msg_downloading_binary_spinner}; diff --git a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/run.rs b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/run.rs index ebc33840bdea..fd872aa67248 100644 --- a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/run.rs +++ b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/run.rs @@ -1,7 +1,7 @@ use anyhow::Context; -use common::{cmd::Cmd, logger}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger}; +use zkstack_cli_config::EcosystemConfig; use crate::messages::{ MSG_CHAIN_NOT_FOUND_ERR, MSG_FAILED_TO_RUN_CONTRACT_VERIFIER_ERR, MSG_RUNNING_CONTRACT_VERIFIER, diff --git a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/wait.rs b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/wait.rs index 011c888d3041..0b844df61f4c 100644 --- a/zkstack_cli/crates/zkstack/src/commands/contract_verifier/wait.rs +++ b/zkstack_cli/crates/zkstack/src/commands/contract_verifier/wait.rs @@ -1,7 +1,7 @@ use anyhow::Context as _; -use common::{config::global_config, logger}; -use config::EcosystemConfig; use xshell::Shell; +use zkstack_cli_common::{config::global_config, logger}; +use zkstack_cli_config::EcosystemConfig; use crate::{commands::args::WaitArgs, messages::MSG_CHAIN_NOT_FOUND_ERR}; diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/clean/mod.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/clean/mod.rs index 06dff541f94e..b45272cc97a8 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/clean/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/clean/mod.rs @@ -1,8 +1,8 @@ use anyhow::Context; use clap::Subcommand; -use common::{docker, logger}; -use config::{EcosystemConfig, DOCKER_COMPOSE_FILE}; use xshell::Shell; +use zkstack_cli_common::{docker, logger}; +use zkstack_cli_config::{EcosystemConfig, DOCKER_COMPOSE_FILE}; use crate::commands::dev::messages::{ MSG_CONTRACTS_CLEANING, MSG_CONTRACTS_CLEANING_FINISHED, MSG_DOCKER_COMPOSE_DOWN, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/config_writer.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/config_writer.rs index 70238ed15f32..01a521334383 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/config_writer.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/config_writer.rs @@ -1,8 +1,8 @@ use anyhow::Context; use clap::Parser; -use common::{logger, Prompt}; -use config::{override_config, EcosystemConfig}; use xshell::Shell; +use zkstack_cli_common::{logger, Prompt}; +use zkstack_cli_config::{override_config, EcosystemConfig}; use crate::commands::dev::messages::{ msg_overriding_config, MSG_CHAIN_NOT_FOUND_ERR, MSG_OVERRIDE_CONFIG_PATH_HELP, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/contracts.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/contracts.rs index 8e0384cbca99..9a9aeeb30305 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/contracts.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/contracts.rs @@ -1,13 +1,13 @@ use std::path::PathBuf; use clap::Parser; -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ contracts::{build_l1_contracts, build_l2_contracts, build_system_contracts}, logger, spinner::Spinner, }; -use config::EcosystemConfig; -use xshell::Shell; +use zkstack_cli_config::EcosystemConfig; use crate::commands::dev::messages::{ MSG_BUILDING_CONTRACTS, MSG_BUILDING_CONTRACTS_SUCCESS, MSG_BUILDING_L1_CONTRACTS_SPINNER, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/args/new_migration.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/args/new_migration.rs index b91b048be784..74e40ab53303 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/args/new_migration.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/args/new_migration.rs @@ -1,6 +1,6 @@ use clap::{Parser, ValueEnum}; -use common::{Prompt, PromptSelect}; use strum::{Display, EnumIter, IntoEnumIterator}; +use zkstack_cli_common::{Prompt, PromptSelect}; use crate::commands::dev::messages::{ MSG_DATABASE_NEW_MIGRATION_DATABASE_HELP, MSG_DATABASE_NEW_MIGRATION_DB_PROMPT, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/check_sqlx_data.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/check_sqlx_data.rs index 990fca78641f..abead3fe00d6 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/check_sqlx_data.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/check_sqlx_data.rs @@ -1,8 +1,8 @@ use std::path::Path; -use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use super::args::DatabaseCommonArgs; use crate::commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/drop.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/drop.rs index a5578d41f77a..e46a434cec06 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/drop.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/drop.rs @@ -1,9 +1,9 @@ -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ db::{drop_db_if_exists, DatabaseConfig}, logger, spinner::Spinner, }; -use xshell::Shell; use super::args::DatabaseCommonArgs; use crate::commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/migrate.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/migrate.rs index fd22f769742e..e67d4a5bf29d 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/migrate.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/migrate.rs @@ -1,8 +1,8 @@ use std::path::Path; -use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use super::args::DatabaseCommonArgs; use crate::commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/new_migration.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/new_migration.rs index 2d9fa1030538..655a841e060a 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/new_migration.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/new_migration.rs @@ -1,8 +1,8 @@ use std::path::Path; -use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use super::args::new_migration::{DatabaseNewMigrationArgs, SelectedDatabase}; use crate::commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/prepare.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/prepare.rs index 288a68452fd5..82c9ed2e338b 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/prepare.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/prepare.rs @@ -1,8 +1,8 @@ use std::path::Path; -use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use super::args::DatabaseCommonArgs; use crate::commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/reset.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/reset.rs index 55d5ab1cbfcb..4a9ec022d723 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/reset.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/reset.rs @@ -1,8 +1,8 @@ use std::path::Path; -use common::logger; -use config::EcosystemConfig; use xshell::Shell; +use zkstack_cli_common::logger; +use zkstack_cli_config::EcosystemConfig; use super::{args::DatabaseCommonArgs, drop::drop_database, setup::setup_database}; use crate::commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/setup.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/setup.rs index 74ade66ba481..4eba9b615fc0 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/setup.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/database/setup.rs @@ -1,8 +1,8 @@ use std::path::Path; -use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use super::args::DatabaseCommonArgs; use crate::commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/fmt.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/fmt.rs index 569d2a61294e..af6985b006d2 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/fmt.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/fmt.rs @@ -1,9 +1,9 @@ use std::path::PathBuf; use clap::Parser; -use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use super::sql_fmt::format_sql; use crate::commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/genesis.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/genesis.rs index 683ffe199161..8e7a3973e037 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/genesis.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/genesis.rs @@ -1,7 +1,7 @@ use anyhow::Context; -use common::{cmd::Cmd, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use crate::{ commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint.rs index fa17ef518901..6b919b8cdb9d 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint.rs @@ -6,9 +6,9 @@ use std::{ use anyhow::{bail, Context}; use clap::Parser; -use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use crate::commands::{ autocomplete::{autocomplete_file_name, generate_completions}, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/args/insert_batch.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/args/insert_batch.rs index e837bbe9eb86..355a750b9e09 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/args/insert_batch.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/args/insert_batch.rs @@ -19,7 +19,7 @@ pub struct InsertBatchArgsFinal { impl InsertBatchArgs { pub(crate) fn fill_values_with_prompts(self, era_version: String) -> InsertBatchArgsFinal { let number = self.number.unwrap_or_else(|| { - common::Prompt::new("Enter the number of the batch to insert").ask() + zkstack_cli_common::Prompt::new("Enter the number of the batch to insert").ask() }); if self.default { @@ -30,7 +30,7 @@ impl InsertBatchArgs { } let version = self.version.unwrap_or_else(|| { - common::Prompt::new("Enter the version of the batch to insert") + zkstack_cli_common::Prompt::new("Enter the version of the batch to insert") .default(&era_version) .ask() }); diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/args/insert_version.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/args/insert_version.rs index 7af98c4a7a43..72a6cd14bcba 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/args/insert_version.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/args/insert_version.rs @@ -35,21 +35,23 @@ impl InsertVersionArgs { } let version = self.version.unwrap_or_else(|| { - common::Prompt::new("Enter the version of the protocol to insert") + zkstack_cli_common::Prompt::new("Enter the version of the protocol to insert") .default(&era_version) .ask() }); let snark_wrapper = self.snark_wrapper.unwrap_or_else(|| { - common::Prompt::new("Enter the snark wrapper of the protocol to insert") + zkstack_cli_common::Prompt::new("Enter the snark wrapper of the protocol to insert") .default(&snark_wrapper) .ask() }); let fflonk_snark_wrapper = self.fflonk_snark_wrapper.unwrap_or_else(|| { - common::Prompt::new("Enter the fflonk snark wrapper of the protocol to insert") - .default(&fflonk_snark_wrapper) - .ask() + zkstack_cli_common::Prompt::new( + "Enter the fflonk snark wrapper of the protocol to insert", + ) + .default(&fflonk_snark_wrapper) + .ask() }); InsertVersionArgsFinal { diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/info.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/info.rs index baf0e6f881cd..44d80d48d0ce 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/info.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/info.rs @@ -4,9 +4,9 @@ use std::{ }; use anyhow::Context as _; -use common::logger; -use config::{ChainConfig, EcosystemConfig}; use xshell::{cmd, Shell}; +use zkstack_cli_common::logger; +use zkstack_cli_config::{ChainConfig, EcosystemConfig}; use crate::commands::dev::messages::MSG_CHAIN_NOT_FOUND_ERR; diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/insert_batch.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/insert_batch.rs index 0e0c0ba33af4..60c4dd3b88c1 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/insert_batch.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/insert_batch.rs @@ -1,6 +1,6 @@ -use common::{check_prerequisites, cmd::Cmd, logger, PROVER_CLI_PREREQUISITE}; -use config::{get_link_to_prover, EcosystemConfig}; use xshell::{cmd, Shell}; +use zkstack_cli_common::{check_prerequisites, cmd::Cmd, logger, PROVER_CLI_PREREQUISITE}; +use zkstack_cli_config::{get_link_to_prover, EcosystemConfig}; use crate::commands::dev::{ commands::prover::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/insert_version.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/insert_version.rs index 86cd73c926b2..18c182ca9057 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/insert_version.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/prover/insert_version.rs @@ -1,6 +1,6 @@ -use common::{check_prerequisites, cmd::Cmd, logger, PROVER_CLI_PREREQUISITE}; -use config::{get_link_to_prover, EcosystemConfig}; use xshell::{cmd, Shell}; +use zkstack_cli_common::{check_prerequisites, cmd::Cmd, logger, PROVER_CLI_PREREQUISITE}; +use zkstack_cli_config::{get_link_to_prover, EcosystemConfig}; use crate::commands::dev::{ commands::prover::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/send_transactions/args/mod.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/send_transactions/args/mod.rs index 03d9ec9b7360..a7bb415fd4da 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/send_transactions/args/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/send_transactions/args/mod.rs @@ -1,8 +1,8 @@ use std::path::PathBuf; use clap::Parser; -use common::Prompt; use url::Url; +use zkstack_cli_common::Prompt; use crate::commands::dev::{ defaults::LOCAL_RPC_URL, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/send_transactions/mod.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/send_transactions/mod.rs index 2f54579ade9e..0607747c8a1c 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/send_transactions/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/send_transactions/mod.rs @@ -9,12 +9,12 @@ use std::{ use anyhow::Context; use args::SendTransactionsArgs; use chrono::Local; -use common::{ethereum::create_ethers_client, logger}; -use config::EcosystemConfig; use ethers::{abi::Bytes, providers::Middleware, types::TransactionRequest, utils::hex}; use serde::Deserialize; use tokio::time::sleep; use xshell::Shell; +use zkstack_cli_common::{ethereum::create_ethers_client, logger}; +use zkstack_cli_config::EcosystemConfig; use zksync_basic_types::{H160, U256}; use crate::commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/snapshot.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/snapshot.rs index 8e4c7183cb55..dcc41af228be 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/snapshot.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/snapshot.rs @@ -1,8 +1,8 @@ use anyhow::Context; use clap::Subcommand; -use common::{cmd::Cmd, logger}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger}; +use zkstack_cli_config::EcosystemConfig; use crate::commands::dev::messages::{MSG_CHAIN_NOT_FOUND_ERR, MSG_RUNNING_SNAPSHOT_CREATOR}; diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/sql_fmt.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/sql_fmt.rs index 0f7ce061ce18..388d733a5f3d 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/sql_fmt.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/sql_fmt.rs @@ -1,9 +1,9 @@ use std::mem::take; use anyhow::{bail, Result}; -use common::spinner::Spinner; use sqruff_lib::{api::simple::get_simple_config, core::linter::core::Linter}; use xshell::Shell; +use zkstack_cli_common::spinner::Spinner; use super::lint_utils::{get_unignored_files, IgnoredData, Target}; use crate::commands::dev::messages::{msg_file_is_not_formatted, MSG_RUNNING_SQL_FMT_SPINNER}; diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/status/args.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/status/args.rs index 5ac52bf854a6..1cc65f194cdc 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/status/args.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/status/args.rs @@ -1,7 +1,7 @@ use anyhow::Context; use clap::Parser; -use config::EcosystemConfig; use xshell::Shell; +use zkstack_cli_config::EcosystemConfig; use crate::{ commands::dev::messages::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/status/mod.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/status/mod.rs index 8687fcb04763..7f2db7533655 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/status/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/status/mod.rs @@ -2,12 +2,12 @@ use std::collections::HashMap; use anyhow::Context; use args::{StatusArgs, StatusSubcommands}; -use common::logger; use draw::{bordered_boxes, format_port_info}; use serde::Deserialize; use serde_json::Value; use utils::deslugify; use xshell::Shell; +use zkstack_cli_common::logger; use crate::{ commands::dev::messages::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/build.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/build.rs index dea6a46bbef6..7465d7ca851a 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/build.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/build.rs @@ -1,5 +1,5 @@ -use config::EcosystemConfig; use xshell::Shell; +use zkstack_cli_config::EcosystemConfig; use super::utils::{build_contracts, install_and_build_dependencies}; diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/db.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/db.rs index 19f6307019b8..89adb3febe8a 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/db.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/db.rs @@ -1,7 +1,7 @@ use std::path::Path; -use common::{cmd::Cmd, db::wait_for_db, logger}; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, db::wait_for_db, logger}; use crate::commands::dev::{commands::database, dals::Dal, messages::MSG_RESETTING_TEST_DATABASES}; diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/fees.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/fees.rs index e58a70e6b7cb..c4d08c6ef9d7 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/fees.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/fees.rs @@ -1,9 +1,9 @@ use std::path::PathBuf; use anyhow::Context; -use common::{cmd::Cmd, config::global_config, logger}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, config::global_config, logger}; +use zkstack_cli_config::EcosystemConfig; use super::{ args::fees::FeesArgs, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/integration.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/integration.rs index 8e9e421c2f4e..7a140644dcec 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/integration.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/integration.rs @@ -1,9 +1,9 @@ use std::path::PathBuf; use anyhow::Context; -use common::{cmd::Cmd, config::global_config, logger}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, config::global_config, logger}; +use zkstack_cli_config::EcosystemConfig; use super::{ args::integration::IntegrationArgs, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/l1_contracts.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/l1_contracts.rs index 7d163daed671..439926a74b80 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/l1_contracts.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/l1_contracts.rs @@ -1,6 +1,6 @@ -use common::{cmd::Cmd, logger}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger}; +use zkstack_cli_config::EcosystemConfig; use crate::commands::dev::messages::MSG_L1_CONTRACTS_TEST_SUCCESS; diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/loadtest.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/loadtest.rs index 72a8f97ff97d..385335890c75 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/loadtest.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/loadtest.rs @@ -1,7 +1,7 @@ use anyhow::Context; -use common::{cmd::Cmd, config::global_config, logger}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, config::global_config, logger}; +use zkstack_cli_config::EcosystemConfig; use crate::commands::dev::messages::MSG_CHAIN_NOT_FOUND_ERR; diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/prover.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/prover.rs index 200baf57215c..b74494c9d915 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/prover.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/prover.rs @@ -1,9 +1,9 @@ use std::str::FromStr; -use common::{cmd::Cmd, logger}; -use config::EcosystemConfig; use url::Url; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger}; +use zkstack_cli_config::EcosystemConfig; use crate::commands::dev::{ commands::test::db::reset_test_databases, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/recovery.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/recovery.rs index ae889969fd2c..e62d6cf9cdc5 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/recovery.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/recovery.rs @@ -1,9 +1,9 @@ use std::path::PathBuf; use anyhow::Context; -use common::{cmd::Cmd, logger, server::Server, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, server::Server, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use super::{ args::recovery::RecoveryArgs, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/revert.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/revert.rs index dc95c88db205..ae8b5df33222 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/revert.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/revert.rs @@ -1,9 +1,9 @@ use std::path::PathBuf; use anyhow::Context; -use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use super::{ args::revert::RevertArgs, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/rust.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/rust.rs index 8c0c707f6a2e..c415eb7407d2 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/rust.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/rust.rs @@ -1,10 +1,10 @@ use std::str::FromStr; use anyhow::Context; -use common::{cmd::Cmd, logger}; -use config::EcosystemConfig; use url::Url; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger}; +use zkstack_cli_config::EcosystemConfig; use super::args::rust::RustArgs; use crate::commands::dev::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/upgrade.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/upgrade.rs index 707e0086ed15..c20bbe163d7f 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/upgrade.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/upgrade.rs @@ -1,6 +1,6 @@ -use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger, spinner::Spinner}; +use zkstack_cli_config::EcosystemConfig; use super::{args::upgrade::UpgradeArgs, utils::install_and_build_dependencies}; use crate::commands::dev::messages::{MSG_UPGRADE_TEST_RUN_INFO, MSG_UPGRADE_TEST_RUN_SUCCESS}; diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/utils.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/utils.rs index 8435b437169d..7c042fad1fa9 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/utils.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/utils.rs @@ -1,14 +1,14 @@ use std::collections::HashMap; use anyhow::Context; -use common::{cmd::Cmd, spinner::Spinner, wallets::Wallet}; -use config::{ChainConfig, EcosystemConfig}; use ethers::{ providers::{Http, Middleware, Provider}, utils::hex::ToHex, }; use serde::Deserialize; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, spinner::Spinner, wallets::Wallet}; +use zkstack_cli_config::{ChainConfig, EcosystemConfig}; use crate::commands::dev::messages::{ MSG_INTEGRATION_TESTS_BUILDING_CONTRACTS, MSG_INTEGRATION_TESTS_BUILDING_DEPENDENCIES, @@ -67,7 +67,7 @@ impl TestWallets { let balance = provider.get_balance(wallet.address, None).await?; if balance.is_zero() { - common::ethereum::distribute_eth( + zkstack_cli_common::ethereum::distribute_eth( self.get_main_wallet()?, vec![wallet.address], l1_rpc, diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/wallet.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/wallet.rs index 6953014bf92b..ebacc5ead532 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/wallet.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/test/wallet.rs @@ -1,9 +1,9 @@ use std::path::PathBuf; use anyhow::Context; -use common::logger; -use config::EcosystemConfig; use xshell::Shell; +use zkstack_cli_common::logger; +use zkstack_cli_config::EcosystemConfig; use super::utils::{TestWallets, TEST_WALLETS_PATH}; use crate::commands::dev::messages::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/dals.rs b/zkstack_cli/crates/zkstack/src/commands/dev/dals.rs index 9626edfed732..199c44bbeb70 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/dals.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/dals.rs @@ -1,7 +1,7 @@ use anyhow::Context as _; -use config::{EcosystemConfig, SecretsConfig}; use url::Url; use xshell::Shell; +use zkstack_cli_config::{EcosystemConfig, SecretsConfig}; use super::{ commands::database::args::DalUrls, diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/build_transactions.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/build_transactions.rs index 697fa518b6e4..3abf0a0e3124 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/build_transactions.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/build_transactions.rs @@ -1,9 +1,9 @@ use std::{path::PathBuf, str::FromStr}; use clap::Parser; -use common::{forge::ForgeScriptArgs, Prompt}; use serde::{Deserialize, Serialize}; use url::Url; +use zkstack_cli_common::{forge::ForgeScriptArgs, Prompt}; use zksync_basic_types::H160; use crate::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/create.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/create.rs index 9665516945e0..c49739d022c9 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/create.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/create.rs @@ -1,12 +1,12 @@ use std::path::PathBuf; use clap::{Parser, ValueHint}; -use common::{Prompt, PromptConfirm, PromptSelect}; use serde::{Deserialize, Serialize}; use slugify_rs::slugify; use strum::IntoEnumIterator; -use types::{L1Network, WalletCreation}; use xshell::Shell; +use zkstack_cli_common::{Prompt, PromptConfirm, PromptSelect}; +use zkstack_cli_types::{L1Network, WalletCreation}; use crate::{ commands::chain::{args::create::ChainCreateArgs, ChainCreateArgsFinal}, diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/gateway_upgrade.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/gateway_upgrade.rs index 21fb714bc491..0301853e1acf 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/gateway_upgrade.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/gateway_upgrade.rs @@ -2,11 +2,11 @@ use std::path::PathBuf; use clap::{Parser, ValueEnum}; -use common::{forge::ForgeScriptArgs, Prompt}; use serde::{Deserialize, Serialize}; use strum::EnumIter; -use types::L1Network; use url::Url; +use zkstack_cli_common::{forge::ForgeScriptArgs, Prompt}; +use zkstack_cli_types::L1Network; use crate::{ defaults::LOCAL_RPC_URL, diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/init.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/init.rs index 9b7ab5abf089..d6c3d675c053 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/init.rs @@ -1,10 +1,10 @@ use std::path::PathBuf; use clap::Parser; -use common::{forge::ForgeScriptArgs, Prompt, PromptConfirm}; use serde::{Deserialize, Serialize}; -use types::L1Network; use url::Url; +use zkstack_cli_common::{forge::ForgeScriptArgs, Prompt, PromptConfirm}; +use zkstack_cli_types::L1Network; use crate::{ commands::chain::args::genesis::GenesisArgs, diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/build_transactions.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/build_transactions.rs index ff7132360972..3d81e6f3b0b7 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/build_transactions.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/build_transactions.rs @@ -1,7 +1,7 @@ use anyhow::Context; -use common::{git, logger, spinner::Spinner}; -use config::{traits::SaveConfigWithBasePath, EcosystemConfig}; use xshell::Shell; +use zkstack_cli_common::{git, logger, spinner::Spinner}; +use zkstack_cli_config::{traits::SaveConfigWithBasePath, EcosystemConfig}; use super::{ args::build_transactions::BuildTransactionsArgs, diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/change_default.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/change_default.rs index 3bd392c0558d..e5448187afd3 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/change_default.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/change_default.rs @@ -1,6 +1,6 @@ -use common::PromptSelect; -use config::{traits::SaveConfigWithBasePath, EcosystemConfig}; use xshell::Shell; +use zkstack_cli_common::PromptSelect; +use zkstack_cli_config::{traits::SaveConfigWithBasePath, EcosystemConfig}; use crate::{ commands::ecosystem::args::change_default::ChangeDefaultChain, diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs index e5ba18fe4c3e..c31aa6252971 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/common.rs @@ -1,6 +1,7 @@ use anyhow::Context; -use common::forge::{Forge, ForgeScriptArgs}; -use config::{ +use xshell::Shell; +use zkstack_cli_common::forge::{Forge, ForgeScriptArgs}; +use zkstack_cli_config::{ forge_interface::{ deploy_ecosystem::{ input::{DeployL1Config, InitialDeploymentConfig}, @@ -11,8 +12,7 @@ use config::{ traits::{ReadConfig, ReadConfigWithBasePath, SaveConfig}, ContractsConfig, EcosystemConfig, GenesisConfig, }; -use types::{L1Network, ProverMode}; -use xshell::Shell; +use zkstack_cli_types::{L1Network, ProverMode}; use crate::utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner}; diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/create.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/create.rs index d7c6005cd1aa..404589afac2d 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/create.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/create.rs @@ -1,10 +1,10 @@ use anyhow::{bail, Context}; -use common::{logger, spinner::Spinner}; -use config::{ +use xshell::Shell; +use zkstack_cli_common::{logger, spinner::Spinner}; +use zkstack_cli_config::{ create_local_configs_dir, create_wallets, get_default_era_chain_id, traits::SaveConfigWithBasePath, EcosystemConfig, EcosystemConfigFromFileError, }; -use xshell::Shell; use crate::{ commands::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/create_configs.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/create_configs.rs index 38358355ff97..a58e0d38bf11 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/create_configs.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/create_configs.rs @@ -1,11 +1,11 @@ use std::path::Path; -use config::{ +use xshell::Shell; +use zkstack_cli_config::{ forge_interface::deploy_ecosystem::input::{Erc20DeploymentConfig, InitialDeploymentConfig}, traits::{SaveConfigWithBasePath, SaveConfigWithCommentAndBasePath}, AppsEcosystemConfig, }; -use xshell::Shell; use crate::messages::{MSG_SAVE_ERC20_CONFIG_ATTENTION, MSG_SAVE_INITIAL_CONFIG_ATTENTION}; diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs index 309dda7abe5b..56c196fe7be9 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/init.rs @@ -1,7 +1,8 @@ use std::{path::PathBuf, str::FromStr}; use anyhow::Context; -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ config::global_config, contracts::build_system_contracts, forge::{Forge, ForgeScriptArgs}, @@ -9,7 +10,7 @@ use common::{ spinner::Spinner, Prompt, }; -use config::{ +use zkstack_cli_config::{ forge_interface::{ deploy_ecosystem::{ input::{DeployErc20Config, Erc20DeploymentConfig, InitialDeploymentConfig}, @@ -20,8 +21,7 @@ use config::{ traits::{FileConfigWithDefaultName, ReadConfig, SaveConfig, SaveConfigWithBasePath}, ContractsConfig, EcosystemConfig, }; -use types::L1Network; -use xshell::Shell; +use zkstack_cli_types::L1Network; use super::{ args::init::{EcosystemArgsFinal, EcosystemInitArgs, EcosystemInitArgsFinal}, diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/setup_observability.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/setup_observability.rs index f20c3c24157e..23d2b6e2cca4 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/setup_observability.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/setup_observability.rs @@ -1,6 +1,6 @@ -use common::{git, logger, spinner::Spinner}; -use config::{ERA_OBSERBAVILITY_DIR, ERA_OBSERBAVILITY_GIT_REPO}; use xshell::Shell; +use zkstack_cli_common::{git, logger, spinner::Spinner}; +use zkstack_cli_config::{ERA_OBSERBAVILITY_DIR, ERA_OBSERBAVILITY_GIT_REPO}; use crate::messages::{ MSG_DOWNLOADING_ERA_OBSERVABILITY_SPINNER, MSG_ERA_OBSERVABILITY_ALREADY_SETUP, diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/utils.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/utils.rs index a51adc75fb42..5f6994ed38f9 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/utils.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/utils.rs @@ -1,7 +1,7 @@ use std::path::Path; -use common::cmd::Cmd; use xshell::{cmd, Shell}; +use zkstack_cli_common::cmd::Cmd; pub(super) fn install_yarn_dependencies(shell: &Shell, link_to_code: &Path) -> anyhow::Result<()> { let _dir_guard = shell.push_dir(link_to_code); diff --git a/zkstack_cli/crates/zkstack/src/commands/explorer/backend.rs b/zkstack_cli/crates/zkstack/src/commands/explorer/backend.rs index 29cc2ecfbff0..b40205cdbe5e 100644 --- a/zkstack_cli/crates/zkstack/src/commands/explorer/backend.rs +++ b/zkstack_cli/crates/zkstack/src/commands/explorer/backend.rs @@ -1,9 +1,9 @@ use std::path::Path; use anyhow::Context; -use common::docker; -use config::{explorer_compose::ExplorerBackendComposeConfig, EcosystemConfig}; use xshell::Shell; +use zkstack_cli_common::docker; +use zkstack_cli_config::{explorer_compose::ExplorerBackendComposeConfig, EcosystemConfig}; use crate::messages::{ msg_explorer_chain_not_initialized, MSG_CHAIN_NOT_FOUND_ERR, diff --git a/zkstack_cli/crates/zkstack/src/commands/explorer/init.rs b/zkstack_cli/crates/zkstack/src/commands/explorer/init.rs index 096c45da5d8f..8bac0b84d982 100644 --- a/zkstack_cli/crates/zkstack/src/commands/explorer/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/explorer/init.rs @@ -1,14 +1,14 @@ use anyhow::Context; -use common::{config::global_config, db, logger, Prompt}; -use config::{ +use slugify_rs::slugify; +use url::Url; +use xshell::Shell; +use zkstack_cli_common::{config::global_config, db, logger, Prompt}; +use zkstack_cli_config::{ explorer::{ExplorerChainConfig, ExplorerConfig}, explorer_compose::{ExplorerBackendComposeConfig, ExplorerBackendConfig, ExplorerBackendPorts}, traits::{ConfigWithL2RpcUrl, SaveConfig}, ChainConfig, EcosystemConfig, }; -use slugify_rs::slugify; -use url::Url; -use xshell::Shell; use crate::{ consts::L2_BASE_TOKEN_ADDRESS, diff --git a/zkstack_cli/crates/zkstack/src/commands/explorer/run.rs b/zkstack_cli/crates/zkstack/src/commands/explorer/run.rs index a6519f62edba..4fbc8e1799fb 100644 --- a/zkstack_cli/crates/zkstack/src/commands/explorer/run.rs +++ b/zkstack_cli/crates/zkstack/src/commands/explorer/run.rs @@ -1,9 +1,9 @@ use std::path::Path; use anyhow::Context; -use common::{config::global_config, docker, logger}; -use config::{explorer::*, traits::SaveConfig, AppsEcosystemConfig, EcosystemConfig}; use xshell::Shell; +use zkstack_cli_common::{config::global_config, docker, logger}; +use zkstack_cli_config::{explorer::*, traits::SaveConfig, AppsEcosystemConfig, EcosystemConfig}; use crate::{ consts::{EXPLORER_APP_DOCKER_CONFIG_PATH, EXPLORER_APP_DOCKER_IMAGE}, diff --git a/zkstack_cli/crates/zkstack/src/commands/external_node/args/prepare_configs.rs b/zkstack_cli/crates/zkstack/src/commands/external_node/args/prepare_configs.rs index b1759702c461..2f688ae2eea5 100644 --- a/zkstack_cli/crates/zkstack/src/commands/external_node/args/prepare_configs.rs +++ b/zkstack_cli/crates/zkstack/src/commands/external_node/args/prepare_configs.rs @@ -1,9 +1,9 @@ use clap::Parser; -use common::{db::DatabaseConfig, Prompt}; -use config::ChainConfig; use serde::{Deserialize, Serialize}; use slugify_rs::slugify; use url::Url; +use zkstack_cli_common::{db::DatabaseConfig, Prompt}; +use zkstack_cli_config::ChainConfig; use crate::{ defaults::{generate_external_node_db_name, DATABASE_SERVER_URL, LOCAL_RPC_URL}, diff --git a/zkstack_cli/crates/zkstack/src/commands/external_node/build.rs b/zkstack_cli/crates/zkstack/src/commands/external_node/build.rs index ff15c0c77f30..8a4c4befe8db 100644 --- a/zkstack_cli/crates/zkstack/src/commands/external_node/build.rs +++ b/zkstack_cli/crates/zkstack/src/commands/external_node/build.rs @@ -1,7 +1,7 @@ use anyhow::Context; -use common::{cmd::Cmd, logger}; -use config::EcosystemConfig; use xshell::{cmd, Shell}; +use zkstack_cli_common::{cmd::Cmd, logger}; +use zkstack_cli_config::EcosystemConfig; use crate::messages::{MSG_BUILDING_EN, MSG_CHAIN_NOT_FOUND_ERR, MSG_FAILED_TO_BUILD_EN_ERR}; diff --git a/zkstack_cli/crates/zkstack/src/commands/external_node/init.rs b/zkstack_cli/crates/zkstack/src/commands/external_node/init.rs index 184151764961..526e9fd4bc5f 100644 --- a/zkstack_cli/crates/zkstack/src/commands/external_node/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/external_node/init.rs @@ -1,10 +1,12 @@ use anyhow::Context; -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ db::{drop_db_if_exists, init_db, migrate_db, DatabaseConfig}, spinner::Spinner, }; -use config::{traits::ReadConfigWithBasePath, ChainConfig, EcosystemConfig, SecretsConfig}; -use xshell::Shell; +use zkstack_cli_config::{ + traits::ReadConfigWithBasePath, ChainConfig, EcosystemConfig, SecretsConfig, +}; use crate::{ consts::SERVER_MIGRATIONS, diff --git a/zkstack_cli/crates/zkstack/src/commands/external_node/prepare_configs.rs b/zkstack_cli/crates/zkstack/src/commands/external_node/prepare_configs.rs index 8e937e3903d4..ed591597584c 100644 --- a/zkstack_cli/crates/zkstack/src/commands/external_node/prepare_configs.rs +++ b/zkstack_cli/crates/zkstack/src/commands/external_node/prepare_configs.rs @@ -1,14 +1,14 @@ use std::{collections::BTreeMap, path::Path, str::FromStr}; use anyhow::Context; -use common::logger; -use config::{ +use xshell::Shell; +use zkstack_cli_common::logger; +use zkstack_cli_config::{ external_node::ENConfig, set_rocks_db_config, traits::{FileConfigWithDefaultName, SaveConfigWithBasePath}, ChainConfig, EcosystemConfig, GeneralConfig, SecretsConfig, }; -use xshell::Shell; use zksync_basic_types::url::SensitiveUrl; use zksync_config::configs::{ consensus::{ConsensusConfig, ConsensusSecrets, NodeSecretKey, Secret}, diff --git a/zkstack_cli/crates/zkstack/src/commands/external_node/run.rs b/zkstack_cli/crates/zkstack/src/commands/external_node/run.rs index 46c98119f893..21714c335fa0 100644 --- a/zkstack_cli/crates/zkstack/src/commands/external_node/run.rs +++ b/zkstack_cli/crates/zkstack/src/commands/external_node/run.rs @@ -1,7 +1,7 @@ use anyhow::Context; -use common::logger; -use config::{ChainConfig, EcosystemConfig}; use xshell::Shell; +use zkstack_cli_common::logger; +use zkstack_cli_config::{ChainConfig, EcosystemConfig}; use crate::{ commands::external_node::{args::run::RunExternalNodeArgs, init}, diff --git a/zkstack_cli/crates/zkstack/src/commands/external_node/wait.rs b/zkstack_cli/crates/zkstack/src/commands/external_node/wait.rs index 72568c36f363..b645314dc9c2 100644 --- a/zkstack_cli/crates/zkstack/src/commands/external_node/wait.rs +++ b/zkstack_cli/crates/zkstack/src/commands/external_node/wait.rs @@ -1,7 +1,7 @@ use anyhow::Context as _; -use common::{config::global_config, logger}; -use config::{traits::ReadConfigWithBasePath, EcosystemConfig}; use xshell::Shell; +use zkstack_cli_common::{config::global_config, logger}; +use zkstack_cli_config::{traits::ReadConfigWithBasePath, EcosystemConfig}; use zksync_config::configs::GeneralConfig; use crate::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/portal.rs b/zkstack_cli/crates/zkstack/src/commands/portal.rs index f9e7fe358609..d534498aaacd 100644 --- a/zkstack_cli/crates/zkstack/src/commands/portal.rs +++ b/zkstack_cli/crates/zkstack/src/commands/portal.rs @@ -1,15 +1,15 @@ use std::path::Path; use anyhow::Context; -use common::{config::global_config, docker, ethereum, logger}; -use config::{ +use ethers::types::Address; +use xshell::Shell; +use zkstack_cli_common::{config::global_config, docker, ethereum, logger}; +use zkstack_cli_config::{ portal::*, traits::{ConfigWithL2RpcUrl, SaveConfig}, AppsEcosystemConfig, ChainConfig, EcosystemConfig, }; -use ethers::types::Address; -use types::{BaseToken, TokenInfo}; -use xshell::Shell; +use zkstack_cli_types::{BaseToken, TokenInfo}; use crate::{ consts::{L2_BASE_TOKEN_ADDRESS, PORTAL_DOCKER_CONFIG_PATH, PORTAL_DOCKER_IMAGE}, diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/args/compressor_keys.rs b/zkstack_cli/crates/zkstack/src/commands/prover/args/compressor_keys.rs index f393a89882af..8b7bfb0fc543 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/args/compressor_keys.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/args/compressor_keys.rs @@ -1,6 +1,6 @@ use clap::{Parser, ValueEnum}; -use common::Prompt; use strum::EnumIter; +use zkstack_cli_common::Prompt; use crate::messages::MSG_SETUP_COMPRESSOR_KEY_PATH_PROMPT; diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/args/init.rs b/zkstack_cli/crates/zkstack/src/commands/prover/args/init.rs index b40dc180124d..afe57a8f5eb4 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/args/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/args/init.rs @@ -1,11 +1,11 @@ use clap::{Parser, ValueEnum}; -use common::{db::DatabaseConfig, logger, Prompt, PromptConfirm, PromptSelect}; -use config::ChainConfig; use serde::{Deserialize, Serialize}; use slugify_rs::slugify; use strum::{EnumIter, IntoEnumIterator}; use url::Url; use xshell::Shell; +use zkstack_cli_common::{db::DatabaseConfig, logger, Prompt, PromptConfirm, PromptSelect}; +use zkstack_cli_config::ChainConfig; use zksync_config::configs::fri_prover::CloudConnectionMode; use super::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/args/init_bellman_cuda.rs b/zkstack_cli/crates/zkstack/src/commands/prover/args/init_bellman_cuda.rs index 98a5c78be2a6..aa653fc62ade 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/args/init_bellman_cuda.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/args/init_bellman_cuda.rs @@ -1,7 +1,7 @@ use clap::Parser; -use common::{Prompt, PromptSelect}; use serde::{Deserialize, Serialize}; use strum::{EnumIter, IntoEnumIterator}; +use zkstack_cli_common::{Prompt, PromptSelect}; use crate::messages::{ MSG_BELLMAN_CUDA_DIR_PROMPT, MSG_BELLMAN_CUDA_ORIGIN_SELECT, MSG_BELLMAN_CUDA_SELECTION_CLONE, diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/args/run.rs b/zkstack_cli/crates/zkstack/src/commands/prover/args/run.rs index a356f1874b7a..3aa3d090e4dc 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/args/run.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/args/run.rs @@ -2,10 +2,10 @@ use std::path::Path; use anyhow::anyhow; use clap::{Parser, ValueEnum}; -use common::{Prompt, PromptSelect}; -use config::ChainConfig; use serde::{Deserialize, Serialize}; use strum::{EnumIter, IntoEnumIterator}; +use zkstack_cli_common::{Prompt, PromptSelect}; +use zkstack_cli_config::ChainConfig; use crate::{ consts::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/args/setup_keys.rs b/zkstack_cli/crates/zkstack/src/commands/prover/args/setup_keys.rs index 155977b8812a..914533e47144 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/args/setup_keys.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/args/setup_keys.rs @@ -1,6 +1,6 @@ use clap::{Parser, ValueEnum}; -use common::PromptSelect; use strum::{EnumIter, IntoEnumIterator}; +use zkstack_cli_common::PromptSelect; use crate::messages::{MSG_SETUP_KEYS_DOWNLOAD_SELECTION_PROMPT, MSG_SETUP_KEYS_REGION_PROMPT}; diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/compressor_keys.rs b/zkstack_cli/crates/zkstack/src/commands/prover/compressor_keys.rs index 31b970de3a1d..19ba634a4075 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/compressor_keys.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/compressor_keys.rs @@ -1,7 +1,7 @@ use anyhow::Context; -use common::{logger, spinner::Spinner}; -use config::{get_link_to_prover, EcosystemConfig, GeneralConfig}; use xshell::Shell; +use zkstack_cli_common::{logger, spinner::Spinner}; +use zkstack_cli_config::{get_link_to_prover, EcosystemConfig, GeneralConfig}; use super::args::compressor_keys::{CompressorKeysArgs, CompressorType}; use crate::messages::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/gcs.rs b/zkstack_cli/crates/zkstack/src/commands/prover/gcs.rs index f28c44504b56..5d82647f98d1 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/gcs.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/gcs.rs @@ -1,5 +1,7 @@ -use common::{check_prerequisites, cmd::Cmd, logger, spinner::Spinner, GCLOUD_PREREQUISITE}; use xshell::{cmd, Shell}; +use zkstack_cli_common::{ + check_prerequisites, cmd::Cmd, logger, spinner::Spinner, GCLOUD_PREREQUISITE, +}; use zksync_config::{configs::object_store::ObjectStoreMode, ObjectStoreConfig}; use super::args::init::ProofStorageGCSCreateBucket; diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/init.rs b/zkstack_cli/crates/zkstack/src/commands/prover/init.rs index d0d9238321a4..b318f4924ec3 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/init.rs @@ -1,18 +1,18 @@ use std::path::PathBuf; use anyhow::Context; -use common::{ +use xshell::{cmd, Shell}; +use zkstack_cli_common::{ cmd::Cmd, config::global_config, db::{drop_db_if_exists, init_db, migrate_db, DatabaseConfig}, logger, spinner::Spinner, }; -use config::{ +use zkstack_cli_config::{ copy_configs, get_link_to_prover, set_prover_database, traits::SaveConfigWithBasePath, EcosystemConfig, }; -use xshell::{cmd, Shell}; use zksync_config::{configs::object_store::ObjectStoreMode, ObjectStoreConfig}; use super::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/init_bellman_cuda.rs b/zkstack_cli/crates/zkstack/src/commands/prover/init_bellman_cuda.rs index 615ef841488b..16e33f8d7d3f 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/init_bellman_cuda.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/init_bellman_cuda.rs @@ -1,7 +1,9 @@ use anyhow::Context; -use common::{check_prerequisites, cmd::Cmd, git, logger, spinner::Spinner, GPU_PREREQUISITES}; -use config::{traits::SaveConfigWithBasePath, EcosystemConfig}; use xshell::{cmd, Shell}; +use zkstack_cli_common::{ + check_prerequisites, cmd::Cmd, git, logger, spinner::Spinner, GPU_PREREQUISITES, +}; +use zkstack_cli_config::{traits::SaveConfigWithBasePath, EcosystemConfig}; use super::args::init_bellman_cuda::InitBellmanCudaArgs; use crate::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/run.rs b/zkstack_cli/crates/zkstack/src/commands/prover/run.rs index c9bf837f787d..495c41ef8255 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/run.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/run.rs @@ -1,9 +1,9 @@ use std::path::{Path, PathBuf}; use anyhow::{anyhow, Context}; -use common::{check_prerequisites, cmd::Cmd, logger, GPU_PREREQUISITES}; -use config::{get_link_to_prover, ChainConfig, EcosystemConfig}; use xshell::{cmd, Shell}; +use zkstack_cli_common::{check_prerequisites, cmd::Cmd, logger, GPU_PREREQUISITES}; +use zkstack_cli_config::{get_link_to_prover, ChainConfig, EcosystemConfig}; use super::args::run::{ProverComponent, ProverRunArgs}; use crate::messages::{ diff --git a/zkstack_cli/crates/zkstack/src/commands/prover/setup_keys.rs b/zkstack_cli/crates/zkstack/src/commands/prover/setup_keys.rs index ae0480e872dd..463dd788777e 100644 --- a/zkstack_cli/crates/zkstack/src/commands/prover/setup_keys.rs +++ b/zkstack_cli/crates/zkstack/src/commands/prover/setup_keys.rs @@ -1,9 +1,9 @@ use anyhow::Ok; -use common::{ +use xshell::{cmd, Shell}; +use zkstack_cli_common::{ check_prerequisites, cmd::Cmd, logger, spinner::Spinner, GCLOUD_PREREQUISITE, GPU_PREREQUISITES, }; -use config::{get_link_to_prover, EcosystemConfig}; -use xshell::{cmd, Shell}; +use zkstack_cli_config::{get_link_to_prover, EcosystemConfig}; use crate::{ commands::prover::args::setup_keys::{Mode, Region, SetupKeysArgs}, diff --git a/zkstack_cli/crates/zkstack/src/commands/server.rs b/zkstack_cli/crates/zkstack/src/commands/server.rs index 702897edbbc1..cf7abf7dea21 100644 --- a/zkstack_cli/crates/zkstack/src/commands/server.rs +++ b/zkstack_cli/crates/zkstack/src/commands/server.rs @@ -1,15 +1,15 @@ use anyhow::Context; -use common::{ +use xshell::{cmd, Shell}; +use zkstack_cli_common::{ cmd::Cmd, config::global_config, logger, server::{Server, ServerMode}, }; -use config::{ +use zkstack_cli_config::{ traits::FileConfigWithDefaultName, ChainConfig, ContractsConfig, EcosystemConfig, GeneralConfig, GenesisConfig, SecretsConfig, WalletsConfig, }; -use xshell::{cmd, Shell}; use crate::{ commands::args::{RunServerArgs, ServerArgs, ServerCommand, WaitArgs}, diff --git a/zkstack_cli/crates/zkstack/src/commands/update.rs b/zkstack_cli/crates/zkstack/src/commands/update.rs index 534d490e6cae..0e1d385f8fef 100644 --- a/zkstack_cli/crates/zkstack/src/commands/update.rs +++ b/zkstack_cli/crates/zkstack/src/commands/update.rs @@ -1,17 +1,17 @@ use std::path::Path; use anyhow::{Context, Ok}; -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ db::migrate_db, git, logger, spinner::Spinner, yaml::{merge_yaml, ConfigDiff}, }; -use config::{ +use zkstack_cli_config::{ ChainConfig, EcosystemConfig, CONTRACTS_FILE, EN_CONFIG_FILE, ERA_OBSERBAVILITY_DIR, GENERAL_FILE, GENESIS_FILE, SECRETS_FILE, }; -use xshell::Shell; use super::args::UpdateArgs; use crate::{ diff --git a/zkstack_cli/crates/zkstack/src/defaults.rs b/zkstack_cli/crates/zkstack/src/defaults.rs index 2b43009f5594..4fa15be8a118 100644 --- a/zkstack_cli/crates/zkstack/src/defaults.rs +++ b/zkstack_cli/crates/zkstack/src/defaults.rs @@ -1,6 +1,6 @@ -use config::ChainConfig; use lazy_static::lazy_static; use url::Url; +use zkstack_cli_config::ChainConfig; lazy_static! { pub static ref DATABASE_SERVER_URL: Url = diff --git a/zkstack_cli/crates/zkstack/src/enable_evm_emulator.rs b/zkstack_cli/crates/zkstack/src/enable_evm_emulator.rs index bda1bfb3fc81..57e78a30b418 100644 --- a/zkstack_cli/crates/zkstack/src/enable_evm_emulator.rs +++ b/zkstack_cli/crates/zkstack/src/enable_evm_emulator.rs @@ -1,11 +1,13 @@ -use common::{ +use ethers::{abi::parse_abi, contract::BaseContract, types::Address}; +use xshell::Shell; +use zkstack_cli_common::{ forge::{Forge, ForgeScript, ForgeScriptArgs}, spinner::Spinner, wallets::Wallet, }; -use config::{forge_interface::script_params::ENABLE_EVM_EMULATOR_PARAMS, EcosystemConfig}; -use ethers::{abi::parse_abi, contract::BaseContract, types::Address}; -use xshell::Shell; +use zkstack_cli_config::{ + forge_interface::script_params::ENABLE_EVM_EMULATOR_PARAMS, EcosystemConfig, +}; use crate::{ messages::MSG_ENABLING_EVM_EMULATOR, diff --git a/zkstack_cli/crates/zkstack/src/external_node.rs b/zkstack_cli/crates/zkstack/src/external_node.rs index 5ff4ce070250..21d4e0db5592 100644 --- a/zkstack_cli/crates/zkstack/src/external_node.rs +++ b/zkstack_cli/crates/zkstack/src/external_node.rs @@ -1,11 +1,11 @@ use std::path::PathBuf; use anyhow::Context; -use config::{ +use xshell::Shell; +use zkstack_cli_config::{ external_node::ENConfig, traits::FileConfigWithDefaultName, ChainConfig, GeneralConfig, SecretsConfig, }; -use xshell::Shell; use zksync_config::configs::consensus::ConsensusConfig; use crate::messages::MSG_FAILED_TO_RUN_SERVER_ERR; @@ -63,7 +63,7 @@ impl RunExternalNode { consensus_args.push(format!("--consensus-path={}", consensus_config)) } - common::external_node::run( + zkstack_cli_common::external_node::run( shell, code_path, config_general_config, diff --git a/zkstack_cli/crates/zkstack/src/main.rs b/zkstack_cli/crates/zkstack/src/main.rs index ff4589a99cc5..98970e2be682 100644 --- a/zkstack_cli/crates/zkstack/src/main.rs +++ b/zkstack_cli/crates/zkstack/src/main.rs @@ -4,15 +4,15 @@ use commands::{ contract_verifier::ContractVerifierCommands, dev::DevCommands, }; -use common::{ +use xshell::Shell; +use zkstack_cli_common::{ check_general_prerequisites, config::{global_config, init_global_config, GlobalConfig}, error::log_error, init_prompt_theme, logger, version::version_message, }; -use config::EcosystemConfig; -use xshell::Shell; +use zkstack_cli_config::EcosystemConfig; use crate::commands::{ args::ServerArgs, chain::ChainCommands, consensus, ecosystem::EcosystemCommands, diff --git a/zkstack_cli/crates/zkstack/src/utils/consensus.rs b/zkstack_cli/crates/zkstack/src/utils/consensus.rs index 946d28a33fbd..0a1287067434 100644 --- a/zkstack_cli/crates/zkstack/src/utils/consensus.rs +++ b/zkstack_cli/crates/zkstack/src/utils/consensus.rs @@ -1,6 +1,6 @@ use anyhow::Context as _; -use config::ChainConfig; use secrecy::{ExposeSecret, Secret}; +use zkstack_cli_config::ChainConfig; use zksync_config::configs::consensus::{ AttesterPublicKey, AttesterSecretKey, ConsensusSecrets, GenesisSpec, NodePublicKey, NodeSecretKey, ProtocolVersion, ValidatorPublicKey, ValidatorSecretKey, WeightedAttester, diff --git a/zkstack_cli/crates/zkstack/src/utils/forge.rs b/zkstack_cli/crates/zkstack/src/utils/forge.rs index 76f045f82b9e..ccf5c3c84cd8 100644 --- a/zkstack_cli/crates/zkstack/src/utils/forge.rs +++ b/zkstack_cli/crates/zkstack/src/utils/forge.rs @@ -1,6 +1,6 @@ use anyhow::Context as _; -use common::{forge::ForgeScript, wallets::Wallet}; use ethers::types::U256; +use zkstack_cli_common::{forge::ForgeScript, wallets::Wallet}; use crate::{ consts::MINIMUM_BALANCE_FOR_WALLET, @@ -37,7 +37,7 @@ pub async fn check_the_balance(forge: &ForgeScript) -> anyhow::Result<()> { if balance >= expected_balance { return Ok(()); } - if !common::PromptConfirm::new(msg_address_doesnt_have_enough_money_prompt( + if !zkstack_cli_common::PromptConfirm::new(msg_address_doesnt_have_enough_money_prompt( &address, balance, expected_balance, diff --git a/zkstack_cli/crates/zkstack/src/utils/link_to_code.rs b/zkstack_cli/crates/zkstack/src/utils/link_to_code.rs index fcae429966dc..522e0d5e9c84 100644 --- a/zkstack_cli/crates/zkstack/src/utils/link_to_code.rs +++ b/zkstack_cli/crates/zkstack/src/utils/link_to_code.rs @@ -4,10 +4,12 @@ use std::{ }; use anyhow::bail; -use common::{cmd::Cmd, git, logger, spinner::Spinner, Prompt, PromptConfirm, PromptSelect}; -use config::ZKSYNC_ERA_GIT_REPO; use strum::{EnumIter, IntoEnumIterator}; use xshell::{cmd, Shell}; +use zkstack_cli_common::{ + cmd::Cmd, git, logger, spinner::Spinner, Prompt, PromptConfirm, PromptSelect, +}; +use zkstack_cli_config::ZKSYNC_ERA_GIT_REPO; use crate::messages::{ msg_path_to_zksync_does_not_exist_err, MSG_CLONING_ERA_REPO_SPINNER, diff --git a/zkstack_cli/crates/zkstack/src/utils/ports.rs b/zkstack_cli/crates/zkstack/src/utils/ports.rs index 6c299b999136..f46acc9402e3 100644 --- a/zkstack_cli/crates/zkstack/src/utils/ports.rs +++ b/zkstack_cli/crates/zkstack/src/utils/ports.rs @@ -1,13 +1,13 @@ use std::{collections::HashMap, fmt, net::SocketAddr, ops::Range, path::Path}; use anyhow::{bail, Context, Result}; -use config::{ - explorer_compose::ExplorerBackendPorts, EcosystemConfig, DEFAULT_EXPLORER_API_PORT, - DEFAULT_EXPLORER_DATA_FETCHER_PORT, DEFAULT_EXPLORER_WORKER_PORT, -}; use serde_yaml::Value; use url::Url; use xshell::Shell; +use zkstack_cli_config::{ + explorer_compose::ExplorerBackendPorts, EcosystemConfig, DEFAULT_EXPLORER_API_PORT, + DEFAULT_EXPLORER_DATA_FETCHER_PORT, DEFAULT_EXPLORER_WORKER_PORT, +}; use crate::defaults::{DEFAULT_OBSERVABILITY_PORT, PORT_RANGE_END, PORT_RANGE_START}; diff --git a/zkstack_cli/crates/zkstack/src/utils/rocks_db.rs b/zkstack_cli/crates/zkstack/src/utils/rocks_db.rs index 1b7e29dd9722..e365d3650952 100644 --- a/zkstack_cli/crates/zkstack/src/utils/rocks_db.rs +++ b/zkstack_cli/crates/zkstack/src/utils/rocks_db.rs @@ -1,7 +1,7 @@ use std::path::Path; -use config::RocksDbs; use xshell::Shell; +use zkstack_cli_config::RocksDbs; use crate::defaults::{ EN_ROCKS_DB_PREFIX, MAIN_ROCKS_DB_PREFIX, ROCKS_DB_BASIC_WITNESS_INPUT_PRODUCER,