Skip to content

Conversation

@promalert
Copy link

@promalert promalert commented Jan 7, 2026

Description

execute goimports to format the code

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Note

Standardizes import ordering/grouping using goimports; no logic or behavior changes.

  • Reformat imports in test files: pkg/chains/chain_test.go, pkg/crypto/evm_address_test.go, pkg/crypto/tss_test.go, x/crosschain/keeper/msg_server_refund_aborted_tx_test.go, x/crosschain/keeper/msg_server_whitelist_asset_test.go, zetaclient/chains/evm/signer/gas_test.go
  • Adjust import order in generated file zetaclient/mode/chaos/generated.go

Written by Cursor Bugbot for commit 2a0f2ad. Configure here.

Summary by CodeRabbit

  • Chores
    • Reorganized import statements in test files to improve code consistency and maintainability across the test suite.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: promalert <promalert@outlook.com>
@promalert promalert requested a review from a team as a code owner January 7, 2026 08:06
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

This pull request standardizes and reorganizes import declarations across six test files in the pkg/chains, pkg/crypto, x/crosschain, and zetaclient modules. Changes consist exclusively of import reordering and the introduction of two new test imports, with no modifications to test logic or behavior.

Changes

Cohort / File(s) Summary
Import Reordering — Structural Organization
pkg/chains/chain_test.go, pkg/crypto/tss_test.go, x/crosschain/keeper/msg_server_refund_aborted_tx_test.go, x/crosschain/keeper/msg_server_whitelist_asset_test.go
Reordered import blocks to standardize grouping and ordering; no imports added or removed.
Import Reordering & Rearrangement
pkg/crypto/evm_address_test.go
Repositioned testing import; no functional impact.
Import Additions & Reordering
zetaclient/chains/evm/signer/gas_test.go
Added imports for github.com/stretchr/testify/require and github.com/zeta-chain/node/pkg/coin; reorganized import block structure.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately describes the primary change: executing goimports to format code across test files and generated files.
Description check ✅ Passed The description includes the required Description section and How Has This Been Tested section with checkboxes, though all test checkboxes remain unchecked.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e26bca and 9c92b06.

📒 Files selected for processing (6)
  • pkg/chains/chain_test.go
  • pkg/crypto/evm_address_test.go
  • pkg/crypto/tss_test.go
  • x/crosschain/keeper/msg_server_refund_aborted_tx_test.go
  • x/crosschain/keeper/msg_server_whitelist_asset_test.go
  • zetaclient/chains/evm/signer/gas_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

⚙️ CodeRabbit configuration file

Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

Files:

  • pkg/crypto/tss_test.go
  • pkg/chains/chain_test.go
  • pkg/crypto/evm_address_test.go
  • zetaclient/chains/evm/signer/gas_test.go
  • x/crosschain/keeper/msg_server_whitelist_asset_test.go
  • x/crosschain/keeper/msg_server_refund_aborted_tx_test.go
🧠 Learnings (22)
📓 Common learnings
Learnt from: gartnera
Repo: zeta-chain/node PR: 3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like `cmd/zetae2e/init.go` in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.
Learnt from: gartnera
Repo: zeta-chain/node PR: 3228
File: zetaclient/orchestrator/orchestrator.go:388-401
Timestamp: 2024-11-27T22:01:49.732Z
Learning: When reviewing code changes in `zetaclient/orchestrator/orchestrator.go`, avoid suggesting refactoring that is unrelated to the current PR.
Learnt from: gartnera
Repo: zeta-chain/node PR: 2817
File: contrib/rpcimportable/go.mod:5-6
Timestamp: 2024-09-24T18:45:32.028Z
Learning: In the `contrib/rpcimportable` test, the `go.mod` file should be empty when committed, and the `go.sum` file should not be committed, as committing `go.sum` causes the test to fail.
Learnt from: gartnera
Repo: zeta-chain/node PR: 2817
File: contrib/rpcimportable/rpcimportable_test.go:9-11
Timestamp: 2024-09-24T18:43:18.488Z
Learning: When reviewing test functions intended solely to verify package importability, avoid suggesting additional assertions or checks that are beyond the intended scope.
Learnt from: lumtis
Repo: zeta-chain/node PR: 4199
File: zetaclient/chains/evm/signer/signer_admin.go:25-26
Timestamp: 2025-09-15T13:42:17.594Z
Learning: In PR 4199, the CLI references to CmdMigrateTssFunds in x/crosschain/client/cli/ files are intentionally not updated as they are out of scope for this specific refactor focused on removing ERC20 custody messages.
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., `IsUTXO()` to `IsBitcoin()`), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
📚 Learning: 2024-10-10T18:50:23.406Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 2987
File: pkg/memo/codec_abi.go:0-0
Timestamp: 2024-10-10T18:50:23.406Z
Learning: The constant `ABIAlignment` has been moved from `pkg/memo/codec_abi.go` to the `testutil` package.

