Skip to content

chore(lint): clear scoped golangci-lint + buf BRIDGE-surface findings#125

Merged
mateeullahmalik merged 1 commit intomasterfrom
fix/everlight-lint-cleanup
Apr 28, 2026
Merged

chore(lint): clear scoped golangci-lint + buf BRIDGE-surface findings#125
mateeullahmalik merged 1 commit intomasterfrom
fix/everlight-lint-cleanup

Conversation

@mateeullahmalik
Copy link
Copy Markdown
Contributor

Summary

Drops the scoped golangci-lint count from 25 → 0 and clears the BRIDGE-surface buf lint findings the Everlight gate report flagged. No state-machine, schema, or on-chain behavior changes.

Triggered by the post-Everlight gate report (2026-04-28): functional Everlight evidence was already green (PASS: 35 FAIL: 0 SKIP: 5 on devnet, two clean iterations) but OVERALL: FAIL on code-quality.

Scoped lint: 25 → 0

Class Action
Unused state-machine helpers in x/supernode/v1/keeper/metrics_state.go and metrics_validation.go Deleted markStorageFull, recoverFromStorageFull, lastNonDegradedState. The audit module already performs STORAGE_FULL/POSTPONED transitions inline in x/audit/v1/keeper/state.go and enforcement.go.
Unused simulation scaffolding in x/action/v1/simulation/helpers.go and module/simulation.go Deleted generateRandomOtiValues and 6 opWeightMsg*/defaultWeightMsg* consts.
ineffassign in x/supernode/v1/simulation/update_supernode.go Removed dead updateAccount = false branch.
errcheck across 8 scoped action *_test.go and 1 supernode test Wrap k.SetAction / k.SetParams / k.SetSuperNode in require.NoError(t, ...). Tests now fail on store errors instead of silently swallowing them.
SA1019 sdk.WrapSDKContext Removed (5 sites).
SA1019 rand.Seed Replaced with rand.New(rand.NewSource(...)).
SA1019 module.HasInvariants / sdk.InvariantRegistry //nolint:staticcheck with rationale: SDK v0.50 still requires HasInvariants; deprecation only resolves when x/crisis is dropped.

buf lint: BRIDGE surfaces commented

Added doc comments to HashAlgo, RewardDistribution, SuperNodeState, SuperNodeStateRecord.

Out of scope: SUPER_NODE_STATE_* prefix and field_lower_snake_case (actionID → action_id) findings — those are wire-incompatible renames touching every existing client.

Verification

golangci-lint run ./x/action/v1/... ./x/supernode/v1/...    # 0 issues, exit 0
go test ./x/action/v1/... ./x/supernode/v1/... -count=1     # PASS
go test ./tests/integration/everlight ./tests/e2e/everlight \
        ./app/upgrades/v1_12_0 ./tests/integration/action/...  # PASS
go build -tags netgo,ledger -o /tmp/lumerad ./cmd/lumera    # OK

Devnet (make -f Makefile.devnet devnet-tests-everlight) was green on master before this PR (2 consecutive iterations, FAIL=0) and these are scoped lint changes only — no devnet behavioral impact expected.

Risks

Minimal. All deletions are dead code (verified via repo-wide grep for call sites). errcheck/SA1019 changes are mechanical and behavior-preserving. The only behavioral change is positive: tests will fail on swallowed store errors instead of continuing.

Rollback

Single revert. No migration, no upgrade handler, no on-chain effect.

Note on the deleted helpers

metrics_state.go previously shipped markStorageFull/recoverFromStorageFull while x/audit/v1/keeper/state.go:57+enforcement.go:464 performed the same transitions inline. That was a duplicated, drift-prone state-machine surface. Deleting the unused helpers removes the ambiguity. Routing both modules through a single set of helpers (restoring SSoT for SuperNode state transitions) is a worthwhile follow-up but is a larger refactor not in scope here.

- Delete dead state-machine helpers in x/supernode/v1/keeper:
  * metrics_state.go: markStorageFull, recoverFromStorageFull (audit module
    does these inline in x/audit/v1/keeper/state.go and enforcement.go;
    helpers were never wired up).
  * metrics_validation.go: lastNonDegradedState (zero call sites).
- Delete unused x/action/v1 simulation scaffolding:
  * helpers.go: generateRandomOtiValues (unused stub).
  * module/simulation.go: 6 op_weight_msg_* / defaultWeightMsg* consts
    (no scaffolded simulation hooks reference them).
- Fix ineffassign in x/supernode/v1/simulation/update_supernode.go:
  drop dead 'updateAccount = false' branch (supernodeAccount is already
  empty in that path, so the flag was redundant).
- errcheck cleanup in scoped tests: wrap k.SetAction / k.SetParams /
  k.SetSuperNode in require.NoError(t, ...). Behavior preserved; tests
  now fail loudly on store errors instead of silently swallowing them.
- staticcheck SA1019 cleanup:
  * Replace deprecated sdk.WrapSDKContext(ctx) with ctx (5 sites in
    msg_server_report_supernode_metrics_test.go).
  * Replace deprecated rand.Seed in crypto_test.go with
    rand.New(rand.NewSource(...)).
  * Annotate module.HasInvariants / sdk.InvariantRegistry usage with
    //nolint:staticcheck — SDK v0.50 still requires HasInvariants and
    only drops it when x/crisis is removed.
