From 84731ebf3112056f26f109466f461f6c1af99c32 Mon Sep 17 00:00:00 2001 From: kunxian xia Date: Sat, 14 Sep 2024 12:13:31 +0800 Subject: [PATCH] transcript should not depend on the proving order of circuits --- ceno_zkvm/src/scheme/prover.rs | 6 ++++-- ceno_zkvm/src/scheme/verifier.rs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ceno_zkvm/src/scheme/prover.rs b/ceno_zkvm/src/scheme/prover.rs index fdf5a9aa2..f1127307d 100644 --- a/ceno_zkvm/src/scheme/prover.rs +++ b/ceno_zkvm/src/scheme/prover.rs @@ -52,6 +52,8 @@ impl ZKVMProver { ) -> Result, ZKVMError> { let mut vm_proof = ZKVMProof::default(); for (circuit_name, pk) in self.pk.circuit_pks.iter() { + // each circuit should be proved independently + let mut transcript = transcript.clone(); let witness = witnesses .witnesses .remove(circuit_name) @@ -84,7 +86,7 @@ impl ZKVMProver { .collect_vec(), num_instances, max_threads, - transcript, + &mut transcript, challenges, )?; tracing::info!( @@ -106,7 +108,7 @@ impl ZKVMProver { .collect_vec(), num_instances, max_threads, - transcript, + &mut transcript, challenges, )?; tracing::info!( diff --git a/ceno_zkvm/src/scheme/verifier.rs b/ceno_zkvm/src/scheme/verifier.rs index fb2f2e97a..a3edcd1b7 100644 --- a/ceno_zkvm/src/scheme/verifier.rs +++ b/ceno_zkvm/src/scheme/verifier.rs @@ -49,6 +49,7 @@ impl ZKVMVerifier { let point_eval = PointAndEval::default(); let mut dummy_table_item_multiplicity = 0; for (name, opcode_proof) in vm_proof.opcode_proofs { + let mut transcript = transcript.clone(); let circuit_vk = self .vk .circuit_vks @@ -57,7 +58,7 @@ impl ZKVMVerifier { let _rand_point = self.verify_opcode_proof( circuit_vk, &opcode_proof, - transcript, + &mut transcript, NUM_FANIN, &point_eval, challenges, @@ -83,6 +84,7 @@ impl ZKVMVerifier { } for (name, table_proof) in vm_proof.table_proofs { + let mut transcript = transcript.clone(); let circuit_vk = self .vk .circuit_vks @@ -91,7 +93,7 @@ impl ZKVMVerifier { let _rand_point = self.verify_table_proof( circuit_vk, &table_proof, - transcript, + &mut transcript, NUM_FANIN_LOGUP, &point_eval, challenges,