From d5fa0a73b8e89edeef5d9022547644d16b257e9c Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 28 Jun 2022 10:38:03 -0400 Subject: [PATCH] fix: remove dependency on tendermint internal library (#12368) (#12378) --- store/types/store.go | 8 ++++++-- x/staking/keeper/msg_server.go | 11 +++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/store/types/store.go b/store/types/store.go index bb628dd2692..37f58390090 100644 --- a/store/types/store.go +++ b/store/types/store.go @@ -5,7 +5,6 @@ import ( "io" abci "github.com/tendermint/tendermint/abci/types" - tmstrings "github.com/tendermint/tendermint/libs/strings" dbm "github.com/tendermint/tm-db" pruningtypes "github.com/cosmos/cosmos-sdk/pruning/types" @@ -64,7 +63,12 @@ func (s *StoreUpgrades) IsAdded(key string) bool { if s == nil { return false } - return tmstrings.StringInSlice(key, s.Added) + for _, added := range s.Added { + if key == added { + return true + } + } + return false } // IsDeleted returns true if the given key should be deleted diff --git a/x/staking/keeper/msg_server.go b/x/staking/keeper/msg_server.go index 3e4ad4417d1..cf74b61ea02 100644 --- a/x/staking/keeper/msg_server.go +++ b/x/staking/keeper/msg_server.go @@ -9,7 +9,6 @@ import ( "google.golang.org/grpc/status" "github.com/armon/go-metrics" - tmstrings "github.com/tendermint/tendermint/libs/strings" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/telemetry" @@ -70,7 +69,15 @@ func (k msgServer) CreateValidator(goCtx context.Context, msg *types.MsgCreateVa cp := ctx.ConsensusParams() if cp != nil && cp.Validator != nil { - if !tmstrings.StringInSlice(pk.Type(), cp.Validator.PubKeyTypes) { + pkType := pk.Type() + hasKeyType := false + for _, keyType := range cp.Validator.PubKeyTypes { + if pkType == keyType { + hasKeyType = true + break + } + } + if !hasKeyType { return nil, sdkerrors.Wrapf( types.ErrValidatorPubKeyTypeNotSupported, "got: %s, expected: %s", pk.Type(), cp.Validator.PubKeyTypes,