Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use custom object for infinity point instead of None #95

Open
hwwhww opened this issue May 9, 2020 · 1 comment
Open

Use custom object for infinity point instead of None #95

hwwhww opened this issue May 9, 2020 · 1 comment

Comments

@hwwhww
Copy link
Contributor

hwwhww commented May 9, 2020

What is wrong?

For #89, discussion offline:

If I call mypy --strict --follow-imports=silent --ignore-missing-imports py_ecc (without --no-strict-optional), then 50+ errors about "None" infinity point would show up

If I call the same command with your PR, the errors:

py_ecc/bn128/bn128_curve.py:63: error: 'None' object is not iterable
py_ecc/bn128/bn128_curve.py:75: error: 'None' object is not iterable
py_ecc/bls12_381/bls12_381_curve.py:66: error: 'None' object is not iterable
py_ecc/bls12_381/bls12_381_curve.py:78: error: 'None' object is not iterable

But it's already handled with if is_inf(pt): return pt

None is really tricky in typing, perhaps there should be a special constant object for infinity point?

How can it be fixed

@vbuterin
Copy link
Contributor

I guess if the goal is to ensure all points are of the same "format", then just use (0, 0) in the "basic" code and (0, 0, 0) in the "optimized" code? (or maybe (1, 1, 0) for optimized would be more correct as that essentially sets x = y = 1/0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants