From 87193616f65cc64ce8f346fb8dbb12e9b7b72bfc Mon Sep 17 00:00:00 2001 From: Ajinkya Kulkarni Date: Thu, 5 Dec 2024 15:47:54 +0100 Subject: [PATCH] WIP --- crates/utils/tcbinfo-updater/src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/utils/tcbinfo-updater/src/main.rs b/crates/utils/tcbinfo-updater/src/main.rs index 65e7f04..440d42f 100644 --- a/crates/utils/tcbinfo-updater/src/main.rs +++ b/crates/utils/tcbinfo-updater/src/main.rs @@ -57,8 +57,16 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> { .parse() .expect("failed to parse contract address"); let query_msg = QueryMsg::GetTcbInfo { fmspc: fmspc.clone() }; - let tcbinfo_on_chain_json: Value = client.query_smart(&contract_address, json!(query_msg)).await.expect("contract query failed"); - let tcbinfo_on_chain = to_content::(&tcbinfo_on_chain_json["data"]["tcb_info"].to_string()).unwrap().to_string(); + + let tcbinfo_on_chain = { if let Ok(res) = client.query_smart::(&contract_address, json!(query_msg)).await { + to_content::(&res["data"]["tcb_info"].to_string()).unwrap().to_string() + } else { + "".to_string() + } + + + }; + println!("{tcbinfo_on_chain} \n {tcbinfo_from_api}"); if tcbinfo_on_chain != tcbinfo_from_api { println!("updating on-chain TCBInfo for FMSPC: {fmspc}");