diff --git a/src/abstract/weierstrass.ts b/src/abstract/weierstrass.ts index 492e35e..2f8cd24 100644 --- a/src/abstract/weierstrass.ts +++ b/src/abstract/weierstrass.ts @@ -333,9 +333,11 @@ export function weierstrassPoints(opts: CurvePointsType) { // A point on curve is valid if it conforms to equation. assertValidity(): void { - // Zero is valid point too! if (this.is0()) { - if (CURVE.allowInfinityPoint) return; + // (0, 1, 0) aka ZERO is invalid in most contexts. + // In BLS, ZERO can be serialized, so we allow it. + // (0, 0, 0) is wrong representation of ZERO and is always invalid. + if (CURVE.allowInfinityPoint && !Fp.is0(this.py)) return; throw new Error('bad point: ZERO'); } // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`