Skip to content

Commit

Permalink
feat(cli): update for new charts, dusk-7 endpoints (#1103)
Browse files Browse the repository at this point in the history
## Summary
Updates rust cli to use dusk-7. This includes updates to use latest
charts + sequencer updates. One additional update of removing unneeded
chain id from basic args.

## Background
Dusk-6 is being released, and cli needs to be updated to work with it

## Changes
- Add default resources which are on low end for chart
- Update passing of private keys to match new chart setup
- Utilize newest chart release
- Default to dusk-7 network
- Remove the unused chain id from basic account args.

## Testing
Manual testing + some CI updates
  • Loading branch information
joroshiba authored May 30, 2024
1 parent ab00633 commit 74f992e
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 13 deletions.
4 changes: 2 additions & 2 deletions crates/astria-cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use crate::cli::{
sequencer::Command as SequencerCommand,
};

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

/// A CLI for deploying and managing Astria services and related infrastructure.
#[derive(Debug, Parser)]
Expand Down
4 changes: 2 additions & 2 deletions crates/astria-cli/src/cli/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use color_eyre::eyre;
use serde::Serialize;

const DEFAULT_ROLLUP_CHART_PATH: &str =
"https://github.com/astriaorg/charts/releases/download/evm-rollup-0.11.1/evm-rollup-0.11.1.tgz";
const DEFAULT_SEQUENCER_GRPC: &str = "https://grpc.sequencer.dusk-4.devnet.astria.org/";
"https://github.com/astriaorg/charts/releases/download/evm-rollup-0.18.4/evm-rollup-0.18.4.tgz";
const DEFAULT_SEQUENCER_GRPC: &str = "https://grpc.sequencer.dusk-7.devnet.astria.org/";
const DEFAULT_LOG_LEVEL: &str = "debug";
const DEFAULT_NETWORK_ID: u64 = 1337;
const DEFAULT_EXECUTION_COMMIT_LEVEL: &str = "SoftOnly";
Expand Down
7 changes: 0 additions & 7 deletions crates/astria-cli/src/cli/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ pub struct BasicAccountArgs {
default_value = crate::cli::DEFAULT_SEQUENCER_RPC
)]
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::cli::DEFAULT_SEQUENCER_CHAIN_ID
)]
pub sequencer_chain_id: String,
/// The address of the Sequencer account
pub(crate) address: SequencerAddressArg,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/astria-cli/src/commands/rollup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ pub(crate) fn create_deployment(args: &DeploymentCreateArgs) -> eyre::Result<()>
// Use a secret manager or inject the private key into the environment
.arg("--set")
.arg(format!(
"config.faucet.privateKey={}",
"config.faucet.privateKey.devContent={}",
args.faucet_private_key.clone()
))
// TODO: https://github.com/astriaorg/astria/issues/594
// Use a secret manager or inject the private key into the environment
.arg("--set")
.arg(format!(
"config.sequencer.privateKey={}",
"config.sequencer.privateKey.devContent={}",
args.sequencer_private_key.clone()
))
.arg(rollup.deployment_config.get_chart_release_name())
Expand Down
81 changes: 81 additions & 0 deletions crates/astria-cli/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub struct Rollup {
pub(crate) ingress_config: IngressConfig,
#[serde(rename = "celestia-node")]
pub(crate) celestia_node: CelestiaNode,
#[serde(rename = "resources")]
pub(crate) resources: CoreResources,
}

impl TryFrom<&ConfigCreateArgs> for Rollup {
Expand All @@ -31,12 +33,14 @@ impl TryFrom<&ConfigCreateArgs> for Rollup {
let deployment_config = RollupDeploymentConfig::try_from(args)?;
let ingress_config = IngressConfig::from(args);
let celestia_node = CelestiaNode::from(args);
let resources = CoreResources::default();

Ok(Self {
globals_config,
deployment_config,
ingress_config,
celestia_node,
resources,
})
}
}
Expand Down Expand Up @@ -251,6 +255,81 @@ struct SequencerConfig {
chain_id: String,
}

#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct CoreResources {
conductor: ServiceResources,
composer: ServiceResources,
geth: ServiceResources,
}

impl CoreResources {
fn default() -> Self {
Self {
conductor: ServiceResources::default_low(),
composer: ServiceResources::default_low(),
geth: ServiceResources::default_high(),
}
}
}

#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct ServiceResources {
requests: Resource,
limits: Resource,
}

impl ServiceResources {
fn default_low() -> Self {
Self {
requests: Resource::default_low_request(),
limits: Resource::default_low_limit(),
}
}

fn default_high() -> Self {
Self {
requests: Resource::default_high_request(),
limits: Resource::default_high_limit(),
}
}
}

#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct Resource {
cpu: f32,
memory: String,
}

impl Resource {
fn default_low_request() -> Self {
Self {
cpu: 0.01,
memory: "1Mi".to_string(),
}
}

fn default_low_limit() -> Self {
Self {
cpu: 0.1,
memory: "20Mi".to_string(),
}
}

fn default_high_request() -> Self {
Self {
cpu: 0.25,
memory: "256Mi".to_string(),
}
}

fn default_high_limit() -> Self {
Self {
cpu: 1.0,
memory: "1Gi".to_string(),
}
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down Expand Up @@ -337,6 +416,7 @@ mod tests {
label_prefix: "rollup1".to_string(),
},
},
resources: CoreResources::default(),
};

let result = Rollup::try_from(&args)?;
Expand Down Expand Up @@ -412,6 +492,7 @@ mod tests {
label_prefix: "rollup2".to_string(),
},
},
resources: CoreResources::default(),
};

let result = Rollup::try_from(&args)?;
Expand Down

0 comments on commit 74f992e

Please sign in to comment.