Skip to content
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
14 changes: 5 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Required: setup-go, for all versions v3.0.0+ of golangci-lint
- uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: '1.24'
check-latest: true
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6.1.2
Expand All @@ -26,14 +25,11 @@ jobs:
go.mod
go.sum
*.toml
- uses: golangci/golangci-lint-action@v6.2.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
args: --timeout 10m
github-token: ${{ secrets.github_token }}
# Check only if there are differences in the source code
- name: run linting
if: env.GIT_DIFF
id: lint_long
run: |
make lint-go
markdown-lint:
name: Run markdown-lint
runs-on: ubuntu-latest
Expand Down
183 changes: 94 additions & 89 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,112 +1,117 @@
version: "2"
run:
tests: true
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m

linters:
disable-all: true
default: none
enable:
- copyloopvar
- dogsled
- errcheck
- copyloopvar
- gci
- goconst
- gocritic
- gofumpt
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- nolintlint
- revive
- staticcheck
- stylecheck
- typecheck
- thelper
- unconvert
- unparam
- unused

settings:
dogsled:
max-blank-identifiers: 3
nolintlint:
require-explanation: false
require-specific: false
allow-unused: false
revive:
severity: warning
rules:
- name: unused-parameter
disabled: true
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unreachable-code
- name: redefines-builtin-id
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- gosec
text: Use of weak random number generator
- linters:
- golint
text: comment on exported var
- linters:
- golint
text: don't use an underscore in package name
- linters:
- staticcheck
text: 'ST1003:'
- linters:
- staticcheck
text: 'ST1016:'
- linters:
- staticcheck
path: migrations
text: 'SA1019:'
paths:
- x/vm/core
- third_party$
- builtin$
- examples$
issues:
exclude-rules:
- text: 'Use of weak random number generator'
linters:
- gosec
- text: 'comment on exported var'
linters:
- golint
- text: "don't use an underscore in package name"
linters:
- golint
- text: 'ST1003:'
linters:
- stylecheck
# FIXME: Disabled until golangci-lint updates stylecheck with this fix:
# https://github.com/dominikh/go-tools/issues/389
- text: 'ST1016:'
linters:
- stylecheck
- path: 'migrations'
text: 'SA1019:'
linters:
- staticcheck
exclude-dirs:
- x/vm/core

max-issues-per-linter: 10000
max-same-issues: 10000

linters-settings:
gci:
custom-order: true
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- blank # blank imports
- dot # dot imports
- prefix(github.com/cometbft/cometbft) # comet
- prefix(github.com/cosmos) # cosmos org
- prefix(cosmossdk.io) # new modules
- prefix(github.com/cosmos/cosmos-sdk) # cosmos sdk
- prefix(github.com/CosmWasm/wasmd) # cosmwasm
- prefix(github.com/cosmos/gaia) # Gaia
dogsled:
max-blank-identifiers: 3
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: false
require-specific: false
revive:
ignore-generated-header: true
severity: warning
rules:
- name: unused-parameter
disabled: true
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unreachable-code
- name: redefines-builtin-id
formatters:
enable:
- gci
- gofumpt
settings:
gci:
sections:
- standard
- default
- blank
- dot
- prefix(github.com/cometbft/cometbft)
- prefix(github.com/cosmos)
- prefix(cosmossdk.io)
- prefix(github.com/cosmos/cosmos-sdk)
- prefix(github.com/CosmWasm/wasmd)
- prefix(github.com/cosmos/gaia)
custom-order: true
exclusions:
generated: lax
paths:
- x/vm/core
- third_party$
- builtin$
- examples$
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ benchmark:
### Linting ###
###############################################################################
golangci_lint_cmd=golangci-lint
golangci_version=v1.64.8
golangci_version=v2.1.6

lint: lint-go lint-python lint-contracts

lint-go:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --timeout=10m

lint-python:
Expand All @@ -184,7 +184,7 @@ lint-contracts:
solhint contracts/**/*.sol

lint-fix:
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --timeout=10m --fix

