py_ecc icon indicating copy to clipboard operation
py_ecc copied to clipboard

Pairings can't be added

Open FilipLaurentiu opened this issue 2 years ago • 0 comments

What happened?

The library can't be used to add pairings result together. This can be helpful for off-chain testing

Code that produced the error

from py_ecc.bn128 import G1, G2, multiply, pairing, add

p1 = pairing(G2, multiply(G1, 4))
p2 = pairing(multiply(G2, 4), G1)
p3 = pairing(G2, multiply(G1, 8))


assert p1 == p2, "Fail 1"
assert add(p1, p2) == p3, "Fail 2"

Full error output

python3.9/site-packages/py_ecc/bn128/bn128_curve.py", line 87, in add
    x1, y1 = p1
TypeError: cannot unpack non-iterable bn128_FQ12 object

Fill this section in if you know how this could or should be fixed

No response

py-ecc Version

6.0.0

Python Version

3.9

Operating System

linux

Output from pip freeze

No response

FilipLaurentiu avatar Dec 08 '23 15:12 FilipLaurentiu