From 91de9cfeb1b971475d77657d252f081315d1b53a Mon Sep 17 00:00:00 2001 From: RiceChuan Date: Mon, 16 Dec 2024 21:52:11 +0800 Subject: [PATCH 1/2] chore: use errors.New to replace fmt.Errorf with no parameters Signed-off-by: RiceChuan --- ecc/bls12-377/fr/gkr/gkr.go | 9 +++++---- ecc/bn254/fr/gkr/gkr.go | 9 +++++---- ecc/bn254/fr/sumcheck/sumcheck.go | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ecc/bls12-377/fr/gkr/gkr.go b/ecc/bls12-377/fr/gkr/gkr.go index fb3629fc0..c55db62a4 100644 --- a/ecc/bls12-377/fr/gkr/gkr.go +++ b/ecc/bls12-377/fr/gkr/gkr.go @@ -6,6 +6,7 @@ package gkr import ( + "errors" "fmt" "github.com/consensys/gnark-crypto/ecc/bls12-377/fr" "github.com/consensys/gnark-crypto/ecc/bls12-377/fr/polynomial" @@ -136,7 +137,7 @@ func (e *eqTimesGateEvalSumcheckLazyClaims) VerifyFinalEval(r []fr.Element, comb if evaluation.Equal(&purportedValue) { return nil } - return fmt.Errorf("incompatible evaluations") + return errors.New("incompatible evaluations") } type eqTimesGateEvalSumcheckClaims struct { @@ -461,7 +462,7 @@ func setup(c Circuit, assignment WireAssignment, transcriptSettings fiatshamir.S o.nbVars = assignment.NumVars() nbInstances := assignment.NumInstances() if 1< Date: Thu, 19 Dec 2024 13:38:26 +0000 Subject: [PATCH 2/2] chore: go generate --- ecc/bls12-377/fr/sumcheck/sumcheck.go | 4 ++-- ecc/bls12-381/fr/gkr/gkr.go | 9 +++++---- ecc/bls12-381/fr/sumcheck/sumcheck.go | 4 ++-- ecc/bls24-315/fr/gkr/gkr.go | 9 +++++---- ecc/bls24-315/fr/sumcheck/sumcheck.go | 4 ++-- ecc/bls24-317/fr/gkr/gkr.go | 9 +++++---- ecc/bls24-317/fr/sumcheck/sumcheck.go | 4 ++-- ecc/bw6-633/fr/gkr/gkr.go | 9 +++++---- ecc/bw6-633/fr/sumcheck/sumcheck.go | 4 ++-- ecc/bw6-761/fr/gkr/gkr.go | 9 +++++---- ecc/bw6-761/fr/sumcheck/sumcheck.go | 4 ++-- internal/generator/gkr/template/gkr.go.tmpl | 9 +++++---- internal/generator/sumcheck/template/sumcheck.go.tmpl | 4 ++-- .../test_vector_utils/small_rational/gkr/gkr.go | 9 +++++---- .../small_rational/sumcheck/sumcheck.go | 4 ++-- 15 files changed, 51 insertions(+), 44 deletions(-) diff --git a/ecc/bls12-377/fr/sumcheck/sumcheck.go b/ecc/bls12-377/fr/sumcheck/sumcheck.go index 71033d0df..f47584955 100644 --- a/ecc/bls12-377/fr/sumcheck/sumcheck.go +++ b/ecc/bls12-377/fr/sumcheck/sumcheck.go @@ -6,7 +6,7 @@ package sumcheck import ( - "fmt" + "errors" "github.com/consensys/gnark-crypto/ecc/bls12-377/fr" "github.com/consensys/gnark-crypto/ecc/bls12-377/fr/polynomial" fiatshamir "github.com/consensys/gnark-crypto/fiat-shamir" @@ -151,7 +151,7 @@ func Verify(claims LazyClaims, proof Proof, transcriptSettings fiatshamir.Settin for j := 0; j < claims.VarsNum(); j++ { if len(proof.PartialSumPolys[j]) != claims.Degree(j) { - return fmt.Errorf("malformed proof") + return errors.New("malformed proof") } copy(gJ[1:], proof.PartialSumPolys[j]) gJ[0].Sub(&gJR, &proof.PartialSumPolys[j][0]) // Requirement that gⱼ(0) + gⱼ(1) = gⱼ₋₁(r) diff --git a/ecc/bls12-381/fr/gkr/gkr.go b/ecc/bls12-381/fr/gkr/gkr.go index 64398b3e2..bdae61d49 100644 --- a/ecc/bls12-381/fr/gkr/gkr.go +++ b/ecc/bls12-381/fr/gkr/gkr.go @@ -6,6 +6,7 @@ package gkr import ( + "errors" "fmt" "github.com/consensys/gnark-crypto/ecc/bls12-381/fr" "github.com/consensys/gnark-crypto/ecc/bls12-381/fr/polynomial" @@ -136,7 +137,7 @@ func (e *eqTimesGateEvalSumcheckLazyClaims) VerifyFinalEval(r []fr.Element, comb if evaluation.Equal(&purportedValue) { return nil } - return fmt.Errorf("incompatible evaluations") + return errors.New("incompatible evaluations") } type eqTimesGateEvalSumcheckClaims struct { @@ -461,7 +462,7 @@ func setup(c Circuit, assignment WireAssignment, transcriptSettings fiatshamir.S o.nbVars = assignment.NumVars() nbInstances := assignment.NumInstances() if 1<