lint-fix-contracts:
Expand Down
2 changes: 1 addition & 1 deletion ethereum/eip712/eip712_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ func (suite *EIP712TestSuite) TestTypedDataErrorHandling() {

messagesArr.WriteString("[")
for i := 0; i < maxRecursionDepth; i++ {
messagesArr.WriteString(fmt.Sprintf(`{ "type": "msgType", "value": { "field%v": 10 } }`, i))
fmt.Fprintf(messagesArr, `{ "type": "msgType", "value": { "field%v": 10 } }`, i)
if i != maxRecursionDepth-1 {
messagesArr.WriteString(",")
}
Expand Down
4 changes: 2 additions & 2 deletions evmd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -998,14 +998,14 @@ func (app *EVMD) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfi

// RegisterTxService implements the Application.RegisterTxService method.
func (app *EVMD) RegisterTxService(clientCtx client.Context) {
authtx.RegisterTxService(app.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry)
authtx.RegisterTxService(app.GRPCQueryRouter(), clientCtx, app.Simulate, app.interfaceRegistry)
}

// RegisterTendermintService implements the Application.RegisterTendermintService method.
func (app *EVMD) RegisterTendermintService(clientCtx client.Context) {
cmtservice.RegisterTendermintService(
clientCtx,
app.BaseApp.GRPCQueryRouter(),
app.GRPCQueryRouter(),
app.interfaceRegistry,
app.Query,
)
Expand Down
11 changes: 3 additions & 8 deletions evmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (app *EVMD) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddr
AppState: appState,
Validators: validators,
Height: height,
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
ConsensusParams: app.GetConsensusParams(ctx),
}, err
}

Expand All @@ -56,15 +56,10 @@ func (app *EVMD) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddr
//
// in favour of export at a block height
func (app *EVMD) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) error {
applyAllowedAddrs := false

// check if there is a allowed address list
if len(jailAllowedAddrs) > 0 {
applyAllowedAddrs = true
}
applyAllowedAddrs := len(jailAllowedAddrs) > 0

// check if there is an allowed address list
allowedAddrsMap := make(map[string]bool)

for _, addr := range jailAllowedAddrs {
_, err := sdk.ValAddressFromBech32(addr)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions evmd/testutil/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func CommitAndCreateNewCtx(ctx sdk.Context, app *app.EVMD, t time.Duration, vs *
// NewContext function keeps the multistore
// but resets other context fields
// GasMeter is set as InfiniteGasMeter
newCtx := app.BaseApp.NewContextLegacy(false, header)
newCtx := app.NewContextLegacy(false, header)
// set the reseted fields to keep the current ctx settings
newCtx = newCtx.WithMinGasPrices(ctx.MinGasPrices())
newCtx = newCtx.WithEventManager(ctx.EventManager())
Expand Down Expand Up @@ -248,7 +248,7 @@ func checkTxBytes(app *app.EVMD, txEncoder sdk.TxEncoder, tx sdk.Tx) (abci.Respo
}

req := abci.RequestCheckTx{Tx: bz}
res, err := app.BaseApp.CheckTx(&req)
res, err := app.CheckTx(&req)
if err != nil {
return abci.ResponseCheckTx{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion indexer/kv_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewKVIndexer(db dbm.DB, logger log.Logger, clientCtx client.Context) *KVInd
// - Iterates over all the messages of the Tx
// - Builds and stores a indexer.TxResult based on parsed events for every message
func (kv *KVIndexer) IndexBlock(block *cmttypes.Block, txResults []*abci.ExecTxResult) error {
height := block.Header.Height
height := block.Height

batch := kv.db.NewBatch()
defer batch.Close()
Expand Down
4 changes: 2 additions & 2 deletions indexer/kv_indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ func TestKVIndexer(t *testing.T) {
} else {
first, err := idxer.FirstIndexedBlock()
require.NoError(t, err)
require.Equal(t, tc.block.Header.Height, first)
require.Equal(t, tc.block.Height, first)

last, err := idxer.LastIndexedBlock()
require.NoError(t, err)
require.Equal(t, tc.block.Header.Height, last)
require.Equal(t, tc.block.Height, last)

res1, err := idxer.GetByTxHash(txHash)
require.NoError(t, err)
Expand Down
Loading
Loading