Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions hyperplonk/src/snark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,13 @@ where
));
}

// check product check subclaim
if prod_evals[3] != perm_check_sub_claim.product_check_sub_claim.final_query.1 {
return Err(HyperPlonkErrors::InvalidVerifier(
"product of product check is not one".to_string(),
));
}

end_timer!(step);
// =======================================================================
// 3. Verify the opening against the commitment
Expand Down Expand Up @@ -734,17 +741,27 @@ mod tests {
>>::verify(&bad_vk, &pi.0, &proof,)?);

// bad path 2: wrong witness
let mut w1_bad = w1;
let mut w1_bad = w1.clone();
w1_bad.0[0] = E::ScalarField::one();
assert!(
<PolyIOP<E::ScalarField> as HyperPlonkSNARK<E, MultilinearKzgPCS<E>>>::prove(
&pk,
&pi.0,
&[w1_bad, w2],
&[w1_bad, w2.clone()],
)
.is_err()
);

// bad path 3: permutation and witness mismatch
let permutation = random_permutation(nv, num_witnesses, &mut rng);
assert!(
<PolyIOP<E::ScalarField> as HyperPlonkSNARK<E, MultilinearKzgPCS<E>>>::prove(
&pk,
&permutation,
&[w1, w2],
).is_err()
);

Ok(())
}
}
7 changes: 7 additions & 0 deletions subroutines/src/poly_iop/perm_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{
poly_iop::{errors::PolyIOPErrors, prelude::ProductCheck, PolyIOP},
};
use ark_ec::pairing::Pairing;
use ark_ff::One;
use ark_poly::DenseMultilinearExtension;
use ark_std::{end_timer, start_timer};
use std::sync::Arc;
Expand Down Expand Up @@ -161,6 +162,12 @@ where
transcript,
)?;

if prod_poly.evaluations[(1 << num_vars) - 2] != E::ScalarField::one() {
return Err(PolyIOPErrors::InvalidProof(
"Product should be one".to_string(),
));
}

end_timer!(start);
Ok((proof, prod_poly, frac_poly))
}
Expand Down