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}");