WIP
This commit is contained in:
parent
031eb9d98c
commit
9f9b15f0fd
1 changed files with 4 additions and 13 deletions
|
@ -12,16 +12,6 @@ type Update = String;
|
||||||
|
|
||||||
const TCB_SIGNER: &str = include_str!("../tcb_signer.pem");
|
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 {
|
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 url = format!("https://api.trustedservices.intel.com/sgx/certification/v4/tcb?fmspc={fmspc}&update={update}");
|
||||||
let body: String = reqwest::get(url)
|
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 chain_id = tendermint::chain::id::Id::try_from("pion-1").expect("invalid chain id");
|
||||||
let sender = "ajinkya";
|
let sender = "ajinkya";
|
||||||
let client = CliClient::neutrond(testnet);
|
let client = CliClient::neutrond(testnet);
|
||||||
let execute_msg = ExecMsg { msg: ExecuteMsg {
|
let execute_msg = ExecuteMsg {
|
||||||
tcb_info: tcbinfo.to_string(),
|
tcb_info: tcbinfo.to_string(),
|
||||||
certificate: TCB_SIGNER.to_string(),
|
certificate: TCB_SIGNER.to_string(),
|
||||||
time: None,
|
time: None,
|
||||||
}};
|
}
|
||||||
|
};
|
||||||
if let Err(e) =
|
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);
|
eprintln!("Error: {}", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue