Closed DariusParvin closed 3 years ago
This is a giant red flag for this library. The library should handle point multiplication by zero automatically and give you back the point at infinity here (i.e., the identity element of G2).
@jakinyele What selection and vetting process did we use for this library?
@indomitableSwan um, to be clear ... this JavaScript lib is a pure reimplementation of BLS that is integrated into the SmartPy online IDE. So, not something we selected.
I suspect we'd get a different result if we tested against the BLS lib integrated directly into Michelson (from ECC and wrapped in Ocaml by NL). But in any case, @DariusParvin has reported the issue to the SmartPy devs.
Yeah that's right. I just tested a custClose on testnet with a 0 balance and it went through fine. So this issue is limited to SmartPy
Right now, if the customer or merchant has a balance of 0, when @custClose is called, the pairing check will fail at the point where we multiply the merchant's PS pubkey (g2) by the balance (fr):
If
msg[i]
is 0 (as with a 0 balance), then it'll throw an error because the bls library won't let you multiply by a non positive integer.The error comes from here: https://github.com/paulmillr/noble-bls12-381/blob/master/math.js#L833
@indomitableSwan @jakinyele