fix: remove dependency on tendermint internal library (#12368)
## Description This is an oft added function for many projects that's probably more clear to implement as needed, but is probably mostly just a gap in the standard library. This function is removed in more recent versions of tendermint (as tendermint no longer uses it.) --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
parent
9d280ac936
commit
cc83d7474b
@ -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
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user