Skip to content

Commit a5bcb1c

Browse files
committed
fix evaluation reversal bug
1 parent be0afd4 commit a5bcb1c

File tree

2 files changed

+22
-24
lines changed

2 files changed

+22
-24
lines changed

src/lib.rs

+12-22
Original file line numberDiff line numberDiff line change
@@ -1327,23 +1327,18 @@ mod tests {
13271327
S<bn256::Point, ZM<halo2curves::bn256::Bn256>>,
13281328
S<grumpkin::Point, EE<_>>,
13291329
>();
1330-
test_ivc_nontrivial_with_compression_with::<
1331-
secp256k1::Point,
1332-
secq256k1::Point,
1333-
S<secp256k1::Point, EE<_>>,
1334-
S<secq256k1::Point, EE<_>>,
1335-
>();
1336-
}
1337-
1338-
#[test]
1339-
#[ignore]
1340-
fn test_ivc_nontrivial_with_zm_compression() {
13411330
test_ivc_nontrivial_with_compression_with::<
13421331
bn256::Point,
13431332
grumpkin::Point,
13441333
S<bn256::Point, ZM<halo2curves::bn256::Bn256>>,
13451334
S<grumpkin::Point, EE<_>>,
13461335
>();
1336+
test_ivc_nontrivial_with_compression_with::<
1337+
secp256k1::Point,
1338+
secq256k1::Point,
1339+
S<secp256k1::Point, EE<_>>,
1340+
S<secq256k1::Point, EE<_>>,
1341+
>();
13471342
}
13481343

13491344
fn test_ivc_nontrivial_with_spark_compression_with<G1, G2, E1, E2>()
@@ -1450,23 +1445,18 @@ mod tests {
14501445
type G2 = pasta_curves::vesta::Point;
14511446

14521447
test_ivc_nontrivial_with_spark_compression_with::<G1, G2, EE<_>, EE<_>>();
1453-
test_ivc_nontrivial_with_spark_compression_with::<
1454-
secp256k1::Point,
1455-
secq256k1::Point,
1456-
EE<_>,
1457-
EE<_>,
1458-
>();
1459-
}
1460-
1461-
#[test]
1462-
#[ignore]
1463-
fn test_ivc_nontrivial_with_spark_zm_compression() {
14641448
test_ivc_nontrivial_with_spark_compression_with::<
14651449
bn256::Point,
14661450
grumpkin::Point,
14671451
ZM<halo2curves::bn256::Bn256>,
14681452
EE<_>,
14691453
>();
1454+
test_ivc_nontrivial_with_spark_compression_with::<
1455+
secp256k1::Point,
1456+
secq256k1::Point,
1457+
EE<_>,
1458+
EE<_>,
1459+
>();
14701460
}
14711461

14721462
fn test_ivc_nondet_with_compression_with<G1, G2, E1, E2>()

src/provider/non_hiding_zeromorph.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,12 @@ where
436436
let commitment = ZMCommitment::from(UVKZGCommitment::from(*comm));
437437
// TODO: the following two lines will need to change base
438438
let polynomial = MultilinearPolynomial::new(poly.to_vec());
439+
440+
// Nova evaluates in lower endian, the implementation assumes big endian
441+
let rev_point = point.iter().rev().cloned().collect::<Vec<_>>();
442+
439443
let evaluation = ZMEvaluation(*eval);
440-
ZMPCS::open(pk, &commitment, &polynomial, point, &evaluation, transcript)
444+
ZMPCS::open(pk, &commitment, &polynomial, &rev_point, &evaluation, transcript)
441445
}
442446

443447
fn verify(
@@ -450,8 +454,12 @@ where
450454
) -> Result<(), NovaError> {
451455
let commitment = ZMCommitment::from(UVKZGCommitment::from(*comm));
452456
let evaluation = ZMEvaluation(*eval);
457+
458+
// Nova evaluates in lower endian, the implementation assumes big endian
459+
let rev_point = point.iter().rev().cloned().collect::<Vec<_>>();
460+
453461
// TODO: this clone is unsightly!
454-
ZMPCS::verify(vk, transcript, &commitment, point, &evaluation, arg.clone())?;
462+
ZMPCS::verify(vk, transcript, &commitment, &rev_point, &evaluation, arg.clone())?;
455463
Ok(())
456464
}
457465
}

0 commit comments

Comments
 (0)