Skip to content

Commit 179294a

Browse files
bug: Added test for FROBENIUS_COEFF_FQ6_C1 and fixed incorrect constant (#1471)
Added a test for the `FROBENIUS_COEFF_FQ6_C1` constant in the pairing extension. The test checks that the values are the same as those in `halo2curves_shims` I found that `FREBENIUS_COEFF_FQ6_C1[0]` did not pass the test. This value is not currently being used in the code, but for completeness, I updated it to be correct.
1 parent 9c9638b commit 179294a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

extensions/pairing/guest/src/bn254/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl Bn254 {
140140
pub const FROBENIUS_COEFF_FQ6_C1: [Fp2; 3] = [
141141
Fp2 {
142142
c0: Bn254Fp(hex!(
143-
"9d0d8fc58d435dd33d0bc7f528eb780a2c4679786fa36e662fdf079ac1770a0e"
143+
"0100000000000000000000000000000000000000000000000000000000000000"
144144
)),
145145
c1: Bn254Fp(hex!(
146146
"0000000000000000000000000000000000000000000000000000000000000000"

extensions/pairing/guest/src/bn254/tests.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use group::{ff::Field, prime::PrimeCurveAffine};
22
use halo2curves_axiom::bn256::{
33
Fq, Fq12, Fq2, Fq6, G1Affine, G2Affine, G2Prepared, Gt, FROBENIUS_COEFF_FQ12_C1,
4+
FROBENIUS_COEFF_FQ6_C1,
45
};
56
use num_bigint::BigUint;
67
use num_traits::One;
@@ -288,3 +289,16 @@ fn test_bn254_final_exponent() {
288289
let final_exp = (BN254_MODULUS.pow(12) - BigUint::one()) / BN254_ORDER.clone();
289290
assert_eq!(Bn254::FINAL_EXPONENT.to_vec(), final_exp.to_bytes_be());
290291
}
292+
293+
#[test]
294+
fn test_bn254_frobenius_coeffs_fq6() {
295+
#[allow(clippy::needless_range_loop)]
296+
for i in 0..3 {
297+
assert_eq!(
298+
Bn254::FROBENIUS_COEFF_FQ6_C1[i],
299+
convert_bn254_halo2_fq2_to_fp2(FROBENIUS_COEFF_FQ6_C1[i]),
300+
"FROBENIUS_COEFFS_FQ6_C1[{}] failed",
301+
i,
302+
)
303+
}
304+
}

0 commit comments

Comments
 (0)