Skip to content

feat: update linter#1826

Merged
thomas-nguy merged 10 commits into
crypto-org-chain:mainfrom
thomas-nguy:thomas/update-lint
Jul 1, 2025
Merged

feat: update linter#1826
thomas-nguy merged 10 commits into
crypto-org-chain:mainfrom
thomas-nguy:thomas/update-lint

Conversation

@thomas-nguy

@thomas-nguy thomas-nguy commented Jun 27, 2025

Copy link
Copy Markdown
Collaborator

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

  • Chores
    • Upgraded and extensively restructured linting configuration, including new linters, formatting rules, and exclusions.
    • Updated tooling and workflows to use the latest linter version and improved output formatting.
    • Improved Makefile with new linting commands and installation target.
    • Updated changelog to reflect linter and codebase tidying.
  • Refactor
    • Simplified function and method signatures for improved readability.
    • Enhanced error handling and assertions in tests for better robustness.
    • Removed redundant types and variables.
  • Style
    • Reorganized and cleaned up import statements across many files for consistency and clarity.
  • Bug Fixes
    • Improved error wrapping and checking in select functions and tests.
    • Added error handling for resource cleanup and initialization steps to prevent silent failures.

@thomas-nguy
thomas-nguy requested a review from a team as a code owner June 27, 2025 08:06
@thomas-nguy
thomas-nguy requested review from JayT106 and songgaoye and removed request for a team June 27, 2025 08:06
@thomas-nguy
thomas-nguy marked this pull request as draft June 27, 2025 08:07
@coderabbitai

coderabbitai Bot commented Jun 27, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This update reorganizes and simplifies import statements across many files, updates and restructures linting configurations for golangci-lint v2, and improves error handling in tests. Several function and method signatures are made more concise, and Makefile linting targets are updated. No major control flow or business logic changes are introduced.

Changes

