Skip to content

refactor(archiver): split L1 checkpoint ingestion into phases - #337

Open
spalladino wants to merge 7 commits into
mainfrom
spl/simplify-l1-synchronizer
Open

spalladino wants to merge 7 commits into
mainfrom
spl/simplify-l1-synchronizer

Conversation

@spalladino

Copy link
Copy Markdown
Collaborator

Splits the archiver's L1 checkpoint ingestion into named phases in a new CheckpointIngestor, without changing behavior apart from one log-context trim.

Context

ArchiverL1Synchronizer.handleCheckpoints had become one 350-line loop doing batch arithmetic, calldata retrieval, promotion lookup, attestation screening, rejected-ancestor tracking, blob fetching, persistence with the sync-point rewinds, and prune events. It shared state through a mutable RollupStatus bag, and the rule that picks which invalid checkpoint to report for invalidation could only be tested by running the whole archiver.

Approach

  • PendingChainValidationTracker owns the "first invalid checkpoint" rule and the decision of which status to persist per batch. It has its own unit tests.
  • Matching L1's last checkpoint against the local proposed one returns a tagged union (promote / evict / none). The updater's addCheckpoints takes the promoted PublishedCheckpoint directly instead of an object that repeated its fields.
  • RollupStatus holds only the rollup's four values, with Fr archives. The validation status, added blocks and last seen checkpoint are returned explicitly, and the write-only lastRetrievedCheckpoint is gone.
  • Each batch runs retrieve → plan (match, screen, build) → persist → log. The batch sync-point guard from fix(archiver): restore the L1 sync point when a checkpoint batch fails #336 keeps its extent, read point and persisted point. The first-gap rewind and the batch guard are now separate named methods.
  • These phases now live in CheckpointIngestor, the checkpoint counterpart of InboxMessageSynchronizer. The move is its own commit. Reorg reconciliation stays in the synchronizer.

The only behavior change is log context: the "Failed to reach checkpoint … Rolling back" warn no longer carries validationResult, blocksAdded and lastRetrievedCheckpoint, which serialized whole blocks into one line. The rollup-status trace likewise no longer carries validationResult and blocksAdded.

New tests in archiver-sync.test.ts cover the recovery paths directly:

  • the gap rewind falling back to the rollup start block;
  • eviction and equivocation when L1's checkpoint is also rejected;
  • promoted blocks not being reported as added;
  • the validation status across batches;
  • partial progress when a later batch fails;
  • prune-event visibility;
  • rollback to the last checkpoint seen in a pass;
  • the reconciliation early return and the status after an unwind.

Each commit is reviewable on its own.

This branch has not been deployed

No deployments
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