Skip to content

Commit

Permalink
Sumcheck update (microsoft#163)
Browse files Browse the repository at this point in the history
* Include number of instances in transcript

* Clarify Sumcheck and verifier

* Fix clippy
  • Loading branch information
adr1anh authored Dec 8, 2023
1 parent 8fc422e commit b13f457
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 142 deletions.
9 changes: 9 additions & 0 deletions src/spartan/batched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ where
let mut transcript = E::TE::new(b"BatchedRelaxedR1CSSNARK");

transcript.absorb(b"vk", &pk.vk_digest);
if num_instances > 1 {
let num_instances_field = E::Scalar::from(num_instances as u64);
transcript.absorb(b"n", &num_instances_field);
}
U.iter().for_each(|u| {
transcript.absorb(b"U", u);
});
Expand Down Expand Up @@ -385,9 +389,14 @@ where
}

fn verify(&self, vk: &Self::VerifierKey, U: &[RelaxedR1CSInstance<E>]) -> Result<(), NovaError> {
let num_instances = U.len();
let mut transcript = E::TE::new(b"BatchedRelaxedR1CSSNARK");

transcript.absorb(b"vk", &vk.digest());
if num_instances > 1 {
let num_instances_field = E::Scalar::from(num_instances as u64);
transcript.absorb(b"n", &num_instances_field);
}
U.iter().for_each(|u| {
transcript.absorb(b"U", u);
});
Expand Down
Loading

0 comments on commit b13f457

Please sign in to comment.