Skip to content

Commit 9f5ddd4

Browse files
authored
fix: add G1 membership for ML and FE in bls precompile (#1591)
1 parent 6e2fc62 commit 9f5ddd4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

std/evmprecompiles/15-blspairing.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ func ECPairBLSMillerLoopAndMul(api frontend.API, accumulator *sw_bls12381.GTEl,
9494
if err != nil {
9595
return fmt.Errorf("new pairing: %w", err)
9696
}
97+
// Miller loop below already checks that Q is in G2, but doesn't check that
98+
// P is. So we do it manually.
99+
pairing.AssertIsOnG1(P)
97100
ml, err := pairing.MillerLoopAndMul(P, Q, accumulator)
98101
if err != nil {
99102
return fmt.Errorf("miller loop and mul: %w", err)
@@ -111,7 +114,9 @@ func ECPairBLSMillerLoopAndFinalExpCheck(api frontend.API, accumulator *sw_bls12
111114
if err != nil {
112115
return fmt.Errorf("new pairing: %w", err)
113116
}
114-
117+
// Miller loop below already checks that Q is in G2, but doesn't check that
118+
// P is. So we do it manually.
119+
pairing.AssertIsOnG1(P)
115120
isSuccess := pairing.IsMillerLoopAndFinalExpOne(P, Q, accumulator)
116121
api.AssertIsEqual(expectedIsSuccess, isSuccess)
117122
return nil

0 commit comments

Comments
 (0)