Skip to content

refactor: Remove duplication and move tests into separate files#7357

Merged
ameten merged 9 commits intomainfrom
ameten/lander-tx-submission-observability
Nov 12, 2025
Merged

refactor: Remove duplication and move tests into separate files#7357
ameten merged 9 commits intomainfrom
ameten/lander-tx-submission-observability

Conversation

@ameten
Copy link
Copy Markdown
Contributor

@ameten ameten commented Nov 11, 2025

Description

Remove duplication and move tests into separate files

Related issues

Contributes into https://linear.app/hyperlane-xyz/issue/ENG-2457/lander-tx-submission-observability-and-alerting-fix

Backward compatibility

Yes

Testing

Unit tests

Summary by CodeRabbit

  • Chores
    • Consolidated and reorganized test infrastructure and shared test utilities across multiple components, moving inline test scaffolding into centralized test modules and adding reusable test helpers/mocks.
    • Introduced additional test utilities and mock types to improve test coverage and maintainability.
    • No changes to production behavior or user-facing functionality.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Nov 11, 2025

⚠️ No Changeset found

Latest commit: 38da2f1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 11, 2025

📝 Walkthrough

Walkthrough

Tests and test utilities were reorganized: inline #[cfg(test)] modules were extracted into separate tests.rs files, shared test helpers and mocks consolidated (tests_common), and imports updated across crates to reference the new tests modules. No production runtime logic was changed.

Changes

Cohort / File(s) Summary
Test module extraction
\rust/main/agents/relayer/src/msg/db_loader.rs`, `rust/main/agents/relayer/src/msg/op_queue.rs``
Replaced inline #[cfg(test)] pub mod test { ... } blocks with #[cfg(test)] pub mod tests; (tests moved to separate files).
New dedicated test modules
\rust/main/agents/relayer/src/msg/db_loader/tests.rs`, `rust/main/agents/relayer/src/msg/op_queue/tests.rs``
Added comprehensive test modules containing mocks, helpers, and integration-style tests (e.g., DummyApplicationOperationVerifier, MockPendingOperation, persistence/retry and queue behavior tests).
Shared test utilities
\rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs``
New consolidated test utilities and mocks (MockQueueOperation, MockHyperlaneDb, MockDispatcherEntrypoint, create_test_queue) for reuse by message processor tests.
Message processor tests refactor
\rust/main/agents/relayer/src/msg/message_processor/tests.rs`, `.../tests/tests_filter_operations_for_preparation.rs`, `.../tests/tests_operation_disposition_by_payload_status.rs``
Test files now import shared tests_common and use shared mocks/helpers (e.g., MockQueueOperation::with_first_prepare) instead of in-file mock definitions.
Widespread test import updates
\rust/main/agents/relayer/src/msg/op_batch.rs`, `rust/main/agents/relayer/src/server/operations/list_messages.rs`, `.../server/operations/message_retry.rs`, `.../server/operations/reprocess_message.rs`, `rust/main/agents/relayer/src/test_utils/dummy_data.rs`, `rust/main/agents/relayer/src/msg/pending_message.rs``
Updated test import paths from testtests and switched references to centralized mocks/helpers (e.g., MockPendingOperation, dummy_cache_metrics, DummyApplicationOperationVerifier, MockHyperlaneDb).
Hyperlane-base test helpers added
\rust/main/hyperlane-base/src/tests.rs`, `rust/main/hyperlane-base/src/tests/mock_hyperlane_db.rs`, `rust/main/hyperlane-base/src/tests/test_validators.rs`, `rust/main/hyperlane-base/src/tests/mock_checkpoint_syncer.rs``
Exposed new test modules and added a detailed mock_hyperlane_db test mock; adjusted test-validator and checkpoint mock exports/imports.
Validator crate dependency & tests
\rust/main/agents/validator/Cargo.toml`, `rust/main/agents/validator/src/submit/tests.rs``
Added hyperlane-core dependency with test-utils feature; replaced locally-generated Db mock with MockHyperlaneDb import.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Files meriting extra attention:
    • rust/main/agents/relayer/src/msg/db_loader/tests.rs — check persistence/backoff test logic and mock fidelity.
    • rust/main/agents/relayer/src/msg/op_queue/tests.rs — validate MockPendingOperation trait impls and ordering/retry scenarios.
    • rust/main/hyperlane-base/src/tests/mock_hyperlane_db.rs — large mock surface; ensure method signatures and behaviors align with consumers.
    • Cross-crate import updates — search for any remaining mod test references or stale paths.

