types: remove pubkey options (#5016)

## Description

This PR removes options in picking different pubkey types. We don't support anything other than ed25519 so this was redundant.
We only ever supported ed25519 keys so not sure why we exposed different options.

Not sure if this needs a changelog entry ?


Closes: #XXX
This commit is contained in:
Marko
2020-06-17 09:35:00 +00:00
committed by GitHub
parent 8149bf517f
commit 95d2d136cd
2 changed files with 13 additions and 17 deletions
+3 -4
View File
@@ -13,8 +13,7 @@ import (
) )
var ( var (
valEd25519 = []string{ABCIPubKeyTypeEd25519} valEd25519 = []string{ABCIPubKeyTypeEd25519}
valSecp256k1 = []string{ABCIPubKeyTypeSecp256k1}
) )
func TestConsensusParamsValidation(t *testing.T) { func TestConsensusParamsValidation(t *testing.T) {
@@ -129,10 +128,10 @@ func TestConsensusParamsUpdate(t *testing.T) {
MaxNum: 50, MaxNum: 50,
}, },
Validator: &tmproto.ValidatorParams{ Validator: &tmproto.ValidatorParams{
PubKeyTypes: valSecp256k1, PubKeyTypes: valEd25519,
}, },
}, },
makeParams(100, 200, 10, 300, 50, valSecp256k1), makeParams(100, 200, 10, 300, 50, valEd25519),
}, },
} }
for _, tc := range testCases { for _, tc := range testCases {
+10 -13
View File
@@ -9,8 +9,6 @@ import (
"github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/ed25519"
cryptoenc "github.com/tendermint/tendermint/crypto/encoding" cryptoenc "github.com/tendermint/tendermint/crypto/encoding"
"github.com/tendermint/tendermint/crypto/secp256k1"
"github.com/tendermint/tendermint/crypto/sr25519"
tmproto "github.com/tendermint/tendermint/proto/types" tmproto "github.com/tendermint/tendermint/proto/types"
) )
@@ -18,22 +16,21 @@ import (
// Use strings to distinguish types in ABCI messages // Use strings to distinguish types in ABCI messages
const ( const (
ABCIEvidenceTypeDuplicateVote = "duplicate/vote" ABCIEvidenceTypeDuplicateVote = "duplicate/vote"
ABCIEvidenceTypeMock = "mock/evidence" ABCIEvidenceTypePhantom = "phantom"
ABCIEvidenceTypeLunatic = "lunatic"
ABCIEvidenceTypePotentialAmnesia = "potential_amnesia"
ABCIEvidenceTypeMock = "mock/evidence"
) )
const ( const (
ABCIPubKeyTypeEd25519 = "ed25519" ABCIPubKeyTypeEd25519 = "ed25519"
ABCIPubKeyTypeSr25519 = "sr25519"
ABCIPubKeyTypeSecp256k1 = "secp256k1"
) )
// TODO: Make non-global by allowing for registration of more pubkey types // TODO: Make non-global by allowing for registration of more pubkey types
var ABCIPubKeyTypesToNames = map[string]string{ var ABCIPubKeyTypesToNames = map[string]string{
ABCIPubKeyTypeEd25519: ed25519.PubKeyName, ABCIPubKeyTypeEd25519: ed25519.PubKeyName,
ABCIPubKeyTypeSr25519: sr25519.PubKeyName,
ABCIPubKeyTypeSecp256k1: secp256k1.PubKeyName,
} }
//------------------------------------------------------- //-------------------------------------------------------
@@ -137,11 +134,11 @@ func (tm2pb) Evidence(ev Evidence, valSet *ValidatorSet, evTime time.Time) abci.
case *DuplicateVoteEvidence: case *DuplicateVoteEvidence:
evType = ABCIEvidenceTypeDuplicateVote evType = ABCIEvidenceTypeDuplicateVote
case *PhantomValidatorEvidence: case *PhantomValidatorEvidence:
evType = "phantom" evType = ABCIEvidenceTypePhantom
case *LunaticValidatorEvidence: case *LunaticValidatorEvidence:
evType = "lunatic" evType = ABCIEvidenceTypeLunatic
case *PotentialAmnesiaEvidence: case *PotentialAmnesiaEvidence:
evType = "potential_amnesia" evType = ABCIEvidenceTypePotentialAmnesia
case MockEvidence: case MockEvidence:
// XXX: not great to have test types in production paths ... // XXX: not great to have test types in production paths ...
evType = ABCIEvidenceTypeMock evType = ABCIEvidenceTypeMock