From 95286858b0311321c5aac86d04314b0db39f14a5 Mon Sep 17 00:00:00 2001 From: Ajinkya Kulkarni Date: Thu, 5 Dec 2024 15:28:01 +0100 Subject: [PATCH] WIP --- crates/utils/tcbinfo-updater/src/main.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/utils/tcbinfo-updater/src/main.rs b/crates/utils/tcbinfo-updater/src/main.rs index 87798aa..65e7f04 100644 --- a/crates/utils/tcbinfo-updater/src/main.rs +++ b/crates/utils/tcbinfo-updater/src/main.rs @@ -50,6 +50,7 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> { for fmspc in fmspc_list { let tcbinfo_from_api = get_tcbinfo(fmspc.clone(), "standard".to_string()).await; + // assert!(verify_signature(tcbinfo.clone(), key)); let contract_address = "neutron1r4m59786vmxrx866585ze5ugjx9egcyja0nuxhn2y6d7ht6680sspa89zk" @@ -57,7 +58,7 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> { .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 = format_json_string(tcbinfo_on_chain_json); + let tcbinfo_on_chain = to_content::(&tcbinfo_on_chain_json["data"]["tcb_info"].to_string()).unwrap().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}"); @@ -88,11 +89,7 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> { Ok(()) } -fn format_json_string(input: Value) -> String { - let without_end_quotes = strip_dquotes(format!("{}", input["data"]["tcb_info"]).as_ref()).unwrap().to_string(); - let content = to_content::(&without_end_quotes).unwrap().to_string(); - content -} + #[tokio::main] pub async fn main() {