Possibly related PRs

Suggested reviewers

  • kamiyaa
  • yjamin
  • daniel-savu

Poem

In the swamp of tests they once did bide,
Now gathered neat by the riverside.
Mocks in a row, helpers humbly dwell,
Cleaner imports — aye, all's going well. 🧅✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.35% 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 title accurately reflects the main objective of the PR: refactoring by removing test duplication and organizing tests into separate files.
Description check ✅ Passed The description covers key sections from the template including description, related issues, backward compatibility, and testing, though drive-by changes section is missing.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ameten/lander-tx-submission-observability

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e175bb and a514780.

📒 Files selected for processing (13)
  • rust/main/agents/relayer/src/msg/db_loader.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/message_processor/tests.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_filter_operations_for_preparation.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_operation_disposition_by_payload_status.rs (14 hunks)
  • rust/main/agents/relayer/src/msg/op_batch.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/op_queue.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/op_queue/tests.rs (1 hunks)
  • rust/main/agents/relayer/src/server/operations/list_messages.rs (1 hunks)
  • rust/main/agents/relayer/src/server/operations/message_retry.rs (1 hunks)
  • rust/main/agents/relayer/src/server/operations/reprocess_message.rs (1 hunks)
  • rust/main/agents/relayer/src/test_utils/dummy_data.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
rust/main/agents/relayer/**/src/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Maintain relayer agent Rust sources under rust/main/agents/relayer

Files:

  • rust/main/agents/relayer/src/test_utils/dummy_data.rs
  • rust/main/agents/relayer/src/server/operations/list_messages.rs
  • rust/main/agents/relayer/src/server/operations/message_retry.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests.rs
  • rust/main/agents/relayer/src/server/operations/reprocess_message.rs
  • rust/main/agents/relayer/src/msg/op_queue.rs
  • rust/main/agents/relayer/src/msg/op_batch.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_filter_operations_for_preparation.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_operation_disposition_by_payload_status.rs
  • rust/main/agents/relayer/src/msg/db_loader.rs
  • rust/main/agents/relayer/src/msg/op_queue/tests.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
rust/main/**/src/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Run cargo clippy for Rust code linting

Files:

  • rust/main/agents/relayer/src/test_utils/dummy_data.rs
  • rust/main/agents/relayer/src/server/operations/list_messages.rs
  • rust/main/agents/relayer/src/server/operations/message_retry.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests.rs
  • rust/main/agents/relayer/src/server/operations/reprocess_message.rs
  • rust/main/agents/relayer/src/msg/op_queue.rs
  • rust/main/agents/relayer/src/msg/op_batch.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_filter_operations_for_preparation.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_operation_disposition_by_payload_status.rs
  • rust/main/agents/relayer/src/msg/db_loader.rs
  • rust/main/agents/relayer/src/msg/op_queue/tests.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
🧠 Learnings (3)
📓 Common learnings
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/testnet_config.json in future code reviews as requested by paulbalaji.
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/mainnet_config.json in future code reviews as requested by paulbalaji.
📚 Learning: 2025-09-02T18:44:06.598Z
Learnt from: CR
Repo: hyperlane-xyz/hyperlane-monorepo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-02T18:44:06.598Z
Learning: Applies to rust/main/agents/relayer/**/src/**/*.rs : Maintain relayer agent Rust sources under rust/main/agents/relayer

