From 88adcb33e36a4b411b6f3432f33e7ce0be61e940 Mon Sep 17 00:00:00 2001 From: Richard Janis Goldschmidt Date: Fri, 6 Dec 2024 14:31:10 +0100 Subject: [PATCH] feat(cli)!: remove default chain ID, endpoint URL (#1792) ## Summary Removes the default RPC URL and chain IDs the CLI. ## Background It is a safety issue to interact with the wrong chain, and so these defaults should not be enshrined in the app. ## Changes - Remove the default value from all `--sequencer.chain-id` arguments. - Remove the default value from all `--sequencer-url` arguments. ## Testing All smoke tests already explicitly provided chain ID and RPC URL and thus keep working. Ran manually: omitting either arguments now results in errors like this: ``` error: the following required arguments were not provided: --sequencer-url ``` ## Changelogs "Changelogs updated." ## Breaking Changelist - All invocations of the CLI for interacting with Astria network `astria-dusk-10` at `"https://rpc.sequencer.dusk-10.devnet.astria.org"` no longer work. Chain ID and RPC URL now need to be set explicitly by providing an environment variable or command line argumient. Invocations that already had the chain ID and RPC URL present continue working unchanged. --- crates/astria-cli/CHANGELOG.md | 5 +++++ crates/astria-cli/src/lib.rs | 3 --- crates/astria-cli/src/sequencer/account.rs | 6 +----- crates/astria-cli/src/sequencer/balance.rs | 6 +----- crates/astria-cli/src/sequencer/block_height.rs | 12 ++---------- crates/astria-cli/src/sequencer/bridge_account.rs | 6 +----- crates/astria-cli/src/sequencer/bridge_lock.rs | 12 ++---------- .../astria-cli/src/sequencer/bridge_sudo_change.rs | 12 ++---------- crates/astria-cli/src/sequencer/fee_assets.rs | 6 +----- crates/astria-cli/src/sequencer/ics20_withdrawal.rs | 12 ++---------- .../astria-cli/src/sequencer/init_bridge_account.rs | 12 ++---------- crates/astria-cli/src/sequencer/submit.rs | 6 +----- crates/astria-cli/src/sequencer/sudo/fee_asset.rs | 12 ++---------- crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs | 12 ++---------- .../astria-cli/src/sequencer/sudo/ibc_sudo_change.rs | 12 ++---------- .../src/sequencer/sudo/sudo_address_change.rs | 12 ++---------- .../src/sequencer/sudo/validator_update.rs | 12 ++---------- crates/astria-cli/src/sequencer/transfer.rs | 12 ++---------- 18 files changed, 32 insertions(+), 138 deletions(-) diff --git a/crates/astria-cli/CHANGELOG.md b/crates/astria-cli/CHANGELOG.md index 738181bef5..8bb8637b8f 100644 --- a/crates/astria-cli/CHANGELOG.md +++ b/crates/astria-cli/CHANGELOG.md @@ -18,6 +18,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed ICS20 withdrawal source when using channel with more than one port/channel combo. [#1768](https://github.com/astriaorg/astria/pull/1768) +### Changed + +- Removed default values from `--sequencer.chain-id` and `--sequencer-url` arguments + [#1792](https://github.com/astriaorg/astria/pull/1792) + ## [0.5.1] - 2024-10-23 ### Added diff --git a/crates/astria-cli/src/lib.rs b/crates/astria-cli/src/lib.rs index e4d7a90ba8..54153b61e2 100644 --- a/crates/astria-cli/src/lib.rs +++ b/crates/astria-cli/src/lib.rs @@ -15,9 +15,6 @@ use clap::{ }; use color_eyre::eyre; -const DEFAULT_SEQUENCER_RPC: &str = "https://rpc.sequencer.dusk-10.devnet.astria.org"; -const DEFAULT_SEQUENCER_CHAIN_ID: &str = "astria-dusk-10"; - /// Run commands against the Astria network. #[derive(Debug, Parser)] #[command(name = "astria-cli", version, about)] diff --git a/crates/astria-cli/src/sequencer/account.rs b/crates/astria-cli/src/sequencer/account.rs index e6160730f0..6d0b6b21fe 100644 --- a/crates/astria-cli/src/sequencer/account.rs +++ b/crates/astria-cli/src/sequencer/account.rs @@ -121,11 +121,7 @@ impl Nonce { #[derive(clap::Args, Debug)] struct ArgsInner { /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The address of the Sequencer account address: Address, diff --git a/crates/astria-cli/src/sequencer/balance.rs b/crates/astria-cli/src/sequencer/balance.rs index 2533dcc122..fcb9b4885c 100644 --- a/crates/astria-cli/src/sequencer/balance.rs +++ b/crates/astria-cli/src/sequencer/balance.rs @@ -31,11 +31,7 @@ enum SubCommand { #[derive(clap::Args, Debug)] struct Get { /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The address of the Sequencer account address: Address, diff --git a/crates/astria-cli/src/sequencer/block_height.rs b/crates/astria-cli/src/sequencer/block_height.rs index 6e9f1df628..a52262d48f 100644 --- a/crates/astria-cli/src/sequencer/block_height.rs +++ b/crates/astria-cli/src/sequencer/block_height.rs @@ -30,18 +30,10 @@ enum SubCommand { #[derive(clap::Args, Debug)] struct Get { /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] sequencer_chain_id: String, } diff --git a/crates/astria-cli/src/sequencer/bridge_account.rs b/crates/astria-cli/src/sequencer/bridge_account.rs index 146cd0ad4b..966ef9451c 100644 --- a/crates/astria-cli/src/sequencer/bridge_account.rs +++ b/crates/astria-cli/src/sequencer/bridge_account.rs @@ -30,11 +30,7 @@ enum SubCommand { #[derive(Debug, clap::Args)] struct Get { /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] pub(crate) sequencer_url: String, /// The bridge account address on the Sequencer pub(crate) address: Address, diff --git a/crates/astria-cli/src/sequencer/bridge_lock.rs b/crates/astria-cli/src/sequencer/bridge_lock.rs index 884064a3bd..a629192752 100644 --- a/crates/astria-cli/src/sequencer/bridge_lock.rs +++ b/crates/astria-cli/src/sequencer/bridge_lock.rs @@ -34,18 +34,10 @@ pub(super) struct Command { #[arg(long, env = "SEQUENCER_PRIVATE_KEY")] private_key: String, /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] sequencer_chain_id: String, /// The asset to lock. #[arg(long, default_value = "nria")] diff --git a/crates/astria-cli/src/sequencer/bridge_sudo_change.rs b/crates/astria-cli/src/sequencer/bridge_sudo_change.rs index 7c8479b215..de760b8181 100644 --- a/crates/astria-cli/src/sequencer/bridge_sudo_change.rs +++ b/crates/astria-cli/src/sequencer/bridge_sudo_change.rs @@ -39,18 +39,10 @@ pub(crate) struct Command { #[arg(long, env = "SEQUENCER_PRIVATE_KEY")] pub(crate) private_key: String, /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] pub(crate) sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] pub(crate) sequencer_chain_id: String, /// The asset to pay the transfer fees with. #[arg(long, default_value = "nria")] diff --git a/crates/astria-cli/src/sequencer/fee_assets.rs b/crates/astria-cli/src/sequencer/fee_assets.rs index b5fa567e5c..d7bcaf8c84 100644 --- a/crates/astria-cli/src/sequencer/fee_assets.rs +++ b/crates/astria-cli/src/sequencer/fee_assets.rs @@ -30,11 +30,7 @@ enum SubCommand { #[derive(clap::Args, Debug)] struct Get { /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, } diff --git a/crates/astria-cli/src/sequencer/ics20_withdrawal.rs b/crates/astria-cli/src/sequencer/ics20_withdrawal.rs index c1053f9881..68ec8c1d72 100644 --- a/crates/astria-cli/src/sequencer/ics20_withdrawal.rs +++ b/crates/astria-cli/src/sequencer/ics20_withdrawal.rs @@ -67,18 +67,10 @@ pub(super) struct Command { #[arg(long, env = "SEQUENCER_PRIVATE_KEY")] private_key: String, /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] sequencer_chain_id: String, /// The asset to withdraw #[arg(long, default_value = "nria")] diff --git a/crates/astria-cli/src/sequencer/init_bridge_account.rs b/crates/astria-cli/src/sequencer/init_bridge_account.rs index 9a7e806d05..41085bc53d 100644 --- a/crates/astria-cli/src/sequencer/init_bridge_account.rs +++ b/crates/astria-cli/src/sequencer/init_bridge_account.rs @@ -22,18 +22,10 @@ pub(super) struct Command { #[arg(long, env = "SEQUENCER_PRIVATE_KEY")] private_key: String, /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] sequencer_chain_id: String, /// Plaintext rollup name (to be hashed into a rollup ID) /// to initialize the bridge account with. diff --git a/crates/astria-cli/src/sequencer/submit.rs b/crates/astria-cli/src/sequencer/submit.rs index 577ef59c23..bb73942482 100644 --- a/crates/astria-cli/src/sequencer/submit.rs +++ b/crates/astria-cli/src/sequencer/submit.rs @@ -17,11 +17,7 @@ use color_eyre::eyre::{ #[derive(clap::Args, Debug)] pub(super) struct Command { /// The URL at which the Sequencer node is listening for ABCI commands. - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The source to read the pbjson formatted astra.protocol.transaction.v1.Transaction (use `-` /// to pass via STDIN). diff --git a/crates/astria-cli/src/sequencer/sudo/fee_asset.rs b/crates/astria-cli/src/sequencer/sudo/fee_asset.rs index dff0b8ddee..dd9a021f19 100644 --- a/crates/astria-cli/src/sequencer/sudo/fee_asset.rs +++ b/crates/astria-cli/src/sequencer/sudo/fee_asset.rs @@ -98,18 +98,10 @@ struct ArgsInner { #[arg(long, env = "SEQUENCER_PRIVATE_KEY")] private_key: String, /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] sequencer_chain_id: String, /// Asset's denomination string #[arg(long)] diff --git a/crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs b/crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs index 1e3d735899..263bb22597 100644 --- a/crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs +++ b/crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs @@ -95,18 +95,10 @@ struct ArgsInner { #[arg(long, env = "SEQUENCER_PRIVATE_KEY")] private_key: String, /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] sequencer_chain_id: String, /// The address to add or remove as an IBC relayer #[arg(long)] diff --git a/crates/astria-cli/src/sequencer/sudo/ibc_sudo_change.rs b/crates/astria-cli/src/sequencer/sudo/ibc_sudo_change.rs index 67f2abd431..3e4218f33c 100644 --- a/crates/astria-cli/src/sequencer/sudo/ibc_sudo_change.rs +++ b/crates/astria-cli/src/sequencer/sudo/ibc_sudo_change.rs @@ -24,18 +24,10 @@ pub(super) struct Command { #[arg(long, env = "SEQUENCER_PRIVATE_KEY")] private_key: String, /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] sequencer_chain_id: String, /// The new address to take over sudo privileges #[arg(long)] diff --git a/crates/astria-cli/src/sequencer/sudo/sudo_address_change.rs b/crates/astria-cli/src/sequencer/sudo/sudo_address_change.rs index 9591fb5fa7..147dc0afc2 100644 --- a/crates/astria-cli/src/sequencer/sudo/sudo_address_change.rs +++ b/crates/astria-cli/src/sequencer/sudo/sudo_address_change.rs @@ -24,18 +24,10 @@ pub(super) struct Command { #[arg(long, env = "SEQUENCER_PRIVATE_KEY")] private_key: String, /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] sequencer_chain_id: String, /// The new address to take over sudo privileges #[arg(long)] diff --git a/crates/astria-cli/src/sequencer/sudo/validator_update.rs b/crates/astria-cli/src/sequencer/sudo/validator_update.rs index 869769f4d9..d97d93f7e3 100644 --- a/crates/astria-cli/src/sequencer/sudo/validator_update.rs +++ b/crates/astria-cli/src/sequencer/sudo/validator_update.rs @@ -12,18 +12,10 @@ use crate::utils::submit_transaction; #[derive(clap::Args, Debug)] pub(super) struct Command { /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] sequencer_chain_id: String, /// The bech32m prefix that will be used for constructing addresses using the private key #[arg(long, default_value = "astria")] diff --git a/crates/astria-cli/src/sequencer/transfer.rs b/crates/astria-cli/src/sequencer/transfer.rs index 885a9a4e2f..b80c46812f 100644 --- a/crates/astria-cli/src/sequencer/transfer.rs +++ b/crates/astria-cli/src/sequencer/transfer.rs @@ -33,18 +33,10 @@ pub(super) struct Command { // that overwrite the key on drop and don't reveal it when printing. private_key: String, /// The url of the Sequencer node - #[arg( - long, - env = "SEQUENCER_URL", - default_value = crate::DEFAULT_SEQUENCER_RPC - )] + #[arg(long, env = "SEQUENCER_URL")] sequencer_url: String, /// The chain id of the sequencing chain being used - #[arg( - long = "sequencer.chain-id", - env = "ROLLUP_SEQUENCER_CHAIN_ID", - default_value = crate::DEFAULT_SEQUENCER_CHAIN_ID - )] + #[arg(long = "sequencer.chain-id", env = "ROLLUP_SEQUENCER_CHAIN_ID")] sequencer_chain_id: String, /// The asset to transer. #[arg(long, default_value = "nria")]