Skip to content

Commit

Permalink
tests/fuzzers: supply gnark multiexp config, fixes ethereum#26669 (et…
Browse files Browse the repository at this point in the history
…hereum#26670)

This change fixes a fuzzer which broke when we updated the gnark dependency earlier.
  • Loading branch information
holiman authored and shekhirin committed Jun 6, 2023
1 parent cea380d commit b12c434
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/fuzzers/bls12381/bls12381_fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"io"
"math/big"

"github.com/consensys/gnark-crypto/ecc"
gnark "github.com/consensys/gnark-crypto/ecc/bls12-381"
"github.com/consensys/gnark-crypto/ecc/bls12-381/fp"
"github.com/consensys/gnark-crypto/ecc/bls12-381/fr"
Expand Down Expand Up @@ -198,7 +199,7 @@ func FuzzCrossG1MultiExp(data []byte) int {
}
gethScalars = append(gethScalars, s)
var gnarkScalar = &fr.Element{}
gnarkScalar = gnarkScalar.SetBigInt(s).FromMont()
gnarkScalar = gnarkScalar.SetBigInt(s)
gnarkScalars = append(gnarkScalars, *gnarkScalar)

gethPoints = append(gethPoints, new(bls12381.PointG1).Set(kp1))
Expand All @@ -217,7 +218,7 @@ func FuzzCrossG1MultiExp(data []byte) int {

// gnark multi exp
cp := new(gnark.G1Affine)
cp.MultiExp(gnarkPoints, gnarkScalars)
cp.MultiExp(gnarkPoints, gnarkScalars, ecc.MultiExpConfig{})

// compare result
if !(bytes.Equal(cp.Marshal(), g1.ToBytes(&kp))) {
Expand Down

0 comments on commit b12c434

Please sign in to comment.