diff --git a/.golangci.yml b/.golangci.yml index db2314d7d4..de978f68af 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,7 +10,6 @@ run: linters: disable-all: true enable: - - depguard - dogsled - exportloopref - goconst @@ -51,6 +50,15 @@ issues: - text: 'SA1019: codec.NewAminoCodec is deprecated' # TODO remove once migration path is set out linters: - staticcheck + - text: 'SA1019: legacybech32.MustMarshalPubKey' # TODO remove once ready to remove from the sdk + linters: + - staticcheck + - text: 'SA1019: legacybech32.MarshalPubKey' # TODO remove once ready to remove from the sdk + linters: + - staticcheck + - text: 'SA1019: legacybech32.UnmarshalPubKey' # TODO remove once ready to remove from the sdk + linters: + - staticcheck - text: 'leading space' linters: - nolintlint @@ -66,6 +74,10 @@ linters-settings: - default # Default section: contains all imports that could not be matched to another section type. - prefix(cosmossdk.io) - prefix(github.com/cosmos/cosmos-sdk) + revive: + rules: + - name: redefines-builtin-id + disabled: true gosec: # To select a subset of rules to run. diff --git a/Makefile b/Makefile index cbbbcebbe7..0c0ac5c185 100644 --- a/Makefile +++ b/Makefile @@ -380,7 +380,7 @@ benchmark: ############################################################################### golangci_lint_cmd=golangci-lint -golangci_version=v1.51.2 +golangci_version=v1.53.3 lint: @echo "--> Running linter" diff --git a/client/debug/main.go b/client/debug/main.go index d355288068..296a3cb1b0 100644 --- a/client/debug/main.go +++ b/client/debug/main.go @@ -107,17 +107,17 @@ func getPubKeyFromRawString(pkstr, keytype string) (cryptotypes.PubKey, error) { } } - pk, err := legacybech32.UnmarshalPubKey(legacybech32.AccPK, pkstr) //nolint:staticcheck // we do old keys, they're keys after all. + pk, err := legacybech32.UnmarshalPubKey(legacybech32.AccPK, pkstr) if err == nil { return pk, nil } - pk, err = legacybech32.UnmarshalPubKey(legacybech32.ValPK, pkstr) //nolint:staticcheck // we do old keys, they're keys after all. + pk, err = legacybech32.UnmarshalPubKey(legacybech32.ValPK, pkstr) if err == nil { return pk, nil } - pk, err = legacybech32.UnmarshalPubKey(legacybech32.ConsPK, pkstr) //nolint:staticcheck // we do old keys, they're keys after all. + pk, err = legacybech32.UnmarshalPubKey(legacybech32.ConsPK, pkstr) if err == nil { return pk, nil } @@ -155,7 +155,7 @@ $ %s debug pubkey-raw cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg var consensusPub string edPK, ok := pk.(*ed25519.PubKey) if ok && pubkeyType == ed { - consensusPub, err = legacybech32.MarshalPubKey(legacybech32.ConsPK, edPK) //nolint:staticcheck // we do old keys, they're keys after all. + consensusPub, err = legacybech32.MarshalPubKey(legacybech32.ConsPK, edPK) if err != nil { return err } @@ -168,11 +168,11 @@ $ %s debug pubkey-raw cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg if err != nil { return err } - accPub, err := legacybech32.MarshalPubKey(legacybech32.AccPK, pk) //nolint:staticcheck // we do old keys, they're keys after all. + accPub, err := legacybech32.MarshalPubKey(legacybech32.AccPK, pk) if err != nil { return err } - valPub, err := legacybech32.MarshalPubKey(legacybech32.ValPK, pk) //nolint:staticcheck // we do old keys, they're keys after all. + valPub, err := legacybech32.MarshalPubKey(legacybech32.ValPK, pk) if err != nil { return err } diff --git a/codec/types/any.go b/codec/types/any.go index 334bed7463..c08b08d855 100644 --- a/codec/types/any.go +++ b/codec/types/any.go @@ -10,7 +10,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -// nolint:revive // XXX is reqired for proto compatibility type Any struct { // A URL/resource name that uniquely identifies the type of the serialized // protocol buffer message. This string must contain at least diff --git a/codec/types/any_internal_test.go b/codec/types/any_internal_test.go index f413f95528..9adab29466 100644 --- a/codec/types/any_internal_test.go +++ b/codec/types/any_internal_test.go @@ -17,7 +17,7 @@ func (d Dog) Greet() string { return d.Name } func (d *Dog) Reset() { d.Name = "" } func (d *Dog) String() string { return d.Name } func (d *Dog) ProtoMessage() {} -func (d *Dog) XXX_MessageName() string { return "tests/dog" } //nolint:revive // XXX_ prefix is required +func (d *Dog) XXX_MessageName() string { return "tests/dog" } type Animal interface { Greet() string diff --git a/codec/types/any_test.go b/codec/types/any_test.go index 06c0f5b418..5e2b29fcca 100644 --- a/codec/types/any_test.go +++ b/codec/types/any_test.go @@ -19,7 +19,7 @@ var _ proto.Message = (*errOnMarshal)(nil) var errAlways = fmt.Errorf("always erroring") -func (eom *errOnMarshal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { //nolint:revive // XXX_ prefix is intentional +func (eom *errOnMarshal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return nil, errAlways } diff --git a/codec/types/types_test.go b/codec/types/types_test.go index 4bb3f7d609..dddacfe18b 100644 --- a/codec/types/types_test.go +++ b/codec/types/types_test.go @@ -44,7 +44,7 @@ var ( func (dog FakeDog) Reset() {} func (dog FakeDog) String() string { return "fakedog" } func (dog FakeDog) ProtoMessage() {} -func (dog FakeDog) XXX_MessageName() string { return proto.MessageName(&testdata.Dog{}) } //nolint:revive // XXX_ prefix is intentional +func (dog FakeDog) XXX_MessageName() string { return proto.MessageName(&testdata.Dog{}) } func (dog FakeDog) Greet() string { return "fakedog" } func TestRegister(t *testing.T) { diff --git a/crypto/keyring/keyring.go b/crypto/keyring/keyring.go index 43bd466308..635b42d436 100644 --- a/crypto/keyring/keyring.go +++ b/crypto/keyring/keyring.go @@ -606,7 +606,7 @@ func SignWithLedger(k *Record, msg []byte, signMode signing.SignMode) (sig []byt priv, err := ledger.NewPrivKeySecp256k1Unsafe(*path) if err != nil { - return + return nil, nil, err } switch signMode { diff --git a/crypto/keys/multisig/amino.go b/crypto/keys/multisig/amino.go index 1973a31a66..8fa596906d 100644 --- a/crypto/keys/multisig/amino.go +++ b/crypto/keys/multisig/amino.go @@ -66,7 +66,7 @@ func tmToProto(tmPk tmMultisig) (*LegacyAminoPubKey, error) { } // MarshalAminoJSON overrides amino JSON unmarshaling. -func (m LegacyAminoPubKey) MarshalAminoJSON() (tmMultisig, error) { //nolint:golint,revive // we need to override the default amino JSON marshaling +func (m LegacyAminoPubKey) MarshalAminoJSON() (tmMultisig, error) { //nolint:golint // we need to override the default amino JSON marshaling return protoToTm(&m) } diff --git a/depinject/location.go b/depinject/location.go index 7b18d5e1b1..4eb4a7254b 100644 --- a/depinject/location.go +++ b/depinject/location.go @@ -90,7 +90,7 @@ const _vendor = "/vendor/" func splitFuncName(function string) (pname, fname string) { if len(function) == 0 { - return + return "", "" } // We have something like "path.to/my/pkg.MyFunction". If the function is diff --git a/depinject/provider_desc_test.go b/depinject/provider_desc_test.go index a620620d78..cbaca1d197 100644 --- a/depinject/provider_desc_test.go +++ b/depinject/provider_desc_test.go @@ -45,7 +45,7 @@ func StructInAndOut(_ float32, _ StructIn, _ byte) (int16, StructOut, int32, err return int16(0), StructOut{}, int32(0), nil } -func BadErrorPosition() (error, int) { return nil, 0 } //nolint:revive,stylecheck // Deliberately has error as first of multiple arguments. +func BadErrorPosition() (error, int) { return nil, 0 } //nolint:stylecheck // Deliberately has error as first of multiple arguments. func BadOptionalFn(_ BadOptional) int { return 0 } diff --git a/math/uint.go b/math/uint.go index 406d9418ce..821ead066a 100644 --- a/math/uint.go +++ b/math/uint.go @@ -244,10 +244,10 @@ func RelativePow(x, n, b Uint) (z Uint) { if x.IsZero() { if n.IsZero() { z = b // 0^0 = 1 - return + return z } z = ZeroUint() // otherwise 0^a = 0 - return + return z } z = x diff --git a/orm/model/ormdb/module_test.go b/orm/model/ormdb/module_test.go index a5ef7bbfef..937f76de17 100644 --- a/orm/model/ormdb/module_test.go +++ b/orm/model/ormdb/module_test.go @@ -258,7 +258,7 @@ func TestModuleDB(t *testing.T) { testkv.AssertBackendsEqual(t, backend, backend2) } -func runSimpleBankTests(t *testing.T, k Keeper, ctx context.Context) { // nolint:revive // test function +func runSimpleBankTests(t *testing.T, k Keeper, ctx context.Context) { // mint coins denom := "foo" acct1 := "bob" diff --git a/orm/model/ormtable/auto_increment_test.go b/orm/model/ormtable/auto_increment_test.go index 053b8a2391..db7e6f4a09 100644 --- a/orm/model/ormtable/auto_increment_test.go +++ b/orm/model/ormtable/auto_increment_test.go @@ -42,7 +42,7 @@ func TestAutoIncrementScenario(t *testing.T) { checkEncodeDecodeEntries(t, table, store.IndexStoreReader()) } -func runAutoIncrementScenario(t *testing.T, table ormtable.AutoIncrementTable, ctx context.Context) { //nolint:revive // ignore linting on testing function signature +func runAutoIncrementScenario(t *testing.T, table ormtable.AutoIncrementTable, ctx context.Context) { store, err := testpb.NewExampleAutoIncrementTableTable(table) assert.NilError(t, err) diff --git a/orm/model/ormtable/bench_test.go b/orm/model/ormtable/bench_test.go index 509bf202cf..810e41135e 100644 --- a/orm/model/ormtable/bench_test.go +++ b/orm/model/ormtable/bench_test.go @@ -68,7 +68,7 @@ func bench(b *testing.B, newBackend func(testing.TB) ormtable.Backend) { }) } -func benchInsert(b *testing.B, ctx context.Context) { //nolint:revive // ignore for benchmark +func benchInsert(b *testing.B, ctx context.Context) { balanceTable := initBalanceTable(b) for i := 0; i < b.N; i++ { assert.NilError(b, balanceTable.Insert(ctx, &testpb.Balance{ @@ -79,7 +79,7 @@ func benchInsert(b *testing.B, ctx context.Context) { //nolint:revive // ignore } } -func benchUpdate(b *testing.B, ctx context.Context) { //nolint:revive // ignore for benchmark +func benchUpdate(b *testing.B, ctx context.Context) { balanceTable := initBalanceTable(b) for i := 0; i < b.N; i++ { assert.NilError(b, balanceTable.Update(ctx, &testpb.Balance{ @@ -90,7 +90,7 @@ func benchUpdate(b *testing.B, ctx context.Context) { //nolint:revive // ignore } } -func benchGet(b *testing.B, ctx context.Context) { //nolint:revive // ignore for benchmark +func benchGet(b *testing.B, ctx context.Context) { balanceTable := initBalanceTable(b) for i := 0; i < b.N; i++ { balance, err := balanceTable.Get(ctx, fmt.Sprintf("acct%d", i), "bar") @@ -99,7 +99,7 @@ func benchGet(b *testing.B, ctx context.Context) { //nolint:revive // ignore for } } -func benchDelete(b *testing.B, ctx context.Context) { //nolint:revive // ignore for benchmark +func benchDelete(b *testing.B, ctx context.Context) { balanceTable := initBalanceTable(b) for i := 0; i < b.N; i++ { assert.NilError(b, balanceTable.Delete(ctx, &testpb.Balance{ diff --git a/orm/model/ormtable/table_test.go b/orm/model/ormtable/table_test.go index 8bebd04324..34a8824b0a 100644 --- a/orm/model/ormtable/table_test.go +++ b/orm/model/ormtable/table_test.go @@ -699,7 +699,7 @@ func TestJSONExportImport(t *testing.T) { assertTablesEqual(t, table, store, store2) } -func assertTablesEqual(t assert.TestingT, table ormtable.Table, ctx, ctx2 context.Context) { //nolint:revive // ignore long function name +func assertTablesEqual(t assert.TestingT, table ormtable.Table, ctx, ctx2 context.Context) { it, err := table.List(ctx, nil) assert.NilError(t, err) it2, err := table.List(ctx2, nil) diff --git a/orm/types/ormerrors/errors.go b/orm/types/ormerrors/errors.go index aae16960fa..9572163b84 100644 --- a/orm/types/ormerrors/errors.go +++ b/orm/types/ormerrors/errors.go @@ -13,7 +13,6 @@ func IsNotFound(err error) bool { return errors.IsOf(err, NotFound) } -// nolint: revive // avoid break API var ( InvalidTableId = errors.New(codespace, 1, "invalid or missing table or single id, need a non-zero value") MissingPrimaryKey = errors.New(codespace, 2, "table is missing primary key") diff --git a/server/mock/app.go b/server/mock/app.go index 60d85cd6a1..b859769a30 100644 --- a/server/mock/app.go +++ b/server/mock/app.go @@ -149,7 +149,7 @@ type MsgServerImpl struct { capKeyMainStore *storetypes.KVStoreKey } -func MsgTestHandler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { // nolint: revive // refactor this in a followup pr +func MsgTestHandler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(KVStoreTx) if err := dec(in); err != nil { return nil, err diff --git a/testutil/cmdtest/system.go b/testutil/cmdtest/system.go index 66e2604302..1b02b0a365 100644 --- a/testutil/cmdtest/system.go +++ b/testutil/cmdtest/system.go @@ -78,7 +78,7 @@ func (s *System) MustRun(t TestingT, args ...string) RunResult { } // MustRunC calls s.RunWithInput, but also calls t.FailNow if RunResult.Err is not nil. -func (s *System) MustRunC(t TestingT, ctx context.Context, args ...string) RunResult { //nolint:revive // As a variation of MustRun, t is more important than ctx. +func (s *System) MustRunC(t TestingT, ctx context.Context, args ...string) RunResult { t.Helper() return s.MustRunWithInputC(t, ctx, bytes.NewReader(nil), args...) @@ -92,7 +92,7 @@ func (s *System) MustRunWithInput(t TestingT, in io.Reader, args ...string) RunR } // MustRunWithInputC calls s.RunWithInputC, but also calls t.FailNow if RunResult.Err is not nil. -func (s *System) MustRunWithInputC(t TestingT, ctx context.Context, in io.Reader, args ...string) RunResult { //nolint:revive // As a variation of MustRun, t is more important than ctx. +func (s *System) MustRunWithInputC(t TestingT, ctx context.Context, in io.Reader, args ...string) RunResult { t.Helper() res := s.RunWithInputC(ctx, in, args...) diff --git a/tools/rosetta/converter.go b/tools/rosetta/converter.go index 30a73c4b77..96793afb34 100644 --- a/tools/rosetta/converter.go +++ b/tools/rosetta/converter.go @@ -612,7 +612,7 @@ func (c converter) OpsAndSigners(txBytes []byte) (ops []*rosettatypes.Operation, var signerStr string signerStr, err = c.ir.SigningContext().AddressCodec().BytesToString(signer) if err != nil { - return + return nil, nil, crgerrs.WrapError(crgerrs.ErrCodec, err.Error()) } signers = append(signers, &rosettatypes.AccountIdentifier{ diff --git a/types/address_test.go b/types/address_test.go index b95d4f4148..c17f3bc533 100644 --- a/types/address_test.go +++ b/types/address_test.go @@ -17,7 +17,7 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/bech32/legacybech32" //nolint:staticcheck // SA1019: legacybech32 is deprecated: use the bech32 package instead. + "github.com/cosmos/cosmos-sdk/types/bech32/legacybech32" //nolint:staticcheck // we do old keys, they're keys after all. ) type addressTestSuite struct { @@ -308,7 +308,7 @@ func (s *addressTestSuite) TestConfiguredPrefix() { acc.String(), prefix+types.PrefixAccount), acc.String()) - bech32Pub := legacybech32.MustMarshalPubKey(legacybech32.AccPK, pub) //nolint:staticcheck // SA1019: legacybech32 is deprecated: use the bech32 package instead. + bech32Pub := legacybech32.MustMarshalPubKey(legacybech32.AccPK, pub) s.Require().True(strings.HasPrefix( bech32Pub, prefix+types.PrefixPublic)) @@ -322,7 +322,7 @@ func (s *addressTestSuite) TestConfiguredPrefix() { val.String(), prefix+types.PrefixValidator+types.PrefixAddress)) - bech32ValPub := legacybech32.MustMarshalPubKey(legacybech32.ValPK, pub) //nolint:staticcheck // SA1019: legacybech32 is deprecated: use the bech32 package instead. + bech32ValPub := legacybech32.MustMarshalPubKey(legacybech32.ValPK, pub) s.Require().True(strings.HasPrefix( bech32ValPub, prefix+types.PrefixValidator+types.PrefixPublic)) @@ -336,7 +336,7 @@ func (s *addressTestSuite) TestConfiguredPrefix() { cons.String(), prefix+types.PrefixConsensus+types.PrefixAddress)) - bech32ConsPub := legacybech32.MustMarshalPubKey(legacybech32.ConsPK, pub) //nolint:staticcheck // SA1019: legacybech32 is deprecated: use the bech32 package instead. + bech32ConsPub := legacybech32.MustMarshalPubKey(legacybech32.ConsPK, pub) s.Require().True(strings.HasPrefix( bech32ConsPub, prefix+types.PrefixConsensus+types.PrefixPublic)) diff --git a/types/tx/ext.go b/types/tx/ext.go index f0cd824d7e..fb2e1ed448 100644 --- a/types/tx/ext.go +++ b/types/tx/ext.go @@ -5,7 +5,7 @@ import ( ) // TxExtensionOptionI defines the interface for tx extension options -type TxExtensionOptionI interface{} //nolint:revive // to avoid breaking change +type TxExtensionOptionI interface{} // unpackTxExtensionOptionsI unpacks Any's to TxExtensionOptionI's. func unpackTxExtensionOptionsI(unpacker types.AnyUnpacker, anys []*types.Any) error { diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index 283034bccf..747c1f09a1 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -73,7 +73,7 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) { } parsedTx, err := authclient.ReadTxFromFile(clientCtx, args[0]) if err != nil { - return + return err } txFactory, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) @@ -183,7 +183,7 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) { outputDoc, _ := cmd.Flags().GetString(flags.FlagOutputDocument) if outputDoc == "" { cmd.Printf("%s\n", json) - return + return nil } fp, err := os.OpenFile(outputDoc, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644) @@ -200,7 +200,7 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) { err = clientCtx.PrintBytes(json) - return + return err } } diff --git a/x/distribution/keeper/delegation.go b/x/distribution/keeper/delegation.go index f487d76335..b912d2895a 100644 --- a/x/distribution/keeper/delegation.go +++ b/x/distribution/keeper/delegation.go @@ -85,13 +85,13 @@ func (k Keeper) CalculateDelegationRewards(ctx context.Context, val stakingtypes // fetch starting info for delegation startingInfo, err := k.DelegatorStartingInfo.Get(ctx, collections.Join(del.GetValidatorAddr(), del.GetDelegatorAddr())) if err != nil && !errors.Is(err, collections.ErrNotFound) { - return + return sdk.DecCoins{}, err } sdkCtx := sdk.UnwrapSDKContext(ctx) if startingInfo.Height == uint64(sdkCtx.BlockHeight()) { // started this height, no rewards yet - return + return sdk.DecCoins{}, nil } startingPeriod := startingInfo.PreviousPeriod diff --git a/x/gov/types/metadata.go b/x/gov/types/metadata.go index 504ed72a1b..fd52da4a28 100644 --- a/x/gov/types/metadata.go +++ b/x/gov/types/metadata.go @@ -7,6 +7,6 @@ type ProposalMetadata struct { Authors []string `json:"authors"` Summary string `json:"summary"` Details string `json:"details"` - ProposalForumUrl string `json:"proposal_forum_url"` //nolint:revive // named 'Url' instead of 'URL' for avoiding the camel case split + ProposalForumUrl string `json:"proposal_forum_url"` VoteOptionContext string `json:"vote_option_context"` } diff --git a/x/group/module/abci_test.go b/x/group/module/abci_test.go index e3a2121b11..96a6fb2ee6 100644 --- a/x/group/module/abci_test.go +++ b/x/group/module/abci_test.go @@ -558,7 +558,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() { } } -func submitProposal(s *IntegrationTestSuite, app *runtime.App, ctx context.Context, msgs []sdk.Msg, proposers []string, groupPolicyAddr sdk.AccAddress) (uint64, error) { //nolint:revive // context-as-argument: context.Context should be the first parameter of a function +func submitProposal(s *IntegrationTestSuite, app *runtime.App, ctx context.Context, msgs []sdk.Msg, proposers []string, groupPolicyAddr sdk.AccAddress) (uint64, error) { proposalReq := &group.MsgSubmitProposal{ GroupPolicyAddress: groupPolicyAddr.String(), Proposers: proposers, @@ -577,7 +577,7 @@ func submitProposal(s *IntegrationTestSuite, app *runtime.App, ctx context.Conte } func submitProposalAndVote( - s *IntegrationTestSuite, app *runtime.App, ctx context.Context, msgs []sdk.Msg, //nolint:revive // context-as-argument: context.Context should be the first parameter of a function + s *IntegrationTestSuite, app *runtime.App, ctx context.Context, msgs []sdk.Msg, proposers []string, groupPolicyAddr sdk.AccAddress, voteOption group.VoteOption, ) (uint64, error) { myProposalID, err := submitProposal(s, app, ctx, msgs, proposers, groupPolicyAddr) diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index 6d214fa3e9..06ad400a4f 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -1042,12 +1042,12 @@ func (k Keeper) getBeginInfo( ) (completionTime time.Time, height int64, completeNow bool, err error) { validator, err := k.GetValidator(ctx, valSrcAddr) if err != nil && errors.Is(err, types.ErrNoValidatorFound) { - return + return completionTime, height, false, nil } sdkCtx := sdk.UnwrapSDKContext(ctx) unbondingTime, err := k.UnbondingTime(ctx) if err != nil { - return + return completionTime, height, false, err } // TODO: When would the validator not be found? diff --git a/x/staking/keeper/val_state_change.go b/x/staking/keeper/val_state_change.go index 1919ccf3d8..860cd787bd 100644 --- a/x/staking/keeper/val_state_change.go +++ b/x/staking/keeper/val_state_change.go @@ -172,13 +172,13 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx context.Context) (updates case validator.IsUnbonded(): validator, err = k.unbondedToBonded(ctx, validator) if err != nil { - return + return nil, err } amtFromNotBondedToBonded = amtFromNotBondedToBonded.Add(validator.GetTokens()) case validator.IsUnbonding(): validator, err = k.unbondingToBonded(ctx, validator) if err != nil { - return + return nil, err } amtFromNotBondedToBonded = amtFromNotBondedToBonded.Add(validator.GetTokens()) case validator.IsBonded(): diff --git a/x/staking/types/keys.go b/x/staking/types/keys.go index 8b77a90987..87c913fa82 100644 --- a/x/staking/types/keys.go +++ b/x/staking/types/keys.go @@ -63,7 +63,6 @@ var ( // UnbondingType defines the type of unbonding operation type UnbondingType int -//nolint:revive // we want these underscores, they make life easier const ( UnbondingType_Undefined UnbondingType = iota UnbondingType_UnbondingDelegation