Applied to files:

  • rust/main/agents/relayer/src/test_utils/dummy_data.rs
  • rust/main/agents/relayer/src/server/operations/message_retry.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests.rs
  • rust/main/agents/relayer/src/server/operations/reprocess_message.rs
  • rust/main/agents/relayer/src/msg/op_queue.rs
  • rust/main/agents/relayer/src/msg/op_batch.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_filter_operations_for_preparation.rs
  • rust/main/agents/relayer/src/msg/db_loader.rs
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
📚 Learning: 2025-09-02T18:44:06.598Z
Learnt from: CR
Repo: hyperlane-xyz/hyperlane-monorepo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-02T18:44:06.598Z
Learning: Applies to rust/main/agents/validator/**/src/**/*.rs : Maintain validator agent Rust sources under rust/main/agents/validator

Applied to files:

  • rust/main/agents/relayer/src/test_utils/dummy_data.rs
  • rust/main/agents/relayer/src/msg/op_batch.rs
🧬 Code graph analysis (7)
rust/main/agents/relayer/src/server/operations/list_messages.rs (1)
rust/main/agents/relayer/src/msg/op_queue/tests.rs (1)
  • dummy_metrics_and_label (240-254)
rust/main/agents/relayer/src/server/operations/reprocess_message.rs (1)
rust/main/agents/relayer/src/msg/db_loader/tests.rs (1)
  • dummy_cache_metrics (60-73)
rust/main/agents/relayer/src/msg/op_batch.rs (1)
rust/main/agents/relayer/src/msg/db_loader/tests.rs (1)
  • dummy_cache_metrics (60-73)
rust/main/agents/relayer/src/msg/message_processor/tests/tests_filter_operations_for_preparation.rs (2)
rust/main/agents/relayer/src/msg/message_processor.rs (1)
  • filter_operations_for_preparation (439-471)
rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs (1)
  • create_test_queue (273-291)
rust/main/agents/relayer/src/msg/message_processor/tests/tests_operation_disposition_by_payload_status.rs (2)
rust/main/agents/relayer/src/msg/message_processor.rs (3)
  • operation_disposition_by_payload_status (492-522)
  • new (100-141)
  • new (1069-1081)
rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs (2)
  • new (34-36)
  • with_first_prepare (38-40)
rust/main/agents/relayer/src/msg/op_queue/tests.rs (3)
rust/main/agents/relayer/src/server/operations/list_messages.rs (1)
  • new (61-66)
rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs (1)
  • broadcast (284-284)
rust/main/agents/relayer/src/settings/matching_list.rs (2)
  • with_message_id (333-342)
  • with_destination_domain (344-353)
rust/main/agents/relayer/src/msg/db_loader/tests.rs (5)
rust/main/hyperlane-core/src/test_utils.rs (1)
  • dummy_domain (44-53)
rust/main/agents/relayer/src/test_utils/dummy_data.rs (2)
  • dummy_message_context (113-128)
  • dummy_metadata_builder (51-92)
rust/main/agents/relayer/src/msg/db_loader.rs (4)
  • new (56-81)
  • new (333-355)
  • new (377-399)
  • domain (248-250)
rust/main/hyperlane-base/src/db/rocks/test_utils.rs (1)
  • run_test_db (17-35)