Applied to files:

  • pkg/crypto/tss_test.go
  • pkg/chains/chain_test.go
  • pkg/crypto/evm_address_test.go
  • x/crosschain/keeper/msg_server_refund_aborted_tx_test.go
📚 Learning: 2024-10-30T17:56:16.341Z
Learnt from: gartnera
Repo: zeta-chain/node PR: 3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like `cmd/zetae2e/init.go` in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.

Applied to files:

  • pkg/crypto/tss_test.go
  • zetaclient/chains/evm/signer/gas_test.go
📚 Learning: 2024-10-10T18:54:33.554Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the `testutil/sample/memo.go` file, unchecked type assertions in the `ABIPack` function are acceptable because it is designed for unit tests and simplicity.

Applied to files:

  • pkg/crypto/tss_test.go
  • pkg/chains/chain_test.go
  • pkg/crypto/evm_address_test.go
  • zetaclient/chains/evm/signer/gas_test.go
  • x/crosschain/keeper/msg_server_whitelist_asset_test.go
📚 Learning: 2025-02-06T16:29:58.925Z
Learnt from: gartnera
Repo: zeta-chain/node PR: 3485
File: e2e/utils/sui/signer.go:24-35
Timestamp: 2025-02-06T16:29:58.925Z
Learning: The Sui blockchain requires signatures in [R || S || V] format, which is best generated using go-ethereum's crypto.Sign function that takes an ecdsa.PrivateKey.

Applied to files:

  • pkg/crypto/tss_test.go
  • zetaclient/chains/evm/signer/gas_test.go
📚 Learning: 2024-07-05T00:02:31.446Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 2411
File: zetaclient/orchestrator/chain_activate.go:184-247
Timestamp: 2024-07-05T00:02:31.446Z
Learning: The `CreateSignerObserverBTC` function in `zetaclient/orchestrator/chain_activate.go` is covered by unit tests in `zetaclient/orchestrator/chain_activate_test.go`.

Applied to files:

  • pkg/crypto/tss_test.go
  • pkg/chains/chain_test.go
  • zetaclient/chains/evm/signer/gas_test.go
📚 Learning: 2024-11-06T21:11:34.420Z
Learnt from: gartnera
Repo: zeta-chain/node PR: 3105
File: cmd/zetae2e/local/bitcoin.go:8-8
Timestamp: 2024-11-06T21:11:34.420Z
Learning: In the `e2e` codebase, it's acceptable to use `github.com/stretchr/testify/require` outside of test files.

Applied to files:

  • pkg/crypto/tss_test.go
  • pkg/chains/chain_test.go
  • pkg/crypto/evm_address_test.go
  • zetaclient/chains/evm/signer/gas_test.go
  • x/crosschain/keeper/msg_server_whitelist_asset_test.go
  • x/crosschain/keeper/msg_server_refund_aborted_tx_test.go
📚 Learning: 2024-11-06T21:10:14.301Z
Learnt from: gartnera
Repo: zeta-chain/node PR: 3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (`e2e/runner/setup_bitcoin.go`), adding security measures for private key handling in the `GetBtcAddress` method is not required.

Applied to files:

  • pkg/crypto/tss_test.go
  • pkg/crypto/evm_address_test.go
📚 Learning: 2024-09-23T19:51:43.360Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the `mineTxNSetNonceMark` function within `bitcoin/observer/outbound_test.go`, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.

Applied to files:

  • pkg/crypto/tss_test.go
  • pkg/chains/chain_test.go
  • zetaclient/chains/evm/signer/gas_test.go
