Skip to content

Commit

Permalink
feat(cli)!: remove default chain ID, endpoint URL (#1792)
Browse files Browse the repository at this point in the history
## 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 <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.
  • Loading branch information
SuperFluffy authored Dec 6, 2024
1 parent eac2759 commit 88adcb3
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 138 deletions.
5 changes: 5 additions & 0 deletions crates/astria-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions crates/astria-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
6 changes: 1 addition & 5 deletions crates/astria-cli/src/sequencer/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 1 addition & 5 deletions crates/astria-cli/src/sequencer/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/block_height.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
6 changes: 1 addition & 5 deletions crates/astria-cli/src/sequencer/bridge_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/bridge_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/bridge_sudo_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
6 changes: 1 addition & 5 deletions crates/astria-cli/src/sequencer/fee_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/ics20_withdrawal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/init_bridge_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions crates/astria-cli/src/sequencer/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/sudo/fee_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/sudo/ibc_relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/sudo/ibc_sudo_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/sudo/sudo_address_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/sudo/validator_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
12 changes: 2 additions & 10 deletions crates/astria-cli/src/sequencer/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit 88adcb3

Please sign in to comment.