rust/main/agents/relayer/src/msg/pending_message.rs (1)
  • calculate_msg_backoff (918-966)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (56)
  • GitHub Check: cli-evm-e2e-matrix (warp-rebalancer)
  • GitHub Check: cli-evm-e2e-matrix (warp-check-5)
  • GitHub Check: cli-evm-e2e-matrix (warp-send)
  • GitHub Check: cli-evm-e2e-matrix (warp-extend-basic)
  • GitHub Check: cli-evm-e2e-matrix (warp-extend-recovery)
  • GitHub Check: cli-evm-e2e-matrix (warp-check-3)
  • GitHub Check: cli-evm-e2e-matrix (warp-extend-config)
  • GitHub Check: cli-evm-e2e-matrix (warp-read)
  • GitHub Check: cli-evm-e2e-matrix (warp-init)
  • GitHub Check: cli-evm-e2e-matrix (warp-bridge-1)
  • GitHub Check: cli-evm-e2e-matrix (warp-deploy-1)
  • GitHub Check: cli-evm-e2e-matrix (warp-deploy-2)
  • GitHub Check: cli-evm-e2e-matrix (warp-check-4)
  • GitHub Check: cli-evm-e2e-matrix (warp-check-1)
  • GitHub Check: cli-evm-e2e-matrix (warp-check-2)
  • GitHub Check: cli-evm-e2e-matrix (warp-apply-2)
  • GitHub Check: cli-evm-e2e-matrix (warp-apply-ism-updates)
  • GitHub Check: cli-evm-e2e-matrix (warp-apply-1)
  • GitHub Check: cli-evm-e2e-matrix (warp-apply-submitters)
  • GitHub Check: cli-evm-e2e-matrix (warp-bridge-2)
  • GitHub Check: cli-evm-e2e-matrix (relay)
  • GitHub Check: cli-evm-e2e-matrix (core-init)
  • GitHub Check: cli-evm-e2e-matrix (core-deploy)
  • GitHub Check: cli-evm-e2e-matrix (core-apply)
  • GitHub Check: cli-evm-e2e-matrix (core-read)
  • GitHub Check: cli-evm-e2e-matrix (core-check)
  • GitHub Check: env-test-matrix (mainnet3, optimism, core)
  • GitHub Check: env-test-matrix (mainnet3, inevm, core)
  • GitHub Check: env-test-matrix (mainnet3, optimism, igp)
  • GitHub Check: env-test-matrix (mainnet3, inevm, igp)
  • GitHub Check: env-test-matrix (mainnet3, ethereum, core)
  • GitHub Check: env-test-matrix (mainnet3, arbitrum, core)
  • GitHub Check: cli-cross-chain-e2e-matrix (warp-deploy)
  • GitHub Check: cli-cosmos-e2e-matrix (warp-deploy)
  • GitHub Check: env-test-matrix (testnet4, sepolia, core)
  • GitHub Check: env-test-matrix (mainnet3, arbitrum, igp)
  • GitHub Check: env-test-matrix (mainnet3, ethereum, igp)
  • GitHub Check: cli-cosmos-e2e-matrix (core-read)
  • GitHub Check: cli-cosmos-e2e-matrix (warp-read)
  • GitHub Check: cli-cross-chain-e2e-matrix (warp-apply)
  • GitHub Check: cli-cosmos-e2e-matrix (core-check)
  • GitHub Check: cli-cosmos-e2e-matrix (core-deploy)
  • GitHub Check: cli-cosmos-e2e-matrix (core-apply)
  • GitHub Check: cli-radix-e2e-matrix (core-deploy)
  • GitHub Check: cosmos-sdk-e2e-run
  • GitHub Check: cli-install-test-run
  • GitHub Check: build-and-push-to-gcr
  • GitHub Check: e2e-matrix (cosmosnative)
  • GitHub Check: e2e-matrix (starknet)
  • GitHub Check: e2e-matrix (radix)
  • GitHub Check: e2e-matrix (sealevel)
  • GitHub Check: e2e-matrix (cosmwasm)
  • GitHub Check: e2e-matrix (evm)
  • GitHub Check: lint-rs
  • GitHub Check: lander-coverage
  • GitHub Check: test-rs

Comment thread rust/main/agents/relayer/src/msg/db_loader/tests.rs Outdated
Comment thread rust/main/agents/relayer/src/msg/op_queue/tests.rs
Comment thread rust/main/agents/relayer/src/msg/op_queue/tests.rs
@ameten ameten enabled auto-merge November 11, 2025 14:18
Comment thread rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs (1)

151-170: Clarify the immediate channel closure.

