chore: bump linter (#25424)

This commit is contained in:
Alex | Cosmos Labs 2025-10-10 08:52:49 -04:00 committed by GitHub
parent 67d2d0ae97
commit ee19321c80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
44 changed files with 82 additions and 82 deletions

View File

@ -379,7 +379,7 @@ benchmark:
### Linting ###
###############################################################################
golangci_version=v2.4.0
golangci_version=v2.5.0
lint-install:
@echo "--> Installing golangci-lint $(golangci_version)"

View File

@ -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
})
}

View File

@ -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.

View File

@ -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 {

View File

@ -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
}

View File

@ -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)

View File

@ -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.

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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
}
//-----------------------------------------------------------------

View File

@ -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.

View File

@ -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

View File

@ -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) {

View File

@ -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
}

View File

@ -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

View File

@ -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,

View File

@ -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 }

View File

@ -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

View File

@ -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
}

View File

@ -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) {}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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 {

View File

@ -105,7 +105,7 @@ func depsFromBuildInfo() (deps []buildDep) {
deps = append(deps, buildDep{dep})
}
return
return deps
}
type buildDep struct {

View File

@ -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 {

View File

@ -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)
}

View File

@ -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)

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -19,5 +19,5 @@ func InitGenesis(
if len(genesisState.GenTxs) > 0 {
validators, err = DeliverGenTxs(ctx, genesisState.GenTxs, stakingKeeper, deliverTx, txEncodingConfig)
}
return
return validators, err
}

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -169,5 +169,5 @@ func (k Keeper) GetAllSDKDelegations(ctx context.Context) (delegations []types.D
delegations = append(delegations, delegation)
}
return
return delegations, err
}

View File

@ -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, &params)
if err != nil {
return
return params, err
}
return
return params, err
}
// Validate validates a set of Params