Commit 7e7d8d0
authored
feat(sequencer): make sequencer pausable (#24475)
Supersedes #24449 and #24450, reimplementing both on a simpler design.
Single PR since the lifecycle work is only exercised by the e2e
primitive.
## Context
Several multi-node e2e tests spend minutes of wall-clock waiting for the
L1 clock to roll while live sequencers sit idle. Warping the shared
clock under a running sequencer interrupts whatever iteration is
mid-build, producing the reorg / "Sequencer was interrupted" failures
behind earlier revert attempts. Pausing sequencers around the warp
requires a lifecycle that can actually stop and resume, which it
couldn't: a second `start()` orphaned the previous poll loop (two loops
racing), and a restarted sequencer never cleared the publishers'
`interrupted` flag, so it would build and propose blocks but silently
never publish to L1.
## Approach
**Idempotent, restartable lifecycle.** `start()`/`stop()` are idempotent
across `SequencerClient`, `Sequencer`, and `PublisherManager`, and
`start()` while `STOPPING` is refused so a mid-stop start cannot orphan
a fresh loop. `PublisherManager.start()` clears the interrupted flag via
the previously-unused `restart()` methods, and `SequencerClient.start()`
starts the publisher manager before the sequencer loop so publishers are
un-interrupted before the first post-restart publish. The funding loop
is created once in the constructor and restarted across cycles, and a
start that failed to load publisher state can be retried.
**`pause()` for restarts.** Restartability is funneled through a
dedicated `Sequencer.pause()` / `SequencerClient.pause()`: it halts the
poll loop and waits for the in-flight `work()` iteration and every
pending L1 submission / fallback send to finish *without interrupting
them* — no interrupt lands mid-build, so no spurious `checkpoint-error`
is emitted and no enqueued checkpoint is dropped. It deliberately does
**not** stop inner services: the validator/HA signer and publishers keep
running, so the slashing-protection store stays open and a later
`start()` cleanly resumes. Draining happens without entering `STOPPING`,
since in that state the iteration's own `setState` calls throw
`SequencerInterruptedError`, which would fail the very iteration being
drained. This replaces the wait-for-IDLE heuristic from #24450, which
raced: sequencers reach IDLE at different times, and any of them could
re-enter `work()` before the stop landed, flaking any test that asserts
no sequencer failure events.
**`stop()` stays a full teardown.** `stop()` keeps the fast interrupting
shutdown used for production teardown, and stopping the validator client
closes its slashing-protection database (LMDB single-node / Postgres
HA), as it did before this line of work. Because restarts now go through
`pause()` — which never closes the store — `stop()` no longer needs to
leave the store open, so there is no DB-ownership bookkeeping to
distinguish "owned" from "shared" databases.
**Single shared request tracker.** The checkpoint proposal jobs'
backgrounded L1 submissions and the sequencer's own fire-and-forget
fallback sends (vote-and-prune when we cannot build, escape-hatch votes)
are tracked in one `RequestsTracker` owned by the sequencer and handed
to each job it creates. `stop()` interrupts and drains that single
tracker in one place; `pause()` awaits it untouched. A sender sleeping
until its target slot therefore cannot survive a `stop()` and publish a
stale-slot tx after a restart clears the pooled publishers' interrupted
flag: interrupting the wrapper publisher is permanent, since wrappers
are never restarted.
**e2e primitive + pilot.** `warpWithSequencersPaused(nodes, cheatCodes,
target, opts)` on `SingleNodeTestContext` (inherited by
`MultiNodeTestContext`) pauses every sequencer, runs the warp with
nobody building, and resumes them (`restart: false` leaves them paused).
Archivers, provers, and the chain monitor keep running, so clock-driven
effects such as an orphan-block prune still fire. Applied to
`pipeline_prune` to collapse its ~2-minute dead wait for the orphan
slot's prune deadline: warp two L1 slots into the slot after the
orphaned one, and resume the sequencers only once the prune is
confirmed. `TX_COUNT` is unchanged, so `assertMultipleBlocksPerSlot` and
`assertProposerPipelining` still hold.
Lifecycle calls are assumed to be serialized by the caller (all current
callers are); this does not add a mutex for truly concurrent
start/stop/pause.
The `pipeline_prune` speedup is validated by this PR's CI run — the
multi-node suite can't be run locally.1 parent 181ceed commit 7e7d8d0
13 files changed
Lines changed: 676 additions & 41 deletions
File tree
- yarn-project
- end-to-end/src
- multi-node/recovery
- single-node
- ethereum/src
- foundation/src/promise
- sequencer-client/src
- client
- sequencer
Lines changed: 29 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
105 | 129 | | |
106 | 130 | | |
107 | 131 | | |
| |||
119 | 143 | | |
120 | 144 | | |
121 | 145 | | |
122 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
123 | 149 | | |
124 | 150 | | |
| 151 | + | |
| 152 | + | |
125 | 153 | | |
126 | 154 | | |
127 | 155 | | |
| |||
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
991 | 992 | | |
992 | 993 | | |
993 | 994 | | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
994 | 1041 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
421 | 520 | | |
422 | 521 | | |
423 | 522 | | |
| |||
431 | 530 | | |
432 | 531 | | |
433 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
434 | 537 | | |
435 | 538 | | |
436 | 539 | | |
| |||
446 | 549 | | |
447 | 550 | | |
448 | 551 | | |
449 | | - | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
450 | 560 | | |
451 | | - | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
452 | 568 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
70 | 79 | | |
71 | 80 | | |
72 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
73 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
74 | 99 | | |
75 | 100 | | |
76 | 101 | | |
77 | 102 | | |
78 | 103 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
91 | 107 | | |
92 | 108 | | |
93 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
94 | 113 | | |
| 114 | + | |
95 | 115 | | |
96 | 116 | | |
97 | 117 | | |
| |||
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
55 | 93 | | |
56 | 94 | | |
57 | 95 | | |
| |||
0 commit comments