At line 164, you drop the sender immediately after creating it. This closes the channel, which might be what you want for certain tests, but it's not obvious. A quick comment explaining why would save future readers from scratching their heads.

     let (tx, rx) = broadcast::channel::<MessageRetryRequest>(10);
+    // Drop the sender to simulate a closed channel for testing scenarios
+    // where no retry requests are sent
     drop(tx);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57501d7 and 38da2f1.

📒 Files selected for processing (12)
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/metadata/multisig/message_id_multisig.rs (1 hunks)
  • rust/main/agents/relayer/src/msg/pending_message.rs (1 hunks)
  • rust/main/agents/validator/Cargo.toml (1 hunks)
  • rust/main/agents/validator/src/submit/tests.rs (1 hunks)
  • rust/main/hyperlane-base/src/tests.rs (1 hunks)
  • rust/main/hyperlane-base/src/tests/mock_checkpoint_syncer.rs (1 hunks)
  • rust/main/hyperlane-base/src/tests/mock_hyperlane_db.rs (1 hunks)
  • rust/main/hyperlane-base/src/tests/test_validators.rs (0 hunks)
  • rust/main/hyperlane-base/src/types/multisig.rs (1 hunks)
💤 Files with no reviewable changes (1)
  • rust/main/hyperlane-base/src/tests/test_validators.rs
🧰 Additional context used
📓 Path-based instructions (4)
rust/main/{hyperlane-core,hyperlane-base}/**/src/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Keep shared Rust core crates in rust/main/{hyperlane-core,hyperlane-base}

Files:

  • rust/main/hyperlane-base/src/tests.rs
  • rust/main/hyperlane-base/src/types/multisig.rs
  • rust/main/hyperlane-base/src/tests/mock_checkpoint_syncer.rs
  • rust/main/hyperlane-base/src/tests/mock_hyperlane_db.rs
rust/main/**/src/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Run cargo clippy for Rust code linting

Files:

  • rust/main/hyperlane-base/src/tests.rs
  • rust/main/agents/relayer/src/msg/metadata/multisig/message_id_multisig.rs
  • rust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rs
  • rust/main/hyperlane-base/src/types/multisig.rs
  • rust/main/hyperlane-base/src/tests/mock_checkpoint_syncer.rs
  • rust/main/agents/relayer/src/msg/pending_message.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs
  • rust/main/agents/validator/src/submit/tests.rs
  • rust/main/hyperlane-base/src/tests/mock_hyperlane_db.rs
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
rust/main/agents/relayer/**/src/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Maintain relayer agent Rust sources under rust/main/agents/relayer

Files:

  • rust/main/agents/relayer/src/msg/metadata/multisig/message_id_multisig.rs
  • rust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rs
  • rust/main/agents/relayer/src/msg/pending_message.rs
  • rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
rust/main/agents/validator/**/src/**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

Maintain validator agent Rust sources under rust/main/agents/validator

Files:

  • rust/main/agents/validator/src/submit/tests.rs
🧠 Learnings (10)
📓 Common learnings
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/testnet_config.json in future code reviews as requested by paulbalaji.
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/mainnet_config.json in future code reviews as requested by paulbalaji.
Learnt from: CR
Repo: hyperlane-xyz/hyperlane-monorepo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-02T18:44:06.598Z
Learning: Applies to rust/main/{hyperlane-core,hyperlane-base}/**/src/**/*.rs : Keep shared Rust core crates in rust/main/{hyperlane-core,hyperlane-base}
📚 Learning: 2025-09-02T18:44:06.598Z
Learnt from: CR
Repo: hyperlane-xyz/hyperlane-monorepo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-02T18:44:06.598Z
Learning: Applies to rust/main/{hyperlane-core,hyperlane-base}/**/src/**/*.rs : Keep shared Rust core crates in rust/main/{hyperlane-core,hyperlane-base}

