Skip to content

Commit 373b258

Browse files
authored
Revert "tests/fuzzers/bn256: add PairingCheck fuzzer (ethereum#27252)"
This reverts commit 625cbea.
1 parent ec75d01 commit 373b258

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

tests/fuzzers/bn256/bn256_fuzz.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -156,29 +156,12 @@ func FuzzPair(data []byte) int {
156156
if !bytes.Equal(clPair, gPair) {
157157
panic("pairing mismatch: cloudflare/google")
158158
}
159+
159160
cPair, err := bn254.Pair([]bn254.G1Affine{*ps}, []bn254.G2Affine{*ts})
160161
if err != nil {
161162
panic(fmt.Sprintf("gnark/bn254 encountered error: %v", err))
162163
}
163-
164-
// gnark uses a different pairing algorithm which might produce
165-
// different but also correct outputs, we need to scale the output by s
166-
167-
u, _ := new(big.Int).SetString("0x44e992b44a6909f1", 0)
168-
u_exp2 := new(big.Int).Exp(u, big.NewInt(2), nil) // u^2
169-
u_6_exp2 := new(big.Int).Mul(big.NewInt(6), u_exp2) // 6*u^2
170-
u_3 := new(big.Int).Mul(big.NewInt(3), u) // 3*u
171-
inner := u_6_exp2.Add(u_6_exp2, u_3) // 6*u^2 + 3*u
172-
inner.Add(inner, big.NewInt(1)) // 6*u^2 + 3*u + 1
173-
u_2 := new(big.Int).Mul(big.NewInt(2), u) // 2*u
174-
s := u_2.Mul(u_2, inner) // 2*u(6*u^2 + 3*u + 1)
175-
176-
gRes := new(bn254.GT)
177-
if err := gRes.SetBytes(clPair); err != nil {
178-
panic(err)
179-
}
180-
gRes = gRes.Exp(*gRes, s)
181-
if !bytes.Equal(cPair.Marshal(), gRes.Marshal()) {
164+
if !bytes.Equal(clPair, cPair.Marshal()) {
182165
panic("pairing mismatch: cloudflare/gnark")
183166
}
184167

0 commit comments

Comments
 (0)