Skip to content

test(messaging): add settlement integration tests - #574

Merged
kariy merged 1 commit into
mainfrom
tests/messaging-settlements
May 26, 2026
Merged

kariy merged 1 commit into
mainfrom
tests/messaging-settlements

Conversation

@kariy

@kariy kariy commented May 23, 2026

Copy link
Copy Markdown
Member

Summary

Adds end-to-end coverage of the messaging service's gather/insert/checkpoint loop against real settlement nodes, and relocates the existing L1→L2 e2e test from katana-rpc-server so all messaging integration coverage lives in one place.

  • tests/eth_settlement.rs — Anvil + StarknetMessagingLocal, isolated MessagingService (no L2 sequencer). Asserts the L1Handler tx lands in an in-memory pool, the L1→L2 index records the mapping, and the checkpoint advances. Two cases: single message + two messages in different blocks.
  • tests/starknet_settlement.rs — A second Katana (TestNode) used purely as the settlement chain, hosting piltover_messaging_mock. The isolated MessagingService polls it and collects the MessageSent event emitted by send_message_to_appchain.
  • tests/e2e.rs — Moved verbatim from crates/rpc/rpc-server/tests/messaging.rs::test_messaging. Still uses Anvil + a full Katana L2; complements the isolated tests above by exercising the full pipeline including the executor.
  • MessagingService refactor — Generalized over any TransactionPool<Transaction = ExecutableTxWithHash> + Clone (defaults to TxPool). Lets the new tests use a Pool with NoopValidator instead of standing up a full stateful validator. Production callers (sequencer) require no changes thanks to the default type parameter.
  • rpc-server cleanup — Removed test_messaging and now-unused imports from rpc/rpc-server/tests/messaging.rs. Kept estimate_message_fee and mod messages_status (RPC-method tests, not messaging-service tests). Dropped 5 alloy dev-deps from rpc-server/Cargo.toml that only the moved test needed.

Heads up — StarknetCollector page-size hardcode

crates/messaging/src/stream/collector/starknet.rs hardcodes chunk_size = 200 for get_events, but TestNode's default max_event_page_size is Some(100). The new Starknet test bumps the page size on its TestNode config; in production Katana with a strict event page cap below 200, the collector would silently fail every gather. Worth a follow-up to make the chunk size configurable or smaller by default.

Test plan

  • cargo nextest run -p katana-messaging --tests — 24/24 pass (20 pre-existing unit + 4 new integration)
  • cargo nextest run -p katana-rpc-server --test messaging — 4/4 pass (estimate_message_fee + 3 messages_status)
  • cargo +nightly-2025-02-20 fmt --all
  • ./scripts/clippy.sh

🤖 Generated with Claude Code

Adds integration coverage for the messaging service that exercises the
real gather/insert/checkpoint loop against live settlement nodes:

- `eth_settlement` — Anvil + StarknetMessagingLocal, isolated service
- `starknet_settlement` — TestNode-as-settlement + piltover_messaging_mock,
  isolated service
- `e2e` — relocated `test_messaging` from rpc-server, retains full Anvil +
  Katana L2 pipeline

To run the service in isolation (without a full Katana node), generalize
`MessagingService` over any `TransactionPool<Transaction = ExecutableTxWithHash>`
so tests can plug in a no-op-validated pool. Production callers (sequencer)
still use the `TxPool` default and require no changes.

Drops alloy dev-deps from rpc-server's Cargo.toml that only the moved test
needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Codec benchmark diff vs main

Benchmark Baseline (ns) Current (ns) Δ
CompiledClass(fixture)/compress 2700139 2564207 -5.03%
CompiledClass(fixture)/decompress 2948520 2902683 -1.55%
ExecutionCheckpoint/compress 34 37 +8.82%
ExecutionCheckpoint/decompress 25 27 +8.00%
PruningCheckpoint/compress 35 35 +0.00%
PruningCheckpoint/decompress 25 26 +4.00%
VersionedHeader/compress 678 661 -2.51%
VersionedHeader/decompress 816 872 +6.86%
StoredBlockBodyIndices/compress 83 81 -2.41%
StoredBlockBodyIndices/decompress 36 40 +11.11%
StorageEntry/compress 154 167 +8.44%
StorageEntry/decompress 140 159 +13.57%
ContractNonceChange/compress 150 161 +7.33%
ContractNonceChange/decompress 236 259 +9.75%
ContractClassChange/compress 216 211 -2.31%
ContractClassChange/decompress 266 283 +6.39%
ContractStorageEntry/compress 161 169 +4.97%
ContractStorageEntry/decompress 332 351 +5.72%
GenericContractInfo/compress 141 139 -1.42%
GenericContractInfo/decompress 123 110 -10.57%
Felt/compress 82 90 +9.76%
Felt/decompress 57 60 +5.26%
BlockHash/compress 81 90 +11.11%
BlockHash/decompress 56 61 +8.93%
TxHash/compress 81 90 +11.11%
TxHash/decompress 57 60 +5.26%
ClassHash/compress 81 90 +11.11%
ClassHash/decompress 57 60 +5.26%
CompiledClassHash/compress 81 90 +11.11%
CompiledClassHash/decompress 57 60 +5.26%
BlockNumber/compress 47 50 +6.38%
BlockNumber/decompress 25 26 +4.00%
TxNumber/compress 47 50 +6.38%
TxNumber/decompress 25 26 +4.00%
FinalityStatus/compress 1 0 -100.00%
FinalityStatus/decompress 12 12 +0.00%
TypedTransactionExecutionInfo/compress 15185 14605 -3.82%
TypedTransactionExecutionInfo/decompress 3633 3676 +1.18%
VersionedContractClass/compress 370 411 +11.08%
VersionedContractClass/decompress 825 854 +3.52%
MigratedCompiledClassHash/compress 147 160 +8.84%
MigratedCompiledClassHash/decompress 142 159 +11.97%
ContractInfoChangeList/compress 1813 1520 -16.16%
ContractInfoChangeList/decompress 2287 2411 +5.42%
BlockChangeList/compress 700 659 -5.86%
BlockChangeList/decompress 955 978 +2.41%
ReceiptEnvelope/compress 29041 28641 -1.38%
ReceiptEnvelope/decompress 6144 6568 +6.90%
TrieDatabaseValue/compress 164 158 -3.66%
TrieDatabaseValue/decompress 219 239 +9.13%
TrieHistoryEntry/compress 296 313 +5.74%
TrieHistoryEntry/decompress 265 276 +4.15%

@github-actions

Copy link
Copy Markdown

Runner: AMD EPYC 9V74 80-Core Processor (4 cores) · 15Gi RAM

@codecov

codecov Bot commented May 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.63%. Comparing base (9bde0ae) to head (00d1dab).
⚠️ Report is 424 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #574      +/-   ##
==========================================
- Coverage   73.32%   68.63%   -4.69%     
==========================================
  Files         209      321     +112     
  Lines       23132    45264   +22132     
==========================================
+ Hits        16961    31069   +14108     
- Misses       6171    14195    +8024     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@kariy
kariy merged commit 42be001 into main May 26, 2026
18 of 21 checks passed
@kariy
kariy deleted the tests/messaging-settlements branch May 26, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant