Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix and update linter #7792

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/callbacks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fetch-depth: 0
- uses: golangci/[email protected]
with:
version: v1.60
version: v1.62
only-new-issues: true
args: --timeout 5m
working-directory: modules/apps/callbacks
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2emodule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fetch-depth: 0
- uses: golangci/[email protected]
with:
version: v1.60
version: v1.62
only-new-issues: true
args: --timeout 5m
working-directory: e2e/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.60
version: v1.62
only-new-issues: true
args: --timeout 10m
2 changes: 1 addition & 1 deletion .github/workflows/golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.60
version: v1.62
only-new-issues: true
args: --timeout 10m
2 changes: 1 addition & 1 deletion .github/workflows/wasm-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fetch-depth: 0
- uses: golangci/[email protected]
with:
version: v1.60
version: v1.62
only-new-issues: true
args: --timeout 10m
working-directory: modules/light-clients/08-wasm
Expand Down
6 changes: 3 additions & 3 deletions modules/apps/29-fee/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (k Keeper) TotalRecvFees(ctx context.Context, req *types.QueryTotalRecvFees

feesInEscrow, found := k.GetFeesInEscrow(ctx, req.PacketId)
if !found {
return nil, status.Errorf(
return nil, status.Error(
codes.NotFound,
errorsmod.Wrapf(types.ErrFeeNotFound, "channel: %s, port: %s, sequence: %d", req.PacketId.ChannelId, req.PacketId.PortId, req.PacketId.Sequence).Error(),
)
Expand All @@ -142,7 +142,7 @@ func (k Keeper) TotalAckFees(ctx context.Context, req *types.QueryTotalAckFeesRe

feesInEscrow, found := k.GetFeesInEscrow(ctx, req.PacketId)
if !found {
return nil, status.Errorf(
return nil, status.Error(
codes.NotFound,
errorsmod.Wrapf(types.ErrFeeNotFound, "channel: %s, port: %s, sequence: %d", req.PacketId.ChannelId, req.PacketId.PortId, req.PacketId.Sequence).Error(),
)
Expand All @@ -166,7 +166,7 @@ func (k Keeper) TotalTimeoutFees(ctx context.Context, req *types.QueryTotalTimeo

feesInEscrow, found := k.GetFeesInEscrow(ctx, req.PacketId)
if !found {
return nil, status.Errorf(
return nil, status.Error(
codes.NotFound,
errorsmod.Wrapf(types.ErrFeeNotFound, "channel: %s, port: %s, sequence: %d", req.PacketId.ChannelId, req.PacketId.PortId, req.PacketId.Sequence).Error(),
)
Expand Down
10 changes: 5 additions & 5 deletions modules/core/04-channel/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func (k *Keeper) GetAllPacketAckSeqs(ctx context.Context) (seqs []types.PacketSe
func (k *Keeper) IteratePacketCommitment(ctx context.Context, cb func(portID, channelID string, sequence uint64, hash []byte) bool) {
store := runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx))
iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyPacketCommitmentPrefix))
k.iterateHashes(ctx, iterator, cb)
k.iterateHashes(iterator, cb)
}

// GetAllPacketCommitments returns all stored PacketCommitments objects.
Expand All @@ -388,7 +388,7 @@ func (k *Keeper) GetAllPacketCommitments(ctx context.Context) (commitments []typ
func (k *Keeper) IteratePacketCommitmentAtChannel(ctx context.Context, portID, channelID string, cb func(_, _ string, sequence uint64, hash []byte) bool) {
store := runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx))
iterator := storetypes.KVStorePrefixIterator(store, host.PacketCommitmentPrefixKey(portID, channelID))
k.iterateHashes(ctx, iterator, cb)
k.iterateHashes(iterator, cb)
}

// GetAllPacketCommitmentsAtChannel returns all stored PacketCommitments objects for a specified
Expand All @@ -408,7 +408,7 @@ func (k *Keeper) GetAllPacketCommitmentsAtChannel(ctx context.Context, portID, c
func (k *Keeper) IteratePacketReceipt(ctx context.Context, cb func(portID, channelID string, sequence uint64, receipt []byte) bool) {
store := runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx))
iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyPacketReceiptPrefix))
k.iterateHashes(ctx, iterator, cb)
k.iterateHashes(iterator, cb)
}

// GetAllPacketReceipts returns all stored PacketReceipt objects.
Expand All @@ -427,7 +427,7 @@ func (k *Keeper) GetAllPacketReceipts(ctx context.Context) (receipts []types.Pac
func (k *Keeper) IteratePacketAcknowledgement(ctx context.Context, cb func(portID, channelID string, sequence uint64, hash []byte) bool) {
store := runtime.KVStoreAdapter(k.KVStoreService.OpenKVStore(ctx))
iterator := storetypes.KVStorePrefixIterator(store, []byte(host.KeyPacketAckPrefix))
k.iterateHashes(ctx, iterator, cb)
k.iterateHashes(iterator, cb)
}

// GetAllPacketAcks returns all stored PacketAcknowledgements objects.
Expand Down Expand Up @@ -688,7 +688,7 @@ func (k *Keeper) GetParams(ctx context.Context) types.Params {
}

// common functionality for IteratePacketCommitment and IteratePacketAcknowledgement
func (k *Keeper) iterateHashes(ctx context.Context, iterator db.Iterator, cb func(portID, channelID string, sequence uint64, hash []byte) bool) {
func (k *Keeper) iterateHashes(iterator db.Iterator, cb func(portID, channelID string, sequence uint64, hash []byte) bool) {
defer coretypes.LogDeferred(k.Logger, func() error { return iterator.Close() })

for ; iterator.Valid(); iterator.Next() {
Expand Down
6 changes: 3 additions & 3 deletions modules/core/24-host/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var IsValidID = regexp.MustCompile(`^[a-zA-Z0-9\.\_\+\-\#\[\]\<\>]+$`).MatchStri
// ValidateFn function type to validate path and identifier bytestrings
type ValidateFn func(string) error

func defaultIdentifierValidator(id string, min, max int) error {
func defaultIdentifierValidator(id string, minLength, maxLength int) error {
if strings.TrimSpace(id) == "" {
return errorsmod.Wrap(ErrInvalidID, "identifier cannot be blank")
}
Expand All @@ -45,8 +45,8 @@ func defaultIdentifierValidator(id string, min, max int) error {
return errorsmod.Wrapf(ErrInvalidID, "identifier %s cannot contain separator '/'", id)
}
// valid id must fit the length requirements
if len(id) < min || len(id) > max {
return errorsmod.Wrapf(ErrInvalidID, "identifier %s has invalid length: %d, must be between %d-%d characters", id, len(id), min, max)
if len(id) < minLength || len(id) > maxLength {
return errorsmod.Wrapf(ErrInvalidID, "identifier %s has invalid length: %d, must be between %d-%d characters", id, len(id), minLength, maxLength)
}
// valid id must contain only alphanumeric characters and some allowed symbols.
if !IsValidID(id) {
Expand Down
2 changes: 1 addition & 1 deletion modules/light-clients/07-tendermint/client_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (cs ClientState) Validate() error {
}

if err := light.ValidateTrustLevel(cs.TrustLevel.ToTendermint()); err != nil {
return errorsmod.Wrapf(ErrInvalidTrustLevel, err.Error())
return errorsmod.Wrap(ErrInvalidTrustLevel, err.Error())
}
if cs.TrustingPeriod <= 0 {
return errorsmod.Wrap(ErrInvalidTrustingPeriod, "trusting period must be greater than zero")
Expand Down
Loading