refactor: Remove duplication and move tests into separate files#7357
refactor: Remove duplication and move tests into separate files#7357
Conversation
|
📝 WalkthroughWalkthroughTests and test utilities were reorganized: inline #[cfg(test)] modules were extracted into separate Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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.rsrust/main/agents/relayer/src/server/operations/list_messages.rsrust/main/agents/relayer/src/server/operations/message_retry.rsrust/main/agents/relayer/src/msg/message_processor/tests.rsrust/main/agents/relayer/src/server/operations/reprocess_message.rsrust/main/agents/relayer/src/msg/op_queue.rsrust/main/agents/relayer/src/msg/op_batch.rsrust/main/agents/relayer/src/msg/message_processor/tests/tests_filter_operations_for_preparation.rsrust/main/agents/relayer/src/msg/message_processor/tests/tests_operation_disposition_by_payload_status.rsrust/main/agents/relayer/src/msg/db_loader.rsrust/main/agents/relayer/src/msg/op_queue/tests.rsrust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rsrust/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.rsrust/main/agents/relayer/src/server/operations/list_messages.rsrust/main/agents/relayer/src/server/operations/message_retry.rsrust/main/agents/relayer/src/msg/message_processor/tests.rsrust/main/agents/relayer/src/server/operations/reprocess_message.rsrust/main/agents/relayer/src/msg/op_queue.rsrust/main/agents/relayer/src/msg/op_batch.rsrust/main/agents/relayer/src/msg/message_processor/tests/tests_filter_operations_for_preparation.rsrust/main/agents/relayer/src/msg/message_processor/tests/tests_operation_disposition_by_payload_status.rsrust/main/agents/relayer/src/msg/db_loader.rsrust/main/agents/relayer/src/msg/op_queue/tests.rsrust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rsrust/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.rsrust/main/agents/relayer/src/server/operations/message_retry.rsrust/main/agents/relayer/src/msg/message_processor/tests.rsrust/main/agents/relayer/src/server/operations/reprocess_message.rsrust/main/agents/relayer/src/msg/op_queue.rsrust/main/agents/relayer/src/msg/op_batch.rsrust/main/agents/relayer/src/msg/message_processor/tests/tests_filter_operations_for_preparation.rsrust/main/agents/relayer/src/msg/db_loader.rsrust/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.rsrust/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
There was a problem hiding this comment.
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
📒 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.rsrust/main/hyperlane-base/src/types/multisig.rsrust/main/hyperlane-base/src/tests/mock_checkpoint_syncer.rsrust/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.rsrust/main/agents/relayer/src/msg/metadata/multisig/message_id_multisig.rsrust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rsrust/main/hyperlane-base/src/types/multisig.rsrust/main/hyperlane-base/src/tests/mock_checkpoint_syncer.rsrust/main/agents/relayer/src/msg/pending_message.rsrust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rsrust/main/agents/validator/src/submit/tests.rsrust/main/hyperlane-base/src/tests/mock_hyperlane_db.rsrust/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.rsrust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rsrust/main/agents/relayer/src/msg/pending_message.rsrust/main/agents/relayer/src/msg/message_processor/tests/tests_common.rsrust/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.rsrust/main/hyperlane-base/src/tests/mock_checkpoint_syncer.rsrust/main/agents/validator/Cargo.tomlrust/main/agents/validator/src/submit/tests.rsrust/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.rsrust/main/hyperlane-base/src/types/multisig.rsrust/main/agents/validator/Cargo.tomlrust/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.rsrust/main/agents/relayer/src/msg/metadata/multisig/message_id_multisig.rsrust/main/agents/relayer/src/msg/metadata/multisig/merkle_root_multisig.rsrust/main/hyperlane-base/src/tests/mock_checkpoint_syncer.rsrust/main/agents/validator/Cargo.tomlrust/main/agents/validator/src/submit/tests.rsrust/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.rsrust/main/agents/relayer/src/msg/pending_message.rsrust/main/agents/validator/Cargo.tomlrust/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.tomlrust/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_validatorsfunction 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_validatorshave been updated to use the newhyperlane_base::tests::test_validators::dummy_validatorspath, with no stragglers left behind. Bothmessage_id_multisig.rsand the relatedmerkle_root_multisig.rsare 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 warningsinrust/main/hyperlane-baselocally 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
Nonefromverify, 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
MockHyperlaneDbat 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_prepareandwith_manual_retrymake 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—
TryBatchAslikely provides defaults.
136-149: Mockall setup is standard.The
MockDispatcherEntrypointfollows 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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7357 +/- ##
============================
============================
🚀 New features to boost your workflow:
|
Co-authored-by: Danil Nemirovsky <4614623+ameten@users.noreply.github.com>
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