Add MRENCLAVE to CLI args

This commit is contained in:
hu55a1n1 2024-02-23 12:48:56 -08:00
parent 3a201cca82
commit d10edd75bc
2 changed files with 14 additions and 0 deletions

View file

@ -6,6 +6,7 @@ edition = "2021"
[dependencies]
clap = { version = "4.1.8", features = ["derive"] }
color-eyre = "0.6.2"
cosmwasm-std = "1.4.0"
prost = "0.12"
tendermint = "0.34.0"
tendermint-light-client = "0.34.0"
@ -15,3 +16,5 @@ tonic = "0.11"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
quartz-proto = { path = "../../utils/quartz-proto" }
quartz-cw = { path = "../../../bisenzone-cw-mvp/packages/quartz-cw" }
quartz-tee-ra = { git = "ssh://git@github.com/informalsystems/bisenzone-cw-mvp.git", branch = "hu55a1n1/11-use-quartz" }

View file

@ -2,6 +2,8 @@ use std::net::SocketAddr;
use clap::Parser;
use color_eyre::eyre::{eyre, Result};
use cosmwasm_std::HexBinary;
use quartz_cw::state::MrEnclave;
use tendermint::Hash;
use tendermint_light_client::types::{Height, TrustThreshold};
@ -15,6 +17,11 @@ fn parse_trust_threshold(s: &str) -> Result<TrustThreshold> {
}
}
fn parse_mr_enclave(s: &str) -> Result<MrEnclave> {
Ok(HexBinary::from_hex(s)?.to_array()?)
}
#[derive(Debug, Parser)]
#[command(author, version, about, long_about = None)]
pub struct Cli {
@ -22,6 +29,10 @@ pub struct Cli {
#[clap(long, default_value = "127.0.0.1:11090")]
pub rpc_addr: SocketAddr,
/// MRENCLAVE of this enclave
#[clap(long, value_parser = parse_mr_enclave)]
pub mr_enclave: MrEnclave,
/// Identifier of the chain
#[clap(long)]
pub chain_id: String,