diff --git a/host/src/server/api/v1/mod.rs b/host/src/server/api/v1/mod.rs index fc3b322fc..8c14a9f7d 100644 --- a/host/src/server/api/v1/mod.rs +++ b/host/src/server/api/v1/mod.rs @@ -1,7 +1,7 @@ use axum::{response::IntoResponse, Router}; use raiko_lib::input::GuestOutput; use serde::{Deserialize, Serialize}; -use serde_json::Value; +use serde_json::{json, Value}; use tower::ServiceBuilder; use utoipa::{OpenApi, ToSchema}; use utoipa_scalar::{Scalar, Servable}; @@ -62,10 +62,7 @@ pub struct ProofResponse { impl ProofResponse { pub fn to_response(&self) -> Value { - serde_json::json!({ - "status": "ok", - "data": self - }) + json!({ "status": "ok", "data": self }) } } diff --git a/host/tests/common/mod.rs b/host/tests/common/mod.rs index 66b1800f9..26ef7c8f2 100644 --- a/host/tests/common/mod.rs +++ b/host/tests/common/mod.rs @@ -6,6 +6,7 @@ use raiko_core::interfaces::{ProofRequestOpt, ProofType, ProverSpecificOpts}; use raiko_host::{server::serve, ProverState}; use raiko_lib::consts::{Network, SupportedChainSpecs}; use serde::Deserialize; +use serde_json::json; use tokio_util::sync::CancellationToken; mod client; @@ -38,7 +39,7 @@ pub async fn find_recent_block(network: Network) -> anyhow::Result { let response = client .post(beacon.clone()) - .json(&serde_json::json!({ + .json(&json!({ "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], @@ -58,7 +59,7 @@ pub async fn find_recent_block(network: Network) -> anyhow::Result { for block_number in latest_blocks { let response = client .post(beacon.clone()) - .json(&serde_json::json!({ + .json(&json!({ "jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": [format!("0x{block_number:x}"), false], @@ -130,7 +131,7 @@ pub async fn make_request() -> anyhow::Result { prover_args: ProverSpecificOpts { native: None, sgx: None, - sp1: Some(serde_json::json!({ "verify": false })), + sp1: Some(json!({ "verify": false })), risc0: None, }, }) diff --git a/provers/sgx/guest/src/one_shot.rs b/provers/sgx/guest/src/one_shot.rs index 4c4cfee71..5dec155c7 100644 --- a/provers/sgx/guest/src/one_shot.rs +++ b/provers/sgx/guest/src/one_shot.rs @@ -13,6 +13,7 @@ use raiko_lib::{ }; use secp256k1::{Keypair, SecretKey}; use serde::Serialize; +use serde_json::json; base64_serde_type!(Base64Standard, base64::engine::general_purpose::STANDARD); @@ -68,7 +69,7 @@ fn save_bootstrap_details( quote: hex::encode(quote), }; - println!("{}", serde_json::json!(&bootstrap_details)); + println!("{}", json!(&bootstrap_details)); let json = serde_json::to_string_pretty(&bootstrap_details)?; fs::write(bootstrap_details_file_path, json).context(format!( "Saving bootstrap data file {} failed", @@ -155,7 +156,7 @@ pub async fn one_shot(global_opts: GlobalOpts, args: OneShotArgs) -> Result<()> // Print out the proof and updated public info let quote = get_sgx_quote()?; - let data = serde_json::json!({ + let data = json!({ "proof": format!("0x{proof}"), "quote": hex::encode(quote), "public_key": format!("0x{new_pubkey}"),