lurk-lab / bls12_381

Implementation of the BLS12-381 pairing-friendly elliptic curve group
Other
0 stars 0 forks source link

fix: Properly handle P = -Q in add_affine #9

Closed wwared closed 1 month ago

wwared commented 2 months ago

This PR fixes the issue mentioned in https://github.com/lurk-lab/bls12_381/pull/8/files#r1587195797

I forgot the full conditions for the G1 add circuit to not divide by zero, which are P != Q and P != -Q. Since -Q is Q with its y coordinate flipped, this is still thankfully easy and cheap to check