WIP
This commit is contained in:
parent
95286858b0
commit
87193616f6
1 changed files with 10 additions and 2 deletions
|
@ -57,8 +57,16 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> {
|
||||||
.parse()
|
.parse()
|
||||||
.expect("failed to parse contract address");
|
.expect("failed to parse contract address");
|
||||||
let query_msg = QueryMsg::GetTcbInfo { fmspc: fmspc.clone() };
|
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::<TestSpec>(&tcbinfo_on_chain_json["data"]["tcb_info"].to_string()).unwrap().to_string();
|
let tcbinfo_on_chain = { if let Ok(res) = client.query_smart::<Value>(&contract_address, json!(query_msg)).await {
|
||||||
|
to_content::<TestSpec>(&res["data"]["tcb_info"].to_string()).unwrap().to_string()
|
||||||
|
} else {
|
||||||
|
"".to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
println!("{tcbinfo_on_chain} \n {tcbinfo_from_api}");
|
println!("{tcbinfo_on_chain} \n {tcbinfo_from_api}");
|
||||||
if tcbinfo_on_chain != tcbinfo_from_api {
|
if tcbinfo_on_chain != tcbinfo_from_api {
|
||||||
println!("updating on-chain TCBInfo for FMSPC: {fmspc}");
|
println!("updating on-chain TCBInfo for FMSPC: {fmspc}");
|
||||||
|
|
Loading…
Reference in a new issue