Skip to content

feat: archiver syncs Inbox buckets (A-1379)#24784

Open
spalladino wants to merge 2 commits into
spl/a-1378-propose-validationfrom
spl/a-1379-archiver-buckets
Open

feat: archiver syncs Inbox buckets (A-1379)#24784
spalladino wants to merge 2 commits into
spl/a-1378-propose-validationfrom
spl/a-1379-archiver-buckets

Conversation

@spalladino

Copy link
Copy Markdown
Contributor

Part of the Fast Inbox stack (AZIP-22). Makes the archiver track the L1 Inbox rolling-hash buckets introduced in A-1377, validate the full-width consensus rolling-hash chain, and expose the bucket queries the sequencer/validator will consume (A-1382/A-1383). Purely additive: the legacy per-checkpoint getL1ToL2Messages path is unchanged.

What's added

  • InboxMessage gains inboxRollingHash: Fr, bucketSeq, and bucketTimestamp (the L1 block timestamp that keys the bucket). mapLogInboxMessage propagates them; the ethereum MessageSent log now also carries the emitting L1 block's timestamp.
  • MessageStore persists a per-bucket snapshot ({ inboxRollingHash, totalMsgCount, timestamp, msgCount, lastMessageIndex }) keyed by bucket sequence, plus a timestamp→sequence index for at-or-before lookups. Snapshots are written as messages are inserted and rewound (deleted / boundary-bucket recomputed) on reorg removal, all inside the existing kv-store transactions.
  • addL1ToL2Messages now validates the full-width consensus rolling hash (updateInboxRollingHash) alongside the legacy 128-bit keccak chain. Both run until the streaming inbox flips on (A-1388 removes the legacy one).
  • Three queries on L1ToL2MessageSource (implemented by the archiver, supported by the mock, exposed over the archiver RPC schema): getLatestInboxBucketAtOrBefore(timestamp), getInboxBucket(seq), and getL1ToL2MessagesBetweenBuckets(fromExclusive, toInclusive). New InboxBucket type + zod schema in stdlib messaging.

Notes

  • No migration: ARCHIVER_DB_VERSION is bumped 7 → 8, so nodes resync their L1→L2 messages from L1. Archiver message stores are rebuildable from L1, so this is acceptable on this release line.
  • Folds in A-1344: InboxMessage.l1BlockNumber is widened from UInt32 to UInt64 (the serialization was being rewritten anyway).
  • Field naming: the full-width hash is inboxRollingHash: Fr to match the updateInboxRollingHash mirror, CheckpointHeader.inboxRollingHash, and the decoded MessageSent event — the value is a truncated-sha256-to-field element. (The plan's provisional consensusRollingHash: Buffer32 predates the implemented event.) The legacy rollingHash: Buffer16 stays until A-1388.

Out of scope

  • Reorg-driven bucket invalidation (a reorg that replays the identical message leaves but re-buckets them across different L1 blocks changes neither the 128-bit nor the full-width leaf-based hash, so localStateMatches cannot detect it, and the allowed message-reinsertion path leaves its bucket snapshot stale). This is handled by A-1389, and bucket consumption is gated off by the streamingInbox flag pre-flip.
  • Sequencer/validator consumption (A-1382/A-1383), proposal bucket-reference types (A-1381), and removing the legacy 128-bit hash (A-1388).

Testing

  • message_store.test.ts: bucket snapshotting (multi-message, cross-batch, rollover), full-width chain-mismatch detection, reorg rewinding, and the three queries incl. boundary cases.
  • archiver-sync.test.ts: end-to-end sync now exercises the full-width chain validation and asserts the bucket queries against the synced state (the fake L1 state mirrors the on-chain bucket assignment).
  • stdlib archiver interface RPC round-trip tests for the three new methods.

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