diff --git a/apps/src/local_prover.rs b/apps/src/local_prover.rs index a438ae1..00bd59b 100644 --- a/apps/src/local_prover.rs +++ b/apps/src/local_prover.rs @@ -29,18 +29,18 @@ impl LocalProver { /// Generates a snark proof as a triplet (`Vec`, `FixedBytes<32>`, /// `Vec) for the given elf and input. pub fn prove(elf: &[u8], input: &[u8]) -> Result<(Vec, FixedBytes<32>, Vec)> { - println!("start local proving"); + log::info!("Start local proving"); let env = ExecutorEnv::builder() .write_slice(input) // .unwrap() .build() .unwrap(); - println!("execute"); + log::info!("Create execution session"); let mut exec = ExecutorImpl::from_elf(env, elf).unwrap(); let session = exec.run().unwrap(); - println!("prove"); + log::info!("Generate STARK proof"); let opts = ProverOpts::default(); let ctx = VerifierContext::default(); let prover = get_prover_server(&opts).unwrap(); @@ -51,13 +51,12 @@ impl LocalProver { let succinct_receipt = prover.compress(composite_receipt).unwrap(); let journal: Vec = session.journal.unwrap().bytes; - println!("identity_p254"); let ident_receipt = identity_p254(&succinct_receipt).unwrap(); let seal_bytes = ident_receipt.get_seal_bytes(); - println!("Start translate STARK to SNARK"); + log::info!("Start translate STARK to SNARK"); let seal = stark_to_snark(&seal_bytes).unwrap().to_vec(); - println!( + log::info!( "Transform finish, proof size decrease from {:} bytes to {:} bytes, snark proof {:?}", seal_bytes.len(), seal.len(), @@ -83,7 +82,7 @@ mod tests { let (journal, _post_state_digest, seal) = super::LocalProver::prove(DCAP_VERIFIER_ELF, &even_number.abi_encode()).unwrap(); - println!("Snark proof: {:?}", hex::encode(&seal)); + log::info!("Snark proof: {:?}", hex::encode(&seal)); let x = U256::abi_decode(&journal, true).unwrap(); assert_eq!(x, even_number); } diff --git a/methods/guest/Cargo.lock b/methods/guest/Cargo.lock index 84d9df6..8fa3bb6 100644 --- a/methods/guest/Cargo.lock +++ b/methods/guest/Cargo.lock @@ -797,6 +797,7 @@ dependencies = [ "const-oid", "der", "hex", + "log", "parity-scale-codec", "pem", "pink-json", diff --git a/methods/guest/Cargo.toml b/methods/guest/Cargo.toml index 7a7ea89..4c665e3 100644 --- a/methods/guest/Cargo.toml +++ b/methods/guest/Cargo.toml @@ -30,6 +30,7 @@ chrono = { version = "0.4.31", default-features = false, features = ["alloc", "s anyhow = { version = "1.0.79", default-features = false } thiserror = "1.0.50" +log = { version = "0.4" } asn1_der = { version = "0.7", default-features = false, features = [ "native_types", diff --git a/methods/guest/src/main.rs b/methods/guest/src/main.rs index b1c1fce..9262722 100644 --- a/methods/guest/src/main.rs +++ b/methods/guest/src/main.rs @@ -31,7 +31,7 @@ fn main() { // Deserialize input bytes let input: Inputs = bincode::deserialize(&input_bytes).unwrap(); - println!("Guest: check if dcap input is valid"); + log::info!("Check if dcap input is valid"); let now = input.now; let raw_quote = input.quote; let raw_quote_collateral = input.quote_collateral; @@ -51,7 +51,7 @@ fn main() { advisory_ids }; - println!("Guest: check passed, commit output to host"); + log::info!("Check passed, commit output to host"); // write public output to the journal env::commit_slice(bincode::serialize(&output).unwrap().as_slice());