forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* enable secp256r1 in antehandlers * Add sig verification benchamrk to find a sigverify fee * adjust the gas fee * enable secp256r1 in antehandlers * Add sig verification benchamrk to find a sigverify fee * adjust the gas fee * Update the secp256r1 fee factor * Update changelog * regenerate docs
- Loading branch information
1 parent
72fb8b3
commit a18f0b1
Showing
8 changed files
with
92 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package ante_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
tmcrypto "github.com/tendermint/tendermint/crypto" | ||
|
||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" | ||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256r1" | ||
) | ||
|
||
// This benchmark is used to asses the ante.Secp256k1ToR1GasFactor value | ||
func BenchmarkSig(b *testing.B) { | ||
require := require.New(b) | ||
msg := tmcrypto.CRandBytes(1000) | ||
|
||
skK := secp256k1.GenPrivKey() | ||
pkK := skK.PubKey() | ||
skR, _ := secp256r1.GenPrivKey() | ||
pkR := skR.PubKey() | ||
|
||
sigK, err := skK.Sign(msg) | ||
require.NoError(err) | ||
sigR, err := skR.Sign(msg) | ||
require.NoError(err) | ||
b.ResetTimer() | ||
|
||
b.Run("secp256k1", func(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
ok := pkK.VerifySignature(msg, sigK) | ||
require.True(ok) | ||
} | ||
}) | ||
|
||
b.Run("secp256r1", func(b *testing.B) { | ||
for i := 0; i < b.N; i++ { | ||
ok := pkR.VerifySignature(msg, sigR) | ||
require.True(ok) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters