Repository navigation
test(messaging): add settlement integration tests - #574
Merged
Merged
Conversation
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>
Codec benchmark diff vs
|
| 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% |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-serverso all messaging integration coverage lives in one place.tests/eth_settlement.rs— Anvil +StarknetMessagingLocal, isolatedMessagingService(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, hostingpiltover_messaging_mock. The isolatedMessagingServicepolls it and collects theMessageSentevent emitted bysend_message_to_appchain.tests/e2e.rs— Moved verbatim fromcrates/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.MessagingServicerefactor — Generalized over anyTransactionPool<Transaction = ExecutableTxWithHash> + Clone(defaults toTxPool). Lets the new tests use aPoolwithNoopValidatorinstead of standing up a full stateful validator. Production callers (sequencer) require no changes thanks to the default type parameter.test_messagingand now-unused imports fromrpc/rpc-server/tests/messaging.rs. Keptestimate_message_feeandmod messages_status(RPC-method tests, not messaging-service tests). Dropped 5 alloy dev-deps fromrpc-server/Cargo.tomlthat only the moved test needed.Heads up —
StarknetCollectorpage-size hardcodecrates/messaging/src/stream/collector/starknet.rshardcodeschunk_size = 200forget_events, butTestNode's defaultmax_event_page_sizeisSome(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+ 3messages_status)cargo +nightly-2025-02-20 fmt --all./scripts/clippy.sh🤖 Generated with Claude Code