From 95d2d136cdcff2a3bb29d4e4271d757e4f88867c Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 17 Jun 2020 11:35:00 +0200 Subject: [PATCH] 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 --- types/params_test.go | 7 +++---- types/protobuf.go | 23 ++++++++++------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/types/params_test.go b/types/params_test.go index 943ca8d55..c5291ef73 100644 --- a/types/params_test.go +++ b/types/params_test.go @@ -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 { diff --git a/types/protobuf.go b/types/protobuf.go index 70876c7d8..d48af0de9 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -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