Applied to files:

  • rust/main/hyperlane-base/src/tests.rs
  • rust/main/hyperlane-base/src/tests/mock_checkpoint_syncer.rs
  • rust/main/agents/validator/Cargo.toml
  • rust/main/agents/validator/src/submit/tests.rs
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
📚 Learning: 2025-09-02T18:44:06.598Z
Learnt from: CR
Repo: hyperlane-xyz/hyperlane-monorepo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-02T18:44:06.598Z
Learning: Applies to rust/main/chains/{hyperlane-ethereum,hyperlane-cosmos,hyperlane-sealevel,hyperlane-fuel}/**/src/**/*.rs : Keep chain support implementations within rust/main/chains/{hyperlane-ethereum,hyperlane-cosmos,hyperlane-sealevel,hyperlane-fuel}

Applied to files:

  • rust/main/hyperlane-base/src/tests.rs
  • rust/main/hyperlane-base/src/types/multisig.rs
  • rust/main/agents/validator/Cargo.toml
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
📚 Learning: 2025-09-02T18:44:06.598Z
Learnt from: CR
Repo: hyperlane-xyz/hyperlane-monorepo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-02T18:44:06.598Z
Learning: Applies to rust/main/agents/validator/**/src/**/*.rs : Maintain validator agent Rust sources under rust/main/agents/validator

Applied to files:

  • rust/main/hyperlane-base/src/tests.rs
  • rust/main/agents/relayer/src/msg/metadata/multisig/message_id_multisig.rs
  • rust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rs
  • rust/main/hyperlane-base/src/tests/mock_checkpoint_syncer.rs
  • rust/main/agents/validator/Cargo.toml
  • rust/main/agents/validator/src/submit/tests.rs
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
📚 Learning: 2025-09-02T18:44:06.598Z
Learnt from: CR
Repo: hyperlane-xyz/hyperlane-monorepo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-02T18:44:06.598Z
Learning: Applies to rust/main/agents/relayer/**/src/**/*.rs : Maintain relayer agent Rust sources under rust/main/agents/relayer

Applied to files:

  • rust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rs
  • rust/main/agents/relayer/src/msg/pending_message.rs
  • rust/main/agents/validator/Cargo.toml
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
📚 Learning: 2025-08-26T13:46:37.695Z
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/testnet_config.json in future code reviews as requested by paulbalaji.

Applied to files:

  • rust/main/agents/validator/Cargo.toml
  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
📚 Learning: 2025-09-02T18:44:06.598Z
Learnt from: CR
Repo: hyperlane-xyz/hyperlane-monorepo PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-02T18:44:06.598Z
Learning: Applies to rust/main/agents/scraper/**/src/**/*.rs : Maintain scraper agent Rust sources under rust/main/agents/scraper

Applied to files:

  • rust/main/agents/validator/Cargo.toml
📚 Learning: 2025-10-27T15:54:48.485Z
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 7090
File: typescript/infra/src/utils/safe.ts:83-87
Timestamp: 2025-10-27T15:54:48.485Z
Learning: In the Hyperlane monorepo, safes are only used on mainnet3 environment with Hyperlane context, so hard-coded values for these parameters in safe-related functions are acceptable.

Applied to files:

  • rust/main/agents/validator/Cargo.toml
📚 Learning: 2025-08-26T13:46:37.695Z
Learnt from: paulbalaji
Repo: hyperlane-xyz/hyperlane-monorepo PR: 6943
File: rust/main/config/mainnet_config.json:965-965
Timestamp: 2025-08-26T13:46:37.695Z
Learning: In the repository hyperlane-xyz/hyperlane-monorepo, skip reviewing the file rust/main/config/mainnet_config.json in future code reviews as requested by paulbalaji.

Applied to files:

  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
📚 Learning: 2025-11-07T16:12:27.713Z
Learnt from: ameten
Repo: hyperlane-xyz/hyperlane-monorepo PR: 7346
File: rust/main/agents/relayer/src/msg/message_processor/tests/tests_confirm_already_submitted_operations.rs:344-353
Timestamp: 2025-11-07T16:12:27.713Z
Learning: In the hyperlane-monorepo Rust codebase, using `as` to cast `Arc<ConcreteType>` to `Arc<dyn Trait + Send + Sync>` is acceptable and preferred. This pattern works correctly since Rust 1.45+ and should not be flagged as a problem.

