This commit is contained in:
Ajinkya Kulkarni 2025-02-11 17:43:48 +01:00
parent f4bc1758da
commit 7379ec91c3
2 changed files with 13 additions and 6 deletions

View file

@ -23,3 +23,5 @@ mc-attestation-verifier.workspace = true
p256.workspace = true p256.workspace = true
x509-cert = "0.2.5" x509-cert = "0.2.5"
der.workspace = true der.workspace = true
anyhow.workspace = true
hex.workspace = true

View file

@ -1,6 +1,7 @@
use cw_client::{CliClient, CwClient}; use cw_client::{GrpcClient, CwClient};
use quartz_tcbinfo_msgs::{QueryMsg, ExecuteMsg}; use quartz_tcbinfo_msgs::{QueryMsg, ExecuteMsg};
use quoted_string::strip_dquotes; use quoted_string::strip_dquotes;
use anyhow::{anyhow, Result};
use quoted_string::test_utils::TestSpec; use quoted_string::test_utils::TestSpec;
use quoted_string::to_content; use quoted_string::to_content;
use reqwest::Url; use reqwest::Url;
@ -41,11 +42,14 @@ async fn get_fmspc_list() -> Vec<Fmspc> {
fmspc_list fmspc_list
} }
async fn upsert_tcbinfo(url: &str, contract_addr: &str, chain_id : Id, sender: &str, gas: u64, fees: &str) -> Result<(), &'static str> { async fn upsert_tcbinfo(url: &str, contract_addr: &str, chain_id : Id, sender: &str, gas: u64, fees: &str, sk: &str) -> Result<(), &'static str> {
let testnet = Url::parse(url).expect("couldn't parse network URL"); let network = Url::parse(url).expect("couldn't parse network URL");
let skey = hex::decode(sk).expect("couldn't read signing key")
let client = CliClient::neutrond(testnet); .as_slice()
.try_into()
.map_err(|e| anyhow!("failed to read/parse sk: {}", e)).expect("couldn't extract result value");
let client = GrpcClient::new(skey, network);
let fmspc_list = get_fmspc_list().await; let fmspc_list = get_fmspc_list().await;
for fmspc in fmspc_list { for fmspc in fmspc_list {
@ -104,7 +108,8 @@ pub async fn main() {
let sender: &str = &args[4]; let sender: &str = &args[4];
let gas: &u64 = &args[5].parse().expect("gas must be a u64 value"); let gas: &u64 = &args[5].parse().expect("gas must be a u64 value");
let fees: &str = &args[6]; let fees: &str = &args[6];
upsert_tcbinfo(url, contract_address, Id::try_from(chain_id.clone()).expect("invalid chain id"), sender, *gas, fees).await.expect("TCBInfo update failed"); let sk: &str = &args[7];
upsert_tcbinfo(url, contract_address, Id::try_from(chain_id.clone()).expect("invalid chain id"), sender, *gas, fees, sk).await.expect("TCBInfo update failed");
} }
/*let url =; /*let url =;