From 0081ac98a1d1eb2d20d5da0b9061807dc7485ccd Mon Sep 17 00:00:00 2001 From: cezary-stroczynski Date: Tue, 10 Dec 2024 13:28:05 +0100 Subject: [PATCH 1/2] Use groth16 proofs --- prover/Cargo.toml | 12 +++++++++--- prover/src/main.rs | 27 +++++++++++++++++++++------ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/prover/Cargo.toml b/prover/Cargo.toml index d451fb5..19f9957 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -9,12 +9,18 @@ shared = { path = "shared" } risc0-zkvm = { version = "1.1.2" } tracing-subscriber = { version = "0.3", features = ["env-filter"] } serde = "1.0" -ddex_schema = {path = '../parser/ddex_schema'} +ddex_schema = { path = '../parser/ddex_schema' } env_logger = "0.11.5" -blob_codec = {path = '../blob_codec'} +blob_codec = { path = '../blob_codec' } +risc0-ethereum-contracts = { git = "https://github.com/risc0/risc0-ethereum", tag = "v1.1.4" } +# alloy-primitives = { version = "=0.8.5", default-features = false, features = [ +# "rlp", +# "serde", +# "std", +# ] } [features] cuda = ["risc0-zkvm/cuda"] default = [] metal = ["risc0-zkvm/metal"] -prove = ["risc0-zkvm/prove"] \ No newline at end of file +prove = ["risc0-zkvm/prove"] diff --git a/prover/src/main.rs b/prover/src/main.rs index 39d58da..a111b5e 100644 --- a/prover/src/main.rs +++ b/prover/src/main.rs @@ -1,10 +1,10 @@ use blob_codec::BlobCodec; use core::str; use methods::{DDEX_PARSER_GUEST_ELF, DDEX_PARSER_GUEST_ID}; -use risc0_zkvm::{default_prover, ExecutorEnv}; +use risc0_ethereum_contracts::encode_seal; +use risc0_zkvm::{default_prover, ExecutorEnv, ProverOpts, VerifierContext}; use shared::PublicOutputs; use std::time::Instant; - pub struct StopWatch { timer: Instant, } @@ -40,16 +40,31 @@ fn main() { let prover = default_prover(); - let receipt = prover.prove(env, DDEX_PARSER_GUEST_ELF).unwrap().receipt; + let receipt = prover + .prove_with_ctx( + env, + &VerifierContext::default(), + DDEX_PARSER_GUEST_ELF, + &ProverOpts::groth16(), + ) + .unwrap() + .receipt; + + let seal = encode_seal(&receipt).unwrap(); + + let journal = receipt.journal.bytes.clone(); let public_outputs: PublicOutputs = receipt.journal.decode().unwrap(); println!( - "Values decoded from receipt:: Verified: {}, Digest: {}", - public_outputs.is_valid, - String::from_utf8_lossy(&public_outputs.digest), + "Values decoded from receipt:: Verified: {}", + public_outputs.is_valid ); + println!("public outputs: {public_outputs:?}"); + println!("journal: {journal:?}"); + println!("seal: {seal:?}"); + timer.stop("produce the proof"); timer = StopWatch::start(); From 8ff73798eaa327a41c90c81251a32c5deb5ac573 Mon Sep 17 00:00:00 2001 From: cezary-stroczynski Date: Tue, 10 Dec 2024 13:29:02 +0100 Subject: [PATCH 2/2] Remove comment in Cargo.toml --- prover/Cargo.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/prover/Cargo.toml b/prover/Cargo.toml index 19f9957..45a58fa 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -13,11 +13,6 @@ ddex_schema = { path = '../parser/ddex_schema' } env_logger = "0.11.5" blob_codec = { path = '../blob_codec' } risc0-ethereum-contracts = { git = "https://github.com/risc0/risc0-ethereum", tag = "v1.1.4" } -# alloy-primitives = { version = "=0.8.5", default-features = false, features = [ -# "rlp", -# "serde", -# "std", -# ] } [features] cuda = ["risc0-zkvm/cuda"]