Applied to files:

  • rust/main/agents/relayer/src/msg/db_loader/tests.rs
🧬 Code graph analysis (6)
rust/main/agents/relayer/src/msg/metadata/multisig/message_id_multisig.rs (1)
rust/main/hyperlane-base/src/tests/test_validators.rs (1)
  • dummy_validators (38-83)
rust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rs (1)
rust/main/hyperlane-base/src/tests/test_validators.rs (1)
  • dummy_validators (38-83)
rust/main/hyperlane-base/src/types/multisig.rs (1)
rust/main/hyperlane-base/src/tests/test_validators.rs (1)
  • dummy_validators (38-83)
rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs (1)
rust/main/agents/relayer/src/msg/pending_message.rs (38)
  • id (169-171)
  • status (173-175)
  • priority (188-190)
  • origin_domain_id (192-194)
  • retrieve_status_from_db (212-220)
  • destination_domain (196-198)
  • sender_address (200-202)
  • recipient_address (204-206)
  • body (208-210)
  • app_context (222-224)
  • get_metric (542-544)
  • set_metric (546-548)
  • set_status (177-186)
  • prepare (227-372)
  • submit (375-422)
  • set_submission_outcome (424-426)
  • get_tx_cost_estimate (428-430)
  • confirm (432-470)
  • set_operation_outcome (472-516)
  • next_attempt_after (518-520)
  • next_attempt_after (598-601)
  • set_next_attempt_after (522-524)
  • reset_attempts (526-528)
  • reset_attempts (884-887)
  • set_retries (530-532)
  • set_retries (900-903)
  • get_retries (534-536)
  • payload (550-560)
  • success_criteria (562-566)
  • on_reprepare (363-363)
  • on_reprepare (400-400)
  • on_reprepare (466-466)
  • on_reprepare (568-574)
  • on_reprepare (823-823)
  • on_reprepare (828-828)
  • on_reprepare (837-850)
  • on_reprepare (1018-1018)
  • on_reprepare (1023-1023)
rust/main/agents/validator/src/submit/tests.rs (1)
rust/main/hyperlane-core/src/test_utils.rs (1)
  • dummy_domain (44-53)
rust/main/agents/relayer/src/msg/db_loader/tests.rs (5)
rust/main/hyperlane-core/src/test_utils.rs (1)
  • dummy_domain (44-53)
rust/main/agents/relayer/src/test_utils/dummy_data.rs (2)
  • dummy_message_context (113-128)
  • dummy_metadata_builder (51-92)
rust/main/agents/relayer/src/msg/db_loader.rs (3)
  • new (56-81)
  • new (333-355)
  • new (377-399)
rust/main/agents/relayer/src/msg/pending_message.rs (2)
  • destination_domain (196-198)
  • calculate_msg_backoff (918-966)
rust/main/hyperlane-base/src/db/rocks/test_utils.rs (1)
  • run_test_db (17-35)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build-and-push-to-gcr
  • GitHub Check: test-rs
  • GitHub Check: lint-rs
  • GitHub Check: lander-coverage
🔇 Additional comments (16)
rust/main/agents/validator/Cargo.toml (1)

54-55: Looks good—test-utils features properly scoped to dev-dependencies.

Adding these features to [dev-dependencies] while keeping the production code features (agent, async) in regular [dependencies] is the right call. Cargo will handle the feature union during testing, so your build stays lean for production while tests get what they need.

This aligns nicely with the PR's goal of organizing and consolidating test helpers without touching any runtime logic.

rust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rs (1)

94-94: Import path correctly updated.

The test import's been adjusted to match the new test organization structure. Everything looks good here - the dummy_validators function is right where it should be in the consolidated test utilities.

rust/main/agents/relayer/src/msg/metadata/multisig/message_id_multisig.rs (1)

