Skip to content

Commit

Permalink
fix/transcript_fork: draft
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurélien Nicolas committed Sep 14, 2024
1 parent 71b1aa2 commit 0f50995
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ceno_zkvm/src/scheme/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ impl<E: ExtensionField> ZKVMProver<E> {
challenges: &[E; 2],
) -> Result<ZKVMProof<E>, ZKVMError> {
let mut vm_proof = ZKVMProof::default();
for (circuit_name, pk) in self.pk.circuit_pks.iter() {
let mut transcripts = transcript.fork(self.pk.circuit_pks.len());

for ((circuit_name, pk), transcript) in
self.pk.circuit_pks.iter().zip_eq(transcripts.iter_mut())
{
let witness = witnesses
.witnesses
.remove(circuit_name)
Expand Down
19 changes: 19 additions & 0 deletions transcript/src/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ impl<E: ExtensionField> Transcript<E> {
}

impl<E: ExtensionField> Transcript<E> {
/// Fork this transcript into n different threads.
pub fn fork(&mut self, n: usize) -> Vec<Self> {
let mut forks = Vec::with_capacity(n);
for i in 0..n {
let mut t = self.clone();
t.append_field_element(&(i as u64).into());
forks.push(t);
}
forks
}

/// Include the history of the forks into the current transcript.
/// NOT IMPLEMENTED.
pub fn merge(&mut self, forks: Vec<Self>) {
for fork in forks {
self.append_field_element_ext(&fork.read_field_element_ext());
}
}

// Append the message to the transcript.
pub fn append_message(&mut self, msg: &[u8]) {
let msg_f = E::BaseField::bytes_to_field_elements(msg);
Expand Down

0 comments on commit 0f50995

Please sign in to comment.