This commit is contained in:
Ajinkya Kulkarni 2024-12-03 10:58:52 +01:00
parent 031eb9d98c
commit 9f9b15f0fd

View file

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