99-99: ---

Import path updated correctly and consistently.

The refactoring is solid—all files importing dummy_validators have been updated to use the new hyperlane_base::tests::test_validators::dummy_validators path, with no stragglers left behind. Both message_id_multisig.rs and the related merkle_root_multisig.rs are in sync. The change reflects the reorganized test module structure cleanly.

rust/main/hyperlane-base/src/tests.rs (1)

1-6: Module files confirmed—just verify clippy passes.

All three test module files exist in the expected locations. The structure looks solid for consolidating test utilities in this shared core crate.

One thing to manually verify since the sandbox environment has limitations: run cargo clippy --all-targets --all-features -- -D warnings in rust/main/hyperlane-base locally to ensure everything passes linting per the guidelines.

Regarding #[cfg(test)]—these modules are unconditionally compiled, which is fine for shared test utilities that other crates depend on. If they're meant only for internal testing, you could add that attribute, but for a core crate like hyperlane-base, the current approach makes sense.

rust/main/agents/relayer/src/msg/db_loader/tests.rs (6)

1-26: Imports look solid.

The module structure is clean, and use super::*; on line 26 correctly brings in the parent module's exports—no missing imports here.


28-39: Simple test verifier works as expected.

This dummy implementation returns None from verify, which is perfect for tests that don't require actual verification logic.


41-167: Test helpers are well-structured.

The helper functions provide clean test fixtures. The 200ms timeout at line 164 should be sufficient for these unit tests, though keep an eye on it if CI environments prove slower.


169-235: Persistence flow test is thorough.

This test validates that retry counts persist correctly across db_loader runs and that backoff calculations align with expectations. The rounding logic accounts for timing differences nicely.


237-308: Iterator test exercises realistic edge cases.

The mock setup simulates an in-progress indexing scenario, and the expected iteration order [2, 3, 1, 4, 0] correctly reflects the forward-backward alternation. Final boundary assertions are spot on.


1-308: Clippy check passed—no issues found.

The file already meets all linting standards. The cargo clippy check ran clean with no warnings, so you're all set there.

rust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rs (6)

1-22: Module setup is clean.

The re-export of MockHyperlaneDb at line 13 makes it convenient for other test modules to access the mock, which aligns with the PR's goal of reducing duplication.


23-42: MockQueueOperation constructors are handy.

The helper constructors with_first_prepare and with_manual_retry make test setup more expressive. Good addition.


44-132: Mock implementation strikes the right balance.

This mock implements only what tests need, leaving the rest as unimplemented!(). Just ensure your tests don't call those unimplemented methods, or you'll get a panic at runtime.


134-134: Marker trait implementation.

Empty impl is appropriate here—TryBatchAs likely provides defaults.


136-149: Mockall setup is standard.

The MockDispatcherEntrypoint follows the typical mockall pattern for async traits. Tests can set expectations on these methods as needed.


1-170: The code passes clippy checks cleanly.

The tests_common.rs file has been verified against clippy linting standards and comes out without any warnings. Your test utilities module is in good shape—the mock implementations, trait derives, and helper functions are all following proper Rust conventions. Nothing needs changing here.

@ameten ameten added this pull request to the merge queue Nov 12, 2025
Merged via the queue into main with commit 71b56e6 Nov 12, 2025
42 checks passed
@ameten ameten deleted the ameten/lander-tx-submission-observability branch November 12, 2025 14:05
@github-project-automation github-project-automation Bot moved this from In Review to Done in Hyperlane Tasks Nov 12, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (355977b) to head (38da2f1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #7357   +/-   ##
============================
============================
Components Coverage Δ
core ∅ <ø> (∅)
hooks ∅ <ø> (∅)
isms ∅ <ø> (∅)
token ∅ <ø> (∅)
middlewares ∅ <ø> (∅)
🚀 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.

yorhodes pushed a commit that referenced this pull request Nov 14, 2025
Co-authored-by: Danil Nemirovsky <4614623+ameten@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants