feat(l1_sender): replace L1SenderLoop with Submitter + Watcher tasks#1105
Open
Artemka374-claude wants to merge 11 commits intomatter-labs:mainfrom
Open
feat(l1_sender): replace L1SenderLoop with Submitter + Watcher tasks#1105Artemka374-claude wants to merge 11 commits intomatter-labs:mainfrom
Artemka374-claude wants to merge 11 commits intomatter-labs:mainfrom
Conversation
Replace the monolithic `run_l1_sender` function with `L1SenderLoop`,
a phase-based struct that categorizes all errors and handles them
appropriately instead of crashing the binary.
Error categories:
- Transient (RPC timeouts, rate limits) → exponential backoff, retry
- Recoverable (GasBlocked, BlobFeeBlocked, TxTimeout, NonceTooLow) →
wait for external condition, retry with 30s sleep
- Fatal (tx revert, data corruption, channel closed) → crash as before
Key changes:
- `L1SenderLoop` tracks three collections: `pending_commands`,
`in_flight`, and `completed`. Commands are never lost on errors —
partial send progress survives transient RPC failures.
- Gas and blob fee caps are checked before any tx is submitted.
Exceeding the cap now returns `GasBlocked`/`BlobFeeBlocked` instead
of warning and sending a doomed tx.
- Pending block fallback: replace `.expect("no pending block")` with
a fallback to `BlockId::latest()` to fix the known Infura crash.
- Metrics: add `GasBlocked`, `BlobFeeBlocked`, `TransientBackoff`
states; add `transient_errors` counter and `recoverable_errors`
labeled counter. Make `report_tx_receipt` / `report_blob_base_fee` /
`report_l1_eip_1559_estimation` non-fatal (log on parse error).
- Informational calls (`get_balance`, `get_transaction_count`) after
inclusion are now non-fatal — log warning and continue.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
These docs were added for planning purposes and belong in the docs repo, not in the server codebase. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wire the Submitter and Watcher tasks together in lib.rs under tokio::try_join!, removing the old sequential L1SenderLoop struct. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
L1SenderLoopwith two independent async tasks:Submitter(provider interaction, fee estimation, tx submission) andWatcher(FuturesOrderedconcurrent receipt polling, downstream forwarding)FuturesOrdered(previously sequential withfirst_mut())max_priority_fee_per_gasdefault from 1 gwei to 10 gweiDesign doc
docs/superpowers/specs/2026-03-27-l1-sender-task-decomposition.mdTesting
Existing integration tests cover the full commit/prove/execute pipeline. Integration test failures on this branch pre-exist on the base branch (
feat/l1-sender-error-handling) and are caused by an anvil JSON parsing incompatibility unrelated to this change.No new tests added — the behaviour is already covered by existing integration tests.
🤖 Generated with Claude Code