From 9f9b15f0fdc0da2c43f5190fd3c5e4956d123fec Mon Sep 17 00:00:00 2001 From: Ajinkya Kulkarni Date: Tue, 3 Dec 2024 10:58:52 +0100 Subject: [PATCH] WIP --- crates/utils/tcbinfo-updater/src/main.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/crates/utils/tcbinfo-updater/src/main.rs b/crates/utils/tcbinfo-updater/src/main.rs index 4306356..c4fd7b1 100644 --- a/crates/utils/tcbinfo-updater/src/main.rs +++ b/crates/utils/tcbinfo-updater/src/main.rs @@ -12,16 +12,6 @@ type Update = String; const TCB_SIGNER: &str = include_str!("../tcb_signer.pem"); -struct ExecMsg { - msg: ExecuteMsg -} - -impl ToString for ExecMsg { - fn to_string (&self) -> String { - format!("\"tcb_info\": {0}, \"certificate\": {1}", self.msg.tcb_info, self.msg.certificate) - } -} - async fn get_tcbinfo(fmspc: Fmspc, update: Update) -> Value { let url = format!("https://api.trustedservices.intel.com/sgx/certification/v4/tcb?fmspc={fmspc}&update={update}"); let body: String = reqwest::get(url) @@ -69,13 +59,14 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> { let chain_id = tendermint::chain::id::Id::try_from("pion-1").expect("invalid chain id"); let sender = "ajinkya"; let client = CliClient::neutrond(testnet); - let execute_msg = ExecMsg { msg: ExecuteMsg { + let execute_msg = ExecuteMsg { tcb_info: tcbinfo.to_string(), certificate: TCB_SIGNER.to_string(), time: None, - }}; + } + }; if let Err(e) = - client.tx_execute(&contract_address, &chain_id, 200000, &sender, execute_msg, "200000untrn").await + client.tx_execute(&contract_address, &chain_id, 200000, &sender, json!(execute_msg), "200000untrn").await { eprintln!("Error: {}", e); }