File(s) / Group Change Summary
.github/workflows/lint.yml, Makefile, nix/golangci-lint.nix, .golangci.yml Upgraded golangci-lint to v2, restructured lint config, changed output formatting, updated install/version/flags.
CHANGELOG.md Added changelog entry for linter update and codebase tidying.
app/app.go, app/export.go, app/storeloader.go, app/test_helpers.go, app/bench_test.go, app/sim_test.go, app/block_address.go, app/legacy.go, app/legacy_test.go, app/prefix.go, app/proposal.go, app/proposal_test.go, app/state.go, app/upgrades.go, app/upgrades_test.go, app/versiondb.go Reorganized import statements for clarity and style; minor signature simplifications; improved error handling in tests.
cmd/cronosd/cmd/root.go, cmd/cronosd/main.go, cmd/cronosd/opendb/opendb.go, cmd/cronosd/opendb/opendb_rocksdb.go Reordered and grouped import statements; added/clarified comments.
testutil/simapp/simapp.go Reordered imports; added error handling for chain initialization.
x/cronos/client/cli/*.go, x/cronos/client/proposal_handler.go Reordered and grouped import statements for consistency.
x/cronos/events/decoders.go, x/cronos/events/events.go Reordered imports for clarity.
x/cronos/genesis.go, x/cronos/handler_test.go, x/cronos/keeper/evm.go, x/cronos/keeper/evm_hooks.go, x/cronos/keeper/evm_test.go, x/cronos/keeper/evmhandlers/.go, x/cronos/keeper/grpc_query.go, x/cronos/keeper/ibc.go, x/cronos/keeper/ibc_test.go, x/cronos/keeper/keeper.go, x/cronos/keeper/keeper_test.go, x/cronos/keeper/migrations.go, x/cronos/keeper/mock/ibckeeper_mock.go, x/cronos/keeper/msg_server.go, x/cronos/keeper/msg_server_test.go, x/cronos/keeper/params.go, x/cronos/keeper/params_test.go, x/cronos/keeper/permissions.go, x/cronos/keeper/permissions_test.go, x/cronos/keeper/precompiles/.go, x/cronos/middleware/conversion_middleware.go, x/cronos/migrations/v2/migrate.go, x/cronos/migrations/v2/migrate_test.go, x/cronos/module.go, x/cronos/proposal_handler.go, x/cronos/rpc/api.go, x/cronos/simulation/*.go, x/cronos/types/codec.go, x/cronos/types/contracts.go, x/cronos/types/events.go, x/cronos/types/genesis_test.go, x/cronos/types/interfaces.go, x/cronos/types/messages.go, x/cronos/types/messages_test.go, x/cronos/types/params_test.go, x/cronos/types/proposal.go, x/cronos/types/tracer.go, x/cronos/types/types_test.go Reordered/grouped imports; concise parameter declarations in functions and interfaces; removed redundant code in tests; improved error handling in test cases.
x/e2ee/client/cli/*.go, x/e2ee/keeper/keeper.go, x/e2ee/keyring/keyring.go, x/e2ee/keyring/keyring_test.go, x/e2ee/module.go, x/e2ee/types/msg.go Reordered/grouped imports; removed nolint directive; added error assertions in tests; improved error wrapping.
store/memiavlstore/store.go Added error handling for iterator Close() in Query method; updated method comments to name methods explicitly.
versiondb/backend_test_utils.go, versiondb/extsort/sort_test.go Added t.Helper() calls in test helper functions for improved test reporting.
versiondb/store.go Updated method comments to explicitly name the methods they document without changing implementations.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Makefile
    participant GitHub Actions
    participant golangci-lint

    Developer->>Makefile: Run `make lint` or `make lint-fix`
    Makefile->>golangci-lint: Invoke with updated flags and config
    Developer->>GitHub Actions: Push code/PR
    GitHub Actions->>golangci-lint: Run with new output formatting
    golangci-lint-->>GitHub Actions/Developer: Output lint results as plain text
Loading

Suggested reviewers

  • JayT106
  • leejw51crypto

Poem

A rabbit hops through code so neat,
Imports in order, no tangled feet.
Linters upgraded, errors in check,
Tests now fail fast—no silent wreck.
With every hop, the code grows bright,
Tidied and trimmed, a developer's delight!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc9c157 and a4bb189.

📒 Files selected for processing (8)
  • app/bench_test.go (3 hunks)
  • testutil/simapp/simapp.go (2 hunks)
  • versiondb/client/convert_to_sst.go (3 hunks)
  • versiondb/client/dump.go (1 hunks)
  • versiondb/client/restore_app_db.go (2 hunks)
  • versiondb/client/verify.go (1 hunks)
  • x/cronos/keeper/precompiles/relayer.go (2 hunks)
  • x/cronos/types/messages.go (5 hunks)
✅ Files skipped from review due to trivial changes (1)
  • versiondb/client/convert_to_sst.go
🚧 Files skipped from review as they are similar to previous changes (7)
  • versiondb/client/verify.go
  • versiondb/client/restore_app_db.go
  • versiondb/client/dump.go
  • x/cronos/keeper/precompiles/relayer.go
  • testutil/simapp/simapp.go
  • app/bench_test.go
  • x/cronos/types/messages.go
⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: integration_tests (ibc_timeout)
  • GitHub Check: integration_tests (gas)
  • GitHub Check: integration_tests (upgrade)
  • GitHub Check: integration_tests (ibc_rly_evm)
  • GitHub Check: integration_tests (ibc_update_client)
  • GitHub Check: integration_tests (gov)
  • GitHub Check: integration_tests (ibc_rly_gas)
  • GitHub Check: integration_tests (ica)
  • GitHub Check: integration_tests (slow)
  • GitHub Check: integration_tests (ibc)
  • GitHub Check: integration_tests (unmarked)
  • GitHub Check: Run golangci-lint
  • GitHub Check: Analyze (go)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-latest)
  • GitHub Check: unittest
  • GitHub Check: build (macos-14)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov

codecov Bot commented Jun 27, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 48.21429% with 29 lines in your changes missing coverage. Please review.

Project coverage is 35.59%. Comparing base (a3c2f70) to head (a4bb189).
Report is 85 commits behind head on main.

Files with missing lines Patch % Lines
store/memiavlstore/store.go 0.00% 4 Missing ⚠️
store/rootmulti/import.go 0.00% 3 Missing ⚠️
testutil/simapp/simapp.go 0.00% 3 Missing ⚠️
versiondb/client/restore.go 0.00% 3 Missing ⚠️
versiondb/client/changeset.go 60.00% 2 Missing ⚠️
versiondb/client/convert_to_sst.go 0.00% 2 Missing ⚠️
x/cronos/keeper/msg_server.go 0.00% 2 Missing ⚠️
app/storeloader.go 0.00% 1 Missing ⚠️
memiavl/db.go 0.00% 1 Missing ⚠️
store/rootmulti/snapshot.go 0.00% 1 Missing ⚠️
... and 7 more
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1826       +/-   ##
===========================================
+ Coverage   16.87%   35.59%   +18.71%     
===========================================
  Files          72      127       +55     
  Lines        6163    11963     +5800     
===========================================
+ Hits         1040     4258     +3218     
- Misses       5000     7277     +2277     
- Partials      123      428      +305     
Files with missing lines Coverage Δ
app/block_address.go 21.73% <ø> (ø)
app/export.go 0.00% <ø> (ø)
app/legacy.go 100.00% <ø> (ø)
app/proposal.go 32.45% <ø> (+14.03%) ⬆️
app/state.go 0.00% <ø> (ø)
app/upgrades.go 43.90% <ø> (+38.56%) ⬆️
app/versiondb.go 83.78% <ø> (ø)
memiavl/export.go 67.04% <100.00%> (ø)
memiavl/layout_little_endian.go 100.00% <ø> (ø)
memiavl/mem_node.go 94.95% <ø> (ø)
... and 74 more

... and 25 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thomas-nguy
thomas-nguy marked this pull request as ready for review June 30, 2025 07:19
@github-actions

This comment has been minimized.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🔭 Outside diff range comments (1)
app/storeloader.go (1)

22-32: Nil-pointer panic risk when storeUpgrades is nil

storeUpgrades is a pointer, but the closure dereferences it immediately (len(storeUpgrades.Renamed) …).
If a caller passes nil (which is legal for pointer params in Go), the node will panic at runtime.

@@
 	return func(ms storetypes.CommitMultiStore) error {
+		// Guard against nil pointer to avoid runtime panic.
+		if storeUpgrades == nil {
+			return MaxVersionStoreLoader(version)(ms)
+		}
 		if upgradeHeight == ms.LastCommitID().Version+1 {
 			// Check if the current commit version and upgrade height matches
 			if len(storeUpgrades.Renamed) > 0 || len(storeUpgrades.Deleted) > 0 || len(storeUpgrades.Added) > 0 {
 				return ms.LoadLatestVersionAndUpgrade(storeUpgrades)
 			}
 		}
🧹 Nitpick comments (2)
.github/workflows/lint.yml (1)

49-56: LGTM: Updated golangci-lint output format for v2 compatibility

The output format has been correctly updated from --out-format=github-actions to --output.text.path stdout across all lint runs, which aligns with the golangci-lint v2 upgrade mentioned in the PR objectives.

Note: The pipeline failure shows a CodeQL deprecation warning that's unrelated to these linter changes but should be addressed in a separate update.

.golangci.yml (1)

143-143: Add missing newline at end of file.

The YAML file should end with a newline character as flagged by yamllint.

       - ./pystarport/*
+
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 787dd00 and 2869785.

📒 Files selected for processing (94)
  • .github/workflows/lint.yml (1 hunks)
  • .golangci.yml (1 hunks)
  • CHANGELOG.md (1 hunks)
  • Makefile (2 hunks)
  • app/app.go (2 hunks)
  • app/bench_test.go (3 hunks)
  • app/block_address.go (1 hunks)
  • app/export.go (2 hunks)
  • app/legacy.go (1 hunks)
  • app/legacy_test.go (1 hunks)
  • app/prefix.go (1 hunks)
  • app/proposal.go (1 hunks)
  • app/proposal_test.go (1 hunks)
  • app/sim_test.go (3 hunks)
  • app/state.go (1 hunks)
  • app/storeloader.go (2 hunks)
  • app/test_helpers.go (3 hunks)
  • app/upgrades.go (1 hunks)
  • app/upgrades_test.go (1 hunks)
  • app/versiondb.go (1 hunks)
  • cmd/cronosd/cmd/root.go (1 hunks)
  • cmd/cronosd/main.go (1 hunks)
  • cmd/cronosd/opendb/opendb.go (1 hunks)
  • cmd/cronosd/opendb/opendb_rocksdb.go (1 hunks)
  • nix/golangci-lint.nix (1 hunks)
  • testutil/simapp/simapp.go (2 hunks)
  • x/cronos/client/cli/query.go (1 hunks)
  • x/cronos/client/cli/tx.go (1 hunks)
  • x/cronos/client/proposal_handler.go (1 hunks)
  • x/cronos/events/decoders.go (1 hunks)
  • x/cronos/events/events.go (1 hunks)
  • x/cronos/genesis.go (1 hunks)
  • x/cronos/handler_test.go (1 hunks)
  • x/cronos/keeper/evm.go (2 hunks)
  • x/cronos/keeper/evm_hooks.go (1 hunks)
  • x/cronos/keeper/evm_hooks_test.go (3 hunks)
  • x/cronos/keeper/evm_test.go (1 hunks)
  • x/cronos/keeper/evmhandlers/send_cro_to_ibc.go (1 hunks)
  • x/cronos/keeper/evmhandlers/send_to_account.go (1 hunks)
  • x/cronos/keeper/evmhandlers/send_to_ibc.go (1 hunks)
  • x/cronos/keeper/evmhandlers/send_to_ibc_v2.go (1 hunks)
  • x/cronos/keeper/evmhandlers_test.go (11 hunks)
  • x/cronos/keeper/grpc_query.go (1 hunks)
  • x/cronos/keeper/ibc.go (1 hunks)
  • x/cronos/keeper/ibc_test.go (6 hunks)
  • x/cronos/keeper/keeper.go (1 hunks)
  • x/cronos/keeper/keeper_test.go (6 hunks)
  • x/cronos/keeper/migrations.go (1 hunks)
  • x/cronos/keeper/mock/ibckeeper_mock.go (1 hunks)
  • x/cronos/keeper/msg_server.go (2 hunks)
  • x/cronos/keeper/msg_server_test.go (0 hunks)
  • x/cronos/keeper/params.go (1 hunks)
  • x/cronos/keeper/params_test.go (1 hunks)
  • x/cronos/keeper/permissions.go (1 hunks)
  • x/cronos/keeper/permissions_test.go (1 hunks)
  • x/cronos/keeper/precompiles/bank.go (1 hunks)
  • x/cronos/keeper/precompiles/ica.go (1 hunks)
  • x/cronos/keeper/precompiles/interface.go (1 hunks)
  • x/cronos/keeper/precompiles/relayer.go (2 hunks)
  • x/cronos/keeper/precompiles/utils.go (1 hunks)
  • x/cronos/middleware/conversion_middleware.go (1 hunks)
  • x/cronos/migrations/v2/migrate.go (1 hunks)
  • x/cronos/migrations/v2/migrate_test.go (2 hunks)
  • x/cronos/module.go (1 hunks)
  • x/cronos/proposal_handler.go (1 hunks)
  • x/cronos/rpc/api.go (2 hunks)
  • x/cronos/simulation/decoder.go (1 hunks)
  • x/cronos/simulation/decoder_test.go (1 hunks)
  • x/cronos/simulation/genesis.go (1 hunks)
  • x/cronos/simulation/genesis_test.go (1 hunks)
  • x/cronos/simulation/operations.go (1 hunks)
  • x/cronos/types/codec.go (0 hunks)
  • x/cronos/types/contracts.go (1 hunks)
  • x/cronos/types/events.go (1 hunks)
  • x/cronos/types/genesis_test.go (0 hunks)
  • x/cronos/types/interfaces.go (2 hunks)
  • x/cronos/types/messages.go (5 hunks)
  • x/cronos/types/messages_test.go (1 hunks)
  • x/cronos/types/params_test.go (1 hunks)
  • x/cronos/types/proposal.go (1 hunks)
  • x/cronos/types/tracer.go (1 hunks)
  • x/cronos/types/types_test.go (0 hunks)
  • x/e2ee/client/cli/decrypt.go (1 hunks)
  • x/e2ee/client/cli/encrypt.go (1 hunks)
  • x/e2ee/client/cli/encrypt_to_validators.go (1 hunks)
  • x/e2ee/client/cli/generate.go (1 hunks)
  • x/e2ee/client/cli/pubkey.go (1 hunks)
  • x/e2ee/client/cli/query.go (1 hunks)
  • x/e2ee/client/cli/tx.go (1 hunks)
  • x/e2ee/keeper/keeper.go (1 hunks)
  • x/e2ee/keyring/keyring.go (1 hunks)
  • x/e2ee/keyring/keyring_test.go (1 hunks)
  • x/e2ee/module.go (1 hunks)
  • x/e2ee/types/msg.go (2 hunks)
💤 Files with no reviewable changes (4)
  • x/cronos/types/codec.go
  • x/cronos/keeper/msg_server_test.go
  • x/cronos/types/genesis_test.go
  • x/cronos/types/types_test.go
🧰 Additional context used
🧠 Learnings (6)
app/storeloader.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:193-194
Timestamp: 2024-10-04T16:08:45.617Z
Learning: In Go version 1.21 and later, the `max` function is defined and available.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:193-194
Timestamp: 2024-10-08T19:00:42.142Z
Learning: In Go version 1.21 and later, the `max` function is defined and available.
app/bench_test.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-12T22:09:46.096Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-04T16:09:08.694Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
x/cronos/migrations/v2/migrate_test.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-12T22:09:46.096Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-04T16:09:08.694Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
x/cronos/keeper/ibc_test.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-12T22:09:46.096Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-04T16:09:08.694Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
x/cronos/keeper/evmhandlers_test.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-12T22:09:46.096Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-04T16:09:08.694Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
x/cronos/types/params_test.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-12T22:09:46.096Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-04T16:09:08.694Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
🧬 Code Graph Analysis (6)
app/bench_test.go (1)
store/setup.go (1)
  • FlagMemIAVL (18-18)
x/cronos/keeper/ibc_test.go (2)
x/cronos/types/params.go (1)
  • IbcCroDenomDefaultValue (26-26)
x/cronos/types/keys.go (1)
  • ModuleName (9-9)
x/cronos/keeper/evmhandlers_test.go (3)
x/cronos/types/interfaces.go (2)
  • CronosKeeper (73-75)
  • BankKeeper (24-34)
x/cronos/types/keys.go (1)
  • ModuleName (9-9)
x/cronos/types/params.go (1)
  • IbcCroDenomDefaultValue (26-26)
x/cronos/keeper/keeper_test.go (1)
x/cronos/types/params.go (1)
  • IbcCroDenomDefaultValue (26-26)
x/cronos/keeper/msg_server.go (1)
x/cronos/keeper/permissions.go (1)
  • CanChangeTokenMapping (14-14)
app/test_helpers.go (1)
x/cronos/types/interfaces.go (1)
  • BankKeeper (24-34)
🪛 GitHub Actions: Run Gosec
.github/workflows/lint.yml

[error] 1-1: CodeQL Action major versions v1 and v2 have been deprecated. Please update all occurrences of the CodeQL Action in your workflow files to v3.

🪛 YAMLlint (1.37.1)
.golangci.yml

[error] 143-143: no new line character at the end of file

(new-line-at-end-of-file)

⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: Run golangci-lint
  • GitHub Check: integration_tests (ica)
  • GitHub Check: integration_tests (gas)
  • GitHub Check: integration_tests (ibc_update_client)
  • GitHub Check: integration_tests (upgrade)
  • GitHub Check: integration_tests (gov)
  • GitHub Check: integration_tests (slow)
  • GitHub Check: integration_tests (unmarked)
  • GitHub Check: integration_tests (ibc_rly_evm)
  • GitHub Check: integration_tests (ibc_timeout)
  • GitHub Check: integration_tests (ibc_rly_gas)
  • GitHub Check: integration_tests (ibc)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (macos-latest)
  • GitHub Check: unittest
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: Analyze (go)
🔇 Additional comments (113)
x/cronos/events/decoders.go (1)

15-18: Import-only change looks good

Purely re-ordering the third-party imports keeps build behavior intact and aligns with goimports grouping. No further action required.

app/proposal_test.go (1)

8-9: Import reordered to comply with go-imports – looks good.

The testify/require import is now grouped with standard-library imports, matching Go convention and avoiding future linter noise. No functional impact.

x/cronos/genesis.go (1)

9-10: Import re-ordering aligns with goimports/lint expectations – looks good.

The change is purely cosmetic, keeps the block deterministically sorted, and has no functional impact. 👍

x/cronos/keeper/mock/ibckeeper_mock.go (1)

8-10: Import re-ordering LGTM

Grouping the aliased sdk import into its own block is consistent with goimports output and doesn’t affect behaviour.

x/cronos/types/proposal.go (1)

7-9: LGTM – import grouping looks consistent with the updated linter rules

The reorder has no functional impact and appears to follow the new import-ordering convention introduced in this PR.

app/state.go (1)

6-7: LGTM! Import reorganization improves code organization.

The reordering of the evmtypes import with proper spacing follows Go import grouping conventions and aligns with the linter update objectives. This change enhances code readability without affecting functionality.

app/proposal.go (1)

11-14: LGTM! Import reordering aligns with linting standards.

The reorganization of import statements is a harmless stylistic improvement that enhances code consistency and readability. This change is typical of automated linting tools and follows Go import grouping conventions.

app/upgrades.go (1)

8-10: LGTM! Clean import reorganization.

The import reordering follows Go conventions by properly grouping third-party imports. Both icahosttypes and evmtypes imports are correctly used in the code and the changes align with the linter update objectives.

Also applies to: 14-14

app/storeloader.go (1)

22-22: Parameter list simplification looks good

The condensed parameter list (version, upgradeHeight int64) improves readability without affecting functionality.

app/bench_test.go (4)

17-29: LGTM! Import reorganization improves code clarity.

The import statements have been properly reorganized with clear separation between different package groups.


43-53: Well-implemented replacement for AppOptionsMap.

The MinimalOptionsMap type correctly implements the servertypes.AppOptions interface with a clean, simple design. The explicit interface{}(nil) return is clear about the intent when keys are not found.


57-57: Good practice: Adding Helper() call to benchmark function.

Marking benchmark functions as helpers improves test diagnostics by excluding them from failure stack traces.


100-100: Good practice: Adding Helper() call to benchmark helper function.

Properly marking this function as a test helper for better test output clarity.

app/test_helpers.go (4)

18-18: LGTM! Adding cronos types import for enhanced functionality.

The addition of cronostypes import aligns with the usage in the SetupWithGenesisValSet function where cronos genesis configuration is set up.


23-25: Good refactoring: Import reorganization with proper grouping.

The import statements are now properly organized with clear separation between different dependency groups using blank lines.


268-268: Good practice: Adding Helper() call to test helper function.

Marking the CheckBalance function as a test helper ensures it won't appear in test failure stack traces, improving debugging experience.


276-276: Approve function signature consolidation.

The function signature appears to have been simplified by consolidating parameters of the same type, which is a common Go idiom for cleaner code.

app/prefix.go (1)

6-8: Import-order tweak looks good

Re-ordering keeps std/lib → external → project groups consistent; no functional impact.

app/versiondb.go (1)

12-14: No issues with the import reshuffle

Moving storetypes lower in the list only affects grouping; build output is unchanged.

x/e2ee/keyring/keyring.go (1)

14-15: Confirm removal of //nolint:gosec is intentional

By deleting the directive you re-enable gosec checks on passKeyringPrefix.
If the original exclusion was to silence a false-positive (e.g. “hard-coded credentials”), the linter may now fail CI. Double-check the latest gosec report and, if still noisy, add a more targeted suppression comment (// #nosec G101: reason…) instead of a blanket ignore.

Also applies to: 22-22

x/cronos/keeper/params_test.go (1)

9-12: Import order cleanup acknowledged

Reordering makes third-party imports follow local ones; test behaviour unaffected.

x/cronos/keeper/permissions_test.go (1)

7-9: Import block re-ordering only

Keeps consistency with new linter rules; nothing else to flag.

app/legacy_test.go (1)

9-10: LGTM - Import organization improvement

The import reordering improves code organization without affecting functionality. This change aligns with Go best practices for import grouping.

x/cronos/simulation/decoder.go (1)

9-10: LGTM - Import grouping improvement

The import reordering separates Cosmos SDK imports from local module imports, improving code organization and readability.

x/cronos/simulation/genesis.go (1)

9-10: LGTM - Local import prioritization

Moving the local types import above external dependencies improves import organization by grouping related imports together.

x/cronos/simulation/genesis_test.go (1)

8-9: LGTM - Import grouping and spacing improvements

The import reordering groups local module imports together and adds appropriate spacing between import groups, improving code organization and readability.

Also applies to: 13-13

app/upgrades_test.go (1)

11-15: LGTM - Import organization follows Go conventions

The import reordering groups Cosmos SDK imports together at the bottom of the import block, following Go best practices for import organization and maintaining clear separation between dependency groups.

x/cronos/types/contracts.go (1)

12-13: LGTM: Import reordering for consistency.

This change improves import organization by moving the auth types import to the end of the import block, which is consistent with the linting updates across the codebase.

x/cronos/keeper/params.go (1)

9-12: LGTM: Import reordering for better organization.

These changes improve import organization by grouping related imports together, which aligns with the linting configuration updates in this PR.

x/e2ee/types/msg.go (1)

16-16: Excellent improvement: Proper error wrapping.

Changing from %s to %w enables proper error wrapping, allowing downstream code to use errors.Is() and errors.As() for better error inspection and handling. This is a Go best practice for error handling.

x/cronos/keeper/permissions.go (1)

5-6: LGTM: Import reordering for consistency.

This change improves import organization by moving the SDK types import to the end of the import block, consistent with the linting standardization across the codebase.

x/cronos/handler_test.go (1)

14-17: LGTM: Import reordering for better organization.

These changes improve import organization by grouping related imports together, which is consistent with the linting configuration updates throughout this PR.

x/cronos/simulation/decoder_test.go (1)

7-9: Import grouping now satisfies goimports / golangci-lint rules
No functional impact – looks good.

x/cronos/events/events.go (1)

13-15: Imports reordered correctly
The new group order follows the project style and the updated linter configuration.

app/block_address.go (1)

6-10: Import section brought in line with lint expectations
Change is cosmetic only – good to merge.

app/legacy.go (1)

4-6: Import re-ordering acknowledged
Keeps third-party modules grouped logically; no further action needed.

x/cronos/types/params_test.go (1)

6-10: Import order updated; tests unaffected
Change is purely stylistic and complies with the new linter; all good.

x/cronos/keeper/grpc_query.go (1)

13-18: LGTM! Import reorganization improves code clarity.

The import reordering properly groups related packages together, separating gRPC imports and Cosmos SDK errors for better readability and organization.

x/e2ee/keyring/keyring_test.go (1)

26-29: Excellent improvement to test robustness.

Adding explicit error checking for writer.Write and writer.Close operations ensures that encryption failures are caught immediately rather than potentially causing silent test failures.

x/cronos/rpc/api.go (2)

22-26: LGTM! Import organization follows consistent pattern.

The import reorganization properly separates Cosmos SDK imports for better code organization and readability.


143-143: Great improvement to error handling.

Changing from %v to %w enables proper error unwrapping downstream, following Go best practices for error wrapping and allowing callers to use errors.Unwrap() or errors.Is() for better error handling.

app/export.go (2)

9-9: LGTM! Import organization improvement.

Moving the storetypes import to its own line improves readability and follows the consistent import organization pattern used throughout the PR.


21-21: Good consolidation of function parameters.

Combining the slice parameters onto a single line makes the function signature more concise while maintaining readability.

cmd/cronosd/opendb/opendb.go (1)

10-10: LGTM! Minor formatting improvement.

Adding a blank line in the import section improves readability and follows good formatting practices.

x/cronos/migrations/v2/migrate.go (1)

4-8: LGTM! Import reorganization improves code organization.

The reordering of imports follows Go conventions by grouping related cronos imports together, which enhances readability and aligns with linting standards.

cmd/cronosd/main.go (1)

8-9: LGTM! Import reordering improves consistency.

Moving the cosmos SDK server command import to the end follows the linting standards and improves import organization consistency across the codebase.

x/cronos/keeper/precompiles/interface.go (1)

7-8: LGTM! Import reordering maintains consistency.

The repositioning of the cosmos SDK types import aligns with the linting standards applied across the codebase in this PR.

x/cronos/keeper/evm_hooks.go (1)

10-11: LGTM! Import reordering maintains codebase consistency.

The cosmos SDK import repositioning follows the same pattern applied across multiple files in this PR, ensuring uniform import organization.

CHANGELOG.md (1)

9-9: LGTM! Changelog entry accurately documents the PR changes.

The entry properly describes the linter update and code tidying effort, and is appropriately categorized under Improvements in the UNRELEASED section.

x/cronos/proposal_handler.go (1)

4-8: Import grouping improved – looks good

The internal cronos imports are now grouped at the top, which aligns with common Go style conventions and keeps dependencies logically organized.

x/cronos/keeper/migrations.go (1)

4-6: Consistent import order

Re-ordering the migration package to the top maintains the internal-first grouping pattern. No functional impact—change approved.

x/cronos/keeper/evmhandlers/send_cro_to_ibc.go (1)

6-14: Import tidy-up acknowledged

The reshuffle places local packages before third-party ones and keeps the standard/import grouping consistent with the new linter rules.

x/e2ee/client/cli/encrypt_to_validators.go (1)

10-15: Clean import ordering

Internal e2ee and Cobra imports are now grouped together, enhancing readability and meeting the updated lint guidelines.

x/e2ee/module.go (1)

8-15: Internal packages moved to the top – ok

The module now follows the preferred import layout (project, third-party, stdlib). No further remarks.

x/cronos/client/proposal_handler.go (1)

5-6: LGTM! Import organization improved.

The reordering groups local imports before external SDK imports, following Go conventions and improving code organization.

x/e2ee/client/cli/tx.go (1)

6-8: LGTM! Import grouping follows Go conventions.

The reorganization groups local module imports and external library imports before Cosmos SDK imports, improving code readability and organization.

x/e2ee/client/cli/generate.go (1)

8-9: LGTM! Consistent import organization.

The reordering groups local e2ee module imports before external Cosmos SDK imports, maintaining consistency with the overall import reorganization effort.

x/cronos/keeper/evm_test.go (1)

9-12: LGTM! Import grouping improved.

The reorganization separates SDK imports into their own group at the bottom, providing better logical organization of the import statements.

x/e2ee/keeper/keeper.go (1)

6-7: LGTM! Import organization maintains consistency.

The reordering groups the local types import before external SDK imports, maintaining consistency with the project-wide import reorganization effort.

Also applies to: 12-12

x/e2ee/client/cli/decrypt.go (1)

8-10: Import re-ordering looks good

Imports are now grouped coherently and compilation behaviour is unchanged.
No further action needed.

x/cronos/client/cli/query.go (1)

7-7: Duplicate import removal is correct

Eliminating the second types import resolves the redundancy that would otherwise break compilation.
Everything else remains intact.

x/e2ee/client/cli/pubkey.go (1)

11-13: Import block re-ordering OK

The client package has simply been moved for lint compliance; no behavioural impact.

x/cronos/types/messages_test.go (1)

13-15: Import grouping tidied up

Moving the SDK import below third-party packages follows Go style conventions; tests are unaffected.

x/cronos/keeper/precompiles/utils.go (1)

11-14: Import grouping updated correctly

Adding the blank line cleanly separates external from Cosmos-SDK packages.
No further concerns.

x/cronos/middleware/conversion_middleware.go (1)

10-13: Import-block reordering is consistent with project style 👍

No functional impact was introduced and the grouping/order now matches the rest of the codebase.
Looks good to merge.

x/e2ee/client/cli/query.go (1)

8-11: Imports reordered correctly

SDK-client imports were moved below third-party / module imports, aligning with Go style conventions (std → external → project).
No further action needed.

x/cronos/keeper/evmhandlers/send_to_ibc_v2.go (1)

7-13: Import clean-up acknowledged

Placing cronoskeeper and types above sdk keeps project packages grouped together. Good catch in adding the blank line to separate external from Cosmos SDK packages.

cmd/cronosd/opendb/opendb_rocksdb.go (1)

14-18: Minor tidy-up looks good

server/types import dropped into correct position.
• Comment tweaked to read more clearly (“BlockCacheSize 3G…”).
No further issues spotted.

x/cronos/client/cli/tx.go (1)

15-29: Import block reorganised successfully

The split between IBC / Cronos / EVM / SDK packages is now clearer and satisfies the linter update.
Everything else remains untouched.

x/e2ee/client/cli/encrypt.go (1)

9-9: LGTM: Import organization improved

The import reordering groups local packages before external SDK imports, following Go conventions and improving code organization.

Also applies to: 12-13

x/cronos/keeper/precompiles/relayer.go (2)

7-24: LGTM: Improved import organization

The import reorganization groups related packages together (IBC types, events, internal packages) and separates them from Cosmos SDK imports, enhancing code readability.


52-52: LGTM: Enhanced comment clarity

The comment clarification from // ibc fee to // RegisterPayee ibc fee provides better context about what the constant relates to.

x/cronos/keeper/keeper.go (1)

15-25: LGTM: Consolidated import grouping

The import reorganization groups packages by source (cosmossdk.io and github.com/cosmos/cosmos-sdk) which improves code organization and readability.

x/cronos/keeper/evmhandlers/send_to_ibc.go (1)

7-14: LGTM: Improved import structure

The import reordering places local packages before external dependencies and adds appropriate spacing, following Go best practices for import organization.

x/cronos/keeper/precompiles/ica.go (1)

20-24: LGTM: Better import separation

The import reorganization moves Cosmos SDK packages to a separate group with appropriate spacing, improving code organization and visual clarity.

x/cronos/keeper/evmhandlers/send_to_account.go (1)

7-14: LGTM: Well-organized import grouping.

The import reorganization properly groups cronos-specific imports at the top, followed by Ethereum imports, then Cosmos SDK imports with appropriate blank line separations. This improves code readability and follows Go best practices.

cmd/cronosd/cmd/root.go (1)

10-46: LGTM: Excellent import organization.

The imports are now well-organized by project/organization (cometbft, cronos, ethermint, cosmos-sdk, etc.) with proper blank line separations. This systematic grouping significantly improves code readability and maintainability.

x/cronos/simulation/operations.go (2)

7-13: LGTM: Good import grouping.

The reorganization groups cronos and ethereum-related imports together at the top, which improves code organization and readability.


23-23: LGTM: Improved comment clarity.

The comment change adds a descriptive prefix while preserving the #nosec security exemption marker, making the code more self-documenting.

x/cronos/module.go (1)

8-12: LGTM: Proper import organization.

The reorganization correctly places internal cronos module imports at the top before external dependencies, following Go best practices and improving code readability.

x/cronos/migrations/v2/migrate_test.go (2)

11-15: LGTM: Clean import organization.

The imports are now well-grouped by project (cosmossdk.io packages together, cosmos-sdk packages together) with proper blank line separation, improving readability.


36-37: Excellent: Improved error handling in test.

The test now properly captures and asserts the error from v2.Migrate, ensuring that migration failures are detected during testing. This is a significant improvement in test robustness.

x/cronos/keeper/ibc_test.go (1)

76-77: Excellent error handling improvements!

The addition of explicit error handling after MintCoins and MintCoinsToModule calls significantly improves test robustness. This ensures that any setup failures are caught immediately rather than causing confusing test failures later.

Also applies to: 108-109, 228-231, 271-272, 288-289

x/cronos/keeper/msg_server.go (2)

6-7: Import reorganization looks good.

Moving the types import for better grouping improves code organization.


73-73: Embedded Keeper methods are correctly accessible

Verified that Keeper defines both methods with value receivers:

  • x/cronos/keeper/permissions.go:32 – func (k Keeper) HasPermission(ctx sdk.Context, accounts []sdk.AccAddress, permissionsToCheck uint64) bool
  • x/cronos/keeper/keeper.go:217 – func (k Keeper) RegisterOrUpdateTokenMapping(ctx sdk.Context, msg *types.MsgUpdateTokenMapping) error

Since msgServer embeds Keeper, the calls at x/cronos/keeper/msg_server.go (lines 73 and 78) to k.HasPermission(...) and k.RegisterOrUpdateTokenMapping(...) are valid and require no further change.

testutil/simapp/simapp.go (2)

12-14: Import reorganization improves clarity.

Moving the cosmossdk.io and testutil imports for better grouping is a good organizational improvement.


24-30: Excellent error handling addition!

Adding error handling for InitChain prevents the function from returning an improperly initialized app instance. Returning nil on initialization failure is the correct approach and will prevent hard-to-debug issues downstream.

x/cronos/keeper/precompiles/bank.go (1)

7-20: Import reorganization enhances readability.

The logical grouping of imports (project-specific, external dependencies, then SDK imports) improves code structure and maintainability.

x/cronos/keeper/ibc.go (1)

7-19: LGTM: Import reorganization improves code clarity

The import statements have been well-organized by grouping related imports together (IBC modules, local types, external dependencies, SDK imports). This follows Go best practices and enhances code readability.

x/cronos/keeper/evm_hooks_test.go (2)

7-15: LGTM: Import reorganization follows best practices

The imports have been properly grouped and organized, improving code readability and consistency with the rest of the codebase.


73-77: LGTM: Enhanced error handling in test setup

The addition of explicit error checking after SetExternalContractForDenom and MintCoins calls improves test robustness by ensuring setup operations succeed before proceeding with test assertions.

Also applies to: 123-127

x/cronos/types/events.go (1)

34-34: LGTM: Function signature simplification

Grouping parameters of the same type (sender, recipient string) follows Go conventions and makes the code more concise while maintaining the same functionality.

x/cronos/types/tracer.go (1)

17-17: LGTM: Function signature simplification

Grouping parameters of the same type (from, to common.Address) follows Go conventions and makes the code more readable while maintaining identical functionality.

app/sim_test.go (2)

218-221: Excellent error handling improvement!

Adding explicit error checking and assertions for InitGenesis and StoreConsensusParams ensures that test failures occur early and explicitly if initialization problems arise. This significantly improves test robustness.


327-331: Good error handling enhancement.

Adding error checking for InitChain follows the same pattern of ensuring initialization errors are caught and asserted in tests, improving overall test reliability.

x/cronos/keeper/evm.go (1)

145-145: Clean method signature simplification.

Combining the parameter declarations into a single line improves readability without affecting functionality.

Makefile (2)

139-142: Correct flag updates for golangci-lint v2.

The flag changes from --out-format to --output.text.path and addition of --path-prefix and --issues-exit-code align with the golangci-lint v2 API changes.


19-19: golangci-lint v2.1.6 is up-to-date and secure

  • Verified that v2.1.6 is the latest stable release (May 4, 2025)¹
  • No known security vulnerabilities in this release
  • Flag changes align correctly with the v2 API

All set to merge.

x/cronos/keeper/evmhandlers_test.go (1)

63-64: Excellent error handling improvements!

Adding explicit error checks and assertions for SetExternalContractForDenom and MintCoinsToModule calls ensures test setup failures are caught early and explicitly.

Also applies to: 148-149, 173-174, 267-268, 294-295, 388-389

x/cronos/keeper/keeper_test.go (2)

55-55: Good test helper practice.

Adding t.Helper() to the DoSetupTest function ensures that test failures are reported at the correct call site, improving debugging experience.


109-110: Excellent error handling improvements in tests.

Adding explicit error checks and assertions for SetValidator, SetExternalContractForDenom, and MintCoins calls ensures that test setup failures are caught early and explicitly, significantly improving test robustness.

Also applies to: 169-170, 233-234, 255-256

x/cronos/types/interfaces.go (2)

8-21: LGTM! Improved import organization.

The import reordering groups related packages together (IBC types at top, SDK imports at bottom) which enhances readability and follows Go conventions.


30-30: LGTM! Cleaner method signature.

Combining parameters of the same type into a single declaration is a good stylistic improvement that makes the interface more concise without changing functionality.

x/cronos/types/messages.go (3)

8-14: LGTM! Better import organization.

The import reordering and spacing improves readability by grouping related packages together.


53-53: LGTM! Cleaner function signatures.

Combining parameters of the same type into single declarations follows Go conventions and makes the code more concise without affecting functionality.

Also applies to: 83-83, 164-164


209-209: Excellent error handling improvement!

Switching from direct error equality (err != nil && err != errDummyIdentity) to errors.Is(err, errDummyIdentity) is a significant improvement. The errors.Is function properly handles wrapped errors and follows Go best practices for error comparison.

app/app.go (2)

25-84: LGTM! Excellent import organization.

The import reordering significantly improves readability by grouping related packages:

  • IBC-related imports together
  • Ethermint imports grouped
  • Cronos imports grouped
  • Ethereum imports grouped
  • SDK imports properly organized

This makes the dependencies much clearer and easier to navigate.


1330-1330: No action required: App struct exposes GRPCQueryRouter and Simulate via BaseApp embedding

Verified that in app/app.go the App struct embeds *baseapp.BaseApp, which promotes all BaseApp methods—including GRPCQueryRouter() and Simulate()—to App. The direct calls

authtx.RegisterTxService(app.GRPCQueryRouter(), clientCtx, app.Simulate, app.interfaceRegistry)

are therefore valid.

.golangci.yml (5)

1-8: Excellent upgrade to golangci-lint v2!

The version upgrade and switch from enabling all linters by default to explicitly enabling specific ones provides better control and reduces noise from unwanted linters.


10-27: Well-chosen linter selection.

The enabled linters provide good coverage:

  • copyloopvar, errcheck, errorlint - catch common Go pitfalls
  • revive, staticcheck - comprehensive code quality checks
  • thelper, tagalign - specialized checks for testing and struct tags
  • Standard linters like govet, ineffassign, unused - essential checks

This is a balanced set that will catch real issues without excessive noise.


29-60: Comprehensive linter configuration.

The settings for each linter are well-configured:

  • dogsled: reasonable limit on blank identifiers
  • gocritic: sensible disabled checks to reduce noise
  • gosec: appropriate exclusions for common false positives
  • revive: good balance between strictness and practicality

61-113: Thorough exclusion rules.

The exclusions section properly handles:

  • Generated files (protobuf, etc.)
  • Legacy code patterns
  • Deprecated API usage that can't be easily changed
  • Common false positives

This will significantly reduce noise while maintaining code quality checks.


117-142: Excellent formatting configuration.

The gci and gofumpt formatters with custom import ordering will ensure consistent code formatting across the project. The import grouping (standard, default, cosmossdk.io, cosmos-sdk) matches the import organization seen in the other files.

Comment thread nix/golangci-lint.nix
Comment thread x/cronos/keeper/evmhandlers_test.go
Comment thread x/cronos/keeper/evmhandlers_test.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e3eb4aa and f117712.

📒 Files selected for processing (34)
  • memiavl/db.go (1 hunks)
  • memiavl/db_test.go (5 hunks)
  • memiavl/export.go (1 hunks)
  • memiavl/layout_little_endian.go (1 hunks)
  • memiavl/layout_native.go (2 hunks)
  • memiavl/mem_node.go (1 hunks)
  • memiavl/mmap.go (1 hunks)
  • memiavl/snapshot.go (2 hunks)
  • memiavl/snapshot_test.go (5 hunks)
  • memiavl/tree.go (2 hunks)
  • memiavl/tree_test.go (1 hunks)
  • memiavl/wal.go (3 hunks)
  • memiavl/wal_test.go (1 hunks)
  • store/memiavlstore/store.go (4 hunks)
  • store/rootmulti/import.go (3 hunks)
  • store/rootmulti/objstore.go (1 hunks)
  • store/rootmulti/snapshot.go (2 hunks)
  • store/rootmulti/store.go (5 hunks)
  • store/rootmulti/store_test.go (1 hunks)
  • store/setup.go (2 hunks)
  • versiondb/client/changeset.go (5 hunks)
  • versiondb/client/convert_to_sst.go (4 hunks)
  • versiondb/client/dump.go (2 hunks)
  • versiondb/client/ingest_sst.go (1 hunks)
  • versiondb/client/restore.go (2 hunks)
  • versiondb/client/restore_app_db.go (2 hunks)
  • versiondb/client/verify.go (2 hunks)
  • versiondb/extsort/delta_encoding_test.go (2 hunks)
  • versiondb/extsort/sort.go (2 hunks)
  • versiondb/store.go (6 hunks)
  • versiondb/tsrocksdb/comparator.go (2 hunks)
  • versiondb/tsrocksdb/iterator.go (1 hunks)
  • versiondb/tsrocksdb/store.go (2 hunks)
  • versiondb/tsrocksdb/store_test.go (1 hunks)
✅ Files skipped from review due to trivial changes (16)
  • store/rootmulti/store_test.go
  • memiavl/tree_test.go
  • memiavl/layout_little_endian.go
  • memiavl/mmap.go
  • memiavl/layout_native.go
  • versiondb/client/ingest_sst.go
  • versiondb/client/restore_app_db.go
  • versiondb/extsort/sort.go
  • memiavl/mem_node.go
  • memiavl/tree.go
  • versiondb/tsrocksdb/store_test.go
  • versiondb/tsrocksdb/iterator.go
  • store/setup.go
  • store/rootmulti/objstore.go
  • versiondb/client/convert_to_sst.go
  • store/rootmulti/store.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • store/memiavlstore/store.go
  • versiondb/store.go
🧰 Additional context used
🧠 Learnings (5)
versiondb/extsort/delta_encoding_test.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-12T22:09:46.096Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-04T16:09:08.694Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
memiavl/db.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-12T22:09:46.096Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-04T16:09:08.694Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
memiavl/wal_test.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-12T22:09:46.096Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-04T16:09:08.694Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
memiavl/snapshot_test.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-12T22:09:46.096Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-04T16:09:08.694Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
memiavl/db_test.go (2)
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-12T22:09:46.096Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
Learnt from: yihuang
PR: crypto-org-chain/cronos#1618
File: memiavl/db_test.go:199-199
Timestamp: 2024-10-04T16:09:08.694Z
Learning: In unit tests within `memiavl/db_test.go`, converting `int64` to `uint32` is acceptable.
🧬 Code Graph Analysis (2)
memiavl/snapshot_test.go (1)
memiavl/export.go (1)
  • ErrorExportDone (11-11)
store/rootmulti/snapshot.go (1)
memiavl/export.go (1)
  • ErrorExportDone (11-11)
⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: integration_tests (gov)
  • GitHub Check: integration_tests (ibc)
  • GitHub Check: integration_tests (unmarked)
  • GitHub Check: integration_tests (upgrade)
  • GitHub Check: integration_tests (ibc_rly_gas)
  • GitHub Check: integration_tests (ibc_timeout)
  • GitHub Check: integration_tests (ibc_update_client)
  • GitHub Check: integration_tests (gas)
  • GitHub Check: integration_tests (slow)
  • GitHub Check: integration_tests (ibc_rly_evm)
  • GitHub Check: integration_tests (ica)
  • GitHub Check: Analyze (go)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (macos-latest)
  • GitHub Check: unittest
  • GitHub Check: Run golangci-lint
🔇 Additional comments (35)
memiavl/db.go (1)

923-923: Good improvement in error wrapping.

The change from %d to %w properly wraps the original strconv.ParseInt error, enabling error unwrapping and maintaining the error chain instead of incorrectly formatting the error as an integer.

versiondb/client/verify.go (2)

17-18: Good import consolidation.

The reorganization of imports improves code readability and follows Go best practices for import grouping.


93-93: Good elimination of variable shadowing.

Removing the redundant re-assignment of the loop variable store eliminates unnecessary variable shadowing, improving code clarity and following Go best practices.

versiondb/extsort/delta_encoding_test.go (1)

5-5: Excellent modernization of error handling.

The addition of the errors import and the change from direct equality check (err == io.EOF) to errors.Is(err, io.EOF) properly handles wrapped errors and follows modern Go error handling best practices.

Also applies to: 43-43

memiavl/wal_test.go (1)

32-35: Good test robustness improvements.

Adding explicit error checking for os.WriteFile and reusing the err variable instead of redeclaring it improves test reliability and follows Go best practices for variable usage.

memiavl/wal.go (1)

6-6: Excellent error handling modernization.

The addition of the errors import and the replacement of direct equality checks (err == wal.ErrCorrupt) with errors.Is(err, wal.ErrCorrupt) properly handles wrapped errors and follows modern Go error handling best practices. This is particularly important for sentinel errors like ErrCorrupt that may be wrapped in error chains.

Also applies to: 20-20, 62-62

memiavl/export.go (1)

73-73: LGTM: Improved error handling with errors.Is.

This change from direct equality check to errors.Is(err, ErrorExportDone) is an excellent improvement that properly handles wrapped errors and follows Go best practices.

versiondb/tsrocksdb/store.go (2)

13-14: LGTM: Import organization improvement.

Moving the Cosmos SDK import to the end with proper spacing improves import organization and follows common Go conventions.


364-364: LGTM: Function signature simplification.

The change from cloneAppend(bz []byte, tail []byte) to cloneAppend(bz, tail []byte) is a valid Go idiom that makes the signature more concise while maintaining the same functionality.

memiavl/snapshot_test.go (3)

4-4: LGTM: Adding errors import for improved error handling.

Adding the errors import is necessary to support the errors.Is pattern used throughout the file.


79-79: LGTM: Improved error handling with errors.Is.

These changes from direct equality checks to errors.Is(err, ErrorExportDone) follow Go best practices and properly handle wrapped errors. This makes the error detection more robust.

Also applies to: 111-111, 177-177


167-167: LGTM: Adding t.Helper() to test helper function.

Adding t.Helper() to the testSnapshotRoundTrip function is a good practice that improves test failure reporting by marking this function as a test helper.

versiondb/client/restore.go (3)

4-4: LGTM: Import organization and aliasing improvements.

These import changes improve code organization:

  • Adding errors import supports the new error handling pattern
  • Reordering imports follows linting conventions
  • Aliasing cosmossdkio distinguishes between standard and Cosmos SDK error packages

Also applies to: 12-13, 16-16, 20-20


94-94: LGTM: Improved EOF error handling.

Changing from err == io.EOF to errors.Is(err, io.EOF) is the idiomatic way to check for EOF in Go and properly handles wrapped errors.


97-97: LGTM: Consistent error wrapping with aliased package.

Using cosmossdkio.Wrap maintains consistency with the new import aliasing and clearly distinguishes between standard and Cosmos SDK error handling.

Also applies to: 105-105

versiondb/client/changeset.go (3)

7-7: LGTM: Adding errors import for improved error handling.

Adding the errors import is necessary to support the errors.Is pattern used throughout the file.


260-260: LGTM: Improved EOF error handling.

These changes from err == io.EOF to errors.Is(err, io.EOF) follow Go best practices and properly handle wrapped EOF errors, making the error detection more robust.

Also applies to: 295-295, 318-318


357-358: LGTM: Variable renaming to avoid shadowing.

Renaming the variable from bits to b avoids shadowing the imported bits package, which is a good practice that prevents potential confusion and follows Go conventions.

versiondb/client/dump.go (2)

20-20: LGTM: Import reordering improves consistency.

The import reordering follows Go conventions and improves code organization.

Also applies to: 25-25


141-141: Confirm closure‐capture safety under Go 1.23+
The module requires Go 1.23.3 (and CI uses Go 1.24.1), which includes the fix that allocates range variables per iteration (since Go 1.21). Removing the workRange := workRange shadowing will not reintroduce any closure capture bugs—no further changes are needed.

store/rootmulti/snapshot.go (3)

10-11: LGTM: Import reordering improves consistency.

The import reordering follows Go conventions and separates standard/third-party packages appropriately.


14-14: LGTM: Comment formatting improvement.

The comment formatting is more consistent with Go documentation standards.


33-33: Excellent: Using errors.Is for sentinel error checking.

This change improves error handling by using errors.Is instead of direct equality comparison, which properly handles wrapped errors and follows Go best practices.

versiondb/tsrocksdb/comparator.go (2)

21-21: LGTM: Concise parameter declaration.

Using the shorthand syntax bz1, bz2 []byte for parameters of the same type is more idiomatic and concise.


37-37: LGTM: Concise parameter declaration.

Using the shorthand syntax a, b []byte for parameters of the same type improves readability and follows Go conventions.

store/rootmulti/import.go (4)

4-4: LGTM: Import reorganization with proper aliasing.

The import reorganization with aliases (cosmoserrors and standard errors) clearly distinguishes between different error handling packages and prevents naming conflicts.

Also applies to: 12-12, 15-15


18-18: LGTM: Comment formatting improvement.

The comment formatting is more consistent with Go documentation standards.


51-51: Excellent: Using errors.Is for EOF detection.

Using errors.Is(err, io.EOF) instead of direct equality properly handles wrapped errors and follows Go best practices for error checking.


54-54: LGTM: Consistent error wrapping with Cosmos SDK.

Using cosmoserrors.Wrap and cosmoserrors.Wrapf provides consistent error handling throughout the Cosmos SDK codebase and maintains proper error context.

Also applies to: 64-65

memiavl/snapshot.go (2)

18-18: LGTM: Improved constant documentation.

The comment improvements make the constants more self-documenting and follow Go documentation conventions by including the constant name in the comment.

Also applies to: 21-21, 29-29


267-273: Excellent: Avoiding builtin function shadowing.

Renaming the variable from len to length prevents shadowing Go's builtin len function, which improves code clarity and prevents potential confusion or bugs.

memiavl/db_test.go (4)

194-195: Good improvement in error handling.

Adding explicit error capture and assertion for db.SetInitialVersion() improves test robustness by ensuring initialization failures are caught early.


224-225: Good improvement in error handling.

Adding explicit error capture and assertion for db.ApplyUpgrades() ensures that upgrade failures are properly detected and reported.


240-241: Good improvement in error handling.

Consistent with the pattern established elsewhere, this explicit error handling for db.ApplyUpgrades() improves test reliability.


519-519: Excellent addition of t.Helper().

Marking testIdempotentWrite as a helper function will improve test failure reporting by showing the actual test function that called this helper in stack traces, rather than the helper itself.

Comment thread memiavl/db_test.go
Comment thread testutil/simapp/simapp.go Outdated
Comment thread versiondb/client/dump.go Outdated
Comment thread versiondb/client/verify.go Outdated
Comment thread x/cronos/keeper/precompiles/relayer.go Outdated

@JayT106 JayT106 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small things, but LGTM

Comment thread app/bench_test.go Outdated
@songgaoye
songgaoye self-requested a review July 1, 2025 04:59
@thomas-nguy
thomas-nguy added this pull request to the merge queue Jul 1, 2025
Merged via the queue into crypto-org-chain:main with commit b79d7df Jul 1, 2025
43 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Sep 12, 2025
randy-cro pushed a commit to thomas-nguy/cronos that referenced this pull request Sep 26, 2025
* update lint

* to be reverted: enable linter in this PR

* revert

* fix lint

* fix more lint

* add changelog

* fix lint

* fix lint

* remove comment

* fix comments
@coderabbitai coderabbitai Bot mentioned this pull request Dec 8, 2025
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants