From ae2dd3bbccdffc25b040313b2c7983a936f36aac Mon Sep 17 00:00:00 2001 From: Danil Date: Tue, 13 Aug 2024 16:18:06 +0200 Subject: [PATCH] feat(zk_toolbox): Minting base token (#2571) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ This pr helps to work with custom base token: 1. It adds an ability to choose the token from one of the predeployed tokens 2. It mints this token to the governor (if applicable) ## Why ❔ Simplify the work with custom base token ## Checklist - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zk fmt` and `zk lint`. --------- Signed-off-by: Danil --- core/tests/ts-integration/src/env.ts | 28 ------- core/tests/ts-integration/src/types.ts | 4 - zk_toolbox/crates/common/src/ethereum.rs | 40 +++++++++- zk_toolbox/crates/config/src/ecosystem.rs | 14 +++- .../forge_interface/deploy_ecosystem/input.rs | 7 -- .../deploy_ecosystem/output.rs | 10 +-- zk_toolbox/crates/config/src/general.rs | 6 ++ zk_toolbox/crates/types/src/base_token.rs | 2 +- .../src/commands/chain/args/create.rs | 26 +++++-- .../zk_inception/src/commands/chain/create.rs | 2 + .../zk_inception/src/commands/chain/init.rs | 78 +++++++++++++++++-- .../src/commands/ecosystem/args/create.rs | 2 +- .../src/commands/ecosystem/init.rs | 50 ++---------- .../crates/zk_inception/src/defaults.rs | 1 + .../crates/zk_inception/src/messages.rs | 2 + .../crates/zk_inception/src/utils/rocks_db.rs | 8 +- 16 files changed, 172 insertions(+), 108 deletions(-) diff --git a/core/tests/ts-integration/src/env.ts b/core/tests/ts-integration/src/env.ts index 6b48387f90d2..8f6ff12224b4 100644 --- a/core/tests/ts-integration/src/env.ts +++ b/core/tests/ts-integration/src/env.ts @@ -97,7 +97,6 @@ async function loadTestEnvironmentFromFile(chain: string): Promise { if (!token) { token = tokens[0]; } - const weth = tokens.find((token: { symbol: string }) => token.symbol == 'WETH')!; const baseToken = tokens.find((token: { address: string }) => zksync.utils.isAddressEq(token.address, baseTokenAddress) )!; @@ -225,12 +210,6 @@ export async function loadTestEnvironmentFromEnv(): Promise { ethers.getDefaultProvider(l1NodeUrl) ).l2TokenAddress(token.address); - const l2WethAddress = await new zksync.Wallet( - mainWalletPK, - l2Provider, - ethers.getDefaultProvider(l1NodeUrl) - ).l2TokenAddress(weth.address); - const baseTokenAddressL2 = L2_BASE_TOKEN_ADDRESS; const l2ChainId = BigInt(process.env.CHAIN_ETH_ZKSYNC_NETWORK_ID!); // If the `CHAIN_STATE_KEEPER_L1_BATCH_COMMIT_DATA_GENERATOR_MODE` is not set, the default value is `Rollup`. @@ -280,13 +259,6 @@ export async function loadTestEnvironmentFromEnv(): Promise { l1Address: token.address, l2Address: l2TokenAddress }, - wethToken: { - name: weth.name, - symbol: weth.symbol, - decimals: weth.decimals, - l1Address: weth.address, - l2Address: l2WethAddress - }, baseToken: { name: baseToken?.name || token.name, symbol: baseToken?.symbol || token.symbol, diff --git a/core/tests/ts-integration/src/types.ts b/core/tests/ts-integration/src/types.ts index 058dcd4929d9..415a8519a1b4 100644 --- a/core/tests/ts-integration/src/types.ts +++ b/core/tests/ts-integration/src/types.ts @@ -85,10 +85,6 @@ export interface TestEnvironment { * Description of the "main" ERC20 token used in the tests. */ erc20Token: Token; - /** - * Description of the WETH token used in the tests. - */ - wethToken: Token; /** * Description of the "base" ERC20 token used in the tests. */ diff --git a/zk_toolbox/crates/common/src/ethereum.rs b/zk_toolbox/crates/common/src/ethereum.rs index c035d588370d..e0141e38b09f 100644 --- a/zk_toolbox/crates/common/src/ethereum.rs +++ b/zk_toolbox/crates/common/src/ethereum.rs @@ -1,6 +1,7 @@ -use std::{ops::Add, time::Duration}; +use std::{ops::Add, sync::Arc, time::Duration}; use ethers::{ + contract::abigen, core::k256::ecdsa::SigningKey, middleware::MiddlewareBuilder, prelude::{Http, LocalWallet, Provider, Signer, SignerMiddleware}, @@ -53,3 +54,40 @@ pub async fn distribute_eth( futures::future::join_all(pending_txs).await; Ok(()) } + +abigen!( + TokenContract, + r"[ + function mint(address to, uint256 amount) + ]" +); + +pub async fn mint_token( + main_wallet: Wallet, + token_address: Address, + addresses: Vec
, + l1_rpc: String, + chain_id: u64, + amount: u128, +) -> anyhow::Result<()> { + let client = Arc::new(create_ethers_client( + main_wallet.private_key.unwrap(), + l1_rpc, + Some(chain_id), + )?); + + let contract = TokenContract::new(token_address, client); + // contract + for address in addresses { + contract + .mint(address, amount.into()) + .send() + .await? + // It's safe to set such low number of confirmations and low interval for localhost + .confirmations(1) + .interval(Duration::from_millis(30)) + .await?; + } + + Ok(()) +} diff --git a/zk_toolbox/crates/config/src/ecosystem.rs b/zk_toolbox/crates/config/src/ecosystem.rs index 76d8a0c45b22..8ce4b733c26f 100644 --- a/zk_toolbox/crates/config/src/ecosystem.rs +++ b/zk_toolbox/crates/config/src/ecosystem.rs @@ -13,11 +13,14 @@ use zksync_basic_types::L2ChainId; use crate::{ consts::{ CONFIGS_PATH, CONFIG_NAME, CONTRACTS_FILE, ECOSYSTEM_PATH, ERA_CHAIN_ID, - ERC20_DEPLOYMENT_FILE, INITIAL_DEPLOYMENT_FILE, L1_CONTRACTS_FOUNDRY, LOCAL_DB_PATH, - WALLETS_FILE, + ERC20_CONFIGS_FILE, ERC20_DEPLOYMENT_FILE, INITIAL_DEPLOYMENT_FILE, L1_CONTRACTS_FOUNDRY, + LOCAL_DB_PATH, WALLETS_FILE, }, create_localhost_wallets, - forge_interface::deploy_ecosystem::input::{Erc20DeploymentConfig, InitialDeploymentConfig}, + forge_interface::deploy_ecosystem::{ + input::{Erc20DeploymentConfig, InitialDeploymentConfig}, + output::{ERC20Tokens, Erc20Token}, + }, traits::{FileConfigWithDefaultName, ReadConfig, SaveConfig, ZkToolboxConfig}, ChainConfig, ChainConfigInternal, ContractsConfig, WalletsConfig, }; @@ -169,6 +172,11 @@ impl EcosystemConfig { pub fn get_erc20_deployment_config(&self) -> anyhow::Result { Erc20DeploymentConfig::read(self.get_shell(), self.config.join(ERC20_DEPLOYMENT_FILE)) } + pub fn get_erc20_tokens(&self) -> Vec { + ERC20Tokens::read(self.get_shell(), self.config.join(ERC20_CONFIGS_FILE)) + .map(|tokens| tokens.tokens.values().cloned().collect()) + .unwrap_or_default() + } pub fn get_wallets(&self) -> anyhow::Result { let path = self.config.join(WALLETS_FILE); diff --git a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs index 0dc117ae8cda..30ec0eeb9c48 100644 --- a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs +++ b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs @@ -92,13 +92,6 @@ impl Default for Erc20DeploymentConfig { implementation: String::from("TestnetERC20Token.sol"), mint: U256::from_str("9000000000000000000000").unwrap(), }, - Erc20DeploymentTokensConfig { - name: String::from("Wrapped Ether"), - symbol: String::from("WETH"), - decimals: 18, - implementation: String::from("WETH9.sol"), - mint: U256::zero(), - }, ], } } diff --git a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/output.rs b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/output.rs index 77f212114916..bf9292e9ba30 100644 --- a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/output.rs +++ b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/output.rs @@ -79,7 +79,7 @@ pub struct L1StateTransitionOutput { } #[derive(Debug, Deserialize, Serialize, Clone)] -pub struct TokenDeployErc20Output { +pub struct Erc20Token { pub address: Address, pub name: String, pub symbol: String, @@ -89,12 +89,12 @@ pub struct TokenDeployErc20Output { } #[derive(Debug, Deserialize, Serialize, Clone)] -pub struct DeployErc20Output { - pub tokens: HashMap, +pub struct ERC20Tokens { + pub tokens: HashMap, } -impl FileConfigWithDefaultName for DeployErc20Output { +impl FileConfigWithDefaultName for ERC20Tokens { const FILE_NAME: &'static str = ERC20_CONFIGS_FILE; } -impl ZkToolboxConfig for DeployErc20Output {} +impl ZkToolboxConfig for ERC20Tokens {} diff --git a/zk_toolbox/crates/config/src/general.rs b/zk_toolbox/crates/config/src/general.rs index 091d18936616..4dfc6c17470d 100644 --- a/zk_toolbox/crates/config/src/general.rs +++ b/zk_toolbox/crates/config/src/general.rs @@ -14,6 +14,7 @@ use crate::{ pub struct RocksDbs { pub state_keeper: PathBuf, pub merkle_tree: PathBuf, + pub protective_reads: PathBuf, } pub fn set_rocks_db_config(config: &mut GeneralConfig, rocks_dbs: RocksDbs) -> anyhow::Result<()> { @@ -28,6 +29,11 @@ pub fn set_rocks_db_config(config: &mut GeneralConfig, rocks_dbs: RocksDbs) -> a .context("DB config is not presented")? .merkle_tree .path = rocks_dbs.merkle_tree.to_str().unwrap().to_string(); + config + .protective_reads_writer_config + .as_mut() + .context("Protective reads config is not presented")? + .db_path = rocks_dbs.protective_reads.to_str().unwrap().to_string(); Ok(()) } diff --git a/zk_toolbox/crates/types/src/base_token.rs b/zk_toolbox/crates/types/src/base_token.rs index f3b01185da63..12a079e9abd1 100644 --- a/zk_toolbox/crates/types/src/base_token.rs +++ b/zk_toolbox/crates/types/src/base_token.rs @@ -1,7 +1,7 @@ use ethers::types::Address; use serde::{Deserialize, Serialize}; -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] pub struct BaseToken { pub address: Address, pub nominator: u64, diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/args/create.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/args/create.rs index 3ccc737acc49..65f809287890 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/args/create.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/args/create.rs @@ -3,6 +3,7 @@ use std::{path::PathBuf, str::FromStr}; use anyhow::{bail, Context}; use clap::{Parser, ValueEnum}; 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}; @@ -71,6 +72,7 @@ impl ChainCreateArgs { self, number_of_chains: u32, l1_network: &L1Network, + possible_erc20: Vec, ) -> anyhow::Result { let mut chain_name = self .chain_name @@ -151,14 +153,24 @@ impl ChainCreateArgs { && self.base_token_price_denominator.is_none() && self.base_token_price_nominator.is_none() { - let base_token_selection = - PromptSelect::new(MSG_BASE_TOKEN_SELECTION_PROMPT, BaseTokenSelection::iter()) - .ask(); + let mut token_selection: Vec<_> = + BaseTokenSelection::iter().map(|a| a.to_string()).collect(); - match base_token_selection { - BaseTokenSelection::Eth => BaseToken::eth(), - BaseTokenSelection::Custom => { - let address = Prompt::new(MSG_BASE_TOKEN_ADDRESS_PROMPT).ask(); + let erc20_tokens = &mut (possible_erc20 + .iter() + .map(|t| format!("{:?}", t.address)) + .collect()); + token_selection.append(erc20_tokens); + let base_token_selection = + PromptSelect::new(MSG_BASE_TOKEN_SELECTION_PROMPT, token_selection).ask(); + match base_token_selection.as_str() { + "Eth" => BaseToken::eth(), + other => { + let address = if other == "Custom" { + Prompt::new(MSG_BASE_TOKEN_ADDRESS_PROMPT).ask() + } else { + H160::from_str(other)? + }; let nominator = Prompt::new(MSG_BASE_TOKEN_PRICE_NOMINATOR_PROMPT) .validate_with(number_validator) .ask(); diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/create.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/create.rs index 7e20ae449a8a..9e109094cbec 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/create.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/create.rs @@ -27,10 +27,12 @@ fn create( ecosystem_config: &mut EcosystemConfig, shell: &Shell, ) -> anyhow::Result<()> { + let tokens = ecosystem_config.get_erc20_tokens(); let args = args .fill_values_with_prompt( ecosystem_config.list_of_chains().len() as u32, &ecosystem_config.l1_network, + tokens, ) .context(MSG_ARGS_VALIDATOR_ERR)?; diff --git a/zk_toolbox/crates/zk_inception/src/commands/chain/init.rs b/zk_toolbox/crates/zk_inception/src/commands/chain/init.rs index 17a993a86ace..b3b43c75c36a 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/chain/init.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/chain/init.rs @@ -15,6 +15,7 @@ use config::{ traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath}, update_from_chain_config, ChainConfig, ContractsConfig, EcosystemConfig, }; +use types::{BaseToken, L1Network, WalletCreation}; use xshell::Shell; use crate::{ @@ -24,10 +25,11 @@ use crate::{ deploy_l2_contracts, deploy_paymaster, genesis::genesis, }, + consts::AMOUNT_FOR_DISTRIBUTION_TO_WALLETS, messages::{ msg_initializing_chain, MSG_ACCEPTING_ADMIN_SPINNER, MSG_CHAIN_INITIALIZED, - MSG_CHAIN_NOT_FOUND_ERR, MSG_GENESIS_DATABASE_ERR, MSG_REGISTERING_CHAIN_SPINNER, - MSG_SELECTED_CONFIG, + MSG_CHAIN_NOT_FOUND_ERR, MSG_DISTRIBUTING_ETH_SPINNER, MSG_GENESIS_DATABASE_ERR, + MSG_MINT_BASE_TOKEN_SPINNER, MSG_REGISTERING_CHAIN_SPINNER, MSG_SELECTED_CONFIG, }, utils::forge::{check_the_balance, fill_forge_private_key}, }; @@ -67,12 +69,9 @@ pub async fn init( contracts_config.l1.base_token_addr = chain_config.base_token.address; contracts_config.save_with_base_path(shell, &chain_config.configs)?; - crate::commands::ecosystem::init::distribute_eth( - ecosystem_config, - chain_config, - init_args.l1_rpc_url.clone(), - ) - .await?; + distribute_eth(ecosystem_config, chain_config, init_args.l1_rpc_url.clone()).await?; + mint_base_token(ecosystem_config, chain_config, init_args.l1_rpc_url.clone()).await?; + let mut secrets = chain_config.get_secrets_config()?; set_l1_rpc_url(&mut secrets, init_args.l1_rpc_url.clone())?; secrets.save_with_base_path(shell, &chain_config.configs)?; @@ -160,3 +159,66 @@ async fn register_chain( contracts.set_chain_contracts(®ister_chain_output); Ok(()) } + +// Distribute eth to the chain wallets for localhost environment +pub async fn distribute_eth( + ecosystem_config: &EcosystemConfig, + chain_config: &ChainConfig, + l1_rpc_url: String, +) -> anyhow::Result<()> { + if chain_config.wallet_creation == WalletCreation::Localhost + && ecosystem_config.l1_network == L1Network::Localhost + { + let spinner = Spinner::new(MSG_DISTRIBUTING_ETH_SPINNER); + let wallets = ecosystem_config.get_wallets()?; + let chain_wallets = chain_config.get_wallets_config()?; + let mut addresses = vec![ + chain_wallets.operator.address, + chain_wallets.blob_operator.address, + chain_wallets.governor.address, + ]; + if let Some(deployer) = chain_wallets.deployer { + addresses.push(deployer.address) + } + common::ethereum::distribute_eth( + wallets.operator, + addresses, + l1_rpc_url, + ecosystem_config.l1_network.chain_id(), + AMOUNT_FOR_DISTRIBUTION_TO_WALLETS, + ) + .await?; + spinner.finish(); + } + Ok(()) +} + +pub async fn mint_base_token( + ecosystem_config: &EcosystemConfig, + chain_config: &ChainConfig, + l1_rpc_url: String, +) -> anyhow::Result<()> { + if chain_config.wallet_creation == WalletCreation::Localhost + && ecosystem_config.l1_network == L1Network::Localhost + && chain_config.base_token != BaseToken::eth() + { + let spinner = Spinner::new(MSG_MINT_BASE_TOKEN_SPINNER); + let wallets = ecosystem_config.get_wallets()?; + let chain_wallets = chain_config.get_wallets_config()?; + let base_token = &chain_config.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( + wallets.operator, + base_token.address, + addresses, + l1_rpc_url, + ecosystem_config.l1_network.chain_id(), + amount, + ) + .await?; + spinner.finish(); + } + Ok(()) +} diff --git a/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/create.rs b/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/create.rs index 4063f4ccdcd2..2e5c50f4538f 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/create.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/ecosystem/args/create.rs @@ -71,7 +71,7 @@ impl EcosystemCreateArgs { // Make the only chain as a default one self.chain.set_as_default = Some(true); - let chain = self.chain.fill_values_with_prompt(0, &l1_network)?; + let chain = self.chain.fill_values_with_prompt(0, &l1_network, vec![])?; let start_containers = self.start_containers.unwrap_or_else(|| { PromptConfirm::new(MSG_START_CONTAINERS_PROMPT) diff --git a/zk_toolbox/crates/zk_inception/src/commands/ecosystem/init.rs b/zk_toolbox/crates/zk_inception/src/commands/ecosystem/init.rs index 33574c9b9ec0..101d272494a0 100644 --- a/zk_toolbox/crates/zk_inception/src/commands/ecosystem/init.rs +++ b/zk_toolbox/crates/zk_inception/src/commands/ecosystem/init.rs @@ -18,7 +18,7 @@ use config::{ input::{ DeployErc20Config, DeployL1Config, Erc20DeploymentConfig, InitialDeploymentConfig, }, - output::{DeployErc20Output, DeployL1Output}, + output::{DeployL1Output, ERC20Tokens}, }, script_params::{DEPLOY_ECOSYSTEM_SCRIPT_PARAMS, DEPLOY_ERC20_SCRIPT_PARAMS}, }, @@ -26,9 +26,9 @@ use config::{ FileConfigWithDefaultName, ReadConfig, ReadConfigWithBasePath, SaveConfig, SaveConfigWithBasePath, }, - ChainConfig, ContractsConfig, EcosystemConfig, GenesisConfig, + ContractsConfig, EcosystemConfig, GenesisConfig, }; -use types::{L1Network, ProverMode, WalletCreation}; +use types::{L1Network, ProverMode}; use xshell::{cmd, Shell}; use super::{ @@ -43,13 +43,12 @@ use crate::{ create_erc20_deployment_config, create_initial_deployments_config, }, }, - consts::AMOUNT_FOR_DISTRIBUTION_TO_WALLETS, messages::{ msg_ecosystem_initialized, msg_initializing_chain, MSG_CHAIN_NOT_INITIALIZED, MSG_DEPLOYING_ECOSYSTEM_CONTRACTS_SPINNER, MSG_DEPLOYING_ERC20, - MSG_DEPLOYING_ERC20_SPINNER, MSG_DISTRIBUTING_ETH_SPINNER, - MSG_ECOSYSTEM_CONTRACTS_PATH_INVALID_ERR, MSG_ECOSYSTEM_CONTRACTS_PATH_PROMPT, - MSG_INITIALIZING_ECOSYSTEM, MSG_INTALLING_DEPS_SPINNER, + MSG_DEPLOYING_ERC20_SPINNER, MSG_ECOSYSTEM_CONTRACTS_PATH_INVALID_ERR, + MSG_ECOSYSTEM_CONTRACTS_PATH_PROMPT, MSG_INITIALIZING_ECOSYSTEM, + MSG_INTALLING_DEPS_SPINNER, }, utils::forge::{check_the_balance, fill_forge_private_key}, }; @@ -135,39 +134,6 @@ pub async fn run(args: EcosystemInitArgs, shell: &Shell) -> anyhow::Result<()> { Ok(()) } -// Distribute eth to the chain wallets for localhost environment -pub async fn distribute_eth( - ecosystem_config: &EcosystemConfig, - chain_config: &ChainConfig, - l1_rpc_url: String, -) -> anyhow::Result<()> { - if chain_config.wallet_creation == WalletCreation::Localhost - && ecosystem_config.l1_network == L1Network::Localhost - { - let spinner = Spinner::new(MSG_DISTRIBUTING_ETH_SPINNER); - let wallets = ecosystem_config.get_wallets()?; - let chain_wallets = chain_config.get_wallets_config()?; - let mut addresses = vec![ - chain_wallets.operator.address, - chain_wallets.blob_operator.address, - chain_wallets.governor.address, - ]; - if let Some(deployer) = chain_wallets.deployer { - addresses.push(deployer.address) - } - common::ethereum::distribute_eth( - wallets.operator, - addresses, - l1_rpc_url, - ecosystem_config.l1_network.chain_id(), - AMOUNT_FOR_DISTRIBUTION_TO_WALLETS, - ) - .await?; - spinner.finish(); - } - Ok(()) -} - async fn init( init_args: &mut EcosystemInitArgsFinal, shell: &Shell, @@ -198,7 +164,7 @@ async fn deploy_erc20( contracts_config: &ContractsConfig, forge_args: ForgeScriptArgs, l1_rpc_url: String, -) -> anyhow::Result { +) -> anyhow::Result { let deploy_config_path = DEPLOY_ERC20_SCRIPT_PARAMS.input(&ecosystem_config.link_to_code); let wallets = ecosystem_config.get_wallets()?; DeployErc20Config::new( @@ -228,7 +194,7 @@ async fn deploy_erc20( forge.run(shell)?; spinner.finish(); - let result = DeployErc20Output::read( + let result = ERC20Tokens::read( shell, DEPLOY_ERC20_SCRIPT_PARAMS.output(&ecosystem_config.link_to_code), )?; diff --git a/zk_toolbox/crates/zk_inception/src/defaults.rs b/zk_toolbox/crates/zk_inception/src/defaults.rs index fcbde71b012a..34b0eeae4195 100644 --- a/zk_toolbox/crates/zk_inception/src/defaults.rs +++ b/zk_toolbox/crates/zk_inception/src/defaults.rs @@ -11,6 +11,7 @@ lazy_static! { pub const ROCKS_DB_STATE_KEEPER: &str = "state_keeper"; pub const ROCKS_DB_TREE: &str = "tree"; +pub const ROCKS_DB_PROTECTIVE_READS: &str = "protective_reads"; pub const EN_ROCKS_DB_PREFIX: &str = "en"; pub const MAIN_ROCKS_DB_PREFIX: &str = "main"; diff --git a/zk_toolbox/crates/zk_inception/src/messages.rs b/zk_toolbox/crates/zk_inception/src/messages.rs index 9816b4ceace5..402ee0718e88 100644 --- a/zk_toolbox/crates/zk_inception/src/messages.rs +++ b/zk_toolbox/crates/zk_inception/src/messages.rs @@ -67,6 +67,8 @@ pub(super) const MSG_INITIALIZING_ECOSYSTEM: &str = "Initializing ecosystem"; pub(super) const MSG_DEPLOYING_ERC20: &str = "Deploying ERC20 contracts"; pub(super) const MSG_CHAIN_INITIALIZED: &str = "Chain initialized successfully"; pub(super) const MSG_DISTRIBUTING_ETH_SPINNER: &str = "Distributing eth..."; +pub(super) const MSG_MINT_BASE_TOKEN_SPINNER: &str = + "Minting base token to the governance addresses..."; pub(super) const MSG_INTALLING_DEPS_SPINNER: &str = "Installing and building dependencies..."; pub(super) const MSG_DEPLOYING_ERC20_SPINNER: &str = "Deploying ERC20 contracts..."; pub(super) const MSG_DEPLOYING_ECOSYSTEM_CONTRACTS_SPINNER: &str = diff --git a/zk_toolbox/crates/zk_inception/src/utils/rocks_db.rs b/zk_toolbox/crates/zk_inception/src/utils/rocks_db.rs index fc80aca100bc..17cffa66e39d 100644 --- a/zk_toolbox/crates/zk_inception/src/utils/rocks_db.rs +++ b/zk_toolbox/crates/zk_inception/src/utils/rocks_db.rs @@ -4,7 +4,8 @@ use config::RocksDbs; use xshell::Shell; use crate::defaults::{ - EN_ROCKS_DB_PREFIX, MAIN_ROCKS_DB_PREFIX, ROCKS_DB_STATE_KEEPER, ROCKS_DB_TREE, + EN_ROCKS_DB_PREFIX, MAIN_ROCKS_DB_PREFIX, ROCKS_DB_PROTECTIVE_READS, ROCKS_DB_STATE_KEEPER, + ROCKS_DB_TREE, }; pub enum RocksDBDirOption { @@ -32,8 +33,13 @@ pub fn recreate_rocksdb_dirs( shell.remove_path(&state_keeper)?; let merkle_tree = rocks_db_path.join(option.prefix()).join(ROCKS_DB_TREE); shell.remove_path(&merkle_tree)?; + let protective_reads = rocks_db_path + .join(option.prefix()) + .join(ROCKS_DB_PROTECTIVE_READS); + shell.remove_path(&protective_reads)?; Ok(RocksDbs { state_keeper: shell.create_dir(state_keeper)?, merkle_tree: shell.create_dir(merkle_tree)?, + protective_reads: shell.create_dir(protective_reads)?, }) }