Commit e1711d3
authored
fix(sequencer): prevent unhandled rejections from in-flight L1 requests during shutdown (v5 line) (#24560)
Ports the remaining part of the `sentinel_status_slash` flake fix to the
v5 line. The flake crashed the jest process after all tests passed: an
in-flight `eth_getBlockByNumber` against the torn-down anvil surfaced as
an unhandled `L1RpcError` (`ECONNREFUSED`). CI log:
http://ci.aztec-labs.com/9bb09d2f904e290a
This complements #24551, which (after retargeting to
`merge-train/spartan-v5`) now carries only the two files that
cherry-picked cleanly from `next` — `l1_tx_utils.ts` (guard the loop-top
`getL1Timestamp()` in `monitorTransaction`) and `sequencer-publisher.ts`
(`.catch` on the fire-and-forget `backupDroppedInSim`). The other two
files had diverged on this branch and are addressed here; #24551's
title/body should be updated to reflect that it covers 2 of the original
4 files, with this PR covering the rest.
### `yarn-project/ethereum/src/publisher_manager.ts` — fixed
This branch's `stop()` (which, unlike `next`, also clears the `started`
flag and supports restart via `start()`) interrupted all publishers and
the funder but returned immediately, so an in-flight tx monitor loop
could still be issuing L1 RPC calls after test teardown. Applied the
equivalent of the `next` fix, fitted to this branch's structure:
`stop()` now awaits `waitMonitoringStopped()` on every publisher and the
funder before returning. `L1TxUtils.waitMonitoringStopped(timeoutSeconds
= 10)` already exists on this branch, is self-bounded, and swallows its
own timeout with a warning, so shutdown cannot hang.
###
`yarn-project/sequencer-client/src/sequencer/checkpoint_proposal_job.ts`
— no change needed
On `next`, the votes-only path assigned a bare `pendingL1Submission =
publisher.sendRequestsAt(...)` with no rejection handler, and only the
last job's submission was awaited at shutdown, so an orphaned job's
rejection could crash the process. On this branch that field no longer
exists: both fire-and-forget paths go through
`this.pendingRequests.trackRequest(promise, () => this.interrupt())`,
backed by the sequencer's shared `RequestsTracker`
(`requests_tracker.ts`). `trackRequest` attaches a rejection handler
synchronously at track time (`promise.then(delete, delete)`), so a
tracked promise can never surface as an unhandled rejection regardless
of whether shutdown awaits it. Additionally, `Sequencer.stop()` calls
`pendingRequests.interruptRequests()` followed by `awaitRequests()`, so
all tracked requests — not just the last one — are interrupted and
drained at shutdown. The `next` bug does not exist here, so no change
was forced. (Minor observability note, not a bug: a rejection on the
votes-only path is swallowed silently by the tracker rather than
logged.)
Verified `publisher_manager.ts` parses cleanly; the full workspace
type-check runs in CI (this container lacks the bootstrapped
bb.js/noir/l1-artifacts toolchain).
No tracked issue.
---
*Created by
[claudebox](https://claudebox.work/v2/sessions/0959caa9f03f59fa) ·
group: `slackbot`*1 parent d4d77e3 commit e1711d3
2 files changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
568 | 572 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
118 | 125 | | |
119 | 126 | | |
120 | 127 | | |
| |||
0 commit comments