diff --git a/evm_arithmetization/src/curve_pairings.rs b/evm_arithmetization/src/curve_pairings.rs index f52d024d8..8152bdd05 100644 --- a/evm_arithmetization/src/curve_pairings.rs +++ b/evm_arithmetization/src/curve_pairings.rs @@ -1007,18 +1007,15 @@ mod tests { } // Finally, multiply by the accumulated inverse and check this matches the - // expected value. - let p = CurveAff::::int(acc); - let q = CurveAff::>::GENERATOR; - running_product = running_product * bls381::ate_optim(p, q); - - let expected = if acc == 0 { - Fp12::::ZERO - } else { - Fp12::::UNIT - }; + // expected value. Only do this when acc is nonzero, as the pairing is only + // defined over valid curve points. + if acc != 0 { + let p = CurveAff::::int(acc); + let q = CurveAff::>::GENERATOR; + running_product = running_product * bls381::ate_optim(p, q); + } - assert_eq!(running_product, expected); + assert_eq!(running_product, Fp12::::UNIT); } #[test] @@ -1040,17 +1037,14 @@ mod tests { } // Finally, multiply by the accumulated inverse and check this matches the - // expected value. - let p = CurveAff::::int(acc); - let q = CurveAff::>::GENERATOR; - running_product = running_product * bn254::tate(p, q); - - let expected = if acc == 0 { - Fp12::::ZERO - } else { - Fp12::::UNIT - }; + // expected value. Only do this when acc is nonzero, as the pairing is only + // defined over valid curve points. + if acc != 0 { + let p = CurveAff::::int(acc); + let q = CurveAff::>::GENERATOR; + running_product = running_product * bn254::tate(p, q); + } - assert_eq!(running_product, expected); + assert_eq!(running_product, Fp12::::UNIT); } }