@@ -257,8 +257,12 @@ func fuzzCrossG1MultiExp(data []byte) int {
257257 cp .MultiExp (gnarkPoints , gnarkScalars , ecc.MultiExpConfig {})
258258
259259 // compare result
260- if ! (bytes .Equal (cp .Marshal (), g1 .ToBytes (& kp ))) {
261- panic ("G1 multi exponentiation mismatch gnark / geth " )
260+ gnarkRes := cp .Marshal ()
261+ gethRes := g1 .ToBytes (& kp )
262+ if ! bytes .Equal (gnarkRes , gethRes ) {
263+ msg := fmt .Sprintf ("G1 multi exponentiation mismatch gnark/geth.\n gnark: %x\n geth: %x\n input: %x\n " ,
264+ gnarkRes , gethRes , data )
265+ panic (msg )
262266 }
263267
264268 return 1
@@ -283,15 +287,18 @@ func getG1Points(input io.Reader) (*bls12381.PointG1, *gnark.G1Affine, *blst.P1A
283287 if err != nil {
284288 panic (fmt .Sprintf ("Could not marshal gnark.G1 -> geth.G1: %v" , err ))
285289 }
286- if ! bytes .Equal (g1 .ToBytes (kp ), cpBytes ) {
287- panic ("bytes(gnark.G1) != bytes(geth.G1)" )
290+
291+ gnarkRes := g1 .ToBytes (kp )
292+ if ! bytes .Equal (gnarkRes , cpBytes ) {
293+ panic (fmt .Sprintf ("bytes(gnark.G1) != bytes(geth.G1)\n gnark.G1: %x\n geth.G1: %x\n " , gnarkRes , cpBytes ))
288294 }
289295
290296 // marshal gnark point -> blst point
291297 scalar := new (blst.Scalar ).FromBEndian (common .LeftPadBytes (s .Bytes (), 32 ))
292298 p1 := new (blst.P1Affine ).From (scalar )
293- if ! bytes .Equal (p1 .Serialize (), cpBytes ) {
294- panic ("bytes(blst.G1) != bytes(geth.G1)" )
299+ blstRes := p1 .Serialize ()
300+ if ! bytes .Equal (blstRes , cpBytes ) {
301+ panic (fmt .Sprintf ("bytes(blst.G1) != bytes(geth.G1)\n blst.G1: %x\n geth.G1: %x\n " , blstRes , cpBytes ))
295302 }
296303
297304 return kp , cp , p1 , nil
@@ -316,8 +323,10 @@ func getG2Points(input io.Reader) (*bls12381.PointG2, *gnark.G2Affine, *blst.P2A
316323 if err != nil {
317324 panic (fmt .Sprintf ("Could not marshal gnark.G2 -> geth.G2: %v" , err ))
318325 }
319- if ! bytes .Equal (g2 .ToBytes (kp ), cpBytes ) {
320- panic ("bytes(gnark.G2) != bytes(geth.G2)" )
326+
327+ gnarkRes := g2 .ToBytes (kp )
328+ if ! bytes .Equal (gnarkRes , cpBytes ) {
329+ panic (fmt .Sprintf ("bytes(gnark.G2) != bytes(geth.G2)\n gnark.G2: %x\n geth.G2: %x\n " , gnarkRes , cpBytes ))
321330 }
322331
323332 // marshal gnark point -> blst point
0 commit comments