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 11:35:00 +02:00
committed by GitHub
parent 8149bf517f
commit 95d2d136cd
2 changed files with 13 additions and 17 deletions

View File

@@ -13,8 +13,7 @@ import (
)
var (
valEd25519 = []string{ABCIPubKeyTypeEd25519}
valSecp256k1 = []string{ABCIPubKeyTypeSecp256k1}
valEd25519 = []string{ABCIPubKeyTypeEd25519}
)
func TestConsensusParamsValidation(t *testing.T) {
@@ -129,10 +128,10 @@ func TestConsensusParamsUpdate(t *testing.T) {
MaxNum: 50,
},
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 {

View File

@@ -9,8 +9,6 @@ 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"
"github.com/tendermint/tendermint/crypto/sr25519"
tmproto "github.com/tendermint/tendermint/proto/types"
)
@@ -18,22 +16,21 @@ import (
// Use strings to distinguish types in ABCI messages
const (
ABCIEvidenceTypeDuplicateVote = "duplicate/vote"
ABCIEvidenceTypeMock = "mock/evidence"
ABCIEvidenceTypeDuplicateVote = "duplicate/vote"
ABCIEvidenceTypePhantom = "phantom"
ABCIEvidenceTypeLunatic = "lunatic"
ABCIEvidenceTypePotentialAmnesia = "potential_amnesia"
ABCIEvidenceTypeMock = "mock/evidence"
)
const (
ABCIPubKeyTypeEd25519 = "ed25519"
ABCIPubKeyTypeSr25519 = "sr25519"
ABCIPubKeyTypeSecp256k1 = "secp256k1"
ABCIPubKeyTypeEd25519 = "ed25519"
)
// TODO: Make non-global by allowing for registration of more pubkey types
var ABCIPubKeyTypesToNames = map[string]string{
ABCIPubKeyTypeEd25519: ed25519.PubKeyName,
ABCIPubKeyTypeSr25519: sr25519.PubKeyName,
ABCIPubKeyTypeSecp256k1: secp256k1.PubKeyName,
ABCIPubKeyTypeEd25519: ed25519.PubKeyName,
}
//-------------------------------------------------------
@@ -137,11 +134,11 @@ func (tm2pb) Evidence(ev Evidence, valSet *ValidatorSet, evTime time.Time) abci.
case *DuplicateVoteEvidence:
evType = ABCIEvidenceTypeDuplicateVote
case *PhantomValidatorEvidence:
evType = "phantom"
evType = ABCIEvidenceTypePhantom
case *LunaticValidatorEvidence:
evType = "lunatic"
evType = ABCIEvidenceTypeLunatic
case *PotentialAmnesiaEvidence:
evType = "potential_amnesia"
evType = ABCIEvidenceTypePotentialAmnesia
case MockEvidence:
// XXX: not great to have test types in production paths ...
evType = ABCIEvidenceTypeMock