refactor: replace proposedCheckpoint tip with atomic archiver read#24008
Open
spalladino wants to merge 1 commit into
Open
refactor: replace proposedCheckpoint tip with atomic archiver read#24008spalladino wants to merge 1 commit into
spalladino wants to merge 1 commit into
Conversation
…oint
Replace the source-side `proposedCheckpoint` tip on `L2Tips` with a dedicated
atomic archiver read `getProposedCheckpoint()` returning `{ tip, data }` (or
undefined when no proposal leads the checkpointed frontier).
The tip and its payload were read separately (JS-side tips cache vs. a direct
store read on `#proposedCheckpoints`), forcing snapshot-race reconciliation in
the sequencer. The single atomic read makes tip and payload coherent by
construction, so that reconciliation code is deleted. `L2Tips`, `ChainTips`,
and `LocalL2Tips` collapse to one shape, and the PXE/TXE fabrication shims are
removed.
Public node behavior is preserved: `'proposed'` in getCheckpointNumber/
resolveCheckpointParameter still means the proposed frontier (incl. unconfirmed),
only the backing read changes. `getProposedCheckpoint` is archiver-internal +
sequencer-facing; it is not exposed over node RPC.
Fixes A-978
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The
proposedCheckpointtip onL2Tipswas the checkpoint frontier including L1-submitted-but-unconfirmed proposals, sitting betweenproposed(blocks) andcheckpointed(confirmed). It existed only for proposer pipelining and had outlived its usefulness as a tip:ChainTipsalready excluded it), so no schema or storage migration is involved in removing it.checkpointed), which is why earlier work had already narrowedLocalL2Tipsto omit it.proposedCheckpoint: checkpointedvalue.#proposedCheckpointsfor the payload (getProposedCheckpointData). A concurrent archiver write could be observed split, which forced explicit race-detection/refuse-to-proceed code in the sequencer'scheckSync.Approach
Drop the
proposedCheckpointtip fromL2Tipsand replace it with a dedicated atomic archiver API:It performs a single read-only transaction over
#proposedCheckpoints, derives the tip entirely from the payload (checkpoint number, header hash, last block =startBlock + blockCount - 1, block hash from the block store), and returnsundefinedwhen no proposed checkpoint leads the checkpointed frontier. Because tip and payload come from one snapshot, they are always coherent.The archiver keeps tracking proposed checkpoints internally — the
#proposedCheckpointspayload store,addProposedCheckpoint, andgetProposedCheckpointData(now used for by-number/by-slot/by-tag lookups in the node'sgetCheckpointfallback) are unchanged. This is interface slimming, not data removal.API changes (internal)
L2BlockSource.getProposedCheckpoint()added (also inArchiverApiSchema). Archiver-internal + sequencer-facing; not exposed on the node RPC surface.L2BlockSource.getProposedCheckpointData(query?)retained for confirmed→proposed fallback lookups by number/slot/tag.proposedCheckpointremoved fromL2TipsandL2TipsSchema;'proposedCheckpoint'removed fromL2BlockTag.ChainTip,ChainTips,ChainTipsSchema, andLocalL2Tipsnow alias theirL2Block*counterparts directly (the three tip shapes converge to one).ProposedCheckpointtype and exportedL2TipIdSchemaadded instdlib.Public node behavior is identical:
'proposed'ingetCheckpointNumber/resolveCheckpointParameterstill means the proposed frontier (including unconfirmed), falling back to the checkpointed frontier when no proposal leads it — only the backing read changed.Changes
L2Tips/L2TipsSchema/L2BlockTag; addedProposedCheckpoint,getProposedCheckpointto theL2BlockSourceinterface, andL2TipIdSchema; collapsedChainTip(s)/LocalL2Tipsto aliases; addedgetProposedCheckpointtoArchiverApiSchema; updatedfactories.tsand interface tests.BlockStore.getProposedCheckpoint()(atomic) and exposed it viadata_source_base; removed theproposedCheckpointcursor fromgetL2TipsData(tips cache); rewrotepruneOrphanProposedBlocksto derive the proposed-checkpoint frontier block number from the payload store; cleaned the trace log and the mocks.checkSyncnow consumes the atomicgetProposedCheckpoint(); deleted the snapshot-race reconciliation block (the inconsistent-proposed-checkpoint refuse-to-proceed guard) that only existed because tip and payload were read separately;hasProposedCheckpointis now derived from the atomic result. Migratedautomine_sequencernext-checkpoint-number computation.getCheckpointNumber('proposed'),resolveCheckpointParameter('proposed'), and thesimulatePublicCallstarget-slot computation now usegetProposedCheckpoint(); the proposed-checkpoint slot is read from the payload header (no extra block fetch in the leading case).getChainTipssimplified.proposedCheckpoint: tips.checkpointedfabrication shims in the PXE node adapter and the TXE archiver.Fixes A-978