📚 Learning: 2025-07-14T21:05:38.534Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 4007
File: e2e/contracts/sui/example-authenticated-call/sources/example.move:69-71
Timestamp: 2025-07-14T21:05:38.534Z
Learning: In Sui Move test contracts for the ZetaChain project, it's acceptable to define generic structs with phantom type parameters for testing type argument functionality without fully implementing their usage in entry functions. The goal is to validate the type system behavior, not to provide complete operational functionality.

Applied to files:

  • pkg/chains/chain_test.go
📚 Learning: 2024-07-04T23:47:56.072Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 2411
File: zetaclient/orchestrator/orchestrator.go:222-237
Timestamp: 2024-07-04T23:47:56.072Z
Learning: The `GetUpdatedChainObserver` method in the `Orchestrator` class is covered by unit tests in `zetaclient/orchestrator/orchestrator_test.go` and `zetaclient/orchestrator/chain_activate_test.go`.

Applied to files:

  • pkg/chains/chain_test.go
📚 Learning: 2025-04-22T15:32:20.706Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 3793
File: pkg/contracts/sui/withdraw_and_call_ptb.go:111-118
Timestamp: 2025-04-22T15:32:20.706Z
Learning: The constant `moduleName` is defined in `pkg/contracts/sui/gateway.go` with the value `"gateway"` and is used across multiple files in the `sui` package.

Applied to files:

  • pkg/chains/chain_test.go
📚 Learning: 2024-07-05T00:02:36.493Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 2411
File: zetaclient/orchestrator/chain_activate.go:116-181
Timestamp: 2024-07-05T00:02:36.493Z
Learning: The `CreateSignerObserverEVM` function in `zetaclient/orchestrator/chain_activate.go` is covered by unit tests in `zetaclient/orchestrator/chain_activate_test.go`.

Applied to files:

  • pkg/chains/chain_test.go
  • zetaclient/chains/evm/signer/gas_test.go
📚 Learning: 2025-07-14T21:08:08.725Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 4007
File: e2e/runner/sui.go:237-274
Timestamp: 2025-07-14T21:08:08.725Z
Learning: In test code for the ZetaChain project, it's acceptable to use constants for EVM and Sui address lengths rather than adding complex validation logic. This applies to functions like payload construction in E2E tests where the expected lengths are well-defined and documented.

Applied to files:

  • pkg/crypto/evm_address_test.go
📚 Learning: 2024-07-04T23:46:38.428Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 2411
File: zetaclient/orchestrator/orchestrator.go:192-217
Timestamp: 2024-07-04T23:46:38.428Z
Learning: The `GetUpdatedSigner` method in `zetaclient/orchestrator/orchestrator.go` is covered by unit tests in `zetaclient/orchestrator/chain_activate_test.go` and `zetaclient/orchestrator/orchestrator_test.go`.

Applied to files:

  • zetaclient/chains/evm/signer/gas_test.go
📚 Learning: 2025-03-04T22:39:58.395Z
Learnt from: gartnera
Repo: zeta-chain/node PR: 3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.

Applied to files:

  • zetaclient/chains/evm/signer/gas_test.go
📚 Learning: 2024-09-13T22:29:09.747Z
Learnt from: ws4charlie
Repo: zeta-chain/node PR: 2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., `IsUTXO()` to `IsBitcoin()`), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.

Applied to files:

  • zetaclient/chains/evm/signer/gas_test.go
📚 Learning: 2025-08-06T01:54:04.100Z
Learnt from: kingpinXD
Repo: zeta-chain/node PR: 4064
File: cmd/zetae2e/local/solana.go:0-0
Timestamp: 2025-08-06T01:54:04.100Z
Learning: The `CheckSolanaTSSBalance()` method in e2e/runner has been refactored to not return an error. Instead, it uses internal assertions (require statements) to fail the test immediately if balance checks fail. This is part of a broader refactoring pattern in the E2E runner where balance check methods were changed from error-returning to assertion-based approaches.

Applied to files:

  • zetaclient/chains/evm/signer/gas_test.go
