Skip to content

Commit

Permalink
add test sample
Browse files Browse the repository at this point in the history
  • Loading branch information
noel2004 committed Mar 10, 2025
1 parent cc8dfcd commit c84a036
Show file tree
Hide file tree
Showing 2 changed files with 327 additions and 6 deletions.
321 changes: 321 additions & 0 deletions crates/integration/testdata/batch-task-phase-1.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions crates/verifier/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<Type> Verifier<Type> {
let root_committed_exe = {
std::fs::read(path_root_committed_exe.as_ref())
.map_err(|e|e.into())
.and_then(|bytes|bincode_v1::deserialize(&bytes))
.and_then(|bytes|bincode::deserialize(&bytes))
.unwrap_or_else(|e|{
use openvm_sdk::{config::AggStarkConfig, keygen::AggStarkProvingKey};
println!("can not load committed exe, try to create it (may take quite a long time) {e}");
Expand Down Expand Up @@ -109,7 +109,7 @@ impl<Type: VerifierType> Verifier<Type> {
&& ret[8..]
.iter()
.zip(&Type::LEAF_COMMIT)
.all(|(r_pi, exe_cmt)| r_pi.as_ref() == Some(exe_cmt))
.all(|(r_pi, leaf_cmt)| r_pi.as_ref() == Some(leaf_cmt))
} else {
false
}
Expand Down Expand Up @@ -137,7 +137,7 @@ impl<Type: VerifierType> Verifier<Type> {
}
}

#[ignore = "enable after correct proof has been updated"]
#[ignore = "need released assets, enable after correct proof has been updated"]
#[test]
fn verify_chunk_proof() {
use scroll_zkvm_prover::{ChunkProof, utils::read_json_deep};
Expand Down Expand Up @@ -175,11 +175,12 @@ fn verify_chunk_proof() {
);
}

#[ignore = "enable after feat/phase2"]
#[ignore = "need released assets"]
#[test]
fn verify_batch_task_proof() {
use scroll_zkvm_prover::{task::batch::BatchProvingTask, utils::read_json_deep};

// FIXME: this task include one problemic proof so we only test several of them
let task =
read_json_deep::<_, BatchProvingTask>("../integration/testdata/batch-task-phase-1.json")
.unwrap();
Expand All @@ -192,10 +193,9 @@ fn verify_batch_task_proof() {
)
.unwrap();

for chunk_proof in task.chunk_proofs {
for chunk_proof in &task.chunk_proofs[..3] {
let root_proof = chunk_proof.as_proof();
let commitment = ProgramCommitment::deserialize(&chunk_proof.vk);
println!("commitment {:?}", commitment);
let ret = verifier.verify_proof_with_pi(root_proof).unwrap();
assert_eq!(
&ret[..8],
Expand Down

0 comments on commit c84a036

Please sign in to comment.