Commit d3be5a7
authored
feat: Multiple blocks per checkpoint (#18825)
## Summary
This PR refactors the sequencer to propose checkpoints instead of
individual blocks, enabling multi-block checkpoint proposals. The
sequencer now builds multiple blocks within a slot and packages them
into a single checkpoint for L1 publication.
_Yes, this text was written by Claude_
## Environment Variables
### New
- **`SEQ_BLOCK_DURATION_MS`**: Duration per block in milliseconds when
building multiple blocks per slot. If undefined (default), builds a
single block per slot using the full slot duration.
- **`SEQ_BUILD_CHECKPOINT_IF_EMPTY`**: Whether to build and publish an
empty checkpoint when there are no txs (defaults to `true`).
### Changed
- **`SEQ_MAX_L1_TX_INCLUSION_TIME_INTO_SLOT`** changed to
**`SEQ_L1_PUBLISHING_TIME_ALLOWANCE_IN_SLOT`**: Aka "the dead zone".
Renamed to better reflect its purpose of how much time (in seconds) we
allow in the slot for publishing the L1 tx (defaults to 1 L1 slot).
- **`SEQ_TX_POLLING_INTERVAL_MS`** changed to
**`SEQ_POLLING_INTERVAL_MS`**: This is the polling for the sequencer
loop, unrelated to polling for txs.
## Architecture Changes
### Main `Sequencer`
Sequencer now focuses on orchestration and state management by
delegating checkpoint proposal logic to a job-like class. It now manages
lifecycle of checkpoint proposal jobs and handles checkpoint
invalidation.
### `CheckpointProposalJob` (new)
Extracted checkpoint proposal logic into a dedicated, self-contained job
that manages the full lifecycle of building and proposing a checkpoint.
Handles block building loop, attestation collection, L1 publishing, and
P2P broadcasting.
### `CheckpointVoter` (new)
Handles voting for slashing and governance proposals, called from both
the main sequencer and the proposal job.
### `SequencerPublisher`
Updated the publisher to work with Checkpoints as opposed to Blocks.
### `CheckpointsBuilder` (new)
Emulates the old `BlockBuilder` but for checkpoints, managing
checkpoint-level state, and orchestrating building multiple blocks
within a checkpoint. Builds on top of the
`LightweightCheckpointBuilder`.
## Miscellaneous Changes
### Disposable Interface
`MerkleTreeWriteOperations`, `GuardedMerkleTree`, and `HintingDbSource`
now implement a `Disposable` interface for proper resource cleanup.
### Global Variables
Introduced a `CheckpointGlobalVariables` for checkpoint-level constants,
separating block-level and checkpoint-level variables.
### Sequencer Config
All sequencer config defaults are now in a single
`DefaultSequencerConfig` object, and the `Sequencer` works with a config
type with most entries defined.
## Placeholders
### Validator Client
Block proposals currently create dummy checkpoint proposals, and
checkpoint proposal creation needs to be distinguished from block
proposals.
### Archiver & World State Sync
Provisional blocks are not yet sent to archiver and world state, actual
sync mechanism to be wired once available.
### P2P Broadcasting
Checkpoint proposals and provisional blocks use placeholder P2P API,
needs wiring to new P2P protocol once available.
## Pending Work
1. **Timetable fixes**: Review timing for new states and fix timing
calculations.
2. **Checkpoint invalidation**: Implement proper checkpoint invalidation
(currently invalidates blocks)
3. **Checkpoint number computation**: Derive proper checkpoint numbers
(currently assumes checkpoint number is the same as block number)
4. **Block builder cleanup**: Remove old block builder in favor of
CheckpointsBuilder
5. **Metrics review**: Audit all metrics for checkpoint-level tracking
6. **Re-enable disabled tests**: Fix and restore checkpoint proposal
failure tests and multi-block checkpoint testsFile tree
86 files changed
+3192
-1390
lines changed- yarn-project
- archiver
- aztec-node/src/aztec-node
- aztec/src/cli
- cli/src/config
- end-to-end
- scripts
- src
- composed/web3signer
- e2e_epochs
- e2e_fees
- e2e_l1_publisher
- e2e_multi_validator
- e2e_p2p
- e2e_sequencer
- ethereum/src
- l1_tx_utils
- test
- foundation
- src
- config
- iterator
- sleep
- timer
- prover-client
- src
- light
- mocks
- prover-node
- pxe/src
- sequencer-client
- src
- client
- global_variable_builder
- publisher
- sequencer
- test
- simulator/src/public
- public_processor
- stdlib/src
- checkpoint
- interfaces
- rollup
- stats
- tx
- telemetry-client/src
- txe/src/state_machine
- validator-client
- src
- world-state/src
- native
- synchronizer
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
86 files changed
+3192
-1390
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
427 | 428 | | |
428 | 429 | | |
429 | 430 | | |
430 | | - | |
| 431 | + | |
431 | 432 | | |
432 | 433 | | |
433 | 434 | | |
| |||
462 | 463 | | |
463 | 464 | | |
464 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
465 | 473 | | |
466 | 474 | | |
467 | 475 | | |
| |||
470 | 478 | | |
471 | 479 | | |
472 | 480 | | |
473 | | - | |
| 481 | + | |
474 | 482 | | |
475 | 483 | | |
476 | 484 | | |
| |||
487 | 495 | | |
488 | 496 | | |
489 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
490 | 505 | | |
491 | 506 | | |
492 | 507 | | |
| |||
501 | 516 | | |
502 | 517 | | |
503 | 518 | | |
504 | | - | |
| 519 | + | |
505 | 520 | | |
506 | 521 | | |
507 | 522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| 193 | + | |
192 | 194 | | |
193 | 195 | | |
194 | 196 | | |
| |||
246 | 248 | | |
247 | 249 | | |
248 | 250 | | |
| 251 | + | |
249 | 252 | | |
250 | 253 | | |
251 | 254 | | |
| |||
303 | 306 | | |
304 | 307 | | |
305 | 308 | | |
| 309 | + | |
306 | 310 | | |
307 | 311 | | |
308 | 312 | | |
| |||
396 | 400 | | |
397 | 401 | | |
398 | 402 | | |
| 403 | + | |
399 | 404 | | |
400 | 405 | | |
401 | 406 | | |
| |||
484 | 489 | | |
485 | 490 | | |
486 | 491 | | |
| 492 | + | |
487 | 493 | | |
488 | 494 | | |
489 | 495 | | |
| |||
577 | 583 | | |
578 | 584 | | |
579 | 585 | | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
580 | 592 | | |
581 | 593 | | |
582 | 594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
144 | 147 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| |||
0 commit comments