Skip to content

Commit

Permalink
benchmark for bls and ed25519
Browse files Browse the repository at this point in the history
  • Loading branch information
kitty committed Jul 15, 2021
1 parent 8fee622 commit e47c7f8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crypto/keys/bls12381/bls12381_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package bls12381_test

import (
"github.com/cosmos/cosmos-sdk/crypto/keys/bls12381"
bench "github.com/cosmos/cosmos-sdk/crypto/keys/internal/benchmarking"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto"
Expand All @@ -19,4 +20,19 @@ func TestSignAndValidateBls12381(t *testing.T) {
// Test the signature
assert.True(t, pubKey.VerifySignature(msg, sig))

}


func BenchmarkSignBls(b *testing.B) {
privKey := bls12381.GenPrivKey()

bench.BenchmarkSigning(b, privKey)

}


func BenchmarkVerifyBls(b *testing.B) {
privKey := bls12381.GenPrivKey()

bench.BenchmarkVerification(b, privKey)
}
17 changes: 17 additions & 0 deletions crypto/keys/ed25519/ed25519_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ed25519_test
import (
stded25519 "crypto/ed25519"
"encoding/base64"
bench "github.com/cosmos/cosmos-sdk/crypto/keys/internal/benchmarking"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -228,3 +229,19 @@ func TestMarshalAmino_BackwardsCompatibility(t *testing.T) {
})
}
}



func BenchmarkSignEd25519(b *testing.B) {
privKey := ed25519.GenPrivKey()

bench.BenchmarkSigning(b, privKey)

}


func BenchmarkVerifyEd25519(b *testing.B) {
privKey := ed25519.GenPrivKey()

bench.BenchmarkVerification(b, privKey)
}

0 comments on commit e47c7f8

Please sign in to comment.