📚 Learning: 2024-11-01T10:30:27.952Z
Learnt from: lumtis
Repo: zeta-chain/node PR: 2984
File: x/crosschain/keeper/msg_server_whitelist_erc20.go:39-48
Timestamp: 2024-11-01T10:30:27.952Z
Learning: In the context of whitelisting assets in `MsgWhitelistERC20` within `x/crosschain/keeper/msg_server_whitelist_erc20.go`, there is no specific address validation required for Solana addresses.

Applied to files:

  • x/crosschain/keeper/msg_server_whitelist_asset_test.go
📚 Learning: 2025-09-15T13:42:17.594Z
Learnt from: lumtis
Repo: zeta-chain/node PR: 4199
File: zetaclient/chains/evm/signer/signer_admin.go:25-26
Timestamp: 2025-09-15T13:42:17.594Z
Learning: In PR 4199, the CLI references to CmdMigrateTssFunds in x/crosschain/client/cli/ files are intentionally not updated as they are out of scope for this specific refactor focused on removing ERC20 custody messages.

Applied to files:

  • x/crosschain/keeper/msg_server_whitelist_asset_test.go
  • x/crosschain/keeper/msg_server_refund_aborted_tx_test.go
📚 Learning: 2025-05-26T22:03:49.074Z
Learnt from: kingpinXD
Repo: zeta-chain/node PR: 3917
File: x/observer/keeper/voting.go:46-74
Timestamp: 2025-05-26T22:03:49.074Z
Learning: In Go SDK staking keeper, validators retrieved via GetValidator() have valid consensus addresses by design. The validator.GetConsAddr() method rarely fails in normal operation since the SDK maintains data integrity for stored validators, making test coverage for this error path unnecessary in most cases.

Applied to files:

  • x/crosschain/keeper/msg_server_whitelist_asset_test.go
  • x/crosschain/keeper/msg_server_refund_aborted_tx_test.go
📚 Learning: 2024-09-24T18:45:32.028Z
Learnt from: gartnera
Repo: zeta-chain/node PR: 2817
File: contrib/rpcimportable/go.mod:5-6
Timestamp: 2024-09-24T18:45:32.028Z
Learning: In the `contrib/rpcimportable` test, the `go.mod` file should be empty when committed, and the `go.sum` file should not be committed, as committing `go.sum` causes the test to fail.

Applied to files:

  • x/crosschain/keeper/msg_server_refund_aborted_tx_test.go
🔇 Additional comments (6)
pkg/crypto/evm_address_test.go (1)

3-9: LGTM: Import formatting standardized correctly.

The import block has been reformatted to include the testing import with proper grouping (standard library separated from third-party imports). No logic changes detected.

pkg/crypto/tss_test.go (1)

3-14: LGTM: Import ordering adjusted per goimports standards.

The import block has been reordered with the zetasui aliased import repositioned. No functional changes to the test logic.

x/crosschain/keeper/msg_server_whitelist_asset_test.go (1)

3-18: LGTM: Import block reformatted correctly.

The import block has been adjusted with the sdkmath alias repositioned and blank line formatting standardized. No logic or test behavior changes.

pkg/chains/chain_test.go (1)

3-12: LGTM: Import block reordered per goimports conventions.

The sui package import has been repositioned within the import block. No functional changes to the test suite.

x/crosschain/keeper/msg_server_refund_aborted_tx_test.go (1)

3-18: LGTM: Import ordering standardized.

The import block has been reformatted with the constant package import repositioned. No logic or test behavior changes.

zetaclient/chains/evm/signer/gas_test.go (1)

3-12: Import organization correctly standardized.

The imports have been properly reorganized by goimports with both newly added imports (require and coin) actively used throughout the test file. The import grouping follows Go conventions with standard library imports first, followed by third-party imports sorted by path.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: promalert <promalert@outlook.com>
Copy link
Contributor

@ws4charlie ws4charlie left a comment

Choose a reason for hiding this comment

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

lgtm

@ws4charlie ws4charlie added the no-changelog Skip changelog CI check label Jan 7, 2026
Copy link
Member

@kingpinXD kingpinXD left a comment

Choose a reason for hiding this comment

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

https://github.com/zeta-chain/zeta-node/blob/9c796d62b309569f4edad26167303faeacdf26e0/.golangci.yml#L26-L34

Test files are manually removed from the .golangci.yml .

This seems intentional. I don't think we need a pr to format the chages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Skip changelog CI check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants