mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 05:46:32 +00:00
crypto: add in secp256k1 support (#5500)
Secp256k1 was removed in the protobuf migration, this pr adds it back in order to provide this functionality for users (band) Closes: #5495
This commit is contained in:
@@ -13,7 +13,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
valEd25519 = []string{ABCIPubKeyTypeEd25519}
|
||||
valEd25519 = []string{ABCIPubKeyTypeEd25519}
|
||||
valSecp256k1 = []string{ABCIPubKeyTypeSecp256k1}
|
||||
)
|
||||
|
||||
func TestConsensusParamsValidation(t *testing.T) {
|
||||
@@ -127,10 +128,10 @@ func TestConsensusParamsUpdate(t *testing.T) {
|
||||
MaxBytes: 50,
|
||||
},
|
||||
Validator: &tmproto.ValidatorParams{
|
||||
PubKeyTypes: valEd25519,
|
||||
PubKeyTypes: valSecp256k1,
|
||||
},
|
||||
},
|
||||
makeParams(100, 200, 10, 300, 50, valEd25519),
|
||||
makeParams(100, 200, 10, 300, 50, valSecp256k1),
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
cryptoenc "github.com/tendermint/tendermint/crypto/encoding"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
)
|
||||
|
||||
@@ -15,13 +16,15 @@ import (
|
||||
// Use strings to distinguish types in ABCI messages
|
||||
|
||||
const (
|
||||
ABCIPubKeyTypeEd25519 = "ed25519"
|
||||
ABCIPubKeyTypeEd25519 = ed25519.KeyType
|
||||
ABCIPubKeyTypeSecp256k1 = secp256k1.KeyType
|
||||
)
|
||||
|
||||
// TODO: Make non-global by allowing for registration of more pubkey types
|
||||
|
||||
var ABCIPubKeyTypesToNames = map[string]string{
|
||||
ABCIPubKeyTypeEd25519: ed25519.PubKeyName,
|
||||
ABCIPubKeyTypeEd25519: ed25519.PubKeyName,
|
||||
ABCIPubKeyTypeSecp256k1: secp256k1.PubKeyName,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user