Skip to content

Commit

Permalink
fix: Uniformize instance order in fn calls
Browse files Browse the repository at this point in the history
  • Loading branch information
CPerezz committed Oct 2, 2024
1 parent 405137d commit be89d2a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions folding-schemes/src/folding/ova/nifs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ where
U_i: &CommittedInstance<C>,
) -> Result<(Witness<C>, CommittedInstance<C>), Error> {
// fold witness
let w3 = NIFS::<C, CS, H>::fold_witness(r, W_i, w_i)?;
let w3 = NIFS::<C, CS, H>::fold_witness(r, w_i, W_i)?;

// fold committed instances
let ci3 = NIFS::<C, CS, H>::fold_committed_instance(r, U_i, u_i);
let ci3 = NIFS::<C, CS, H>::fold_committed_instance(r, u_i, U_i);

Ok((w3, ci3))
}
Expand Down Expand Up @@ -178,7 +178,7 @@ where
// folded instance
folded_instance: &CommittedInstance<C>,
) -> Result<(), Error> {
let expected = Self::fold_committed_instance(r, U_i, u_i);
let expected = Self::fold_committed_instance(r, u_i, U_i);
if folded_instance.mu != expected.mu
|| folded_instance.cmWE != expected.cmWE
|| folded_instance.x != expected.x
Expand Down Expand Up @@ -307,9 +307,11 @@ pub mod tests {
);
let alpha_Fr = C::ScalarField::from_bigint(BigInteger::from_bits_le(&alpha_bits)).unwrap();

// Wrong order.
let (w_fold, u_fold) =
NIFS::<C, Pedersen<C>>::fold_instances(alpha_Fr, &w, &u, &W, &U).unwrap();
NIFS::<C, Pedersen<C>, false>::fold_instances(alpha_Fr, &w, &u, &W, &U).unwrap();

// Check correctness of the R1CS relation of the folded instance.
compute_E_check_relation::<C, Pedersen<C>, false>(&r1cs, &w_fold, &u_fold);

(
pedersen_params,
Expand Down

0 comments on commit be89d2a

Please sign in to comment.