- buf lint: add doc comments on BRIDGE-surface enums/messages
  (HashAlgo, RewardDistribution, SuperNodeState, SuperNodeStateRecord).
  No wire-affecting renames.

Verification:
- golangci-lint run ./x/action/v1/... ./x/supernode/v1/... -> 0 issues
- go test ./x/action/v1/... ./x/supernode/v1/... -count=1 -> PASS
- go test ./tests/integration/everlight ./tests/e2e/everlight     ./app/upgrades/v1_12_0 ./tests/integration/action/... -> PASS
- make build (lumerad) -> OK

No state-machine, no schema, no on-chain behavior changes.

Note: the dead helpers in metrics_state.go/metrics_validation.go are
deleted rather than re-wired because audit-module enforcement already
performs STORAGE_FULL/POSTPONED transitions inline. Routing both
modules through one set of helpers is a separate, larger SSoT refactor
not in scope for this lint cleanup.
@roomote-v0
Copy link
Copy Markdown

roomote-v0 Bot commented Apr 28, 2026

Rooviewer Clock   See task

Reviewed all 20 changed files. No issues found. All changes are mechanical lint fixes, dead code removal (verified zero call sites), errcheck wrapping in tests, and proto doc comments with no wire-format impact. LGTM.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

mateeullahmalik added a commit that referenced this pull request Apr 28, 2026
The previous attempt failed CI with:

  Error: can't load config: the Go language version (go1.24) used to
  build golangci-lint is lower than the targeted Go version (1.25.9)

Root cause: golangci-lint v1.64.8 (the latest v1.x release) is itself
compiled against Go 1.24. When it loads a module whose go.mod declares
`go 1.25.9` (Lumera's case), it refuses with the version-mismatch
error above. Removing the `go:` pin from .golangci.yml didn't help
because v1 reads the version from go.mod when the config doesn't
override it.

The fix is to bump to golangci-lint v2.x, which is built with Go 1.25+.
v2 ships a breaking config-schema change, so this commit also rewrites
.golangci.yml to the v2 schema:

- Add `version: "2"` at top level.
- Move `linters.disable-all: true` -> `linters.default: none`.
- Move `linters-settings` -> `linters.settings`.
- Move `issues.exclude-rules` -> `linters.exclusions.rules`.
- Drop `exclude-use-default: false` (replaced by `exclusions.generated: lax`).

Same rule set, same exclusions, same effective behavior. Pinned to
v2.0.2 (first stable v2.x release).

Verified locally: the new config loads cleanly under v2.0.2 and reports
the expected baseline findings on master (which #125 cleans).

No change to the workflow's diff-only semantics: still
filter_mode=added, reporter=github-pr-review, fail_level=error.
mateeullahmalik added a commit that referenced this pull request Apr 28, 2026
v2.0.2 was itself built with Go 1.24 — same root cause as v1.64.8 but a
release later. golangci-lint refuses any config whose targeted Go
version is higher than the binary's own build version, regardless of
whether that target comes from go.mod or .golangci.yml.

v2.11.4 is built with Go 1.26.1 (>= our chain's Go 1.25.9), so the
version guard passes.

Verified locally: config loads, linter runs, exits 0 with the expected
master-baseline findings (which #125 cleans).
@mateeullahmalik mateeullahmalik merged commit 0e26b4a into master Apr 28, 2026
16 checks passed
akobrin1 added a commit that referenced this pull request May 1, 2026
Brings master's LEP-6 audit storage-truth scaffolding (#117), recent devnet
test fixes (#123, #124), and scoped lint cleanup (#125) onto the evm branch.

Conflict resolutions:
- .gitignore: union of both sides, deduped, fixed .codex/.agents (file vs dir)
- devnet/go.mod: master's lumera-only replace, kept evm's local sdk-go replace
  (devnet evmigration tests use BuildAndSignTxWithOptions only on local sdk-go);
  cosmos-sdk pinned to evm's v0.53.6.
- supernode-setup.sh: folded master's EVERLIGHT_TEST_TARGET host_reporter
  bypass into evm's start_supernode_process abstraction so all call sites
  honor the env var.
- audit_peer_ports / audit_recovery system tests: kept evm's wider epoch
  windows + multi-node assignment-aware reporting (the EVM-integrated binary
  is slower; tighter epochs flake).
- distribution_freshness / query_get_reward_eligibility tests: kept evm's
  Bech32-prefixed config constants (master's lcfg.ValidatorAddressPrefix
  doesn't compile on evm).
- metrics_state.go / metrics_validation.go: kept evm's reserved
  STORAGE_FULL helpers (markStorageFull, recoverFromStorageFull,
  lastNonDegradedState) for follow-up audit-enforcement wiring.
- testutil/cryptotestutils → testutil/crypto: rewrote 3 master-side import
  paths to evm's renamed directory.
- Dropped master's duplicate indexOfModule from lep6_module_order_test.go
  in favor of the existing helper in app/evm_test.go.

Lint cleanup applied to bring `make lint` to 0 issues:
- defer it.Close() → defer func() { _ = it.Close() }() across audit module.
- gofmt -w on master-side test/sim files.
- Removed unused //nolint:staticcheck directives on HasInvariants.
- Marked reserved declarations (maxAuditEpochLookback, globalAuditKeeper)
  with //nolint:unused.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant