Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into joroshiba/proto-wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
joroshiba committed Apr 20, 2024
2 parents fd89565 + 6f13e7f commit b900c97
Show file tree
Hide file tree
Showing 29 changed files with 533 additions and 67 deletions.
2 changes: 1 addition & 1 deletion charts/evm-rollup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type: application
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)

version: 0.12.2
version: 0.12.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
1 change: 1 addition & 0 deletions charts/evm-rollup/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ data:
{{- if not .Values.global.dev }}
{{- else }}
ASTRIA_COMPOSER_GRPC_ADDR: "0.0.0.0:0"
ASTRIA_COMPOSER_SEQUENCER_CHAIN_ID: "{{ .Values.config.sequencer.chainId }}"
{{- end }}
---
apiVersion: v1
Expand Down
1 change: 1 addition & 0 deletions charts/evm-rollup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ config:

# Configuration related to sequencer connection for rollup
sequencer:
chainId: ""
# Block height to start syncing rollup from
initialBlockHeight: "2"
# Fastest block time possible in MS
Expand Down
1 change: 1 addition & 0 deletions crates/astria-cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::cli::{
};

const DEFAULT_SEQUENCER_RPC: &str = "https://rpc.sequencer.dusk-4.devnet.astria.org";
const DEFAULT_SEQUENCER_CHAIN_ID: &str = "astria-dusk-4";

/// A CLI for deploying and managing Astria services and related infrastructure.
#[derive(Debug, Parser)]
Expand Down
10 changes: 10 additions & 0 deletions crates/astria-cli/src/cli/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ pub enum Command {
}

/// Commands for managing rollup configs.
// Allowing large enum size variation here because this is a CLI tool
// not huge performance critical code.
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Subcommand)]
pub enum ConfigCommand {
/// Create a new rollup config
Expand Down Expand Up @@ -119,6 +122,13 @@ pub struct ConfigCreateArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub sequencer_rpc: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
/// Optional. Will default to 'localdev.me' for local deployments. Will need to separately
/// configure other hosts
#[clap(
Expand Down
70 changes: 70 additions & 0 deletions crates/astria-cli/src/cli/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ pub struct BasicAccountArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub(crate) sequencer_url: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
/// The address of the Sequencer account
pub(crate) address: SequencerAddressArg,
}
Expand All @@ -121,6 +128,13 @@ pub struct TransferArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub(crate) sequencer_url: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
}

#[derive(Args, Debug)]
Expand All @@ -138,6 +152,13 @@ pub struct FeeAssetChangeArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub(crate) sequencer_url: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
/// Asset's denomination string
#[clap(long)]
pub(crate) asset: String,
Expand All @@ -158,6 +179,13 @@ pub struct IbcRelayerChangeArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub(crate) sequencer_url: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
/// The address to add or remove as an IBC relayer
#[clap(long)]
pub(crate) address: SequencerAddressArg,
Expand All @@ -178,6 +206,13 @@ pub struct InitBridgeAccountArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub(crate) sequencer_url: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
/// Plaintext rollup name (to be hashed into a rollup ID)
/// to initialize the bridge account with.
#[clap(long)]
Expand Down Expand Up @@ -206,6 +241,13 @@ pub struct BridgeLockArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub(crate) sequencer_url: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
}

#[derive(Clone, Debug, PartialEq)]
Expand Down Expand Up @@ -241,6 +283,13 @@ pub struct BlockHeightGetArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub(crate) sequencer_url: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
}

