From eefb57f2c035be1a398f630dd8cfed8b4ccbe348 Mon Sep 17 00:00:00 2001 From: Kamen Mladenov Date: Wed, 30 Apr 2025 17:25:15 +0300 Subject: feat(zkvms_guest_io): Output proof size In each zkVM we'll write the size to /tmp/proof_size and then guest_io will read that value and place it inside our metrics output. This is not the most elegant, and in certain zkVMs the file output is a part of the benchmark timing, but it will have to do. --- zkvms/sp1/host/src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'zkvms/sp1/host/src/main.rs') diff --git a/zkvms/sp1/host/src/main.rs b/zkvms/sp1/host/src/main.rs index 6d19000..a395247 100644 --- a/zkvms/sp1/host/src/main.rs +++ b/zkvms/sp1/host/src/main.rs @@ -2,6 +2,7 @@ use sp1_sdk::{EnvProver, ProverClient, SP1ProofWithPublicValues, SP1Stdin, SP1Ve use zkvms_host_io::{ benchmarkable, foreach_input_field, read_args, Input, RunType::{Execute, Prove, Verify}, + output_proof_size, }; /// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM. @@ -40,13 +41,18 @@ fn main() { println!("Number of cycles: {}", report.total_instruction_count()); }, Prove => benchmarkable! { - let _ = prove(&client, stdin.clone()); + let (proof, _) = prove(&client, stdin.clone()); + + output_proof_size(&proof); + println!("Successfully generated proof!"); }, Verify => { let (proof, vk) = prove(&client, stdin.clone()); println!("Successfully generated proof!"); + output_proof_size(&proof); + benchmarkable! { client.verify(&proof, &vk).expect("failed to verify proof"); println!("Successfully verified proof!"); -- cgit v1.2.3