Skip to content

Commit 1381eb5

Browse files
authored
carry cycle data in starkproof (#167)
1 parent 726574a commit 1381eb5

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

crates/prover/src/prover/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::{
2323
task::ProvingTask,
2424
};
2525

26-
use scroll_zkvm_types::proof::{EvmProof, ProofEnum, StarkProof};
26+
use scroll_zkvm_types::proof::{EvmProof, ProofEnum, StarkProof, StarkProofStat};
2727
/// The default directory to locate openvm's halo2 SRS parameters.
2828
const DEFAULT_PARAMS_DIR: &str = concat!(env!("HOME"), "/.openvm/params/");
2929

@@ -242,7 +242,7 @@ impl Prover {
242242
pub fn gen_proof_stark(&self, stdin: StdIn) -> Result<StarkProof, Error> {
243243
// Here we always do an execution of the guest program to get the cycle count.
244244
// and do precheck before proving like ensure PI != 0
245-
self.execute_and_check(&stdin)?;
245+
let total_cycles = self.execute_and_check(&stdin)?;
246246

247247
let sdk = Sdk::new();
248248
let proof = sdk
@@ -258,6 +258,7 @@ impl Prover {
258258
public_values: proof.user_public_values,
259259
//exe_commitment: comm.exe,
260260
//vm_commitment: comm.vm,
261+
stat: StarkProofStat { total_cycles },
261262
};
262263
tracing::info!("verifing stark proof");
263264
UniversalVerifier::verify_stark_proof(&proof, &self.get_app_vk())

crates/types/src/proof.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ pub struct EvmProof {
3434
*/
3535
}
3636

37+
/// Stat for the insight of stark proofing
38+
#[derive(Clone, Serialize, Deserialize)]
39+
pub struct StarkProofStat {
40+
/// total cycles
41+
pub total_cycles: u64,
42+
}
43+
3744
/// Helper to modify serde implementations on the remote [`RootProof`] type.
3845
#[derive(Clone, Serialize, Deserialize)]
3946
pub struct StarkProof {
@@ -46,6 +53,7 @@ pub struct StarkProof {
4653
pub public_values: Vec<BabyBear>,
4754
//pub exe_commitment: [u32; 8],
4855
//pub vm_commitment: [u32; 8],
56+
pub stat: StarkProofStat,
4957
}
5058

5159
pub use openvm_sdk::types::EvmProof as OpenVmEvmProof;

0 commit comments

Comments
 (0)