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

Updates on subgroup check #1952

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions eth/_utils/bn128.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def validate_point(x: int, y: int) -> Tuple[bn128.FQ, bn128.FQ, bn128.FQ]:
p1 = (FQ(x), FQ(y), FQ(1))
if not bn128.is_on_curve(p1, bn128.b):
raise ValidationError("Point is not on the curve")
if bn128.multiply(p1, bn128.curve_order)[-1] != FQ.zero():
raise ValidationError("Point is not in correct subgroup")
else:
p1 = (FQ(1), FQ(1), FQ(0))

Expand Down
2 changes: 1 addition & 1 deletion eth/precompiles/ecpairing.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _process_point(data_buffer: bytes, exponent: int) -> bn128.FQP:
raise ValidationError("point is not on curve")

if bn128.multiply(p2, bn128.curve_order)[-1] != bn128.FQ2.zero():
raise ValidationError("TODO: what case is this?????")
raise ValidationError("Point is not in correct subgroup")

return exponent * bn128.pairing(FQP_point_to_FQ2_point(p2), p1, final_exponentiate=False)

Expand Down