#[derive(Args, Debug)]
Expand All @@ -258,6 +307,13 @@ pub struct MintArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub(crate) sequencer_url: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
/// The address to mint to
#[clap(long)]
pub(crate) to_address: SequencerAddressArg,
Expand All @@ -281,6 +337,13 @@ pub struct SudoAddressChangeArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub(crate) sequencer_url: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
/// The new address to take over sudo privileges
#[clap(long)]
pub(crate) address: SequencerAddressArg,
Expand All @@ -295,6 +358,13 @@ pub struct ValidatorUpdateArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
pub(crate) sequencer_url: String,
/// The chain id of the sequencing chain being used
#[clap(
long = "sequencer.chain-id",
env = "ROLLUP_SEQUENCER_CHAIN_ID",
default_value = crate::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
/// The private key of the sudo account authorizing change
#[clap(long, env = "SEQUENCER_PRIVATE_KEY")]
// TODO: https://github.com/astriaorg/astria/issues/594
Expand Down
1 change: 1 addition & 0 deletions crates/astria-cli/src/commands/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ mod test {
sequencer_initial_block_height: Some(1),
sequencer_grpc: String::new(),
sequencer_rpc: String::new(),
sequencer_chain_id: "test-chain-1".to_string(),
log_level: String::new(),
hostname: String::new(),
namespace: "namespace_test".to_string(),
Expand Down
17 changes: 16 additions & 1 deletion crates/astria-cli/src/commands/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use astria_core::{
SudoAddressChangeAction,
TransferAction,
},
TransactionParams,
UnsignedTransaction,
},
};
Expand Down Expand Up @@ -181,6 +182,7 @@ pub(crate) async fn send_transfer(args: &TransferArgs) -> eyre::Result<()> {

let res = submit_transaction(
args.sequencer_url.as_str(),
args.sequencer_chain_id.clone(),
args.private_key.as_str(),
Action::Transfer(TransferAction {
to: args.to_address.0,
Expand Down Expand Up @@ -211,6 +213,7 @@ pub(crate) async fn send_transfer(args: &TransferArgs) -> eyre::Result<()> {
pub(crate) async fn ibc_relayer_add(args: &IbcRelayerChangeArgs) -> eyre::Result<()> {
let res = submit_transaction(
args.sequencer_url.as_str(),
args.sequencer_chain_id.clone(),
args.private_key.as_str(),
Action::IbcRelayerChange(IbcRelayerChangeAction::Addition(args.address.0)),
)
Expand Down Expand Up @@ -239,6 +242,7 @@ pub(crate) async fn ibc_relayer_add(args: &IbcRelayerChangeArgs) -> eyre::Result
pub(crate) async fn ibc_relayer_remove(args: &IbcRelayerChangeArgs) -> eyre::Result<()> {
let res = submit_transaction(
args.sequencer_url.as_str(),
args.sequencer_chain_id.clone(),
args.private_key.as_str(),
Action::IbcRelayerChange(IbcRelayerChangeAction::Removal(args.address.0)),
)
Expand Down Expand Up @@ -273,6 +277,7 @@ pub(crate) async fn init_bridge_account(args: &InitBridgeAccountArgs) -> eyre::R
let rollup_id = RollupId::from_unhashed_bytes(args.rollup_name.as_bytes());
let res = submit_transaction(
args.sequencer_url.as_str(),
args.sequencer_chain_id.clone(),
args.private_key.as_str(),
Action::InitBridgeAccount(InitBridgeAccountAction {
rollup_id,
Expand Down Expand Up @@ -306,6 +311,7 @@ pub(crate) async fn bridge_lock(args: &BridgeLockArgs) -> eyre::Result<()> {

let res = submit_transaction(
args.sequencer_url.as_str(),
args.sequencer_chain_id.clone(),
args.private_key.as_str(),
Action::BridgeLock(BridgeLockAction {
to: args.to_address.0,
Expand Down Expand Up @@ -337,6 +343,7 @@ pub(crate) async fn bridge_lock(args: &BridgeLockArgs) -> eyre::Result<()> {
pub(crate) async fn fee_asset_add(args: &FeeAssetChangeArgs) -> eyre::Result<()> {
let res = submit_transaction(
args.sequencer_url.as_str(),
args.sequencer_chain_id.clone(),
args.private_key.as_str(),
Action::FeeAssetChange(FeeAssetChangeAction::Addition(asset::Id::from_denom(
&args.asset,
Expand Down Expand Up @@ -367,6 +374,7 @@ pub(crate) async fn fee_asset_add(args: &FeeAssetChangeArgs) -> eyre::Result<()>
pub(crate) async fn fee_asset_remove(args: &FeeAssetChangeArgs) -> eyre::Result<()> {
let res = submit_transaction(
args.sequencer_url.as_str(),
args.sequencer_chain_id.clone(),
args.private_key.as_str(),
Action::FeeAssetChange(FeeAssetChangeAction::Removal(asset::Id::from_denom(
&args.asset,
Expand Down Expand Up @@ -397,6 +405,7 @@ pub(crate) async fn fee_asset_remove(args: &FeeAssetChangeArgs) -> eyre::Result<
pub(crate) async fn mint(args: &MintArgs) -> eyre::Result<()> {
let res = submit_transaction(
args.sequencer_url.as_str(),
args.sequencer_chain_id.clone(),
args.private_key.as_str(),
Action::Mint(MintAction {
to: args.to_address.0,
Expand Down Expand Up @@ -425,6 +434,7 @@ pub(crate) async fn mint(args: &MintArgs) -> eyre::Result<()> {
pub(crate) async fn sudo_address_change(args: &SudoAddressChangeArgs) -> eyre::Result<()> {
let res = submit_transaction(
args.sequencer_url.as_str(),
args.sequencer_chain_id.clone(),
args.private_key.as_str(),
Action::SudoAddressChange(SudoAddressChangeAction {
new_address: args.address.0,
Expand Down Expand Up @@ -463,6 +473,7 @@ pub(crate) async fn validator_update(args: &ValidatorUpdateArgs) -> eyre::Result

let res = submit_transaction(
args.sequencer_url.as_str(),
args.sequencer_chain_id.clone(),
args.private_key.as_str(),
Action::ValidatorUpdate(validator_update),
)
Expand All @@ -477,6 +488,7 @@ pub(crate) async fn validator_update(args: &ValidatorUpdateArgs) -> eyre::Result

async fn submit_transaction(
sequencer_url: &str,
chain_id: String,
private_key: &str,
action: Action,
) -> eyre::Result<endpoint::broadcast::tx_commit::Response> {
Expand All @@ -497,7 +509,10 @@ async fn submit_transaction(
.wrap_err("failed to get nonce")?;

let tx = UnsignedTransaction {
nonce: nonce_res.nonce,
params: TransactionParams {
nonce: nonce_res.nonce,
chain_id,
},
actions: vec![action],
}
.into_signed(&sequencer_key);
Expand Down
6 changes: 6 additions & 0 deletions crates/astria-cli/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ impl TryFrom<&ConfigCreateArgs> for RollupDeploymentConfig {
initial_block_height: sequencer_initial_block_height.to_string(),
grpc: args.sequencer_grpc.clone(),
rpc: args.sequencer_rpc.clone(),
chain_id: args.sequencer_chain_id.clone(),
},
})
}
Expand Down Expand Up @@ -247,6 +248,7 @@ struct SequencerConfig {
initial_block_height: String,
rpc: String,
grpc: String,
chain_id: String,
}

#[cfg(test)]
Expand Down Expand Up @@ -282,6 +284,7 @@ mod tests {
sequencer_initial_block_height: Some(127_689_000_000),
sequencer_grpc: "http://localhost:8080".to_string(),
sequencer_rpc: "http://localhost:8081".to_string(),
sequencer_chain_id: "test-chain-1".to_string(),
hostname: "test.com".to_string(),
namespace: "test-cluster".to_string(),
enable_celestia_node: false,
Expand Down Expand Up @@ -322,6 +325,7 @@ mod tests {
initial_block_height: "127689000000".to_string(),
grpc: "http://localhost:8080".to_string(),
rpc: "http://localhost:8081".to_string(),
chain_id: "test-chain-1".to_string(),
},
},
ingress_config: IngressConfig {
Expand Down Expand Up @@ -363,6 +367,7 @@ mod tests {
sequencer_initial_block_height: None,
sequencer_grpc: "http://localhost:8082".to_string(),
sequencer_rpc: "http://localhost:8083".to_string(),
sequencer_chain_id: "test-chain-1".to_string(),
hostname: "localdev.me".to_string(),
namespace: "astria-dev-cluster".to_string(),
enable_celestia_node: false,
Expand Down Expand Up @@ -395,6 +400,7 @@ mod tests {
initial_block_height: "2".to_string(), // Default value
grpc: "http://localhost:8082".to_string(),
rpc: "http://localhost:8083".to_string(),
chain_id: "test-chain-1".to_string(),
},
},
ingress_config: IngressConfig {
Expand Down
3 changes: 3 additions & 0 deletions crates/astria-composer/local.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ ASTRIA_COMPOSER_API_LISTEN_ADDR="0.0.0.0:0"
# Address of the RPC server for the sequencer chain
ASTRIA_COMPOSER_SEQUENCER_URL="http://127.0.0.1:26657"

# Chain ID of the sequencer chain which transactions are submitted to.
ASTRIA_COMPOSER_SEQUENCER_CHAIN_ID="astria-dev-1"

# A list of execution `<rollup_name_1>::<rpc_server_1>,<rollup_name_2>::<rpc_server_2>`.
# Rollup names are not case sensitive. If a name is repeated, the last list item is used.
# names are sha256 hashed and used as the `rollup_id` in `SequenceAction`s
Expand Down
1 change: 1 addition & 0 deletions crates/astria-composer/src/composer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ impl Composer {

let (executor, executor_handle) = executor::Builder {
sequencer_url: cfg.sequencer_url.clone(),
sequencer_chain_id: cfg.sequencer_chain_id.clone(),
private_key: cfg.private_key.clone(),
block_time_ms: cfg.block_time_ms,
max_bytes_per_bundle: cfg.max_bytes_per_bundle,
Expand Down
3 changes: 3 additions & 0 deletions crates/astria-composer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ pub struct Config {
/// Address of the RPC server for the sequencer chain
pub sequencer_url: String,

/// The chain ID of the sequencer chain
pub sequencer_chain_id: String,

/// A list of <rollup_name>::<url> pairs
pub rollups: String,

Expand Down
Loading

0 comments on commit b900c97

Please sign in to comment.