From 474d17381776e4b129e52cc887163cbee32f310b Mon Sep 17 00:00:00 2001 From: Manuel Mauro Date: Wed, 6 Nov 2024 07:59:54 +0100 Subject: [PATCH 1/9] docs(zkstack_cli): Improve ZK Stack CLI autocomplete CI error message (#3214) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ Improve ZK Stack CLI autocomplete CI error message ## Why ❔ ## 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/crates/zkstack/src/commands/dev/commands/lint.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6c3c3fa3d75..d018859a8ff 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint.rs @@ -183,7 +183,7 @@ fn lint_autocompletion_files(_shell: &Shell, check: bool) -> anyhow::Result<()> let mut autocomplete_file = File::create(path).context("Failed to create file")?; autocomplete_file.write_all(new.as_bytes())?; } else { - bail!("Autocompletion files need to be regenerated. Run `zkstack dev lint -t autocompletion` to fix this issue.") + bail!("Autocompletion files need to be regenerated. To fix this issue, follow these steps: 1) Build an updated ZK Stack CLI using `zkstackup --local`, 2) Run `zkstack dev lint -t autocompletion` to generate the updated files, and 3) Commit the newly generated files.") } } } From 8a3a82ca16479183e96505bc91011fc07bfc6889 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 6 Nov 2024 09:59:00 +0200 Subject: [PATCH 2/9] feat(contract-verifier): Support Solidity contracts with EVM bytecode in contract verifier (#3225) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ Supports verifying Solidity contracts deployed with EVM bytecode in the contract verifier. ## Why ❔ Part of supporting EVM emulation throughout the Era codebase. ## 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`. --- Cargo.lock | 3 +- core/lib/contract_verifier/Cargo.toml | 1 + .../contract_verifier/src/compilers/mod.rs | 87 ++++ .../contract_verifier/src/compilers/solc.rs | 168 +++++++ .../{zksolc_utils.rs => compilers/zksolc.rs} | 142 +++--- .../zkvyper.rs} | 29 +- core/lib/contract_verifier/src/error.rs | 6 +- core/lib/contract_verifier/src/lib.rs | 359 +++++++-------- core/lib/contract_verifier/src/resolver.rs | 164 ++++--- core/lib/contract_verifier/src/tests/mod.rs | 430 ++++++++++++++++-- core/lib/contract_verifier/src/tests/real.rs | 158 +++++-- ...87f3b5d4ba906ec9a38e10912e3c7832fc93e.json | 42 ++ ...c84b0dd496700a61569929dcc7602ec678b09.json | 36 -- core/lib/dal/src/contract_verification_dal.rs | 342 +++++++++----- .../types/src/contract_verification_api.rs | 39 +- core/lib/utils/Cargo.toml | 1 + core/lib/utils/src/bytecode.rs | 64 ++- core/node/api_server/Cargo.toml | 1 - core/node/api_server/src/testonly.rs | 25 - core/node/api_server/src/utils.rs | 36 -- .../api_server/src/web3/namespaces/eth.rs | 21 +- core/node/api_server/src/web3/tests/mod.rs | 11 +- prover/Cargo.lock | 12 +- zkstack_cli/Cargo.lock | 10 + 24 files changed, 1531 insertions(+), 656 deletions(-) create mode 100644 core/lib/contract_verifier/src/compilers/mod.rs create mode 100644 core/lib/contract_verifier/src/compilers/solc.rs rename core/lib/contract_verifier/src/{zksolc_utils.rs => compilers/zksolc.rs} (71%) rename core/lib/contract_verifier/src/{zkvyper_utils.rs => compilers/zkvyper.rs} (78%) create mode 100644 core/lib/dal/.sqlx/query-40a7a619ed490eb3848a45fdde787f3b5d4ba906ec9a38e10912e3c7832fc93e.json delete mode 100644 core/lib/dal/.sqlx/query-8ab1634beba74aaef952562a3bcc84b0dd496700a61569929dcc7602ec678b09.json diff --git a/Cargo.lock b/Cargo.lock index 8d393040c03..c5cee452b1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10828,6 +10828,7 @@ dependencies = [ "serde", "serde_json", "tempfile", + "test-casing", "thiserror", "tokio", "tracing", @@ -11446,7 +11447,6 @@ dependencies = [ "async-trait", "axum 0.7.7", "chrono", - "const-decoder", "futures 0.3.31", "governor", "hex", @@ -12175,6 +12175,7 @@ dependencies = [ "assert_matches", "bigdecimal", "bincode", + "const-decoder", "futures 0.3.31", "hex", "num", diff --git a/core/lib/contract_verifier/Cargo.toml b/core/lib/contract_verifier/Cargo.toml index 3b2ab33294e..bdbfa90bf76 100644 --- a/core/lib/contract_verifier/Cargo.toml +++ b/core/lib/contract_verifier/Cargo.toml @@ -34,3 +34,4 @@ semver.workspace = true [dev-dependencies] zksync_node_test_utils.workspace = true zksync_vm_interface.workspace = true +test-casing.workspace = true diff --git a/core/lib/contract_verifier/src/compilers/mod.rs b/core/lib/contract_verifier/src/compilers/mod.rs new file mode 100644 index 00000000000..a56b4e32d1a --- /dev/null +++ b/core/lib/contract_verifier/src/compilers/mod.rs @@ -0,0 +1,87 @@ +use anyhow::Context as _; +use serde::{Deserialize, Serialize}; +use zksync_types::contract_verification_api::CompilationArtifacts; + +pub(crate) use self::{ + solc::{Solc, SolcInput}, + zksolc::{ZkSolc, ZkSolcInput}, + zkvyper::{ZkVyper, ZkVyperInput}, +}; +use crate::error::ContractVerifierError; + +mod solc; +mod zksolc; +mod zkvyper; + +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct Source { + /// The source code file content. + pub content: String, +} + +/// Parsing logic shared between `solc` and `zksolc`. +fn parse_standard_json_output( + output: &serde_json::Value, + contract_name: String, + file_name: String, + get_deployed_bytecode: bool, +) -> Result { + if let Some(errors) = output.get("errors") { + let errors = errors.as_array().unwrap().clone(); + if errors + .iter() + .any(|err| err["severity"].as_str().unwrap() == "error") + { + let error_messages = errors + .into_iter() + .map(|err| err["formattedMessage"].clone()) + .collect(); + return Err(ContractVerifierError::CompilationError( + serde_json::Value::Array(error_messages), + )); + } + } + + let contracts = output["contracts"] + .get(&file_name) + .ok_or(ContractVerifierError::MissingSource(file_name))?; + let Some(contract) = contracts.get(&contract_name) else { + return Err(ContractVerifierError::MissingContract(contract_name)); + }; + + let Some(bytecode_str) = contract + .pointer("/evm/bytecode/object") + .context("missing bytecode in solc / zksolc output")? + .as_str() + else { + return Err(ContractVerifierError::AbstractContract(contract_name)); + }; + let bytecode = hex::decode(bytecode_str).context("invalid bytecode")?; + + let deployed_bytecode = if get_deployed_bytecode { + let bytecode_str = contract + .pointer("/evm/deployedBytecode/object") + .context("missing deployed bytecode in solc output")? + .as_str() + .ok_or(ContractVerifierError::AbstractContract(contract_name))?; + Some(hex::decode(bytecode_str).context("invalid deployed bytecode")?) + } else { + None + }; + + let abi = contract["abi"].clone(); + if !abi.is_array() { + let err = anyhow::anyhow!( + "unexpected value for ABI: {}", + serde_json::to_string_pretty(&abi).unwrap() + ); + return Err(err.into()); + } + + Ok(CompilationArtifacts { + bytecode, + deployed_bytecode, + abi, + }) +} diff --git a/core/lib/contract_verifier/src/compilers/solc.rs b/core/lib/contract_verifier/src/compilers/solc.rs new file mode 100644 index 00000000000..bb453cb729c --- /dev/null +++ b/core/lib/contract_verifier/src/compilers/solc.rs @@ -0,0 +1,168 @@ +use std::{collections::HashMap, path::PathBuf, process::Stdio}; + +use anyhow::Context; +use serde::{Deserialize, Serialize}; +use tokio::io::AsyncWriteExt; +use zksync_queued_job_processor::async_trait; +use zksync_types::contract_verification_api::{ + CompilationArtifacts, SourceCodeData, VerificationIncomingRequest, +}; + +use super::{parse_standard_json_output, Source}; +use crate::{error::ContractVerifierError, resolver::Compiler}; + +// Here and below, fields are public for testing purposes. +#[derive(Debug)] +pub(crate) struct SolcInput { + pub standard_json: StandardJson, + pub contract_name: String, + pub file_name: String, +} + +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct StandardJson { + pub language: String, + pub sources: HashMap, + settings: Settings, +} + +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct Settings { + /// The output selection filters. + output_selection: Option, + /// Other settings (only filled when parsing `StandardJson` input from the request). + #[serde(flatten)] + other: serde_json::Value, +} + +#[derive(Debug)] +pub(crate) struct Solc { + path: PathBuf, +} + +impl Solc { + pub fn new(path: PathBuf) -> Self { + Self { path } + } + + pub fn build_input( + req: VerificationIncomingRequest, + ) -> Result { + // Users may provide either just contract name or + // source file name and contract name joined with ":". + let (file_name, contract_name) = + if let Some((file_name, contract_name)) = req.contract_name.rsplit_once(':') { + (file_name.to_string(), contract_name.to_string()) + } else { + ( + format!("{}.sol", req.contract_name), + req.contract_name.clone(), + ) + }; + let default_output_selection = serde_json::json!({ + "*": { + "*": [ "abi", "evm.bytecode", "evm.deployedBytecode" ], + "": [ "abi", "evm.bytecode", "evm.deployedBytecode" ], + } + }); + + let standard_json = match req.source_code_data { + SourceCodeData::SolSingleFile(source_code) => { + let source = Source { + content: source_code, + }; + let sources = HashMap::from([(file_name.clone(), source)]); + let settings = Settings { + output_selection: Some(default_output_selection), + other: serde_json::json!({ + "optimizer": { + "enabled": req.optimization_used, + }, + }), + }; + + StandardJson { + language: "Solidity".to_owned(), + sources, + settings, + } + } + SourceCodeData::StandardJsonInput(map) => { + let mut compiler_input: StandardJson = + serde_json::from_value(serde_json::Value::Object(map)) + .map_err(|_| ContractVerifierError::FailedToDeserializeInput)?; + // Set default output selection even if it is different in request. + compiler_input.settings.output_selection = Some(default_output_selection); + compiler_input + } + SourceCodeData::YulSingleFile(source_code) => { + let source = Source { + content: source_code, + }; + let sources = HashMap::from([(file_name.clone(), source)]); + let settings = Settings { + output_selection: Some(default_output_selection), + other: serde_json::json!({ + "optimizer": { + "enabled": req.optimization_used, + }, + }), + }; + StandardJson { + language: "Yul".to_owned(), + sources, + settings, + } + } + other => unreachable!("Unexpected `SourceCodeData` variant: {other:?}"), + }; + + Ok(SolcInput { + standard_json, + contract_name, + file_name, + }) + } +} + +#[async_trait] +impl Compiler for Solc { + async fn compile( + self: Box, + input: SolcInput, + ) -> Result { + let mut command = tokio::process::Command::new(&self.path); + let mut child = command + .arg("--standard-json") + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .context("failed spawning solc")?; + let stdin = child.stdin.as_mut().unwrap(); + let content = serde_json::to_vec(&input.standard_json) + .context("cannot encode standard JSON input for solc")?; + stdin + .write_all(&content) + .await + .context("failed writing standard JSON to solc stdin")?; + stdin + .flush() + .await + .context("failed flushing standard JSON to solc")?; + + let output = child.wait_with_output().await.context("solc failed")?; + if output.status.success() { + let output = serde_json::from_slice(&output.stdout) + .context("zksolc output is not valid JSON")?; + parse_standard_json_output(&output, input.contract_name, input.file_name, true) + } else { + Err(ContractVerifierError::CompilerError( + "solc", + String::from_utf8_lossy(&output.stderr).to_string(), + )) + } + } +} diff --git a/core/lib/contract_verifier/src/zksolc_utils.rs b/core/lib/contract_verifier/src/compilers/zksolc.rs similarity index 71% rename from core/lib/contract_verifier/src/zksolc_utils.rs rename to core/lib/contract_verifier/src/compilers/zksolc.rs index 0a3d84ab555..0d6b5828e31 100644 --- a/core/lib/contract_verifier/src/zksolc_utils.rs +++ b/core/lib/contract_verifier/src/compilers/zksolc.rs @@ -6,15 +6,18 @@ use semver::Version; use serde::{Deserialize, Serialize}; use tokio::io::AsyncWriteExt; use zksync_queued_job_processor::async_trait; -use zksync_types::contract_verification_api::CompilationArtifacts; +use zksync_types::contract_verification_api::{ + CompilationArtifacts, SourceCodeData, VerificationIncomingRequest, +}; +use super::{parse_standard_json_output, Source}; use crate::{ error::ContractVerifierError, resolver::{Compiler, CompilerPaths}, }; #[derive(Debug)] -pub enum ZkSolcInput { +pub(crate) enum ZkSolcInput { StandardJson { input: StandardJson, contract_name: String, @@ -28,7 +31,7 @@ pub enum ZkSolcInput { #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct StandardJson { +pub(crate) struct StandardJson { /// The input language. pub language: String, /// The input source code files hashmap. @@ -37,19 +40,12 @@ pub struct StandardJson { pub settings: Settings, } -#[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct Source { - /// The source code file content. - pub content: String, -} - /// Compiler settings. /// There are fields like `output_selection`, `is_system`, `force_evmla` which are accessed by contract verifier explicitly. /// Other fields are accumulated in `other`, this way every field that was in the original request will be passed to a compiler. #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Settings { +pub(crate) struct Settings { /// The output selection filters. pub output_selection: Option, /// Flag for system compilation mode. @@ -58,29 +54,20 @@ pub struct Settings { /// Flag to force `evmla` IR. #[serde(default)] pub force_evmla: bool, - /// Other fields. + /// Other settings (only filled when parsing `StandardJson` input from the request). #[serde(flatten)] pub other: serde_json::Value, } #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Optimizer { +pub(crate) struct Optimizer { /// Whether the optimizer is enabled. pub enabled: bool, /// The optimization mode string. pub mode: Option, } -impl Default for Optimizer { - fn default() -> Self { - Self { - enabled: true, - mode: None, - } - } -} - #[derive(Debug)] pub(crate) struct ZkSolc { paths: CompilerPaths, @@ -95,47 +82,73 @@ impl ZkSolc { } } - fn parse_standard_json_output( - output: &serde_json::Value, - contract_name: String, - file_name: String, - ) -> Result { - if let Some(errors) = output.get("errors") { - let errors = errors.as_array().unwrap().clone(); - if errors - .iter() - .any(|err| err["severity"].as_str().unwrap() == "error") - { - let error_messages = errors - .into_iter() - .map(|err| err["formattedMessage"].clone()) - .collect(); - return Err(ContractVerifierError::CompilationError( - serde_json::Value::Array(error_messages), - )); + pub fn build_input( + req: VerificationIncomingRequest, + ) -> Result { + // Users may provide either just contract name or + // source file name and contract name joined with ":". + let (file_name, contract_name) = + if let Some((file_name, contract_name)) = req.contract_name.rsplit_once(':') { + (file_name.to_string(), contract_name.to_string()) + } else { + ( + format!("{}.sol", req.contract_name), + req.contract_name.clone(), + ) + }; + let default_output_selection = serde_json::json!({ + "*": { + "*": [ "abi" ], + "": [ "abi" ] } - } + }); - let contracts = output["contracts"] - .get(&file_name) - .ok_or(ContractVerifierError::MissingSource(file_name))?; - let Some(contract) = contracts.get(&contract_name) else { - return Err(ContractVerifierError::MissingContract(contract_name)); - }; - let bytecode_str = contract["evm"]["bytecode"]["object"] - .as_str() - .ok_or(ContractVerifierError::AbstractContract(contract_name))?; - let bytecode = hex::decode(bytecode_str).unwrap(); - let abi = contract["abi"].clone(); - if !abi.is_array() { - let err = anyhow::anyhow!( - "zksolc returned unexpected value for ABI: {}", - serde_json::to_string_pretty(&abi).unwrap() - ); - return Err(err.into()); - } + match req.source_code_data { + SourceCodeData::SolSingleFile(source_code) => { + let source = Source { + content: source_code, + }; + let sources = HashMap::from([(file_name.clone(), source)]); + let settings = Settings { + output_selection: Some(default_output_selection), + is_system: req.is_system, + force_evmla: req.force_evmla, + other: serde_json::json!({ + "optimizer": Optimizer { + enabled: req.optimization_used, + mode: req.optimizer_mode.and_then(|s| s.chars().next()), + }, + }), + }; - Ok(CompilationArtifacts { bytecode, abi }) + Ok(ZkSolcInput::StandardJson { + input: StandardJson { + language: "Solidity".to_string(), + sources, + settings, + }, + contract_name, + file_name, + }) + } + SourceCodeData::StandardJsonInput(map) => { + let mut compiler_input: StandardJson = + serde_json::from_value(serde_json::Value::Object(map)) + .map_err(|_| ContractVerifierError::FailedToDeserializeInput)?; + // Set default output selection even if it is different in request. + compiler_input.settings.output_selection = Some(default_output_selection); + Ok(ZkSolcInput::StandardJson { + input: compiler_input, + contract_name, + file_name, + }) + } + SourceCodeData::YulSingleFile(source_code) => Ok(ZkSolcInput::YulSingleFile { + source_code, + is_system: req.is_system, + }), + other => unreachable!("Unexpected `SourceCodeData` variant: {other:?}"), + } } fn parse_single_file_yul_output( @@ -149,6 +162,7 @@ impl ZkSolc { let bytecode = hex::decode(bytecode_str).context("invalid Yul output bytecode")?; Ok(CompilationArtifacts { bytecode, + deployed_bytecode: None, abi: serde_json::Value::Array(Vec::new()), }) } @@ -234,10 +248,10 @@ impl Compiler for ZkSolc { if output.status.success() { let output = serde_json::from_slice(&output.stdout) .context("zksolc output is not valid JSON")?; - Self::parse_standard_json_output(&output, contract_name, file_name) + parse_standard_json_output(&output, contract_name, file_name, false) } else { Err(ContractVerifierError::CompilerError( - "zksolc".to_string(), + "zksolc", String::from_utf8_lossy(&output.stderr).to_string(), )) } @@ -266,7 +280,7 @@ impl Compiler for ZkSolc { Self::parse_single_file_yul_output(&output) } else { Err(ContractVerifierError::CompilerError( - "zksolc".to_string(), + "zksolc", String::from_utf8_lossy(&output.stderr).to_string(), )) } @@ -279,7 +293,7 @@ impl Compiler for ZkSolc { mod tests { use std::path::PathBuf; - use crate::{resolver::CompilerPaths, zksolc_utils::ZkSolc}; + use super::*; #[test] fn check_is_post_1_5_0() { diff --git a/core/lib/contract_verifier/src/zkvyper_utils.rs b/core/lib/contract_verifier/src/compilers/zkvyper.rs similarity index 78% rename from core/lib/contract_verifier/src/zkvyper_utils.rs rename to core/lib/contract_verifier/src/compilers/zkvyper.rs index bc2cd7e996c..b3dacce64e7 100644 --- a/core/lib/contract_verifier/src/zkvyper_utils.rs +++ b/core/lib/contract_verifier/src/compilers/zkvyper.rs @@ -2,7 +2,9 @@ use std::{collections::HashMap, fs::File, io::Write, path::Path, process::Stdio} use anyhow::Context as _; use zksync_queued_job_processor::async_trait; -use zksync_types::contract_verification_api::CompilationArtifacts; +use zksync_types::contract_verification_api::{ + CompilationArtifacts, SourceCodeData, VerificationIncomingRequest, +}; use crate::{ error::ContractVerifierError, @@ -26,6 +28,28 @@ impl ZkVyper { Self { paths } } + pub fn build_input( + req: VerificationIncomingRequest, + ) -> Result { + // Users may provide either just contract name or + // source file name and contract name joined with ":". + let contract_name = if let Some((_, contract_name)) = req.contract_name.rsplit_once(':') { + contract_name.to_owned() + } else { + req.contract_name.clone() + }; + + let sources = match req.source_code_data { + SourceCodeData::VyperMultiFile(s) => s, + other => unreachable!("unexpected `SourceCodeData` variant: {other:?}"), + }; + Ok(ZkVyperInput { + contract_name, + sources, + optimizer_mode: req.optimizer_mode, + }) + } + fn parse_output( output: &serde_json::Value, contract_name: String, @@ -47,6 +71,7 @@ impl ZkVyper { return Ok(CompilationArtifacts { abi: artifact["abi"].clone(), bytecode, + deployed_bytecode: None, }); } } @@ -97,7 +122,7 @@ impl Compiler for ZkVyper { Self::parse_output(&output, input.contract_name) } else { Err(ContractVerifierError::CompilerError( - "zkvyper".to_string(), + "zkvyper", String::from_utf8_lossy(&output.stderr).to_string(), )) } diff --git a/core/lib/contract_verifier/src/error.rs b/core/lib/contract_verifier/src/error.rs index e55d2499c93..c777df24e22 100644 --- a/core/lib/contract_verifier/src/error.rs +++ b/core/lib/contract_verifier/src/error.rs @@ -6,16 +6,18 @@ pub enum ContractVerifierError { Internal(#[from] anyhow::Error), #[error("Deployed bytecode is not equal to generated one from given source")] BytecodeMismatch, + #[error("Creation bytecode is not equal to generated one from given source")] + CreationBytecodeMismatch, #[error("Constructor arguments are not correct")] IncorrectConstructorArguments, #[error("Compilation takes too much time")] CompilationTimeout, #[error("{0} error: {1}")] - CompilerError(String, String), + CompilerError(&'static str, String), #[error("Compilation error")] CompilationError(serde_json::Value), #[error("Unknown {0} version: {1}")] - UnknownCompilerVersion(String, String), + UnknownCompilerVersion(&'static str, String), #[error("Contract with {0} name is missing in sources")] MissingContract(String), #[error("There is no {0} source file")] diff --git a/core/lib/contract_verifier/src/lib.rs b/core/lib/contract_verifier/src/lib.rs index f5face9f8a5..425440fa2eb 100644 --- a/core/lib/contract_verifier/src/lib.rs +++ b/core/lib/contract_verifier/src/lib.rs @@ -1,7 +1,6 @@ //! Contract verifier able to verify contracts created with `zksolc` or `zkvyper` toolchains. use std::{ - collections::HashMap, fmt, sync::Arc, time::{Duration, Instant}, @@ -11,31 +10,30 @@ use anyhow::Context as _; use chrono::Utc; use ethabi::{Contract, Token}; use tokio::time; -use zksync_dal::{ConnectionPool, Core, CoreDal}; +use zksync_dal::{contract_verification_dal::DeployedContractData, ConnectionPool, Core, CoreDal}; use zksync_queued_job_processor::{async_trait, JobProcessor}; use zksync_types::{ contract_verification_api::{ - CompilationArtifacts, CompilerType, DeployContractCalldata, SourceCodeData, - VerificationIncomingRequest, VerificationInfo, VerificationRequest, + CompilationArtifacts, CompilerType, VerificationIncomingRequest, VerificationInfo, + VerificationRequest, }, - Address, + Address, CONTRACT_DEPLOYER_ADDRESS, }; +use zksync_utils::bytecode::{prepare_evm_bytecode, BytecodeMarker}; use crate::{ + compilers::{Solc, ZkSolc, ZkVyper}, error::ContractVerifierError, metrics::API_CONTRACT_VERIFIER_METRICS, resolver::{CompilerResolver, EnvCompilerResolver}, - zksolc_utils::{Optimizer, Settings, Source, StandardJson, ZkSolcInput}, - zkvyper_utils::ZkVyperInput, }; +mod compilers; pub mod error; mod metrics; mod resolver; #[cfg(test)] mod tests; -mod zksolc_utils; -mod zkvyper_utils; enum ConstructorArgs { Check(Vec), @@ -142,14 +140,12 @@ impl ContractVerifier { &self, mut request: VerificationRequest, ) -> Result { - let artifacts = self.compile(request.req.clone()).await?; - // Bytecode should be present because it is checked when accepting request. let mut storage = self .connection_pool .connection_tagged("contract_verifier") .await?; - let (deployed_bytecode, creation_tx_calldata) = storage + let deployed_contract = storage .contract_verification_dal() .get_contract_info_for_verification(request.req.contract_address) .await? @@ -161,15 +157,31 @@ impl ContractVerifier { })?; drop(storage); - let constructor_args = - self.decode_constructor_args(creation_tx_calldata, request.req.contract_address)?; + let bytecode_marker = BytecodeMarker::new(deployed_contract.bytecode_hash) + .context("unknown bytecode kind")?; + let artifacts = self.compile(request.req.clone(), bytecode_marker).await?; + let constructor_args = match bytecode_marker { + BytecodeMarker::EraVm => self + .decode_era_vm_constructor_args(&deployed_contract, request.req.contract_address)?, + BytecodeMarker::Evm => Self::decode_evm_constructor_args( + request.id, + &deployed_contract, + &artifacts.bytecode, + )?, + }; + + let deployed_bytecode = match bytecode_marker { + BytecodeMarker::EraVm => deployed_contract.bytecode.as_slice(), + BytecodeMarker::Evm => prepare_evm_bytecode(&deployed_contract.bytecode) + .context("invalid stored EVM bytecode")?, + }; - if artifacts.bytecode != deployed_bytecode { + if artifacts.deployed_bytecode() != deployed_bytecode { tracing::info!( - "Bytecode mismatch req {}, deployed: 0x{}, compiled: 0x{}", - request.id, - hex::encode(deployed_bytecode), - hex::encode(artifacts.bytecode) + request_id = request.id, + deployed = hex::encode(deployed_bytecode), + compiled = hex::encode(artifacts.deployed_bytecode()), + "Deployed (runtime) bytecode mismatch", ); return Err(ContractVerifierError::BytecodeMismatch); } @@ -206,10 +218,10 @@ impl ContractVerifier { ) -> Result { let zksolc = self .compiler_resolver - .resolve_solc(&req.compiler_versions) + .resolve_zksolc(&req.compiler_versions) .await?; tracing::debug!(?zksolc, ?req.compiler_versions, "resolved compiler"); - let input = Self::build_zksolc_input(req)?; + let input = ZkSolc::build_input(req)?; time::timeout(self.compilation_timeout, zksolc.compile(input)) .await @@ -222,194 +234,142 @@ impl ContractVerifier { ) -> Result { let zkvyper = self .compiler_resolver - .resolve_vyper(&req.compiler_versions) + .resolve_zkvyper(&req.compiler_versions) .await?; tracing::debug!(?zkvyper, ?req.compiler_versions, "resolved compiler"); - let input = Self::build_zkvyper_input(req)?; + let input = ZkVyper::build_input(req)?; time::timeout(self.compilation_timeout, zkvyper.compile(input)) .await .map_err(|_| ContractVerifierError::CompilationTimeout)? } - #[tracing::instrument(level = "debug", skip_all)] - async fn compile( + async fn compile_solc( &self, req: VerificationIncomingRequest, ) -> Result { - match req.source_code_data.compiler_type() { - CompilerType::Solc => self.compile_zksolc(req).await, - CompilerType::Vyper => self.compile_zkvyper(req).await, - } + let solc = self + .compiler_resolver + .resolve_solc(req.compiler_versions.compiler_version()) + .await?; + tracing::debug!(?solc, ?req.compiler_versions, "resolved compiler"); + let input = Solc::build_input(req)?; + + time::timeout(self.compilation_timeout, solc.compile(input)) + .await + .map_err(|_| ContractVerifierError::CompilationTimeout)? } - fn build_zksolc_input( + #[tracing::instrument(level = "debug", skip_all)] + async fn compile( + &self, req: VerificationIncomingRequest, - ) -> Result { - // Users may provide either just contract name or - // source file name and contract name joined with ":". - let (file_name, contract_name) = - if let Some((file_name, contract_name)) = req.contract_name.rsplit_once(':') { - (file_name.to_string(), contract_name.to_string()) - } else { - ( - format!("{}.sol", req.contract_name), - req.contract_name.clone(), - ) - }; - let default_output_selection = serde_json::json!({ - "*": { - "*": [ "abi" ], - "": [ "abi" ] - } - }); - - match req.source_code_data { - SourceCodeData::SolSingleFile(source_code) => { - let source = Source { - content: source_code, - }; - let sources = HashMap::from([(file_name.clone(), source)]); - let optimizer = Optimizer { - enabled: req.optimization_used, - mode: req.optimizer_mode.and_then(|s| s.chars().next()), - }; - let optimizer_value = serde_json::to_value(optimizer).unwrap(); - - let settings = Settings { - output_selection: Some(default_output_selection), - is_system: req.is_system, - force_evmla: req.force_evmla, - other: serde_json::Value::Object( - vec![("optimizer".to_string(), optimizer_value)] - .into_iter() - .collect(), - ), - }; + bytecode_marker: BytecodeMarker, + ) -> Result { + let compiler_type = req.source_code_data.compiler_type(); + let compiler_type_by_versions = req.compiler_versions.compiler_type(); + if compiler_type != compiler_type_by_versions { + // Should be checked when receiving a request, so here it's more of a sanity check + let err = anyhow::anyhow!( + "specified compiler versions {:?} belong to a differing toolchain than source code ({compiler_type:?})", + req.compiler_versions + ); + return Err(err.into()); + } - Ok(ZkSolcInput::StandardJson { - input: StandardJson { - language: "Solidity".to_string(), - sources, - settings, - }, - contract_name, - file_name, - }) - } - SourceCodeData::StandardJsonInput(map) => { - let mut compiler_input: StandardJson = - serde_json::from_value(serde_json::Value::Object(map)) - .map_err(|_| ContractVerifierError::FailedToDeserializeInput)?; - // Set default output selection even if it is different in request. - compiler_input.settings.output_selection = Some(default_output_selection); - Ok(ZkSolcInput::StandardJson { - input: compiler_input, - contract_name, - file_name, - }) + match (bytecode_marker, compiler_type) { + (BytecodeMarker::EraVm, CompilerType::Solc) => self.compile_zksolc(req).await, + (BytecodeMarker::EraVm, CompilerType::Vyper) => self.compile_zkvyper(req).await, + (BytecodeMarker::Evm, CompilerType::Solc) => self.compile_solc(req).await, + (BytecodeMarker::Evm, CompilerType::Vyper) => { + // TODO: add vyper support + let err = anyhow::anyhow!("vyper toolchain is not yet supported for EVM contracts"); + return Err(err.into()); } - SourceCodeData::YulSingleFile(source_code) => Ok(ZkSolcInput::YulSingleFile { - source_code, - is_system: req.is_system, - }), - other => unreachable!("Unexpected `SourceCodeData` variant: {other:?}"), } } - fn build_zkvyper_input( - req: VerificationIncomingRequest, - ) -> Result { - // Users may provide either just contract name or - // source file name and contract name joined with ":". - let contract_name = if let Some((_, contract_name)) = req.contract_name.rsplit_once(':') { - contract_name.to_owned() - } else { - req.contract_name.clone() + /// All returned errors are internal. + #[tracing::instrument(level = "trace", skip_all, ret, err)] + fn decode_era_vm_constructor_args( + &self, + contract: &DeployedContractData, + contract_address_to_verify: Address, + ) -> anyhow::Result { + let Some(calldata) = &contract.calldata else { + return Ok(ConstructorArgs::Ignore); }; - let sources = match req.source_code_data { - SourceCodeData::VyperMultiFile(s) => s, - other => unreachable!("unexpected `SourceCodeData` variant: {other:?}"), - }; - Ok(ZkVyperInput { - contract_name, - sources, - optimizer_mode: req.optimizer_mode, - }) + if contract.contract_address == Some(CONTRACT_DEPLOYER_ADDRESS) { + self.decode_contract_deployer_call(calldata, contract_address_to_verify) + } else { + Ok(ConstructorArgs::Ignore) + } } - /// All returned errors are internal. - #[tracing::instrument(level = "trace", skip_all, ret, err)] - fn decode_constructor_args( + fn decode_contract_deployer_call( &self, - calldata: DeployContractCalldata, + calldata: &[u8], contract_address_to_verify: Address, ) -> anyhow::Result { - match calldata { - DeployContractCalldata::Deploy(calldata) => { - anyhow::ensure!( - calldata.len() >= 4, - "calldata doesn't include Solidity function selector" - ); - - let contract_deployer = &self.contract_deployer; - let create = contract_deployer - .function("create") - .context("no `create` in contract deployer ABI")?; - let create2 = contract_deployer - .function("create2") - .context("no `create2` in contract deployer ABI")?; - let create_acc = contract_deployer - .function("createAccount") - .context("no `createAccount` in contract deployer ABI")?; - let create2_acc = contract_deployer - .function("create2Account") - .context("no `create2Account` in contract deployer ABI")?; - let force_deploy = contract_deployer - .function("forceDeployOnAddresses") - .context("no `forceDeployOnAddresses` in contract deployer ABI")?; - - let (selector, token_data) = calldata.split_at(4); - // It's assumed that `create` and `create2` methods have the same parameters - // and the same for `createAccount` and `create2Account`. - Ok(match selector { - selector - if selector == create.short_signature() - || selector == create2.short_signature() => - { - let tokens = create - .decode_input(token_data) - .context("failed to decode `create` / `create2` input")?; - // Constructor arguments are in the third parameter. - ConstructorArgs::Check(tokens[2].clone().into_bytes().context( - "third parameter of `create/create2` should be of type `bytes`", - )?) - } - selector - if selector == create_acc.short_signature() - || selector == create2_acc.short_signature() => - { - let tokens = create - .decode_input(token_data) - .context("failed to decode `createAccount` / `create2Account` input")?; - // Constructor arguments are in the third parameter. - ConstructorArgs::Check(tokens[2].clone().into_bytes().context( - "third parameter of `createAccount/create2Account` should be of type `bytes`", - )?) - } - selector if selector == force_deploy.short_signature() => { - Self::decode_force_deployment( - token_data, - force_deploy, - contract_address_to_verify, - ) - .context("failed decoding force deployment")? - } - _ => ConstructorArgs::Ignore, - }) + anyhow::ensure!( + calldata.len() >= 4, + "calldata doesn't include Solidity function selector" + ); + + let contract_deployer = &self.contract_deployer; + let create = contract_deployer + .function("create") + .context("no `create` in contract deployer ABI")?; + let create2 = contract_deployer + .function("create2") + .context("no `create2` in contract deployer ABI")?; + let create_acc = contract_deployer + .function("createAccount") + .context("no `createAccount` in contract deployer ABI")?; + let create2_acc = contract_deployer + .function("create2Account") + .context("no `create2Account` in contract deployer ABI")?; + let force_deploy = contract_deployer + .function("forceDeployOnAddresses") + .context("no `forceDeployOnAddresses` in contract deployer ABI")?; + + let (selector, token_data) = calldata.split_at(4); + // It's assumed that `create` and `create2` methods have the same parameters + // and the same for `createAccount` and `create2Account`. + Ok(match selector { + selector + if selector == create.short_signature() + || selector == create2.short_signature() => + { + let tokens = create + .decode_input(token_data) + .context("failed to decode `create` / `create2` input")?; + // Constructor arguments are in the third parameter. + ConstructorArgs::Check( + tokens[2] + .clone() + .into_bytes() + .context("third parameter of `create/create2` should be of type `bytes`")?, + ) } - DeployContractCalldata::Ignore => Ok(ConstructorArgs::Ignore), - } + selector + if selector == create_acc.short_signature() + || selector == create2_acc.short_signature() => + { + let tokens = create + .decode_input(token_data) + .context("failed to decode `createAccount` / `create2Account` input")?; + // Constructor arguments are in the third parameter. + ConstructorArgs::Check(tokens[2].clone().into_bytes().context( + "third parameter of `createAccount/create2Account` should be of type `bytes`", + )?) + } + selector if selector == force_deploy.short_signature() => { + Self::decode_force_deployment(token_data, force_deploy, contract_address_to_verify) + .context("failed decoding force deployment")? + } + _ => ConstructorArgs::Ignore, + }) } fn decode_force_deployment( @@ -453,6 +413,31 @@ impl ContractVerifier { anyhow::bail!("couldn't find force deployment for address {contract_address_to_verify:?}"); } + fn decode_evm_constructor_args( + request_id: usize, + contract: &DeployedContractData, + creation_bytecode: &[u8], + ) -> Result { + let Some(calldata) = &contract.calldata else { + return Ok(ConstructorArgs::Ignore); + }; + if contract.contract_address.is_some() { + // Not an EVM deployment transaction + return Ok(ConstructorArgs::Ignore); + } + + let args = calldata.strip_prefix(creation_bytecode).ok_or_else(|| { + tracing::info!( + request_id, + calldata = hex::encode(calldata), + compiled = hex::encode(creation_bytecode), + "Creation bytecode mismatch" + ); + ContractVerifierError::CreationBytecodeMismatch + })?; + Ok(ConstructorArgs::Check(args.to_vec())) + } + #[tracing::instrument(level = "debug", skip_all, err, fields(id = request_id))] async fn process_result( &self, @@ -488,7 +473,7 @@ impl ContractVerifier { }; storage .contract_verification_dal() - .save_verification_error(request_id, error_message, compilation_errors, None) + .save_verification_error(request_id, &error_message, &compilation_errors, None) .await?; tracing::info!("Request with id = {request_id} was failed"); } @@ -535,9 +520,9 @@ impl JobProcessor for ContractVerifier { .contract_verification_dal() .save_verification_error( job_id, - "Internal error".to_string(), - serde_json::Value::Array(Vec::new()), - Some(error), + "Internal error", + &serde_json::Value::Array(Vec::new()), + Some(&error), ) .await .unwrap(); diff --git a/core/lib/contract_verifier/src/resolver.rs b/core/lib/contract_verifier/src/resolver.rs index 5e772900669..347db8fff09 100644 --- a/core/lib/contract_verifier/src/resolver.rs +++ b/core/lib/contract_verifier/src/resolver.rs @@ -1,4 +1,7 @@ -use std::{fmt, path::PathBuf}; +use std::{ + fmt, + path::{Path, PathBuf}, +}; use anyhow::Context as _; use tokio::fs; @@ -7,11 +10,62 @@ use zksync_types::contract_verification_api::{CompilationArtifacts, CompilerVers use zksync_utils::env::Workspace; use crate::{ + compilers::{Solc, SolcInput, ZkSolc, ZkSolcInput, ZkVyper, ZkVyperInput}, error::ContractVerifierError, - zksolc_utils::{ZkSolc, ZkSolcInput}, - zkvyper_utils::{ZkVyper, ZkVyperInput}, }; +#[derive(Debug, Clone, Copy)] +enum CompilerType { + Solc, + ZkSolc, + Vyper, + ZkVyper, +} + +impl CompilerType { + fn as_str(self) -> &'static str { + match self { + Self::Solc => "solc", + Self::ZkSolc => "zksolc", + Self::Vyper => "vyper", + Self::ZkVyper => "zkvyper", + } + } + + /// Returns the absolute path to the compiler binary. + fn bin_path_unchecked(self, home_dir: &Path, version: &str) -> PathBuf { + let compiler_dir = match self { + Self::Solc => "solc-bin", + Self::ZkSolc => "zksolc-bin", + Self::Vyper => "vyper-bin", + Self::ZkVyper => "zkvyper-bin", + }; + home_dir + .join("etc") + .join(compiler_dir) + .join(version) + .join(self.as_str()) + } + + async fn bin_path( + self, + home_dir: &Path, + version: &str, + ) -> Result { + let path = self.bin_path_unchecked(home_dir, version); + if !fs::try_exists(&path) + .await + .with_context(|| format!("failed accessing `{}`", self.as_str()))? + { + return Err(ContractVerifierError::UnknownCompilerVersion( + self.as_str(), + version.to_owned(), + )); + } + Ok(path) + } +} + /// Compiler versions supported by a [`CompilerResolver`]. #[derive(Debug)] pub(crate) struct SupportedCompilerVersions { @@ -48,14 +102,20 @@ pub(crate) trait CompilerResolver: fmt::Debug + Send + Sync { /// Returned errors are assumed to be fatal. async fn supported_versions(&self) -> anyhow::Result; - /// Resolves a `zksolc` compiler. + /// Resolves a `solc` compiler. async fn resolve_solc( + &self, + version: &str, + ) -> Result>, ContractVerifierError>; + + /// Resolves a `zksolc` compiler. + async fn resolve_zksolc( &self, versions: &CompilerVersions, ) -> Result>, ContractVerifierError>; /// Resolves a `zkvyper` compiler. - async fn resolve_vyper( + async fn resolve_zkvyper( &self, versions: &CompilerVersions, ) -> Result>, ContractVerifierError>; @@ -129,88 +189,44 @@ impl CompilerResolver for EnvCompilerResolver { } async fn resolve_solc( + &self, + version: &str, + ) -> Result>, ContractVerifierError> { + let solc_path = CompilerType::Solc.bin_path(&self.home_dir, version).await?; + Ok(Box::new(Solc::new(solc_path))) + } + + async fn resolve_zksolc( &self, versions: &CompilerVersions, ) -> Result>, ContractVerifierError> { let zksolc_version = versions.zk_compiler_version(); - let zksolc_path = self - .home_dir - .join("etc") - .join("zksolc-bin") - .join(&zksolc_version) - .join("zksolc"); - if !fs::try_exists(&zksolc_path) - .await - .context("failed accessing zksolc")? - { - return Err(ContractVerifierError::UnknownCompilerVersion( - "zksolc".to_owned(), - zksolc_version, - )); - } - - let solc_version = versions.compiler_version(); - let solc_path = self - .home_dir - .join("etc") - .join("solc-bin") - .join(&solc_version) - .join("solc"); - if !fs::try_exists(&solc_path) - .await - .context("failed accessing solc")? - { - return Err(ContractVerifierError::UnknownCompilerVersion( - "solc".to_owned(), - solc_version, - )); - } - + let zksolc_path = CompilerType::ZkSolc + .bin_path(&self.home_dir, zksolc_version) + .await?; + let solc_path = CompilerType::Solc + .bin_path(&self.home_dir, versions.compiler_version()) + .await?; let compiler_paths = CompilerPaths { base: solc_path, zk: zksolc_path, }; - Ok(Box::new(ZkSolc::new(compiler_paths, zksolc_version))) + Ok(Box::new(ZkSolc::new( + compiler_paths, + zksolc_version.to_owned(), + ))) } - async fn resolve_vyper( + async fn resolve_zkvyper( &self, versions: &CompilerVersions, ) -> Result>, ContractVerifierError> { - let zkvyper_version = versions.zk_compiler_version(); - let zkvyper_path = self - .home_dir - .join("etc") - .join("zkvyper-bin") - .join(&zkvyper_version) - .join("zkvyper"); - if !fs::try_exists(&zkvyper_path) - .await - .context("failed accessing zkvyper")? - { - return Err(ContractVerifierError::UnknownCompilerVersion( - "zkvyper".to_owned(), - zkvyper_version, - )); - } - - let vyper_version = versions.compiler_version(); - let vyper_path = self - .home_dir - .join("etc") - .join("vyper-bin") - .join(&vyper_version) - .join("vyper"); - if !fs::try_exists(&vyper_path) - .await - .context("failed accessing vyper")? - { - return Err(ContractVerifierError::UnknownCompilerVersion( - "vyper".to_owned(), - vyper_version, - )); - } - + let zkvyper_path = CompilerType::ZkVyper + .bin_path(&self.home_dir, versions.zk_compiler_version()) + .await?; + let vyper_path = CompilerType::Vyper + .bin_path(&self.home_dir, versions.compiler_version()) + .await?; let compiler_paths = CompilerPaths { base: vyper_path, zk: zkvyper_path, diff --git a/core/lib/contract_verifier/src/tests/mod.rs b/core/lib/contract_verifier/src/tests/mod.rs index ae7b23ebab8..f05d3155a6d 100644 --- a/core/lib/contract_verifier/src/tests/mod.rs +++ b/core/lib/contract_verifier/src/tests/mod.rs @@ -1,29 +1,145 @@ //! Tests for the contract verifier. +use std::{collections::HashMap, iter}; + +use test_casing::{test_casing, Product}; use tokio::sync::watch; use zksync_dal::Connection; use zksync_node_test_utils::{create_l1_batch, create_l2_block}; use zksync_types::{ - contract_verification_api::{CompilerVersions, VerificationIncomingRequest}, + contract_verification_api::{CompilerVersions, SourceCodeData, VerificationIncomingRequest}, get_code_key, get_known_code_key, l2::L2Tx, tx::IncludedTxLocation, Execute, L1BatchNumber, L2BlockNumber, ProtocolVersion, StorageLog, CONTRACT_DEPLOYER_ADDRESS, - H256, + H256, U256, +}; +use zksync_utils::{ + address_to_h256, + bytecode::{hash_bytecode, hash_evm_bytecode}, }; -use zksync_utils::{address_to_h256, bytecode::hash_bytecode}; use zksync_vm_interface::{tracer::ValidationTraces, TransactionExecutionMetrics, VmEvent}; use super::*; -use crate::resolver::{Compiler, SupportedCompilerVersions}; +use crate::{ + compilers::{SolcInput, ZkSolcInput, ZkVyperInput}, + resolver::{Compiler, SupportedCompilerVersions}, +}; mod real; const SOLC_VERSION: &str = "0.8.27"; const ZKSOLC_VERSION: &str = "1.5.4"; -async fn mock_deployment(storage: &mut Connection<'_, Core>, address: Address, bytecode: Vec) { +const BYTECODE_KINDS: [BytecodeMarker; 2] = [BytecodeMarker::EraVm, BytecodeMarker::Evm]; + +const COUNTER_CONTRACT: &str = r#" + contract Counter { + uint256 value; + + function increment(uint256 x) external { + value += x; + } + } +"#; +const COUNTER_CONTRACT_WITH_CONSTRUCTOR: &str = r#" + contract Counter { + uint256 value; + + constructor(uint256 _value) { + value = _value; + } + + function increment(uint256 x) external { + value += x; + } + } +"#; + +#[derive(Debug, Clone, Copy)] +enum TestContract { + Counter, + CounterWithConstructor, +} + +impl TestContract { + const ALL: [Self; 2] = [Self::Counter, Self::CounterWithConstructor]; + + fn source(self) -> &'static str { + match self { + Self::Counter => COUNTER_CONTRACT, + Self::CounterWithConstructor => COUNTER_CONTRACT_WITH_CONSTRUCTOR, + } + } + + fn constructor_args(self) -> &'static [Token] { + match self { + Self::Counter => &[], + Self::CounterWithConstructor => &[Token::Uint(U256([42, 0, 0, 0]))], + } + } +} + +/// Pads an EVM bytecode in the same ways it's done by system contracts. +fn pad_evm_bytecode(deployed_bytecode: &[u8]) -> Vec { + let mut padded = Vec::with_capacity(deployed_bytecode.len() + 32); + let len = U256::from(deployed_bytecode.len()); + padded.extend_from_slice(&[0; 32]); + len.to_big_endian(&mut padded); + padded.extend_from_slice(deployed_bytecode); + + // Pad to the 32-byte word boundary. + if padded.len() % 32 != 0 { + padded.extend(iter::repeat(0).take(32 - padded.len() % 32)); + } + assert_eq!(padded.len() % 32, 0); + + // Pad to contain the odd number of words. + if (padded.len() / 32) % 2 != 1 { + padded.extend_from_slice(&[0; 32]); + } + assert_eq!((padded.len() / 32) % 2, 1); + padded +} + +async fn mock_deployment( + storage: &mut Connection<'_, Core>, + address: Address, + bytecode: Vec, + constructor_args: &[Token], +) { let bytecode_hash = hash_bytecode(&bytecode); + let deployment = Execute::for_deploy(H256::zero(), bytecode.clone(), constructor_args); + mock_deployment_inner(storage, address, bytecode_hash, bytecode, deployment).await; +} + +async fn mock_evm_deployment( + storage: &mut Connection<'_, Core>, + address: Address, + creation_bytecode: Vec, + deployed_bytecode: &[u8], + constructor_args: &[Token], +) { + let mut calldata = creation_bytecode; + calldata.extend_from_slice(ðabi::encode(constructor_args)); + let deployment = Execute { + contract_address: None, + calldata, // FIXME: check + value: 0.into(), + factory_deps: vec![], + }; + let bytecode = pad_evm_bytecode(deployed_bytecode); + let bytecode_hash = hash_evm_bytecode(&bytecode); + mock_deployment_inner(storage, address, bytecode_hash, bytecode, deployment).await; +} + +async fn mock_deployment_inner( + storage: &mut Connection<'_, Core>, + address: Address, + bytecode_hash: H256, + bytecode: Vec, + execute: Execute, +) { let logs = [ StorageLog::new_write_log(get_code_key(&address), bytecode_hash), StorageLog::new_write_log(get_known_code_key(&bytecode_hash), H256::from_low_u64_be(1)), @@ -43,7 +159,7 @@ async fn mock_deployment(storage: &mut Connection<'_, Core>, address: Address, b .unwrap(); let mut deploy_tx = L2Tx { - execute: Execute::for_deploy(H256::zero(), bytecode, &[]), + execute, common_data: Default::default(), received_timestamp_ms: 0, raw_bytes: Some(vec![0; 128].into()), @@ -83,11 +199,13 @@ async fn mock_deployment(storage: &mut Connection<'_, Core>, address: Address, b .unwrap(); } +type SharedMockFn = + Arc Result + Send + Sync>; + #[derive(Clone)] struct MockCompilerResolver { - zksolc: Arc< - dyn Fn(ZkSolcInput) -> Result + Send + Sync, - >, + zksolc: SharedMockFn, + solc: SharedMockFn, } impl fmt::Debug for MockCompilerResolver { @@ -99,9 +217,19 @@ impl fmt::Debug for MockCompilerResolver { } impl MockCompilerResolver { - fn new(zksolc: impl Fn(ZkSolcInput) -> CompilationArtifacts + 'static + Send + Sync) -> Self { + fn zksolc( + zksolc: impl Fn(ZkSolcInput) -> CompilationArtifacts + 'static + Send + Sync, + ) -> Self { Self { zksolc: Arc::new(move |input| Ok(zksolc(input))), + solc: Arc::new(|input| panic!("unexpected solc call: {input:?}")), + } + } + + fn solc(solc: impl Fn(SolcInput) -> CompilationArtifacts + 'static + Send + Sync) -> Self { + Self { + solc: Arc::new(move |input| Ok(solc(input))), + zksolc: Arc::new(|input| panic!("unexpected zksolc call: {input:?}")), } } } @@ -116,6 +244,16 @@ impl Compiler for MockCompilerResolver { } } +#[async_trait] +impl Compiler for MockCompilerResolver { + async fn compile( + self: Box, + input: SolcInput, + ) -> Result { + (self.solc)(input) + } +} + #[async_trait] impl CompilerResolver for MockCompilerResolver { async fn supported_versions(&self) -> anyhow::Result { @@ -128,25 +266,38 @@ impl CompilerResolver for MockCompilerResolver { } async fn resolve_solc( + &self, + version: &str, + ) -> Result>, ContractVerifierError> { + if version != SOLC_VERSION { + return Err(ContractVerifierError::UnknownCompilerVersion( + "solc", + version.to_owned(), + )); + } + Ok(Box::new(self.clone())) + } + + async fn resolve_zksolc( &self, versions: &CompilerVersions, ) -> Result>, ContractVerifierError> { if versions.compiler_version() != SOLC_VERSION { return Err(ContractVerifierError::UnknownCompilerVersion( - "solc".to_owned(), - versions.compiler_version(), + "solc", + versions.compiler_version().to_owned(), )); } if versions.zk_compiler_version() != ZKSOLC_VERSION { return Err(ContractVerifierError::UnknownCompilerVersion( - "zksolc".to_owned(), - versions.zk_compiler_version(), + "zksolc", + versions.zk_compiler_version().to_owned(), )); } Ok(Box::new(self.clone())) } - async fn resolve_vyper( + async fn resolve_zkvyper( &self, _versions: &CompilerVersions, ) -> Result>, ContractVerifierError> { @@ -154,19 +305,10 @@ impl CompilerResolver for MockCompilerResolver { } } -fn test_request(address: Address) -> VerificationIncomingRequest { - let contract_source = r#" - contract Counter { - uint256 value; - - function increment(uint256 x) external { - value += x; - } - } - "#; +fn test_request(address: Address, source: &str) -> VerificationIncomingRequest { VerificationIncomingRequest { contract_address: address, - source_code_data: SourceCodeData::SolSingleFile(contract_source.into()), + source_code_data: SourceCodeData::SolSingleFile(source.into()), contract_name: "Counter".to_owned(), compiler_versions: CompilerVersions::Solc { compiler_zksolc_version: ZKSOLC_VERSION.to_owned(), @@ -213,23 +355,31 @@ async fn prepare_storage(storage: &mut Connection<'_, Core>) { .unwrap(); } +#[test_casing(2, TestContract::ALL)] #[tokio::test] -async fn contract_verifier_basics() { +async fn contract_verifier_basics(contract: TestContract) { let pool = ConnectionPool::test_pool().await; let mut storage = pool.connection().await.unwrap(); let expected_bytecode = vec![0_u8; 32]; prepare_storage(&mut storage).await; let address = Address::repeat_byte(1); - mock_deployment(&mut storage, address, expected_bytecode.clone()).await; - let req = test_request(address); + mock_deployment( + &mut storage, + address, + expected_bytecode.clone(), + contract.constructor_args(), + ) + .await; + let mut req = test_request(address, contract.source()); + req.constructor_arguments = ethabi::encode(contract.constructor_args()).into(); let request_id = storage .contract_verification_dal() .add_contract_verification_request(req) .await .unwrap(); - let mock_resolver = MockCompilerResolver::new(|input| { + let mock_resolver = MockCompilerResolver::zksolc(|input| { let ZkSolcInput::StandardJson { input, .. } = &input else { panic!("unexpected input"); }; @@ -240,6 +390,7 @@ async fn contract_verifier_basics() { CompilationArtifacts { bytecode: vec![0; 32], + deployed_bytecode: None, abi: counter_contract_abi(), } }); @@ -276,7 +427,7 @@ async fn assert_request_success( request_id: usize, address: Address, expected_bytecode: &[u8], -) { +) -> VerificationInfo { let status = storage .contract_verification_dal() .get_verification_request_status(request_id) @@ -295,15 +446,60 @@ async fn assert_request_success( .expect("no verification info"); assert_eq!(verification_info.artifacts.bytecode, *expected_bytecode); assert_eq!(verification_info.artifacts.abi, counter_contract_abi()); + verification_info } -async fn checked_env_resolver() -> Option<(EnvCompilerResolver, SupportedCompilerVersions)> { - let compiler_resolver = EnvCompilerResolver::default(); - let supported_compilers = compiler_resolver.supported_versions().await.ok()?; - if supported_compilers.zksolc.is_empty() || supported_compilers.solc.is_empty() { - return None; - } - Some((compiler_resolver, supported_compilers)) +#[test_casing(2, TestContract::ALL)] +#[tokio::test] +async fn verifying_evm_bytecode(contract: TestContract) { + let pool = ConnectionPool::test_pool().await; + let mut storage = pool.connection().await.unwrap(); + let creation_bytecode = vec![3_u8; 20]; + let deployed_bytecode = vec![5_u8; 10]; + + prepare_storage(&mut storage).await; + let address = Address::repeat_byte(1); + mock_evm_deployment( + &mut storage, + address, + creation_bytecode.clone(), + &deployed_bytecode, + contract.constructor_args(), + ) + .await; + let mut req = test_request(address, contract.source()); + req.constructor_arguments = ethabi::encode(contract.constructor_args()).into(); + let request_id = storage + .contract_verification_dal() + .add_contract_verification_request(req) + .await + .unwrap(); + + let artifacts = CompilationArtifacts { + bytecode: creation_bytecode.clone(), + deployed_bytecode: Some(deployed_bytecode), + abi: counter_contract_abi(), + }; + let mock_resolver = MockCompilerResolver::solc(move |input| { + assert_eq!(input.standard_json.language, "Solidity"); + assert_eq!(input.standard_json.sources.len(), 1); + let source = input.standard_json.sources.values().next().unwrap(); + assert!(source.content.contains("contract Counter"), "{source:?}"); + + artifacts.clone() + }); + let verifier = ContractVerifier::with_resolver( + Duration::from_secs(60), + pool.clone(), + Arc::new(mock_resolver), + ) + .await + .unwrap(); + + let (_stop_sender, stop_receiver) = watch::channel(false); + verifier.run(stop_receiver, Some(1)).await.unwrap(); + + assert_request_success(&mut storage, request_id, address, &creation_bytecode).await; } #[tokio::test] @@ -313,16 +509,17 @@ async fn bytecode_mismatch_error() { prepare_storage(&mut storage).await; let address = Address::repeat_byte(1); - mock_deployment(&mut storage, address, vec![0xff; 32]).await; - let req = test_request(address); + mock_deployment(&mut storage, address, vec![0xff; 32], &[]).await; + let req = test_request(address, COUNTER_CONTRACT); let request_id = storage .contract_verification_dal() .add_contract_verification_request(req) .await .unwrap(); - let mock_resolver = MockCompilerResolver::new(|_| CompilationArtifacts { + let mock_resolver = MockCompilerResolver::zksolc(|_| CompilationArtifacts { bytecode: vec![0; 32], + deployed_bytecode: None, abi: counter_contract_abi(), }); let verifier = ContractVerifier::with_resolver( @@ -344,8 +541,149 @@ async fn bytecode_mismatch_error() { .expect("no status"); assert_eq!(status.status, "failed"); assert!(status.compilation_errors.is_none(), "{status:?}"); - let error = status.error.unwrap(); - assert!(error.contains("bytecode"), "{error}"); + let err = status.error.unwrap(); + assert_eq!(err, ContractVerifierError::BytecodeMismatch.to_string()); +} + +#[test_casing(4, Product((TestContract::ALL, BYTECODE_KINDS)))] +#[tokio::test] +async fn args_mismatch_error(contract: TestContract, bytecode_kind: BytecodeMarker) { + let pool = ConnectionPool::test_pool().await; + let mut storage = pool.connection().await.unwrap(); + + prepare_storage(&mut storage).await; + let address = Address::repeat_byte(1); + let bytecode = vec![0_u8; 32]; + match bytecode_kind { + BytecodeMarker::EraVm => { + mock_deployment( + &mut storage, + address, + bytecode.clone(), + contract.constructor_args(), + ) + .await; + } + BytecodeMarker::Evm => { + let creation_bytecode = vec![3_u8; 48]; + mock_evm_deployment( + &mut storage, + address, + creation_bytecode, + &bytecode, + contract.constructor_args(), + ) + .await; + } + } + + let mut req = test_request(address, contract.source()); + // Intentionally encode incorrect constructor args + req.constructor_arguments = match contract { + TestContract::Counter => ethabi::encode(&[Token::Bool(true)]).into(), + TestContract::CounterWithConstructor => ethabi::encode(&[]).into(), + }; + let request_id = storage + .contract_verification_dal() + .add_contract_verification_request(req) + .await + .unwrap(); + + let mock_resolver = match bytecode_kind { + BytecodeMarker::EraVm => MockCompilerResolver::zksolc(move |_| CompilationArtifacts { + bytecode: bytecode.clone(), + deployed_bytecode: None, + abi: counter_contract_abi(), + }), + BytecodeMarker::Evm => MockCompilerResolver::solc(move |_| CompilationArtifacts { + bytecode: vec![3_u8; 48], + deployed_bytecode: Some(bytecode.clone()), + abi: counter_contract_abi(), + }), + }; + let verifier = ContractVerifier::with_resolver( + Duration::from_secs(60), + pool.clone(), + Arc::new(mock_resolver), + ) + .await + .unwrap(); + + let (_stop_sender, stop_receiver) = watch::channel(false); + verifier.run(stop_receiver, Some(1)).await.unwrap(); + + assert_constructor_args_mismatch(&mut storage, request_id).await; +} + +async fn assert_constructor_args_mismatch(storage: &mut Connection<'_, Core>, request_id: usize) { + let status = storage + .contract_verification_dal() + .get_verification_request_status(request_id) + .await + .unwrap() + .expect("no status"); + assert_eq!(status.status, "failed"); + assert_eq!(status.compilation_errors, None); + let err = status.error.unwrap(); + assert_eq!( + err, + ContractVerifierError::IncorrectConstructorArguments.to_string() + ); +} + +#[tokio::test] +async fn creation_bytecode_mismatch() { + let pool = ConnectionPool::test_pool().await; + let mut storage = pool.connection().await.unwrap(); + prepare_storage(&mut storage).await; + + let address = Address::repeat_byte(1); + let creation_bytecode = vec![3; 20]; + let deployed_bytecode = vec![5; 10]; + mock_evm_deployment( + &mut storage, + address, + creation_bytecode, + &deployed_bytecode, + &[], + ) + .await; + let req = test_request(address, COUNTER_CONTRACT); + let request_id = storage + .contract_verification_dal() + .add_contract_verification_request(req) + .await + .unwrap(); + + let mock_resolver = MockCompilerResolver::solc(move |_| CompilationArtifacts { + bytecode: vec![4; 20], // differs from `creation_bytecode` + deployed_bytecode: Some(deployed_bytecode.clone()), + abi: counter_contract_abi(), + }); + let verifier = ContractVerifier::with_resolver( + Duration::from_secs(60), + pool.clone(), + Arc::new(mock_resolver), + ) + .await + .unwrap(); + + let (_stop_sender, stop_receiver) = watch::channel(false); + verifier.run(stop_receiver, Some(1)).await.unwrap(); + + let status = storage + .contract_verification_dal() + .get_verification_request_status(request_id) + .await + .unwrap() + .expect("no status"); + assert_eq!(status.status, "failed"); + assert!(status.compilation_errors.is_none(), "{status:?}"); + let err = status.error.unwrap(); + assert_eq!( + err, + ContractVerifierError::CreationBytecodeMismatch.to_string() + ); } #[tokio::test] @@ -355,13 +693,13 @@ async fn no_compiler_version() { prepare_storage(&mut storage).await; let address = Address::repeat_byte(1); - mock_deployment(&mut storage, address, vec![0xff; 32]).await; + mock_deployment(&mut storage, address, vec![0xff; 32], &[]).await; let req = VerificationIncomingRequest { compiler_versions: CompilerVersions::Solc { compiler_zksolc_version: ZKSOLC_VERSION.to_owned(), compiler_solc_version: "1.0.0".to_owned(), // a man can dream }, - ..test_request(address) + ..test_request(address, COUNTER_CONTRACT) }; let request_id = storage .contract_verification_dal() @@ -370,7 +708,7 @@ async fn no_compiler_version() { .unwrap(); let mock_resolver = - MockCompilerResolver::new(|_| unreachable!("should reject unknown solc version")); + MockCompilerResolver::zksolc(|_| unreachable!("should reject unknown solc version")); let verifier = ContractVerifier::with_resolver( Duration::from_secs(60), pool.clone(), diff --git a/core/lib/contract_verifier/src/tests/real.rs b/core/lib/contract_verifier/src/tests/real.rs index b7acc753fd6..5f550a5feea 100644 --- a/core/lib/contract_verifier/src/tests/real.rs +++ b/core/lib/contract_verifier/src/tests/real.rs @@ -8,6 +8,41 @@ use zksync_utils::bytecode::validate_bytecode; use super::*; +#[derive(Debug)] +struct TestCompilerVersions { + solc: String, + zksolc: String, +} + +impl TestCompilerVersions { + fn new(mut versions: SupportedCompilerVersions) -> Option { + let solc = versions + .solc + .into_iter() + .find(|ver| !ver.starts_with("zkVM"))?; + Some(Self { + solc, + zksolc: versions.zksolc.pop()?, + }) + } + + fn for_zksolc(self) -> CompilerVersions { + CompilerVersions::Solc { + compiler_solc_version: self.solc, + compiler_zksolc_version: self.zksolc, + } + } +} + +async fn checked_env_resolver() -> Option<(EnvCompilerResolver, TestCompilerVersions)> { + let compiler_resolver = EnvCompilerResolver::default(); + let supported_compilers = compiler_resolver.supported_versions().await.ok()?; + Some(( + compiler_resolver, + TestCompilerVersions::new(supported_compilers)?, + )) +} + fn assert_no_compilers_expected() { assert_ne!( env::var("RUN_CONTRACT_VERIFICATION_TEST").ok().as_deref(), @@ -18,23 +53,30 @@ fn assert_no_compilers_expected() { println!("No compilers found, skipping the test"); } +/// Simplifies initializing real compiler resolver in tests. +macro_rules! real_resolver { + () => { + match checked_env_resolver().await { + Some(resolver_and_versions) => resolver_and_versions, + None => { + assert_no_compilers_expected(); + return; + } + } + }; +} + #[tokio::test] async fn using_real_compiler() { - let Some((compiler_resolver, supported_compilers)) = checked_env_resolver().await else { - assert_no_compilers_expected(); - return; - }; + let (compiler_resolver, supported_compilers) = real_resolver!(); - let versions = CompilerVersions::Solc { - compiler_zksolc_version: supported_compilers.zksolc[0].clone(), - compiler_solc_version: supported_compilers.solc[0].clone(), - }; - let compiler = compiler_resolver.resolve_solc(&versions).await.unwrap(); + let versions = supported_compilers.for_zksolc(); + let compiler = compiler_resolver.resolve_zksolc(&versions).await.unwrap(); let req = VerificationIncomingRequest { compiler_versions: versions, - ..test_request(Address::repeat_byte(1)) + ..test_request(Address::repeat_byte(1), COUNTER_CONTRACT) }; - let input = ContractVerifier::build_zksolc_input(req).unwrap(); + let input = ZkSolc::build_input(req).unwrap(); let output = compiler.compile(input).await.unwrap(); validate_bytecode(&output.bytecode).unwrap(); @@ -42,29 +84,71 @@ async fn using_real_compiler() { } #[tokio::test] -async fn using_real_compiler_in_verifier() { - let Some((compiler_resolver, supported_compilers)) = checked_env_resolver().await else { - assert_no_compilers_expected(); - return; - }; +async fn using_standalone_solc() { + let (compiler_resolver, supported_compilers) = real_resolver!(); - let versions = CompilerVersions::Solc { - compiler_zksolc_version: supported_compilers.zksolc[0].clone(), - compiler_solc_version: supported_compilers.solc[0].clone(), + let version = &supported_compilers.solc; + let compiler = compiler_resolver.resolve_solc(version).await.unwrap(); + let req = VerificationIncomingRequest { + compiler_versions: CompilerVersions::Solc { + compiler_solc_version: version.clone(), + compiler_zksolc_version: "1000.0.0".to_owned(), // not used + }, + ..test_request(Address::repeat_byte(1), COUNTER_CONTRACT) }; - let address = Address::repeat_byte(1); - let compiler = compiler_resolver.resolve_solc(&versions).await.unwrap(); + let input = Solc::build_input(req).unwrap(); + let output = compiler.compile(input).await.unwrap(); + + assert!(output.deployed_bytecode.is_some()); + assert_eq!(output.abi, counter_contract_abi()); +} + +#[test_casing(2, BYTECODE_KINDS)] +#[tokio::test] +async fn using_real_compiler_in_verifier(bytecode_kind: BytecodeMarker) { + let (compiler_resolver, supported_compilers) = real_resolver!(); + + let versions = supported_compilers.for_zksolc(); let req = VerificationIncomingRequest { compiler_versions: versions, - ..test_request(Address::repeat_byte(1)) + ..test_request(Address::repeat_byte(1), COUNTER_CONTRACT) + }; + let address = Address::repeat_byte(1); + let output = match bytecode_kind { + BytecodeMarker::EraVm => { + let compiler = compiler_resolver + .resolve_zksolc(&req.compiler_versions) + .await + .unwrap(); + let input = ZkSolc::build_input(req.clone()).unwrap(); + compiler.compile(input).await.unwrap() + } + BytecodeMarker::Evm => { + let solc_version = req.compiler_versions.compiler_version(); + let compiler = compiler_resolver.resolve_solc(solc_version).await.unwrap(); + let input = Solc::build_input(req.clone()).unwrap(); + compiler.compile(input).await.unwrap() + } }; - let input = ContractVerifier::build_zksolc_input(req.clone()).unwrap(); - let output = compiler.compile(input).await.unwrap(); let pool = ConnectionPool::test_pool().await; let mut storage = pool.connection().await.unwrap(); prepare_storage(&mut storage).await; - mock_deployment(&mut storage, address, output.bytecode.clone()).await; + match bytecode_kind { + BytecodeMarker::EraVm => { + mock_deployment(&mut storage, address, output.bytecode.clone(), &[]).await; + } + BytecodeMarker::Evm => { + mock_evm_deployment( + &mut storage, + address, + output.bytecode.clone(), + output.deployed_bytecode(), + &[], + ) + .await; + } + } let request_id = storage .contract_verification_dal() .add_contract_verification_request(req) @@ -85,28 +169,30 @@ async fn using_real_compiler_in_verifier() { assert_request_success(&mut storage, request_id, address, &output.bytecode).await; } +#[test_casing(2, BYTECODE_KINDS)] #[tokio::test] -async fn compilation_errors() { - let Some((compiler_resolver, supported_compilers)) = checked_env_resolver().await else { - assert_no_compilers_expected(); - return; - }; +async fn compilation_errors(bytecode_kind: BytecodeMarker) { + let (compiler_resolver, supported_compilers) = real_resolver!(); - let versions = CompilerVersions::Solc { - compiler_zksolc_version: supported_compilers.zksolc[0].clone(), - compiler_solc_version: supported_compilers.solc[0].clone(), - }; + let versions = supported_compilers.for_zksolc(); let address = Address::repeat_byte(1); let req = VerificationIncomingRequest { compiler_versions: versions, source_code_data: SourceCodeData::SolSingleFile("contract ???".to_owned()), - ..test_request(Address::repeat_byte(1)) + ..test_request(Address::repeat_byte(1), COUNTER_CONTRACT) }; let pool = ConnectionPool::test_pool().await; let mut storage = pool.connection().await.unwrap(); prepare_storage(&mut storage).await; - mock_deployment(&mut storage, address, vec![0; 32]).await; + match bytecode_kind { + BytecodeMarker::EraVm => { + mock_deployment(&mut storage, address, vec![0; 32], &[]).await; + } + BytecodeMarker::Evm => { + mock_evm_deployment(&mut storage, address, vec![3; 20], &[5; 10], &[]).await; + } + } let request_id = storage .contract_verification_dal() diff --git a/core/lib/dal/.sqlx/query-40a7a619ed490eb3848a45fdde787f3b5d4ba906ec9a38e10912e3c7832fc93e.json b/core/lib/dal/.sqlx/query-40a7a619ed490eb3848a45fdde787f3b5d4ba906ec9a38e10912e3c7832fc93e.json new file mode 100644 index 00000000000..1b68326b896 --- /dev/null +++ b/core/lib/dal/.sqlx/query-40a7a619ed490eb3848a45fdde787f3b5d4ba906ec9a38e10912e3c7832fc93e.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT\n factory_deps.bytecode_hash,\n factory_deps.bytecode,\n transactions.data -> 'calldata' AS \"calldata?\",\n transactions.contract_address AS \"contract_address?\"\n FROM\n (\n SELECT\n miniblock_number,\n tx_hash,\n topic3\n FROM\n events\n WHERE\n address = $1\n AND topic1 = $2\n AND topic4 = $3\n LIMIT\n 1\n ) deploy_event\n JOIN factory_deps ON factory_deps.bytecode_hash = deploy_event.topic3\n LEFT JOIN transactions ON transactions.hash = deploy_event.tx_hash\n WHERE\n deploy_event.miniblock_number <= (\n SELECT\n MAX(number)\n FROM\n miniblocks\n )\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "bytecode_hash", + "type_info": "Bytea" + }, + { + "ordinal": 1, + "name": "bytecode", + "type_info": "Bytea" + }, + { + "ordinal": 2, + "name": "calldata?", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "contract_address?", + "type_info": "Bytea" + } + ], + "parameters": { + "Left": [ + "Bytea", + "Bytea", + "Bytea" + ] + }, + "nullable": [ + false, + false, + null, + true + ] + }, + "hash": "40a7a619ed490eb3848a45fdde787f3b5d4ba906ec9a38e10912e3c7832fc93e" +} diff --git a/core/lib/dal/.sqlx/query-8ab1634beba74aaef952562a3bcc84b0dd496700a61569929dcc7602ec678b09.json b/core/lib/dal/.sqlx/query-8ab1634beba74aaef952562a3bcc84b0dd496700a61569929dcc7602ec678b09.json deleted file mode 100644 index 5869c1d37a0..00000000000 --- a/core/lib/dal/.sqlx/query-8ab1634beba74aaef952562a3bcc84b0dd496700a61569929dcc7602ec678b09.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT\n factory_deps.bytecode,\n transactions.data AS \"data?\",\n transactions.contract_address AS \"contract_address?\"\n FROM\n (\n SELECT\n miniblock_number,\n tx_hash,\n topic3\n FROM\n events\n WHERE\n address = $1\n AND topic1 = $2\n AND topic4 = $3\n LIMIT\n 1\n ) deploy_event\n JOIN factory_deps ON factory_deps.bytecode_hash = deploy_event.topic3\n LEFT JOIN transactions ON transactions.hash = deploy_event.tx_hash\n WHERE\n deploy_event.miniblock_number <= (\n SELECT\n MAX(number)\n FROM\n miniblocks\n )\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "bytecode", - "type_info": "Bytea" - }, - { - "ordinal": 1, - "name": "data?", - "type_info": "Jsonb" - }, - { - "ordinal": 2, - "name": "contract_address?", - "type_info": "Bytea" - } - ], - "parameters": { - "Left": [ - "Bytea", - "Bytea", - "Bytea" - ] - }, - "nullable": [ - false, - true, - true - ] - }, - "hash": "8ab1634beba74aaef952562a3bcc84b0dd496700a61569929dcc7602ec678b09" -} diff --git a/core/lib/dal/src/contract_verification_dal.rs b/core/lib/dal/src/contract_verification_dal.rs index 291e60a50d9..1a827545ca1 100644 --- a/core/lib/dal/src/contract_verification_dal.rs +++ b/core/lib/dal/src/contract_verification_dal.rs @@ -1,28 +1,25 @@ #![doc = include_str!("../doc/ContractVerificationDal.md")] + use std::{ fmt::{Display, Formatter}, time::Duration, }; -use anyhow::Context as _; use sqlx::postgres::types::PgInterval; -use zksync_db_connection::connection::Connection; +use zksync_db_connection::{error::SqlxContext, instrument::InstrumentExt}; use zksync_types::{ contract_verification_api::{ - DeployContractCalldata, VerificationIncomingRequest, VerificationInfo, VerificationRequest, + VerificationIncomingRequest, VerificationInfo, VerificationRequest, VerificationRequestStatus, }, - Address, CONTRACT_DEPLOYER_ADDRESS, + web3, Address, CONTRACT_DEPLOYER_ADDRESS, H256, }; use zksync_utils::address_to_h256; use zksync_vm_interface::VmEvent; -use crate::{models::storage_verification_request::StorageVerificationRequest, Core}; - -#[derive(Debug)] -pub struct ContractVerificationDal<'a, 'c> { - pub(crate) storage: &'a mut Connection<'c, Core>, -} +use crate::{ + models::storage_verification_request::StorageVerificationRequest, Connection, Core, DalResult, +}; #[derive(Debug)] enum Compiler { @@ -43,8 +40,24 @@ impl Display for Compiler { } } +#[derive(Debug)] +pub struct DeployedContractData { + pub bytecode_hash: H256, + /// Bytecode as persisted in Postgres (i.e., with additional padding for EVM bytecodes). + pub bytecode: Vec, + /// Recipient of the deployment transaction. + pub contract_address: Option
, + /// Call data for the deployment transaction. + pub calldata: Option>, +} + +#[derive(Debug)] +pub struct ContractVerificationDal<'a, 'c> { + pub(crate) storage: &'a mut Connection<'c, Core>, +} + impl ContractVerificationDal<'_, '_> { - pub async fn get_count_of_queued_verification_requests(&mut self) -> sqlx::Result { + pub async fn get_count_of_queued_verification_requests(&mut self) -> DalResult { sqlx::query!( r#" SELECT @@ -55,7 +68,8 @@ impl ContractVerificationDal<'_, '_> { status = 'queued' "# ) - .fetch_one(self.storage.conn()) + .instrument("get_count_of_queued_verification_requests") + .fetch_one(self.storage) .await .map(|row| row.count as usize) } @@ -63,7 +77,7 @@ impl ContractVerificationDal<'_, '_> { pub async fn add_contract_verification_request( &mut self, query: VerificationIncomingRequest, - ) -> sqlx::Result { + ) -> DalResult { sqlx::query!( r#" INSERT INTO @@ -99,7 +113,9 @@ impl ContractVerificationDal<'_, '_> { query.is_system, query.force_evmla, ) - .fetch_one(self.storage.conn()) + .instrument("add_contract_verification_request") + .with_arg("address", &query.contract_address) + .fetch_one(self.storage) .await .map(|row| row.id as usize) } @@ -111,7 +127,7 @@ impl ContractVerificationDal<'_, '_> { pub async fn get_next_queued_verification_request( &mut self, processing_timeout: Duration, - ) -> sqlx::Result> { + ) -> DalResult> { let processing_timeout = PgInterval { months: 0, days: 0, @@ -160,7 +176,9 @@ impl ContractVerificationDal<'_, '_> { "#, &processing_timeout ) - .fetch_optional(self.storage.conn()) + .instrument("get_next_queued_verification_request") + .with_arg("processing_timeout", &processing_timeout) + .fetch_optional(self.storage) .await? .map(Into::into); Ok(result) @@ -170,12 +188,10 @@ impl ContractVerificationDal<'_, '_> { pub async fn save_verification_info( &mut self, verification_info: VerificationInfo, - ) -> anyhow::Result<()> { - let mut transaction = self - .storage - .start_transaction() - .await - .context("start_transaction()")?; + ) -> DalResult<()> { + let mut transaction = self.storage.start_transaction().await?; + let id = verification_info.request.id; + let address = verification_info.request.req.contract_address; sqlx::query!( r#" @@ -188,10 +204,12 @@ impl ContractVerificationDal<'_, '_> { "#, verification_info.request.id as i64, ) - .execute(transaction.conn()) + .instrument("save_verification_info#set_status") + .with_arg("id", &id) + .with_arg("address", &address) + .execute(&mut transaction) .await?; - let address = verification_info.request.req.contract_address; // Serialization should always succeed. let verification_info_json = serde_json::to_value(verification_info) .expect("Failed to serialize verification info into serde_json"); @@ -209,20 +227,22 @@ impl ContractVerificationDal<'_, '_> { address.as_bytes(), &verification_info_json ) - .execute(transaction.conn()) + .instrument("save_verification_info#insert") + .with_arg("id", &id) + .with_arg("address", &address) + .execute(&mut transaction) .await?; - transaction.commit().await.context("commit()")?; - Ok(()) + transaction.commit().await } pub async fn save_verification_error( &mut self, id: usize, - error: String, - compilation_errors: serde_json::Value, - panic_message: Option, - ) -> sqlx::Result<()> { + error: &str, + compilation_errors: &serde_json::Value, + panic_message: Option<&str>, + ) -> DalResult<()> { sqlx::query!( r#" UPDATE contract_verification_requests @@ -236,11 +256,14 @@ impl ContractVerificationDal<'_, '_> { id = $1 "#, id as i64, - error.as_str(), - &compilation_errors, + error, + compilation_errors, panic_message ) - .execute(self.storage.conn()) + .instrument("save_verification_error") + .with_arg("id", &id) + .with_arg("error", &error) + .execute(self.storage) .await?; Ok(()) } @@ -248,8 +271,8 @@ impl ContractVerificationDal<'_, '_> { pub async fn get_verification_request_status( &mut self, id: usize, - ) -> anyhow::Result> { - let Some(row) = sqlx::query!( + ) -> DalResult> { + sqlx::query!( r#" SELECT status, @@ -262,41 +285,46 @@ impl ContractVerificationDal<'_, '_> { "#, id as i64, ) - .fetch_optional(self.storage.conn()) - .await? - else { - return Ok(None); - }; - - let mut compilation_errors = vec![]; - if let Some(errors) = row.compilation_errors { - for value in errors.as_array().context("expected an array")? { - compilation_errors.push(value.as_str().context("expected string")?.to_string()); + .try_map(|row| { + let mut compilation_errors = vec![]; + if let Some(errors) = row.compilation_errors { + let serde_json::Value::Array(errors) = errors else { + return Err(anyhow::anyhow!("errors are not an array")) + .decode_column("compilation_errors")?; + }; + for value in errors { + let serde_json::Value::String(err) = value else { + return Err(anyhow::anyhow!("error is not a string")) + .decode_column("compilation_errors")?; + }; + compilation_errors.push(err.to_owned()); + } } - } - Ok(Some(VerificationRequestStatus { - status: row.status, - error: row.error, - compilation_errors: if compilation_errors.is_empty() { - None - } else { - Some(compilation_errors) - }, - })) + + Ok(VerificationRequestStatus { + status: row.status, + error: row.error, + compilation_errors: (!compilation_errors.is_empty()).then_some(compilation_errors), + }) + }) + .instrument("get_verification_request_status") + .with_arg("id", &id) + .fetch_optional(self.storage) + .await } /// Returns bytecode and calldata from the contract and the transaction that created it. pub async fn get_contract_info_for_verification( &mut self, address: Address, - ) -> anyhow::Result, DeployContractCalldata)>> { + ) -> DalResult> { let address_h256 = address_to_h256(&address); - - let Some(row) = sqlx::query!( + sqlx::query!( r#" SELECT + factory_deps.bytecode_hash, factory_deps.bytecode, - transactions.data AS "data?", + transactions.data -> 'calldata' AS "calldata?", transactions.contract_address AS "contract_address?" FROM ( @@ -327,30 +355,29 @@ impl ContractVerificationDal<'_, '_> { VmEvent::DEPLOY_EVENT_SIGNATURE.as_bytes(), address_h256.as_bytes(), ) - .fetch_optional(self.storage.conn()) - .await? - else { - return Ok(None); - }; - let calldata = match row.contract_address { - Some(contract_address) if contract_address == CONTRACT_DEPLOYER_ADDRESS.0.to_vec() => { - // `row.contract_address` and `row.data` are either both `None` or both `Some(_)`. - // In this arm it's checked that `row.contract_address` is `Some(_)`, so it's safe to unwrap `row.data`. - let data: serde_json::Value = row.data.context("data missing")?; - let calldata_str: String = serde_json::from_value( - data.get("calldata").context("calldata missing")?.clone(), - ) - .context("failed parsing calldata")?; - let calldata = hex::decode(&calldata_str[2..]).context("invalid calldata")?; - DeployContractCalldata::Deploy(calldata) - } - _ => DeployContractCalldata::Ignore, - }; - Ok(Some((row.bytecode, calldata))) + .try_map(|row| { + Ok(DeployedContractData { + bytecode_hash: H256::from_slice(&row.bytecode_hash), + bytecode: row.bytecode, + contract_address: row.contract_address.as_deref().map(Address::from_slice), + calldata: row + .calldata + .map(|calldata| { + serde_json::from_value::(calldata) + .decode_column("calldata") + .map(|bytes| bytes.0) + }) + .transpose()?, + }) + }) + .instrument("get_contract_info_for_verification") + .with_arg("address", &address) + .fetch_optional(self.storage) + .await } /// Returns true if the contract has a stored contracts_verification_info. - pub async fn is_contract_verified(&mut self, address: Address) -> sqlx::Result { + pub async fn is_contract_verified(&mut self, address: Address) -> DalResult { let count = sqlx::query!( r#" SELECT @@ -362,13 +389,15 @@ impl ContractVerificationDal<'_, '_> { "#, address.as_bytes() ) - .fetch_one(self.storage.conn()) + .instrument("is_contract_verified") + .with_arg("address", &address) + .fetch_one(self.storage) .await? .count; Ok(count > 0) } - async fn get_compiler_versions(&mut self, compiler: Compiler) -> sqlx::Result> { + async fn get_compiler_versions(&mut self, compiler: Compiler) -> DalResult> { let compiler = format!("{compiler}"); let versions: Vec<_> = sqlx::query!( r#" @@ -383,7 +412,9 @@ impl ContractVerificationDal<'_, '_> { "#, &compiler ) - .fetch_all(self.storage.conn()) + .instrument("get_compiler_versions") + .with_arg("compiler", &compiler) + .fetch_all(self.storage) .await? .into_iter() .map(|row| row.version) @@ -391,19 +422,19 @@ impl ContractVerificationDal<'_, '_> { Ok(versions) } - pub async fn get_zksolc_versions(&mut self) -> sqlx::Result> { + pub async fn get_zksolc_versions(&mut self) -> DalResult> { self.get_compiler_versions(Compiler::ZkSolc).await } - pub async fn get_solc_versions(&mut self) -> sqlx::Result> { + pub async fn get_solc_versions(&mut self) -> DalResult> { self.get_compiler_versions(Compiler::Solc).await } - pub async fn get_zkvyper_versions(&mut self) -> sqlx::Result> { + pub async fn get_zkvyper_versions(&mut self) -> DalResult> { self.get_compiler_versions(Compiler::ZkVyper).await } - pub async fn get_vyper_versions(&mut self) -> sqlx::Result> { + pub async fn get_vyper_versions(&mut self) -> DalResult> { self.get_compiler_versions(Compiler::Vyper).await } @@ -411,12 +442,8 @@ impl ContractVerificationDal<'_, '_> { &mut self, compiler: Compiler, versions: Vec, - ) -> anyhow::Result<()> { - let mut transaction = self - .storage - .start_transaction() - .await - .context("start_transaction")?; + ) -> DalResult<()> { + let mut transaction = self.storage.start_transaction().await?; let compiler = format!("{compiler}"); sqlx::query!( @@ -427,7 +454,9 @@ impl ContractVerificationDal<'_, '_> { "#, &compiler ) - .execute(transaction.conn()) + .instrument("set_compiler_versions#delete") + .with_arg("compiler", &compiler) + .execute(&mut transaction) .await?; sqlx::query!( @@ -446,31 +475,33 @@ impl ContractVerificationDal<'_, '_> { &versions, &compiler, ) - .execute(transaction.conn()) + .instrument("set_compiler_versions#insert") + .with_arg("compiler", &compiler) + .with_arg("versions.len", &versions.len()) + .execute(&mut transaction) .await?; - transaction.commit().await.context("commit()")?; - Ok(()) + transaction.commit().await } - pub async fn set_zksolc_versions(&mut self, versions: Vec) -> anyhow::Result<()> { + pub async fn set_zksolc_versions(&mut self, versions: Vec) -> DalResult<()> { self.set_compiler_versions(Compiler::ZkSolc, versions).await } - pub async fn set_solc_versions(&mut self, versions: Vec) -> anyhow::Result<()> { + pub async fn set_solc_versions(&mut self, versions: Vec) -> DalResult<()> { self.set_compiler_versions(Compiler::Solc, versions).await } - pub async fn set_zkvyper_versions(&mut self, versions: Vec) -> anyhow::Result<()> { + pub async fn set_zkvyper_versions(&mut self, versions: Vec) -> DalResult<()> { self.set_compiler_versions(Compiler::ZkVyper, versions) .await } - pub async fn set_vyper_versions(&mut self, versions: Vec) -> anyhow::Result<()> { + pub async fn set_vyper_versions(&mut self, versions: Vec) -> DalResult<()> { self.set_compiler_versions(Compiler::Vyper, versions).await } - pub async fn get_all_successful_requests(&mut self) -> sqlx::Result> { + pub async fn get_all_successful_requests(&mut self) -> DalResult> { let result = sqlx::query_as!( StorageVerificationRequest, r#" @@ -494,7 +525,8 @@ impl ContractVerificationDal<'_, '_> { id "#, ) - .fetch_all(self.storage.conn()) + .instrument("get_all_successful_requests") + .fetch_all(self.storage) .await? .into_iter() .map(Into::into) @@ -505,8 +537,8 @@ impl ContractVerificationDal<'_, '_> { pub async fn get_contract_verification_info( &mut self, address: Address, - ) -> anyhow::Result> { - let Some(row) = sqlx::query!( + ) -> DalResult> { + Ok(sqlx::query!( r#" SELECT verification_info @@ -517,14 +549,100 @@ impl ContractVerificationDal<'_, '_> { "#, address.as_bytes(), ) - .fetch_optional(self.storage.conn()) + .try_map(|row| { + row.verification_info + .map(|info| serde_json::from_value(info).decode_column("verification_info")) + .transpose() + }) + .instrument("get_contract_verification_info") + .with_arg("address", &address) + .fetch_optional(self.storage) .await? - else { - return Ok(None); + .flatten()) + } +} + +#[cfg(test)] +mod tests { + use std::collections::HashMap; + + use zksync_types::{ + tx::IncludedTxLocation, Execute, L1BatchNumber, L2BlockNumber, ProtocolVersion, + }; + use zksync_utils::bytecode::hash_bytecode; + use zksync_vm_interface::{tracer::ValidationTraces, TransactionExecutionMetrics}; + + use super::*; + use crate::{ + tests::{create_l2_block_header, mock_l2_transaction}, + ConnectionPool, CoreDal, + }; + + #[tokio::test] + async fn getting_contract_info_for_verification() { + let pool = ConnectionPool::::test_pool().await; + let mut conn = pool.connection().await.unwrap(); + + conn.protocol_versions_dal() + .save_protocol_version_with_tx(&ProtocolVersion::default()) + .await + .unwrap(); + conn.blocks_dal() + .insert_l2_block(&create_l2_block_header(0)) + .await + .unwrap(); + + // Add a transaction, its bytecode and the bytecode deployment event. + let deployed_address = Address::repeat_byte(12); + let mut tx = mock_l2_transaction(); + let bytecode = vec![1; 32]; + let bytecode_hash = hash_bytecode(&bytecode); + tx.execute = Execute::for_deploy(H256::zero(), bytecode.clone(), &[]); + conn.transactions_dal() + .insert_transaction_l2( + &tx, + TransactionExecutionMetrics::default(), + ValidationTraces::default(), + ) + .await + .unwrap(); + conn.factory_deps_dal() + .insert_factory_deps( + L2BlockNumber(0), + &HashMap::from([(bytecode_hash, bytecode.clone())]), + ) + .await + .unwrap(); + let location = IncludedTxLocation { + tx_hash: tx.hash(), + tx_index_in_l2_block: 0, + tx_initiator_address: tx.initiator_account(), }; - let Some(info) = row.verification_info else { - return Ok(None); + let deploy_event = VmEvent { + location: (L1BatchNumber(0), 0), + address: CONTRACT_DEPLOYER_ADDRESS, + indexed_topics: vec![ + VmEvent::DEPLOY_EVENT_SIGNATURE, + address_to_h256(&tx.initiator_account()), + bytecode_hash, + address_to_h256(&deployed_address), + ], + value: vec![], }; - Ok(Some(serde_json::from_value(info).context("invalid info")?)) + conn.events_dal() + .save_events(L2BlockNumber(0), &[(location, vec![&deploy_event])]) + .await + .unwrap(); + + let contract = conn + .contract_verification_dal() + .get_contract_info_for_verification(deployed_address) + .await + .unwrap() + .expect("no info"); + assert_eq!(contract.bytecode_hash, bytecode_hash); + assert_eq!(contract.bytecode, bytecode); + assert_eq!(contract.contract_address, Some(CONTRACT_DEPLOYER_ADDRESS)); + assert_eq!(contract.calldata.unwrap(), tx.execute.calldata); } } diff --git a/core/lib/types/src/contract_verification_api.rs b/core/lib/types/src/contract_verification_api.rs index 8ee1d3ec649..fcaa1aa9a53 100644 --- a/core/lib/types/src/contract_verification_api.rs +++ b/core/lib/types/src/contract_verification_api.rs @@ -157,7 +157,7 @@ pub enum CompilerType { pub enum CompilerVersions { #[serde(rename_all = "camelCase")] Solc { - compiler_zksolc_version: String, + compiler_zksolc_version: String, // FIXME: optional? compiler_solc_version: String, }, #[serde(rename_all = "camelCase")] @@ -175,29 +175,29 @@ impl CompilerVersions { } } - pub fn zk_compiler_version(&self) -> String { + pub fn zk_compiler_version(&self) -> &str { match self { - CompilerVersions::Solc { + Self::Solc { compiler_zksolc_version, .. - } => compiler_zksolc_version.clone(), - CompilerVersions::Vyper { + } => compiler_zksolc_version, + Self::Vyper { compiler_zkvyper_version, .. - } => compiler_zkvyper_version.clone(), + } => compiler_zkvyper_version, } } - pub fn compiler_version(&self) -> String { + pub fn compiler_version(&self) -> &str { match self { - CompilerVersions::Solc { + Self::Solc { compiler_solc_version, .. - } => compiler_solc_version.clone(), - CompilerVersions::Vyper { + } => compiler_solc_version, + Self::Vyper { compiler_vyper_version, .. - } => compiler_vyper_version.clone(), + } => compiler_vyper_version, } } } @@ -213,10 +213,21 @@ pub struct VerificationRequest { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CompilationArtifacts { + /// In case of EVM contracts, this is the creation bytecode (`bytecode` in `solc` output). pub bytecode: Vec, + /// Deployed bytecode (`deployedBytecode` in `solc` output). Only set for EVM contracts; for EraVM contracts, the deployed bytecode + /// is always `bytecode` (i.e., there's no distinction between creation and deployed bytecodes). + #[serde(default, skip_serializing_if = "Option::is_none")] + pub deployed_bytecode: Option>, pub abi: serde_json::Value, } +impl CompilationArtifacts { + pub fn deployed_bytecode(&self) -> &[u8] { + self.deployed_bytecode.as_deref().unwrap_or(&self.bytecode) + } +} + #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct VerificationInfo { @@ -235,12 +246,6 @@ pub struct VerificationRequestStatus { pub compilation_errors: Option>, } -#[derive(Debug)] -pub enum DeployContractCalldata { - Deploy(Vec), - Ignore, -} - #[cfg(test)] mod tests { use assert_matches::assert_matches; diff --git a/core/lib/utils/Cargo.toml b/core/lib/utils/Cargo.toml index b87b2ad9896..9b65ccdd29c 100644 --- a/core/lib/utils/Cargo.toml +++ b/core/lib/utils/Cargo.toml @@ -16,6 +16,7 @@ zk_evm.workspace = true zksync_vlog.workspace = true bigdecimal.workspace = true +const-decoder.workspace = true num = { workspace = true, features = ["serde"] } serde = { workspace = true, features = ["derive"] } tokio = { workspace = true, features = ["time"] } diff --git a/core/lib/utils/src/bytecode.rs b/core/lib/utils/src/bytecode.rs index 01cce5bc34d..4fda5e9d48a 100644 --- a/core/lib/utils/src/bytecode.rs +++ b/core/lib/utils/src/bytecode.rs @@ -1,7 +1,8 @@ // FIXME: move to basic_types? +use anyhow::Context as _; use zk_evm::k256::sha2::{Digest, Sha256}; -use zksync_basic_types::H256; +use zksync_basic_types::{H256, U256}; use crate::bytes_to_chunks; @@ -98,9 +99,62 @@ pub fn hash_evm_bytecode(bytecode: &[u8]) -> H256 { H256(output) } +pub fn prepare_evm_bytecode(raw: &[u8]) -> anyhow::Result<&[u8]> { + // EVM bytecodes are prefixed with a big-endian `U256` bytecode length. + let bytecode_len_bytes = raw.get(..32).context("length < 32")?; + let bytecode_len = U256::from_big_endian(bytecode_len_bytes); + let bytecode_len: usize = bytecode_len + .try_into() + .map_err(|_| anyhow::anyhow!("length ({bytecode_len}) overflow"))?; + let bytecode = raw.get(32..(32 + bytecode_len)).with_context(|| { + format!( + "prefixed length ({bytecode_len}) exceeds real length ({})", + raw.len() - 32 + ) + })?; + // Since slicing above succeeded, this one is safe. + let padding = &raw[(32 + bytecode_len)..]; + anyhow::ensure!( + padding.iter().all(|&b| b == 0), + "bytecode padding contains non-zero bytes" + ); + Ok(bytecode) +} + +pub mod testonly { + use const_decoder::Decoder; + + pub const RAW_EVM_BYTECODE: &[u8] = &const_decoder::decode!( + Decoder::Hex, + b"00000000000000000000000000000000000000000000000000000000000001266080604052348015\ + 600e575f80fd5b50600436106030575f3560e01c8063816898ff146034578063fb5343f314604c57\ + 5b5f80fd5b604a60048036038101906046919060a6565b6066565b005b6052606f565b604051605d\ + 919060d9565b60405180910390f35b805f8190555050565b5f5481565b5f80fd5b5f819050919050\ + 565b6088816078565b81146091575f80fd5b50565b5f8135905060a0816081565b92915050565b5f\ + 6020828403121560b85760b76074565b5b5f60c3848285016094565b91505092915050565b60d381\ + 6078565b82525050565b5f60208201905060ea5f83018460cc565b9291505056fea2646970667358\ + 221220caca1247066da378f2ec77c310f2ae51576272367b4fa11cc4350af4e9ce4d0964736f6c63\ + 4300081a00330000000000000000000000000000000000000000000000000000" + ); + pub const PROCESSED_EVM_BYTECODE: &[u8] = &const_decoder::decode!( + Decoder::Hex, + b"6080604052348015600e575f80fd5b50600436106030575f3560e01c8063816898ff146034578063\ + fb5343f314604c575b5f80fd5b604a60048036038101906046919060a6565b6066565b005b605260\ + 6f565b604051605d919060d9565b60405180910390f35b805f8190555050565b5f5481565b5f80fd\ + 5b5f819050919050565b6088816078565b81146091575f80fd5b50565b5f8135905060a081608156\ + 5b92915050565b5f6020828403121560b85760b76074565b5b5f60c3848285016094565b91505092\ + 915050565b60d3816078565b82525050565b5f60208201905060ea5f83018460cc565b9291505056\ + fea2646970667358221220caca1247066da378f2ec77c310f2ae51576272367b4fa11cc4350af4e9\ + ce4d0964736f6c634300081a0033" + ); +} + #[cfg(test)] mod tests { - use super::*; + use super::{ + testonly::{PROCESSED_EVM_BYTECODE, RAW_EVM_BYTECODE}, + *, + }; #[test] fn bytecode_markers_are_valid() { @@ -115,4 +169,10 @@ mod tests { Some(BytecodeMarker::Evm) ); } + + #[test] + fn preparing_evm_bytecode() { + let prepared = prepare_evm_bytecode(RAW_EVM_BYTECODE).unwrap(); + assert_eq!(prepared, PROCESSED_EVM_BYTECODE); + } } diff --git a/core/node/api_server/Cargo.toml b/core/node/api_server/Cargo.toml index 067b9b3e372..d0723a9d23e 100644 --- a/core/node/api_server/Cargo.toml +++ b/core/node/api_server/Cargo.toml @@ -61,5 +61,4 @@ zksync_node_genesis.workspace = true zksync_node_test_utils.workspace = true assert_matches.workspace = true -const-decoder.workspace = true test-casing.workspace = true diff --git a/core/node/api_server/src/testonly.rs b/core/node/api_server/src/testonly.rs index 3add9c2f165..de650171612 100644 --- a/core/node/api_server/src/testonly.rs +++ b/core/node/api_server/src/testonly.rs @@ -2,7 +2,6 @@ use std::{collections::HashMap, iter}; -use const_decoder::Decoder; use zk_evm_1_5_0::zkevm_opcode_defs::decoding::{EncodingModeProduction, VmEncodingMode}; use zksync_contracts::{ eth_contract, get_loadnext_contract, load_contract, read_bytecode, @@ -27,30 +26,6 @@ use zksync_types::{ }; use zksync_utils::{address_to_u256, u256_to_h256}; -pub(crate) const RAW_EVM_BYTECODE: &[u8] = &const_decoder::decode!( - Decoder::Hex, - b"00000000000000000000000000000000000000000000000000000000000001266080604052348015\ - 600e575f80fd5b50600436106030575f3560e01c8063816898ff146034578063fb5343f314604c57\ - 5b5f80fd5b604a60048036038101906046919060a6565b6066565b005b6052606f565b604051605d\ - 919060d9565b60405180910390f35b805f8190555050565b5f5481565b5f80fd5b5f819050919050\ - 565b6088816078565b81146091575f80fd5b50565b5f8135905060a0816081565b92915050565b5f\ - 6020828403121560b85760b76074565b5b5f60c3848285016094565b91505092915050565b60d381\ - 6078565b82525050565b5f60208201905060ea5f83018460cc565b9291505056fea2646970667358\ - 221220caca1247066da378f2ec77c310f2ae51576272367b4fa11cc4350af4e9ce4d0964736f6c63\ - 4300081a00330000000000000000000000000000000000000000000000000000" -); -pub(crate) const PROCESSED_EVM_BYTECODE: &[u8] = &const_decoder::decode!( - Decoder::Hex, - b"6080604052348015600e575f80fd5b50600436106030575f3560e01c8063816898ff146034578063\ - fb5343f314604c575b5f80fd5b604a60048036038101906046919060a6565b6066565b005b605260\ - 6f565b604051605d919060d9565b60405180910390f35b805f8190555050565b5f5481565b5f80fd\ - 5b5f819050919050565b6088816078565b81146091575f80fd5b50565b5f8135905060a081608156\ - 5b92915050565b5f6020828403121560b85760b76074565b5b5f60c3848285016094565b91505092\ - 915050565b60d3816078565b82525050565b5f60208201905060ea5f83018460cc565b9291505056\ - fea2646970667358221220caca1247066da378f2ec77c310f2ae51576272367b4fa11cc4350af4e9\ - ce4d0964736f6c634300081a0033" -); - const EXPENSIVE_CONTRACT_PATH: &str = "etc/contracts-test-data/artifacts-zk/contracts/expensive/expensive.sol/Expensive.json"; const PRECOMPILES_CONTRACT_PATH: &str = diff --git a/core/node/api_server/src/utils.rs b/core/node/api_server/src/utils.rs index c7a1134682b..6769e773dc7 100644 --- a/core/node/api_server/src/utils.rs +++ b/core/node/api_server/src/utils.rs @@ -6,33 +6,9 @@ use std::{ time::{Duration, Instant}, }; -use anyhow::Context; use zksync_dal::{Connection, Core, DalError}; -use zksync_multivm::circuit_sequencer_api_latest::boojum::ethereum_types::U256; use zksync_web3_decl::error::Web3Error; -pub(crate) fn prepare_evm_bytecode(raw: &[u8]) -> anyhow::Result> { - // EVM bytecodes are prefixed with a big-endian `U256` bytecode length. - let bytecode_len_bytes = raw.get(..32).context("length < 32")?; - let bytecode_len = U256::from_big_endian(bytecode_len_bytes); - let bytecode_len: usize = bytecode_len - .try_into() - .map_err(|_| anyhow::anyhow!("length ({bytecode_len}) overflow"))?; - let bytecode = raw.get(32..(32 + bytecode_len)).with_context(|| { - format!( - "prefixed length ({bytecode_len}) exceeds real length ({})", - raw.len() - 32 - ) - })?; - // Since slicing above succeeded, this one is safe. - let padding = &raw[(32 + bytecode_len)..]; - anyhow::ensure!( - padding.iter().all(|&b| b == 0), - "bytecode padding contains non-zero bytes" - ); - Ok(bytecode.to_vec()) -} - /// Opens a readonly transaction over the specified connection. pub(crate) async fn open_readonly_transaction<'r>( conn: &'r mut Connection<'_, Core>, @@ -90,15 +66,3 @@ macro_rules! report_filter { ReportFilter::new($interval, &LAST_TIMESTAMP) }}; } - -#[cfg(test)] -mod tests { - use super::*; - use crate::testonly::{PROCESSED_EVM_BYTECODE, RAW_EVM_BYTECODE}; - - #[test] - fn preparing_evm_bytecode() { - let prepared = prepare_evm_bytecode(RAW_EVM_BYTECODE).unwrap(); - assert_eq!(prepared, PROCESSED_EVM_BYTECODE); - } -} diff --git a/core/node/api_server/src/web3/namespaces/eth.rs b/core/node/api_server/src/web3/namespaces/eth.rs index ee37cb989f1..e594af20d18 100644 --- a/core/node/api_server/src/web3/namespaces/eth.rs +++ b/core/node/api_server/src/web3/namespaces/eth.rs @@ -12,7 +12,10 @@ use zksync_types::{ web3::{self, Bytes, SyncInfo, SyncState}, AccountTreeId, L2BlockNumber, StorageKey, H256, L2_BASE_TOKEN_ADDRESS, U256, }; -use zksync_utils::{bytecode::BytecodeMarker, u256_to_h256}; +use zksync_utils::{ + bytecode::{prepare_evm_bytecode, BytecodeMarker}, + u256_to_h256, +}; use zksync_web3_decl::{ error::Web3Error, types::{Address, Block, Filter, FilterChanges, Log, U64}, @@ -21,7 +24,7 @@ use zksync_web3_decl::{ use crate::{ execution_sandbox::BlockArgs, tx_sender::BinarySearchKind, - utils::{open_readonly_transaction, prepare_evm_bytecode}, + utils::open_readonly_transaction, web3::{backend_jsonrpsee::MethodTracer, metrics::API_METRICS, state::RpcState, TypedFilter}, }; @@ -403,12 +406,14 @@ impl EthNamespace { // Check if the bytecode is an EVM bytecode, and if so, pre-process it correspondingly. let marker = BytecodeMarker::new(contract_code.bytecode_hash); let prepared_bytecode = if marker == Some(BytecodeMarker::Evm) { - prepare_evm_bytecode(&contract_code.bytecode).with_context(|| { - format!( - "malformed EVM bytecode at address {address:?}, hash = {:?}", - contract_code.bytecode_hash - ) - })? + prepare_evm_bytecode(&contract_code.bytecode) + .with_context(|| { + format!( + "malformed EVM bytecode at address {address:?}, hash = {:?}", + contract_code.bytecode_hash + ) + })? + .to_vec() } else { contract_code.bytecode }; diff --git a/core/node/api_server/src/web3/tests/mod.rs b/core/node/api_server/src/web3/tests/mod.rs index 17e92200d66..b35bb9f5fad 100644 --- a/core/node/api_server/src/web3/tests/mod.rs +++ b/core/node/api_server/src/web3/tests/mod.rs @@ -45,7 +45,10 @@ use zksync_types::{ U256, U64, }; use zksync_utils::{ - bytecode::{hash_bytecode, hash_evm_bytecode}, + bytecode::{ + hash_bytecode, hash_evm_bytecode, + testonly::{PROCESSED_EVM_BYTECODE, RAW_EVM_BYTECODE}, + }, u256_to_h256, }; use zksync_vm_executor::oneshot::MockOneshotExecutor; @@ -64,11 +67,7 @@ use zksync_web3_decl::{ }; use super::*; -use crate::{ - testonly::{PROCESSED_EVM_BYTECODE, RAW_EVM_BYTECODE}, - tx_sender::SandboxExecutorOptions, - web3::testonly::TestServerBuilder, -}; +use crate::{tx_sender::SandboxExecutorOptions, web3::testonly::TestServerBuilder}; mod debug; mod filters; diff --git a/prover/Cargo.lock b/prover/Cargo.lock index 8432cbb85fa..0a86a44f145 100644 --- a/prover/Cargo.lock +++ b/prover/Cargo.lock @@ -1071,6 +1071,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5241cd7938b1b415942e943ea96f615953d500b50347b505b0b507080bad5a6f" +[[package]] +name = "const-decoder" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b381abde2cdc1bc3817e394b24e05667a2dc89f37570cbd34d9c397d99e56e3f" +dependencies = [ + "compile-fmt", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -8626,6 +8635,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bigdecimal", + "const-decoder 0.4.0", "futures 0.3.30", "hex", "num", @@ -8751,7 +8761,7 @@ dependencies = [ "async-trait", "bincode", "circuit_definitions", - "const-decoder", + "const-decoder 0.3.0", "ctrlc", "futures 0.3.30", "jemallocator", diff --git a/zkstack_cli/Cargo.lock b/zkstack_cli/Cargo.lock index 7770d06a197..0f0657c6027 100644 --- a/zkstack_cli/Cargo.lock +++ b/zkstack_cli/Cargo.lock @@ -795,6 +795,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "const-decoder" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b381abde2cdc1bc3817e394b24e05667a2dc89f37570cbd34d9c397d99e56e3f" +dependencies = [ + "compile-fmt", +] + [[package]] name = "const-hex" version = "1.13.1" @@ -7009,6 +7018,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bigdecimal", + "const-decoder", "futures", "hex", "num", From 7b8640a89fa8666e14934481317c94f07280e591 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 6 Nov 2024 11:07:54 +0200 Subject: [PATCH 3/9] feat(en): Support Merkle tree recovery with pruning enabled (#3172) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ Generalizes Merkle tree recovery so that it supports recovery after the node has pruned some of its data. ## Why ❔ Improves node UX; allows to recover a tree of a full / non-archive node. ## 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`. --- ...73e86be9876cd198610e0792322e2a0797af.json} | 4 +- ...2cb2ea9f2209fe2c12dda6c72c96bdb496d3.json} | 4 +- core/lib/dal/src/storage_logs_dal.rs | 4 +- core/node/metadata_calculator/src/pruning.rs | 1 + .../metadata_calculator/src/recovery/mod.rs | 156 ++++++---- .../metadata_calculator/src/recovery/tests.rs | 266 ++++++++++++++---- core/node/metadata_calculator/src/tests.rs | 26 +- docs/guides/external-node/08_pruning.md | 6 + docs/guides/external-node/09_treeless_mode.md | 6 - 9 files changed, 352 insertions(+), 121 deletions(-) rename core/lib/dal/.sqlx/{query-0429f2fa683bdff6fc1ff5069de69d57dbfda4be1f70232afffca82a895d43e0.json => query-12c062c6a5078ebcbde378126a3773e86be9876cd198610e0792322e2a0797af.json} (50%) rename core/lib/dal/.sqlx/{query-442212bb5f28f234cd624f2acc27944b2acedce201da4454aadb79f3545713ae.json => query-2ae0541e9af1a9966585a25dfe772cb2ea9f2209fe2c12dda6c72c96bdb496d3.json} (72%) diff --git a/core/lib/dal/.sqlx/query-0429f2fa683bdff6fc1ff5069de69d57dbfda4be1f70232afffca82a895d43e0.json b/core/lib/dal/.sqlx/query-12c062c6a5078ebcbde378126a3773e86be9876cd198610e0792322e2a0797af.json similarity index 50% rename from core/lib/dal/.sqlx/query-0429f2fa683bdff6fc1ff5069de69d57dbfda4be1f70232afffca82a895d43e0.json rename to core/lib/dal/.sqlx/query-12c062c6a5078ebcbde378126a3773e86be9876cd198610e0792322e2a0797af.json index 5693bdf987e..0027377ae59 100644 --- a/core/lib/dal/.sqlx/query-0429f2fa683bdff6fc1ff5069de69d57dbfda4be1f70232afffca82a895d43e0.json +++ b/core/lib/dal/.sqlx/query-12c062c6a5078ebcbde378126a3773e86be9876cd198610e0792322e2a0797af.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n WITH\n sl AS (\n SELECT\n (\n SELECT\n ARRAY[hashed_key, value] AS kv\n FROM\n storage_logs\n WHERE\n storage_logs.miniblock_number = $1\n AND storage_logs.hashed_key >= u.start_key\n AND storage_logs.hashed_key <= u.end_key\n ORDER BY\n storage_logs.hashed_key\n LIMIT\n 1\n )\n FROM\n UNNEST($2::bytea [], $3::bytea []) AS u (start_key, end_key)\n )\n \n SELECT\n sl.kv[1] AS \"hashed_key?\",\n sl.kv[2] AS \"value?\",\n initial_writes.index\n FROM\n sl\n LEFT OUTER JOIN initial_writes ON initial_writes.hashed_key = sl.kv[1]\n ", + "query": "\n WITH\n sl AS (\n SELECT\n (\n SELECT\n ARRAY[hashed_key, value] AS kv\n FROM\n storage_logs\n WHERE\n storage_logs.miniblock_number <= $1\n AND storage_logs.hashed_key >= u.start_key\n AND storage_logs.hashed_key <= u.end_key\n ORDER BY\n storage_logs.hashed_key\n LIMIT\n 1\n )\n FROM\n UNNEST($2::bytea [], $3::bytea []) AS u (start_key, end_key)\n )\n \n SELECT\n sl.kv[1] AS \"hashed_key?\",\n sl.kv[2] AS \"value?\",\n initial_writes.index\n FROM\n sl\n LEFT OUTER JOIN initial_writes ON initial_writes.hashed_key = sl.kv[1]\n ", "describe": { "columns": [ { @@ -32,5 +32,5 @@ true ] }, - "hash": "0429f2fa683bdff6fc1ff5069de69d57dbfda4be1f70232afffca82a895d43e0" + "hash": "12c062c6a5078ebcbde378126a3773e86be9876cd198610e0792322e2a0797af" } diff --git a/core/lib/dal/.sqlx/query-442212bb5f28f234cd624f2acc27944b2acedce201da4454aadb79f3545713ae.json b/core/lib/dal/.sqlx/query-2ae0541e9af1a9966585a25dfe772cb2ea9f2209fe2c12dda6c72c96bdb496d3.json similarity index 72% rename from core/lib/dal/.sqlx/query-442212bb5f28f234cd624f2acc27944b2acedce201da4454aadb79f3545713ae.json rename to core/lib/dal/.sqlx/query-2ae0541e9af1a9966585a25dfe772cb2ea9f2209fe2c12dda6c72c96bdb496d3.json index 621295d4ab8..b706a9df437 100644 --- a/core/lib/dal/.sqlx/query-442212bb5f28f234cd624f2acc27944b2acedce201da4454aadb79f3545713ae.json +++ b/core/lib/dal/.sqlx/query-2ae0541e9af1a9966585a25dfe772cb2ea9f2209fe2c12dda6c72c96bdb496d3.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n storage_logs.hashed_key,\n storage_logs.value,\n initial_writes.index\n FROM\n storage_logs\n INNER JOIN initial_writes ON storage_logs.hashed_key = initial_writes.hashed_key\n WHERE\n storage_logs.miniblock_number = $1\n AND storage_logs.hashed_key >= $2::bytea\n AND storage_logs.hashed_key <= $3::bytea\n ORDER BY\n storage_logs.hashed_key\n ", + "query": "\n SELECT\n storage_logs.hashed_key,\n storage_logs.value,\n initial_writes.index\n FROM\n storage_logs\n INNER JOIN initial_writes ON storage_logs.hashed_key = initial_writes.hashed_key\n WHERE\n storage_logs.miniblock_number <= $1\n AND storage_logs.hashed_key >= $2::bytea\n AND storage_logs.hashed_key <= $3::bytea\n ORDER BY\n storage_logs.hashed_key\n ", "describe": { "columns": [ { @@ -32,5 +32,5 @@ false ] }, - "hash": "442212bb5f28f234cd624f2acc27944b2acedce201da4454aadb79f3545713ae" + "hash": "2ae0541e9af1a9966585a25dfe772cb2ea9f2209fe2c12dda6c72c96bdb496d3" } diff --git a/core/lib/dal/src/storage_logs_dal.rs b/core/lib/dal/src/storage_logs_dal.rs index adad6eb7e1d..ced8f594add 100644 --- a/core/lib/dal/src/storage_logs_dal.rs +++ b/core/lib/dal/src/storage_logs_dal.rs @@ -727,7 +727,7 @@ impl StorageLogsDal<'_, '_> { FROM storage_logs WHERE - storage_logs.miniblock_number = $1 + storage_logs.miniblock_number <= $1 AND storage_logs.hashed_key >= u.start_key AND storage_logs.hashed_key <= u.end_key ORDER BY @@ -784,7 +784,7 @@ impl StorageLogsDal<'_, '_> { storage_logs INNER JOIN initial_writes ON storage_logs.hashed_key = initial_writes.hashed_key WHERE - storage_logs.miniblock_number = $1 + storage_logs.miniblock_number <= $1 AND storage_logs.hashed_key >= $2::bytea AND storage_logs.hashed_key <= $3::bytea ORDER BY diff --git a/core/node/metadata_calculator/src/pruning.rs b/core/node/metadata_calculator/src/pruning.rs index abbf9bf6865..4ac05e55c30 100644 --- a/core/node/metadata_calculator/src/pruning.rs +++ b/core/node/metadata_calculator/src/pruning.rs @@ -304,6 +304,7 @@ mod tests { extend_db_state_from_l1_batch( &mut storage, snapshot_recovery.l1_batch_number + 1, + snapshot_recovery.l2_block_number + 1, new_logs, ) .await; diff --git a/core/node/metadata_calculator/src/recovery/mod.rs b/core/node/metadata_calculator/src/recovery/mod.rs index dcbc0a68af9..ce720747179 100644 --- a/core/node/metadata_calculator/src/recovery/mod.rs +++ b/core/node/metadata_calculator/src/recovery/mod.rs @@ -32,16 +32,14 @@ use std::{ }; use anyhow::Context as _; +use async_trait::async_trait; use futures::future; use tokio::sync::{watch, Mutex, Semaphore}; use zksync_dal::{Connection, ConnectionPool, Core, CoreDal}; use zksync_health_check::HealthUpdater; use zksync_merkle_tree::TreeEntry; use zksync_shared_metrics::{SnapshotRecoveryStage, APP_METRICS}; -use zksync_types::{ - snapshots::{uniform_hashed_keys_chunk, SnapshotRecoveryStatus}, - L2BlockNumber, H256, -}; +use zksync_types::{snapshots::uniform_hashed_keys_chunk, L1BatchNumber, L2BlockNumber, H256}; use super::{ helpers::{AsyncTree, AsyncTreeRecovery, GenericAsyncTree, MerkleTreeHealth}, @@ -54,12 +52,13 @@ mod tests; /// Handler of recovery life cycle events. This functionality is encapsulated in a trait to be able /// to control recovery behavior in tests. +#[async_trait] trait HandleRecoveryEvent: fmt::Debug + Send + Sync { fn recovery_started(&mut self, _chunk_count: u64, _recovered_chunk_count: u64) { // Default implementation does nothing } - fn chunk_recovered(&self) { + async fn chunk_recovered(&self) { // Default implementation does nothing } } @@ -82,6 +81,7 @@ impl<'a> RecoveryHealthUpdater<'a> { } } +#[async_trait] impl HandleRecoveryEvent for RecoveryHealthUpdater<'_> { fn recovery_started(&mut self, chunk_count: u64, recovered_chunk_count: u64) { self.chunk_count = chunk_count; @@ -91,7 +91,7 @@ impl HandleRecoveryEvent for RecoveryHealthUpdater<'_> { .set(recovered_chunk_count); } - fn chunk_recovered(&self) { + async fn chunk_recovered(&self) { let recovered_chunk_count = self.recovered_chunk_count.fetch_add(1, Ordering::SeqCst) + 1; let chunks_left = self.chunk_count.saturating_sub(recovered_chunk_count); tracing::info!( @@ -110,34 +110,68 @@ impl HandleRecoveryEvent for RecoveryHealthUpdater<'_> { } #[derive(Debug, Clone, Copy)] -struct SnapshotParameters { +struct InitParameters { + l1_batch: L1BatchNumber, l2_block: L2BlockNumber, - expected_root_hash: H256, + expected_root_hash: Option, log_count: u64, desired_chunk_size: u64, } -impl SnapshotParameters { +impl InitParameters { async fn new( pool: &ConnectionPool, - recovery: &SnapshotRecoveryStatus, config: &MetadataCalculatorRecoveryConfig, - ) -> anyhow::Result { - let l2_block = recovery.l2_block_number; - let expected_root_hash = recovery.l1_batch_root_hash; - + ) -> anyhow::Result> { let mut storage = pool.connection_tagged("metadata_calculator").await?; + let recovery_status = storage + .snapshot_recovery_dal() + .get_applied_snapshot_status() + .await?; + let pruning_info = storage.pruning_dal().get_pruning_info().await?; + + let (l1_batch, l2_block); + let mut expected_root_hash = None; + match (recovery_status, pruning_info.last_hard_pruned_l2_block) { + (Some(recovery), None) => { + tracing::warn!( + "Snapshot recovery {recovery:?} is present on the node, but pruning info is empty; assuming no pruning happened" + ); + l1_batch = recovery.l1_batch_number; + l2_block = recovery.l2_block_number; + expected_root_hash = Some(recovery.l1_batch_root_hash); + } + (Some(recovery), Some(pruned_l2_block)) => { + // We have both recovery and some pruning on top of it. + l2_block = pruned_l2_block.max(recovery.l2_block_number); + l1_batch = pruning_info + .last_hard_pruned_l1_batch + .with_context(|| format!("malformed pruning info: {pruning_info:?}"))?; + if l1_batch == recovery.l1_batch_number { + expected_root_hash = Some(recovery.l1_batch_root_hash); + } + } + (None, Some(pruned_l2_block)) => { + l2_block = pruned_l2_block; + l1_batch = pruning_info + .last_hard_pruned_l1_batch + .with_context(|| format!("malformed pruning info: {pruning_info:?}"))?; + } + (None, None) => return Ok(None), + }; + let log_count = storage .storage_logs_dal() .get_storage_logs_row_count(l2_block) .await?; - Ok(Self { + Ok(Some(Self { + l1_batch, l2_block, expected_root_hash, log_count, desired_chunk_size: config.desired_chunk_size, - }) + })) } fn chunk_count(&self) -> u64 { @@ -168,29 +202,27 @@ impl GenericAsyncTree { stop_receiver: &watch::Receiver, ) -> anyhow::Result> { let started_at = Instant::now(); - let (tree, snapshot_recovery) = match self { + let (tree, init_params) = match self { Self::Ready(tree) => return Ok(Some(tree)), Self::Recovering(tree) => { - let snapshot_recovery = get_snapshot_recovery(main_pool).await?.context( + let params = InitParameters::new(main_pool, config).await?.context( "Merkle tree is recovering, but Postgres doesn't contain snapshot recovery information", )?; let recovered_version = tree.recovered_version(); anyhow::ensure!( - u64::from(snapshot_recovery.l1_batch_number.0) == recovered_version, - "Snapshot L1 batch in Postgres ({snapshot_recovery:?}) differs from the recovered Merkle tree version \ + u64::from(params.l1_batch.0) == recovered_version, + "Snapshot L1 batch in Postgres ({params:?}) differs from the recovered Merkle tree version \ ({recovered_version})" ); - tracing::info!("Resuming tree recovery with status: {snapshot_recovery:?}"); - (tree, snapshot_recovery) + tracing::info!("Resuming tree recovery with status: {params:?}"); + (tree, params) } Self::Empty { db, mode } => { - if let Some(snapshot_recovery) = get_snapshot_recovery(main_pool).await? { - tracing::info!( - "Starting Merkle tree recovery with status {snapshot_recovery:?}" - ); - let l1_batch = snapshot_recovery.l1_batch_number; + if let Some(params) = InitParameters::new(main_pool, config).await? { + tracing::info!("Starting Merkle tree recovery with status {params:?}"); + let l1_batch = params.l1_batch; let tree = AsyncTreeRecovery::new(db, l1_batch.0.into(), mode, config)?; - (tree, snapshot_recovery) + (tree, params) } else { // Start the tree from scratch. The genesis block will be filled in `TreeUpdater::loop_updating_tree()`. return Ok(Some(AsyncTree::new(db, mode)?)); @@ -198,17 +230,16 @@ impl GenericAsyncTree { } }; - let snapshot = SnapshotParameters::new(main_pool, &snapshot_recovery, config).await?; tracing::debug!( - "Obtained snapshot parameters: {snapshot:?} based on recovery configuration {config:?}" + "Obtained recovery init parameters: {init_params:?} based on recovery configuration {config:?}" ); let recovery_options = RecoveryOptions { - chunk_count: snapshot.chunk_count(), + chunk_count: init_params.chunk_count(), concurrency_limit: recovery_pool.max_size() as usize, events: Box::new(RecoveryHealthUpdater::new(health_updater)), }; let tree = tree - .recover(snapshot, recovery_options, &recovery_pool, stop_receiver) + .recover(init_params, recovery_options, &recovery_pool, stop_receiver) .await?; if tree.is_some() { // Only report latency if recovery wasn't canceled @@ -223,12 +254,12 @@ impl GenericAsyncTree { impl AsyncTreeRecovery { async fn recover( mut self, - snapshot: SnapshotParameters, + init_params: InitParameters, mut options: RecoveryOptions<'_>, pool: &ConnectionPool, stop_receiver: &watch::Receiver, ) -> anyhow::Result> { - self.ensure_desired_chunk_size(snapshot.desired_chunk_size) + self.ensure_desired_chunk_size(init_params.desired_chunk_size) .await?; let start_time = Instant::now(); @@ -237,13 +268,15 @@ impl AsyncTreeRecovery { .map(|chunk_id| uniform_hashed_keys_chunk(chunk_id, chunk_count)) .collect(); tracing::info!( - "Recovering Merkle tree from Postgres snapshot in {chunk_count} chunks with max concurrency {}", + "Recovering Merkle tree from Postgres snapshot in {chunk_count} chunks with max concurrency {}. \ + Be aware that enabling node pruning during recovery will probably result in a recovery error; always disable pruning \ + until recovery is complete", options.concurrency_limit ); let mut storage = pool.connection_tagged("metadata_calculator").await?; let remaining_chunks = self - .filter_chunks(&mut storage, snapshot.l2_block, &chunks) + .filter_chunks(&mut storage, init_params.l2_block, &chunks) .await?; drop(storage); options @@ -261,9 +294,10 @@ impl AsyncTreeRecovery { .acquire() .await .context("semaphore is never closed")?; - if Self::recover_key_chunk(&tree, snapshot.l2_block, chunk, pool, stop_receiver).await? + if Self::recover_key_chunk(&tree, init_params.l2_block, chunk, pool, stop_receiver) + .await? { - options.events.chunk_recovered(); + options.events.chunk_recovered().await; } anyhow::Ok(()) }); @@ -279,13 +313,18 @@ impl AsyncTreeRecovery { let finalize_latency = RECOVERY_METRICS.latency[&RecoveryStage::Finalize].start(); let actual_root_hash = tree.root_hash().await; - anyhow::ensure!( - actual_root_hash == snapshot.expected_root_hash, - "Root hash of recovered tree {actual_root_hash:?} differs from expected root hash {:?}. \ - If pruning is enabled and the tree is initialized some time after node recovery, \ - this is caused by snapshot storage logs getting pruned; this setup is currently not supported", - snapshot.expected_root_hash - ); + if let Some(expected_root_hash) = init_params.expected_root_hash { + anyhow::ensure!( + actual_root_hash == expected_root_hash, + "Root hash of recovered tree {actual_root_hash:?} differs from expected root hash {expected_root_hash:?}" + ); + } + + // Check pruning info one last time before finalizing the tree. + let mut storage = pool.connection_tagged("metadata_calculator").await?; + Self::check_pruning_info(&mut storage, init_params.l2_block).await?; + drop(storage); + let tree = tree.finalize().await?; finalize_latency.observe(); tracing::info!( @@ -340,6 +379,21 @@ impl AsyncTreeRecovery { Ok(output) } + async fn check_pruning_info( + storage: &mut Connection<'_, Core>, + snapshot_l2_block: L2BlockNumber, + ) -> anyhow::Result<()> { + let pruning_info = storage.pruning_dal().get_pruning_info().await?; + if let Some(last_hard_pruned_l2_block) = pruning_info.last_hard_pruned_l2_block { + anyhow::ensure!( + last_hard_pruned_l2_block == snapshot_l2_block, + "Additional data was pruned compared to tree recovery L2 block #{snapshot_l2_block}: {pruning_info:?}. \ + Continuing recovery is impossible; to recover the tree, drop its RocksDB directory, stop pruning and restart recovery" + ); + } + Ok(()) + } + /// Returns `Ok(true)` if the chunk was recovered, `Ok(false)` if the recovery process was interrupted. async fn recover_key_chunk( tree: &Mutex, @@ -363,7 +417,9 @@ impl AsyncTreeRecovery { .storage_logs_dal() .get_tree_entries_for_l2_block(snapshot_l2_block, key_chunk.clone()) .await?; + Self::check_pruning_info(&mut storage, snapshot_l2_block).await?; drop(storage); + let entries_latency = entries_latency.observe(); tracing::debug!( "Loaded {} entries for chunk {key_chunk:?} in {entries_latency:?}", @@ -414,13 +470,3 @@ impl AsyncTreeRecovery { Ok(true) } } - -async fn get_snapshot_recovery( - pool: &ConnectionPool, -) -> anyhow::Result> { - let mut storage = pool.connection_tagged("metadata_calculator").await?; - Ok(storage - .snapshot_recovery_dal() - .get_applied_snapshot_status() - .await?) -} diff --git a/core/node/metadata_calculator/src/recovery/tests.rs b/core/node/metadata_calculator/src/recovery/tests.rs index 3861e8a5a84..1d83c2f0603 100644 --- a/core/node/metadata_calculator/src/recovery/tests.rs +++ b/core/node/metadata_calculator/src/recovery/tests.rs @@ -1,6 +1,6 @@ //! Tests for metadata calculator snapshot recovery. -use std::{path::Path, sync::Mutex}; +use std::{collections::HashMap, path::Path, sync::Mutex}; use assert_matches::assert_matches; use tempfile::TempDir; @@ -15,7 +15,7 @@ use zksync_health_check::{CheckHealth, HealthStatus, ReactiveHealthCheck}; use zksync_merkle_tree::{domain::ZkSyncTree, recovery::PersistenceThreadHandle, TreeInstruction}; use zksync_node_genesis::{insert_genesis_batch, GenesisParams}; use zksync_node_test_utils::prepare_recovery_snapshot; -use zksync_types::{L1BatchNumber, ProtocolVersionId, StorageLog}; +use zksync_types::{L1BatchNumber, U256}; use super::*; use crate::{ @@ -29,10 +29,11 @@ use crate::{ #[test] fn calculating_chunk_count() { - let mut snapshot = SnapshotParameters { + let mut snapshot = InitParameters { + l1_batch: L1BatchNumber(1), l2_block: L2BlockNumber(1), log_count: 160_000_000, - expected_root_hash: H256::zero(), + expected_root_hash: Some(H256::zero()), desired_chunk_size: 200_000, }; assert_eq!(snapshot.chunk_count(), 800); @@ -57,13 +58,15 @@ async fn create_tree_recovery( async fn basic_recovery_workflow() { let pool = ConnectionPool::::test_pool().await; let temp_dir = TempDir::new().expect("failed get temporary directory for RocksDB"); - let snapshot_recovery = prepare_recovery_snapshot_with_genesis(pool.clone(), &temp_dir).await; + let root_hash = prepare_storage_logs(pool.clone(), &temp_dir).await; + prune_storage(&pool, L1BatchNumber(1)).await; + let config = MetadataCalculatorRecoveryConfig::default(); - let snapshot = SnapshotParameters::new(&pool, &snapshot_recovery, &config) + let init_params = InitParameters::new(&pool, &config) .await - .unwrap(); - - assert!(snapshot.log_count > 200); + .unwrap() + .expect("no init params"); + assert!(init_params.log_count > 200, "{init_params:?}"); let (_stop_sender, stop_receiver) = watch::channel(false); for chunk_count in [1, 4, 9, 16, 60, 256] { @@ -78,54 +81,94 @@ async fn basic_recovery_workflow() { events: Box::new(RecoveryHealthUpdater::new(&health_updater)), }; let tree = tree - .recover(snapshot, recovery_options, &pool, &stop_receiver) + .recover(init_params, recovery_options, &pool, &stop_receiver) .await .unwrap() .expect("Tree recovery unexpectedly aborted"); - assert_eq!(tree.root_hash(), snapshot_recovery.l1_batch_root_hash); + assert_eq!(tree.root_hash(), root_hash); let health = health_check.check_health().await; assert_matches!(health.status(), HealthStatus::Affected); } } -async fn prepare_recovery_snapshot_with_genesis( - pool: ConnectionPool, - temp_dir: &TempDir, -) -> SnapshotRecoveryStatus { +async fn prepare_storage_logs(pool: ConnectionPool, temp_dir: &TempDir) -> H256 { let mut storage = pool.connection().await.unwrap(); insert_genesis_batch(&mut storage, &GenesisParams::mock()) .await .unwrap(); - let mut logs = gen_storage_logs(100..300, 1).pop().unwrap(); - - // Add all logs from the genesis L1 batch to `logs` so that they cover all state keys. - let genesis_logs = storage - .storage_logs_dal() - .get_touched_slots_for_executed_l1_batch(L1BatchNumber(0)) - .await - .unwrap(); - let genesis_logs = genesis_logs - .into_iter() - .map(|(key, value)| StorageLog::new_write_log(key, value)); - logs.extend(genesis_logs); + let logs = gen_storage_logs(100..300, 1).pop().unwrap(); extend_db_state(&mut storage, vec![logs]).await; drop(storage); // Ensure that metadata for L1 batch #1 is present in the DB. let (calculator, _) = setup_calculator(&temp_dir.path().join("init"), pool, true).await; - let l1_batch_root_hash = run_calculator(calculator).await; - - SnapshotRecoveryStatus { - l1_batch_number: L1BatchNumber(1), - l1_batch_timestamp: 1, - l1_batch_root_hash, - l2_block_number: L2BlockNumber(1), - l2_block_timestamp: 1, - l2_block_hash: H256::zero(), // not used - protocol_version: ProtocolVersionId::latest(), - storage_logs_chunks_processed: vec![], - } + run_calculator(calculator).await +} + +async fn prune_storage(pool: &ConnectionPool, pruned_l1_batch: L1BatchNumber) { + // Emulate pruning batches in the storage. + let mut storage = pool.connection().await.unwrap(); + let (_, pruned_l2_block) = storage + .blocks_dal() + .get_l2_block_range_of_l1_batch(pruned_l1_batch) + .await + .unwrap() + .expect("L1 batch not present in Postgres"); + storage + .pruning_dal() + .soft_prune_batches_range(pruned_l1_batch, pruned_l2_block) + .await + .unwrap(); + let pruning_stats = storage + .pruning_dal() + .hard_prune_batches_range(pruned_l1_batch, pruned_l2_block) + .await + .unwrap(); + assert!( + pruning_stats.deleted_l1_batches > 0 && pruning_stats.deleted_l2_blocks > 0, + "{pruning_stats:?}" + ); +} + +#[tokio::test] +async fn recovery_workflow_for_partial_pruning() { + let pool = ConnectionPool::::test_pool().await; + let temp_dir = TempDir::new().expect("failed get temporary directory for RocksDB"); + let recovery_root_hash = prepare_storage_logs(pool.clone(), &temp_dir).await; + + // Add more storage logs and prune initial logs. + let logs = gen_storage_logs(200..400, 5); + extend_db_state(&mut pool.connection().await.unwrap(), logs).await; + let (calculator, _) = setup_calculator(&temp_dir.path().join("init"), pool.clone(), true).await; + let final_root_hash = run_calculator(calculator).await; + prune_storage(&pool, L1BatchNumber(1)).await; + + let tree_path = temp_dir.path().join("recovery"); + let db = create_db(mock_config(&tree_path)).await.unwrap(); + let tree = GenericAsyncTree::Empty { + db, + mode: MerkleTreeMode::Lightweight, + }; + let (_stop_sender, stop_receiver) = watch::channel(false); + let tree = tree + .ensure_ready( + &MetadataCalculatorRecoveryConfig::default(), + &pool, + pool.clone(), + &ReactiveHealthCheck::new("tree").1, + &stop_receiver, + ) + .await + .unwrap() + .expect("Tree recovery unexpectedly aborted"); + + assert_eq!(tree.root_hash(), recovery_root_hash); + drop(tree); // Release exclusive lock on RocksDB + + // Check that tree operates as intended after recovery + let (calculator, _) = setup_calculator(&tree_path, pool, true).await; + assert_eq!(run_calculator(calculator).await, final_root_hash); } #[derive(Debug)] @@ -164,12 +207,13 @@ impl TestEventListener { } } +#[async_trait] impl HandleRecoveryEvent for TestEventListener { fn recovery_started(&mut self, _chunk_count: u64, recovered_chunk_count: u64) { assert_eq!(recovered_chunk_count, self.expected_recovered_chunks); } - fn chunk_recovered(&self) { + async fn chunk_recovered(&self) { let processed_chunk_count = self.processed_chunk_count.fetch_add(1, Ordering::SeqCst) + 1; if processed_chunk_count >= self.stop_threshold { self.stop_sender.send_replace(true); @@ -201,7 +245,8 @@ impl FaultToleranceCase { async fn recovery_fault_tolerance(chunk_count: u64, case: FaultToleranceCase) { let pool = ConnectionPool::::test_pool().await; let temp_dir = TempDir::new().expect("failed get temporary directory for RocksDB"); - let snapshot_recovery = prepare_recovery_snapshot_with_genesis(pool.clone(), &temp_dir).await; + let root_hash = prepare_storage_logs(pool.clone(), &temp_dir).await; + prune_storage(&pool, L1BatchNumber(1)).await; let tree_path = temp_dir.path().join("recovery"); let mut config = MetadataCalculatorRecoveryConfig::default(); @@ -217,18 +262,19 @@ async fn recovery_fault_tolerance(chunk_count: u64, case: FaultToleranceCase) { concurrency_limit: 1, events: Box::new(TestEventListener::new(1, stop_sender)), }; - let snapshot = SnapshotParameters::new(&pool, &snapshot_recovery, &config) + let init_params = InitParameters::new(&pool, &config) .await - .unwrap(); + .unwrap() + .expect("no init params"); assert!(tree - .recover(snapshot, recovery_options, &pool, &stop_receiver) + .recover(init_params, recovery_options, &pool, &stop_receiver) .await .unwrap() .is_none()); // Emulate a restart and recover 2 more chunks (or 1 + emulated persistence crash). let (mut tree, handle) = create_tree_recovery(&tree_path, L1BatchNumber(1), &config).await; - assert_ne!(tree.root_hash().await, snapshot_recovery.l1_batch_root_hash); + assert_ne!(tree.root_hash().await, root_hash); let (stop_sender, stop_receiver) = watch::channel(false); let mut event_listener = TestEventListener::new(2, stop_sender).expect_recovered_chunks(1); let expected_recovered_chunks = if matches!(case, FaultToleranceCase::ParallelWithCrash) { @@ -244,7 +290,7 @@ async fn recovery_fault_tolerance(chunk_count: u64, case: FaultToleranceCase) { events: Box::new(event_listener), }; let recovery_result = tree - .recover(snapshot, recovery_options, &pool, &stop_receiver) + .recover(init_params, recovery_options, &pool, &stop_receiver) .await; if matches!(case, FaultToleranceCase::ParallelWithCrash) { let err = format!("{:#}", recovery_result.unwrap_err()); @@ -255,7 +301,7 @@ async fn recovery_fault_tolerance(chunk_count: u64, case: FaultToleranceCase) { // Emulate another restart and recover remaining chunks. let (mut tree, _) = create_tree_recovery(&tree_path, L1BatchNumber(1), &config).await; - assert_ne!(tree.root_hash().await, snapshot_recovery.l1_batch_root_hash); + assert_ne!(tree.root_hash().await, root_hash); let (stop_sender, stop_receiver) = watch::channel(false); let recovery_options = RecoveryOptions { chunk_count, @@ -266,11 +312,11 @@ async fn recovery_fault_tolerance(chunk_count: u64, case: FaultToleranceCase) { ), }; let tree = tree - .recover(snapshot, recovery_options, &pool, &stop_receiver) + .recover(init_params, recovery_options, &pool, &stop_receiver) .await .unwrap() .expect("Tree recovery unexpectedly aborted"); - assert_eq!(tree.root_hash(), snapshot_recovery.l1_batch_root_hash); + assert_eq!(tree.root_hash(), root_hash); } #[derive(Debug)] @@ -345,6 +391,7 @@ async fn entire_recovery_workflow(case: RecoveryWorkflowCase) { extend_db_state_from_l1_batch( &mut storage, snapshot_recovery.l1_batch_number + 1, + snapshot_recovery.l2_block_number + 1, [new_logs.clone()], ) .await; @@ -376,3 +423,124 @@ async fn entire_recovery_workflow(case: RecoveryWorkflowCase) { stop_sender.send_replace(true); calculator_task.await.expect("calculator panicked").unwrap(); } + +/// `pruned_batches == 0` is a sanity check. +#[test_casing(4, [0, 1, 2, 4])] +#[tokio::test] +async fn recovery_with_further_pruning(pruned_batches: u32) { + const NEW_BATCH_COUNT: usize = 5; + + assert!( + (pruned_batches as usize) < NEW_BATCH_COUNT, + "at least 1 batch should remain in DB" + ); + + let pool = ConnectionPool::::test_pool().await; + let snapshot_logs = gen_storage_logs(100..300, 1).pop().unwrap(); + let mut storage = pool.connection().await.unwrap(); + let mut db_transaction = storage.start_transaction().await.unwrap(); + let snapshot_recovery = prepare_recovery_snapshot( + &mut db_transaction, + L1BatchNumber(23), + L2BlockNumber(42), + &snapshot_logs, + ) + .await; + + // Add some batches after recovery. + let logs = gen_storage_logs(200..400, NEW_BATCH_COUNT); + extend_db_state_from_l1_batch( + &mut db_transaction, + snapshot_recovery.l1_batch_number + 1, + snapshot_recovery.l2_block_number + 1, + logs, + ) + .await; + db_transaction.commit().await.unwrap(); + + let all_logs = storage + .storage_logs_dal() + .dump_all_storage_logs_for_tests() + .await; + assert_eq!(all_logs.len(), 400); + let initial_writes = storage + .storage_logs_dedup_dal() + .dump_all_initial_writes_for_tests() + .await; + let initial_writes: HashMap<_, _> = initial_writes + .into_iter() + .map(|write| (write.hashed_key, write.index)) + .collect(); + drop(storage); + + let instructions: Vec<_> = all_logs + .iter() + .map(|log| { + let leaf_index = initial_writes[&log.hashed_key]; + let key = U256::from_little_endian(log.hashed_key.as_bytes()); + TreeInstruction::write(key, leaf_index, log.value) + }) + .collect(); + let expected_root_hash = ZkSyncTree::process_genesis_batch(&instructions).root_hash; + + if pruned_batches > 0 { + prune_storage(&pool, snapshot_recovery.l1_batch_number + pruned_batches).await; + } + + // Create a new tree instance. It should recover and process the remaining batches. + let temp_dir = TempDir::new().expect("failed get temporary directory for RocksDB"); + let (calculator, _) = setup_calculator(temp_dir.path(), pool, true).await; + assert_eq!(run_calculator(calculator).await, expected_root_hash); +} + +#[derive(Debug)] +struct PruningEventListener { + pool: ConnectionPool, + pruned_l1_batch: L1BatchNumber, +} + +#[async_trait] +impl HandleRecoveryEvent for PruningEventListener { + async fn chunk_recovered(&self) { + prune_storage(&self.pool, self.pruned_l1_batch).await; + } +} + +#[tokio::test] +async fn pruning_during_recovery_is_detected() { + let pool = ConnectionPool::::test_pool().await; + let temp_dir = TempDir::new().expect("failed get temporary directory for RocksDB"); + + let mut storage = pool.connection().await.unwrap(); + insert_genesis_batch(&mut storage, &GenesisParams::mock()) + .await + .unwrap(); + let logs = gen_storage_logs(200..400, 5); + extend_db_state(&mut storage, logs).await; + drop(storage); + prune_storage(&pool, L1BatchNumber(1)).await; + + let tree_path = temp_dir.path().join("recovery"); + let config = MetadataCalculatorRecoveryConfig::default(); + let (tree, _) = create_tree_recovery(&tree_path, L1BatchNumber(1), &config).await; + let (_stop_sender, stop_receiver) = watch::channel(false); + let recovery_options = RecoveryOptions { + chunk_count: 5, + concurrency_limit: 1, + events: Box::new(PruningEventListener { + pool: pool.clone(), + pruned_l1_batch: L1BatchNumber(3), + }), + }; + let init_params = InitParameters::new(&pool, &config) + .await + .unwrap() + .expect("no init params"); + + let err = tree + .recover(init_params, recovery_options, &pool, &stop_receiver) + .await + .unwrap_err(); + let err = format!("{err:#}").to_lowercase(); + assert!(err.contains("continuing recovery is impossible"), "{err}"); +} diff --git a/core/node/metadata_calculator/src/tests.rs b/core/node/metadata_calculator/src/tests.rs index b878b0c4a53..1c003c4ecf7 100644 --- a/core/node/metadata_calculator/src/tests.rs +++ b/core/node/metadata_calculator/src/tests.rs @@ -696,7 +696,9 @@ async fn setup_calculator_with_options( object_store: Option>, ) -> MetadataCalculator { let mut storage = pool.connection().await.unwrap(); - if storage.blocks_dal().is_genesis_needed().await.unwrap() { + let pruning_info = storage.pruning_dal().get_pruning_info().await.unwrap(); + let has_pruning_logs = pruning_info.last_hard_pruned_l1_batch.is_some(); + if !has_pruning_logs && storage.blocks_dal().is_genesis_needed().await.unwrap() { insert_genesis_batch(&mut storage, &GenesisParams::mock()) .await .unwrap(); @@ -782,13 +784,26 @@ pub(super) async fn extend_db_state( .await .unwrap() .expect("no L1 batches in Postgres"); - extend_db_state_from_l1_batch(&mut storage, sealed_l1_batch + 1, new_logs).await; + let sealed_l2_block = storage + .blocks_dal() + .get_sealed_l2_block_number() + .await + .unwrap() + .expect("no L2 blocks in Postgres"); + extend_db_state_from_l1_batch( + &mut storage, + sealed_l1_batch + 1, + sealed_l2_block + 1, + new_logs, + ) + .await; storage.commit().await.unwrap(); } pub(super) async fn extend_db_state_from_l1_batch( storage: &mut Connection<'_, Core>, next_l1_batch: L1BatchNumber, + mut next_l2_block: L2BlockNumber, new_logs: impl IntoIterator>, ) { assert!(storage.in_transaction(), "must be called in DB transaction"); @@ -797,8 +812,7 @@ pub(super) async fn extend_db_state_from_l1_batch( let header = create_l1_batch(idx); let batch_number = header.number; // Assumes that L1 batch consists of only one L2 block. - let l2_block_header = create_l2_block(idx); - let l2_block_number = l2_block_header.number; + let l2_block_header = create_l2_block(next_l2_block.0); storage .blocks_dal() @@ -812,7 +826,7 @@ pub(super) async fn extend_db_state_from_l1_batch( .unwrap(); storage .storage_logs_dal() - .insert_storage_logs(l2_block_number, &batch_logs) + .insert_storage_logs(next_l2_block, &batch_logs) .await .unwrap(); storage @@ -831,6 +845,8 @@ pub(super) async fn extend_db_state_from_l1_batch( .await .unwrap(); insert_initial_writes_for_batch(storage, batch_number).await; + + next_l2_block += 1; } } diff --git a/docs/guides/external-node/08_pruning.md b/docs/guides/external-node/08_pruning.md index 7f7dfc34d4a..06bd9f8d8a9 100644 --- a/docs/guides/external-node/08_pruning.md +++ b/docs/guides/external-node/08_pruning.md @@ -53,6 +53,12 @@ be pruned after it has been executed on Ethereum. Pruning can be disabled or enabled and the data retention period can be freely changed during the node lifetime. +> [!WARNING] +> +> Pruning should be disabled when recovering the Merkle tree (e.g., if a node ran in +> [the treeless mode](09_treeless_mode.md) before, or if its tree needs a reset for whatever reason). Otherwise, tree +> recovery will with almost definitely result in an error, or worse, in a corrupted tree. + ## Storage requirements for pruned nodes The storage requirements depend on how long you configure to retain the data, but are roughly: diff --git a/docs/guides/external-node/09_treeless_mode.md b/docs/guides/external-node/09_treeless_mode.md index 59e6f6412d3..ceeea6f86c6 100644 --- a/docs/guides/external-node/09_treeless_mode.md +++ b/docs/guides/external-node/09_treeless_mode.md @@ -59,12 +59,6 @@ or not running it when initializing a node. > (order of 2–3 hours for the mainnet) because the node no longer needs to recover the Merkle tree before starting > catching up. -> [!WARNING] -> -> In contrast to the tree fetcher, the Merkle tree cannot be safely switched on after a significant delay if pruning is -> enabled (some data necessary for tree update may have been pruned while the tree was off). We plan to fix this flaw in -> the future. If pruning is disabled, the Merkle tree _can_ be freely switched on / off. - ## Monitoring tree fetcher Tree fetcher information is logged with the `zksync_node_sync::tree_data_fetcher` target. From e69d15b6a80c36a19648a8dd90f567d1e5e108e9 Mon Sep 17 00:00:00 2001 From: Manuel Mauro Date: Thu, 7 Nov 2024 04:40:22 +0100 Subject: [PATCH 4/9] feat(zkstack_cli): Use the same rust toolchain as main repo (#3230) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ Add linting target for Rust toolchains. ## Why ❔ ## 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`. --- .github/workflows/ci-core-lint-reusable.yml | 1 + rust-toolchain | 3 +- zkstack_cli/Cargo.lock | 7 ---- .../crates/zkstack/completion/_zkstack.zsh | 8 ++-- .../crates/zkstack/completion/zkstack.fish | 2 +- .../crates/zkstack/completion/zkstack.sh | 8 ++-- .../zkstack/src/commands/dev/commands/lint.rs | 42 +++++++++++++++++-- .../src/commands/dev/commands/lint_utils.rs | 1 + zkstack_cli/rust-toolchain | 3 +- 9 files changed, 54 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-core-lint-reusable.yml b/.github/workflows/ci-core-lint-reusable.yml index 0babbd1c9db..0d4db601c46 100644 --- a/.github/workflows/ci-core-lint-reusable.yml +++ b/.github/workflows/ci-core-lint-reusable.yml @@ -50,6 +50,7 @@ jobs: ci_run zkstack dev lint -t ts --check ci_run zkstack dev lint -t rs --check ci_run zkstack dev lint -t autocompletion --check + ci_run zkstack dev lint -t rust-toolchain - name: Check Database run: | diff --git a/rust-toolchain b/rust-toolchain index 03c040b91f1..bc5d1d6bbd8 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1,2 @@ -nightly-2024-08-01 +[toolchain] +channel = "nightly-2024-08-01" diff --git a/zkstack_cli/Cargo.lock b/zkstack_cli/Cargo.lock index 0f0657c6027..a9089719714 100644 --- a/zkstack_cli/Cargo.lock +++ b/zkstack_cli/Cargo.lock @@ -1097,7 +1097,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -6808,11 +6807,6 @@ dependencies = [ "rand", "secrecy", "serde", - "strum", - "strum_macros", - "time", - "url", - "vise", "zksync_basic_types", "zksync_concurrency", "zksync_consensus_utils", @@ -6962,7 +6956,6 @@ dependencies = [ "secrecy", "serde_json", "serde_yaml", - "time", "tracing", "zksync_basic_types", "zksync_config", diff --git a/zkstack_cli/crates/zkstack/completion/_zkstack.zsh b/zkstack_cli/crates/zkstack/completion/_zkstack.zsh index f1cfc994673..825fc967e6d 100644 --- a/zkstack_cli/crates/zkstack/completion/_zkstack.zsh +++ b/zkstack_cli/crates/zkstack/completion/_zkstack.zsh @@ -1255,8 +1255,8 @@ esac ;; (lint) _arguments "${_arguments_options[@]}" : \ -'*-t+[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ -'*--targets=[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ +'*-t+[]:TARGETS:(md sol js ts rs contracts autocompletion rust-toolchain)' \ +'*--targets=[]:TARGETS:(md sol js ts rs contracts autocompletion rust-toolchain)' \ '--chain=[Chain to use]:CHAIN:_default' \ '-c[]' \ '--check[]' \ @@ -1309,8 +1309,8 @@ _arguments "${_arguments_options[@]}" : \ ;; (prettier) _arguments "${_arguments_options[@]}" : \ -'*-t+[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ -'*--targets=[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ +'*-t+[]:TARGETS:(md sol js ts rs contracts autocompletion rust-toolchain)' \ +'*--targets=[]:TARGETS:(md sol js ts rs contracts autocompletion rust-toolchain)' \ '--chain=[Chain to use]:CHAIN:_default' \ '-v[Verbose mode]' \ '--verbose[Verbose mode]' \ diff --git a/zkstack_cli/crates/zkstack/completion/zkstack.fish b/zkstack_cli/crates/zkstack/completion/zkstack.fish index a1261082e6f..7ad4e6959f9 100644 --- a/zkstack_cli/crates/zkstack/completion/zkstack.fish +++ b/zkstack_cli/crates/zkstack/completion/zkstack.fish @@ -368,7 +368,7 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and __fish_seen_sub complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and __fish_seen_subcommand_from snapshot" -s h -l help -d 'Print help' complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and __fish_seen_subcommand_from snapshot" -f -a "create" complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and __fish_seen_subcommand_from snapshot" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and __fish_seen_subcommand_from lint" -s t -l targets -r -f -a "{md\t'',sol\t'',js\t'',ts\t'',rs\t'',contracts\t'',autocompletion\t''}" +complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and __fish_seen_subcommand_from lint" -s t -l targets -r -f -a "{md\t'',sol\t'',js\t'',ts\t'',rs\t'',contracts\t'',autocompletion\t'',rust-toolchain\t''}" complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and __fish_seen_subcommand_from lint" -l chain -d 'Chain to use' -r complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and __fish_seen_subcommand_from lint" -s c -l check complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and __fish_seen_subcommand_from lint" -s v -l verbose -d 'Verbose mode' diff --git a/zkstack_cli/crates/zkstack/completion/zkstack.sh b/zkstack_cli/crates/zkstack/completion/zkstack.sh index 7cdb20ae9aa..ff351ebd79e 100644 --- a/zkstack_cli/crates/zkstack/completion/zkstack.sh +++ b/zkstack_cli/crates/zkstack/completion/zkstack.sh @@ -3104,11 +3104,11 @@ _zkstack() { fi case "${prev}" in --targets) - COMPREPLY=($(compgen -W "md sol js ts rs contracts autocompletion" -- "${cur}")) + COMPREPLY=($(compgen -W "md sol js ts rs contracts autocompletion rust-toolchain" -- "${cur}")) return 0 ;; -t) - COMPREPLY=($(compgen -W "md sol js ts rs contracts autocompletion" -- "${cur}")) + COMPREPLY=($(compgen -W "md sol js ts rs contracts autocompletion rust-toolchain" -- "${cur}")) return 0 ;; --chain) @@ -3768,11 +3768,11 @@ _zkstack() { fi case "${prev}" in --targets) - COMPREPLY=($(compgen -W "md sol js ts rs contracts autocompletion" -- "${cur}")) + COMPREPLY=($(compgen -W "md sol js ts rs contracts autocompletion rust-toolchain" -- "${cur}")) return 0 ;; -t) - COMPREPLY=($(compgen -W "md sol js ts rs contracts autocompletion" -- "${cur}")) + COMPREPLY=($(compgen -W "md sol js ts rs contracts autocompletion rust-toolchain" -- "${cur}")) return 0 ;; --chain) 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 d018859a8ff..04955726706 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint.rs @@ -41,6 +41,7 @@ pub fn run(shell: &Shell, args: LintArgs) -> anyhow::Result<()> { Target::Ts, Target::Contracts, Target::Autocompletion, + Target::RustToolchain, ] } else { args.targets.clone() @@ -55,6 +56,7 @@ pub fn run(shell: &Shell, args: LintArgs) -> anyhow::Result<()> { Target::Rs => lint_rs(shell, &ecosystem, args.check)?, Target::Contracts => lint_contracts(shell, &ecosystem, args.check)?, Target::Autocompletion => lint_autocompletion_files(shell, args.check)?, + Target::RustToolchain => check_rust_toolchain(shell)?, ext => lint(shell, &ecosystem, &ext, args.check)?, } } @@ -70,13 +72,18 @@ fn lint_rs(shell: &Shell, ecosystem: &EcosystemConfig, check: bool) -> anyhow::R let link_to_code = &ecosystem.link_to_code; let lint_to_prover = &ecosystem.link_to_code.join("prover"); let link_to_zkstack = &ecosystem.link_to_code.join("zkstack_cli"); - let paths = vec![link_to_code, lint_to_prover, link_to_zkstack]; spinner.freeze(); - for path in paths { + for path in [link_to_code, lint_to_prover, link_to_zkstack] { let _dir_guard = shell.push_dir(path); let mut cmd = cmd!(shell, "cargo clippy"); - let common_args = &["--locked", "--", "-D", "warnings"]; + let mut common_args = vec!["--locked", "--", "-D", "warnings"]; + + if !path.ends_with("prover") { + common_args.push("-D"); + common_args.push("unstable-features"); + } + if !check { cmd = cmd.args(&["--fix", "--allow-dirty"]); } @@ -87,6 +94,34 @@ fn lint_rs(shell: &Shell, ecosystem: &EcosystemConfig, check: bool) -> anyhow::R Ok(()) } +fn check_rust_toolchain(shell: &Shell) -> anyhow::Result<()> { + // deserialize /zkstack_cli/rust-toolchain as TOML + let path = Path::new("zkstack_cli/rust-toolchain"); + if !path.exists() { + logger::info("WARNING: Please run this command from the project's root folder"); + return Ok(()); + } + let contents = shell.read_file(path)?; + let zkstack_cli_toolchain: toml::Value = toml::from_str(&contents)?; + + // deserialize /rust-toolchain as TOML + let path = Path::new("rust-toolchain"); + let contents = shell.read_file(path)?; + let zksync_era_toolchain: toml::Value = toml::from_str(&contents)?; + + // check if the toolchains are the same + if zksync_era_toolchain["toolchain"]["channel"] != zkstack_cli_toolchain["toolchain"]["channel"] + { + bail!( + "The Rust toolchains are not the same: ZKsync Era: {} - ZK Stack CLI: {}", + zksync_era_toolchain["toolchain"]["channel"], + zkstack_cli_toolchain["toolchain"]["channel"] + ); + } + + Ok(()) +} + fn get_linter(target: &Target) -> Vec { match target { Target::Rs => vec!["cargo".to_string(), "clippy".to_string()], @@ -96,6 +131,7 @@ fn get_linter(target: &Target) -> Vec { Target::Ts => vec!["eslint".to_string(), "--ext".to_string(), "ts".to_string()], Target::Contracts => vec![], Target::Autocompletion => vec![], + Target::RustToolchain => vec![], } } diff --git a/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint_utils.rs b/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint_utils.rs index 11a32504710..93184de7656 100644 --- a/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint_utils.rs +++ b/zkstack_cli/crates/zkstack/src/commands/dev/commands/lint_utils.rs @@ -15,6 +15,7 @@ pub enum Target { Rs, Contracts, Autocompletion, + RustToolchain, } #[derive(Deserialize, Serialize, Debug)] diff --git a/zkstack_cli/rust-toolchain b/zkstack_cli/rust-toolchain index 03c040b91f1..bc5d1d6bbd8 100644 --- a/zkstack_cli/rust-toolchain +++ b/zkstack_cli/rust-toolchain @@ -1 +1,2 @@ -nightly-2024-08-01 +[toolchain] +channel = "nightly-2024-08-01" From 942e335d71d87e791e8de377f329660225af46b0 Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Thu, 7 Nov 2024 15:08:06 -0300 Subject: [PATCH 5/9] Make contract_verifier:init:run async --- .../crates/zkstack/src/commands/chain/contract_verifier/init.rs | 2 +- .../crates/zkstack/src/commands/chain/contract_verifier/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/init.rs b/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/init.rs index ffa2bfd470b..8cfe019a53c 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/init.rs @@ -7,7 +7,7 @@ use xshell::{cmd, Shell}; use super::args::{init::InitContractVerifierArgs, releases::Version}; use crate::messages::{msg_binary_already_exists, msg_downloading_binary_spinner}; -pub(crate) fn run(shell: &Shell, args: InitContractVerifierArgs) -> anyhow::Result<()> { +pub(crate) async fn run(shell: &Shell, args: InitContractVerifierArgs) -> anyhow::Result<()> { let args = args.fill_values_with_prompt(shell)?; let chain = ZkStackConfig::load_current_chain(shell)?; let link_to_code = chain.link_to_code; diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/mod.rs index 3e3d9b266e8..f70c75202f8 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/mod.rs @@ -17,6 +17,6 @@ pub enum ContractVerifierCommands { pub(crate) async fn run(shell: &Shell, args: ContractVerifierCommands) -> anyhow::Result<()> { match args { ContractVerifierCommands::Run => run::run(shell).await, - ContractVerifierCommands::Init(args) => init::run(shell, args), + ContractVerifierCommands::Init(args) => init::run(shell, args).await, } } From 1a6f628cfd2e27bad0ee2bab6f2bf72ac2f35e11 Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Thu, 7 Nov 2024 15:10:09 -0300 Subject: [PATCH 6/9] Remove use messages:self --- .../crates/zkstack/src/commands/chain/consensus/mod.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/consensus/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/consensus/mod.rs index 4894f0b2551..d8ca6762def 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/consensus/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/consensus/mod.rs @@ -19,10 +19,7 @@ use xshell::Shell; use zksync_consensus_crypto::ByteFmt; use zksync_consensus_roles::{attester, validator}; -use crate::{ - messages::{self}, - utils::consensus::parse_attester_committee, -}; +use crate::{messages, utils::consensus::parse_attester_committee}; mod conv; mod proto; From f6fb8bfdb4c44d2a5d086e3a8f0123f0fc2b3c6c Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Thu, 7 Nov 2024 15:13:23 -0300 Subject: [PATCH 7/9] Remove _zkstack.zsh --- .gitignore | 1 + _zkstack.zsh | 5094 -------------------------------------- zkstack_cli/_zkstack.zsh | 5092 ------------------------------------- 3 files changed, 1 insertion(+), 10186 deletions(-) delete mode 100644 _zkstack.zsh delete mode 100644 zkstack_cli/_zkstack.zsh diff --git a/.gitignore b/.gitignore index adf3b779961..b02c7e79e13 100644 --- a/.gitignore +++ b/.gitignore @@ -120,3 +120,4 @@ configs/* era-observability/ core/tests/ts-integration/deployments-zk transactions/ +_zkstack.zsh diff --git a/_zkstack.zsh b/_zkstack.zsh deleted file mode 100644 index 0c812a5f5b3..00000000000 --- a/_zkstack.zsh +++ /dev/null @@ -1,5094 +0,0 @@ -#compdef zkstack - -autoload -U is-at-least - -_zkstack() { - typeset -A opt_args - typeset -a _arguments_options - local ret=1 - - if is-at-least 5.2; then - _arguments_options=(-s -S -C) - else - _arguments_options=(-s -C) - fi - - local context curcontext="$curcontext" state line - _arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -'-V[Print version]' \ -'--version[Print version]' \ -":: :_zkstack_commands" \ -"*::: :->zkstack" \ -&& ret=0 - case $state in - (zkstack) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-command-$line[1]:" - case $line[1] in - (autocomplete) -_arguments "${_arguments_options[@]}" : \ -'--generate=[The shell to generate the autocomplete script for]:GENERATOR:(bash elvish fish powershell zsh)' \ -'-o+[The out directory to write the autocomplete script to]:OUT:_files' \ -'--out=[The out directory to write the autocomplete script to]:OUT:_files' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(ecosystem) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__ecosystem_commands" \ -"*::: :->ecosystem" \ -&& ret=0 - - case $state in - (ecosystem) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-ecosystem-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -'--ecosystem-name=[]:ECOSYSTEM_NAME:_default' \ -'--l1-network=[L1 Network]:L1_NETWORK:(localhost sepolia holesky mainnet)' \ -'--link-to-code=[Code link]:LINK_TO_CODE:_files -/' \ -'--chain-name=[]:CHAIN_NAME:_default' \ -'--chain-id=[Chain ID]:CHAIN_ID:_default' \ -'--prover-mode=[Prover options]:PROVER_MODE:(no-proofs gpu)' \ -'--wallet-creation=[Wallet options]:WALLET_CREATION:((localhost\:"Load wallets from localhost mnemonic, they are funded for localhost env" -random\:"Generate random wallets" -empty\:"Generate placeholder wallets" -in-file\:"Specify file with wallets"))' \ -'--wallet-path=[Wallet path]:WALLET_PATH:_files' \ -'--l1-batch-commit-data-generator-mode=[Commit data generation mode]:L1_BATCH_COMMIT_DATA_GENERATOR_MODE:(rollup validium)' \ -'--base-token-address=[Base token address]:BASE_TOKEN_ADDRESS:_default' \ -'--base-token-price-nominator=[Base token nominator]:BASE_TOKEN_PRICE_NOMINATOR:_default' \ -'--base-token-price-denominator=[Base token denominator]:BASE_TOKEN_PRICE_DENOMINATOR:_default' \ -'--set-as-default=[Set as default chain]' \ -'--evm-emulator=[Enable EVM emulator]' \ -'--l1-network=[L1 Network]:L1_NETWORK:(localhost sepolia holesky mainnet)' \ -'--start-containers=[Start reth and postgres containers after creation]' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--legacy-bridge[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -'--sender=[Address of the transaction sender]:SENDER:_default' \ -'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ -'-o+[Output directory for the generated files]:OUT:_files' \ -'--out=[Output directory for the generated files]:OUT:_files' \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -'--deploy-erc20=[Deploy ERC20 contracts]' \ -'--deploy-ecosystem=[Deploy ecosystem contracts]' \ -'--ecosystem-contracts-path=[Path to ecosystem contracts]:ECOSYSTEM_CONTRACTS_PATH:_files' \ -'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--deploy-paymaster=[Deploy Paymaster contract]' \ -'--server-db-url=[Server database url without database name]:SERVER_DB_URL:_default' \ -'--server-db-name=[Server database name]:SERVER_DB_NAME:_default' \ -'-o+[Enable Grafana]' \ -'--observability=[Enable Grafana]' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-d[]' \ -'--dont-drop[]' \ -'--ecosystem-only[Initialize ecosystem only and skip chain initialization (chain can be initialized later with \`chain init\` subcommand)]' \ -'--dev[Use defaults for all options and flags. Suitable for local development]' \ -'--no-port-reallocation[Do not reallocate ports]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(change-default-chain) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -'::name:_default' \ -&& ret=0 -;; -(setup-observability) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__ecosystem__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-ecosystem-help-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(change-default-chain) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup-observability) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(chain) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__chain_commands" \ -"*::: :->chain" \ -&& ret=0 - - case $state in - (chain) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -'--chain-name=[]:CHAIN_NAME:_default' \ -'--chain-id=[Chain ID]:CHAIN_ID:_default' \ -'--prover-mode=[Prover options]:PROVER_MODE:(no-proofs gpu)' \ -'--wallet-creation=[Wallet options]:WALLET_CREATION:((localhost\:"Load wallets from localhost mnemonic, they are funded for localhost env" -random\:"Generate random wallets" -empty\:"Generate placeholder wallets" -in-file\:"Specify file with wallets"))' \ -'--wallet-path=[Wallet path]:WALLET_PATH:_files' \ -'--l1-batch-commit-data-generator-mode=[Commit data generation mode]:L1_BATCH_COMMIT_DATA_GENERATOR_MODE:(rollup validium)' \ -'--base-token-address=[Base token address]:BASE_TOKEN_ADDRESS:_default' \ -'--base-token-price-nominator=[Base token nominator]:BASE_TOKEN_PRICE_NOMINATOR:_default' \ -'--base-token-price-denominator=[Base token denominator]:BASE_TOKEN_PRICE_DENOMINATOR:_default' \ -'--set-as-default=[Set as default chain]' \ -'--evm-emulator=[Enable EVM emulator]' \ -'--l1-network=[L1 Network]:L1_NETWORK:(localhost sepolia holesky mainnet)' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--legacy-bridge[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -'-o+[Output directory for the generated files]:OUT:_files' \ -'--out=[Output directory for the generated files]:OUT:_files' \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--server-db-url=[Server database url without database name]:SERVER_DB_URL:_default' \ -'--server-db-name=[Server database name]:SERVER_DB_NAME:_default' \ -'--deploy-paymaster=[]' \ -'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-d[]' \ -'--dont-drop[]' \ -'--no-port-reallocation[Do not reallocate ports]' \ -'--dev[Use defaults for all options and flags. Suitable for local development]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -":: :_zkstack__chain__init_commands" \ -"*::: :->init" \ -&& ret=0 - - case $state in - (init) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-init-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -'--server-db-url=[Server database url without database name]:SERVER_DB_URL:_default' \ -'--server-db-name=[Server database name]:SERVER_DB_NAME:_default' \ -'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-d[Use default database urls and names]' \ -'--dev[Use default database urls and names]' \ -'-d[]' \ -'--dont-drop[]' \ -'--no-port-reallocation[Do not reallocate ports]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__init__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-init-help-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(genesis) -_arguments "${_arguments_options[@]}" : \ -'--server-db-url=[Server database url without database name]:SERVER_DB_URL:_default' \ -'--server-db-name=[Server database name]:SERVER_DB_NAME:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-d[Use default database urls and names]' \ -'--dev[Use default database urls and names]' \ -'-d[]' \ -'--dont-drop[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__chain__genesis_commands" \ -"*::: :->genesis" \ -&& ret=0 - - case $state in - (genesis) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-genesis-command-$line[1]:" - case $line[1] in - (init-database) -_arguments "${_arguments_options[@]}" : \ -'--server-db-url=[Server database url without database name]:SERVER_DB_URL:_default' \ -'--server-db-name=[Server database name]:SERVER_DB_NAME:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-d[Use default database urls and names]' \ -'--dev[Use default database urls and names]' \ -'-d[]' \ -'--dont-drop[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__genesis__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-genesis-help-command-$line[1]:" - case $line[1] in - (init-database) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(register-chain) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(deploy-l2-contracts) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(accept-chain-ownership) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(initialize-bridges) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(deploy-consensus-registry) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(deploy-multicall3) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(deploy-upgrader) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(deploy-paymaster) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(update-token-multiplier-setter) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -'*--components=[Components of server to run]:COMPONENTS:_default' \ -'*-a+[Additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[Additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--genesis[Run server in genesis mode]' \ -'--build[Build server but don'\''t run it]' \ -'--uring[Enables uring support for RocksDB]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(contract-verifier) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__chain__contract-verifier_commands" \ -"*::: :->contract-verifier" \ -&& ret=0 - - case $state in - (contract-verifier) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-contract-verifier-command-$line[1]:" - case $line[1] in - (run) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -'--zksolc-version=[Version of zksolc to install]:ZKSOLC_VERSION:_default' \ -'--zkvyper-version=[Version of zkvyper to install]:ZKVYPER_VERSION:_default' \ -'--solc-version=[Version of solc to install]:SOLC_VERSION:_default' \ -'--era-vm-solc-version=[Version of era vm solc to install]:ERA_VM_SOLC_VERSION:_default' \ -'--vyper-version=[Version of vyper to install]:VYPER_VERSION:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--only[Install only provided compilers]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__contract-verifier__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-contract-verifier-help-command-$line[1]:" - case $line[1] in - (run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(consensus) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__chain__consensus_commands" \ -"*::: :->consensus" \ -&& ret=0 - - case $state in - (consensus) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-consensus-command-$line[1]:" - case $line[1] in - (set-attester-committee) -_arguments "${_arguments_options[@]}" : \ -'--from-file=[Sets the attester committee in the consensus registry contract to the committee in the yaml file. File format is definied in \`commands/consensus/proto/mod.proto\`]:FROM_FILE:_files' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--from-genesis[Sets the attester committee in the consensus registry contract to \`consensus.genesis_spec.attesters\` in general.yaml]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(get-attester-committee) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__consensus__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-consensus-help-command-$line[1]:" - case $line[1] in - (set-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(get-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-help-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__help__init_commands" \ -"*::: :->init" \ -&& ret=0 - - case $state in - (init) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-help-init-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(genesis) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__help__genesis_commands" \ -"*::: :->genesis" \ -&& ret=0 - - case $state in - (genesis) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-help-genesis-command-$line[1]:" - case $line[1] in - (init-database) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(register-chain) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-l2-contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(accept-chain-ownership) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(initialize-bridges) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-consensus-registry) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-multicall3) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-upgrader) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-paymaster) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(update-token-multiplier-setter) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contract-verifier) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__help__contract-verifier_commands" \ -"*::: :->contract-verifier" \ -&& ret=0 - - case $state in - (contract-verifier) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-help-contract-verifier-command-$line[1]:" - case $line[1] in - (run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(consensus) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__help__consensus_commands" \ -"*::: :->consensus" \ -&& ret=0 - - case $state in - (consensus) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-help-consensus-command-$line[1]:" - case $line[1] in - (set-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(get-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(dev) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev_commands" \ -"*::: :->dev" \ -&& ret=0 - - case $state in - (dev) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-command-$line[1]:" - case $line[1] in - (database) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__database_commands" \ -"*::: :->database" \ -&& ret=0 - - case $state in - (database) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-database-command-$line[1]:" - case $line[1] in - (check-sqlx-data) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(drop) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(migrate) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(new-migration) -_arguments "${_arguments_options[@]}" : \ -'--database=[Database to create new migration for]:DATABASE:(prover core)' \ -'--name=[Migration name]:NAME:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(prepare) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(reset) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(setup) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__database__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-database-help-command-$line[1]:" - case $line[1] in - (check-sqlx-data) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(drop) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(migrate) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(new-migration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prepare) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(reset) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(test) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__test_commands" \ -"*::: :->test" \ -&& ret=0 - - case $state in - (test) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-test-command-$line[1]:" - case $line[1] in - (integration) -_arguments "${_arguments_options[@]}" : \ -'-t+[Run just the tests matching a pattern. Same as the -t flag on jest.]:TEST_PATTERN:_default' \ -'--test-pattern=[Run just the tests matching a pattern. Same as the -t flag on jest.]:TEST_PATTERN:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-e[Run tests for external node]' \ -'--external-node[Run tests for external node]' \ -'-n[Do not install or build dependencies]' \ -'--no-deps[Do not install or build dependencies]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(fees) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-n[Do not install or build dependencies]' \ -'--no-deps[Do not install or build dependencies]' \ -'--no-kill[The test will not kill all the nodes during execution]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(revert) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--enable-consensus[Enable consensus]' \ -'-e[Run tests for external node]' \ -'--external-node[Run tests for external node]' \ -'-n[Do not install or build dependencies]' \ -'--no-deps[Do not install or build dependencies]' \ -'--no-kill[The test will not kill all the nodes during execution]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(recovery) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-s[Run recovery from a snapshot instead of genesis]' \ -'--snapshot[Run recovery from a snapshot instead of genesis]' \ -'-n[Do not install or build dependencies]' \ -'--no-deps[Do not install or build dependencies]' \ -'--no-kill[The test will not kill all the nodes during execution]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(upgrade) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-n[Do not install or build dependencies]' \ -'--no-deps[Do not install or build dependencies]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(build) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(rust) -_arguments "${_arguments_options[@]}" : \ -'--options=[Cargo test flags]:OPTIONS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(l1-contracts) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(wallet) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(loadtest) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__test__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-test-help-command-$line[1]:" - case $line[1] in - (integration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(fees) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(revert) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(recovery) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(upgrade) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(rust) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(l1-contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(wallet) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(loadtest) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(clean) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__clean_commands" \ -"*::: :->clean" \ -&& ret=0 - - case $state in - (clean) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-clean-command-$line[1]:" - case $line[1] in - (all) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(contracts-cache) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__clean__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-clean-help-command-$line[1]:" - case $line[1] in - (all) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contracts-cache) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(snapshot) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__snapshot_commands" \ -"*::: :->snapshot" \ -&& ret=0 - - case $state in - (snapshot) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-snapshot-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__snapshot__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-snapshot-help-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(lint) -_arguments "${_arguments_options[@]}" : \ -'*-t+[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ -'*--targets=[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-c[]' \ -'--check[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(fmt) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-c[]' \ -'--check[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__fmt_commands" \ -"*::: :->fmt" \ -&& ret=0 - - case $state in - (fmt) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-fmt-command-$line[1]:" - case $line[1] in - (rustfmt) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(contract) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(prettier) -_arguments "${_arguments_options[@]}" : \ -'*-t+[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ -'*--targets=[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__fmt__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-fmt-help-command-$line[1]:" - case $line[1] in - (rustfmt) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contract) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prettier) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__prover_commands" \ -"*::: :->prover" \ -&& ret=0 - - case $state in - (prover) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-prover-command-$line[1]:" - case $line[1] in - (info) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(insert-batch) -_arguments "${_arguments_options[@]}" : \ -'--number=[]:NUMBER:_default' \ -'--version=[]:VERSION:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--default[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(insert-version) -_arguments "${_arguments_options[@]}" : \ -'--version=[]:VERSION:_default' \ -'--snark-wrapper=[]:SNARK_WRAPPER:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--default[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__prover__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-prover-help-command-$line[1]:" - case $line[1] in - (info) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-batch) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-version) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(contracts) -_arguments "${_arguments_options[@]}" : \ -'--l1-contracts=[Build L1 contracts]' \ -'--l2-contracts=[Build L2 contracts]' \ -'--system-contracts=[Build system contracts]' \ -'--test-contracts=[Build test contracts]' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(config-writer) -_arguments "${_arguments_options[@]}" : \ -'-p+[Path to the config file to override]:PATH:_default' \ -'--path=[Path to the config file to override]:PATH:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(send-transactions) -_arguments "${_arguments_options[@]}" : \ -'--file=[]:FILE:_files' \ -'--private-key=[]:PRIVATE_KEY:_default' \ -'--l1-rpc-url=[]:L1_RPC_URL:_default' \ -'--confirmations=[]:CONFIRMATIONS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(status) -_arguments "${_arguments_options[@]}" : \ -'-u+[URL of the health check endpoint]:URL:_default' \ -'--url=[URL of the health check endpoint]:URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__status_commands" \ -"*::: :->status" \ -&& ret=0 - - case $state in - (status) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-status-command-$line[1]:" - case $line[1] in - (ports) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__status__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-status-help-command-$line[1]:" - case $line[1] in - (ports) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(generate-genesis) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-command-$line[1]:" - case $line[1] in - (database) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__database_commands" \ -"*::: :->database" \ -&& ret=0 - - case $state in - (database) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-database-command-$line[1]:" - case $line[1] in - (check-sqlx-data) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(drop) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(migrate) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(new-migration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prepare) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(reset) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(test) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__test_commands" \ -"*::: :->test" \ -&& ret=0 - - case $state in - (test) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-test-command-$line[1]:" - case $line[1] in - (integration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(fees) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(revert) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(recovery) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(upgrade) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(rust) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(l1-contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(wallet) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(loadtest) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(clean) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__clean_commands" \ -"*::: :->clean" \ -&& ret=0 - - case $state in - (clean) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-clean-command-$line[1]:" - case $line[1] in - (all) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contracts-cache) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(snapshot) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__snapshot_commands" \ -"*::: :->snapshot" \ -&& ret=0 - - case $state in - (snapshot) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-snapshot-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(lint) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(fmt) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__fmt_commands" \ -"*::: :->fmt" \ -&& ret=0 - - case $state in - (fmt) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-fmt-command-$line[1]:" - case $line[1] in - (rustfmt) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contract) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prettier) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__prover_commands" \ -"*::: :->prover" \ -&& ret=0 - - case $state in - (prover) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-prover-command-$line[1]:" - case $line[1] in - (info) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-batch) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-version) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(config-writer) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(send-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(status) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__status_commands" \ -"*::: :->status" \ -&& ret=0 - - case $state in - (status) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-status-command-$line[1]:" - case $line[1] in - (ports) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(generate-genesis) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__prover_commands" \ -"*::: :->prover" \ -&& ret=0 - - case $state in - (prover) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-prover-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -'--proof-store-dir=[]:PROOF_STORE_DIR:_default' \ -'--bucket-base-url=[]:BUCKET_BASE_URL:_default' \ -'--credentials-file=[]:CREDENTIALS_FILE:_default' \ -'--bucket-name=[]:BUCKET_NAME:_default' \ -'--location=[]:LOCATION:_default' \ -'--project-id=[]:PROJECT_ID:_default' \ -'--shall-save-to-public-bucket=[]:SHALL_SAVE_TO_PUBLIC_BUCKET:(true false)' \ -'--public-store-dir=[]:PUBLIC_STORE_DIR:_default' \ -'--public-bucket-base-url=[]:PUBLIC_BUCKET_BASE_URL:_default' \ -'--public-credentials-file=[]:PUBLIC_CREDENTIALS_FILE:_default' \ -'--public-bucket-name=[]:PUBLIC_BUCKET_NAME:_default' \ -'--public-location=[]:PUBLIC_LOCATION:_default' \ -'--public-project-id=[]:PUBLIC_PROJECT_ID:_default' \ -'(--clone)--bellman-cuda-dir=[]:BELLMAN_CUDA_DIR:_default' \ -'--bellman-cuda=[]' \ -'--setup-compressor-key=[]' \ -'--path=[]:PATH:_default' \ -'--region=[]:REGION:(us europe asia)' \ -'--mode=[]:MODE:(download generate)' \ -'--setup-keys=[]' \ -'--setup-database=[]:SETUP_DATABASE:(true false)' \ -'--prover-db-url=[Prover database url without database name]:PROVER_DB_URL:_default' \ -'--prover-db-name=[Prover database name]:PROVER_DB_NAME:_default' \ -'-u+[Use default database urls and names]:USE_DEFAULT:(true false)' \ -'--use-default=[Use default database urls and names]:USE_DEFAULT:(true false)' \ -'-d+[]:DONT_DROP:(true false)' \ -'--dont-drop=[]:DONT_DROP:(true false)' \ -'--cloud-type=[]:CLOUD_TYPE:(gcp local)' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--dev[]' \ -'(--bellman-cuda-dir)--clone[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(setup-keys) -_arguments "${_arguments_options[@]}" : \ -'--region=[]:REGION:(us europe asia)' \ -'--mode=[]:MODE:(download generate)' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -'--component=[]:COMPONENT:(gateway witness-generator witness-vector-generator prover circuit-prover compressor prover-job-monitor)' \ -'--round=[]:ROUND:(all-rounds basic-circuits leaf-aggregation node-aggregation recursion-tip scheduler)' \ -'--threads=[]:THREADS:_default' \ -'--max-allocation=[Memory allocation limit in bytes (for prover component)]:MAX_ALLOCATION:_default' \ -'--witness-vector-generator-count=[]:WITNESS_VECTOR_GENERATOR_COUNT:_default' \ -'--max-allocation=[]:MAX_ALLOCATION:_default' \ -'--docker=[]:DOCKER:(true false)' \ -'--tag=[]:TAG:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(init-bellman-cuda) -_arguments "${_arguments_options[@]}" : \ -'(--clone)--bellman-cuda-dir=[]:BELLMAN_CUDA_DIR:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'(--bellman-cuda-dir)--clone[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(compressor-keys) -_arguments "${_arguments_options[@]}" : \ -'--path=[]:PATH:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__prover__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-prover-help-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup-keys) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init-bellman-cuda) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(compressor-keys) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(external-node) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__external-node_commands" \ -"*::: :->external-node" \ -&& ret=0 - - case $state in - (external-node) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-external-node-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -'--db-url=[]:DB_URL:_default' \ -'--db-name=[]:DB_NAME:_default' \ -'--l1-rpc-url=[]:L1_RPC_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-u[Use default database urls and names]' \ -'--use-default[Use default database urls and names]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -'*--components=[Components of server to run]:COMPONENTS:_default' \ -'--enable-consensus=[Enable consensus]' \ -'*-a+[Additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[Additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--reinit[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__external-node__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-external-node-help-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -'-o+[Enable Grafana]' \ -'--observability=[Enable Grafana]' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(portal) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(explorer) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__explorer_commands" \ -"*::: :->explorer" \ -&& ret=0 - - case $state in - (explorer) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-explorer-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(run-backend) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__explorer__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-explorer-help-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run-backend) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(update) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-c[Update only the config files]' \ -'--only-config[Update only the config files]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(markdown) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-command-$line[1]:" - case $line[1] in - (autocomplete) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(ecosystem) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__ecosystem_commands" \ -"*::: :->ecosystem" \ -&& ret=0 - - case $state in - (ecosystem) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-ecosystem-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(change-default-chain) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup-observability) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(chain) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__chain_commands" \ -"*::: :->chain" \ -&& ret=0 - - case $state in - (chain) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-chain-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__chain__init_commands" \ -"*::: :->init" \ -&& ret=0 - - case $state in - (init) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-chain-init-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(genesis) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__chain__genesis_commands" \ -"*::: :->genesis" \ -&& ret=0 - - case $state in - (genesis) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-chain-genesis-command-$line[1]:" - case $line[1] in - (init-database) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(register-chain) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-l2-contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(accept-chain-ownership) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(initialize-bridges) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-consensus-registry) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-multicall3) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-upgrader) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-paymaster) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(update-token-multiplier-setter) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contract-verifier) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__chain__contract-verifier_commands" \ -"*::: :->contract-verifier" \ -&& ret=0 - - case $state in - (contract-verifier) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-chain-contract-verifier-command-$line[1]:" - case $line[1] in - (run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(consensus) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__chain__consensus_commands" \ -"*::: :->consensus" \ -&& ret=0 - - case $state in - (consensus) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-chain-consensus-command-$line[1]:" - case $line[1] in - (set-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(get-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(dev) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev_commands" \ -"*::: :->dev" \ -&& ret=0 - - case $state in - (dev) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-command-$line[1]:" - case $line[1] in - (database) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__database_commands" \ -"*::: :->database" \ -&& ret=0 - - case $state in - (database) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-database-command-$line[1]:" - case $line[1] in - (check-sqlx-data) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(drop) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(migrate) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(new-migration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prepare) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(reset) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(test) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__test_commands" \ -"*::: :->test" \ -&& ret=0 - - case $state in - (test) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-test-command-$line[1]:" - case $line[1] in - (integration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(fees) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(revert) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(recovery) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(upgrade) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(rust) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(l1-contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(wallet) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(loadtest) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(clean) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__clean_commands" \ -"*::: :->clean" \ -&& ret=0 - - case $state in - (clean) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-clean-command-$line[1]:" - case $line[1] in - (all) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contracts-cache) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(snapshot) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__snapshot_commands" \ -"*::: :->snapshot" \ -&& ret=0 - - case $state in - (snapshot) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-snapshot-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(lint) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(fmt) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__fmt_commands" \ -"*::: :->fmt" \ -&& ret=0 - - case $state in - (fmt) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-fmt-command-$line[1]:" - case $line[1] in - (rustfmt) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contract) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prettier) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__prover_commands" \ -"*::: :->prover" \ -&& ret=0 - - case $state in - (prover) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-prover-command-$line[1]:" - case $line[1] in - (info) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-batch) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-version) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(config-writer) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(send-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(status) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__status_commands" \ -"*::: :->status" \ -&& ret=0 - - case $state in - (status) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-status-command-$line[1]:" - case $line[1] in - (ports) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(generate-genesis) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__prover_commands" \ -"*::: :->prover" \ -&& ret=0 - - case $state in - (prover) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-prover-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup-keys) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init-bellman-cuda) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(compressor-keys) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(external-node) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__external-node_commands" \ -"*::: :->external-node" \ -&& ret=0 - - case $state in - (external-node) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-external-node-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(portal) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(explorer) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__explorer_commands" \ -"*::: :->explorer" \ -&& ret=0 - - case $state in - (explorer) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-explorer-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run-backend) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(update) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(markdown) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -} - -(( $+functions[_zkstack_commands] )) || -_zkstack_commands() { - local commands; commands=( -'autocomplete:Create shell autocompletion files' \ -'ecosystem:Ecosystem related commands' \ -'chain:Chain related commands' \ -'dev:Supervisor related commands' \ -'prover:Prover related commands' \ -'external-node:External Node related commands' \ -'containers:Run containers for local development' \ -'portal:Run dapp-portal' \ -'explorer:Run block-explorer' \ -'update:Update ZKsync' \ -'markdown:Print markdown help' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack commands' commands "$@" -} -(( $+functions[_zkstack__autocomplete_commands] )) || -_zkstack__autocomplete_commands() { - local commands; commands=() - _describe -t commands 'zkstack autocomplete commands' commands "$@" -} -(( $+functions[_zkstack__chain_commands] )) || -_zkstack__chain_commands() { - local commands; commands=( -'create:Create a new chain, setting the necessary configurations for later initialization' \ -'build-transactions:Create unsigned transactions for chain deployment' \ -'init:Initialize chain, deploying necessary contracts and performing on-chain operations' \ -'genesis:Run server genesis' \ -'register-chain:Register a new chain on L1 (executed by L1 governor). This command deploys and configures Governance, ChainAdmin, and DiamondProxy contracts, registers chain with BridgeHub and sets pending admin for DiamondProxy. Note\: After completion, L2 governor can accept ownership by running \`accept-chain-ownership\`' \ -'deploy-l2-contracts:Deploy all L2 contracts (executed by L1 governor)' \ -'accept-chain-ownership:Accept ownership of L2 chain (executed by L2 governor). This command should be run after \`register-chain\` to accept ownership of newly created DiamondProxy contract' \ -'initialize-bridges:Initialize bridges on L2' \ -'deploy-consensus-registry:Deploy L2 consensus registry' \ -'deploy-multicall3:Deploy L2 multicall3' \ -'deploy-upgrader:Deploy Default Upgrader' \ -'deploy-paymaster:Deploy paymaster smart contract' \ -'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ -'server:Run server' \ -'contract-verifier:Run contract verifier' \ -'consensus:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain commands' commands "$@" -} -(( $+functions[_zkstack__chain__accept-chain-ownership_commands] )) || -_zkstack__chain__accept-chain-ownership_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain accept-chain-ownership commands' commands "$@" -} -(( $+functions[_zkstack__chain__build-transactions_commands] )) || -_zkstack__chain__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus_commands] )) || -_zkstack__chain__consensus_commands() { - local commands; commands=( -'set-attester-committee:Sets the attester committee in the consensus registry contract to \`consensus.genesis_spec.attesters\` in general.yaml' \ -'get-attester-committee:Fetches the attester committee from the consensus registry contract' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain consensus commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__get-attester-committee_commands] )) || -_zkstack__chain__consensus__get-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain consensus get-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__help_commands] )) || -_zkstack__chain__consensus__help_commands() { - local commands; commands=( -'set-attester-committee:Sets the attester committee in the consensus registry contract to \`consensus.genesis_spec.attesters\` in general.yaml' \ -'get-attester-committee:Fetches the attester committee from the consensus registry contract' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain consensus help commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__help__get-attester-committee_commands] )) || -_zkstack__chain__consensus__help__get-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain consensus help get-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__help__help_commands] )) || -_zkstack__chain__consensus__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain consensus help help commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__help__set-attester-committee_commands] )) || -_zkstack__chain__consensus__help__set-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain consensus help set-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__set-attester-committee_commands] )) || -_zkstack__chain__consensus__set-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain consensus set-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier_commands] )) || -_zkstack__chain__contract-verifier_commands() { - local commands; commands=( -'run:Run contract verifier' \ -'init:Download required binaries for contract verifier' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain contract-verifier commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__help_commands] )) || -_zkstack__chain__contract-verifier__help_commands() { - local commands; commands=( -'run:Run contract verifier' \ -'init:Download required binaries for contract verifier' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain contract-verifier help commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__help__help_commands] )) || -_zkstack__chain__contract-verifier__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain contract-verifier help help commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__help__init_commands] )) || -_zkstack__chain__contract-verifier__help__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain contract-verifier help init commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__help__run_commands] )) || -_zkstack__chain__contract-verifier__help__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain contract-verifier help run commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__init_commands] )) || -_zkstack__chain__contract-verifier__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain contract-verifier init commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__run_commands] )) || -_zkstack__chain__contract-verifier__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain contract-verifier run commands' commands "$@" -} -(( $+functions[_zkstack__chain__create_commands] )) || -_zkstack__chain__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain create commands' commands "$@" -} -(( $+functions[_zkstack__chain__deploy-consensus-registry_commands] )) || -_zkstack__chain__deploy-consensus-registry_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain deploy-consensus-registry commands' commands "$@" -} -(( $+functions[_zkstack__chain__deploy-l2-contracts_commands] )) || -_zkstack__chain__deploy-l2-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain deploy-l2-contracts commands' commands "$@" -} -(( $+functions[_zkstack__chain__deploy-multicall3_commands] )) || -_zkstack__chain__deploy-multicall3_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain deploy-multicall3 commands' commands "$@" -} -(( $+functions[_zkstack__chain__deploy-paymaster_commands] )) || -_zkstack__chain__deploy-paymaster_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain deploy-paymaster commands' commands "$@" -} -(( $+functions[_zkstack__chain__deploy-upgrader_commands] )) || -_zkstack__chain__deploy-upgrader_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain deploy-upgrader commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis_commands] )) || -_zkstack__chain__genesis_commands() { - local commands; commands=( -'init-database:Initialize databases' \ -'server:Runs server genesis' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain genesis commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__help_commands] )) || -_zkstack__chain__genesis__help_commands() { - local commands; commands=( -'init-database:Initialize databases' \ -'server:Runs server genesis' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain genesis help commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__help__help_commands] )) || -_zkstack__chain__genesis__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain genesis help help commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__help__init-database_commands] )) || -_zkstack__chain__genesis__help__init-database_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain genesis help init-database commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__help__server_commands] )) || -_zkstack__chain__genesis__help__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain genesis help server commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__init-database_commands] )) || -_zkstack__chain__genesis__init-database_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain genesis init-database commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__server_commands] )) || -_zkstack__chain__genesis__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain genesis server commands' commands "$@" -} -(( $+functions[_zkstack__chain__help_commands] )) || -_zkstack__chain__help_commands() { - local commands; commands=( -'create:Create a new chain, setting the necessary configurations for later initialization' \ -'build-transactions:Create unsigned transactions for chain deployment' \ -'init:Initialize chain, deploying necessary contracts and performing on-chain operations' \ -'genesis:Run server genesis' \ -'register-chain:Register a new chain on L1 (executed by L1 governor). This command deploys and configures Governance, ChainAdmin, and DiamondProxy contracts, registers chain with BridgeHub and sets pending admin for DiamondProxy. Note\: After completion, L2 governor can accept ownership by running \`accept-chain-ownership\`' \ -'deploy-l2-contracts:Deploy all L2 contracts (executed by L1 governor)' \ -'accept-chain-ownership:Accept ownership of L2 chain (executed by L2 governor). This command should be run after \`register-chain\` to accept ownership of newly created DiamondProxy contract' \ -'initialize-bridges:Initialize bridges on L2' \ -'deploy-consensus-registry:Deploy L2 consensus registry' \ -'deploy-multicall3:Deploy L2 multicall3' \ -'deploy-upgrader:Deploy Default Upgrader' \ -'deploy-paymaster:Deploy paymaster smart contract' \ -'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ -'server:Run server' \ -'contract-verifier:Run contract verifier' \ -'consensus:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain help commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__accept-chain-ownership_commands] )) || -_zkstack__chain__help__accept-chain-ownership_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help accept-chain-ownership commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__build-transactions_commands] )) || -_zkstack__chain__help__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__consensus_commands] )) || -_zkstack__chain__help__consensus_commands() { - local commands; commands=( -'set-attester-committee:Sets the attester committee in the consensus registry contract to \`consensus.genesis_spec.attesters\` in general.yaml' \ -'get-attester-committee:Fetches the attester committee from the consensus registry contract' \ - ) - _describe -t commands 'zkstack chain help consensus commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__consensus__get-attester-committee_commands] )) || -_zkstack__chain__help__consensus__get-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help consensus get-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__consensus__set-attester-committee_commands] )) || -_zkstack__chain__help__consensus__set-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help consensus set-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__contract-verifier_commands] )) || -_zkstack__chain__help__contract-verifier_commands() { - local commands; commands=( -'run:Run contract verifier' \ -'init:Download required binaries for contract verifier' \ - ) - _describe -t commands 'zkstack chain help contract-verifier commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__contract-verifier__init_commands] )) || -_zkstack__chain__help__contract-verifier__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help contract-verifier init commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__contract-verifier__run_commands] )) || -_zkstack__chain__help__contract-verifier__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help contract-verifier run commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__create_commands] )) || -_zkstack__chain__help__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help create commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__deploy-consensus-registry_commands] )) || -_zkstack__chain__help__deploy-consensus-registry_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help deploy-consensus-registry commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__deploy-l2-contracts_commands] )) || -_zkstack__chain__help__deploy-l2-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help deploy-l2-contracts commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__deploy-multicall3_commands] )) || -_zkstack__chain__help__deploy-multicall3_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help deploy-multicall3 commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__deploy-paymaster_commands] )) || -_zkstack__chain__help__deploy-paymaster_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help deploy-paymaster commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__deploy-upgrader_commands] )) || -_zkstack__chain__help__deploy-upgrader_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help deploy-upgrader commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__genesis_commands] )) || -_zkstack__chain__help__genesis_commands() { - local commands; commands=( -'init-database:Initialize databases' \ -'server:Runs server genesis' \ - ) - _describe -t commands 'zkstack chain help genesis commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__genesis__init-database_commands] )) || -_zkstack__chain__help__genesis__init-database_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help genesis init-database commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__genesis__server_commands] )) || -_zkstack__chain__help__genesis__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help genesis server commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__help_commands] )) || -_zkstack__chain__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help help commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__init_commands] )) || -_zkstack__chain__help__init_commands() { - local commands; commands=( -'configs:Initialize chain configs' \ - ) - _describe -t commands 'zkstack chain help init commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__init__configs_commands] )) || -_zkstack__chain__help__init__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help init configs commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__initialize-bridges_commands] )) || -_zkstack__chain__help__initialize-bridges_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help initialize-bridges commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__register-chain_commands] )) || -_zkstack__chain__help__register-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help register-chain commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__server_commands] )) || -_zkstack__chain__help__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help server commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__update-token-multiplier-setter_commands] )) || -_zkstack__chain__help__update-token-multiplier-setter_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help update-token-multiplier-setter commands' commands "$@" -} -(( $+functions[_zkstack__chain__init_commands] )) || -_zkstack__chain__init_commands() { - local commands; commands=( -'configs:Initialize chain configs' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain init commands' commands "$@" -} -(( $+functions[_zkstack__chain__init__configs_commands] )) || -_zkstack__chain__init__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain init configs commands' commands "$@" -} -(( $+functions[_zkstack__chain__init__help_commands] )) || -_zkstack__chain__init__help_commands() { - local commands; commands=( -'configs:Initialize chain configs' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain init help commands' commands "$@" -} -(( $+functions[_zkstack__chain__init__help__configs_commands] )) || -_zkstack__chain__init__help__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain init help configs commands' commands "$@" -} -(( $+functions[_zkstack__chain__init__help__help_commands] )) || -_zkstack__chain__init__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain init help help commands' commands "$@" -} -(( $+functions[_zkstack__chain__initialize-bridges_commands] )) || -_zkstack__chain__initialize-bridges_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain initialize-bridges commands' commands "$@" -} -(( $+functions[_zkstack__chain__register-chain_commands] )) || -_zkstack__chain__register-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain register-chain commands' commands "$@" -} -(( $+functions[_zkstack__chain__server_commands] )) || -_zkstack__chain__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain server commands' commands "$@" -} -(( $+functions[_zkstack__chain__update-token-multiplier-setter_commands] )) || -_zkstack__chain__update-token-multiplier-setter_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain update-token-multiplier-setter commands' commands "$@" -} -(( $+functions[_zkstack__containers_commands] )) || -_zkstack__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack containers commands' commands "$@" -} -(( $+functions[_zkstack__dev_commands] )) || -_zkstack__dev_commands() { - local commands; commands=( -'database:Database related commands' \ -'test:Run tests' \ -'clean:Clean artifacts' \ -'snapshot:Snapshots creator' \ -'lint:Lint code' \ -'fmt:Format code' \ -'prover:Protocol version used by provers' \ -'contracts:Build contracts' \ -'config-writer:Overwrite general config' \ -'send-transactions:Send transactions from file' \ -'status:Get status of the server' \ -'generate-genesis:Generate new genesis file based on current contracts' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean_commands] )) || -_zkstack__dev__clean_commands() { - local commands; commands=( -'all:Remove containers and contracts cache' \ -'containers:Remove containers and docker volumes' \ -'contracts-cache:Remove contracts caches' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev clean commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__all_commands] )) || -_zkstack__dev__clean__all_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean all commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__containers_commands] )) || -_zkstack__dev__clean__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean containers commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__contracts-cache_commands] )) || -_zkstack__dev__clean__contracts-cache_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean contracts-cache commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__help_commands] )) || -_zkstack__dev__clean__help_commands() { - local commands; commands=( -'all:Remove containers and contracts cache' \ -'containers:Remove containers and docker volumes' \ -'contracts-cache:Remove contracts caches' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev clean help commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__help__all_commands] )) || -_zkstack__dev__clean__help__all_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean help all commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__help__containers_commands] )) || -_zkstack__dev__clean__help__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean help containers commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__help__contracts-cache_commands] )) || -_zkstack__dev__clean__help__contracts-cache_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean help contracts-cache commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__help__help_commands] )) || -_zkstack__dev__clean__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__config-writer_commands] )) || -_zkstack__dev__config-writer_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev config-writer commands' commands "$@" -} -(( $+functions[_zkstack__dev__contracts_commands] )) || -_zkstack__dev__contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev contracts commands' commands "$@" -} -(( $+functions[_zkstack__dev__database_commands] )) || -_zkstack__dev__database_commands() { - local commands; commands=( -'check-sqlx-data:Check sqlx-data.json is up to date. If no databases are selected, all databases will be checked.' \ -'drop:Drop databases. If no databases are selected, all databases will be dropped.' \ -'migrate:Migrate databases. If no databases are selected, all databases will be migrated.' \ -'new-migration:Create new migration' \ -'prepare:Prepare sqlx-data.json. If no databases are selected, all databases will be prepared.' \ -'reset:Reset databases. If no databases are selected, all databases will be reset.' \ -'setup:Setup databases. If no databases are selected, all databases will be setup.' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev database commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__check-sqlx-data_commands] )) || -_zkstack__dev__database__check-sqlx-data_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database check-sqlx-data commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__drop_commands] )) || -_zkstack__dev__database__drop_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database drop commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help_commands] )) || -_zkstack__dev__database__help_commands() { - local commands; commands=( -'check-sqlx-data:Check sqlx-data.json is up to date. If no databases are selected, all databases will be checked.' \ -'drop:Drop databases. If no databases are selected, all databases will be dropped.' \ -'migrate:Migrate databases. If no databases are selected, all databases will be migrated.' \ -'new-migration:Create new migration' \ -'prepare:Prepare sqlx-data.json. If no databases are selected, all databases will be prepared.' \ -'reset:Reset databases. If no databases are selected, all databases will be reset.' \ -'setup:Setup databases. If no databases are selected, all databases will be setup.' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev database help commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__check-sqlx-data_commands] )) || -_zkstack__dev__database__help__check-sqlx-data_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help check-sqlx-data commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__drop_commands] )) || -_zkstack__dev__database__help__drop_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help drop commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__help_commands] )) || -_zkstack__dev__database__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__migrate_commands] )) || -_zkstack__dev__database__help__migrate_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help migrate commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__new-migration_commands] )) || -_zkstack__dev__database__help__new-migration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help new-migration commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__prepare_commands] )) || -_zkstack__dev__database__help__prepare_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help prepare commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__reset_commands] )) || -_zkstack__dev__database__help__reset_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help reset commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__setup_commands] )) || -_zkstack__dev__database__help__setup_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help setup commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__migrate_commands] )) || -_zkstack__dev__database__migrate_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database migrate commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__new-migration_commands] )) || -_zkstack__dev__database__new-migration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database new-migration commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__prepare_commands] )) || -_zkstack__dev__database__prepare_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database prepare commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__reset_commands] )) || -_zkstack__dev__database__reset_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database reset commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__setup_commands] )) || -_zkstack__dev__database__setup_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database setup commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt_commands] )) || -_zkstack__dev__fmt_commands() { - local commands; commands=( -'rustfmt:' \ -'contract:' \ -'prettier:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev fmt commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__contract_commands] )) || -_zkstack__dev__fmt__contract_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt contract commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__help_commands] )) || -_zkstack__dev__fmt__help_commands() { - local commands; commands=( -'rustfmt:' \ -'contract:' \ -'prettier:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev fmt help commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__help__contract_commands] )) || -_zkstack__dev__fmt__help__contract_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt help contract commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__help__help_commands] )) || -_zkstack__dev__fmt__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__help__prettier_commands] )) || -_zkstack__dev__fmt__help__prettier_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt help prettier commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__help__rustfmt_commands] )) || -_zkstack__dev__fmt__help__rustfmt_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt help rustfmt commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__prettier_commands] )) || -_zkstack__dev__fmt__prettier_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt prettier commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__rustfmt_commands] )) || -_zkstack__dev__fmt__rustfmt_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt rustfmt commands' commands "$@" -} -(( $+functions[_zkstack__dev__generate-genesis_commands] )) || -_zkstack__dev__generate-genesis_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev generate-genesis commands' commands "$@" -} -(( $+functions[_zkstack__dev__help_commands] )) || -_zkstack__dev__help_commands() { - local commands; commands=( -'database:Database related commands' \ -'test:Run tests' \ -'clean:Clean artifacts' \ -'snapshot:Snapshots creator' \ -'lint:Lint code' \ -'fmt:Format code' \ -'prover:Protocol version used by provers' \ -'contracts:Build contracts' \ -'config-writer:Overwrite general config' \ -'send-transactions:Send transactions from file' \ -'status:Get status of the server' \ -'generate-genesis:Generate new genesis file based on current contracts' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev help commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__clean_commands] )) || -_zkstack__dev__help__clean_commands() { - local commands; commands=( -'all:Remove containers and contracts cache' \ -'containers:Remove containers and docker volumes' \ -'contracts-cache:Remove contracts caches' \ - ) - _describe -t commands 'zkstack dev help clean commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__clean__all_commands] )) || -_zkstack__dev__help__clean__all_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help clean all commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__clean__containers_commands] )) || -_zkstack__dev__help__clean__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help clean containers commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__clean__contracts-cache_commands] )) || -_zkstack__dev__help__clean__contracts-cache_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help clean contracts-cache commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__config-writer_commands] )) || -_zkstack__dev__help__config-writer_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help config-writer commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__contracts_commands] )) || -_zkstack__dev__help__contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help contracts commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database_commands] )) || -_zkstack__dev__help__database_commands() { - local commands; commands=( -'check-sqlx-data:Check sqlx-data.json is up to date. If no databases are selected, all databases will be checked.' \ -'drop:Drop databases. If no databases are selected, all databases will be dropped.' \ -'migrate:Migrate databases. If no databases are selected, all databases will be migrated.' \ -'new-migration:Create new migration' \ -'prepare:Prepare sqlx-data.json. If no databases are selected, all databases will be prepared.' \ -'reset:Reset databases. If no databases are selected, all databases will be reset.' \ -'setup:Setup databases. If no databases are selected, all databases will be setup.' \ - ) - _describe -t commands 'zkstack dev help database commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__check-sqlx-data_commands] )) || -_zkstack__dev__help__database__check-sqlx-data_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database check-sqlx-data commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__drop_commands] )) || -_zkstack__dev__help__database__drop_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database drop commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__migrate_commands] )) || -_zkstack__dev__help__database__migrate_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database migrate commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__new-migration_commands] )) || -_zkstack__dev__help__database__new-migration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database new-migration commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__prepare_commands] )) || -_zkstack__dev__help__database__prepare_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database prepare commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__reset_commands] )) || -_zkstack__dev__help__database__reset_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database reset commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__setup_commands] )) || -_zkstack__dev__help__database__setup_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database setup commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__fmt_commands] )) || -_zkstack__dev__help__fmt_commands() { - local commands; commands=( -'rustfmt:' \ -'contract:' \ -'prettier:' \ - ) - _describe -t commands 'zkstack dev help fmt commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__fmt__contract_commands] )) || -_zkstack__dev__help__fmt__contract_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help fmt contract commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__fmt__prettier_commands] )) || -_zkstack__dev__help__fmt__prettier_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help fmt prettier commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__fmt__rustfmt_commands] )) || -_zkstack__dev__help__fmt__rustfmt_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help fmt rustfmt commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__generate-genesis_commands] )) || -_zkstack__dev__help__generate-genesis_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help generate-genesis commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__help_commands] )) || -_zkstack__dev__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__lint_commands] )) || -_zkstack__dev__help__lint_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help lint commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__prover_commands] )) || -_zkstack__dev__help__prover_commands() { - local commands; commands=( -'info:' \ -'insert-batch:' \ -'insert-version:' \ - ) - _describe -t commands 'zkstack dev help prover commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__prover__info_commands] )) || -_zkstack__dev__help__prover__info_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help prover info commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__prover__insert-batch_commands] )) || -_zkstack__dev__help__prover__insert-batch_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help prover insert-batch commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__prover__insert-version_commands] )) || -_zkstack__dev__help__prover__insert-version_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help prover insert-version commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__send-transactions_commands] )) || -_zkstack__dev__help__send-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help send-transactions commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__snapshot_commands] )) || -_zkstack__dev__help__snapshot_commands() { - local commands; commands=( -'create:' \ - ) - _describe -t commands 'zkstack dev help snapshot commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__snapshot__create_commands] )) || -_zkstack__dev__help__snapshot__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help snapshot create commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__status_commands] )) || -_zkstack__dev__help__status_commands() { - local commands; commands=( -'ports:Show used ports' \ - ) - _describe -t commands 'zkstack dev help status commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__status__ports_commands] )) || -_zkstack__dev__help__status__ports_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help status ports commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test_commands] )) || -_zkstack__dev__help__test_commands() { - local commands; commands=( -'integration:Run integration tests' \ -'fees:Run fees test' \ -'revert:Run revert tests' \ -'recovery:Run recovery tests' \ -'upgrade:Run upgrade tests' \ -'build:Build all test dependencies' \ -'rust:Run unit-tests, accepts optional cargo test flags' \ -'l1-contracts:Run L1 contracts tests' \ -'prover:Run prover tests' \ -'wallet:Print test wallets information' \ -'loadtest:Run loadtest' \ - ) - _describe -t commands 'zkstack dev help test commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__build_commands] )) || -_zkstack__dev__help__test__build_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test build commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__fees_commands] )) || -_zkstack__dev__help__test__fees_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test fees commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__integration_commands] )) || -_zkstack__dev__help__test__integration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test integration commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__l1-contracts_commands] )) || -_zkstack__dev__help__test__l1-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test l1-contracts commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__loadtest_commands] )) || -_zkstack__dev__help__test__loadtest_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test loadtest commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__prover_commands] )) || -_zkstack__dev__help__test__prover_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test prover commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__recovery_commands] )) || -_zkstack__dev__help__test__recovery_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test recovery commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__revert_commands] )) || -_zkstack__dev__help__test__revert_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test revert commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__rust_commands] )) || -_zkstack__dev__help__test__rust_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test rust commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__upgrade_commands] )) || -_zkstack__dev__help__test__upgrade_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test upgrade commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__wallet_commands] )) || -_zkstack__dev__help__test__wallet_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test wallet commands' commands "$@" -} -(( $+functions[_zkstack__dev__lint_commands] )) || -_zkstack__dev__lint_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev lint commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover_commands] )) || -_zkstack__dev__prover_commands() { - local commands; commands=( -'info:' \ -'insert-batch:' \ -'insert-version:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev prover commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__help_commands] )) || -_zkstack__dev__prover__help_commands() { - local commands; commands=( -'info:' \ -'insert-batch:' \ -'insert-version:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev prover help commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__help__help_commands] )) || -_zkstack__dev__prover__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__help__info_commands] )) || -_zkstack__dev__prover__help__info_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover help info commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__help__insert-batch_commands] )) || -_zkstack__dev__prover__help__insert-batch_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover help insert-batch commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__help__insert-version_commands] )) || -_zkstack__dev__prover__help__insert-version_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover help insert-version commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__info_commands] )) || -_zkstack__dev__prover__info_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover info commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__insert-batch_commands] )) || -_zkstack__dev__prover__insert-batch_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover insert-batch commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__insert-version_commands] )) || -_zkstack__dev__prover__insert-version_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover insert-version commands' commands "$@" -} -(( $+functions[_zkstack__dev__send-transactions_commands] )) || -_zkstack__dev__send-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev send-transactions commands' commands "$@" -} -(( $+functions[_zkstack__dev__snapshot_commands] )) || -_zkstack__dev__snapshot_commands() { - local commands; commands=( -'create:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev snapshot commands' commands "$@" -} -(( $+functions[_zkstack__dev__snapshot__create_commands] )) || -_zkstack__dev__snapshot__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev snapshot create commands' commands "$@" -} -(( $+functions[_zkstack__dev__snapshot__help_commands] )) || -_zkstack__dev__snapshot__help_commands() { - local commands; commands=( -'create:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev snapshot help commands' commands "$@" -} -(( $+functions[_zkstack__dev__snapshot__help__create_commands] )) || -_zkstack__dev__snapshot__help__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev snapshot help create commands' commands "$@" -} -(( $+functions[_zkstack__dev__snapshot__help__help_commands] )) || -_zkstack__dev__snapshot__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev snapshot help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__status_commands] )) || -_zkstack__dev__status_commands() { - local commands; commands=( -'ports:Show used ports' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev status commands' commands "$@" -} -(( $+functions[_zkstack__dev__status__help_commands] )) || -_zkstack__dev__status__help_commands() { - local commands; commands=( -'ports:Show used ports' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev status help commands' commands "$@" -} -(( $+functions[_zkstack__dev__status__help__help_commands] )) || -_zkstack__dev__status__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev status help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__status__help__ports_commands] )) || -_zkstack__dev__status__help__ports_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev status help ports commands' commands "$@" -} -(( $+functions[_zkstack__dev__status__ports_commands] )) || -_zkstack__dev__status__ports_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev status ports commands' commands "$@" -} -(( $+functions[_zkstack__dev__test_commands] )) || -_zkstack__dev__test_commands() { - local commands; commands=( -'integration:Run integration tests' \ -'fees:Run fees test' \ -'revert:Run revert tests' \ -'recovery:Run recovery tests' \ -'upgrade:Run upgrade tests' \ -'build:Build all test dependencies' \ -'rust:Run unit-tests, accepts optional cargo test flags' \ -'l1-contracts:Run L1 contracts tests' \ -'prover:Run prover tests' \ -'wallet:Print test wallets information' \ -'loadtest:Run loadtest' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev test commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__build_commands] )) || -_zkstack__dev__test__build_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test build commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__fees_commands] )) || -_zkstack__dev__test__fees_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test fees commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help_commands] )) || -_zkstack__dev__test__help_commands() { - local commands; commands=( -'integration:Run integration tests' \ -'fees:Run fees test' \ -'revert:Run revert tests' \ -'recovery:Run recovery tests' \ -'upgrade:Run upgrade tests' \ -'build:Build all test dependencies' \ -'rust:Run unit-tests, accepts optional cargo test flags' \ -'l1-contracts:Run L1 contracts tests' \ -'prover:Run prover tests' \ -'wallet:Print test wallets information' \ -'loadtest:Run loadtest' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev test help commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__build_commands] )) || -_zkstack__dev__test__help__build_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help build commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__fees_commands] )) || -_zkstack__dev__test__help__fees_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help fees commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__help_commands] )) || -_zkstack__dev__test__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__integration_commands] )) || -_zkstack__dev__test__help__integration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help integration commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__l1-contracts_commands] )) || -_zkstack__dev__test__help__l1-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help l1-contracts commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__loadtest_commands] )) || -_zkstack__dev__test__help__loadtest_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help loadtest commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__prover_commands] )) || -_zkstack__dev__test__help__prover_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help prover commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__recovery_commands] )) || -_zkstack__dev__test__help__recovery_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help recovery commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__revert_commands] )) || -_zkstack__dev__test__help__revert_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help revert commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__rust_commands] )) || -_zkstack__dev__test__help__rust_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help rust commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__upgrade_commands] )) || -_zkstack__dev__test__help__upgrade_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help upgrade commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__wallet_commands] )) || -_zkstack__dev__test__help__wallet_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help wallet commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__integration_commands] )) || -_zkstack__dev__test__integration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test integration commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__l1-contracts_commands] )) || -_zkstack__dev__test__l1-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test l1-contracts commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__loadtest_commands] )) || -_zkstack__dev__test__loadtest_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test loadtest commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__prover_commands] )) || -_zkstack__dev__test__prover_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test prover commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__recovery_commands] )) || -_zkstack__dev__test__recovery_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test recovery commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__revert_commands] )) || -_zkstack__dev__test__revert_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test revert commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__rust_commands] )) || -_zkstack__dev__test__rust_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test rust commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__upgrade_commands] )) || -_zkstack__dev__test__upgrade_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test upgrade commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__wallet_commands] )) || -_zkstack__dev__test__wallet_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test wallet commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem_commands] )) || -_zkstack__ecosystem_commands() { - local commands; commands=( -'create:Create a new ecosystem and chain, setting necessary configurations for later initialization' \ -'build-transactions:Create transactions to build ecosystem contracts' \ -'init:Initialize ecosystem and chain, deploying necessary contracts and performing on-chain operations' \ -'change-default-chain:Change the default chain' \ -'setup-observability:Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack ecosystem commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__build-transactions_commands] )) || -_zkstack__ecosystem__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__change-default-chain_commands] )) || -_zkstack__ecosystem__change-default-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem change-default-chain commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__create_commands] )) || -_zkstack__ecosystem__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem create commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help_commands] )) || -_zkstack__ecosystem__help_commands() { - local commands; commands=( -'create:Create a new ecosystem and chain, setting necessary configurations for later initialization' \ -'build-transactions:Create transactions to build ecosystem contracts' \ -'init:Initialize ecosystem and chain, deploying necessary contracts and performing on-chain operations' \ -'change-default-chain:Change the default chain' \ -'setup-observability:Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack ecosystem help commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__build-transactions_commands] )) || -_zkstack__ecosystem__help__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__change-default-chain_commands] )) || -_zkstack__ecosystem__help__change-default-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help change-default-chain commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__create_commands] )) || -_zkstack__ecosystem__help__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help create commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__help_commands] )) || -_zkstack__ecosystem__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help help commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__init_commands] )) || -_zkstack__ecosystem__help__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help init commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__setup-observability_commands] )) || -_zkstack__ecosystem__help__setup-observability_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help setup-observability commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__init_commands] )) || -_zkstack__ecosystem__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem init commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__setup-observability_commands] )) || -_zkstack__ecosystem__setup-observability_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem setup-observability commands' commands "$@" -} -(( $+functions[_zkstack__explorer_commands] )) || -_zkstack__explorer_commands() { - local commands; commands=( -'init:Initialize explorer (create database to store explorer data and generate docker compose file with explorer services). Runs for all chains, unless --chain is passed' \ -'run-backend:Start explorer backend services (api, data_fetcher, worker) for a given chain. Uses default chain, unless --chain is passed' \ -'run:Run explorer app' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack explorer commands' commands "$@" -} -(( $+functions[_zkstack__explorer__help_commands] )) || -_zkstack__explorer__help_commands() { - local commands; commands=( -'init:Initialize explorer (create database to store explorer data and generate docker compose file with explorer services). Runs for all chains, unless --chain is passed' \ -'run-backend:Start explorer backend services (api, data_fetcher, worker) for a given chain. Uses default chain, unless --chain is passed' \ -'run:Run explorer app' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack explorer help commands' commands "$@" -} -(( $+functions[_zkstack__explorer__help__help_commands] )) || -_zkstack__explorer__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer help help commands' commands "$@" -} -(( $+functions[_zkstack__explorer__help__init_commands] )) || -_zkstack__explorer__help__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer help init commands' commands "$@" -} -(( $+functions[_zkstack__explorer__help__run_commands] )) || -_zkstack__explorer__help__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer help run commands' commands "$@" -} -(( $+functions[_zkstack__explorer__help__run-backend_commands] )) || -_zkstack__explorer__help__run-backend_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer help run-backend commands' commands "$@" -} -(( $+functions[_zkstack__explorer__init_commands] )) || -_zkstack__explorer__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer init commands' commands "$@" -} -(( $+functions[_zkstack__explorer__run_commands] )) || -_zkstack__explorer__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer run commands' commands "$@" -} -(( $+functions[_zkstack__explorer__run-backend_commands] )) || -_zkstack__explorer__run-backend_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer run-backend commands' commands "$@" -} -(( $+functions[_zkstack__external-node_commands] )) || -_zkstack__external-node_commands() { - local commands; commands=( -'configs:Prepare configs for EN' \ -'init:Init databases' \ -'run:Run external node' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack external-node commands' commands "$@" -} -(( $+functions[_zkstack__external-node__configs_commands] )) || -_zkstack__external-node__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node configs commands' commands "$@" -} -(( $+functions[_zkstack__external-node__help_commands] )) || -_zkstack__external-node__help_commands() { - local commands; commands=( -'configs:Prepare configs for EN' \ -'init:Init databases' \ -'run:Run external node' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack external-node help commands' commands "$@" -} -(( $+functions[_zkstack__external-node__help__configs_commands] )) || -_zkstack__external-node__help__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node help configs commands' commands "$@" -} -(( $+functions[_zkstack__external-node__help__help_commands] )) || -_zkstack__external-node__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node help help commands' commands "$@" -} -(( $+functions[_zkstack__external-node__help__init_commands] )) || -_zkstack__external-node__help__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node help init commands' commands "$@" -} -(( $+functions[_zkstack__external-node__help__run_commands] )) || -_zkstack__external-node__help__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node help run commands' commands "$@" -} -(( $+functions[_zkstack__external-node__init_commands] )) || -_zkstack__external-node__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node init commands' commands "$@" -} -(( $+functions[_zkstack__external-node__run_commands] )) || -_zkstack__external-node__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node run commands' commands "$@" -} -(( $+functions[_zkstack__help_commands] )) || -_zkstack__help_commands() { - local commands; commands=( -'autocomplete:Create shell autocompletion files' \ -'ecosystem:Ecosystem related commands' \ -'chain:Chain related commands' \ -'dev:Supervisor related commands' \ -'prover:Prover related commands' \ -'external-node:External Node related commands' \ -'containers:Run containers for local development' \ -'portal:Run dapp-portal' \ -'explorer:Run block-explorer' \ -'update:Update ZKsync' \ -'markdown:Print markdown help' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack help commands' commands "$@" -} -(( $+functions[_zkstack__help__autocomplete_commands] )) || -_zkstack__help__autocomplete_commands() { - local commands; commands=() - _describe -t commands 'zkstack help autocomplete commands' commands "$@" -} -(( $+functions[_zkstack__help__chain_commands] )) || -_zkstack__help__chain_commands() { - local commands; commands=( -'create:Create a new chain, setting the necessary configurations for later initialization' \ -'build-transactions:Create unsigned transactions for chain deployment' \ -'init:Initialize chain, deploying necessary contracts and performing on-chain operations' \ -'genesis:Run server genesis' \ -'register-chain:Register a new chain on L1 (executed by L1 governor). This command deploys and configures Governance, ChainAdmin, and DiamondProxy contracts, registers chain with BridgeHub and sets pending admin for DiamondProxy. Note\: After completion, L2 governor can accept ownership by running \`accept-chain-ownership\`' \ -'deploy-l2-contracts:Deploy all L2 contracts (executed by L1 governor)' \ -'accept-chain-ownership:Accept ownership of L2 chain (executed by L2 governor). This command should be run after \`register-chain\` to accept ownership of newly created DiamondProxy contract' \ -'initialize-bridges:Initialize bridges on L2' \ -'deploy-consensus-registry:Deploy L2 consensus registry' \ -'deploy-multicall3:Deploy L2 multicall3' \ -'deploy-upgrader:Deploy Default Upgrader' \ -'deploy-paymaster:Deploy paymaster smart contract' \ -'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ -'server:Run server' \ -'contract-verifier:Run contract verifier' \ -'consensus:' \ - ) - _describe -t commands 'zkstack help chain commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__accept-chain-ownership_commands] )) || -_zkstack__help__chain__accept-chain-ownership_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain accept-chain-ownership commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__build-transactions_commands] )) || -_zkstack__help__chain__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__consensus_commands] )) || -_zkstack__help__chain__consensus_commands() { - local commands; commands=( -'set-attester-committee:Sets the attester committee in the consensus registry contract to \`consensus.genesis_spec.attesters\` in general.yaml' \ -'get-attester-committee:Fetches the attester committee from the consensus registry contract' \ - ) - _describe -t commands 'zkstack help chain consensus commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__consensus__get-attester-committee_commands] )) || -_zkstack__help__chain__consensus__get-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain consensus get-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__consensus__set-attester-committee_commands] )) || -_zkstack__help__chain__consensus__set-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain consensus set-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__contract-verifier_commands] )) || -_zkstack__help__chain__contract-verifier_commands() { - local commands; commands=( -'run:Run contract verifier' \ -'init:Download required binaries for contract verifier' \ - ) - _describe -t commands 'zkstack help chain contract-verifier commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__contract-verifier__init_commands] )) || -_zkstack__help__chain__contract-verifier__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain contract-verifier init commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__contract-verifier__run_commands] )) || -_zkstack__help__chain__contract-verifier__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain contract-verifier run commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__create_commands] )) || -_zkstack__help__chain__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain create commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__deploy-consensus-registry_commands] )) || -_zkstack__help__chain__deploy-consensus-registry_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain deploy-consensus-registry commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__deploy-l2-contracts_commands] )) || -_zkstack__help__chain__deploy-l2-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain deploy-l2-contracts commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__deploy-multicall3_commands] )) || -_zkstack__help__chain__deploy-multicall3_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain deploy-multicall3 commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__deploy-paymaster_commands] )) || -_zkstack__help__chain__deploy-paymaster_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain deploy-paymaster commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__deploy-upgrader_commands] )) || -_zkstack__help__chain__deploy-upgrader_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain deploy-upgrader commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__genesis_commands] )) || -_zkstack__help__chain__genesis_commands() { - local commands; commands=( -'init-database:Initialize databases' \ -'server:Runs server genesis' \ - ) - _describe -t commands 'zkstack help chain genesis commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__genesis__init-database_commands] )) || -_zkstack__help__chain__genesis__init-database_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain genesis init-database commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__genesis__server_commands] )) || -_zkstack__help__chain__genesis__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain genesis server commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__init_commands] )) || -_zkstack__help__chain__init_commands() { - local commands; commands=( -'configs:Initialize chain configs' \ - ) - _describe -t commands 'zkstack help chain init commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__init__configs_commands] )) || -_zkstack__help__chain__init__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain init configs commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__initialize-bridges_commands] )) || -_zkstack__help__chain__initialize-bridges_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain initialize-bridges commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__register-chain_commands] )) || -_zkstack__help__chain__register-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain register-chain commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__server_commands] )) || -_zkstack__help__chain__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain server commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__update-token-multiplier-setter_commands] )) || -_zkstack__help__chain__update-token-multiplier-setter_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain update-token-multiplier-setter commands' commands "$@" -} -(( $+functions[_zkstack__help__containers_commands] )) || -_zkstack__help__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack help containers commands' commands "$@" -} -(( $+functions[_zkstack__help__dev_commands] )) || -_zkstack__help__dev_commands() { - local commands; commands=( -'database:Database related commands' \ -'test:Run tests' \ -'clean:Clean artifacts' \ -'snapshot:Snapshots creator' \ -'lint:Lint code' \ -'fmt:Format code' \ -'prover:Protocol version used by provers' \ -'contracts:Build contracts' \ -'config-writer:Overwrite general config' \ -'send-transactions:Send transactions from file' \ -'status:Get status of the server' \ -'generate-genesis:Generate new genesis file based on current contracts' \ - ) - _describe -t commands 'zkstack help dev commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__clean_commands] )) || -_zkstack__help__dev__clean_commands() { - local commands; commands=( -'all:Remove containers and contracts cache' \ -'containers:Remove containers and docker volumes' \ -'contracts-cache:Remove contracts caches' \ - ) - _describe -t commands 'zkstack help dev clean commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__clean__all_commands] )) || -_zkstack__help__dev__clean__all_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev clean all commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__clean__containers_commands] )) || -_zkstack__help__dev__clean__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev clean containers commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__clean__contracts-cache_commands] )) || -_zkstack__help__dev__clean__contracts-cache_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev clean contracts-cache commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__config-writer_commands] )) || -_zkstack__help__dev__config-writer_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev config-writer commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__contracts_commands] )) || -_zkstack__help__dev__contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev contracts commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database_commands] )) || -_zkstack__help__dev__database_commands() { - local commands; commands=( -'check-sqlx-data:Check sqlx-data.json is up to date. If no databases are selected, all databases will be checked.' \ -'drop:Drop databases. If no databases are selected, all databases will be dropped.' \ -'migrate:Migrate databases. If no databases are selected, all databases will be migrated.' \ -'new-migration:Create new migration' \ -'prepare:Prepare sqlx-data.json. If no databases are selected, all databases will be prepared.' \ -'reset:Reset databases. If no databases are selected, all databases will be reset.' \ -'setup:Setup databases. If no databases are selected, all databases will be setup.' \ - ) - _describe -t commands 'zkstack help dev database commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__check-sqlx-data_commands] )) || -_zkstack__help__dev__database__check-sqlx-data_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database check-sqlx-data commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__drop_commands] )) || -_zkstack__help__dev__database__drop_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database drop commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__migrate_commands] )) || -_zkstack__help__dev__database__migrate_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database migrate commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__new-migration_commands] )) || -_zkstack__help__dev__database__new-migration_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database new-migration commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__prepare_commands] )) || -_zkstack__help__dev__database__prepare_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database prepare commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__reset_commands] )) || -_zkstack__help__dev__database__reset_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database reset commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__setup_commands] )) || -_zkstack__help__dev__database__setup_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database setup commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__fmt_commands] )) || -_zkstack__help__dev__fmt_commands() { - local commands; commands=( -'rustfmt:' \ -'contract:' \ -'prettier:' \ - ) - _describe -t commands 'zkstack help dev fmt commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__fmt__contract_commands] )) || -_zkstack__help__dev__fmt__contract_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev fmt contract commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__fmt__prettier_commands] )) || -_zkstack__help__dev__fmt__prettier_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev fmt prettier commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__fmt__rustfmt_commands] )) || -_zkstack__help__dev__fmt__rustfmt_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev fmt rustfmt commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__generate-genesis_commands] )) || -_zkstack__help__dev__generate-genesis_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev generate-genesis commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__lint_commands] )) || -_zkstack__help__dev__lint_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev lint commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__prover_commands] )) || -_zkstack__help__dev__prover_commands() { - local commands; commands=( -'info:' \ -'insert-batch:' \ -'insert-version:' \ - ) - _describe -t commands 'zkstack help dev prover commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__prover__info_commands] )) || -_zkstack__help__dev__prover__info_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev prover info commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__prover__insert-batch_commands] )) || -_zkstack__help__dev__prover__insert-batch_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev prover insert-batch commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__prover__insert-version_commands] )) || -_zkstack__help__dev__prover__insert-version_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev prover insert-version commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__send-transactions_commands] )) || -_zkstack__help__dev__send-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev send-transactions commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__snapshot_commands] )) || -_zkstack__help__dev__snapshot_commands() { - local commands; commands=( -'create:' \ - ) - _describe -t commands 'zkstack help dev snapshot commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__snapshot__create_commands] )) || -_zkstack__help__dev__snapshot__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev snapshot create commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__status_commands] )) || -_zkstack__help__dev__status_commands() { - local commands; commands=( -'ports:Show used ports' \ - ) - _describe -t commands 'zkstack help dev status commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__status__ports_commands] )) || -_zkstack__help__dev__status__ports_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev status ports commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test_commands] )) || -_zkstack__help__dev__test_commands() { - local commands; commands=( -'integration:Run integration tests' \ -'fees:Run fees test' \ -'revert:Run revert tests' \ -'recovery:Run recovery tests' \ -'upgrade:Run upgrade tests' \ -'build:Build all test dependencies' \ -'rust:Run unit-tests, accepts optional cargo test flags' \ -'l1-contracts:Run L1 contracts tests' \ -'prover:Run prover tests' \ -'wallet:Print test wallets information' \ -'loadtest:Run loadtest' \ - ) - _describe -t commands 'zkstack help dev test commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__build_commands] )) || -_zkstack__help__dev__test__build_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test build commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__fees_commands] )) || -_zkstack__help__dev__test__fees_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test fees commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__integration_commands] )) || -_zkstack__help__dev__test__integration_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test integration commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__l1-contracts_commands] )) || -_zkstack__help__dev__test__l1-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test l1-contracts commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__loadtest_commands] )) || -_zkstack__help__dev__test__loadtest_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test loadtest commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__prover_commands] )) || -_zkstack__help__dev__test__prover_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test prover commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__recovery_commands] )) || -_zkstack__help__dev__test__recovery_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test recovery commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__revert_commands] )) || -_zkstack__help__dev__test__revert_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test revert commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__rust_commands] )) || -_zkstack__help__dev__test__rust_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test rust commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__upgrade_commands] )) || -_zkstack__help__dev__test__upgrade_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test upgrade commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__wallet_commands] )) || -_zkstack__help__dev__test__wallet_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test wallet commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem_commands] )) || -_zkstack__help__ecosystem_commands() { - local commands; commands=( -'create:Create a new ecosystem and chain, setting necessary configurations for later initialization' \ -'build-transactions:Create transactions to build ecosystem contracts' \ -'init:Initialize ecosystem and chain, deploying necessary contracts and performing on-chain operations' \ -'change-default-chain:Change the default chain' \ -'setup-observability:Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' \ - ) - _describe -t commands 'zkstack help ecosystem commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem__build-transactions_commands] )) || -_zkstack__help__ecosystem__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack help ecosystem build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem__change-default-chain_commands] )) || -_zkstack__help__ecosystem__change-default-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack help ecosystem change-default-chain commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem__create_commands] )) || -_zkstack__help__ecosystem__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack help ecosystem create commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem__init_commands] )) || -_zkstack__help__ecosystem__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack help ecosystem init commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem__setup-observability_commands] )) || -_zkstack__help__ecosystem__setup-observability_commands() { - local commands; commands=() - _describe -t commands 'zkstack help ecosystem setup-observability commands' commands "$@" -} -(( $+functions[_zkstack__help__explorer_commands] )) || -_zkstack__help__explorer_commands() { - local commands; commands=( -'init:Initialize explorer (create database to store explorer data and generate docker compose file with explorer services). Runs for all chains, unless --chain is passed' \ -'run-backend:Start explorer backend services (api, data_fetcher, worker) for a given chain. Uses default chain, unless --chain is passed' \ -'run:Run explorer app' \ - ) - _describe -t commands 'zkstack help explorer commands' commands "$@" -} -(( $+functions[_zkstack__help__explorer__init_commands] )) || -_zkstack__help__explorer__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack help explorer init commands' commands "$@" -} -(( $+functions[_zkstack__help__explorer__run_commands] )) || -_zkstack__help__explorer__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack help explorer run commands' commands "$@" -} -(( $+functions[_zkstack__help__explorer__run-backend_commands] )) || -_zkstack__help__explorer__run-backend_commands() { - local commands; commands=() - _describe -t commands 'zkstack help explorer run-backend commands' commands "$@" -} -(( $+functions[_zkstack__help__external-node_commands] )) || -_zkstack__help__external-node_commands() { - local commands; commands=( -'configs:Prepare configs for EN' \ -'init:Init databases' \ -'run:Run external node' \ - ) - _describe -t commands 'zkstack help external-node commands' commands "$@" -} -(( $+functions[_zkstack__help__external-node__configs_commands] )) || -_zkstack__help__external-node__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack help external-node configs commands' commands "$@" -} -(( $+functions[_zkstack__help__external-node__init_commands] )) || -_zkstack__help__external-node__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack help external-node init commands' commands "$@" -} -(( $+functions[_zkstack__help__external-node__run_commands] )) || -_zkstack__help__external-node__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack help external-node run commands' commands "$@" -} -(( $+functions[_zkstack__help__help_commands] )) || -_zkstack__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack help help commands' commands "$@" -} -(( $+functions[_zkstack__help__markdown_commands] )) || -_zkstack__help__markdown_commands() { - local commands; commands=() - _describe -t commands 'zkstack help markdown commands' commands "$@" -} -(( $+functions[_zkstack__help__portal_commands] )) || -_zkstack__help__portal_commands() { - local commands; commands=() - _describe -t commands 'zkstack help portal commands' commands "$@" -} -(( $+functions[_zkstack__help__prover_commands] )) || -_zkstack__help__prover_commands() { - local commands; commands=( -'init:Initialize prover' \ -'setup-keys:Generate setup keys' \ -'run:Run prover' \ -'init-bellman-cuda:Initialize bellman-cuda' \ -'compressor-keys:Download compressor keys' \ - ) - _describe -t commands 'zkstack help prover commands' commands "$@" -} -(( $+functions[_zkstack__help__prover__compressor-keys_commands] )) || -_zkstack__help__prover__compressor-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack help prover compressor-keys commands' commands "$@" -} -(( $+functions[_zkstack__help__prover__init_commands] )) || -_zkstack__help__prover__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack help prover init commands' commands "$@" -} -(( $+functions[_zkstack__help__prover__init-bellman-cuda_commands] )) || -_zkstack__help__prover__init-bellman-cuda_commands() { - local commands; commands=() - _describe -t commands 'zkstack help prover init-bellman-cuda commands' commands "$@" -} -(( $+functions[_zkstack__help__prover__run_commands] )) || -_zkstack__help__prover__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack help prover run commands' commands "$@" -} -(( $+functions[_zkstack__help__prover__setup-keys_commands] )) || -_zkstack__help__prover__setup-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack help prover setup-keys commands' commands "$@" -} -(( $+functions[_zkstack__help__update_commands] )) || -_zkstack__help__update_commands() { - local commands; commands=() - _describe -t commands 'zkstack help update commands' commands "$@" -} -(( $+functions[_zkstack__markdown_commands] )) || -_zkstack__markdown_commands() { - local commands; commands=() - _describe -t commands 'zkstack markdown commands' commands "$@" -} -(( $+functions[_zkstack__portal_commands] )) || -_zkstack__portal_commands() { - local commands; commands=() - _describe -t commands 'zkstack portal commands' commands "$@" -} -(( $+functions[_zkstack__prover_commands] )) || -_zkstack__prover_commands() { - local commands; commands=( -'init:Initialize prover' \ -'setup-keys:Generate setup keys' \ -'run:Run prover' \ -'init-bellman-cuda:Initialize bellman-cuda' \ -'compressor-keys:Download compressor keys' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack prover commands' commands "$@" -} -(( $+functions[_zkstack__prover__compressor-keys_commands] )) || -_zkstack__prover__compressor-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover compressor-keys commands' commands "$@" -} -(( $+functions[_zkstack__prover__help_commands] )) || -_zkstack__prover__help_commands() { - local commands; commands=( -'init:Initialize prover' \ -'setup-keys:Generate setup keys' \ -'run:Run prover' \ -'init-bellman-cuda:Initialize bellman-cuda' \ -'compressor-keys:Download compressor keys' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack prover help commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__compressor-keys_commands] )) || -_zkstack__prover__help__compressor-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help compressor-keys commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__help_commands] )) || -_zkstack__prover__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help help commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__init_commands] )) || -_zkstack__prover__help__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help init commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__init-bellman-cuda_commands] )) || -_zkstack__prover__help__init-bellman-cuda_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help init-bellman-cuda commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__run_commands] )) || -_zkstack__prover__help__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help run commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__setup-keys_commands] )) || -_zkstack__prover__help__setup-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help setup-keys commands' commands "$@" -} -(( $+functions[_zkstack__prover__init_commands] )) || -_zkstack__prover__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover init commands' commands "$@" -} -(( $+functions[_zkstack__prover__init-bellman-cuda_commands] )) || -_zkstack__prover__init-bellman-cuda_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover init-bellman-cuda commands' commands "$@" -} -(( $+functions[_zkstack__prover__run_commands] )) || -_zkstack__prover__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover run commands' commands "$@" -} -(( $+functions[_zkstack__prover__setup-keys_commands] )) || -_zkstack__prover__setup-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover setup-keys commands' commands "$@" -} -(( $+functions[_zkstack__update_commands] )) || -_zkstack__update_commands() { - local commands; commands=() - _describe -t commands 'zkstack update commands' commands "$@" -} - -if [ "$funcstack[1]" = "_zkstack" ]; then - _zkstack "$@" -else - compdef _zkstack zkstack -fi diff --git a/zkstack_cli/_zkstack.zsh b/zkstack_cli/_zkstack.zsh deleted file mode 100644 index ba9feb65410..00000000000 --- a/zkstack_cli/_zkstack.zsh +++ /dev/null @@ -1,5092 +0,0 @@ -#compdef zkstack - -autoload -U is-at-least - -_zkstack() { - typeset -A opt_args - typeset -a _arguments_options - local ret=1 - - if is-at-least 5.2; then - _arguments_options=(-s -S -C) - else - _arguments_options=(-s -C) - fi - - local context curcontext="$curcontext" state line - _arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -'-V[Print version]' \ -'--version[Print version]' \ -":: :_zkstack_commands" \ -"*::: :->zkstack" \ -&& ret=0 - case $state in - (zkstack) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-command-$line[1]:" - case $line[1] in - (autocomplete) -_arguments "${_arguments_options[@]}" : \ -'--generate=[The shell to generate the autocomplete script for]:GENERATOR:(bash elvish fish powershell zsh)' \ -'-o+[The out directory to write the autocomplete script to]:OUT:_files' \ -'--out=[The out directory to write the autocomplete script to]:OUT:_files' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(ecosystem) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__ecosystem_commands" \ -"*::: :->ecosystem" \ -&& ret=0 - - case $state in - (ecosystem) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-ecosystem-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -'--ecosystem-name=[]:ECOSYSTEM_NAME:_default' \ -'--l1-network=[L1 Network]:L1_NETWORK:(localhost sepolia holesky mainnet)' \ -'--link-to-code=[Code link]:LINK_TO_CODE:_files -/' \ -'--chain-name=[]:CHAIN_NAME:_default' \ -'--chain-id=[Chain ID]:CHAIN_ID:_default' \ -'--prover-mode=[Prover options]:PROVER_MODE:(no-proofs gpu)' \ -'--wallet-creation=[Wallet options]:WALLET_CREATION:((localhost\:"Load wallets from localhost mnemonic, they are funded for localhost env" -random\:"Generate random wallets" -empty\:"Generate placeholder wallets" -in-file\:"Specify file with wallets"))' \ -'--wallet-path=[Wallet path]:WALLET_PATH:_files' \ -'--l1-batch-commit-data-generator-mode=[Commit data generation mode]:L1_BATCH_COMMIT_DATA_GENERATOR_MODE:(rollup validium)' \ -'--base-token-address=[Base token address]:BASE_TOKEN_ADDRESS:_default' \ -'--base-token-price-nominator=[Base token nominator]:BASE_TOKEN_PRICE_NOMINATOR:_default' \ -'--base-token-price-denominator=[Base token denominator]:BASE_TOKEN_PRICE_DENOMINATOR:_default' \ -'--set-as-default=[Set as default chain]' \ -'--evm-emulator=[Enable EVM emulator]' \ -'--start-containers=[Start reth and postgres containers after creation]' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--legacy-bridge[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -'--sender=[Address of the transaction sender]:SENDER:_default' \ -'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ -'-o+[Output directory for the generated files]:OUT:_files' \ -'--out=[Output directory for the generated files]:OUT:_files' \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -'--deploy-erc20=[Deploy ERC20 contracts]' \ -'--deploy-ecosystem=[Deploy ecosystem contracts]' \ -'--ecosystem-contracts-path=[Path to ecosystem contracts]:ECOSYSTEM_CONTRACTS_PATH:_files' \ -'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--deploy-paymaster=[Deploy Paymaster contract]' \ -'--server-db-url=[Server database url without database name]:SERVER_DB_URL:_default' \ -'--server-db-name=[Server database name]:SERVER_DB_NAME:_default' \ -'-o+[Enable Grafana]' \ -'--observability=[Enable Grafana]' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-d[]' \ -'--dont-drop[]' \ -'--ecosystem-only[Initialize ecosystem only and skip chain initialization (chain can be initialized later with \`chain init\` subcommand)]' \ -'--dev[Use defaults for all options and flags. Suitable for local development]' \ -'--no-port-reallocation[Do not reallocate ports]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(change-default-chain) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -'::name:_default' \ -&& ret=0 -;; -(setup-observability) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__ecosystem__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-ecosystem-help-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(change-default-chain) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup-observability) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(chain) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__chain_commands" \ -"*::: :->chain" \ -&& ret=0 - - case $state in - (chain) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -'--chain-name=[]:CHAIN_NAME:_default' \ -'--chain-id=[Chain ID]:CHAIN_ID:_default' \ -'--prover-mode=[Prover options]:PROVER_MODE:(no-proofs gpu)' \ -'--wallet-creation=[Wallet options]:WALLET_CREATION:((localhost\:"Load wallets from localhost mnemonic, they are funded for localhost env" -random\:"Generate random wallets" -empty\:"Generate placeholder wallets" -in-file\:"Specify file with wallets"))' \ -'--wallet-path=[Wallet path]:WALLET_PATH:_files' \ -'--l1-batch-commit-data-generator-mode=[Commit data generation mode]:L1_BATCH_COMMIT_DATA_GENERATOR_MODE:(rollup validium)' \ -'--base-token-address=[Base token address]:BASE_TOKEN_ADDRESS:_default' \ -'--base-token-price-nominator=[Base token nominator]:BASE_TOKEN_PRICE_NOMINATOR:_default' \ -'--base-token-price-denominator=[Base token denominator]:BASE_TOKEN_PRICE_DENOMINATOR:_default' \ -'--set-as-default=[Set as default chain]' \ -'--evm-emulator=[Enable EVM emulator]' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--legacy-bridge[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -'-o+[Output directory for the generated files]:OUT:_files' \ -'--out=[Output directory for the generated files]:OUT:_files' \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--server-db-url=[Server database url without database name]:SERVER_DB_URL:_default' \ -'--server-db-name=[Server database name]:SERVER_DB_NAME:_default' \ -'--deploy-paymaster=[]' \ -'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-d[]' \ -'--dont-drop[]' \ -'--no-port-reallocation[Do not reallocate ports]' \ -'--dev[Use defaults for all options and flags. Suitable for local development]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -":: :_zkstack__chain__init_commands" \ -"*::: :->init" \ -&& ret=0 - - case $state in - (init) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-init-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -'--server-db-url=[Server database url without database name]:SERVER_DB_URL:_default' \ -'--server-db-name=[Server database name]:SERVER_DB_NAME:_default' \ -'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-d[Use default database urls and names]' \ -'--dev[Use default database urls and names]' \ -'-d[]' \ -'--dont-drop[]' \ -'--no-port-reallocation[Do not reallocate ports]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__init__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-init-help-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(genesis) -_arguments "${_arguments_options[@]}" : \ -'--server-db-url=[Server database url without database name]:SERVER_DB_URL:_default' \ -'--server-db-name=[Server database name]:SERVER_DB_NAME:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-d[Use default database urls and names]' \ -'--dev[Use default database urls and names]' \ -'-d[]' \ -'--dont-drop[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__chain__genesis_commands" \ -"*::: :->genesis" \ -&& ret=0 - - case $state in - (genesis) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-genesis-command-$line[1]:" - case $line[1] in - (init-database) -_arguments "${_arguments_options[@]}" : \ -'--server-db-url=[Server database url without database name]:SERVER_DB_URL:_default' \ -'--server-db-name=[Server database name]:SERVER_DB_NAME:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-d[Use default database urls and names]' \ -'--dev[Use default database urls and names]' \ -'-d[]' \ -'--dont-drop[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__genesis__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-genesis-help-command-$line[1]:" - case $line[1] in - (init-database) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(register-chain) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(deploy-l2-contracts) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(accept-chain-ownership) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(initialize-bridges) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(deploy-consensus-registry) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(deploy-multicall3) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(deploy-upgrader) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(deploy-paymaster) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(update-token-multiplier-setter) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -'*--components=[Components of server to run]:COMPONENTS:_default' \ -'*-a+[Additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[Additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--genesis[Run server in genesis mode]' \ -'--build[Build server but don'\''t run it]' \ -'--uring[Enables uring support for RocksDB]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(contract-verifier) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__chain__contract-verifier_commands" \ -"*::: :->contract-verifier" \ -&& ret=0 - - case $state in - (contract-verifier) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-contract-verifier-command-$line[1]:" - case $line[1] in - (run) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -'--zksolc-version=[Version of zksolc to install]:ZKSOLC_VERSION:_default' \ -'--zkvyper-version=[Version of zkvyper to install]:ZKVYPER_VERSION:_default' \ -'--solc-version=[Version of solc to install]:SOLC_VERSION:_default' \ -'--era-vm-solc-version=[Version of era vm solc to install]:ERA_VM_SOLC_VERSION:_default' \ -'--vyper-version=[Version of vyper to install]:VYPER_VERSION:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--only[Install only provided compilers]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__contract-verifier__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-contract-verifier-help-command-$line[1]:" - case $line[1] in - (run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(consensus) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__chain__consensus_commands" \ -"*::: :->consensus" \ -&& ret=0 - - case $state in - (consensus) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-consensus-command-$line[1]:" - case $line[1] in - (set-attester-committee) -_arguments "${_arguments_options[@]}" : \ -'--from-file=[Sets the attester committee in the consensus registry contract to the committee in the yaml file. File format is definied in \`commands/consensus/proto/mod.proto\`]:FROM_FILE:_files' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--from-genesis[Sets the attester committee in the consensus registry contract to \`consensus.genesis_spec.attesters\` in general.yaml]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(get-attester-committee) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__consensus__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-consensus-help-command-$line[1]:" - case $line[1] in - (set-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(get-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-help-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__help__init_commands" \ -"*::: :->init" \ -&& ret=0 - - case $state in - (init) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-help-init-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(genesis) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__help__genesis_commands" \ -"*::: :->genesis" \ -&& ret=0 - - case $state in - (genesis) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-help-genesis-command-$line[1]:" - case $line[1] in - (init-database) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(register-chain) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-l2-contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(accept-chain-ownership) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(initialize-bridges) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-consensus-registry) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-multicall3) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-upgrader) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-paymaster) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(update-token-multiplier-setter) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contract-verifier) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__help__contract-verifier_commands" \ -"*::: :->contract-verifier" \ -&& ret=0 - - case $state in - (contract-verifier) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-help-contract-verifier-command-$line[1]:" - case $line[1] in - (run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(consensus) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__chain__help__consensus_commands" \ -"*::: :->consensus" \ -&& ret=0 - - case $state in - (consensus) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-chain-help-consensus-command-$line[1]:" - case $line[1] in - (set-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(get-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(dev) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev_commands" \ -"*::: :->dev" \ -&& ret=0 - - case $state in - (dev) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-command-$line[1]:" - case $line[1] in - (database) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__database_commands" \ -"*::: :->database" \ -&& ret=0 - - case $state in - (database) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-database-command-$line[1]:" - case $line[1] in - (check-sqlx-data) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(drop) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(migrate) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(new-migration) -_arguments "${_arguments_options[@]}" : \ -'--database=[Database to create new migration for]:DATABASE:(prover core)' \ -'--name=[Migration name]:NAME:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(prepare) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(reset) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(setup) -_arguments "${_arguments_options[@]}" : \ -'-p+[Prover database]' \ -'--prover=[Prover database]' \ -'--prover-url=[URL of the Prover database. If not specified, it is used from the current chain'\''s secrets]:PROVER_URL:_default' \ -'-c+[Core database]' \ -'--core=[Core database]' \ -'--core-url=[URL of the Core database. If not specified, it is used from the current chain'\''s secrets.]:CORE_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__database__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-database-help-command-$line[1]:" - case $line[1] in - (check-sqlx-data) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(drop) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(migrate) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(new-migration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prepare) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(reset) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(test) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__test_commands" \ -"*::: :->test" \ -&& ret=0 - - case $state in - (test) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-test-command-$line[1]:" - case $line[1] in - (integration) -_arguments "${_arguments_options[@]}" : \ -'-t+[Run just the tests matching a pattern. Same as the -t flag on jest.]:TEST_PATTERN:_default' \ -'--test-pattern=[Run just the tests matching a pattern. Same as the -t flag on jest.]:TEST_PATTERN:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-e[Run tests for external node]' \ -'--external-node[Run tests for external node]' \ -'-n[Do not install or build dependencies]' \ -'--no-deps[Do not install or build dependencies]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(fees) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-n[Do not install or build dependencies]' \ -'--no-deps[Do not install or build dependencies]' \ -'--no-kill[The test will not kill all the nodes during execution]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(revert) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--enable-consensus[Enable consensus]' \ -'-e[Run tests for external node]' \ -'--external-node[Run tests for external node]' \ -'-n[Do not install or build dependencies]' \ -'--no-deps[Do not install or build dependencies]' \ -'--no-kill[The test will not kill all the nodes during execution]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(recovery) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-s[Run recovery from a snapshot instead of genesis]' \ -'--snapshot[Run recovery from a snapshot instead of genesis]' \ -'-n[Do not install or build dependencies]' \ -'--no-deps[Do not install or build dependencies]' \ -'--no-kill[The test will not kill all the nodes during execution]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(upgrade) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-n[Do not install or build dependencies]' \ -'--no-deps[Do not install or build dependencies]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(build) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(rust) -_arguments "${_arguments_options[@]}" : \ -'--options=[Cargo test flags]:OPTIONS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(l1-contracts) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(wallet) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(loadtest) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__test__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-test-help-command-$line[1]:" - case $line[1] in - (integration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(fees) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(revert) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(recovery) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(upgrade) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(rust) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(l1-contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(wallet) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(loadtest) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(clean) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__clean_commands" \ -"*::: :->clean" \ -&& ret=0 - - case $state in - (clean) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-clean-command-$line[1]:" - case $line[1] in - (all) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(contracts-cache) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__clean__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-clean-help-command-$line[1]:" - case $line[1] in - (all) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contracts-cache) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(snapshot) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__snapshot_commands" \ -"*::: :->snapshot" \ -&& ret=0 - - case $state in - (snapshot) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-snapshot-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__snapshot__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-snapshot-help-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(lint) -_arguments "${_arguments_options[@]}" : \ -'*-t+[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ -'*--targets=[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-c[]' \ -'--check[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(fmt) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-c[]' \ -'--check[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__fmt_commands" \ -"*::: :->fmt" \ -&& ret=0 - - case $state in - (fmt) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-fmt-command-$line[1]:" - case $line[1] in - (rustfmt) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(contract) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(prettier) -_arguments "${_arguments_options[@]}" : \ -'*-t+[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ -'*--targets=[]:TARGETS:(md sol js ts rs contracts autocompletion)' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__fmt__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-fmt-help-command-$line[1]:" - case $line[1] in - (rustfmt) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contract) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prettier) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__prover_commands" \ -"*::: :->prover" \ -&& ret=0 - - case $state in - (prover) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-prover-command-$line[1]:" - case $line[1] in - (info) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(insert-batch) -_arguments "${_arguments_options[@]}" : \ -'--number=[]:NUMBER:_default' \ -'--version=[]:VERSION:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--default[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(insert-version) -_arguments "${_arguments_options[@]}" : \ -'--version=[]:VERSION:_default' \ -'--snark-wrapper=[]:SNARK_WRAPPER:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--default[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__prover__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-prover-help-command-$line[1]:" - case $line[1] in - (info) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-batch) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-version) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(contracts) -_arguments "${_arguments_options[@]}" : \ -'--l1-contracts=[Build L1 contracts]' \ -'--l2-contracts=[Build L2 contracts]' \ -'--system-contracts=[Build system contracts]' \ -'--test-contracts=[Build test contracts]' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(config-writer) -_arguments "${_arguments_options[@]}" : \ -'-p+[Path to the config file to override]:PATH:_default' \ -'--path=[Path to the config file to override]:PATH:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(send-transactions) -_arguments "${_arguments_options[@]}" : \ -'--file=[]:FILE:_files' \ -'--private-key=[]:PRIVATE_KEY:_default' \ -'--l1-rpc-url=[]:L1_RPC_URL:_default' \ -'--confirmations=[]:CONFIRMATIONS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(status) -_arguments "${_arguments_options[@]}" : \ -'-u+[URL of the health check endpoint]:URL:_default' \ -'--url=[URL of the health check endpoint]:URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__dev__status_commands" \ -"*::: :->status" \ -&& ret=0 - - case $state in - (status) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-status-command-$line[1]:" - case $line[1] in - (ports) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__status__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-status-help-command-$line[1]:" - case $line[1] in - (ports) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(generate-genesis) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-command-$line[1]:" - case $line[1] in - (database) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__database_commands" \ -"*::: :->database" \ -&& ret=0 - - case $state in - (database) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-database-command-$line[1]:" - case $line[1] in - (check-sqlx-data) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(drop) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(migrate) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(new-migration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prepare) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(reset) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(test) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__test_commands" \ -"*::: :->test" \ -&& ret=0 - - case $state in - (test) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-test-command-$line[1]:" - case $line[1] in - (integration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(fees) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(revert) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(recovery) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(upgrade) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(rust) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(l1-contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(wallet) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(loadtest) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(clean) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__clean_commands" \ -"*::: :->clean" \ -&& ret=0 - - case $state in - (clean) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-clean-command-$line[1]:" - case $line[1] in - (all) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contracts-cache) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(snapshot) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__snapshot_commands" \ -"*::: :->snapshot" \ -&& ret=0 - - case $state in - (snapshot) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-snapshot-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(lint) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(fmt) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__fmt_commands" \ -"*::: :->fmt" \ -&& ret=0 - - case $state in - (fmt) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-fmt-command-$line[1]:" - case $line[1] in - (rustfmt) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contract) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prettier) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__prover_commands" \ -"*::: :->prover" \ -&& ret=0 - - case $state in - (prover) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-prover-command-$line[1]:" - case $line[1] in - (info) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-batch) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-version) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(config-writer) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(send-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(status) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__dev__help__status_commands" \ -"*::: :->status" \ -&& ret=0 - - case $state in - (status) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-dev-help-status-command-$line[1]:" - case $line[1] in - (ports) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(generate-genesis) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__prover_commands" \ -"*::: :->prover" \ -&& ret=0 - - case $state in - (prover) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-prover-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -'--proof-store-dir=[]:PROOF_STORE_DIR:_default' \ -'--bucket-base-url=[]:BUCKET_BASE_URL:_default' \ -'--credentials-file=[]:CREDENTIALS_FILE:_default' \ -'--bucket-name=[]:BUCKET_NAME:_default' \ -'--location=[]:LOCATION:_default' \ -'--project-id=[]:PROJECT_ID:_default' \ -'--shall-save-to-public-bucket=[]:SHALL_SAVE_TO_PUBLIC_BUCKET:(true false)' \ -'--public-store-dir=[]:PUBLIC_STORE_DIR:_default' \ -'--public-bucket-base-url=[]:PUBLIC_BUCKET_BASE_URL:_default' \ -'--public-credentials-file=[]:PUBLIC_CREDENTIALS_FILE:_default' \ -'--public-bucket-name=[]:PUBLIC_BUCKET_NAME:_default' \ -'--public-location=[]:PUBLIC_LOCATION:_default' \ -'--public-project-id=[]:PUBLIC_PROJECT_ID:_default' \ -'(--clone)--bellman-cuda-dir=[]:BELLMAN_CUDA_DIR:_default' \ -'--bellman-cuda=[]' \ -'--setup-compressor-key=[]' \ -'--path=[]:PATH:_default' \ -'--region=[]:REGION:(us europe asia)' \ -'--mode=[]:MODE:(download generate)' \ -'--setup-keys=[]' \ -'--setup-database=[]:SETUP_DATABASE:(true false)' \ -'--prover-db-url=[Prover database url without database name]:PROVER_DB_URL:_default' \ -'--prover-db-name=[Prover database name]:PROVER_DB_NAME:_default' \ -'-u+[Use default database urls and names]:USE_DEFAULT:(true false)' \ -'--use-default=[Use default database urls and names]:USE_DEFAULT:(true false)' \ -'-d+[]:DONT_DROP:(true false)' \ -'--dont-drop=[]:DONT_DROP:(true false)' \ -'--cloud-type=[]:CLOUD_TYPE:(gcp local)' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--dev[]' \ -'(--bellman-cuda-dir)--clone[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(setup-keys) -_arguments "${_arguments_options[@]}" : \ -'--region=[]:REGION:(us europe asia)' \ -'--mode=[]:MODE:(download generate)' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -'--component=[]:COMPONENT:(gateway witness-generator witness-vector-generator prover circuit-prover compressor prover-job-monitor)' \ -'--round=[]:ROUND:(all-rounds basic-circuits leaf-aggregation node-aggregation recursion-tip scheduler)' \ -'--threads=[]:THREADS:_default' \ -'--max-allocation=[Memory allocation limit in bytes (for prover component)]:MAX_ALLOCATION:_default' \ -'--witness-vector-generator-count=[]:WITNESS_VECTOR_GENERATOR_COUNT:_default' \ -'--max-allocation=[]:MAX_ALLOCATION:_default' \ -'--docker=[]:DOCKER:(true false)' \ -'--tag=[]:TAG:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(init-bellman-cuda) -_arguments "${_arguments_options[@]}" : \ -'(--clone)--bellman-cuda-dir=[]:BELLMAN_CUDA_DIR:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'(--bellman-cuda-dir)--clone[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(compressor-keys) -_arguments "${_arguments_options[@]}" : \ -'--path=[]:PATH:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__prover__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-prover-help-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup-keys) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init-bellman-cuda) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(compressor-keys) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(external-node) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__external-node_commands" \ -"*::: :->external-node" \ -&& ret=0 - - case $state in - (external-node) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-external-node-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -'--db-url=[]:DB_URL:_default' \ -'--db-name=[]:DB_NAME:_default' \ -'--l1-rpc-url=[]:L1_RPC_URL:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-u[Use default database urls and names]' \ -'--use-default[Use default database urls and names]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -'*--components=[Components of server to run]:COMPONENTS:_default' \ -'--enable-consensus=[Enable consensus]' \ -'*-a+[Additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[Additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--reinit[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__external-node__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-external-node-help-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -'-o+[Enable Grafana]' \ -'--observability=[Enable Grafana]' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(portal) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(explorer) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -":: :_zkstack__explorer_commands" \ -"*::: :->explorer" \ -&& ret=0 - - case $state in - (explorer) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-explorer-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(run-backend) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__explorer__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-explorer-help-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run-backend) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(update) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-c[Update only the config files]' \ -'--only-config[Update only the config files]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(markdown) -_arguments "${_arguments_options[@]}" : \ -'--chain=[Chain to use]:CHAIN:_default' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help]' \ -'--help[Print help]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help_commands" \ -"*::: :->help" \ -&& ret=0 - - case $state in - (help) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-command-$line[1]:" - case $line[1] in - (autocomplete) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(ecosystem) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__ecosystem_commands" \ -"*::: :->ecosystem" \ -&& ret=0 - - case $state in - (ecosystem) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-ecosystem-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(change-default-chain) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup-observability) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(chain) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__chain_commands" \ -"*::: :->chain" \ -&& ret=0 - - case $state in - (chain) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-chain-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__chain__init_commands" \ -"*::: :->init" \ -&& ret=0 - - case $state in - (init) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-chain-init-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(genesis) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__chain__genesis_commands" \ -"*::: :->genesis" \ -&& ret=0 - - case $state in - (genesis) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-chain-genesis-command-$line[1]:" - case $line[1] in - (init-database) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(register-chain) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-l2-contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(accept-chain-ownership) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(initialize-bridges) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-consensus-registry) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-multicall3) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-upgrader) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(deploy-paymaster) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(update-token-multiplier-setter) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(server) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contract-verifier) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__chain__contract-verifier_commands" \ -"*::: :->contract-verifier" \ -&& ret=0 - - case $state in - (contract-verifier) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-chain-contract-verifier-command-$line[1]:" - case $line[1] in - (run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(consensus) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__chain__consensus_commands" \ -"*::: :->consensus" \ -&& ret=0 - - case $state in - (consensus) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-chain-consensus-command-$line[1]:" - case $line[1] in - (set-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(get-attester-committee) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -;; -(dev) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev_commands" \ -"*::: :->dev" \ -&& ret=0 - - case $state in - (dev) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-command-$line[1]:" - case $line[1] in - (database) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__database_commands" \ -"*::: :->database" \ -&& ret=0 - - case $state in - (database) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-database-command-$line[1]:" - case $line[1] in - (check-sqlx-data) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(drop) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(migrate) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(new-migration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prepare) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(reset) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(test) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__test_commands" \ -"*::: :->test" \ -&& ret=0 - - case $state in - (test) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-test-command-$line[1]:" - case $line[1] in - (integration) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(fees) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(revert) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(recovery) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(upgrade) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(build) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(rust) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(l1-contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(wallet) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(loadtest) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(clean) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__clean_commands" \ -"*::: :->clean" \ -&& ret=0 - - case $state in - (clean) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-clean-command-$line[1]:" - case $line[1] in - (all) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contracts-cache) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(snapshot) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__snapshot_commands" \ -"*::: :->snapshot" \ -&& ret=0 - - case $state in - (snapshot) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-snapshot-command-$line[1]:" - case $line[1] in - (create) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(lint) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(fmt) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__fmt_commands" \ -"*::: :->fmt" \ -&& ret=0 - - case $state in - (fmt) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-fmt-command-$line[1]:" - case $line[1] in - (rustfmt) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(contract) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(prettier) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__prover_commands" \ -"*::: :->prover" \ -&& ret=0 - - case $state in - (prover) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-prover-command-$line[1]:" - case $line[1] in - (info) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-batch) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(insert-version) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(contracts) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(config-writer) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(send-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(status) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__dev__status_commands" \ -"*::: :->status" \ -&& ret=0 - - case $state in - (status) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-dev-status-command-$line[1]:" - case $line[1] in - (ports) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(generate-genesis) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(prover) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__prover_commands" \ -"*::: :->prover" \ -&& ret=0 - - case $state in - (prover) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-prover-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(setup-keys) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init-bellman-cuda) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(compressor-keys) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(external-node) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__external-node_commands" \ -"*::: :->external-node" \ -&& ret=0 - - case $state in - (external-node) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-external-node-command-$line[1]:" - case $line[1] in - (configs) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(containers) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(portal) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(explorer) -_arguments "${_arguments_options[@]}" : \ -":: :_zkstack__help__explorer_commands" \ -"*::: :->explorer" \ -&& ret=0 - - case $state in - (explorer) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:zkstack-help-explorer-command-$line[1]:" - case $line[1] in - (init) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run-backend) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(run) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; -(update) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(markdown) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; - esac - ;; -esac -;; - esac - ;; -esac -} - -(( $+functions[_zkstack_commands] )) || -_zkstack_commands() { - local commands; commands=( -'autocomplete:Create shell autocompletion files' \ -'ecosystem:Ecosystem related commands' \ -'chain:Chain related commands' \ -'dev:Supervisor related commands' \ -'prover:Prover related commands' \ -'external-node:External Node related commands' \ -'containers:Run containers for local development' \ -'portal:Run dapp-portal' \ -'explorer:Run block-explorer' \ -'update:Update ZKsync' \ -'markdown:Print markdown help' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack commands' commands "$@" -} -(( $+functions[_zkstack__autocomplete_commands] )) || -_zkstack__autocomplete_commands() { - local commands; commands=() - _describe -t commands 'zkstack autocomplete commands' commands "$@" -} -(( $+functions[_zkstack__chain_commands] )) || -_zkstack__chain_commands() { - local commands; commands=( -'create:Create a new chain, setting the necessary configurations for later initialization' \ -'build-transactions:Create unsigned transactions for chain deployment' \ -'init:Initialize chain, deploying necessary contracts and performing on-chain operations' \ -'genesis:Run server genesis' \ -'register-chain:Register a new chain on L1 (executed by L1 governor). This command deploys and configures Governance, ChainAdmin, and DiamondProxy contracts, registers chain with BridgeHub and sets pending admin for DiamondProxy. Note\: After completion, L2 governor can accept ownership by running \`accept-chain-ownership\`' \ -'deploy-l2-contracts:Deploy all L2 contracts (executed by L1 governor)' \ -'accept-chain-ownership:Accept ownership of L2 chain (executed by L2 governor). This command should be run after \`register-chain\` to accept ownership of newly created DiamondProxy contract' \ -'initialize-bridges:Initialize bridges on L2' \ -'deploy-consensus-registry:Deploy L2 consensus registry' \ -'deploy-multicall3:Deploy L2 multicall3' \ -'deploy-upgrader:Deploy Default Upgrader' \ -'deploy-paymaster:Deploy paymaster smart contract' \ -'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ -'server:Run server' \ -'contract-verifier:Run contract verifier' \ -'consensus:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain commands' commands "$@" -} -(( $+functions[_zkstack__chain__accept-chain-ownership_commands] )) || -_zkstack__chain__accept-chain-ownership_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain accept-chain-ownership commands' commands "$@" -} -(( $+functions[_zkstack__chain__build-transactions_commands] )) || -_zkstack__chain__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus_commands] )) || -_zkstack__chain__consensus_commands() { - local commands; commands=( -'set-attester-committee:Sets the attester committee in the consensus registry contract to \`consensus.genesis_spec.attesters\` in general.yaml' \ -'get-attester-committee:Fetches the attester committee from the consensus registry contract' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain consensus commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__get-attester-committee_commands] )) || -_zkstack__chain__consensus__get-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain consensus get-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__help_commands] )) || -_zkstack__chain__consensus__help_commands() { - local commands; commands=( -'set-attester-committee:Sets the attester committee in the consensus registry contract to \`consensus.genesis_spec.attesters\` in general.yaml' \ -'get-attester-committee:Fetches the attester committee from the consensus registry contract' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain consensus help commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__help__get-attester-committee_commands] )) || -_zkstack__chain__consensus__help__get-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain consensus help get-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__help__help_commands] )) || -_zkstack__chain__consensus__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain consensus help help commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__help__set-attester-committee_commands] )) || -_zkstack__chain__consensus__help__set-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain consensus help set-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__consensus__set-attester-committee_commands] )) || -_zkstack__chain__consensus__set-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain consensus set-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier_commands] )) || -_zkstack__chain__contract-verifier_commands() { - local commands; commands=( -'run:Run contract verifier' \ -'init:Download required binaries for contract verifier' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain contract-verifier commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__help_commands] )) || -_zkstack__chain__contract-verifier__help_commands() { - local commands; commands=( -'run:Run contract verifier' \ -'init:Download required binaries for contract verifier' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain contract-verifier help commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__help__help_commands] )) || -_zkstack__chain__contract-verifier__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain contract-verifier help help commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__help__init_commands] )) || -_zkstack__chain__contract-verifier__help__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain contract-verifier help init commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__help__run_commands] )) || -_zkstack__chain__contract-verifier__help__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain contract-verifier help run commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__init_commands] )) || -_zkstack__chain__contract-verifier__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain contract-verifier init commands' commands "$@" -} -(( $+functions[_zkstack__chain__contract-verifier__run_commands] )) || -_zkstack__chain__contract-verifier__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain contract-verifier run commands' commands "$@" -} -(( $+functions[_zkstack__chain__create_commands] )) || -_zkstack__chain__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain create commands' commands "$@" -} -(( $+functions[_zkstack__chain__deploy-consensus-registry_commands] )) || -_zkstack__chain__deploy-consensus-registry_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain deploy-consensus-registry commands' commands "$@" -} -(( $+functions[_zkstack__chain__deploy-l2-contracts_commands] )) || -_zkstack__chain__deploy-l2-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain deploy-l2-contracts commands' commands "$@" -} -(( $+functions[_zkstack__chain__deploy-multicall3_commands] )) || -_zkstack__chain__deploy-multicall3_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain deploy-multicall3 commands' commands "$@" -} -(( $+functions[_zkstack__chain__deploy-paymaster_commands] )) || -_zkstack__chain__deploy-paymaster_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain deploy-paymaster commands' commands "$@" -} -(( $+functions[_zkstack__chain__deploy-upgrader_commands] )) || -_zkstack__chain__deploy-upgrader_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain deploy-upgrader commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis_commands] )) || -_zkstack__chain__genesis_commands() { - local commands; commands=( -'init-database:Initialize databases' \ -'server:Runs server genesis' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain genesis commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__help_commands] )) || -_zkstack__chain__genesis__help_commands() { - local commands; commands=( -'init-database:Initialize databases' \ -'server:Runs server genesis' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain genesis help commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__help__help_commands] )) || -_zkstack__chain__genesis__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain genesis help help commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__help__init-database_commands] )) || -_zkstack__chain__genesis__help__init-database_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain genesis help init-database commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__help__server_commands] )) || -_zkstack__chain__genesis__help__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain genesis help server commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__init-database_commands] )) || -_zkstack__chain__genesis__init-database_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain genesis init-database commands' commands "$@" -} -(( $+functions[_zkstack__chain__genesis__server_commands] )) || -_zkstack__chain__genesis__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain genesis server commands' commands "$@" -} -(( $+functions[_zkstack__chain__help_commands] )) || -_zkstack__chain__help_commands() { - local commands; commands=( -'create:Create a new chain, setting the necessary configurations for later initialization' \ -'build-transactions:Create unsigned transactions for chain deployment' \ -'init:Initialize chain, deploying necessary contracts and performing on-chain operations' \ -'genesis:Run server genesis' \ -'register-chain:Register a new chain on L1 (executed by L1 governor). This command deploys and configures Governance, ChainAdmin, and DiamondProxy contracts, registers chain with BridgeHub and sets pending admin for DiamondProxy. Note\: After completion, L2 governor can accept ownership by running \`accept-chain-ownership\`' \ -'deploy-l2-contracts:Deploy all L2 contracts (executed by L1 governor)' \ -'accept-chain-ownership:Accept ownership of L2 chain (executed by L2 governor). This command should be run after \`register-chain\` to accept ownership of newly created DiamondProxy contract' \ -'initialize-bridges:Initialize bridges on L2' \ -'deploy-consensus-registry:Deploy L2 consensus registry' \ -'deploy-multicall3:Deploy L2 multicall3' \ -'deploy-upgrader:Deploy Default Upgrader' \ -'deploy-paymaster:Deploy paymaster smart contract' \ -'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ -'server:Run server' \ -'contract-verifier:Run contract verifier' \ -'consensus:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain help commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__accept-chain-ownership_commands] )) || -_zkstack__chain__help__accept-chain-ownership_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help accept-chain-ownership commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__build-transactions_commands] )) || -_zkstack__chain__help__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__consensus_commands] )) || -_zkstack__chain__help__consensus_commands() { - local commands; commands=( -'set-attester-committee:Sets the attester committee in the consensus registry contract to \`consensus.genesis_spec.attesters\` in general.yaml' \ -'get-attester-committee:Fetches the attester committee from the consensus registry contract' \ - ) - _describe -t commands 'zkstack chain help consensus commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__consensus__get-attester-committee_commands] )) || -_zkstack__chain__help__consensus__get-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help consensus get-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__consensus__set-attester-committee_commands] )) || -_zkstack__chain__help__consensus__set-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help consensus set-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__contract-verifier_commands] )) || -_zkstack__chain__help__contract-verifier_commands() { - local commands; commands=( -'run:Run contract verifier' \ -'init:Download required binaries for contract verifier' \ - ) - _describe -t commands 'zkstack chain help contract-verifier commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__contract-verifier__init_commands] )) || -_zkstack__chain__help__contract-verifier__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help contract-verifier init commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__contract-verifier__run_commands] )) || -_zkstack__chain__help__contract-verifier__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help contract-verifier run commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__create_commands] )) || -_zkstack__chain__help__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help create commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__deploy-consensus-registry_commands] )) || -_zkstack__chain__help__deploy-consensus-registry_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help deploy-consensus-registry commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__deploy-l2-contracts_commands] )) || -_zkstack__chain__help__deploy-l2-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help deploy-l2-contracts commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__deploy-multicall3_commands] )) || -_zkstack__chain__help__deploy-multicall3_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help deploy-multicall3 commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__deploy-paymaster_commands] )) || -_zkstack__chain__help__deploy-paymaster_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help deploy-paymaster commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__deploy-upgrader_commands] )) || -_zkstack__chain__help__deploy-upgrader_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help deploy-upgrader commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__genesis_commands] )) || -_zkstack__chain__help__genesis_commands() { - local commands; commands=( -'init-database:Initialize databases' \ -'server:Runs server genesis' \ - ) - _describe -t commands 'zkstack chain help genesis commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__genesis__init-database_commands] )) || -_zkstack__chain__help__genesis__init-database_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help genesis init-database commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__genesis__server_commands] )) || -_zkstack__chain__help__genesis__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help genesis server commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__help_commands] )) || -_zkstack__chain__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help help commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__init_commands] )) || -_zkstack__chain__help__init_commands() { - local commands; commands=( -'configs:Initialize chain configs' \ - ) - _describe -t commands 'zkstack chain help init commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__init__configs_commands] )) || -_zkstack__chain__help__init__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help init configs commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__initialize-bridges_commands] )) || -_zkstack__chain__help__initialize-bridges_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help initialize-bridges commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__register-chain_commands] )) || -_zkstack__chain__help__register-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help register-chain commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__server_commands] )) || -_zkstack__chain__help__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help server commands' commands "$@" -} -(( $+functions[_zkstack__chain__help__update-token-multiplier-setter_commands] )) || -_zkstack__chain__help__update-token-multiplier-setter_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain help update-token-multiplier-setter commands' commands "$@" -} -(( $+functions[_zkstack__chain__init_commands] )) || -_zkstack__chain__init_commands() { - local commands; commands=( -'configs:Initialize chain configs' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain init commands' commands "$@" -} -(( $+functions[_zkstack__chain__init__configs_commands] )) || -_zkstack__chain__init__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain init configs commands' commands "$@" -} -(( $+functions[_zkstack__chain__init__help_commands] )) || -_zkstack__chain__init__help_commands() { - local commands; commands=( -'configs:Initialize chain configs' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack chain init help commands' commands "$@" -} -(( $+functions[_zkstack__chain__init__help__configs_commands] )) || -_zkstack__chain__init__help__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain init help configs commands' commands "$@" -} -(( $+functions[_zkstack__chain__init__help__help_commands] )) || -_zkstack__chain__init__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain init help help commands' commands "$@" -} -(( $+functions[_zkstack__chain__initialize-bridges_commands] )) || -_zkstack__chain__initialize-bridges_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain initialize-bridges commands' commands "$@" -} -(( $+functions[_zkstack__chain__register-chain_commands] )) || -_zkstack__chain__register-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain register-chain commands' commands "$@" -} -(( $+functions[_zkstack__chain__server_commands] )) || -_zkstack__chain__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain server commands' commands "$@" -} -(( $+functions[_zkstack__chain__update-token-multiplier-setter_commands] )) || -_zkstack__chain__update-token-multiplier-setter_commands() { - local commands; commands=() - _describe -t commands 'zkstack chain update-token-multiplier-setter commands' commands "$@" -} -(( $+functions[_zkstack__containers_commands] )) || -_zkstack__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack containers commands' commands "$@" -} -(( $+functions[_zkstack__dev_commands] )) || -_zkstack__dev_commands() { - local commands; commands=( -'database:Database related commands' \ -'test:Run tests' \ -'clean:Clean artifacts' \ -'snapshot:Snapshots creator' \ -'lint:Lint code' \ -'fmt:Format code' \ -'prover:Protocol version used by provers' \ -'contracts:Build contracts' \ -'config-writer:Overwrite general config' \ -'send-transactions:Send transactions from file' \ -'status:Get status of the server' \ -'generate-genesis:Generate new genesis file based on current contracts' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean_commands] )) || -_zkstack__dev__clean_commands() { - local commands; commands=( -'all:Remove containers and contracts cache' \ -'containers:Remove containers and docker volumes' \ -'contracts-cache:Remove contracts caches' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev clean commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__all_commands] )) || -_zkstack__dev__clean__all_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean all commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__containers_commands] )) || -_zkstack__dev__clean__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean containers commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__contracts-cache_commands] )) || -_zkstack__dev__clean__contracts-cache_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean contracts-cache commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__help_commands] )) || -_zkstack__dev__clean__help_commands() { - local commands; commands=( -'all:Remove containers and contracts cache' \ -'containers:Remove containers and docker volumes' \ -'contracts-cache:Remove contracts caches' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev clean help commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__help__all_commands] )) || -_zkstack__dev__clean__help__all_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean help all commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__help__containers_commands] )) || -_zkstack__dev__clean__help__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean help containers commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__help__contracts-cache_commands] )) || -_zkstack__dev__clean__help__contracts-cache_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean help contracts-cache commands' commands "$@" -} -(( $+functions[_zkstack__dev__clean__help__help_commands] )) || -_zkstack__dev__clean__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev clean help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__config-writer_commands] )) || -_zkstack__dev__config-writer_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev config-writer commands' commands "$@" -} -(( $+functions[_zkstack__dev__contracts_commands] )) || -_zkstack__dev__contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev contracts commands' commands "$@" -} -(( $+functions[_zkstack__dev__database_commands] )) || -_zkstack__dev__database_commands() { - local commands; commands=( -'check-sqlx-data:Check sqlx-data.json is up to date. If no databases are selected, all databases will be checked.' \ -'drop:Drop databases. If no databases are selected, all databases will be dropped.' \ -'migrate:Migrate databases. If no databases are selected, all databases will be migrated.' \ -'new-migration:Create new migration' \ -'prepare:Prepare sqlx-data.json. If no databases are selected, all databases will be prepared.' \ -'reset:Reset databases. If no databases are selected, all databases will be reset.' \ -'setup:Setup databases. If no databases are selected, all databases will be setup.' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev database commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__check-sqlx-data_commands] )) || -_zkstack__dev__database__check-sqlx-data_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database check-sqlx-data commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__drop_commands] )) || -_zkstack__dev__database__drop_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database drop commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help_commands] )) || -_zkstack__dev__database__help_commands() { - local commands; commands=( -'check-sqlx-data:Check sqlx-data.json is up to date. If no databases are selected, all databases will be checked.' \ -'drop:Drop databases. If no databases are selected, all databases will be dropped.' \ -'migrate:Migrate databases. If no databases are selected, all databases will be migrated.' \ -'new-migration:Create new migration' \ -'prepare:Prepare sqlx-data.json. If no databases are selected, all databases will be prepared.' \ -'reset:Reset databases. If no databases are selected, all databases will be reset.' \ -'setup:Setup databases. If no databases are selected, all databases will be setup.' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev database help commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__check-sqlx-data_commands] )) || -_zkstack__dev__database__help__check-sqlx-data_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help check-sqlx-data commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__drop_commands] )) || -_zkstack__dev__database__help__drop_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help drop commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__help_commands] )) || -_zkstack__dev__database__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__migrate_commands] )) || -_zkstack__dev__database__help__migrate_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help migrate commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__new-migration_commands] )) || -_zkstack__dev__database__help__new-migration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help new-migration commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__prepare_commands] )) || -_zkstack__dev__database__help__prepare_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help prepare commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__reset_commands] )) || -_zkstack__dev__database__help__reset_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help reset commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__help__setup_commands] )) || -_zkstack__dev__database__help__setup_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database help setup commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__migrate_commands] )) || -_zkstack__dev__database__migrate_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database migrate commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__new-migration_commands] )) || -_zkstack__dev__database__new-migration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database new-migration commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__prepare_commands] )) || -_zkstack__dev__database__prepare_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database prepare commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__reset_commands] )) || -_zkstack__dev__database__reset_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database reset commands' commands "$@" -} -(( $+functions[_zkstack__dev__database__setup_commands] )) || -_zkstack__dev__database__setup_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev database setup commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt_commands] )) || -_zkstack__dev__fmt_commands() { - local commands; commands=( -'rustfmt:' \ -'contract:' \ -'prettier:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev fmt commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__contract_commands] )) || -_zkstack__dev__fmt__contract_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt contract commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__help_commands] )) || -_zkstack__dev__fmt__help_commands() { - local commands; commands=( -'rustfmt:' \ -'contract:' \ -'prettier:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev fmt help commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__help__contract_commands] )) || -_zkstack__dev__fmt__help__contract_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt help contract commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__help__help_commands] )) || -_zkstack__dev__fmt__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__help__prettier_commands] )) || -_zkstack__dev__fmt__help__prettier_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt help prettier commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__help__rustfmt_commands] )) || -_zkstack__dev__fmt__help__rustfmt_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt help rustfmt commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__prettier_commands] )) || -_zkstack__dev__fmt__prettier_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt prettier commands' commands "$@" -} -(( $+functions[_zkstack__dev__fmt__rustfmt_commands] )) || -_zkstack__dev__fmt__rustfmt_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev fmt rustfmt commands' commands "$@" -} -(( $+functions[_zkstack__dev__generate-genesis_commands] )) || -_zkstack__dev__generate-genesis_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev generate-genesis commands' commands "$@" -} -(( $+functions[_zkstack__dev__help_commands] )) || -_zkstack__dev__help_commands() { - local commands; commands=( -'database:Database related commands' \ -'test:Run tests' \ -'clean:Clean artifacts' \ -'snapshot:Snapshots creator' \ -'lint:Lint code' \ -'fmt:Format code' \ -'prover:Protocol version used by provers' \ -'contracts:Build contracts' \ -'config-writer:Overwrite general config' \ -'send-transactions:Send transactions from file' \ -'status:Get status of the server' \ -'generate-genesis:Generate new genesis file based on current contracts' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev help commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__clean_commands] )) || -_zkstack__dev__help__clean_commands() { - local commands; commands=( -'all:Remove containers and contracts cache' \ -'containers:Remove containers and docker volumes' \ -'contracts-cache:Remove contracts caches' \ - ) - _describe -t commands 'zkstack dev help clean commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__clean__all_commands] )) || -_zkstack__dev__help__clean__all_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help clean all commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__clean__containers_commands] )) || -_zkstack__dev__help__clean__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help clean containers commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__clean__contracts-cache_commands] )) || -_zkstack__dev__help__clean__contracts-cache_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help clean contracts-cache commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__config-writer_commands] )) || -_zkstack__dev__help__config-writer_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help config-writer commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__contracts_commands] )) || -_zkstack__dev__help__contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help contracts commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database_commands] )) || -_zkstack__dev__help__database_commands() { - local commands; commands=( -'check-sqlx-data:Check sqlx-data.json is up to date. If no databases are selected, all databases will be checked.' \ -'drop:Drop databases. If no databases are selected, all databases will be dropped.' \ -'migrate:Migrate databases. If no databases are selected, all databases will be migrated.' \ -'new-migration:Create new migration' \ -'prepare:Prepare sqlx-data.json. If no databases are selected, all databases will be prepared.' \ -'reset:Reset databases. If no databases are selected, all databases will be reset.' \ -'setup:Setup databases. If no databases are selected, all databases will be setup.' \ - ) - _describe -t commands 'zkstack dev help database commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__check-sqlx-data_commands] )) || -_zkstack__dev__help__database__check-sqlx-data_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database check-sqlx-data commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__drop_commands] )) || -_zkstack__dev__help__database__drop_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database drop commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__migrate_commands] )) || -_zkstack__dev__help__database__migrate_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database migrate commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__new-migration_commands] )) || -_zkstack__dev__help__database__new-migration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database new-migration commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__prepare_commands] )) || -_zkstack__dev__help__database__prepare_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database prepare commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__reset_commands] )) || -_zkstack__dev__help__database__reset_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database reset commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__database__setup_commands] )) || -_zkstack__dev__help__database__setup_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help database setup commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__fmt_commands] )) || -_zkstack__dev__help__fmt_commands() { - local commands; commands=( -'rustfmt:' \ -'contract:' \ -'prettier:' \ - ) - _describe -t commands 'zkstack dev help fmt commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__fmt__contract_commands] )) || -_zkstack__dev__help__fmt__contract_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help fmt contract commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__fmt__prettier_commands] )) || -_zkstack__dev__help__fmt__prettier_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help fmt prettier commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__fmt__rustfmt_commands] )) || -_zkstack__dev__help__fmt__rustfmt_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help fmt rustfmt commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__generate-genesis_commands] )) || -_zkstack__dev__help__generate-genesis_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help generate-genesis commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__help_commands] )) || -_zkstack__dev__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__lint_commands] )) || -_zkstack__dev__help__lint_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help lint commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__prover_commands] )) || -_zkstack__dev__help__prover_commands() { - local commands; commands=( -'info:' \ -'insert-batch:' \ -'insert-version:' \ - ) - _describe -t commands 'zkstack dev help prover commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__prover__info_commands] )) || -_zkstack__dev__help__prover__info_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help prover info commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__prover__insert-batch_commands] )) || -_zkstack__dev__help__prover__insert-batch_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help prover insert-batch commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__prover__insert-version_commands] )) || -_zkstack__dev__help__prover__insert-version_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help prover insert-version commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__send-transactions_commands] )) || -_zkstack__dev__help__send-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help send-transactions commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__snapshot_commands] )) || -_zkstack__dev__help__snapshot_commands() { - local commands; commands=( -'create:' \ - ) - _describe -t commands 'zkstack dev help snapshot commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__snapshot__create_commands] )) || -_zkstack__dev__help__snapshot__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help snapshot create commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__status_commands] )) || -_zkstack__dev__help__status_commands() { - local commands; commands=( -'ports:Show used ports' \ - ) - _describe -t commands 'zkstack dev help status commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__status__ports_commands] )) || -_zkstack__dev__help__status__ports_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help status ports commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test_commands] )) || -_zkstack__dev__help__test_commands() { - local commands; commands=( -'integration:Run integration tests' \ -'fees:Run fees test' \ -'revert:Run revert tests' \ -'recovery:Run recovery tests' \ -'upgrade:Run upgrade tests' \ -'build:Build all test dependencies' \ -'rust:Run unit-tests, accepts optional cargo test flags' \ -'l1-contracts:Run L1 contracts tests' \ -'prover:Run prover tests' \ -'wallet:Print test wallets information' \ -'loadtest:Run loadtest' \ - ) - _describe -t commands 'zkstack dev help test commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__build_commands] )) || -_zkstack__dev__help__test__build_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test build commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__fees_commands] )) || -_zkstack__dev__help__test__fees_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test fees commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__integration_commands] )) || -_zkstack__dev__help__test__integration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test integration commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__l1-contracts_commands] )) || -_zkstack__dev__help__test__l1-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test l1-contracts commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__loadtest_commands] )) || -_zkstack__dev__help__test__loadtest_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test loadtest commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__prover_commands] )) || -_zkstack__dev__help__test__prover_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test prover commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__recovery_commands] )) || -_zkstack__dev__help__test__recovery_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test recovery commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__revert_commands] )) || -_zkstack__dev__help__test__revert_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test revert commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__rust_commands] )) || -_zkstack__dev__help__test__rust_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test rust commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__upgrade_commands] )) || -_zkstack__dev__help__test__upgrade_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test upgrade commands' commands "$@" -} -(( $+functions[_zkstack__dev__help__test__wallet_commands] )) || -_zkstack__dev__help__test__wallet_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev help test wallet commands' commands "$@" -} -(( $+functions[_zkstack__dev__lint_commands] )) || -_zkstack__dev__lint_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev lint commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover_commands] )) || -_zkstack__dev__prover_commands() { - local commands; commands=( -'info:' \ -'insert-batch:' \ -'insert-version:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev prover commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__help_commands] )) || -_zkstack__dev__prover__help_commands() { - local commands; commands=( -'info:' \ -'insert-batch:' \ -'insert-version:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev prover help commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__help__help_commands] )) || -_zkstack__dev__prover__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__help__info_commands] )) || -_zkstack__dev__prover__help__info_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover help info commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__help__insert-batch_commands] )) || -_zkstack__dev__prover__help__insert-batch_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover help insert-batch commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__help__insert-version_commands] )) || -_zkstack__dev__prover__help__insert-version_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover help insert-version commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__info_commands] )) || -_zkstack__dev__prover__info_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover info commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__insert-batch_commands] )) || -_zkstack__dev__prover__insert-batch_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover insert-batch commands' commands "$@" -} -(( $+functions[_zkstack__dev__prover__insert-version_commands] )) || -_zkstack__dev__prover__insert-version_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev prover insert-version commands' commands "$@" -} -(( $+functions[_zkstack__dev__send-transactions_commands] )) || -_zkstack__dev__send-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev send-transactions commands' commands "$@" -} -(( $+functions[_zkstack__dev__snapshot_commands] )) || -_zkstack__dev__snapshot_commands() { - local commands; commands=( -'create:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev snapshot commands' commands "$@" -} -(( $+functions[_zkstack__dev__snapshot__create_commands] )) || -_zkstack__dev__snapshot__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev snapshot create commands' commands "$@" -} -(( $+functions[_zkstack__dev__snapshot__help_commands] )) || -_zkstack__dev__snapshot__help_commands() { - local commands; commands=( -'create:' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev snapshot help commands' commands "$@" -} -(( $+functions[_zkstack__dev__snapshot__help__create_commands] )) || -_zkstack__dev__snapshot__help__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev snapshot help create commands' commands "$@" -} -(( $+functions[_zkstack__dev__snapshot__help__help_commands] )) || -_zkstack__dev__snapshot__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev snapshot help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__status_commands] )) || -_zkstack__dev__status_commands() { - local commands; commands=( -'ports:Show used ports' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev status commands' commands "$@" -} -(( $+functions[_zkstack__dev__status__help_commands] )) || -_zkstack__dev__status__help_commands() { - local commands; commands=( -'ports:Show used ports' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev status help commands' commands "$@" -} -(( $+functions[_zkstack__dev__status__help__help_commands] )) || -_zkstack__dev__status__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev status help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__status__help__ports_commands] )) || -_zkstack__dev__status__help__ports_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev status help ports commands' commands "$@" -} -(( $+functions[_zkstack__dev__status__ports_commands] )) || -_zkstack__dev__status__ports_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev status ports commands' commands "$@" -} -(( $+functions[_zkstack__dev__test_commands] )) || -_zkstack__dev__test_commands() { - local commands; commands=( -'integration:Run integration tests' \ -'fees:Run fees test' \ -'revert:Run revert tests' \ -'recovery:Run recovery tests' \ -'upgrade:Run upgrade tests' \ -'build:Build all test dependencies' \ -'rust:Run unit-tests, accepts optional cargo test flags' \ -'l1-contracts:Run L1 contracts tests' \ -'prover:Run prover tests' \ -'wallet:Print test wallets information' \ -'loadtest:Run loadtest' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev test commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__build_commands] )) || -_zkstack__dev__test__build_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test build commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__fees_commands] )) || -_zkstack__dev__test__fees_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test fees commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help_commands] )) || -_zkstack__dev__test__help_commands() { - local commands; commands=( -'integration:Run integration tests' \ -'fees:Run fees test' \ -'revert:Run revert tests' \ -'recovery:Run recovery tests' \ -'upgrade:Run upgrade tests' \ -'build:Build all test dependencies' \ -'rust:Run unit-tests, accepts optional cargo test flags' \ -'l1-contracts:Run L1 contracts tests' \ -'prover:Run prover tests' \ -'wallet:Print test wallets information' \ -'loadtest:Run loadtest' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack dev test help commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__build_commands] )) || -_zkstack__dev__test__help__build_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help build commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__fees_commands] )) || -_zkstack__dev__test__help__fees_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help fees commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__help_commands] )) || -_zkstack__dev__test__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help help commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__integration_commands] )) || -_zkstack__dev__test__help__integration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help integration commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__l1-contracts_commands] )) || -_zkstack__dev__test__help__l1-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help l1-contracts commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__loadtest_commands] )) || -_zkstack__dev__test__help__loadtest_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help loadtest commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__prover_commands] )) || -_zkstack__dev__test__help__prover_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help prover commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__recovery_commands] )) || -_zkstack__dev__test__help__recovery_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help recovery commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__revert_commands] )) || -_zkstack__dev__test__help__revert_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help revert commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__rust_commands] )) || -_zkstack__dev__test__help__rust_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help rust commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__upgrade_commands] )) || -_zkstack__dev__test__help__upgrade_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help upgrade commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__help__wallet_commands] )) || -_zkstack__dev__test__help__wallet_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test help wallet commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__integration_commands] )) || -_zkstack__dev__test__integration_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test integration commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__l1-contracts_commands] )) || -_zkstack__dev__test__l1-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test l1-contracts commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__loadtest_commands] )) || -_zkstack__dev__test__loadtest_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test loadtest commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__prover_commands] )) || -_zkstack__dev__test__prover_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test prover commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__recovery_commands] )) || -_zkstack__dev__test__recovery_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test recovery commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__revert_commands] )) || -_zkstack__dev__test__revert_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test revert commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__rust_commands] )) || -_zkstack__dev__test__rust_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test rust commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__upgrade_commands] )) || -_zkstack__dev__test__upgrade_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test upgrade commands' commands "$@" -} -(( $+functions[_zkstack__dev__test__wallet_commands] )) || -_zkstack__dev__test__wallet_commands() { - local commands; commands=() - _describe -t commands 'zkstack dev test wallet commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem_commands] )) || -_zkstack__ecosystem_commands() { - local commands; commands=( -'create:Create a new ecosystem and chain, setting necessary configurations for later initialization' \ -'build-transactions:Create transactions to build ecosystem contracts' \ -'init:Initialize ecosystem and chain, deploying necessary contracts and performing on-chain operations' \ -'change-default-chain:Change the default chain' \ -'setup-observability:Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack ecosystem commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__build-transactions_commands] )) || -_zkstack__ecosystem__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__change-default-chain_commands] )) || -_zkstack__ecosystem__change-default-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem change-default-chain commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__create_commands] )) || -_zkstack__ecosystem__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem create commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help_commands] )) || -_zkstack__ecosystem__help_commands() { - local commands; commands=( -'create:Create a new ecosystem and chain, setting necessary configurations for later initialization' \ -'build-transactions:Create transactions to build ecosystem contracts' \ -'init:Initialize ecosystem and chain, deploying necessary contracts and performing on-chain operations' \ -'change-default-chain:Change the default chain' \ -'setup-observability:Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack ecosystem help commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__build-transactions_commands] )) || -_zkstack__ecosystem__help__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__change-default-chain_commands] )) || -_zkstack__ecosystem__help__change-default-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help change-default-chain commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__create_commands] )) || -_zkstack__ecosystem__help__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help create commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__help_commands] )) || -_zkstack__ecosystem__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help help commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__init_commands] )) || -_zkstack__ecosystem__help__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help init commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__help__setup-observability_commands] )) || -_zkstack__ecosystem__help__setup-observability_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem help setup-observability commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__init_commands] )) || -_zkstack__ecosystem__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem init commands' commands "$@" -} -(( $+functions[_zkstack__ecosystem__setup-observability_commands] )) || -_zkstack__ecosystem__setup-observability_commands() { - local commands; commands=() - _describe -t commands 'zkstack ecosystem setup-observability commands' commands "$@" -} -(( $+functions[_zkstack__explorer_commands] )) || -_zkstack__explorer_commands() { - local commands; commands=( -'init:Initialize explorer (create database to store explorer data and generate docker compose file with explorer services). Runs for all chains, unless --chain is passed' \ -'run-backend:Start explorer backend services (api, data_fetcher, worker) for a given chain. Uses default chain, unless --chain is passed' \ -'run:Run explorer app' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack explorer commands' commands "$@" -} -(( $+functions[_zkstack__explorer__help_commands] )) || -_zkstack__explorer__help_commands() { - local commands; commands=( -'init:Initialize explorer (create database to store explorer data and generate docker compose file with explorer services). Runs for all chains, unless --chain is passed' \ -'run-backend:Start explorer backend services (api, data_fetcher, worker) for a given chain. Uses default chain, unless --chain is passed' \ -'run:Run explorer app' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack explorer help commands' commands "$@" -} -(( $+functions[_zkstack__explorer__help__help_commands] )) || -_zkstack__explorer__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer help help commands' commands "$@" -} -(( $+functions[_zkstack__explorer__help__init_commands] )) || -_zkstack__explorer__help__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer help init commands' commands "$@" -} -(( $+functions[_zkstack__explorer__help__run_commands] )) || -_zkstack__explorer__help__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer help run commands' commands "$@" -} -(( $+functions[_zkstack__explorer__help__run-backend_commands] )) || -_zkstack__explorer__help__run-backend_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer help run-backend commands' commands "$@" -} -(( $+functions[_zkstack__explorer__init_commands] )) || -_zkstack__explorer__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer init commands' commands "$@" -} -(( $+functions[_zkstack__explorer__run_commands] )) || -_zkstack__explorer__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer run commands' commands "$@" -} -(( $+functions[_zkstack__explorer__run-backend_commands] )) || -_zkstack__explorer__run-backend_commands() { - local commands; commands=() - _describe -t commands 'zkstack explorer run-backend commands' commands "$@" -} -(( $+functions[_zkstack__external-node_commands] )) || -_zkstack__external-node_commands() { - local commands; commands=( -'configs:Prepare configs for EN' \ -'init:Init databases' \ -'run:Run external node' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack external-node commands' commands "$@" -} -(( $+functions[_zkstack__external-node__configs_commands] )) || -_zkstack__external-node__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node configs commands' commands "$@" -} -(( $+functions[_zkstack__external-node__help_commands] )) || -_zkstack__external-node__help_commands() { - local commands; commands=( -'configs:Prepare configs for EN' \ -'init:Init databases' \ -'run:Run external node' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack external-node help commands' commands "$@" -} -(( $+functions[_zkstack__external-node__help__configs_commands] )) || -_zkstack__external-node__help__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node help configs commands' commands "$@" -} -(( $+functions[_zkstack__external-node__help__help_commands] )) || -_zkstack__external-node__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node help help commands' commands "$@" -} -(( $+functions[_zkstack__external-node__help__init_commands] )) || -_zkstack__external-node__help__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node help init commands' commands "$@" -} -(( $+functions[_zkstack__external-node__help__run_commands] )) || -_zkstack__external-node__help__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node help run commands' commands "$@" -} -(( $+functions[_zkstack__external-node__init_commands] )) || -_zkstack__external-node__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node init commands' commands "$@" -} -(( $+functions[_zkstack__external-node__run_commands] )) || -_zkstack__external-node__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack external-node run commands' commands "$@" -} -(( $+functions[_zkstack__help_commands] )) || -_zkstack__help_commands() { - local commands; commands=( -'autocomplete:Create shell autocompletion files' \ -'ecosystem:Ecosystem related commands' \ -'chain:Chain related commands' \ -'dev:Supervisor related commands' \ -'prover:Prover related commands' \ -'external-node:External Node related commands' \ -'containers:Run containers for local development' \ -'portal:Run dapp-portal' \ -'explorer:Run block-explorer' \ -'update:Update ZKsync' \ -'markdown:Print markdown help' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack help commands' commands "$@" -} -(( $+functions[_zkstack__help__autocomplete_commands] )) || -_zkstack__help__autocomplete_commands() { - local commands; commands=() - _describe -t commands 'zkstack help autocomplete commands' commands "$@" -} -(( $+functions[_zkstack__help__chain_commands] )) || -_zkstack__help__chain_commands() { - local commands; commands=( -'create:Create a new chain, setting the necessary configurations for later initialization' \ -'build-transactions:Create unsigned transactions for chain deployment' \ -'init:Initialize chain, deploying necessary contracts and performing on-chain operations' \ -'genesis:Run server genesis' \ -'register-chain:Register a new chain on L1 (executed by L1 governor). This command deploys and configures Governance, ChainAdmin, and DiamondProxy contracts, registers chain with BridgeHub and sets pending admin for DiamondProxy. Note\: After completion, L2 governor can accept ownership by running \`accept-chain-ownership\`' \ -'deploy-l2-contracts:Deploy all L2 contracts (executed by L1 governor)' \ -'accept-chain-ownership:Accept ownership of L2 chain (executed by L2 governor). This command should be run after \`register-chain\` to accept ownership of newly created DiamondProxy contract' \ -'initialize-bridges:Initialize bridges on L2' \ -'deploy-consensus-registry:Deploy L2 consensus registry' \ -'deploy-multicall3:Deploy L2 multicall3' \ -'deploy-upgrader:Deploy Default Upgrader' \ -'deploy-paymaster:Deploy paymaster smart contract' \ -'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ -'server:Run server' \ -'contract-verifier:Run contract verifier' \ -'consensus:' \ - ) - _describe -t commands 'zkstack help chain commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__accept-chain-ownership_commands] )) || -_zkstack__help__chain__accept-chain-ownership_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain accept-chain-ownership commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__build-transactions_commands] )) || -_zkstack__help__chain__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__consensus_commands] )) || -_zkstack__help__chain__consensus_commands() { - local commands; commands=( -'set-attester-committee:Sets the attester committee in the consensus registry contract to \`consensus.genesis_spec.attesters\` in general.yaml' \ -'get-attester-committee:Fetches the attester committee from the consensus registry contract' \ - ) - _describe -t commands 'zkstack help chain consensus commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__consensus__get-attester-committee_commands] )) || -_zkstack__help__chain__consensus__get-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain consensus get-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__consensus__set-attester-committee_commands] )) || -_zkstack__help__chain__consensus__set-attester-committee_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain consensus set-attester-committee commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__contract-verifier_commands] )) || -_zkstack__help__chain__contract-verifier_commands() { - local commands; commands=( -'run:Run contract verifier' \ -'init:Download required binaries for contract verifier' \ - ) - _describe -t commands 'zkstack help chain contract-verifier commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__contract-verifier__init_commands] )) || -_zkstack__help__chain__contract-verifier__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain contract-verifier init commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__contract-verifier__run_commands] )) || -_zkstack__help__chain__contract-verifier__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain contract-verifier run commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__create_commands] )) || -_zkstack__help__chain__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain create commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__deploy-consensus-registry_commands] )) || -_zkstack__help__chain__deploy-consensus-registry_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain deploy-consensus-registry commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__deploy-l2-contracts_commands] )) || -_zkstack__help__chain__deploy-l2-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain deploy-l2-contracts commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__deploy-multicall3_commands] )) || -_zkstack__help__chain__deploy-multicall3_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain deploy-multicall3 commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__deploy-paymaster_commands] )) || -_zkstack__help__chain__deploy-paymaster_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain deploy-paymaster commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__deploy-upgrader_commands] )) || -_zkstack__help__chain__deploy-upgrader_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain deploy-upgrader commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__genesis_commands] )) || -_zkstack__help__chain__genesis_commands() { - local commands; commands=( -'init-database:Initialize databases' \ -'server:Runs server genesis' \ - ) - _describe -t commands 'zkstack help chain genesis commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__genesis__init-database_commands] )) || -_zkstack__help__chain__genesis__init-database_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain genesis init-database commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__genesis__server_commands] )) || -_zkstack__help__chain__genesis__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain genesis server commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__init_commands] )) || -_zkstack__help__chain__init_commands() { - local commands; commands=( -'configs:Initialize chain configs' \ - ) - _describe -t commands 'zkstack help chain init commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__init__configs_commands] )) || -_zkstack__help__chain__init__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain init configs commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__initialize-bridges_commands] )) || -_zkstack__help__chain__initialize-bridges_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain initialize-bridges commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__register-chain_commands] )) || -_zkstack__help__chain__register-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain register-chain commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__server_commands] )) || -_zkstack__help__chain__server_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain server commands' commands "$@" -} -(( $+functions[_zkstack__help__chain__update-token-multiplier-setter_commands] )) || -_zkstack__help__chain__update-token-multiplier-setter_commands() { - local commands; commands=() - _describe -t commands 'zkstack help chain update-token-multiplier-setter commands' commands "$@" -} -(( $+functions[_zkstack__help__containers_commands] )) || -_zkstack__help__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack help containers commands' commands "$@" -} -(( $+functions[_zkstack__help__dev_commands] )) || -_zkstack__help__dev_commands() { - local commands; commands=( -'database:Database related commands' \ -'test:Run tests' \ -'clean:Clean artifacts' \ -'snapshot:Snapshots creator' \ -'lint:Lint code' \ -'fmt:Format code' \ -'prover:Protocol version used by provers' \ -'contracts:Build contracts' \ -'config-writer:Overwrite general config' \ -'send-transactions:Send transactions from file' \ -'status:Get status of the server' \ -'generate-genesis:Generate new genesis file based on current contracts' \ - ) - _describe -t commands 'zkstack help dev commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__clean_commands] )) || -_zkstack__help__dev__clean_commands() { - local commands; commands=( -'all:Remove containers and contracts cache' \ -'containers:Remove containers and docker volumes' \ -'contracts-cache:Remove contracts caches' \ - ) - _describe -t commands 'zkstack help dev clean commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__clean__all_commands] )) || -_zkstack__help__dev__clean__all_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev clean all commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__clean__containers_commands] )) || -_zkstack__help__dev__clean__containers_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev clean containers commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__clean__contracts-cache_commands] )) || -_zkstack__help__dev__clean__contracts-cache_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev clean contracts-cache commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__config-writer_commands] )) || -_zkstack__help__dev__config-writer_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev config-writer commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__contracts_commands] )) || -_zkstack__help__dev__contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev contracts commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database_commands] )) || -_zkstack__help__dev__database_commands() { - local commands; commands=( -'check-sqlx-data:Check sqlx-data.json is up to date. If no databases are selected, all databases will be checked.' \ -'drop:Drop databases. If no databases are selected, all databases will be dropped.' \ -'migrate:Migrate databases. If no databases are selected, all databases will be migrated.' \ -'new-migration:Create new migration' \ -'prepare:Prepare sqlx-data.json. If no databases are selected, all databases will be prepared.' \ -'reset:Reset databases. If no databases are selected, all databases will be reset.' \ -'setup:Setup databases. If no databases are selected, all databases will be setup.' \ - ) - _describe -t commands 'zkstack help dev database commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__check-sqlx-data_commands] )) || -_zkstack__help__dev__database__check-sqlx-data_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database check-sqlx-data commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__drop_commands] )) || -_zkstack__help__dev__database__drop_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database drop commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__migrate_commands] )) || -_zkstack__help__dev__database__migrate_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database migrate commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__new-migration_commands] )) || -_zkstack__help__dev__database__new-migration_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database new-migration commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__prepare_commands] )) || -_zkstack__help__dev__database__prepare_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database prepare commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__reset_commands] )) || -_zkstack__help__dev__database__reset_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database reset commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__database__setup_commands] )) || -_zkstack__help__dev__database__setup_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev database setup commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__fmt_commands] )) || -_zkstack__help__dev__fmt_commands() { - local commands; commands=( -'rustfmt:' \ -'contract:' \ -'prettier:' \ - ) - _describe -t commands 'zkstack help dev fmt commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__fmt__contract_commands] )) || -_zkstack__help__dev__fmt__contract_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev fmt contract commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__fmt__prettier_commands] )) || -_zkstack__help__dev__fmt__prettier_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev fmt prettier commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__fmt__rustfmt_commands] )) || -_zkstack__help__dev__fmt__rustfmt_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev fmt rustfmt commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__generate-genesis_commands] )) || -_zkstack__help__dev__generate-genesis_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev generate-genesis commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__lint_commands] )) || -_zkstack__help__dev__lint_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev lint commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__prover_commands] )) || -_zkstack__help__dev__prover_commands() { - local commands; commands=( -'info:' \ -'insert-batch:' \ -'insert-version:' \ - ) - _describe -t commands 'zkstack help dev prover commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__prover__info_commands] )) || -_zkstack__help__dev__prover__info_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev prover info commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__prover__insert-batch_commands] )) || -_zkstack__help__dev__prover__insert-batch_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev prover insert-batch commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__prover__insert-version_commands] )) || -_zkstack__help__dev__prover__insert-version_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev prover insert-version commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__send-transactions_commands] )) || -_zkstack__help__dev__send-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev send-transactions commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__snapshot_commands] )) || -_zkstack__help__dev__snapshot_commands() { - local commands; commands=( -'create:' \ - ) - _describe -t commands 'zkstack help dev snapshot commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__snapshot__create_commands] )) || -_zkstack__help__dev__snapshot__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev snapshot create commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__status_commands] )) || -_zkstack__help__dev__status_commands() { - local commands; commands=( -'ports:Show used ports' \ - ) - _describe -t commands 'zkstack help dev status commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__status__ports_commands] )) || -_zkstack__help__dev__status__ports_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev status ports commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test_commands] )) || -_zkstack__help__dev__test_commands() { - local commands; commands=( -'integration:Run integration tests' \ -'fees:Run fees test' \ -'revert:Run revert tests' \ -'recovery:Run recovery tests' \ -'upgrade:Run upgrade tests' \ -'build:Build all test dependencies' \ -'rust:Run unit-tests, accepts optional cargo test flags' \ -'l1-contracts:Run L1 contracts tests' \ -'prover:Run prover tests' \ -'wallet:Print test wallets information' \ -'loadtest:Run loadtest' \ - ) - _describe -t commands 'zkstack help dev test commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__build_commands] )) || -_zkstack__help__dev__test__build_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test build commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__fees_commands] )) || -_zkstack__help__dev__test__fees_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test fees commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__integration_commands] )) || -_zkstack__help__dev__test__integration_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test integration commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__l1-contracts_commands] )) || -_zkstack__help__dev__test__l1-contracts_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test l1-contracts commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__loadtest_commands] )) || -_zkstack__help__dev__test__loadtest_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test loadtest commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__prover_commands] )) || -_zkstack__help__dev__test__prover_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test prover commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__recovery_commands] )) || -_zkstack__help__dev__test__recovery_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test recovery commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__revert_commands] )) || -_zkstack__help__dev__test__revert_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test revert commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__rust_commands] )) || -_zkstack__help__dev__test__rust_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test rust commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__upgrade_commands] )) || -_zkstack__help__dev__test__upgrade_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test upgrade commands' commands "$@" -} -(( $+functions[_zkstack__help__dev__test__wallet_commands] )) || -_zkstack__help__dev__test__wallet_commands() { - local commands; commands=() - _describe -t commands 'zkstack help dev test wallet commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem_commands] )) || -_zkstack__help__ecosystem_commands() { - local commands; commands=( -'create:Create a new ecosystem and chain, setting necessary configurations for later initialization' \ -'build-transactions:Create transactions to build ecosystem contracts' \ -'init:Initialize ecosystem and chain, deploying necessary contracts and performing on-chain operations' \ -'change-default-chain:Change the default chain' \ -'setup-observability:Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' \ - ) - _describe -t commands 'zkstack help ecosystem commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem__build-transactions_commands] )) || -_zkstack__help__ecosystem__build-transactions_commands() { - local commands; commands=() - _describe -t commands 'zkstack help ecosystem build-transactions commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem__change-default-chain_commands] )) || -_zkstack__help__ecosystem__change-default-chain_commands() { - local commands; commands=() - _describe -t commands 'zkstack help ecosystem change-default-chain commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem__create_commands] )) || -_zkstack__help__ecosystem__create_commands() { - local commands; commands=() - _describe -t commands 'zkstack help ecosystem create commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem__init_commands] )) || -_zkstack__help__ecosystem__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack help ecosystem init commands' commands "$@" -} -(( $+functions[_zkstack__help__ecosystem__setup-observability_commands] )) || -_zkstack__help__ecosystem__setup-observability_commands() { - local commands; commands=() - _describe -t commands 'zkstack help ecosystem setup-observability commands' commands "$@" -} -(( $+functions[_zkstack__help__explorer_commands] )) || -_zkstack__help__explorer_commands() { - local commands; commands=( -'init:Initialize explorer (create database to store explorer data and generate docker compose file with explorer services). Runs for all chains, unless --chain is passed' \ -'run-backend:Start explorer backend services (api, data_fetcher, worker) for a given chain. Uses default chain, unless --chain is passed' \ -'run:Run explorer app' \ - ) - _describe -t commands 'zkstack help explorer commands' commands "$@" -} -(( $+functions[_zkstack__help__explorer__init_commands] )) || -_zkstack__help__explorer__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack help explorer init commands' commands "$@" -} -(( $+functions[_zkstack__help__explorer__run_commands] )) || -_zkstack__help__explorer__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack help explorer run commands' commands "$@" -} -(( $+functions[_zkstack__help__explorer__run-backend_commands] )) || -_zkstack__help__explorer__run-backend_commands() { - local commands; commands=() - _describe -t commands 'zkstack help explorer run-backend commands' commands "$@" -} -(( $+functions[_zkstack__help__external-node_commands] )) || -_zkstack__help__external-node_commands() { - local commands; commands=( -'configs:Prepare configs for EN' \ -'init:Init databases' \ -'run:Run external node' \ - ) - _describe -t commands 'zkstack help external-node commands' commands "$@" -} -(( $+functions[_zkstack__help__external-node__configs_commands] )) || -_zkstack__help__external-node__configs_commands() { - local commands; commands=() - _describe -t commands 'zkstack help external-node configs commands' commands "$@" -} -(( $+functions[_zkstack__help__external-node__init_commands] )) || -_zkstack__help__external-node__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack help external-node init commands' commands "$@" -} -(( $+functions[_zkstack__help__external-node__run_commands] )) || -_zkstack__help__external-node__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack help external-node run commands' commands "$@" -} -(( $+functions[_zkstack__help__help_commands] )) || -_zkstack__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack help help commands' commands "$@" -} -(( $+functions[_zkstack__help__markdown_commands] )) || -_zkstack__help__markdown_commands() { - local commands; commands=() - _describe -t commands 'zkstack help markdown commands' commands "$@" -} -(( $+functions[_zkstack__help__portal_commands] )) || -_zkstack__help__portal_commands() { - local commands; commands=() - _describe -t commands 'zkstack help portal commands' commands "$@" -} -(( $+functions[_zkstack__help__prover_commands] )) || -_zkstack__help__prover_commands() { - local commands; commands=( -'init:Initialize prover' \ -'setup-keys:Generate setup keys' \ -'run:Run prover' \ -'init-bellman-cuda:Initialize bellman-cuda' \ -'compressor-keys:Download compressor keys' \ - ) - _describe -t commands 'zkstack help prover commands' commands "$@" -} -(( $+functions[_zkstack__help__prover__compressor-keys_commands] )) || -_zkstack__help__prover__compressor-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack help prover compressor-keys commands' commands "$@" -} -(( $+functions[_zkstack__help__prover__init_commands] )) || -_zkstack__help__prover__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack help prover init commands' commands "$@" -} -(( $+functions[_zkstack__help__prover__init-bellman-cuda_commands] )) || -_zkstack__help__prover__init-bellman-cuda_commands() { - local commands; commands=() - _describe -t commands 'zkstack help prover init-bellman-cuda commands' commands "$@" -} -(( $+functions[_zkstack__help__prover__run_commands] )) || -_zkstack__help__prover__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack help prover run commands' commands "$@" -} -(( $+functions[_zkstack__help__prover__setup-keys_commands] )) || -_zkstack__help__prover__setup-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack help prover setup-keys commands' commands "$@" -} -(( $+functions[_zkstack__help__update_commands] )) || -_zkstack__help__update_commands() { - local commands; commands=() - _describe -t commands 'zkstack help update commands' commands "$@" -} -(( $+functions[_zkstack__markdown_commands] )) || -_zkstack__markdown_commands() { - local commands; commands=() - _describe -t commands 'zkstack markdown commands' commands "$@" -} -(( $+functions[_zkstack__portal_commands] )) || -_zkstack__portal_commands() { - local commands; commands=() - _describe -t commands 'zkstack portal commands' commands "$@" -} -(( $+functions[_zkstack__prover_commands] )) || -_zkstack__prover_commands() { - local commands; commands=( -'init:Initialize prover' \ -'setup-keys:Generate setup keys' \ -'run:Run prover' \ -'init-bellman-cuda:Initialize bellman-cuda' \ -'compressor-keys:Download compressor keys' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack prover commands' commands "$@" -} -(( $+functions[_zkstack__prover__compressor-keys_commands] )) || -_zkstack__prover__compressor-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover compressor-keys commands' commands "$@" -} -(( $+functions[_zkstack__prover__help_commands] )) || -_zkstack__prover__help_commands() { - local commands; commands=( -'init:Initialize prover' \ -'setup-keys:Generate setup keys' \ -'run:Run prover' \ -'init-bellman-cuda:Initialize bellman-cuda' \ -'compressor-keys:Download compressor keys' \ -'help:Print this message or the help of the given subcommand(s)' \ - ) - _describe -t commands 'zkstack prover help commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__compressor-keys_commands] )) || -_zkstack__prover__help__compressor-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help compressor-keys commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__help_commands] )) || -_zkstack__prover__help__help_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help help commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__init_commands] )) || -_zkstack__prover__help__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help init commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__init-bellman-cuda_commands] )) || -_zkstack__prover__help__init-bellman-cuda_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help init-bellman-cuda commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__run_commands] )) || -_zkstack__prover__help__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help run commands' commands "$@" -} -(( $+functions[_zkstack__prover__help__setup-keys_commands] )) || -_zkstack__prover__help__setup-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover help setup-keys commands' commands "$@" -} -(( $+functions[_zkstack__prover__init_commands] )) || -_zkstack__prover__init_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover init commands' commands "$@" -} -(( $+functions[_zkstack__prover__init-bellman-cuda_commands] )) || -_zkstack__prover__init-bellman-cuda_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover init-bellman-cuda commands' commands "$@" -} -(( $+functions[_zkstack__prover__run_commands] )) || -_zkstack__prover__run_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover run commands' commands "$@" -} -(( $+functions[_zkstack__prover__setup-keys_commands] )) || -_zkstack__prover__setup-keys_commands() { - local commands; commands=() - _describe -t commands 'zkstack prover setup-keys commands' commands "$@" -} -(( $+functions[_zkstack__update_commands] )) || -_zkstack__update_commands() { - local commands; commands=() - _describe -t commands 'zkstack update commands' commands "$@" -} - -if [ "$funcstack[1]" = "_zkstack" ]; then - _zkstack "$@" -else - compdef _zkstack zkstack -fi From a01eea872295eb73484a058f7dcf9642419ac8ef Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Thu, 7 Nov 2024 15:34:06 -0300 Subject: [PATCH 8/9] Load chain in chain:run and pass it to the next commands --- .../commands/chain/contract_verifier/init.rs | 9 +++-- .../commands/chain/contract_verifier/mod.rs | 11 ++++-- .../commands/chain/contract_verifier/run.rs | 11 ++---- .../src/commands/chain/deploy_paymaster.rs | 13 +++---- .../src/commands/chain/genesis/database.rs | 14 ++++---- .../zkstack/src/commands/chain/genesis/mod.rs | 35 +++++++++++-------- .../src/commands/chain/genesis/server.rs | 24 ++++++------- .../crates/zkstack/src/commands/chain/mod.rs | 25 +++++++++---- .../zkstack/src/commands/chain/server.rs | 30 ++++++---------- 9 files changed, 89 insertions(+), 83 deletions(-) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/init.rs b/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/init.rs index 8cfe019a53c..3e886822669 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/init.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/init.rs @@ -1,15 +1,18 @@ use std::path::{Path, PathBuf}; use common::{cmd::Cmd, logger, spinner::Spinner}; -use config::zkstack_config::ZkStackConfig; +use config::ChainConfig; use xshell::{cmd, Shell}; use super::args::{init::InitContractVerifierArgs, releases::Version}; use crate::messages::{msg_binary_already_exists, msg_downloading_binary_spinner}; -pub(crate) async fn run(shell: &Shell, args: InitContractVerifierArgs) -> anyhow::Result<()> { +pub(crate) async fn run( + shell: &Shell, + args: InitContractVerifierArgs, + chain: ChainConfig, +) -> anyhow::Result<()> { let args = args.fill_values_with_prompt(shell)?; - let chain = ZkStackConfig::load_current_chain(shell)?; let link_to_code = chain.link_to_code; download_binaries( diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/mod.rs index f70c75202f8..9520f95ee38 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/mod.rs @@ -1,5 +1,6 @@ use args::init::InitContractVerifierArgs; use clap::Subcommand; +use config::ChainConfig; use xshell::Shell; mod args; @@ -14,9 +15,13 @@ pub enum ContractVerifierCommands { Init(InitContractVerifierArgs), } -pub(crate) async fn run(shell: &Shell, args: ContractVerifierCommands) -> anyhow::Result<()> { +pub(crate) async fn run( + shell: &Shell, + args: ContractVerifierCommands, + chain: ChainConfig, +) -> anyhow::Result<()> { match args { - ContractVerifierCommands::Run => run::run(shell).await, - ContractVerifierCommands::Init(args) => init::run(shell, args).await, + ContractVerifierCommands::Run => run::run(shell, chain).await, + ContractVerifierCommands::Init(args) => init::run(shell, args, chain).await, } } diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/run.rs b/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/run.rs index ea3245a2e51..1ef631db54b 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/run.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/contract_verifier/run.rs @@ -1,16 +1,11 @@ use anyhow::Context; use common::{cmd::Cmd, logger}; -use config::zkstack_config::ZkStackConfig; +use config::ChainConfig; use xshell::{cmd, Shell}; -use crate::messages::{ - MSG_CHAIN_NOT_INITIALIZED, MSG_FAILED_TO_RUN_CONTRACT_VERIFIER_ERR, - MSG_RUNNING_CONTRACT_VERIFIER, -}; - -pub(crate) async fn run(shell: &Shell) -> anyhow::Result<()> { - let chain = ZkStackConfig::load_current_chain(shell).context(MSG_CHAIN_NOT_INITIALIZED)?; +use crate::messages::{MSG_FAILED_TO_RUN_CONTRACT_VERIFIER_ERR, MSG_RUNNING_CONTRACT_VERIFIER}; +pub(crate) async fn run(shell: &Shell, chain: ChainConfig) -> anyhow::Result<()> { let config_path = chain.path_to_general_config(); let secrets_path = chain.path_to_secrets_config(); 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 e2dd32c46e1..c6e89cd91c0 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/deploy_paymaster.rs @@ -6,22 +6,19 @@ use config::{ script_params::DEPLOY_PAYMASTER_SCRIPT_PARAMS, }, traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath}, - zkstack_config::ZkStackConfig, ChainConfig, ContractsConfig, }; use xshell::Shell; use crate::{ - messages::{MSG_CHAIN_NOT_INITIALIZED, MSG_L1_SECRETS_MUST_BE_PRESENTED}, + messages::MSG_L1_SECRETS_MUST_BE_PRESENTED, utils::forge::{check_the_balance, fill_forge_private_key}, }; -pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { - let chain_config = - ZkStackConfig::load_current_chain(shell).context(MSG_CHAIN_NOT_INITIALIZED)?; - let mut contracts = chain_config.get_contracts_config()?; - deploy_paymaster(shell, &chain_config, &mut contracts, args, None, true).await?; - contracts.save_with_base_path(shell, chain_config.configs) +pub async fn run(args: ForgeScriptArgs, shell: &Shell, chain: ChainConfig) -> anyhow::Result<()> { + let mut contracts = chain.get_contracts_config()?; + deploy_paymaster(shell, &chain, &mut contracts, args, None, true).await?; + contracts.save_with_base_path(shell, chain.configs) } pub async fn deploy_paymaster( 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 22ba6e1c355..240269a6c90 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/genesis/database.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/genesis/database.rs @@ -8,7 +8,7 @@ use common::{ }; use config::{ override_config, set_file_artifacts, set_rocks_db_config, set_server_database, - traits::SaveConfigWithBasePath, zkstack_config::ZkStackConfig, ChainConfig, FileArtifacts, + traits::SaveConfigWithBasePath, ChainConfig, FileArtifacts, }; use types::ProverMode; use xshell::Shell; @@ -27,18 +27,16 @@ use crate::{ utils::rocks_db::{recreate_rocksdb_dirs, RocksDBDirOption}, }; -pub async fn run(args: GenesisArgs, shell: &Shell) -> anyhow::Result<()> { - let chain_config = ZkStackConfig::load_current_chain(shell)?; - - let mut secrets = chain_config.get_secrets_config()?; - let args = args.fill_values_with_secrets(&chain_config)?; +pub async fn run(args: GenesisArgs, shell: &Shell, chain: ChainConfig) -> anyhow::Result<()> { + let mut secrets = chain.get_secrets_config()?; + let args = args.fill_values_with_secrets(&chain)?; set_server_database(&mut secrets, &args.server_db)?; - secrets.save_with_base_path(shell, &chain_config.configs)?; + secrets.save_with_base_path(shell, &chain.configs)?; initialize_server_database( shell, &args.server_db, - chain_config.link_to_code.clone(), + chain.link_to_code.clone(), args.dont_drop, ) .await?; 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 388c8a239fa..bb40a47b351 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/genesis/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/genesis/mod.rs @@ -1,6 +1,6 @@ use clap::{command, Parser, Subcommand}; use common::{logger, spinner::Spinner}; -use config::{zkstack_config::ZkStackConfig, ChainConfig}; +use config::ChainConfig; use xshell::Shell; use crate::{ @@ -36,19 +36,26 @@ pub struct GenesisCommand { args: GenesisArgs, } -pub(crate) async fn run(args: GenesisCommand, shell: &Shell) -> anyhow::Result<()> { +pub(crate) async fn run( + args: GenesisCommand, + shell: &Shell, + chain: ChainConfig, +) -> anyhow::Result<()> { match args.command { - Some(GenesisSubcommands::InitDatabase(args)) => database::run(*args, shell).await, - Some(GenesisSubcommands::Server) => server::run(shell).await, - None => run_genesis(args.args, shell).await, + Some(GenesisSubcommands::InitDatabase(args)) => database::run(*args, shell, chain).await, + Some(GenesisSubcommands::Server) => server::run(shell, chain).await, + None => run_genesis(args.args, shell, chain).await, } } -pub async fn run_genesis(args: GenesisArgs, shell: &Shell) -> anyhow::Result<()> { - let chain_config = ZkStackConfig::load_current_chain(shell)?; - let args = args.fill_values_with_prompt(&chain_config); +pub async fn run_genesis( + args: GenesisArgs, + shell: &Shell, + chain: ChainConfig, +) -> anyhow::Result<()> { + let args = args.fill_values_with_prompt(&chain); - genesis(args, shell, &chain_config).await?; + genesis(args, shell, &chain).await?; logger::outro(MSG_GENESIS_COMPLETED); Ok(()) @@ -57,14 +64,14 @@ pub async fn run_genesis(args: GenesisArgs, shell: &Shell) -> anyhow::Result<()> pub async fn genesis( args: GenesisArgsFinal, shell: &Shell, - config: &ChainConfig, + chain: &ChainConfig, ) -> anyhow::Result<()> { - genesis::database::update_configs(args.clone(), shell, config)?; + genesis::database::update_configs(args.clone(), shell, chain)?; logger::note( MSG_SELECTED_CONFIG, logger::object_to_string(serde_json::json!({ - "chain_config": config, + "chain_config": chain, "server_db_config": args.server_db, })), ); @@ -74,14 +81,14 @@ pub async fn genesis( initialize_server_database( shell, &args.server_db, - config.link_to_code.clone(), + chain.link_to_code.clone(), args.dont_drop, ) .await?; spinner.finish(); let spinner = Spinner::new(MSG_STARTING_GENESIS_SPINNER); - run_server_genesis(config, shell)?; + run_server_genesis(chain, shell)?; spinner.finish(); Ok(()) 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 c1e6e4e0d5a..93daa6c24d4 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/genesis/server.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/genesis/server.rs @@ -5,8 +5,8 @@ use common::{ spinner::Spinner, }; use config::{ - traits::FileConfigWithDefaultName, zkstack_config::ZkStackConfig, ChainConfig, ContractsConfig, - GeneralConfig, GenesisConfig, SecretsConfig, WalletsConfig, + traits::FileConfigWithDefaultName, ChainConfig, ContractsConfig, GeneralConfig, GenesisConfig, + SecretsConfig, WalletsConfig, }; use xshell::Shell; @@ -14,28 +14,26 @@ use crate::messages::{ MSG_FAILED_TO_RUN_SERVER_ERR, MSG_GENESIS_COMPLETED, MSG_STARTING_GENESIS_SPINNER, }; -pub async fn run(shell: &Shell) -> anyhow::Result<()> { - let chain_config = ZkStackConfig::load_current_chain(shell)?; - +pub async fn run(shell: &Shell, chain: ChainConfig) -> anyhow::Result<()> { let spinner = Spinner::new(MSG_STARTING_GENESIS_SPINNER); - run_server_genesis(&chain_config, shell)?; + run_server_genesis(&chain, shell)?; spinner.finish(); logger::outro(MSG_GENESIS_COMPLETED); Ok(()) } -pub fn run_server_genesis(chain_config: &ChainConfig, shell: &Shell) -> anyhow::Result<()> { - let server = Server::new(None, chain_config.link_to_code.clone(), false); +pub fn run_server_genesis(chain: &ChainConfig, shell: &Shell) -> anyhow::Result<()> { + let server = Server::new(None, chain.link_to_code.clone(), false); server .run( shell, ServerMode::Genesis, - GenesisConfig::get_path_with_base_path(&chain_config.configs), - WalletsConfig::get_path_with_base_path(&chain_config.configs), - GeneralConfig::get_path_with_base_path(&chain_config.configs), - SecretsConfig::get_path_with_base_path(&chain_config.configs), - ContractsConfig::get_path_with_base_path(&chain_config.configs), + GenesisConfig::get_path_with_base_path(&chain.configs), + WalletsConfig::get_path_with_base_path(&chain.configs), + GeneralConfig::get_path_with_base_path(&chain.configs), + SecretsConfig::get_path_with_base_path(&chain.configs), + ContractsConfig::get_path_with_base_path(&chain.configs), vec![], ) .context(MSG_FAILED_TO_RUN_SERVER_ERR) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs index 60129f850e0..239a05704b3 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs @@ -1,15 +1,20 @@ use ::common::forge::ForgeScriptArgs; +use anyhow::Context; pub(crate) use args::create::ChainCreateArgsFinal; use args::{build_transactions::BuildTransactionsArgs, run_server::RunServerArgs}; use clap::{command, Subcommand}; +use config::zkstack_config::ZkStackConfig; use consensus::ConsensusCommand; use contract_verifier::ContractVerifierCommands; pub(crate) use create::create_chain_inner; use xshell::Shell; -use crate::commands::chain::{ - args::create::ChainCreateArgs, deploy_l2_contracts::Deploy2ContractsOption, - genesis::GenesisCommand, init::ChainInitCommand, +use crate::{ + commands::chain::{ + args::create::ChainCreateArgs, deploy_l2_contracts::Deploy2ContractsOption, + genesis::GenesisCommand, init::ChainInitCommand, + }, + messages::MSG_CHAIN_NOT_FOUND_ERR, }; mod accept_chain_ownership; @@ -78,11 +83,17 @@ pub enum ChainCommands { } pub(crate) async fn run(shell: &Shell, cmd: ChainCommands) -> anyhow::Result<()> { + if let ChainCommands::Create(args) = cmd { + return create::run(args, shell); + } + + let chain = ZkStackConfig::load_current_chain(shell).context(MSG_CHAIN_NOT_FOUND_ERR)?; + match cmd { ChainCommands::Create(args) => create::run(args, shell), ChainCommands::Init(args) => init::run(*args, shell).await, ChainCommands::BuildTransactions(args) => build_transactions::run(args, shell).await, - ChainCommands::Genesis(args) => genesis::run(args, shell).await, + ChainCommands::Genesis(args) => genesis::run(args, shell, chain).await, ChainCommands::RegisterChain(args) => register_chain::run(args, shell).await, ChainCommands::DeployL2Contracts(args) => { deploy_l2_contracts::run(args, shell, Deploy2ContractsOption::All).await @@ -100,12 +111,12 @@ pub(crate) async fn run(shell: &Shell, cmd: ChainCommands) -> anyhow::Result<()> ChainCommands::InitializeBridges(args) => { deploy_l2_contracts::run(args, shell, Deploy2ContractsOption::InitiailizeBridges).await } - ChainCommands::DeployPaymaster(args) => deploy_paymaster::run(args, shell).await, + ChainCommands::DeployPaymaster(args) => deploy_paymaster::run(args, shell, chain).await, ChainCommands::UpdateTokenMultiplierSetter(args) => { set_token_multiplier_setter::run(args, shell).await } - ChainCommands::Server(args) => server::run(shell, args), - ChainCommands::ContractVerifier(args) => contract_verifier::run(shell, args).await, + ChainCommands::Server(args) => server::run(shell, args, chain), + ChainCommands::ContractVerifier(args) => contract_verifier::run(shell, args, chain).await, ChainCommands::Consensus(cmd) => cmd.run(shell).await, } } diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/server.rs b/zkstack_cli/crates/zkstack/src/commands/chain/server.rs index d01d00a1b7f..a460ae0f589 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/server.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/server.rs @@ -4,32 +4,24 @@ use common::{ server::{Server, ServerMode}, }; use config::{ - traits::FileConfigWithDefaultName, zkstack_config::ZkStackConfig, ChainConfig, ContractsConfig, - GeneralConfig, GenesisConfig, SecretsConfig, WalletsConfig, + traits::FileConfigWithDefaultName, ChainConfig, ContractsConfig, GeneralConfig, GenesisConfig, + SecretsConfig, WalletsConfig, }; use xshell::Shell; use super::args::run_server::RunServerArgs; use crate::messages::{MSG_FAILED_TO_RUN_SERVER_ERR, MSG_STARTING_SERVER}; -pub fn run(shell: &Shell, args: RunServerArgs) -> anyhow::Result<()> { - let chain_config = ZkStackConfig::load_current_chain(shell)?; - +pub fn run(shell: &Shell, args: RunServerArgs, chain: ChainConfig) -> anyhow::Result<()> { logger::info(MSG_STARTING_SERVER); - - run_server(args, &chain_config, shell)?; - + run_server(args, &chain, shell)?; Ok(()) } -fn run_server( - args: RunServerArgs, - chain_config: &ChainConfig, - shell: &Shell, -) -> anyhow::Result<()> { +fn run_server(args: RunServerArgs, chain: &ChainConfig, shell: &Shell) -> anyhow::Result<()> { let server = Server::new( args.components.clone(), - chain_config.link_to_code.clone(), + chain.link_to_code.clone(), args.uring, ); @@ -47,11 +39,11 @@ fn run_server( .run( shell, mode, - GenesisConfig::get_path_with_base_path(&chain_config.configs), - WalletsConfig::get_path_with_base_path(&chain_config.configs), - GeneralConfig::get_path_with_base_path(&chain_config.configs), - SecretsConfig::get_path_with_base_path(&chain_config.configs), - ContractsConfig::get_path_with_base_path(&chain_config.configs), + GenesisConfig::get_path_with_base_path(&chain.configs), + WalletsConfig::get_path_with_base_path(&chain.configs), + GeneralConfig::get_path_with_base_path(&chain.configs), + SecretsConfig::get_path_with_base_path(&chain.configs), + ContractsConfig::get_path_with_base_path(&chain.configs), vec![], ) .context(MSG_FAILED_TO_RUN_SERVER_ERR) From 18403f15ed4f4b67dd93cb6064a6c0435c24c972 Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Thu, 7 Nov 2024 15:51:10 -0300 Subject: [PATCH 9/9] Add ChainConfig::from_internal --- zkstack_cli/crates/config/src/chain.rs | 34 ++++++++++++++++++- .../crates/config/src/zkstack_config.rs | 31 +---------------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/zkstack_cli/crates/config/src/chain.rs b/zkstack_cli/crates/config/src/chain.rs index 150745b4ce6..fc472b78e31 100644 --- a/zkstack_cli/crates/config/src/chain.rs +++ b/zkstack_cli/crates/config/src/chain.rs @@ -3,7 +3,7 @@ use std::{ path::{Path, PathBuf}, }; -use anyhow::bail; +use anyhow::{bail, Context}; use serde::{Deserialize, Serialize, Serializer}; use types::{BaseToken, L1BatchCommitmentMode, L1Network, ProverMode, WalletCreation}; use xshell::Shell; @@ -170,6 +170,38 @@ impl ChainConfig { evm_emulator: self.evm_emulator, } } + + pub fn from_internal( + chain_internal: ChainConfigInternal, + shell: Shell, + ) -> anyhow::Result { + let l1_network = chain_internal.l1_network.context("L1 Network not found")?; + let link_to_code = chain_internal + .link_to_code + .context("Link to code not found")?; + let artifacts = chain_internal + .artifacts_path + .context("Artifacts path not found")?; + + Ok(Self { + id: chain_internal.id, + name: chain_internal.name, + chain_id: chain_internal.chain_id, + prover_version: chain_internal.prover_version, + configs: chain_internal.configs, + rocks_db_path: chain_internal.rocks_db_path, + external_node_config_path: chain_internal.external_node_config_path, + l1_network, + l1_batch_commit_data_generator_mode: chain_internal.l1_batch_commit_data_generator_mode, + base_token: chain_internal.base_token, + wallet_creation: chain_internal.wallet_creation, + legacy_bridge: chain_internal.legacy_bridge, + link_to_code, + artifacts, + evm_emulator: chain_internal.evm_emulator, + shell: shell.into(), + }) + } } impl ChainConfigInternal { diff --git a/zkstack_cli/crates/config/src/zkstack_config.rs b/zkstack_cli/crates/config/src/zkstack_config.rs index 7e31df0d24d..99c7360f4cc 100644 --- a/zkstack_cli/crates/config/src/zkstack_config.rs +++ b/zkstack_cli/crates/config/src/zkstack_config.rs @@ -1,4 +1,3 @@ -use anyhow::Context; use xshell::Shell; use crate::{ChainConfig, ChainConfigInternal, EcosystemConfig}; @@ -14,35 +13,7 @@ impl ZkStackConfig { Ok(ZkStackConfig::EcosystemConfig(ecosystem)) } else { let chain_internal = ChainConfigInternal::from_file(shell)?; - - let l1_network = chain_internal.l1_network.context("L1 Network not found")?; - let link_to_code = chain_internal - .link_to_code - .context("Link to code not found")?; - let artifacts = chain_internal - .artifacts_path - .context("Artifacts path not found")?; - - let chain = ChainConfig { - id: chain_internal.id, - name: chain_internal.name, - chain_id: chain_internal.chain_id, - prover_version: chain_internal.prover_version, - configs: chain_internal.configs, - rocks_db_path: chain_internal.rocks_db_path, - external_node_config_path: chain_internal.external_node_config_path, - l1_network, - l1_batch_commit_data_generator_mode: chain_internal - .l1_batch_commit_data_generator_mode, - base_token: chain_internal.base_token, - wallet_creation: chain_internal.wallet_creation, - legacy_bridge: chain_internal.legacy_bridge, - link_to_code, - artifacts, - evm_emulator: chain_internal.evm_emulator, - shell: shell.clone().into(), - }; - + let chain = ChainConfig::from_internal(chain_internal, shell.clone())?; Ok(ZkStackConfig::ChainConfig(chain)) } }