diff --git a/Makefile b/Makefile index db605661a5..0e935ce2b1 100644 --- a/Makefile +++ b/Makefile @@ -379,7 +379,7 @@ benchmark: ### Linting ### ############################################################################### -golangci_version=v2.4.0 +golangci_version=v2.5.0 lint-install: @echo "--> Installing golangci-lint $(golangci_version)" diff --git a/baseapp/abci_test.go b/baseapp/abci_test.go index f23b274f23..368833b253 100644 --- a/baseapp/abci_test.go +++ b/baseapp/abci_test.go @@ -750,7 +750,7 @@ func TestABCI_Query_SimulateTx(t *testing.T) { anteOpt := func(bapp *baseapp.BaseApp) { bapp.SetAnteHandler(func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, err error) { newCtx = ctx.WithGasMeter(storetypes.NewGasMeter(gasConsumed)) - return + return newCtx, err }) } suite := NewBaseAppSuite(t, anteOpt) @@ -810,7 +810,7 @@ func TestABCI_Query_SimulateTx(t *testing.T) { func TestABCI_InvalidTransaction(t *testing.T) { anteOpt := func(bapp *baseapp.BaseApp) { bapp.SetAnteHandler(func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, err error) { - return + return newCtx, err }) } @@ -1048,7 +1048,7 @@ func TestABCI_MaxBlockGasLimits(t *testing.T) { count, _ := parseTxMemo(t, tx) newCtx.GasMeter().ConsumeGas(uint64(count), "counter-ante") - return + return newCtx, err }) } @@ -1149,7 +1149,7 @@ func TestABCI_GasConsumptionBadTx(t *testing.T) { return newCtx, errorsmod.Wrap(sdkerrors.ErrUnauthorized, "ante handler failure") } - return + return newCtx, err }) } @@ -1188,7 +1188,7 @@ func TestABCI_Query(t *testing.T) { bapp.SetAnteHandler(func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, err error) { store := ctx.KVStore(capKey1) store.Set(key, value) - return + return newCtx, err }) } diff --git a/baseapp/internal/protocompat/protocompat.go b/baseapp/internal/protocompat/protocompat.go index ec296b9147..48c3eb7b6e 100644 --- a/baseapp/internal/protocompat/protocompat.go +++ b/baseapp/internal/protocompat/protocompat.go @@ -214,7 +214,7 @@ func isProtov2(md grpc.MethodDesc) (isV2Type bool, err error) { // we are allowed to pass in a nil context and nil request, since we are not actually executing the request. // this is made possible by the doNotExecute function which immediately returns without calling other handlers. _, _ = md.Handler(nil, nil, pullRequestType, doNotExecute) - return + return isV2Type, err } // RequestFullNameFromMethodDesc returns the fully-qualified name of the request message of the provided service's method. diff --git a/codec/collections.go b/codec/collections.go index cded358c5c..c9e9b8f9a9 100644 --- a/codec/collections.go +++ b/codec/collections.go @@ -76,7 +76,7 @@ func (c collValue[T, PT]) EncodeJSON(value T) ([]byte, error) { func (c collValue[T, PT]) DecodeJSON(b []byte) (value T, err error) { err = c.cdc.UnmarshalJSON(b, PT(&value)) - return + return value, err } func (c collValue[T, PT]) Stringify(value T) string { diff --git a/codec/legacy/codec.go b/codec/legacy/codec.go index b552dc7fb0..6988c19584 100644 --- a/codec/legacy/codec.go +++ b/codec/legacy/codec.go @@ -22,11 +22,11 @@ func init() { // PrivKeyFromBytes unmarshals private key bytes and returns a PrivKey func PrivKeyFromBytes(privKeyBytes []byte) (privKey cryptotypes.PrivKey, err error) { err = Cdc.Unmarshal(privKeyBytes, &privKey) - return + return privKey, err } // PubKeyFromBytes unmarshals public key bytes and returns a PubKey func PubKeyFromBytes(pubKeyBytes []byte) (pubKey cryptotypes.PubKey, err error) { err = Cdc.Unmarshal(pubKeyBytes, &pubKey) - return + return pubKey, err } diff --git a/collections/colltest/codec.go b/collections/colltest/codec.go index daef69c594..29f9879d59 100644 --- a/collections/colltest/codec.go +++ b/collections/colltest/codec.go @@ -113,7 +113,7 @@ func (m mockValueCodec[T]) Decode(b []byte) (t T, err error) { wrappedValue := mockValueJSON{} err = json.Unmarshal(b, &wrappedValue) if err != nil { - return + return t, err } if !m.isInterface { err = json.Unmarshal(wrappedValue.Value, &t) diff --git a/collections/indexes/helpers.go b/collections/indexes/helpers.go index e627c03a98..7be15d8c92 100644 --- a/collections/indexes/helpers.go +++ b/collections/indexes/helpers.go @@ -30,7 +30,7 @@ func CollectKeyValues[K, V any, I iterator[K], Idx collections.Indexes[K, V]]( kvs = append(kvs, kv) return false }) - return + return kvs, err } // ScanKeyValues calls the do function on every record found, in the indexed map @@ -79,7 +79,7 @@ func CollectValues[K, V any, I iterator[K], Idx collections.Indexes[K, V]]( values = append(values, value) return false }) - return + return values, err } // ScanValues collects all the values from an Index iterator and the IndexedMap in a lazy way. diff --git a/collections/indexes/reverse_pair.go b/collections/indexes/reverse_pair.go index 4b85b62c6c..4728a8377d 100644 --- a/collections/indexes/reverse_pair.go +++ b/collections/indexes/reverse_pair.go @@ -83,7 +83,7 @@ func NewReversePair[Value, K1, K2 any]( func (i *ReversePair[K1, K2, Value]) Iterate(ctx context.Context, ranger collections.Ranger[collections.Pair[K2, K1]]) (iter ReversePairIterator[K2, K1], err error) { sIter, err := i.refKeys.Iterate(ctx, ranger) if err != nil { - return + return iter, err } return (ReversePairIterator[K2, K1])(sIter), nil } diff --git a/collections/indexes/unique.go b/collections/indexes/unique.go index 4654003a88..7a1efb2e3a 100644 --- a/collections/indexes/unique.go +++ b/collections/indexes/unique.go @@ -98,7 +98,7 @@ func (i *Unique[ReferenceKey, PrimaryKey, Value]) Walk( func (i *Unique[ReferenceKey, PrimaryKey, Value]) IterateRaw(ctx context.Context, start, end []byte, order collections.Order) (u UniqueIterator[ReferenceKey, PrimaryKey], err error) { iter, err := i.refKeys.IterateRaw(ctx, start, end, order) if err != nil { - return + return u, err } return (UniqueIterator[ReferenceKey, PrimaryKey])(iter), nil } diff --git a/collections/pair.go b/collections/pair.go index bf22a6711d..d6a7482dc6 100644 --- a/collections/pair.go +++ b/collections/pair.go @@ -19,7 +19,7 @@ type Pair[K1, K2 any] struct { // If not present the zero value is returned. func (p Pair[K1, K2]) K1() (k1 K1) { if p.key1 == nil { - return + return k1 } return *p.key1 } @@ -28,7 +28,7 @@ func (p Pair[K1, K2]) K1() (k1 K1) { // If not present the zero value is returned. func (p Pair[K1, K2]) K2() (k2 K2) { if p.key2 == nil { - return + return k2 } return *p.key2 } diff --git a/collections/protocodec/collections.go b/collections/protocodec/collections.go index 77dee98bc8..3388aa287f 100644 --- a/collections/protocodec/collections.go +++ b/collections/protocodec/collections.go @@ -80,7 +80,7 @@ func (c collValue[T, PT]) EncodeJSON(value T) ([]byte, error) { func (c collValue[T, PT]) DecodeJSON(b []byte) (value T, err error) { err = c.cdc.UnmarshalJSON(b, PT(&value)) - return + return value, err } func (c collValue[T, PT]) Stringify(value T) string { diff --git a/contrib/x/nft/keeper/class.go b/contrib/x/nft/keeper/class.go index e8fa357fda..a88ff81e4e 100644 --- a/contrib/x/nft/keeper/class.go +++ b/contrib/x/nft/keeper/class.go @@ -63,7 +63,7 @@ func (k Keeper) GetClasses(ctx context.Context) (classes []*nft.Class) { k.cdc.MustUnmarshal(iterator.Value(), &class) classes = append(classes, &class) } - return + return classes } // HasClass determines whether the specified classID exist diff --git a/contrib/x/nft/keeper/keys.go b/contrib/x/nft/keeper/keys.go index d4ade01976..03bd909a8a 100644 --- a/contrib/x/nft/keeper/keys.go +++ b/contrib/x/nft/keeper/keys.go @@ -86,7 +86,7 @@ func parseNftOfClassByOwnerStoreKey(key []byte) (classID, nftID string) { } classID = conv.UnsafeBytesToStr(ret[0]) nftID = string(ret[1]) - return + return classID, nftID } // ownerStoreKey returns the byte representation of the nft owner diff --git a/crypto/armor.go b/crypto/armor.go index 5a191a7218..2526eb2152 100644 --- a/crypto/armor.go +++ b/crypto/armor.go @@ -128,15 +128,15 @@ func UnarmorPubKeyBytes(armorStr string) (bz []byte, algo string, err error) { func unarmorBytes(armorStr, blockType string) (bz []byte, header map[string]string, err error) { bType, header, bz, err := DecodeArmor(armorStr) if err != nil { - return + return bz, header, err } if bType != blockType { err = fmt.Errorf("unrecognized armor type %q, expected: %q", bType, blockType) - return + return bz, header, err } - return + return bz, header, err } //----------------------------------------------------------------- diff --git a/crypto/hd/hdpath.go b/crypto/hd/hdpath.go index 0faa3e405b..ed92c18d84 100644 --- a/crypto/hd/hdpath.go +++ b/crypto/hd/hdpath.go @@ -160,7 +160,7 @@ func ComputeMastersFromSeed(seed []byte) (secret, chainCode [32]byte) { curveIdentifier := []byte("Bitcoin seed") secret, chainCode = i64(curveIdentifier, seed) - return + return secret, chainCode } // DerivePrivateKeyForPath derives the private key by following the BIP 32/44 path from privKeyBytes, @@ -272,7 +272,7 @@ func i64(key, data []byte) (il, ir [32]byte) { copy(il[:], I[:32]) copy(ir[:], I[32:]) - return + return il, ir } // CreateHDPath returns BIP 44 object from account and index parameters. diff --git a/crypto/keyring/legacy_info.go b/crypto/keyring/legacy_info.go index d14f990109..acea5e0d1b 100644 --- a/crypto/keyring/legacy_info.go +++ b/crypto/keyring/legacy_info.go @@ -251,7 +251,7 @@ func unMarshalLegacyInfo(bz []byte) (info LegacyInfo, err error) { return multi, err } - return + return info, err } // privKeyFromLegacyInfo exports a private key from LegacyInfo diff --git a/crypto/keys/multisig/multisig_test.go b/crypto/keys/multisig/multisig_test.go index 498dbc168c..6f904457a4 100644 --- a/crypto/keys/multisig/multisig_test.go +++ b/crypto/keys/multisig/multisig_test.go @@ -315,7 +315,7 @@ func generatePubKeysAndSignatures(n int, msg []byte) (pubKeys []cryptotypes.PubK sig, _ := privkey.Sign(msg) signatures[i] = &signing.SingleSignatureData{Signature: sig} } - return + return pubKeys, signatures } func generateNestedMultiSignature(n int, msg []byte) (multisig.PubKey, *signing.MultiSignatureData) { @@ -348,7 +348,7 @@ func reorderPubKey(pk *kmultisig.LegacyAminoPubKey) (other *kmultisig.LegacyAmin pubkeysCpy[0] = pk.PubKeys[1] pubkeysCpy[1] = pk.PubKeys[0] other = &kmultisig.LegacyAminoPubKey{Threshold: 2, PubKeys: pubkeysCpy} - return + return other } func TestDisplay(t *testing.T) { diff --git a/math/int.go b/math/int.go index 12217981a4..01e0d8484c 100644 --- a/math/int.go +++ b/math/int.go @@ -161,12 +161,12 @@ func NewIntFromBigIntMut(i *big.Int) Int { func NewIntFromString(s string) (res Int, ok bool) { i, ok := newIntegerFromString(s) if !ok { - return + return res, ok } // Check overflow if bigIntOverflows(i) { ok = false - return + return res, ok } return Int{i}, true } diff --git a/server/mock/app.go b/server/mock/app.go index 5c6680b469..e06bb2370f 100644 --- a/server/mock/app.go +++ b/server/mock/app.go @@ -133,13 +133,13 @@ func AppGenState(_ *codec.LegacyAmino, _ genutiltypes.AppGenesis, _ []json.RawMe } ] }`) - return + return appState, err } // AppGenStateEmpty returns an empty transaction state for mocking. func AppGenStateEmpty(_ *codec.LegacyAmino, _ genutiltypes.AppGenesis, _ []json.RawMessage) (appState json.RawMessage, err error) { appState = json.RawMessage(``) - return + return appState, err } // Manually write the handlers for this custom message diff --git a/server/util.go b/server/util.go index 84461a05f7..42d01bd65d 100644 --- a/server/util.go +++ b/server/util.go @@ -504,7 +504,7 @@ func openDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error) { func openTraceWriter(traceWriterFile string) (w io.WriteCloser, err error) { if traceWriterFile == "" { - return + return w, err } return os.OpenFile( traceWriterFile, diff --git a/store/mem/store.go b/store/mem/store.go index b819d75363..33a470d481 100644 --- a/store/mem/store.go +++ b/store/mem/store.go @@ -47,7 +47,7 @@ func (s Store) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.Cach } // Commit performs a no-op as entries are persistent between commitments. -func (s *Store) Commit() (id types.CommitID) { return } +func (s *Store) Commit() (id types.CommitID) { return id } func (s *Store) SetPruning(pruning pruningtypes.PruningOptions) {} @@ -57,6 +57,6 @@ func (s *Store) GetPruning() pruningtypes.PruningOptions { return pruningtypes.NewPruningOptions(pruningtypes.PruningUndefined) } -func (s Store) LastCommitID() (id types.CommitID) { return } +func (s Store) LastCommitID() (id types.CommitID) { return id } -func (s Store) WorkingHash() (hash []byte) { return } +func (s Store) WorkingHash() (hash []byte) { return hash } diff --git a/store/prefix/store.go b/store/prefix/store.go index 26fc0cb50d..719326e462 100644 --- a/store/prefix/store.go +++ b/store/prefix/store.go @@ -31,7 +31,7 @@ func cloneAppend(bz, tail []byte) (res []byte) { res = make([]byte, len(bz)+len(tail)) copy(res, bz) copy(res[len(bz):], tail) - return + return res } func (s Store) key(key []byte) (res []byte) { @@ -39,7 +39,7 @@ func (s Store) key(key []byte) (res []byte) { panic("nil key on Store") } res = cloneAppend(s.prefix, key) - return + return res } // GetStoreType implements Store, returning the parent store's type @@ -165,7 +165,7 @@ func (pi *prefixIterator) Key() (key []byte) { key = pi.iter.Key() key = stripPrefix(key, pi.prefix) - return + return key } // Implements Iterator diff --git a/store/rootmulti/proof.go b/store/rootmulti/proof.go index a1524adb6c..290e1270dd 100644 --- a/store/rootmulti/proof.go +++ b/store/rootmulti/proof.go @@ -28,5 +28,5 @@ func DefaultProofRuntime() (prt *merkle.ProofRuntime) { prt = merkle.NewProofRuntime() prt.RegisterOpDecoder(storetypes.ProofOpIAVLCommitment, storetypes.CommitmentOpDecoder) prt.RegisterOpDecoder(storetypes.ProofOpSimpleMerkleCommitment, storetypes.CommitmentOpDecoder) - return + return prt } diff --git a/store/transient/store.go b/store/transient/store.go index da06691970..daeea35b1b 100644 --- a/store/transient/store.go +++ b/store/transient/store.go @@ -27,7 +27,7 @@ func NewStore() *Store { // Implements CommitStore func (ts *Store) Commit() (id types.CommitID) { ts.Store = dbadapter.Store{DB: dbm.NewMemDB()} - return + return id } func (ts *Store) SetPruning(_ pruningtypes.PruningOptions) {} diff --git a/store/types/proof.go b/store/types/proof.go index b1f4a115ed..d40c1aebee 100644 --- a/store/types/proof.go +++ b/store/types/proof.go @@ -153,14 +153,14 @@ func ProofOpFromMap(cmap map[string][]byte, storeName string) (ret cmtprotocrypt proof := proofs[storeName] if proof == nil { err = fmt.Errorf("ProofOp for %s but not registered store name", storeName) - return + return ret, err } // convert merkle.SimpleProof to CommitmentProof existProof, err := sdkproofs.ConvertExistenceProof(proof, []byte(storeName), cmap[storeName]) if err != nil { err = fmt.Errorf("could not convert simple proof to existence proof: %w", err) - return + return ret, err } commitmentProof := &ics23.CommitmentProof{ @@ -170,5 +170,5 @@ func ProofOpFromMap(cmap map[string][]byte, storeName string) (ret cmtprotocrypt } ret = NewSimpleMerkleCommitmentOp([]byte(storeName), commitmentProof).ProofOp() - return + return ret, err } diff --git a/testutil/network/util.go b/testutil/network/util.go index 398be3064b..d378a057f9 100644 --- a/testutil/network/util.go +++ b/testutil/network/util.go @@ -232,5 +232,5 @@ func FreeTCPAddr() (addr, port string, closeFn func() error, err error) { portI := l.Addr().(*net.TCPAddr).Port port = fmt.Sprintf("%d", portI) addr = fmt.Sprintf("tcp://0.0.0.0:%s", port) - return + return addr, port, closeFn, err } diff --git a/testutil/simsx/msg_factory.go b/testutil/simsx/msg_factory.go index c2e751c84f..01e4e82655 100644 --- a/testutil/simsx/msg_factory.go +++ b/testutil/simsx/msg_factory.go @@ -69,7 +69,7 @@ func NewSimMsgFactoryWithDeliveryResultHandler[T sdk.Msg](f FactoryMethodWithDel if r.resultHandler == nil { r.resultHandler = expectNoError } - return + return signer, msg } return r } @@ -95,7 +95,7 @@ func NewSimMsgFactoryWithFutureOps[T sdk.Msg](f FactoryMethodWithFutureOps[T]) * r := &LazyStateSimMsgFactory[T]{} r.SimMsgFactoryFn = func(ctx context.Context, testData *ChainDataSource, reporter SimulationReporter) (signer []SimAccount, msg T) { signer, msg = f(ctx, testData, reporter, r.fsOpsReg) - return + return signer, msg } return r } diff --git a/types/collections.go b/types/collections.go index de2873fadb..661835481a 100644 --- a/types/collections.go +++ b/types/collections.go @@ -83,10 +83,10 @@ func (a genericAddressKey[T]) EncodeJSON(value T) ([]byte, error) { func (a genericAddressKey[T]) DecodeJSON(b []byte) (v T, err error) { s, err := collections.StringKey.DecodeJSON(b) if err != nil { - return + return v, err } v, err = a.stringDecoder(s) - return + return v, err } func (a genericAddressKey[T]) Stringify(key T) string { diff --git a/version/version.go b/version/version.go index 8d5fe373bb..4a9432a59c 100644 --- a/version/version.go +++ b/version/version.go @@ -105,7 +105,7 @@ func depsFromBuildInfo() (deps []buildDep) { deps = append(deps, buildDep{dep}) } - return + return deps } type buildDep struct { diff --git a/x/auth/ante/ante_test.go b/x/auth/ante/ante_test.go index e86e86abe5..84a0744cb3 100644 --- a/x/auth/ante/ante_test.go +++ b/x/auth/ante/ante_test.go @@ -1210,7 +1210,7 @@ func generatePubKeysAndSignatures(n int, msg []byte, _ bool) (pubkeys []cryptoty pubkeys[i] = privkey.PubKey() signatures[i], _ = privkey.Sign(msg) } - return + return pubkeys, signatures } func expectedGasCostByKeys(pubkeys []cryptotypes.PubKey) uint64 { diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index 4d6237f167..ab49a0c693 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -387,7 +387,7 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error { func unmarshalSignatureJSON(clientCtx client.Context, filename string) (sigs []signingtypes.SignatureV2, err error) { var bytes []byte if bytes, err = os.ReadFile(filename); err != nil { - return + return sigs, err } return clientCtx.TxConfig.UnmarshalSignatureJSON(bytes) } diff --git a/x/auth/client/tx.go b/x/auth/client/tx.go index 56d8149244..e0dab99237 100644 --- a/x/auth/client/tx.go +++ b/x/auth/client/tx.go @@ -99,7 +99,7 @@ func ReadTxFromFile(ctx client.Context, filename string) (tx sdk.Tx, err error) } if err != nil { - return + return tx, err } return ctx.TxConfig.TxJSONDecoder()(bytes) diff --git a/x/authz/simulation/msg_factory.go b/x/authz/simulation/msg_factory.go index 47c1ef86b1..7cdcbff895 100644 --- a/x/authz/simulation/msg_factory.go +++ b/x/authz/simulation/msg_factory.go @@ -98,10 +98,10 @@ func findGrant( }) if innerErr != nil { reporter.Skip(innerErr.Error()) - return + return granterAddr, granteeAddr, auth } if auth == nil { reporter.Skip("no grant found") } - return + return granterAddr, granteeAddr, auth } diff --git a/x/bank/keeper/view.go b/x/bank/keeper/view.go index 028dbedaea..ed7d864fa4 100644 --- a/x/bank/keeper/view.go +++ b/x/bank/keeper/view.go @@ -214,10 +214,10 @@ func (k BaseViewKeeper) spendableCoins(ctx context.Context, addr sdk.AccAddress) spendable, hasNeg := total.SafeSub(locked...) if hasNeg { spendable = sdk.NewCoins() - return + return spendable, total } - return + return spendable, total } // ValidateBalance validates all balances for a given account address returning diff --git a/x/distribution/keeper/store.go b/x/distribution/keeper/store.go index 7fc1df657a..b28796ad8d 100644 --- a/x/distribution/keeper/store.go +++ b/x/distribution/keeper/store.go @@ -83,7 +83,7 @@ func (k Keeper) GetDelegatorStartingInfo(ctx context.Context, val sdk.ValAddress store := k.storeService.OpenKVStore(ctx) b, err := store.Get(types.GetDelegatorStartingInfoKey(val, del)) if err != nil { - return + return period, err } err = k.cdc.Unmarshal(b, &period) @@ -133,11 +133,11 @@ func (k Keeper) GetValidatorHistoricalRewards(ctx context.Context, val sdk.ValAd store := k.storeService.OpenKVStore(ctx) b, err := store.Get(types.GetValidatorHistoricalRewardsKey(val, period)) if err != nil { - return + return rewards, err } err = k.cdc.Unmarshal(b, &rewards) - return + return rewards, err } // SetValidatorHistoricalRewards sets historical rewards for a particular period @@ -202,7 +202,7 @@ func (k Keeper) GetValidatorHistoricalReferenceCount(ctx context.Context) (count k.cdc.MustUnmarshal(iter.Value(), &rewards) count += uint64(rewards.ReferenceCount) } - return + return count } // GetValidatorCurrentRewards gets current rewards for a validator @@ -210,11 +210,11 @@ func (k Keeper) GetValidatorCurrentRewards(ctx context.Context, val sdk.ValAddre store := k.storeService.OpenKVStore(ctx) b, err := store.Get(types.GetValidatorCurrentRewardsKey(val)) if err != nil { - return + return rewards, err } err = k.cdc.Unmarshal(b, &rewards) - return + return rewards, err } // SetValidatorCurrentRewards sets current rewards for a validator @@ -265,7 +265,7 @@ func (k Keeper) GetValidatorAccumulatedCommission(ctx context.Context, val sdk.V if err != nil { return types.ValidatorAccumulatedCommission{}, err } - return + return commission, err } // SetValidatorAccumulatedCommission sets accumulated commission for a validator @@ -315,10 +315,10 @@ func (k Keeper) GetValidatorOutstandingRewards(ctx context.Context, val sdk.ValA store := k.storeService.OpenKVStore(ctx) bz, err := store.Get(types.GetValidatorOutstandingRewardsKey(val)) if err != nil { - return + return rewards, err } err = k.cdc.Unmarshal(bz, &rewards) - return + return rewards, err } // SetValidatorOutstandingRewards sets validator outstanding rewards diff --git a/x/distribution/migrations/v1/types.go b/x/distribution/migrations/v1/types.go index 59a0b3b952..1f7c2768f7 100644 --- a/x/distribution/migrations/v1/types.go +++ b/x/distribution/migrations/v1/types.go @@ -80,7 +80,7 @@ func GetDelegatorStartingInfoAddresses(key []byte) (valAddr sdk.ValAddress, delA addr = key[1+v1auth.AddrLen:] kv.AssertKeyLength(addr, v1auth.AddrLen) delAddr = addr - return + return valAddr, delAddr } // GetValidatorHistoricalRewardsAddressPeriod gets the address & period from a validator's historical rewards key @@ -92,7 +92,7 @@ func GetValidatorHistoricalRewardsAddressPeriod(key []byte) (valAddr sdk.ValAddr b := key[1+v1auth.AddrLen:] kv.AssertKeyLength(addr, 8) period = binary.LittleEndian.Uint64(b) - return + return valAddr, period } // GetValidatorCurrentRewardsAddress gets the address from a validator's current rewards key @@ -121,7 +121,7 @@ func GetValidatorSlashEventAddressHeight(key []byte) (valAddr sdk.ValAddress, he kv.AssertKeyAtLeastLength(key, startB+9) b := key[startB : startB+8] // the next 8 bytes represent the height height = binary.BigEndian.Uint64(b) - return + return valAddr, height } // GetValidatorOutstandingRewardsKey gets the outstanding rewards key for a validator diff --git a/x/distribution/types/keys.go b/x/distribution/types/keys.go index 597f9a4900..702e54c64c 100644 --- a/x/distribution/types/keys.go +++ b/x/distribution/types/keys.go @@ -97,7 +97,7 @@ func GetDelegatorStartingInfoAddresses(key []byte) (valAddr sdk.ValAddress, delA delAddr = sdk.AccAddress(key[3+valAddrLen:]) kv.AssertKeyLength(delAddr.Bytes(), delAddrLen) - return + return valAddr, delAddr } // GetValidatorHistoricalRewardsAddressPeriod creates the address & period from a validator's historical rewards key. @@ -111,7 +111,7 @@ func GetValidatorHistoricalRewardsAddressPeriod(key []byte) (valAddr sdk.ValAddr b := key[2+valAddrLen:] kv.AssertKeyLength(b, 8) period = binary.LittleEndian.Uint64(b) - return + return valAddr, period } // GetValidatorCurrentRewardsAddress creates the address from a validator's current rewards key. @@ -152,7 +152,7 @@ func GetValidatorSlashEventAddressHeight(key []byte) (valAddr sdk.ValAddress, he kv.AssertKeyAtLeastLength(key, startB+9) b := key[startB : startB+8] // the next 8 bytes represent the height height = binary.BigEndian.Uint64(b) - return + return valAddr, height } // GetValidatorOutstandingRewardsKey creates the outstanding rewards key for a validator. diff --git a/x/genutil/genesis.go b/x/genutil/genesis.go index 0f8f7d4867..c3bcf77826 100644 --- a/x/genutil/genesis.go +++ b/x/genutil/genesis.go @@ -19,5 +19,5 @@ func InitGenesis( if len(genesisState.GenTxs) > 0 { validators, err = DeliverGenTxs(ctx, genesisState.GenTxs, stakingKeeper, deliverTx, txEncodingConfig) } - return + return validators, err } diff --git a/x/gov/abci.go b/x/gov/abci.go index a411c392a6..da131a441c 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -287,7 +287,7 @@ func safeExecuteHandler(ctx sdk.Context, msg sdk.Msg, handler baseapp.MsgService } }() res, err = handler(ctx, msg) - return + return res, err } // failUnsupportedProposal fails a proposal that cannot be processed by gov diff --git a/x/gov/migrations/v1/types.go b/x/gov/migrations/v1/types.go index 31bfe7b64e..604e9fefdb 100644 --- a/x/gov/migrations/v1/types.go +++ b/x/gov/migrations/v1/types.go @@ -57,7 +57,7 @@ var lenTime = len(sdk.FormatTimeBytes(time.Now())) func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte) { proposalIDBz = make([]byte, 8) binary.BigEndian.PutUint64(proposalIDBz, proposalID) - return + return proposalIDBz } // GetProposalIDFromBytes returns proposalID in uint64 format from a byte array @@ -150,7 +150,7 @@ func splitKeyWithTime(key []byte) (proposalID uint64, endTime time.Time) { } proposalID = GetProposalIDFromBytes(key[1+lenTime:]) - return + return proposalID, endTime } func splitKeyWithAddress(key []byte) (proposalID uint64, addr sdk.AccAddress) { @@ -159,5 +159,5 @@ func splitKeyWithAddress(key []byte) (proposalID uint64, addr sdk.AccAddress) { kv.AssertKeyAtLeastLength(key, 10) proposalID = GetProposalIDFromBytes(key[1:9]) addr = sdk.AccAddress(key[9:]) - return + return proposalID, addr } diff --git a/x/gov/migrations/v4/keys.go b/x/gov/migrations/v4/keys.go index ca4723dda7..0ad676201f 100644 --- a/x/gov/migrations/v4/keys.go +++ b/x/gov/migrations/v4/keys.go @@ -24,5 +24,5 @@ func VotingPeriodProposalKey(proposalID uint64) []byte { func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte) { proposalIDBz = make([]byte, 8) binary.BigEndian.PutUint64(proposalIDBz, proposalID) - return + return proposalIDBz } diff --git a/x/staking/genesis.go b/x/staking/genesis.go index ed8a5505d4..2df87ca39b 100644 --- a/x/staking/genesis.go +++ b/x/staking/genesis.go @@ -38,7 +38,7 @@ func WriteValidators(ctx sdk.Context, keeper *keeper.Keeper) (vals []cmttypes.Ge return nil, err } - return + return vals, returnErr } // ValidateGenesis validates the provided staking genesis state to ensure the diff --git a/x/staking/keeper/alias_functions.go b/x/staking/keeper/alias_functions.go index 4379043cc6..bf28f687db 100644 --- a/x/staking/keeper/alias_functions.go +++ b/x/staking/keeper/alias_functions.go @@ -169,5 +169,5 @@ func (k Keeper) GetAllSDKDelegations(ctx context.Context) (delegations []types.D delegations = append(delegations, delegation) } - return + return delegations, err } diff --git a/x/staking/types/params.go b/x/staking/types/params.go index 2405a80ea1..fa5dcffbe3 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -72,10 +72,10 @@ func MustUnmarshalParams(cdc *codec.LegacyAmino, value []byte) Params { func UnmarshalParams(cdc *codec.LegacyAmino, value []byte) (params Params, err error) { err = cdc.Unmarshal(value, ¶ms) if err != nil { - return + return params, err } - return + return params, err } // Validate validates a set of Params