diff --git a/.github/workflows/ci-core-reusable.yml b/.github/workflows/ci-core-reusable.yml index d76bb776968d..7cdbd95fb284 100644 --- a/.github/workflows/ci-core-reusable.yml +++ b/.github/workflows/ci-core-reusable.yml @@ -132,7 +132,7 @@ jobs: run: | ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup || true ci_run zkstackup -g --local - + - name: Create and initialize legacy chain run: | @@ -298,7 +298,7 @@ jobs: run: | ci_run zkstack chain create \ --chain-name offline_chain \ - --chain-id sequential \ + --chain-id 384 \ --prover-mode no-proofs \ --wallet-creation localhost \ --l1-batch-commit-data-generator-mode rollup \ @@ -309,12 +309,13 @@ jobs: --ignore-prerequisites \ --evm-emulator false - ci_run zkstack chain build-transactions --chain offline_chain --l1-rpc-url http://127.0.0.1:8545 + ci_run zkstack chain propose-chain --chain offline_chain --dev + ci_run zkstack ecosystem register-chain --no-broadcast --chain offline_chain --dev governor_pk=$(awk '/governor:/ {flag=1} flag && /private_key:/ {print $2; exit}' ./configs/wallets.yaml) ci_run zkstack dev send-transactions \ - --file ./transactions/chain/offline_chain/register-hyperchain-txns.json \ + --file ./transactions/chain/384/register-hyperchain-txns.json \ --l1-rpc-url http://127.0.0.1:8545 \ --private-key $governor_pk diff --git a/.github/workflows/ci-prover-e2e.yml b/.github/workflows/ci-prover-e2e.yml index a4a9b29e1d64..b1d301e3deed 100644 --- a/.github/workflows/ci-prover-e2e.yml +++ b/.github/workflows/ci-prover-e2e.yml @@ -105,10 +105,10 @@ jobs: ci_run zkstack prover run --component=compressor --docker=false &>prover_logs/compressor.log & - name: Wait for batch to be executed on L1 env: - DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain - BATCH_NUMBER: 1 - INTERVAL: 30 - TIMEOUT: 600 + DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain + BATCH_NUMBER: 1 + INTERVAL: 30 + TIMEOUT: 600 run: | PASSED_ENV_VARS="BATCH_NUMBER,DATABASE_URL,URL,INTERVAL,TIMEOUT" \ ci_run ./bin/prover_checkers/batch_l1_status_checker diff --git a/configs/.gitkeep b/configs/.gitkeep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/contracts b/contracts index 46d75088e7dd..a90b044a3e89 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 46d75088e7ddb534101874c3ec15b877da1cb417 +Subproject commit a90b044a3e89195b4e664f88089ce60a48cc96dd diff --git a/core/lib/basic_types/src/commitment.rs b/core/lib/basic_types/src/commitment.rs index 0eed46aad782..3917fe75b626 100644 --- a/core/lib/basic_types/src/commitment.rs +++ b/core/lib/basic_types/src/commitment.rs @@ -44,6 +44,15 @@ impl Detokenize for L1BatchCommitmentMode { } } +impl From for u8 { + fn from(val: L1BatchCommitmentMode) -> Self { + match val { + L1BatchCommitmentMode::Rollup => 0, + L1BatchCommitmentMode::Validium => 1, + } + } +} + impl FromStr for L1BatchCommitmentMode { type Err = &'static str; diff --git a/zkstack_cli/crates/common/src/ethereum/chain_registrar.rs b/zkstack_cli/crates/common/src/ethereum/chain_registrar.rs new file mode 100644 index 000000000000..96b96ce84889 --- /dev/null +++ b/zkstack_cli/crates/common/src/ethereum/chain_registrar.rs @@ -0,0 +1,40 @@ +use std::sync::Arc; + +use ethers::{ + abi::Address, + contract::abigen, + prelude::{Http, Provider}, +}; + +abigen!( + ChainRegistar, + r"[ + struct RegisteredChainConfig {address pendingChainAdmin;address chainAdmin;address diamondProxy;address l2BridgeAddress;} + function getRegisteredChainConfig(uint256 chainId) public view returns (RegisteredChainConfig memory) + ]" +); + +#[derive(Clone, Copy)] +pub struct ChainRegistrationResult { + pub diamond_proxy: Address, + pub chain_admin: Address, + pub l2_shared_bridge: Address, +} + +pub async fn load_contracts_for_chain( + chain_registrar: Address, + l1_rpc: String, + l2_chain_id: u64, +) -> anyhow::Result { + let client = Arc::new(Provider::::try_from(l1_rpc)?); + let contract = ChainRegistar::new(chain_registrar, client); + let (pending_chain_admin, _chain_admin, diamond_proxy, l2_bridge_address) = contract + .get_registered_chain_config(l2_chain_id.into()) + .await?; + + Ok(ChainRegistrationResult { + diamond_proxy, + chain_admin: pending_chain_admin, + l2_shared_bridge: l2_bridge_address, + }) +} diff --git a/zkstack_cli/crates/common/src/ethereum/mod.rs b/zkstack_cli/crates/common/src/ethereum/mod.rs new file mode 100644 index 000000000000..0cb6a654211c --- /dev/null +++ b/zkstack_cli/crates/common/src/ethereum/mod.rs @@ -0,0 +1,58 @@ +pub mod chain_registrar; +pub mod token; + +use std::{ops::Add, time::Duration}; + +use ethers::{ + core::k256::ecdsa::SigningKey, + middleware::MiddlewareBuilder, + prelude::{Http, LocalWallet, Provider, Signer, SignerMiddleware}, + providers::Middleware, + types::{Address, TransactionRequest}, +}; +pub use token::{get_token_info, mint_token}; + +use crate::wallets::Wallet; + +pub fn create_ethers_client( + mut wallet: LocalWallet, + l1_rpc: String, + chain_id: Option, +) -> anyhow::Result, ethers::prelude::Wallet>> { + if let Some(chain_id) = chain_id { + wallet = wallet.with_chain_id(chain_id); + } + let client = Provider::::try_from(l1_rpc)?.with_signer(wallet); + Ok(client) +} + +pub async fn distribute_eth( + main_wallet: Wallet, + addresses: Vec
, + l1_rpc: String, + chain_id: u64, + amount: u128, +) -> anyhow::Result<()> { + let client = create_ethers_client(main_wallet.private_key.unwrap(), l1_rpc, Some(chain_id))?; + let mut pending_txs = vec![]; + let mut nonce = client.get_transaction_count(client.address(), None).await?; + for address in addresses { + let tx = TransactionRequest::new() + .to(address) + .value(amount) + .nonce(nonce) + .chain_id(chain_id); + nonce = nonce.add(1); + pending_txs.push( + client + .send_transaction(tx, None) + .await? + // It's safe to set such low number of confirmations and low interval for localhost + .confirmations(1) + .interval(Duration::from_millis(30)), + ); + } + + futures::future::join_all(pending_txs).await; + Ok(()) +} diff --git a/zkstack_cli/crates/common/src/ethereum.rs b/zkstack_cli/crates/common/src/ethereum/token.rs similarity index 53% rename from zkstack_cli/crates/common/src/ethereum.rs rename to zkstack_cli/crates/common/src/ethereum/token.rs index 2100746fecff..108172131441 100644 --- a/zkstack_cli/crates/common/src/ethereum.rs +++ b/zkstack_cli/crates/common/src/ethereum/token.rs @@ -1,60 +1,14 @@ -use std::{ops::Add, sync::Arc, time::Duration}; +use std::{sync::Arc, time::Duration}; use ethers::{ + abi::Address, contract::abigen, - core::k256::ecdsa::SigningKey, middleware::MiddlewareBuilder, - prelude::{Http, LocalWallet, Provider, Signer, SignerMiddleware}, - providers::Middleware, - types::{Address, TransactionRequest}, + prelude::{Http, Provider}, }; use types::TokenInfo; -use crate::{logger, wallets::Wallet}; - -pub fn create_ethers_client( - mut wallet: LocalWallet, - l1_rpc: String, - chain_id: Option, -) -> anyhow::Result, ethers::prelude::Wallet>> { - if let Some(chain_id) = chain_id { - wallet = wallet.with_chain_id(chain_id); - } - let client = Provider::::try_from(l1_rpc)?.with_signer(wallet); - Ok(client) -} - -pub async fn distribute_eth( - main_wallet: Wallet, - addresses: Vec
, - l1_rpc: String, - chain_id: u64, - amount: u128, -) -> anyhow::Result<()> { - let client = create_ethers_client(main_wallet.private_key.unwrap(), l1_rpc, Some(chain_id))?; - let mut pending_txs = vec![]; - let mut nonce = client.get_transaction_count(client.address(), None).await?; - for address in addresses { - let tx = TransactionRequest::new() - .to(address) - .value(amount) - .nonce(nonce) - .chain_id(chain_id); - nonce = nonce.add(1); - pending_txs.push( - client - .send_transaction(tx, None) - .await? - // It's safe to set such low number of confirmations and low interval for localhost - .confirmations(1) - .interval(Duration::from_millis(30)), - ); - } - - futures::future::join_all(pending_txs).await; - Ok(()) -} - +use crate::{ethereum::create_ethers_client, logger, wallets::Wallet}; abigen!( TokenContract, r"[ diff --git a/zkstack_cli/crates/config/src/contracts.rs b/zkstack_cli/crates/config/src/contracts.rs index 79044a59f3af..8ce326a946ff 100644 --- a/zkstack_cli/crates/config/src/contracts.rs +++ b/zkstack_cli/crates/config/src/contracts.rs @@ -71,11 +71,12 @@ impl ContractsConfig { .diamond_cut_data .clone_from(&deploy_l1_output.contracts_config.diamond_cut_data); self.l1.chain_admin_addr = deploy_l1_output.deployed_addresses.chain_admin; + self.ecosystem_contracts.chain_registrar = + deploy_l1_output.deployed_addresses.chain_registrar; } pub fn set_chain_contracts(&mut self, register_chain_output: &RegisterChainOutput) { self.l1.diamond_proxy_addr = register_chain_output.diamond_proxy_addr; - self.l1.governance_addr = register_chain_output.governance_addr; self.l1.chain_admin_addr = register_chain_output.chain_admin_addr; } @@ -132,6 +133,7 @@ pub struct EcosystemContracts { pub transparent_proxy_admin_addr: Address, pub validator_timelock_addr: Address, pub diamond_cut_data: String, + pub chain_registrar: Address, } impl ZkStackConfig for EcosystemContracts {} diff --git a/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs b/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs index d5611f805b17..796dd76a2a0f 100644 --- a/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/input.rs @@ -111,6 +111,7 @@ pub struct DeployL1Config { pub era_chain_id: L2ChainId, pub owner_address: Address, pub testnet_verifier: bool, + pub l2_deployer: Address, pub contracts: ContractsDeployL1Config, pub tokens: TokensDeployL1Config, } @@ -166,6 +167,7 @@ impl DeployL1Config { tokens: TokensDeployL1Config { token_weth_address: initial_deployment_config.token_weth_address, }, + l2_deployer: wallets_config.governor.address, } } } diff --git a/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/output.rs b/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/output.rs index 7a922cbdf3c0..402b2106098e 100644 --- a/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/output.rs +++ b/zkstack_cli/crates/config/src/forge_interface/deploy_ecosystem/output.rs @@ -48,6 +48,7 @@ pub struct DeployL1DeployedAddressesOutput { pub bridgehub: L1BridgehubOutput, pub bridges: L1BridgesOutput, pub state_transition: L1StateTransitionOutput, + pub chain_registrar: Address, } #[derive(Debug, Deserialize, Serialize, Clone)] diff --git a/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs b/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs index 3836dca9d24c..ec17e149dc03 100644 --- a/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/deploy_l2_contracts/input.rs @@ -17,6 +17,8 @@ pub struct DeployL2ContractsInput { pub governance: Address, pub erc20_bridge: Address, pub consensus_registry_owner: Address, + pub chain_registrar: Address, + pub proposal_author: Address, } impl DeployL2ContractsInput { @@ -31,6 +33,8 @@ impl DeployL2ContractsInput { governance: wallets.governor.address, erc20_bridge: contracts.bridges.erc20.l1_address, consensus_registry_owner: wallets.governor.address, + chain_registrar: contracts.ecosystem_contracts.chain_registrar, + proposal_author: wallets.governor.address, }) } } diff --git a/zkstack_cli/crates/config/src/forge_interface/mod.rs b/zkstack_cli/crates/config/src/forge_interface/mod.rs index c7033c45ed22..c0a2551f9583 100644 --- a/zkstack_cli/crates/config/src/forge_interface/mod.rs +++ b/zkstack_cli/crates/config/src/forge_interface/mod.rs @@ -2,6 +2,7 @@ pub mod accept_ownership; pub mod deploy_ecosystem; pub mod deploy_l2_contracts; pub mod paymaster; +pub mod propose_registration; pub mod register_chain; pub mod script_params; pub mod setup_legacy_bridge; diff --git a/zkstack_cli/crates/config/src/forge_interface/propose_registration/mod.rs b/zkstack_cli/crates/config/src/forge_interface/propose_registration/mod.rs new file mode 100644 index 000000000000..1fe4af1399da --- /dev/null +++ b/zkstack_cli/crates/config/src/forge_interface/propose_registration/mod.rs @@ -0,0 +1,64 @@ +use ethers::types::Address; +use serde::{Deserialize, Serialize}; +use types::BaseToken; +use zksync_basic_types::commitment::L1BatchCommitmentMode; + +use crate::traits::ZkStackConfig; + +#[derive(Debug, Deserialize, Serialize, Clone)] + +struct ChainConfig { + chain_id: u64, + blob_operator: Address, + operator: Address, + governor: Address, + base_token: BaseTokenInt, + pubdata_pricing_mode: u8, +} + +#[derive(Debug, Deserialize, Serialize, Clone)] +struct BaseTokenInt { + pub token_multiplier_setter: Option
, + pub address: Address, + pub nominator: u64, + pub denominator: u64, +} + +#[derive(Debug, Deserialize, Serialize, Clone)] +pub struct ProposeRegistrationInputConfig { + chain_registrar: Address, + chain: ChainConfig, +} + +impl ProposeRegistrationInputConfig { + #[allow(clippy::too_many_arguments)] + pub fn new( + chain_registrar: Address, + chain_id: u64, + blob_operator: Address, + operator: Address, + governor: Address, + token: BaseToken, + token_multiplier_setter: Option
, + l1batch_commitment_mode: L1BatchCommitmentMode, + ) -> Self { + ProposeRegistrationInputConfig { + chain_registrar, + chain: ChainConfig { + chain_id, + blob_operator, + operator, + governor, + base_token: BaseTokenInt { + token_multiplier_setter, + address: token.address, + nominator: token.nominator, + denominator: token.denominator, + }, + pubdata_pricing_mode: l1batch_commitment_mode as u8, + }, + } + } +} + +impl ZkStackConfig for ProposeRegistrationInputConfig {} diff --git a/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs b/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs index fb7c606a4569..33c02624ecc3 100644 --- a/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs @@ -1,10 +1,9 @@ use ethers::types::Address; use rand::Rng; use serde::{Deserialize, Serialize}; -use types::L1BatchCommitmentMode; use zksync_basic_types::L2ChainId; -use crate::{traits::ZkStackConfig, ChainConfig, ContractsConfig}; +use crate::{traits::ZkStackConfig, ContractsConfig}; #[derive(Debug, Deserialize, Serialize, Clone)] struct Bridgehub { @@ -21,6 +20,7 @@ struct DeployedAddresses { state_transition: StateTransition, bridgehub: Bridgehub, validator_timelock_addr: Address, + chain_registrar: Address, } #[derive(Debug, Deserialize, Serialize, Clone)] @@ -33,28 +33,23 @@ pub struct RegisterChainL1Config { contracts_config: Contracts, deployed_addresses: DeployedAddresses, chain: ChainL1Config, - owner_address: Address, } #[derive(Debug, Deserialize, Serialize, Clone)] pub struct ChainL1Config { pub chain_chain_id: L2ChainId, - pub base_token_addr: Address, + pub proposal_author: Address, pub bridgehub_create_new_chain_salt: u64, - pub validium_mode: bool, - pub validator_sender_operator_commit_eth: Address, - pub validator_sender_operator_blobs_eth: Address, - pub base_token_gas_price_multiplier_nominator: u64, - pub base_token_gas_price_multiplier_denominator: u64, - pub governance_security_council_address: Address, - pub governance_min_delay: u64, } impl ZkStackConfig for RegisterChainL1Config {} impl RegisterChainL1Config { - pub fn new(chain_config: &ChainConfig, contracts: &ContractsConfig) -> anyhow::Result { - let wallets_config = chain_config.get_wallets_config()?; + pub fn new( + chain_id: L2ChainId, + contracts: &ContractsConfig, + proposal_author: Address, + ) -> anyhow::Result { Ok(Self { contracts_config: Contracts { diamond_cut_data: contracts.ecosystem_contracts.diamond_cut_data.clone(), @@ -69,23 +64,13 @@ impl RegisterChainL1Config { bridgehub_proxy_addr: contracts.ecosystem_contracts.bridgehub_proxy_addr, }, validator_timelock_addr: contracts.ecosystem_contracts.validator_timelock_addr, + chain_registrar: contracts.ecosystem_contracts.chain_registrar, }, chain: ChainL1Config { - chain_chain_id: chain_config.chain_id, - base_token_gas_price_multiplier_nominator: chain_config.base_token.nominator, - base_token_gas_price_multiplier_denominator: chain_config.base_token.denominator, - base_token_addr: chain_config.base_token.address, - // TODO specify - governance_security_council_address: Default::default(), - governance_min_delay: 0, - // TODO verify + chain_chain_id: chain_id, + proposal_author, bridgehub_create_new_chain_salt: rand::thread_rng().gen_range(0..=i64::MAX) as u64, - validium_mode: chain_config.l1_batch_commit_data_generator_mode - == L1BatchCommitmentMode::Validium, - validator_sender_operator_commit_eth: wallets_config.operator.address, - validator_sender_operator_blobs_eth: wallets_config.blob_operator.address, }, - owner_address: wallets_config.governor.address, }) } } diff --git a/zkstack_cli/crates/config/src/forge_interface/register_chain/output.rs b/zkstack_cli/crates/config/src/forge_interface/register_chain/output.rs index a3e23f7bae42..d641b1b6d0ca 100644 --- a/zkstack_cli/crates/config/src/forge_interface/register_chain/output.rs +++ b/zkstack_cli/crates/config/src/forge_interface/register_chain/output.rs @@ -6,7 +6,6 @@ use crate::traits::ZkStackConfig; #[derive(Debug, Deserialize, Serialize, Clone)] pub struct RegisterChainOutput { pub diamond_proxy_addr: Address, - pub governance_addr: Address, pub chain_admin_addr: Address, } diff --git a/zkstack_cli/crates/config/src/forge_interface/script_params.rs b/zkstack_cli/crates/config/src/forge_interface/script_params.rs index e7e21ad132b8..72d489c509bb 100644 --- a/zkstack_cli/crates/config/src/forge_interface/script_params.rs +++ b/zkstack_cli/crates/config/src/forge_interface/script_params.rs @@ -67,3 +67,9 @@ pub const SETUP_LEGACY_BRIDGE: ForgeScriptParams = ForgeScriptParams { output: "script-out/setup-legacy-bridge.toml", script_path: "deploy-scripts/dev/SetupLegacyBridge.s.sol", }; + +pub const PROPOSE_CHAIN_SCRIPT_PARAMS: ForgeScriptParams = ForgeScriptParams { + input: "script-config/config-propose-chain-registration.toml", + output: "script-out/output-propose-chain-registration.toml", + script_path: "deploy-scripts/ProposeChainRegistration.s.sol", +}; diff --git a/zkstack_cli/crates/zkstack/completion/_zkstack.zsh b/zkstack_cli/crates/zkstack/completion/_zkstack.zsh index fc6f29851e66..bdb4214c0747 100644 --- a/zkstack_cli/crates/zkstack/completion/_zkstack.zsh +++ b/zkstack_cli/crates/zkstack/completion/_zkstack.zsh @@ -144,6 +144,30 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; +(register-chain) +_arguments "${_arguments_options[@]}" : \ +'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ +'--chain-id=[]:CHAIN_ID:_default' \ +'--proposal-author=[]:PROPOSAL_AUTHOR:_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' \ +'--no-broadcast=[]' \ +'-o+[]:OUT:_files' \ +'--out=[]:OUT:_files' \ +'--dev=[]' \ +'--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 +;; (change-default-chain) _arguments "${_arguments_options[@]}" : \ '--chain=[Chain to use]:CHAIN:_default' \ @@ -189,6 +213,10 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ && ret=0 ;; +(register-chain) +_arguments "${_arguments_options[@]}" : \ +&& ret=0 +;; (change-default-chain) _arguments "${_arguments_options[@]}" : \ && ret=0 @@ -252,26 +280,6 @@ in-file\:"Specify file with wallets"))' \ '--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]' \ @@ -433,7 +441,7 @@ esac ;; esac ;; -(register-chain) +(deploy-l2-contracts) _arguments "${_arguments_options[@]}" : \ '--verify=[Verify deployed contracts]' \ '--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ @@ -450,7 +458,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(deploy-l2-contracts) +(accept-chain-ownership) _arguments "${_arguments_options[@]}" : \ '--verify=[Verify deployed contracts]' \ '--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ @@ -467,7 +475,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(accept-chain-ownership) +(initialize-bridges) _arguments "${_arguments_options[@]}" : \ '--verify=[Verify deployed contracts]' \ '--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ @@ -484,7 +492,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(initialize-bridges) +(deploy-consensus-registry) _arguments "${_arguments_options[@]}" : \ '--verify=[Verify deployed contracts]' \ '--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ @@ -501,7 +509,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(deploy-consensus-registry) +(deploy-multicall3) _arguments "${_arguments_options[@]}" : \ '--verify=[Verify deployed contracts]' \ '--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ @@ -518,7 +526,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(deploy-multicall3) +(deploy-timestamp-asserter) _arguments "${_arguments_options[@]}" : \ '--verify=[Verify deployed contracts]' \ '--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ @@ -535,7 +543,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(deploy-timestamp-asserter) +(deploy-upgrader) _arguments "${_arguments_options[@]}" : \ '--verify=[Verify deployed contracts]' \ '--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ @@ -552,7 +560,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(deploy-upgrader) +(deploy-paymaster) _arguments "${_arguments_options[@]}" : \ '--verify=[Verify deployed contracts]' \ '--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ @@ -569,7 +577,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(deploy-paymaster) +(update-token-multiplier-setter) _arguments "${_arguments_options[@]}" : \ '--verify=[Verify deployed contracts]' \ '--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ @@ -586,16 +594,22 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(update-token-multiplier-setter) +(propose-chain) _arguments "${_arguments_options[@]}" : \ +'--l1-rpc-url=[L1 RPC URL]:L1_RPC_URL:_default' \ +'--chain-registrar=[]:CHAIN_REGISTRAR:_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' \ +'--private-key=[]:PRIVATE_KEY:_default' \ +'--sender=[]:SENDER:_default' \ '--chain=[Chain to use]:CHAIN:_default' \ '--resume[]' \ +'--broadcast[]' \ +'--dev[]' \ '-v[Verbose mode]' \ '--verbose[Verbose mode]' \ '--ignore-prerequisites[Ignores prerequisites checks]' \ @@ -619,10 +633,6 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ && ret=0 ;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; (init) _arguments "${_arguments_options[@]}" : \ ":: :_zkstack__chain__help__init_commands" \ @@ -667,10 +677,6 @@ _arguments "${_arguments_options[@]}" : \ ;; esac ;; -(register-chain) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; (deploy-l2-contracts) _arguments "${_arguments_options[@]}" : \ && ret=0 @@ -707,6 +713,10 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ && ret=0 ;; +(propose-chain) +_arguments "${_arguments_options[@]}" : \ +&& ret=0 +;; (help) _arguments "${_arguments_options[@]}" : \ && ret=0 @@ -2590,6 +2600,10 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ && ret=0 ;; +(register-chain) +_arguments "${_arguments_options[@]}" : \ +&& ret=0 +;; (change-default-chain) _arguments "${_arguments_options[@]}" : \ && ret=0 @@ -2618,10 +2632,6 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ && ret=0 ;; -(build-transactions) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; (init) _arguments "${_arguments_options[@]}" : \ ":: :_zkstack__help__chain__init_commands" \ @@ -2666,10 +2676,6 @@ _arguments "${_arguments_options[@]}" : \ ;; esac ;; -(register-chain) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; (deploy-l2-contracts) _arguments "${_arguments_options[@]}" : \ && ret=0 @@ -2705,6 +2711,10 @@ _arguments "${_arguments_options[@]}" : \ (update-token-multiplier-setter) _arguments "${_arguments_options[@]}" : \ && ret=0 +;; +(propose-chain) +_arguments "${_arguments_options[@]}" : \ +&& ret=0 ;; esac ;; @@ -3221,10 +3231,8 @@ _zkstack__autocomplete_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' \ @@ -3234,6 +3242,7 @@ _zkstack__chain_commands() { 'deploy-upgrader:Deploy Default Upgrader' \ 'deploy-paymaster:Deploy paymaster smart contract' \ 'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ +'propose-chain:ForgeScriptArgs is a set of arguments that can be passed to the forge script command' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'zkstack chain commands' commands "$@" @@ -3243,11 +3252,6 @@ _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__create_commands] )) || _zkstack__chain__create_commands() { local commands; commands=() @@ -3330,10 +3334,8 @@ _zkstack__chain__genesis__server_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' \ @@ -3343,6 +3345,7 @@ _zkstack__chain__help_commands() { 'deploy-upgrader:Deploy Default Upgrader' \ 'deploy-paymaster:Deploy paymaster smart contract' \ 'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ +'propose-chain:ForgeScriptArgs is a set of arguments that can be passed to the forge script command' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'zkstack chain help commands' commands "$@" @@ -3352,11 +3355,6 @@ _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__create_commands] )) || _zkstack__chain__help__create_commands() { local commands; commands=() @@ -3432,10 +3430,10 @@ _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() { +(( $+functions[_zkstack__chain__help__propose-chain_commands] )) || +_zkstack__chain__help__propose-chain_commands() { local commands; commands=() - _describe -t commands 'zkstack chain help register-chain commands' commands "$@" + _describe -t commands 'zkstack chain help propose-chain commands' commands "$@" } (( $+functions[_zkstack__chain__help__update-token-multiplier-setter_commands] )) || _zkstack__chain__help__update-token-multiplier-setter_commands() { @@ -3478,10 +3476,10 @@ _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() { +(( $+functions[_zkstack__chain__propose-chain_commands] )) || +_zkstack__chain__propose-chain_commands() { local commands; commands=() - _describe -t commands 'zkstack chain register-chain commands' commands "$@" + _describe -t commands 'zkstack chain propose-chain commands' commands "$@" } (( $+functions[_zkstack__chain__update-token-multiplier-setter_commands] )) || _zkstack__chain__update-token-multiplier-setter_commands() { @@ -4411,6 +4409,7 @@ _zkstack__ecosystem_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' \ +'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\`' \ '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)' \ @@ -4438,6 +4437,7 @@ _zkstack__ecosystem__help_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' \ +'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\`' \ '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)' \ @@ -4469,6 +4469,11 @@ _zkstack__ecosystem__help__init_commands() { local commands; commands=() _describe -t commands 'zkstack ecosystem help init commands' commands "$@" } +(( $+functions[_zkstack__ecosystem__help__register-chain_commands] )) || +_zkstack__ecosystem__help__register-chain_commands() { + local commands; commands=() + _describe -t commands 'zkstack ecosystem help register-chain commands' commands "$@" +} (( $+functions[_zkstack__ecosystem__help__setup-observability_commands] )) || _zkstack__ecosystem__help__setup-observability_commands() { local commands; commands=() @@ -4479,6 +4484,11 @@ _zkstack__ecosystem__init_commands() { local commands; commands=() _describe -t commands 'zkstack ecosystem init commands' commands "$@" } +(( $+functions[_zkstack__ecosystem__register-chain_commands] )) || +_zkstack__ecosystem__register-chain_commands() { + local commands; commands=() + _describe -t commands 'zkstack ecosystem register-chain commands' commands "$@" +} (( $+functions[_zkstack__ecosystem__setup-observability_commands] )) || _zkstack__ecosystem__setup-observability_commands() { local commands; commands=() @@ -4648,10 +4658,8 @@ _zkstack__help__autocomplete_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' \ @@ -4661,6 +4669,7 @@ _zkstack__help__chain_commands() { 'deploy-upgrader:Deploy Default Upgrader' \ 'deploy-paymaster:Deploy paymaster smart contract' \ 'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ +'propose-chain:ForgeScriptArgs is a set of arguments that can be passed to the forge script command' \ ) _describe -t commands 'zkstack help chain commands' commands "$@" } @@ -4669,11 +4678,6 @@ _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__create_commands] )) || _zkstack__help__chain__create_commands() { local commands; commands=() @@ -4744,10 +4748,10 @@ _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() { +(( $+functions[_zkstack__help__chain__propose-chain_commands] )) || +_zkstack__help__chain__propose-chain_commands() { local commands; commands=() - _describe -t commands 'zkstack help chain register-chain commands' commands "$@" + _describe -t commands 'zkstack help chain propose-chain commands' commands "$@" } (( $+functions[_zkstack__help__chain__update-token-multiplier-setter_commands] )) || _zkstack__help__chain__update-token-multiplier-setter_commands() { @@ -5078,6 +5082,7 @@ _zkstack__help__ecosystem_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' \ +'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\`' \ 'change-default-chain:Change the default chain' \ 'setup-observability:Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' \ ) @@ -5103,6 +5108,11 @@ _zkstack__help__ecosystem__init_commands() { local commands; commands=() _describe -t commands 'zkstack help ecosystem init commands' commands "$@" } +(( $+functions[_zkstack__help__ecosystem__register-chain_commands] )) || +_zkstack__help__ecosystem__register-chain_commands() { + local commands; commands=() + _describe -t commands 'zkstack help ecosystem register-chain commands' commands "$@" +} (( $+functions[_zkstack__help__ecosystem__setup-observability_commands] )) || _zkstack__help__ecosystem__setup-observability_commands() { local commands; commands=() diff --git a/zkstack_cli/crates/zkstack/completion/zkstack.fish b/zkstack_cli/crates/zkstack/completion/zkstack.fish index 8a5b338fcda2..39595f2ae620 100644 --- a/zkstack_cli/crates/zkstack/completion/zkstack.fish +++ b/zkstack_cli/crates/zkstack/completion/zkstack.fish @@ -50,16 +50,17 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand autocomplete" -l chain - complete -c zkstack -n "__fish_zkstack_using_subcommand autocomplete" -s v -l verbose -d 'Verbose mode' complete -c zkstack -n "__fish_zkstack_using_subcommand autocomplete" -l ignore-prerequisites -d 'Ignores prerequisites checks' complete -c zkstack -n "__fish_zkstack_using_subcommand autocomplete" -s h -l help -d 'Print help' -complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init change-default-chain setup-observability help" -l chain -d 'Chain to use' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init change-default-chain setup-observability help" -s v -l verbose -d 'Verbose mode' -complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init change-default-chain setup-observability help" -l ignore-prerequisites -d 'Ignores prerequisites checks' -complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init change-default-chain setup-observability help" -s h -l help -d 'Print help' -complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init change-default-chain setup-observability help" -f -a "create" -d 'Create a new ecosystem and chain, setting necessary configurations for later initialization' -complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init change-default-chain setup-observability help" -f -a "build-transactions" -d 'Create transactions to build ecosystem contracts' -complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init change-default-chain setup-observability help" -f -a "init" -d 'Initialize ecosystem and chain, deploying necessary contracts and performing on-chain operations' -complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init change-default-chain setup-observability help" -f -a "change-default-chain" -d 'Change the default chain' -complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init change-default-chain setup-observability help" -f -a "setup-observability" -d 'Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' -complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init change-default-chain setup-observability help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -l chain -d 'Chain to use' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -s v -l verbose -d 'Verbose mode' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -l ignore-prerequisites -d 'Ignores prerequisites checks' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -s h -l help -d 'Print help' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -f -a "create" -d 'Create a new ecosystem and chain, setting necessary configurations for later initialization' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -f -a "build-transactions" -d 'Create transactions to build ecosystem contracts' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -f -a "init" -d 'Initialize ecosystem and chain, deploying necessary contracts and performing on-chain operations' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -f -a "register-chain" -d '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`' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -f -a "change-default-chain" -d 'Change the default chain' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -f -a "setup-observability" -d 'Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and not __fish_seen_subcommand_from create build-transactions init register-chain change-default-chain setup-observability help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from create" -l ecosystem-name -r complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from create" -l l1-network -d 'L1 Network' -r -f -a "{localhost\t'',sepolia\t'',holesky\t'',mainnet\t''}" complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from create" -l link-to-code -d 'Code link' -r -f -a "(__fish_complete_directories)" @@ -115,6 +116,22 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_se complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from init" -s v -l verbose -d 'Verbose mode' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from init" -l ignore-prerequisites -d 'Ignores prerequisites checks' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from init" -s h -l help -d 'Print help (see more with \'--help\')' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l l1-rpc-url -d 'L1 RPC URL' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l chain-id -r +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l proposal-author -r +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l verifier-url -d 'Verifier URL, if using a custom provider' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l verifier-api-key -d 'Verifier API key' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -s a -l additional-args -d 'List of additional arguments that can be passed through the CLI' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l no-broadcast -r -f -a "{true\t'',false\t''}" +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -s o -l out -r -F +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l dev -r -f -a "{true\t'',false\t''}" +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l chain -d 'Chain to use' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l resume +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -s v -l verbose -d 'Verbose mode' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -l ignore-prerequisites -d 'Ignores prerequisites checks' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from register-chain" -s h -l help -d 'Print help (see more with \'--help\')' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from change-default-chain" -l chain -d 'Chain to use' -r complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from change-default-chain" -s v -l verbose -d 'Verbose mode' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from change-default-chain" -l ignore-prerequisites -d 'Ignores prerequisites checks' @@ -126,28 +143,28 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_se complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from help" -f -a "create" -d 'Create a new ecosystem and chain, setting necessary configurations for later initialization' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from help" -f -a "build-transactions" -d 'Create transactions to build ecosystem contracts' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from help" -f -a "init" -d 'Initialize ecosystem and chain, deploying necessary contracts and performing on-chain operations' +complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from help" -f -a "register-chain" -d '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`' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from help" -f -a "change-default-chain" -d 'Change the default chain' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from help" -f -a "setup-observability" -d 'Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -l chain -d 'Chain to use' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -s v -l verbose -d 'Verbose mode' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -l ignore-prerequisites -d 'Ignores prerequisites checks' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -s h -l help -d 'Print help' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "create" -d 'Create a new chain, setting the necessary configurations for later initialization' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "build-transactions" -d 'Create unsigned transactions for chain deployment' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "init" -d 'Initialize chain, deploying necessary contracts and performing on-chain operations' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "genesis" -d 'Run server genesis' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "register-chain" -d '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`' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "deploy-l2-contracts" -d 'Deploy all L2 contracts (executed by L1 governor)' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "accept-chain-ownership" -d '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' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "initialize-bridges" -d 'Initialize bridges on L2' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "deploy-consensus-registry" -d 'Deploy L2 consensus registry' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "deploy-multicall3" -d 'Deploy L2 multicall3' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "deploy-timestamp-asserter" -d 'Deploy L2 TimestampAsserter' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "deploy-upgrader" -d 'Deploy Default Upgrader' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "deploy-paymaster" -d 'Deploy paymaster smart contract' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "update-token-multiplier-setter" -d 'Update Token Multiplier Setter address on L1' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -l chain -d 'Chain to use' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -s v -l verbose -d 'Verbose mode' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -l ignore-prerequisites -d 'Ignores prerequisites checks' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -s h -l help -d 'Print help' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "create" -d 'Create a new chain, setting the necessary configurations for later initialization' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "init" -d 'Initialize chain, deploying necessary contracts and performing on-chain operations' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "genesis" -d 'Run server genesis' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "deploy-l2-contracts" -d 'Deploy all L2 contracts (executed by L1 governor)' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "accept-chain-ownership" -d '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' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "initialize-bridges" -d 'Initialize bridges on L2' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "deploy-consensus-registry" -d 'Deploy L2 consensus registry' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "deploy-multicall3" -d 'Deploy L2 multicall3' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "deploy-timestamp-asserter" -d 'Deploy L2 TimestampAsserter' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "deploy-upgrader" -d 'Deploy Default Upgrader' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "deploy-paymaster" -d 'Deploy paymaster smart contract' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "update-token-multiplier-setter" -d 'Update Token Multiplier Setter address on L1' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "propose-chain" -d 'ForgeScriptArgs is a set of arguments that can be passed to the forge script command' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from create" -l chain-name -r complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from create" -l chain-id -d 'Chain ID' -r complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from create" -l prover-mode -d 'Prover options' -r -f -a "{no-proofs\t'',gpu\t''}" @@ -164,18 +181,6 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_s complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from create" -s v -l verbose -d 'Verbose mode' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from create" -l ignore-prerequisites -d 'Ignores prerequisites checks' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from create" -s h -l help -d 'Print help (see more with \'--help\')' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -s o -l out -d 'Output directory for the generated files' -r -F -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -l verifier-url -d 'Verifier URL, if using a custom provider' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -l verifier-api-key -d 'Verifier API key' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -s a -l additional-args -d 'List of additional arguments that can be passed through the CLI' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -l l1-rpc-url -d 'L1 RPC URL' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -l chain -d 'Chain to use' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -l resume -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -s v -l verbose -d 'Verbose mode' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -l ignore-prerequisites -d 'Ignores prerequisites checks' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from build-transactions" -s h -l help -d 'Print help (see more with \'--help\')' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from init" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from init" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from init" -l verifier-url -d 'Verifier URL, if using a custom provider' -r @@ -206,16 +211,6 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_s complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from genesis" -f -a "init-database" -d 'Initialize databases' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from genesis" -f -a "server" -d 'Runs server genesis' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from genesis" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from register-chain" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from register-chain" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from register-chain" -l verifier-url -d 'Verifier URL, if using a custom provider' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from register-chain" -l verifier-api-key -d 'Verifier API key' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from register-chain" -s a -l additional-args -d 'List of additional arguments that can be passed through the CLI' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from register-chain" -l chain -d 'Chain to use' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from register-chain" -l resume -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from register-chain" -s v -l verbose -d 'Verbose mode' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from register-chain" -l ignore-prerequisites -d 'Ignores prerequisites checks' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from register-chain" -s h -l help -d 'Print help (see more with \'--help\')' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from deploy-l2-contracts" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from deploy-l2-contracts" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from deploy-l2-contracts" -l verifier-url -d 'Verifier URL, if using a custom provider' -r @@ -306,11 +301,25 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_s complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from update-token-multiplier-setter" -s v -l verbose -d 'Verbose mode' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from update-token-multiplier-setter" -l ignore-prerequisites -d 'Ignores prerequisites checks' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from update-token-multiplier-setter" -s h -l help -d 'Print help (see more with \'--help\')' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l l1-rpc-url -d 'L1 RPC URL' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l chain-registrar -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l verifier-url -d 'Verifier URL, if using a custom provider' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l verifier-api-key -d 'Verifier API key' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -s a -l additional-args -d 'List of additional arguments that can be passed through the CLI' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l private-key -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l sender -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l chain -d 'Chain to use' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l resume +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l broadcast +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l dev +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -s v -l verbose -d 'Verbose mode' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -l ignore-prerequisites -d 'Ignores prerequisites checks' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from propose-chain" -s h -l help -d 'Print help (see more with \'--help\')' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "create" -d 'Create a new chain, setting the necessary configurations for later initialization' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "build-transactions" -d 'Create unsigned transactions for chain deployment' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "init" -d 'Initialize chain, deploying necessary contracts and performing on-chain operations' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "genesis" -d 'Run server genesis' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "register-chain" -d '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`' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "deploy-l2-contracts" -d 'Deploy all L2 contracts (executed by L1 governor)' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "accept-chain-ownership" -d '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' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "initialize-bridges" -d 'Initialize bridges on L2' @@ -320,6 +329,7 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_s complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "deploy-upgrader" -d 'Deploy Default Upgrader' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "deploy-paymaster" -d 'Deploy paymaster smart contract' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "update-token-multiplier-setter" -d 'Update Token Multiplier Setter address on L1' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "propose-chain" -d 'ForgeScriptArgs is a set of arguments that can be passed to the forge script command' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -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 not __fish_seen_subcommand_from database test clean snapshot lint fmt prover contracts config-writer send-transactions status generate-genesis help" -l chain -d 'Chain to use' -r complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and not __fish_seen_subcommand_from database test clean snapshot lint fmt prover contracts config-writer send-transactions status generate-genesis help" -s v -l verbose -d 'Verbose mode' @@ -731,13 +741,12 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand help; and not __fish_see complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from ecosystem" -f -a "create" -d 'Create a new ecosystem and chain, setting necessary configurations for later initialization' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from ecosystem" -f -a "build-transactions" -d 'Create transactions to build ecosystem contracts' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from ecosystem" -f -a "init" -d 'Initialize ecosystem and chain, deploying necessary contracts and performing on-chain operations' +complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from ecosystem" -f -a "register-chain" -d '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`' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from ecosystem" -f -a "change-default-chain" -d 'Change the default chain' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from ecosystem" -f -a "setup-observability" -d 'Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "create" -d 'Create a new chain, setting the necessary configurations for later initialization' -complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "build-transactions" -d 'Create unsigned transactions for chain deployment' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "init" -d 'Initialize chain, deploying necessary contracts and performing on-chain operations' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "genesis" -d 'Run server genesis' -complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "register-chain" -d '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`' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "deploy-l2-contracts" -d 'Deploy all L2 contracts (executed by L1 governor)' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "accept-chain-ownership" -d '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' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "initialize-bridges" -d 'Initialize bridges on L2' @@ -747,6 +756,7 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_su complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "deploy-upgrader" -d 'Deploy Default Upgrader' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "deploy-paymaster" -d 'Deploy paymaster smart contract' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "update-token-multiplier-setter" -d 'Update Token Multiplier Setter address on L1' +complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "propose-chain" -d 'ForgeScriptArgs is a set of arguments that can be passed to the forge script command' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from dev" -f -a "database" -d 'Database related commands' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from dev" -f -a "test" -d 'Run tests' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from dev" -f -a "clean" -d 'Clean artifacts' diff --git a/zkstack_cli/crates/zkstack/completion/zkstack.sh b/zkstack_cli/crates/zkstack/completion/zkstack.sh index bb373c3f63eb..1ca2b32ac384 100644 --- a/zkstack_cli/crates/zkstack/completion/zkstack.sh +++ b/zkstack_cli/crates/zkstack/completion/zkstack.sh @@ -60,9 +60,6 @@ _zkstack() { zkstack__chain,accept-chain-ownership) cmd="zkstack__chain__accept__chain__ownership" ;; - zkstack__chain,build-transactions) - cmd="zkstack__chain__build__transactions" - ;; zkstack__chain,create) cmd="zkstack__chain__create" ;; @@ -96,8 +93,8 @@ _zkstack() { zkstack__chain,initialize-bridges) cmd="zkstack__chain__initialize__bridges" ;; - zkstack__chain,register-chain) - cmd="zkstack__chain__register__chain" + zkstack__chain,propose-chain) + cmd="zkstack__chain__propose__chain" ;; zkstack__chain,update-token-multiplier-setter) cmd="zkstack__chain__update__token__multiplier__setter" @@ -123,9 +120,6 @@ _zkstack() { zkstack__chain__help,accept-chain-ownership) cmd="zkstack__chain__help__accept__chain__ownership" ;; - zkstack__chain__help,build-transactions) - cmd="zkstack__chain__help__build__transactions" - ;; zkstack__chain__help,create) cmd="zkstack__chain__help__create" ;; @@ -159,8 +153,8 @@ _zkstack() { zkstack__chain__help,initialize-bridges) cmd="zkstack__chain__help__initialize__bridges" ;; - zkstack__chain__help,register-chain) - cmd="zkstack__chain__help__register__chain" + zkstack__chain__help,propose-chain) + cmd="zkstack__chain__help__propose__chain" ;; zkstack__chain__help,update-token-multiplier-setter) cmd="zkstack__chain__help__update__token__multiplier__setter" @@ -636,6 +630,9 @@ _zkstack() { zkstack__ecosystem,init) cmd="zkstack__ecosystem__init" ;; + zkstack__ecosystem,register-chain) + cmd="zkstack__ecosystem__register__chain" + ;; zkstack__ecosystem,setup-observability) cmd="zkstack__ecosystem__setup__observability" ;; @@ -654,6 +651,9 @@ _zkstack() { zkstack__ecosystem__help,init) cmd="zkstack__ecosystem__help__init" ;; + zkstack__ecosystem__help,register-chain) + cmd="zkstack__ecosystem__help__register__chain" + ;; zkstack__ecosystem__help,setup-observability) cmd="zkstack__ecosystem__help__setup__observability" ;; @@ -765,9 +765,6 @@ _zkstack() { zkstack__help__chain,accept-chain-ownership) cmd="zkstack__help__chain__accept__chain__ownership" ;; - zkstack__help__chain,build-transactions) - cmd="zkstack__help__chain__build__transactions" - ;; zkstack__help__chain,create) cmd="zkstack__help__chain__create" ;; @@ -798,8 +795,8 @@ _zkstack() { zkstack__help__chain,initialize-bridges) cmd="zkstack__help__chain__initialize__bridges" ;; - zkstack__help__chain,register-chain) - cmd="zkstack__help__chain__register__chain" + zkstack__help__chain,propose-chain) + cmd="zkstack__help__chain__propose__chain" ;; zkstack__help__chain,update-token-multiplier-setter) cmd="zkstack__help__chain__update__token__multiplier__setter" @@ -969,6 +966,9 @@ _zkstack() { zkstack__help__ecosystem,init) cmd="zkstack__help__ecosystem__init" ;; + zkstack__help__ecosystem,register-chain) + cmd="zkstack__help__ecosystem__register__chain" + ;; zkstack__help__ecosystem,setup-observability) cmd="zkstack__help__ecosystem__setup__observability" ;; @@ -1135,7 +1135,7 @@ _zkstack() { return 0 ;; zkstack__chain) - opts="-v -h --verbose --chain --ignore-prerequisites --help create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" + opts="-v -h --verbose --chain --ignore-prerequisites --help create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1194,60 +1194,6 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - zkstack__chain__build__transactions) - opts="-o -a -v -h --out --verify --verifier --verifier-url --verifier-api-key --resume --additional-args --l1-rpc-url --verbose --chain --ignore-prerequisites --help" - if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then - COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) - return 0 - fi - case "${prev}" in - --out) - COMPREPLY=($(compgen -f "${cur}")) - return 0 - ;; - -o) - COMPREPLY=($(compgen -f "${cur}")) - return 0 - ;; - --verify) - COMPREPLY=($(compgen -W "true false" -- "${cur}")) - return 0 - ;; - --verifier) - COMPREPLY=($(compgen -W "etherscan sourcify blockscout oklink" -- "${cur}")) - return 0 - ;; - --verifier-url) - COMPREPLY=($(compgen -f "${cur}")) - return 0 - ;; - --verifier-api-key) - COMPREPLY=($(compgen -f "${cur}")) - return 0 - ;; - --additional-args) - COMPREPLY=($(compgen -f "${cur}")) - return 0 - ;; - -a) - COMPREPLY=($(compgen -f "${cur}")) - return 0 - ;; - --l1-rpc-url) - COMPREPLY=($(compgen -f "${cur}")) - return 0 - ;; - --chain) - COMPREPLY=($(compgen -f "${cur}")) - return 0 - ;; - *) - COMPREPLY=() - ;; - esac - COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) - return 0 - ;; zkstack__chain__create) opts="-v -h --chain-name --chain-id --prover-mode --wallet-creation --wallet-path --l1-batch-commit-data-generator-mode --base-token-address --base-token-price-nominator --base-token-price-denominator --set-as-default --legacy-bridge --evm-emulator --verbose --chain --ignore-prerequisites --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then @@ -1700,7 +1646,7 @@ _zkstack() { return 0 ;; zkstack__chain__help) - opts="create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter help" + opts="create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1727,20 +1673,6 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - zkstack__chain__help__build__transactions) - opts="" - if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then - COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) - return 0 - fi - case "${prev}" in - *) - COMPREPLY=() - ;; - esac - COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) - return 0 - ;; zkstack__chain__help__create) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then @@ -1937,7 +1869,7 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - zkstack__chain__help__register__chain) + zkstack__chain__help__propose__chain) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -2137,13 +2069,21 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - zkstack__chain__register__chain) - opts="-a -v -h --verify --verifier --verifier-url --verifier-api-key --resume --additional-args --verbose --chain --ignore-prerequisites --help" + zkstack__chain__propose__chain) + opts="-a -v -h --l1-rpc-url --chain-registrar --verify --verifier --verifier-url --verifier-api-key --resume --additional-args --broadcast --dev --private-key --sender --verbose --chain --ignore-prerequisites --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in + --l1-rpc-url) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --chain-registrar) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; --verify) COMPREPLY=($(compgen -W "true false" -- "${cur}")) return 0 @@ -2168,6 +2108,14 @@ _zkstack() { COMPREPLY=($(compgen -f "${cur}")) return 0 ;; + --private-key) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --sender) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; --chain) COMPREPLY=($(compgen -f "${cur}")) return 0 @@ -4812,7 +4760,7 @@ _zkstack() { return 0 ;; zkstack__ecosystem) - opts="-v -h --verbose --chain --ignore-prerequisites --help create build-transactions init change-default-chain setup-observability help" + opts="-v -h --verbose --chain --ignore-prerequisites --help create build-transactions init register-chain change-default-chain setup-observability help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -4998,7 +4946,7 @@ _zkstack() { return 0 ;; zkstack__ecosystem__help) - opts="create build-transactions init change-default-chain setup-observability help" + opts="create build-transactions init register-chain change-default-chain setup-observability help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -5081,6 +5029,20 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; + zkstack__ecosystem__help__register__chain) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; zkstack__ecosystem__help__setup__observability) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then @@ -5173,6 +5135,76 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; + zkstack__ecosystem__register__chain) + opts="-a -o -v -h --l1-rpc-url --chain-id --proposal-author --verify --verifier --verifier-url --verifier-api-key --resume --additional-args --no-broadcast --out --dev --verbose --chain --ignore-prerequisites --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + --l1-rpc-url) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --chain-id) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --proposal-author) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --verify) + COMPREPLY=($(compgen -W "true false" -- "${cur}")) + return 0 + ;; + --verifier) + COMPREPLY=($(compgen -W "etherscan sourcify blockscout oklink" -- "${cur}")) + return 0 + ;; + --verifier-url) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --verifier-api-key) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --additional-args) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + -a) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --no-broadcast) + COMPREPLY=($(compgen -W "true false" -- "${cur}")) + return 0 + ;; + --out) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + -o) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --dev) + COMPREPLY=($(compgen -W "true false" -- "${cur}")) + return 0 + ;; + --chain) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; zkstack__ecosystem__setup__observability) opts="-v -h --verbose --chain --ignore-prerequisites --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then @@ -5608,7 +5640,7 @@ _zkstack() { return 0 ;; zkstack__help__chain) - opts="create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter" + opts="create init genesis deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter propose-chain" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -5635,20 +5667,6 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - zkstack__help__chain__build__transactions) - opts="" - if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then - COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) - return 0 - fi - case "${prev}" in - *) - COMPREPLY=() - ;; - esac - COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) - return 0 - ;; zkstack__help__chain__create) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then @@ -5831,7 +5849,7 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - zkstack__help__chain__register__chain) + zkstack__help__chain__propose__chain) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -6588,7 +6606,7 @@ _zkstack() { return 0 ;; zkstack__help__ecosystem) - opts="create build-transactions init change-default-chain setup-observability" + opts="create build-transactions init register-chain change-default-chain setup-observability" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -6657,6 +6675,20 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; + zkstack__help__ecosystem__register__chain) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; zkstack__help__ecosystem__setup__observability) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/args/build_transactions.rs b/zkstack_cli/crates/zkstack/src/commands/chain/args/build_transactions.rs deleted file mode 100644 index 793bea487f7e..000000000000 --- a/zkstack_cli/crates/zkstack/src/commands/chain/args/build_transactions.rs +++ /dev/null @@ -1,60 +0,0 @@ -use std::path::PathBuf; - -use clap::Parser; -use common::{config::global_config, forge::ForgeScriptArgs, Prompt}; -use serde::{Deserialize, Serialize}; -use url::Url; - -use crate::{ - consts::DEFAULT_UNSIGNED_TRANSACTIONS_DIR, - defaults::LOCAL_RPC_URL, - messages::{MSG_L1_RPC_URL_HELP, MSG_L1_RPC_URL_INVALID_ERR, MSG_L1_RPC_URL_PROMPT}, -}; - -const CHAIN_SUBDIR: &str = "chain"; - -#[derive(Debug, Clone, Serialize, Deserialize, Parser)] -pub struct BuildTransactionsArgs { - /// Output directory for the generated files. - #[arg(long, short)] - pub out: Option, - /// All ethereum environment related arguments - #[clap(flatten)] - #[serde(flatten)] - pub forge_args: ForgeScriptArgs, - #[clap(long, help = MSG_L1_RPC_URL_HELP)] - pub l1_rpc_url: Option, -} - -impl BuildTransactionsArgs { - pub fn fill_values_with_prompt(self, default_chain: String) -> BuildTransactionsArgsFinal { - let chain_name = global_config().chain_name.clone(); - - let l1_rpc_url = self.l1_rpc_url.unwrap_or_else(|| { - Prompt::new(MSG_L1_RPC_URL_PROMPT) - .default(LOCAL_RPC_URL) - .validate_with(|val: &String| -> Result<(), String> { - Url::parse(val) - .map(|_| ()) - .map_err(|_| MSG_L1_RPC_URL_INVALID_ERR.to_string()) - }) - .ask() - }); - - BuildTransactionsArgsFinal { - out: self - .out - .unwrap_or(PathBuf::from(DEFAULT_UNSIGNED_TRANSACTIONS_DIR).join(CHAIN_SUBDIR)) - .join(chain_name.unwrap_or(default_chain)), - forge_args: self.forge_args, - l1_rpc_url, - } - } -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -pub struct BuildTransactionsArgsFinal { - pub out: PathBuf, - pub forge_args: ForgeScriptArgs, - pub l1_rpc_url: String, -} diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/args/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/args/mod.rs index f2a5f6b8be1f..5746d0984485 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/args/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/args/mod.rs @@ -1,4 +1,4 @@ -pub mod build_transactions; pub mod create; pub mod genesis; pub mod init; +pub mod propose_registration; diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/args/propose_registration.rs b/zkstack_cli/crates/zkstack/src/commands/chain/args/propose_registration.rs new file mode 100644 index 000000000000..1ce63fae2fca --- /dev/null +++ b/zkstack_cli/crates/zkstack/src/commands/chain/args/propose_registration.rs @@ -0,0 +1,118 @@ +use anyhow::Context; +use clap::Parser; +use common::{forge::ForgeScriptArgs, wallets::Wallet, Prompt}; +use config::EcosystemConfig; +use ethers::{abi::Address, prelude::LocalWallet, types::H256}; +use serde::{Deserialize, Serialize}; +use url::Url; + +use crate::{ + defaults::LOCAL_RPC_URL, + messages::{MSG_L1_RPC_URL_HELP, MSG_L1_RPC_URL_INVALID_ERR, MSG_L1_RPC_URL_PROMPT}, +}; + +#[derive(Debug, Clone, Serialize, Deserialize, Parser)] +pub struct ProposeRegistrationArgs { + #[clap(long, help = MSG_L1_RPC_URL_HELP)] + pub l1_rpc_url: Option, + #[clap(long)] + pub chain_registrar: Option
, + #[clap(flatten)] + #[serde(flatten)] + pub forge_args: ForgeScriptArgs, + #[clap(long)] + pub broadcast: bool, + #[clap(long)] + pub dev: bool, + #[clap(long)] + pub private_key: Option, + #[clap(long)] + pub sender: Option
, +} + +impl ProposeRegistrationArgs { + pub fn fill_values_with_prompt( + self, + config: Option<&EcosystemConfig>, + ) -> anyhow::Result { + let chain_registrar_default = config + .map(|config| { + config + .get_contracts_config() + .map(|contracts| contracts.ecosystem_contracts.chain_registrar) + }) + .transpose()?; + + if self.dev { + let l1_rpc_url = self.l1_rpc_url.unwrap_or(LOCAL_RPC_URL.to_string()); + let chain_registrar = if let Some(chain_registrar) = self.chain_registrar { + chain_registrar + } else { + chain_registrar_default.context("Ecosystem must be provided for dev mode")? + }; + + let main_wallet = if let Some(pk) = self.private_key { + let local_wallet = LocalWallet::from_bytes(pk.as_bytes())?; + Wallet::new(local_wallet) + } else { + config + .map(|config| config.get_wallets().map(|wallets| wallets.governor)) + .transpose()? + .context("Ecosystem must be provided for dev mode")? + }; + + return Ok(ProposeRegistrationArgsFinal { + l1_rpc_url, + chain_registrar, + main_wallet, + broadcast: true, + forge_args: Default::default(), + sender: None, + }); + } + + let chain_registrar = self.chain_registrar.unwrap_or_else(|| { + let mut prompt = Prompt::new("Provide chain registrar for the the ecosystem"); + if let Some(chain_registrar) = chain_registrar_default { + prompt = prompt.default(&format!("{:?}", chain_registrar)) + }; + prompt.ask() + }); + + let l1_rpc_url = self.l1_rpc_url.unwrap_or_else(|| { + let mut prompt = Prompt::new(MSG_L1_RPC_URL_PROMPT); + prompt = prompt.default(LOCAL_RPC_URL); + prompt + .validate_with(|val: &String| -> Result<(), String> { + Url::parse(val) + .map(|_| ()) + .map_err(|_| MSG_L1_RPC_URL_INVALID_ERR.to_string()) + }) + .ask() + }); + + let pk = self + .private_key + .unwrap_or_else(|| Prompt::new("Please specify your private key").ask()); + let local_wallet = LocalWallet::from_bytes(pk.as_bytes())?; + + Ok(ProposeRegistrationArgsFinal { + l1_rpc_url, + chain_registrar, + main_wallet: Wallet::new(local_wallet), + broadcast: self.broadcast, + forge_args: self.forge_args, + sender: self.sender, + }) + } +} + +#[derive(Debug, Clone)] +pub struct ProposeRegistrationArgsFinal { + pub l1_rpc_url: String, + pub chain_registrar: Address, + pub main_wallet: Wallet, + pub broadcast: bool, + pub forge_args: ForgeScriptArgs, + pub sender: Option
, +} diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs b/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs deleted file mode 100644 index d3953c656596..000000000000 --- a/zkstack_cli/crates/zkstack/src/commands/chain/build_transactions.rs +++ /dev/null @@ -1,90 +0,0 @@ -use anyhow::Context; -use common::{git, logger, spinner::Spinner}; -use config::{ - copy_configs, traits::SaveConfigWithBasePath, update_from_chain_config, EcosystemConfig, -}; -use ethers::utils::hex::ToHex; -use xshell::Shell; - -use crate::{ - commands::chain::{ - args::build_transactions::BuildTransactionsArgs, register_chain::register_chain, - }, - messages::{ - MSG_BUILDING_CHAIN_REGISTRATION_TXNS_SPINNER, MSG_CHAIN_NOT_FOUND_ERR, - MSG_CHAIN_TRANSACTIONS_BUILT, MSG_CHAIN_TXN_MISSING_CONTRACT_CONFIG, - MSG_CHAIN_TXN_OUT_PATH_INVALID_ERR, MSG_PREPARING_CONFIG_SPINNER, MSG_SELECTED_CONFIG, - MSG_WRITING_OUTPUT_FILES_SPINNER, - }, -}; - -const REGISTER_CHAIN_TXNS_FILE_SRC: &str = - "contracts/l1-contracts/broadcast/RegisterHyperchain.s.sol/9/dry-run/run-latest.json"; -const REGISTER_CHAIN_TXNS_FILE_DST: &str = "register-hyperchain-txns.json"; - -const SCRIPT_CONFIG_FILE_SRC: &str = - "contracts/l1-contracts/script-config/register-hyperchain.toml"; -const SCRIPT_CONFIG_FILE_DST: &str = "register-hyperchain.toml"; - -pub(crate) async fn run(args: BuildTransactionsArgs, shell: &Shell) -> anyhow::Result<()> { - let config = EcosystemConfig::from_file(shell)?; - let chain_config = config - .load_current_chain() - .context(MSG_CHAIN_NOT_FOUND_ERR)?; - - let args = args.fill_values_with_prompt(config.default_chain.clone()); - - git::submodule_update(shell, config.link_to_code.clone())?; - - let spinner = Spinner::new(MSG_PREPARING_CONFIG_SPINNER); - copy_configs(shell, &config.link_to_code, &chain_config.configs)?; - - logger::note(MSG_SELECTED_CONFIG, logger::object_to_string(&chain_config)); - - let mut genesis_config = chain_config.get_genesis_config()?; - update_from_chain_config(&mut genesis_config, &chain_config)?; - - // Copy ecosystem contracts - let mut contracts_config = config - .get_contracts_config() - .context(MSG_CHAIN_TXN_MISSING_CONTRACT_CONFIG)?; - contracts_config.l1.base_token_addr = chain_config.base_token.address; - spinner.finish(); - - let spinner = Spinner::new(MSG_BUILDING_CHAIN_REGISTRATION_TXNS_SPINNER); - let governor: String = config.get_wallets()?.governor.address.encode_hex_upper(); - - register_chain( - shell, - args.forge_args.clone(), - &config, - &chain_config, - &mut contracts_config, - args.l1_rpc_url.clone(), - Some(governor), - false, - ) - .await?; - - contracts_config.save_with_base_path(shell, &args.out)?; - spinner.finish(); - - let spinner = Spinner::new(MSG_WRITING_OUTPUT_FILES_SPINNER); - shell - .create_dir(&args.out) - .context(MSG_CHAIN_TXN_OUT_PATH_INVALID_ERR)?; - - shell.copy_file( - config.link_to_code.join(REGISTER_CHAIN_TXNS_FILE_SRC), - args.out.join(REGISTER_CHAIN_TXNS_FILE_DST), - )?; - - shell.copy_file( - config.link_to_code.join(SCRIPT_CONFIG_FILE_SRC), - args.out.join(SCRIPT_CONFIG_FILE_DST), - )?; - spinner.finish(); - - logger::success(MSG_CHAIN_TRANSACTIONS_BUILT); - Ok(()) -} diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs b/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs index 31c5c681e7d3..9b00627fb080 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/init/configs.rs @@ -12,6 +12,7 @@ use crate::{ chain::{ args::init::configs::{InitConfigsArgs, InitConfigsArgsFinal}, genesis, + init::fill_contracts_config_from_l1, }, portal::update_portal_config, }, @@ -32,9 +33,11 @@ pub async fn run(args: InitConfigsArgs, shell: &Shell) -> anyhow::Result<()> { .context(MSG_CHAIN_NOT_FOUND_ERR)?; let args = args.fill_values_with_prompt(&chain_config); - init_configs(&args, shell, &ecosystem_config, &chain_config).await?; + let mut contracts = init_configs(&args, shell, &ecosystem_config, &chain_config).await?; + contracts = + fill_contracts_config_from_l1(contracts, chain_config.chain_id, args.l1_rpc_url).await?; + contracts.save_with_base_path(shell, &chain_config.configs)?; logger::outro(MSG_CHAIN_CONFIGS_INITIALIZED); - Ok(()) } diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs index d92c56d2eb10..02a52595408f 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs @@ -1,30 +1,31 @@ use anyhow::Context; use clap::{command, Parser, Subcommand}; -use common::{git, logger, spinner::Spinner}; -use config::{traits::SaveConfigWithBasePath, ChainConfig, EcosystemConfig}; -use types::BaseToken; +use common::{ethereum, git, logger, spinner::Spinner}; +use config::{traits::SaveConfigWithBasePath, ChainConfig, ContractsConfig, EcosystemConfig}; use xshell::Shell; +use zksync_basic_types::L2ChainId; use crate::{ accept_ownership::accept_admin, - commands::chain::{ - args::init::{ - configs::{InitConfigsArgs, InitConfigsArgsFinal}, - InitArgs, InitArgsFinal, + commands::{ + chain::{ + args::init::{ + configs::{InitConfigsArgs, InitConfigsArgsFinal}, + InitArgs, InitArgsFinal, + }, + common::{distribute_eth, mint_base_token}, + deploy_l2_contracts, deploy_paymaster, + genesis::genesis, + init::configs::init_configs, + propose_chain, + setup_legacy_bridge::setup_legacy_bridge, }, - common::{distribute_eth, mint_base_token}, - deploy_l2_contracts, deploy_paymaster, - genesis::genesis, - init::configs::init_configs, - register_chain::register_chain, - set_token_multiplier_setter::set_token_multiplier_setter, - setup_legacy_bridge::setup_legacy_bridge, + ecosystem::register_chain::register_chain, }, messages::{ msg_initializing_chain, MSG_ACCEPTING_ADMIN_SPINNER, MSG_CHAIN_INITIALIZED, MSG_CHAIN_NOT_FOUND_ERR, MSG_DEPLOYING_PAYMASTER, MSG_GENESIS_DATABASE_ERR, MSG_REGISTERING_CHAIN_SPINNER, MSG_SELECTED_CONFIG, - MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER, MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND, }, }; @@ -84,6 +85,19 @@ pub async fn init( // Fund some wallet addresses with ETH or base token (only for Localhost) distribute_eth(ecosystem_config, chain_config, init_args.l1_rpc_url.clone()).await?; mint_base_token(ecosystem_config, chain_config, init_args.l1_rpc_url.clone()).await?; + // Propose chain registration + let wallet = chain_config.get_wallets_config()?.governor; + propose_chain::run_propose_chain_registration( + shell, + chain_config, + contracts_config.ecosystem_contracts.chain_registrar, + init_args.l1_rpc_url.clone(), + init_args.forge_args.clone(), + true, + None, + &wallet, + ) + .await?; // Register chain on BridgeHub (run by L1 Governor) let spinner = Spinner::new(MSG_REGISTERING_CHAIN_SPINNER); @@ -91,16 +105,35 @@ pub async fn init( shell, init_args.forge_args.clone(), ecosystem_config, - chain_config, - &mut contracts_config, + &contracts_config, + chain_config.chain_id, init_args.l1_rpc_url.clone(), None, + wallet.address, true, ) .await?; - contracts_config.save_with_base_path(shell, &chain_config.configs)?; spinner.finish(); + // Deploy L2 contracts: L2SharedBridge, L2DefaultUpgrader, ... (run by L1 Governor) + deploy_l2_contracts::deploy_l2_contracts( + shell, + chain_config, + ecosystem_config, + &mut contracts_config, + init_args.forge_args.clone(), + ) + .await?; + contracts_config.save_with_base_path(shell, &chain_config.configs)?; + + contracts_config = fill_contracts_config_from_l1( + contracts_config, + chain_config.chain_id, + init_args.l1_rpc_url.clone(), + ) + .await?; + contracts_config.save_with_base_path(shell, &chain_config.configs)?; + // Accept ownership for DiamondProxy (run by L2 Governor) let spinner = Spinner::new(MSG_ACCEPTING_ADMIN_SPINNER); accept_admin( @@ -115,38 +148,6 @@ pub async fn init( .await?; spinner.finish(); - // Set token multiplier setter address (run by L2 Governor) - if chain_config.base_token != BaseToken::eth() { - let spinner = Spinner::new(MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER); - set_token_multiplier_setter( - shell, - ecosystem_config, - &chain_config.get_wallets_config()?.governor, - contracts_config.l1.chain_admin_addr, - chain_config - .get_wallets_config() - .unwrap() - .token_multiplier_setter - .context(MSG_WALLET_TOKEN_MULTIPLIER_SETTER_NOT_FOUND)? - .address, - &init_args.forge_args.clone(), - init_args.l1_rpc_url.clone(), - ) - .await?; - spinner.finish(); - } - - // Deploy L2 contracts: L2SharedBridge, L2DefaultUpgrader, ... (run by L1 Governor) - deploy_l2_contracts::deploy_l2_contracts( - shell, - chain_config, - ecosystem_config, - &mut contracts_config, - init_args.forge_args.clone(), - ) - .await?; - contracts_config.save_with_base_path(shell, &chain_config.configs)?; - // Setup legacy bridge - shouldn't be used for new chains (run by L1 Governor) if let Some(true) = chain_config.legacy_bridge { setup_legacy_bridge( @@ -181,3 +182,21 @@ pub async fn init( Ok(()) } + +async fn fill_contracts_config_from_l1( + mut contracts: ContractsConfig, + l2_chain_id: L2ChainId, + l1_rpc_url: String, +) -> anyhow::Result { + let res = ethereum::chain_registrar::load_contracts_for_chain( + contracts.ecosystem_contracts.chain_registrar, + l1_rpc_url, + l2_chain_id.as_u64(), + ) + .await?; + contracts.l1.chain_admin_addr = res.chain_admin; + contracts.l1.diamond_proxy_addr = res.diamond_proxy; + contracts.bridges.shared.l2_address = Some(res.l2_shared_bridge); + contracts.bridges.erc20.l2_address = Some(res.l2_shared_bridge); + Ok(contracts) +} diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs index 82b8656154ab..f2c8a82b2ff6 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs @@ -1,25 +1,25 @@ use ::common::forge::ForgeScriptArgs; -use args::build_transactions::BuildTransactionsArgs; pub(crate) use args::create::ChainCreateArgsFinal; use clap::{command, Subcommand}; 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, + args::{create::ChainCreateArgs, propose_registration::ProposeRegistrationArgs}, + deploy_l2_contracts::Deploy2ContractsOption, + genesis::GenesisCommand, + init::ChainInitCommand, }; mod accept_chain_ownership; pub(crate) mod args; -mod build_transactions; mod common; mod create; pub mod deploy_l2_contracts; pub mod deploy_paymaster; pub mod genesis; pub mod init; -pub mod register_chain; +pub mod propose_chain; mod set_token_multiplier_setter; mod setup_legacy_bridge; @@ -27,18 +27,10 @@ mod setup_legacy_bridge; pub enum ChainCommands { /// Create a new chain, setting the necessary configurations for later initialization Create(ChainCreateArgs), - /// Create unsigned transactions for chain deployment - BuildTransactions(BuildTransactionsArgs), /// Initialize chain, deploying necessary contracts and performing on-chain operations Init(Box), /// Run server genesis Genesis(GenesisCommand), - /// 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` - #[command(alias = "register")] - RegisterChain(ForgeScriptArgs), /// Deploy all L2 contracts (executed by L1 governor). #[command(alias = "l2")] DeployL2Contracts(ForgeScriptArgs), @@ -67,15 +59,14 @@ pub enum ChainCommands { DeployPaymaster(ForgeScriptArgs), /// Update Token Multiplier Setter address on L1 UpdateTokenMultiplierSetter(ForgeScriptArgs), + ProposeChain(ProposeRegistrationArgs), } pub(crate) async fn run(shell: &Shell, args: ChainCommands) -> anyhow::Result<()> { match args { 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::RegisterChain(args) => register_chain::run(args, shell).await, ChainCommands::DeployL2Contracts(args) => { deploy_l2_contracts::run(args, shell, Deploy2ContractsOption::All).await } @@ -99,5 +90,6 @@ pub(crate) async fn run(shell: &Shell, args: ChainCommands) -> anyhow::Result<() ChainCommands::UpdateTokenMultiplierSetter(args) => { set_token_multiplier_setter::run(args, shell).await } + ChainCommands::ProposeChain(args) => propose_chain::run(shell, args).await, } } diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/propose_chain.rs b/zkstack_cli/crates/zkstack/src/commands/chain/propose_chain.rs new file mode 100644 index 000000000000..b1fcd1998d73 --- /dev/null +++ b/zkstack_cli/crates/zkstack/src/commands/chain/propose_chain.rs @@ -0,0 +1,89 @@ +use anyhow::Context; +use common::{ + forge::{Forge, ForgeScriptArgs}, + spinner::Spinner, + wallets::Wallet, +}; +use config::{ + forge_interface::{ + propose_registration::ProposeRegistrationInputConfig, + script_params::PROPOSE_CHAIN_SCRIPT_PARAMS, + }, + traits::SaveConfig, + ChainConfig, EcosystemConfig, +}; +use ethers::{abi::Address, utils::hex::ToHex}; +use xshell::Shell; + +use crate::{ + commands::chain::args::propose_registration::ProposeRegistrationArgs, + messages::{MSG_CHAIN_NOT_INITIALIZED, MSG_PROPOSE_CHAIN_SPINNER}, + utils::forge::{check_the_balance, fill_forge_private_key}, +}; + +pub async fn run(shell: &Shell, args: ProposeRegistrationArgs) -> anyhow::Result<()> { + let ecosystem_config = EcosystemConfig::from_file(shell)?; + let chain_config = ecosystem_config + .load_current_chain() + .context(MSG_CHAIN_NOT_INITIALIZED)?; + let args = args.fill_values_with_prompt(Some(&ecosystem_config))?; + run_propose_chain_registration( + shell, + &chain_config, + args.chain_registrar, + args.l1_rpc_url, + args.forge_args, + args.broadcast, + args.sender, + &args.main_wallet, + ) + .await +} + +#[allow(clippy::too_many_arguments)] +pub async fn run_propose_chain_registration( + shell: &Shell, + chain_config: &ChainConfig, + chain_registrar: Address, + l1_rpc_url: String, + forge_args: ForgeScriptArgs, + broadcast: bool, + sender: Option
, + wallet: &Wallet, +) -> anyhow::Result<()> { + let wallets = chain_config.get_wallets_config()?; + let spinner = Spinner::new(MSG_PROPOSE_CHAIN_SPINNER); + let deploy_config_path = PROPOSE_CHAIN_SCRIPT_PARAMS.input(&chain_config.link_to_code); + + let deploy_config = ProposeRegistrationInputConfig::new( + chain_registrar, + chain_config.chain_id.as_u64(), + wallets.blob_operator.address, + wallets.operator.address, + wallets.governor.address, + chain_config.base_token.clone(), + wallets.token_multiplier_setter.map(|a| a.address), + chain_config.l1_batch_commit_data_generator_mode, + ); + deploy_config.save(shell, deploy_config_path)?; + + let mut forge = Forge::new(&chain_config.path_to_foundry()) + .script(&PROPOSE_CHAIN_SCRIPT_PARAMS.script(), forge_args.clone()) + .with_ffi() + .with_rpc_url(l1_rpc_url); + + if broadcast { + forge = forge.with_broadcast(); + } + + if let Some(address) = sender { + forge = forge.with_sender(address.encode_hex_upper()); + } else { + forge = fill_forge_private_key(forge, Some(wallet))?; + check_the_balance(&forge).await?; + } + + forge.run(shell)?; + spinner.finish(); + Ok(()) +} diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs b/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs deleted file mode 100644 index 65ee05a1ea5f..000000000000 --- a/zkstack_cli/crates/zkstack/src/commands/chain/register_chain.rs +++ /dev/null @@ -1,96 +0,0 @@ -use anyhow::Context; -use common::{ - forge::{Forge, ForgeScriptArgs}, - logger, - spinner::Spinner, -}; -use config::{ - forge_interface::{ - register_chain::{input::RegisterChainL1Config, output::RegisterChainOutput}, - script_params::REGISTER_CHAIN_SCRIPT_PARAMS, - }, - traits::{ReadConfig, SaveConfig, SaveConfigWithBasePath}, - ChainConfig, ContractsConfig, EcosystemConfig, -}; -use xshell::Shell; - -use crate::{ - messages::{ - MSG_CHAIN_NOT_INITIALIZED, MSG_CHAIN_REGISTERED, MSG_L1_SECRETS_MUST_BE_PRESENTED, - MSG_REGISTERING_CHAIN_SPINNER, - }, - utils::forge::{check_the_balance, fill_forge_private_key}, -}; - -pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { - let ecosystem_config = EcosystemConfig::from_file(shell)?; - let chain_config = ecosystem_config - .load_current_chain() - .context(MSG_CHAIN_NOT_INITIALIZED)?; - let mut contracts = chain_config.get_contracts_config()?; - let secrets = chain_config.get_secrets_config()?; - let l1_rpc_url = secrets - .l1 - .context(MSG_L1_SECRETS_MUST_BE_PRESENTED)? - .l1_rpc_url - .expose_str() - .to_string(); - let spinner = Spinner::new(MSG_REGISTERING_CHAIN_SPINNER); - register_chain( - shell, - args, - &ecosystem_config, - &chain_config, - &mut contracts, - l1_rpc_url, - None, - true, - ) - .await?; - contracts.save_with_base_path(shell, chain_config.configs)?; - spinner.finish(); - logger::success(MSG_CHAIN_REGISTERED); - Ok(()) -} - -#[allow(clippy::too_many_arguments)] -pub async fn register_chain( - shell: &Shell, - forge_args: ForgeScriptArgs, - config: &EcosystemConfig, - chain_config: &ChainConfig, - contracts: &mut ContractsConfig, - l1_rpc_url: String, - sender: Option, - broadcast: bool, -) -> anyhow::Result<()> { - let deploy_config_path = REGISTER_CHAIN_SCRIPT_PARAMS.input(&config.link_to_code); - - let deploy_config = RegisterChainL1Config::new(chain_config, contracts)?; - deploy_config.save(shell, deploy_config_path)?; - - let mut forge = Forge::new(&config.path_to_foundry()) - .script(®ISTER_CHAIN_SCRIPT_PARAMS.script(), forge_args.clone()) - .with_ffi() - .with_rpc_url(l1_rpc_url); - - if broadcast { - forge = forge.with_broadcast(); - } - - if let Some(address) = sender { - forge = forge.with_sender(address); - } else { - forge = fill_forge_private_key(forge, Some(&config.get_wallets()?.governor))?; - check_the_balance(&forge).await?; - } - - forge.run(shell)?; - - let register_chain_output = RegisterChainOutput::read( - shell, - REGISTER_CHAIN_SCRIPT_PARAMS.output(&chain_config.link_to_code), - )?; - contracts.set_chain_contracts(®ister_chain_output); - Ok(()) -} diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/mod.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/mod.rs index c25eebda3d6d..4f0e99a2348a 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/mod.rs @@ -2,3 +2,4 @@ pub mod build_transactions; pub mod change_default; pub mod create; pub mod init; +pub mod register_chain; diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/register_chain.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/register_chain.rs new file mode 100644 index 000000000000..181e61ed562e --- /dev/null +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/args/register_chain.rs @@ -0,0 +1,101 @@ +use std::path::PathBuf; + +use clap::Parser; +use common::{forge::ForgeScriptArgs, Prompt}; +use ethers::abi::Address; +use serde::{Deserialize, Serialize}; +use url::Url; +use zksync_basic_types::L2ChainId; + +use crate::{ + consts::DEFAULT_UNSIGNED_TRANSACTIONS_DIR, + defaults::LOCAL_RPC_URL, + messages::{MSG_L1_RPC_URL_HELP, MSG_L1_RPC_URL_INVALID_ERR, MSG_L1_RPC_URL_PROMPT}, +}; +const CHAIN_SUBDIR: &str = "chain"; + +#[derive(Debug, Clone, Serialize, Deserialize, Parser)] +pub struct RegisterChainArgs { + #[clap(long, help = MSG_L1_RPC_URL_HELP)] + pub l1_rpc_url: Option, + #[clap(long)] + pub chain_id: Option, + #[clap(long)] + pub proposal_author: Option
, + #[clap(flatten)] + pub forge_script_args: ForgeScriptArgs, + #[clap(long, default_missing_value = "true", num_args = 0..=1)] + pub no_broadcast: bool, + #[arg(long, short)] + pub out: Option, + #[clap(long, default_missing_value = "true", num_args = 0..=1)] + pub dev: bool, +} + +impl RegisterChainArgs { + pub fn fill_values_with_prompt( + self, + default_chain_id: L2ChainId, + chain_governor: Address, + ) -> RegisterChainArgsFinal { + let default_out = PathBuf::from(DEFAULT_UNSIGNED_TRANSACTIONS_DIR).join(CHAIN_SUBDIR); + if self.dev { + let chain_id = self.chain_id.unwrap_or(default_chain_id); + let chain_id_str = &format!("{:?}", chain_id.as_u64()); + return RegisterChainArgsFinal { + l1_rpc_url: self.l1_rpc_url.unwrap_or_else(|| LOCAL_RPC_URL.to_string()), + chain_id: self.chain_id.unwrap_or(default_chain_id), + proposal_author: self.proposal_author.unwrap_or(chain_governor), + out: self.out.unwrap_or_else(|| default_out.join(chain_id_str)), + forge_script_args: self.forge_script_args, + no_broadcast: self.no_broadcast, + }; + } + + let l1_rpc_url = self.l1_rpc_url.unwrap_or_else(|| { + Prompt::new(MSG_L1_RPC_URL_PROMPT) + .default(LOCAL_RPC_URL) + .validate_with(|val: &String| -> Result<(), String> { + Url::parse(val) + .map(|_| ()) + .map_err(|_| MSG_L1_RPC_URL_INVALID_ERR.to_string()) + }) + .ask() + }); + + let chain_id = self.chain_id.unwrap_or_else(|| { + Prompt::new("Chain id ") + .default(&format!("{:?}", default_chain_id)) + .ask() + }); + + let proposal_author = self.proposal_author.unwrap_or_else(|| { + Prompt::new("Proposal author ") + .default(&format!("{:?}", chain_governor)) + .ask() + }); + let chain_id_str = &format!("{:?}", chain_id); + + RegisterChainArgsFinal { + l1_rpc_url, + chain_id, + proposal_author, + out: self + .out + .unwrap_or(PathBuf::from(DEFAULT_UNSIGNED_TRANSACTIONS_DIR).join(CHAIN_SUBDIR)) + .join(chain_id_str), + forge_script_args: self.forge_script_args, + no_broadcast: self.no_broadcast, + } + } +} + +#[derive(Debug, Clone)] +pub struct RegisterChainArgsFinal { + pub l1_rpc_url: String, + pub chain_id: L2ChainId, + pub proposal_author: Address, + pub out: PathBuf, + pub forge_script_args: ForgeScriptArgs, + pub no_broadcast: bool, +} diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/mod.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/mod.rs index 3f4aa7565e19..dd0db219d1a1 100644 --- a/zkstack_cli/crates/zkstack/src/commands/ecosystem/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/mod.rs @@ -4,6 +4,7 @@ use xshell::Shell; use crate::commands::ecosystem::args::{ change_default::ChangeDefaultChain, create::EcosystemCreateArgs, init::EcosystemInitArgs, + register_chain::RegisterChainArgs, }; mod args; @@ -13,6 +14,7 @@ mod common; mod create; pub mod create_configs; pub(crate) mod init; +pub mod register_chain; pub(crate) mod setup_observability; mod utils; @@ -27,6 +29,12 @@ pub enum EcosystemCommands { /// Initialize ecosystem and chain, /// deploying necessary contracts and performing on-chain operations Init(EcosystemInitArgs), + /// 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` + #[command(alias = "register")] + RegisterChain(RegisterChainArgs), /// Change the default chain #[command(alias = "cd")] ChangeDefaultChain(ChangeDefaultChain), @@ -43,5 +51,6 @@ pub(crate) async fn run(shell: &Shell, args: EcosystemCommands) -> anyhow::Resul EcosystemCommands::Init(args) => init::run(args, shell).await, EcosystemCommands::ChangeDefaultChain(args) => change_default::run(args, shell), EcosystemCommands::SetupObservability => setup_observability::run(shell), + EcosystemCommands::RegisterChain(args) => register_chain::run(args, shell).await, } } diff --git a/zkstack_cli/crates/zkstack/src/commands/ecosystem/register_chain.rs b/zkstack_cli/crates/zkstack/src/commands/ecosystem/register_chain.rs new file mode 100644 index 000000000000..4c77232f5cbd --- /dev/null +++ b/zkstack_cli/crates/zkstack/src/commands/ecosystem/register_chain.rs @@ -0,0 +1,115 @@ +use anyhow::Context; +use common::{ + forge::{Forge, ForgeScriptArgs}, + logger, + spinner::Spinner, +}; +use config::{ + forge_interface::{ + register_chain::input::RegisterChainL1Config, script_params::REGISTER_CHAIN_SCRIPT_PARAMS, + }, + traits::SaveConfig, + ContractsConfig, EcosystemConfig, +}; +use ethers::{abi::Address, utils::hex::ToHexExt}; +use xshell::Shell; +use zksync_basic_types::L2ChainId; + +use crate::{ + commands::ecosystem::args::register_chain::RegisterChainArgs, + messages::{ + MSG_CHAIN_REGISTERED, MSG_CHAIN_TRANSACTIONS_BUILT, MSG_CHAIN_TXN_OUT_PATH_INVALID_ERR, + MSG_REGISTERING_CHAIN_SPINNER, MSG_WRITING_OUTPUT_FILES_SPINNER, + }, + utils::forge::{check_the_balance, fill_forge_private_key}, +}; + +pub const REGISTER_CHAIN_TXNS_FILE_SRC: &str = + "contracts/l1-contracts/broadcast/RegisterHyperchain.s.sol/9/dry-run/run-latest.json"; +pub const REGISTER_CHAIN_TXNS_FILE_DST: &str = "register-hyperchain-txns.json"; +const SCRIPT_CONFIG_FILE_DST: &str = "register-hyperchain.toml"; + +pub async fn run(args: RegisterChainArgs, shell: &Shell) -> anyhow::Result<()> { + let ecosystem_config = EcosystemConfig::from_file(shell)?; + let chain_config = ecosystem_config.load_current_chain()?; + let wallets = ecosystem_config.get_wallets()?; + let final_args = args.fill_values_with_prompt(chain_config.chain_id, wallets.governor.address); + let contracts = ecosystem_config.get_contracts_config()?; + let l1_rpc_url = final_args.l1_rpc_url; + let spinner = Spinner::new(MSG_REGISTERING_CHAIN_SPINNER); + register_chain( + shell, + final_args.forge_script_args, + &ecosystem_config, + &contracts, + final_args.chain_id, + l1_rpc_url, + None, + final_args.proposal_author, + !final_args.no_broadcast, + ) + .await?; + spinner.finish(); + logger::success(MSG_CHAIN_REGISTERED); + + if final_args.no_broadcast { + let out = final_args.out; + let spinner = Spinner::new(MSG_WRITING_OUTPUT_FILES_SPINNER); + shell + .create_dir(&out) + .context(MSG_CHAIN_TXN_OUT_PATH_INVALID_ERR)?; + + shell.copy_file( + ecosystem_config + .link_to_code + .join(REGISTER_CHAIN_TXNS_FILE_SRC), + out.join(REGISTER_CHAIN_TXNS_FILE_DST), + )?; + + shell.copy_file( + REGISTER_CHAIN_SCRIPT_PARAMS.input(&ecosystem_config.link_to_code), + out.join(SCRIPT_CONFIG_FILE_DST), + )?; + spinner.finish(); + + logger::success(MSG_CHAIN_TRANSACTIONS_BUILT); + } + Ok(()) +} + +#[allow(clippy::too_many_arguments)] +pub async fn register_chain( + shell: &Shell, + forge_args: ForgeScriptArgs, + config: &EcosystemConfig, + contracts: &ContractsConfig, + chain_id: L2ChainId, + l1_rpc_url: String, + sender: Option
, + proposal_author: Address, + broadcast: bool, +) -> anyhow::Result<()> { + let deploy_config_path = REGISTER_CHAIN_SCRIPT_PARAMS.input(&config.link_to_code); + + let deploy_config = RegisterChainL1Config::new(chain_id, contracts, proposal_author)?; + deploy_config.save(shell, deploy_config_path)?; + + let mut forge = Forge::new(&config.path_to_foundry()) + .script(®ISTER_CHAIN_SCRIPT_PARAMS.script(), forge_args.clone()) + .with_ffi() + .with_rpc_url(l1_rpc_url); + + if broadcast { + forge = forge.with_broadcast(); + } + + if let Some(address) = sender { + forge = forge.with_sender(address.encode_hex_upper()); + } else { + forge = fill_forge_private_key(forge, Some(&config.get_wallets()?.governor))?; + check_the_balance(&forge).await?; + } + + forge.run(shell)?; + Ok(()) +} diff --git a/zkstack_cli/crates/zkstack/src/messages.rs b/zkstack_cli/crates/zkstack/src/messages.rs index bedcb233b19f..c08ff7146bed 100644 --- a/zkstack_cli/crates/zkstack/src/messages.rs +++ b/zkstack_cli/crates/zkstack/src/messages.rs @@ -88,11 +88,11 @@ pub(super) const MSG_DISTRIBUTING_ETH_SPINNER: &str = "Distributing eth..."; pub(super) const MSG_MINT_BASE_TOKEN_SPINNER: &str = "Minting base token to the governance addresses..."; pub(super) const MSG_INTALLING_DEPS_SPINNER: &str = "Installing and building dependencies..."; -pub(super) const MSG_PREPARING_CONFIG_SPINNER: &str = "Preparing config files..."; pub(super) const MSG_DEPLOYING_ERC20_SPINNER: &str = "Deploying ERC20 contracts..."; pub(super) const MSG_DEPLOYING_ECOSYSTEM_CONTRACTS_SPINNER: &str = "Deploying ecosystem contracts..."; pub(super) const MSG_REGISTERING_CHAIN_SPINNER: &str = "Registering chain..."; +pub(super) const MSG_PROPOSE_CHAIN_SPINNER: &str = "Proposing chain..."; pub(super) const MSG_ACCEPTING_ADMIN_SPINNER: &str = "Accepting admin..."; pub(super) const MSG_UPDATING_TOKEN_MULTIPLIER_SETTER_SPINNER: &str = "Updating token multiplier setter..."; @@ -252,11 +252,7 @@ pub(super) const MSG_DEPLOYING_L2_CONTRACT_SPINNER: &str = "Deploying l2 contrac pub(super) const MSG_DEPLOYING_PAYMASTER: &str = "Deploying paymaster"; /// Chain build related messages -pub(super) const MSG_BUILDING_CHAIN_REGISTRATION_TXNS_SPINNER: &str = - "Building chain registration transactions..."; pub(super) const MSG_CHAIN_TXN_OUT_PATH_INVALID_ERR: &str = "Invalid path"; -pub(super) const MSG_CHAIN_TXN_MISSING_CONTRACT_CONFIG: &str = - "Missing contract.yaml, please be sure to run this command within initialized ecosystem"; pub(super) const MSG_CHAIN_TRANSACTIONS_BUILT: &str = "Chain transactions successfully built"; /// Run server related messages