refactor: remove unused code (#13725)
This commit is contained in:
parent
0eea227d20
commit
97bd2ab792
@ -193,7 +193,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
|
||||
* (deps) Bump IAVL version to [v0.19.4](https://github.com/cosmos/iavl/releases/tag/v0.19.4).
|
||||
|
||||
## Bug Fixes
|
||||
### Bug Fixes
|
||||
|
||||
* (x/auth/tx) [#12474](https://github.com/cosmos/cosmos-sdk/pull/12474) Remove condition in GetTxsEvent that disallowed multiple equal signs, which would break event queries with base64 strings (i.e. query by signature).
|
||||
* (store) [#13530](https://github.com/cosmos/cosmos-sdk/pull/13530) Fix app-hash mismatch if upgrade migration commit is interrupted.
|
||||
@ -202,7 +202,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
|
||||
* [#13656](https://github.com/cosmos/cosmos-sdk/pull/13659) Rename `server.FlagIAVLFastNode` to `server.FlagDisableIAVLFastNode` for clarity.
|
||||
|
||||
## API Breaking Changes
|
||||
### API Breaking Changes
|
||||
|
||||
* (context) [#13063](https://github.com/cosmos/cosmos-sdk/pull/13063) Update `Context#CacheContext` to automatically emit all events on the parent context's `EventManager`.
|
||||
|
||||
|
||||
@ -36,8 +36,6 @@ import (
|
||||
// App can be used to create a hybrid app.go setup where some configuration is
|
||||
// done declaratively with an app config and the rest of it is done the old way.
|
||||
// See simapp/app.go for an example of this setup.
|
||||
//
|
||||
//nolint:unused
|
||||
type App struct {
|
||||
*baseapp.BaseApp
|
||||
|
||||
@ -49,8 +47,6 @@ type App struct {
|
||||
cdc codec.Codec
|
||||
amino *codec.LegacyAmino
|
||||
basicManager module.BasicManager
|
||||
beginBlockers []func(sdk.Context, abci.RequestBeginBlock)
|
||||
endBlockers []func(sdk.Context, abci.RequestEndBlock) []abci.ValidatorUpdate
|
||||
baseAppOptions []BaseAppOption
|
||||
msgServiceRouter *baseapp.MsgServiceRouter
|
||||
appConfig *appv1alpha1.Config
|
||||
|
||||
@ -410,28 +410,3 @@ func getProofFromTree(tree *iavl.MutableTree, key []byte, exists bool) *tmcrypto
|
||||
op := types.NewIavlCommitmentOp(key, commitmentProof)
|
||||
return &tmcrypto.ProofOps{Ops: []tmcrypto.ProofOp{op.ProofOp()}}
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// iavlIterator implements types.Iterator.
|
||||
type iavlIterator struct {
|
||||
dbm.Iterator
|
||||
}
|
||||
|
||||
var _ types.Iterator = (*iavlIterator)(nil)
|
||||
|
||||
// newIAVLIterator will create a new iavlIterator.
|
||||
// CONTRACT: Caller must release the iavlIterator, as each one creates a new
|
||||
// goroutine.
|
||||
//
|
||||
//nolint:deadcode,unused
|
||||
func newIAVLIterator(tree *iavl.ImmutableTree, start, end []byte, ascending bool) *iavlIterator {
|
||||
iterator, err := tree.Iterator(start, end, ascending)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
iter := &iavlIterator{
|
||||
Iterator: iterator,
|
||||
}
|
||||
return iter
|
||||
}
|
||||
|
||||
@ -121,6 +121,7 @@ func TestGetImmutable(t *testing.T) {
|
||||
store := UnsafeNewStore(tree)
|
||||
|
||||
updated, err := tree.Set([]byte("hello"), []byte("adios"))
|
||||
require.NoError(t, err)
|
||||
require.True(t, updated)
|
||||
hash, ver, err := tree.SaveVersion()
|
||||
cID = types.CommitID{Version: ver, Hash: hash}
|
||||
|
||||
@ -73,12 +73,6 @@ func (s *contextTestSuite) TestLogContext() {
|
||||
ctx.Logger().Error("error")
|
||||
}
|
||||
|
||||
type dummy int64 //nolint:unused
|
||||
|
||||
func (d dummy) Clone() interface{} {
|
||||
return d
|
||||
}
|
||||
|
||||
// Testing saving/loading sdk type values to/from the context
|
||||
func (s *contextTestSuite) TestContextWithCustom() {
|
||||
var ctx types.Context
|
||||
|
||||
@ -51,28 +51,6 @@ func (se SendEnabled) Validate() error {
|
||||
return sdk.ValidateDenom(se.Denom)
|
||||
}
|
||||
|
||||
// validateSendEnabledParams is used by the x/params module to validate the params for the bank module.
|
||||
//
|
||||
//nolint:deadcode,unused
|
||||
func validateSendEnabledParams(i interface{}) error {
|
||||
params, ok := i.([]*SendEnabled)
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid parameter type: %T", i)
|
||||
}
|
||||
// ensure each denom is only registered one time.
|
||||
registered := make(map[string]bool)
|
||||
for _, p := range params {
|
||||
if _, exists := registered[p.Denom]; exists {
|
||||
return fmt.Errorf("duplicate send enabled parameter found: '%s'", p.Denom)
|
||||
}
|
||||
if err := validateSendEnabled(*p); err != nil {
|
||||
return err
|
||||
}
|
||||
registered[p.Denom] = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewSendEnabled creates a new SendEnabled object
|
||||
// The denom may be left empty to control the global default setting of send_enabled
|
||||
func NewSendEnabled(denom string, sendEnabled bool) *SendEnabled {
|
||||
@ -87,17 +65,6 @@ func (se SendEnabled) String() string {
|
||||
return fmt.Sprintf("denom: %s\nenabled: %t\n", se.Denom, se.Enabled)
|
||||
}
|
||||
|
||||
// validateSendEnabled is used by the x/params module to validate a single SendEnabled entry.
|
||||
//
|
||||
//nolint:unused
|
||||
func validateSendEnabled(i interface{}) error {
|
||||
param, ok := i.(SendEnabled)
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid parameter type: %T", i)
|
||||
}
|
||||
return param.Validate()
|
||||
}
|
||||
|
||||
// validateIsBool is used by the x/params module to validate that a thing is a bool.
|
||||
func validateIsBool(i interface{}) error {
|
||||
_, ok := i.(bool)
|
||||
|
||||
@ -3,41 +3,12 @@ package types
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func Test_validateSendEnabledParam(t *testing.T) {
|
||||
type args struct {
|
||||
i interface{}
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{"invalid type", args{sdk.NewCoin(sdk.DefaultBondDenom, math.OneInt())}, true},
|
||||
|
||||
{"invalid empty denom send enabled", args{*NewSendEnabled("", true)}, true},
|
||||
{"invalid empty denom send disabled", args{*NewSendEnabled("", false)}, true},
|
||||
|
||||
{"valid denom send enabled", args{*NewSendEnabled(sdk.DefaultBondDenom, true)}, false},
|
||||
{"valid denom send disabled", args{*NewSendEnabled(sdk.DefaultBondDenom, false)}, false},
|
||||
|
||||
{"invalid denom send enabled", args{*NewSendEnabled("0FOO", true)}, true},
|
||||
{"invalid denom send disabled", args{*NewSendEnabled("0FOO", false)}, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
require.Equal(t, tt.wantErr, validateSendEnabled(tt.args.i) != nil)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_sendParamEqual(t *testing.T) {
|
||||
paramsA := NewSendEnabled(sdk.DefaultBondDenom, true)
|
||||
paramsB := NewSendEnabled(sdk.DefaultBondDenom, true)
|
||||
@ -100,47 +71,3 @@ func Test_validateParams(t *testing.T) {
|
||||
assert.NoError(t, NewParams(false).Validate(), "false")
|
||||
assert.Error(t, Params{[]*SendEnabled{{"foocoing", false}}, true}.Validate(), "with SendEnabled entry")
|
||||
}
|
||||
|
||||
func Test_validateSendEnabledParams(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
arg interface{}
|
||||
exp string
|
||||
}{
|
||||
{
|
||||
name: "ok",
|
||||
arg: []*SendEnabled{},
|
||||
exp: "",
|
||||
},
|
||||
{
|
||||
name: "has entry",
|
||||
arg: []*SendEnabled{{"foocoin", false}},
|
||||
exp: "",
|
||||
},
|
||||
{
|
||||
name: "not a slice",
|
||||
arg: &SendEnabled{},
|
||||
exp: "invalid parameter type: *types.SendEnabled",
|
||||
},
|
||||
{
|
||||
name: "not a slice of refs",
|
||||
arg: []SendEnabled{},
|
||||
exp: "invalid parameter type: []types.SendEnabled",
|
||||
},
|
||||
{
|
||||
name: "not a slice of send enabled",
|
||||
arg: []*Params{},
|
||||
exp: "invalid parameter type: []*types.Params",
|
||||
},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(tt *testing.T) {
|
||||
actual := validateSendEnabledParams(tc.arg)
|
||||
if len(tc.exp) == 0 {
|
||||
assert.NoError(tt, actual)
|
||||
} else {
|
||||
assert.EqualError(tt, actual, tc.exp)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,9 +18,6 @@ import (
|
||||
|
||||
// Keeper defines the governance module Keeper
|
||||
type Keeper struct {
|
||||
// The reference to the Paramstore to get and set gov specific params
|
||||
paramSpace types.ParamSubspace //nolint:unused
|
||||
|
||||
authKeeper types.AccountKeeper
|
||||
bankKeeper types.BankKeeper
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user