diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ce34b40dc..c733cc385a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/runtime/app.go b/runtime/app.go index 427b03f6f0..4cfa6d5278 100644 --- a/runtime/app.go +++ b/runtime/app.go @@ -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 diff --git a/store/iavl/store.go b/store/iavl/store.go index b93a350254..c6878e4a39 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -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 -} diff --git a/store/iavl/store_test.go b/store/iavl/store_test.go index 5c120f2901..ef057e4e0a 100644 --- a/store/iavl/store_test.go +++ b/store/iavl/store_test.go @@ -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} diff --git a/types/context_test.go b/types/context_test.go index 78fb9c2762..fb16c3db49 100644 --- a/types/context_test.go +++ b/types/context_test.go @@ -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 diff --git a/x/bank/types/params.go b/x/bank/types/params.go index 6c03e2fad7..d7d1a05043 100644 --- a/x/bank/types/params.go +++ b/x/bank/types/params.go @@ -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) diff --git a/x/bank/types/params_test.go b/x/bank/types/params_test.go index 4e48166e70..697e9412a3 100644 --- a/x/bank/types/params_test.go +++ b/x/bank/types/params_test.go @@ -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) - } - }) - } -} diff --git a/x/gov/keeper/keeper.go b/x/gov/keeper/keeper.go index 34e8e975d3..23868a77e9 100644 --- a/x/gov/keeper/keeper.go +++ b/x/gov/keeper/keeper.go @@ -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