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

fix: add G2 membership check for constant points #1397

Merged
merged 1 commit into from
Jan 21, 2025
Merged
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
9 changes: 9 additions & 0 deletions std/algebra/emulated/sw_bn254/g2.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ func NewG2Affine(v bn254.G2Affine) G2Affine {
// NewG2AffineFixed returns witness of v with precomputations for efficient
// pairing computation.
func NewG2AffineFixed(v bn254.G2Affine) G2Affine {
if !v.IsInSubGroup() {
// for the pairing check we check that G2 point is already in the
// subgroup when we compute the lines in circuit. However, when the
// point is given as a constant, then we already precompute the lines at
// circuit compile time without explicitly checking the G2 membership.
// So, we need to check that the point is in the subgroup before we
// compute the lines.
panic("given point is not in the G2 subgroup")
}
lines := precomputeLines(v)
return G2Affine{
P: newG2AffP(v),
Expand Down
Loading