Skip to content

feat: sequencer streaming message selection, flag off (A-1382)#24787

Open
spalladino wants to merge 3 commits into
spl/a-1381-proposal-bucket-reffrom
spl/a-1382-sequencer-streaming
Open

feat: sequencer streaming message selection, flag off (A-1382)#24787
spalladino wants to merge 3 commits into
spl/a-1381-proposal-bucket-reffrom
spl/a-1382-sequencer-streaming

Conversation

@spalladino

Copy link
Copy Markdown
Contributor

Implements A-1382 (FI-12): sequencer streaming Inbox message selection behind a streamingInbox flag, default off. Part of the Fast Inbox stack (AZIP-22).

Flag semantics

  • One shared env var STREAMING_INBOX -> streamingInbox: boolean (default false), defined once in stdlib's sharedSequencerConfigMappings so the sequencer reads it now and the validator (A-1383) maps the same env. Flag off is byte-identical: the new paths are gated at checkpoint start and per block.
  • With the flag on, checkpoints are expected to fail L1 submission (on-chain propose still enforces the legacy per-checkpoint consumption until the flip, A-1384). The streaming path is exercised with unit/mock tests only.

Selection policy (mirrors ProposeLib.validateInboxConsumption)

New pure selector sequencer-client/src/sequencer/inbox_bucket_selector.ts, run per block:

  • Pick the newest lag-eligible bucket (getLatestInboxBucketAtOrBefore(now - INBOX_LAG_SECONDS)); on the checkpoint's final block, also consider the cutoff bucket and take the newer, so consumption reaches the censorship floor.
  • Walk back from the candidate to the newest bucket that fits both the per-block cap (bucket.totalMsgCount - parent.totalMsgCount) and the per-checkpoint cap (bucket.totalMsgCount - checkpointStartTotalMsgCount). If even the first forward bucket overshoots the per-checkpoint cap, consume nothing — matching L1's cap-escape (next.totalMsgCount - parentTotal > MAX_L1_TO_L2_MSGS_PER_CHECKPOINT).
  • The inclusive <= comparisons make a bucket exactly INBOX_LAG_SECONDS old eligible and a bucket exactly at the cutoff mandatory, matching L1's strict next.timestamp > cutoff.

Cutoff is computed as getTimestampForSlot(slot - 1) - INBOX_LAG_SECONDS, matching ProposeLib exactly (not the consensus timetable's getBuildFrameStart, which subtracts an extra ethereum-slot). Boundary vectors pinned against A-1371 resolution section 13.

Cutoff floor

On the checkpoint's final block (including the block that reaches the per-checkpoint block cap) the cutoff is a consumption floor, so the checkpoint's own header would pass the L1 censorship assert post-flip.

Builder interface change

  • ICheckpointBlockBuilder.buildBlock gains an optional per-block l1ToL2Messages bundle; ICheckpointsBuilder.startCheckpoint gains insertMessagesPerBlock. Threaded through FullNodeCheckpointsBuilder/CheckpointBuilder and the lightweight builder (first-in-checkpoint bundle padded, non-first compact; the inHash/rolling hash recompute over the accumulated logical messages).
  • An optional signed bucket reference is threaded onto block proposals (Validator.createBlockProposal -> ValidationService -> BlockProposal.createProposalFromSigner).

Constant

INBOX_LAG_SECONDS = 12 added to constants.nr and regenerated into the TS constants (constants.gen.ts). Not emitted to ConstantsGen.sol (Solidity whitelist); ProposeLib keeps its local copy pending consolidation (A-1434).

Open item / to verify on CI

  • Non-genesis cross-checkpoint parent-bucket sourcing is not wired: there is no by-rolling-hash archiver lookup and legacy parents do not sit on a bucket boundary, so only the genesis base case is resolved and non-genesis throws (safely caught -> skipped proposal). This is a flip-time concern.
  • Local build/typecheck of sequencer-client, validator-client, prover-client is blocked by the known stale-artifact/@aztec/bb-avm-sim breakage, so CI is the typecheck of record for the job/builder/proposal edits. The pure selector unit tests and the stdlib config changes were verified locally.

…ING_INBOX (A-1382)

Behind the shared `streamingInbox` flag (env `STREAMING_INBOX`, default off), the
sequencer selects L1-to-L2 messages from the Inbox rolling-hash buckets per block
instead of consuming the whole checkpoint's messages up front.

- Adds a pure `inbox_bucket_selector` that mirrors `ProposeLib.validateInboxConsumption`:
  newest lag-eligible bucket, per-block/per-checkpoint cap walk-back with cap-escape,
  and a last-block cutoff floor (cutoff = toTimestamp(slot-1) - INBOX_LAG_SECONDS).
- Adds `INBOX_LAG_SECONDS` (12) to constants.nr, regenerated into the TS constants.
- Threads a per-block message bundle through the checkpoint builder interface and an
  optional signed bucket reference onto block proposals.
- Flag off is byte-identical: the new paths are gated at checkpoint start and per block.
…inal block and defer bundle accumulation (A-1382)

- The censorship cutoff floor now applies on whichever block ends the checkpoint,
  including the block that reaches the per-checkpoint block cap, not only the
  timetable's last sub-slot, so the checkpoint always consumes through the cutoff.
- The lightweight builder accumulates a block's streaming message bundle only after
  the block is fully built, so a mid-build failure leaves the checkpoint's message
  list (and its inHash/rolling hash) consistent with the blocks actually built.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant