From faff980d97ea73e8b51d388d4d92cdb86481c179 Mon Sep 17 00:00:00 2001 From: jwasinger Date: Tue, 10 Jan 2023 00:16:17 -0800 Subject: [PATCH] crypto/bls12381: use worst case scalar for input to G1/G2 mul benchmarks (#26447) * test * crypto/bls12381: use worst case scalar for input to G1/G2 mul benchmarks --- crypto/bls12381/g1_test.go | 3 ++- crypto/bls12381/g2_test.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crypto/bls12381/g1_test.go b/crypto/bls12381/g1_test.go index eef9f4505..87140459f 100644 --- a/crypto/bls12381/g1_test.go +++ b/crypto/bls12381/g1_test.go @@ -262,8 +262,9 @@ func BenchmarkG1Add(t *testing.B) { } func BenchmarkG1Mul(t *testing.B) { + worstCaseScalar, _ := new(big.Int).SetString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16) g1 := NewG1() - a, e, c := g1.rand(), q, PointG1{} + a, e, c := g1.rand(), worstCaseScalar, PointG1{} t.ResetTimer() for i := 0; i < t.N; i++ { g1.MulScalar(&c, a, e) diff --git a/crypto/bls12381/g2_test.go b/crypto/bls12381/g2_test.go index f16f0e5ee..4d1f3a19a 100644 --- a/crypto/bls12381/g2_test.go +++ b/crypto/bls12381/g2_test.go @@ -265,8 +265,9 @@ func BenchmarkG2Add(t *testing.B) { } func BenchmarkG2Mul(t *testing.B) { + worstCaseScalar, _ := new(big.Int).SetString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16) g2 := NewG2() - a, e, c := g2.rand(), q, PointG2{} + a, e, c := g2.rand(), worstCaseScalar, PointG2{} t.ResetTimer() for i := 0; i < t.N; i++ { g2.MulScalar(&c, a, e)