execution: preserve parent-chain blockhash transitions - #4720
Draft
exocognosis wants to merge 1 commit into
Draft
Conversation
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.
Summary
Prevent the sequencer from skipping parent-chain blockhash transitions when its header reader observes a jump in the L1 block number.
This change:
Problem
If the previous L2 header records parent-chain block
Nand the header reader next observesN+2, the sequencer currently placesN+2directly in the next incoming message. ArbOS then associates the previous L2 block hash with parent-chain blockN+1. The ring-buffer entry for blockNis never updated, so an older value can remain in that slot and reappear after the 256-entry ring wraps.Lowering the header reader polling interval reduces how often this happens, but it does not guarantee that every intermediate header will be observed. Network delays and temporary reader stalls can still produce jumps.
Solution
Before constructing the sequencer message header, compare the latest observed parent-chain block number with the number stored in the previous L2 header. When the observation is more than one block ahead, use
previous + 1for the new message. If the observation remains ahead, each following L2 block advances one more step until the sequencer catches up.For example, an observation jump from
NtoN+2now produces transitions throughN+1and thenN+2. ArbOS receives the previous L2 block hash for each transition and updates the corresponding ring-buffer slots in order.Normal one-block progress, unchanged observations, and lower observations keep their existing behavior. Headers without ArbOS metadata also keep the existing behavior for compatibility.
Consensus considerations
Changing
ApplyInternalTxUpdatedirectly would alter the ArbOS state transition for historical input and would require an ArbOS version gate plus coordinated activation. This change avoids that consensus risk by correcting the sequencer-produced input before it enters deterministic execution. Validators continue to replay the exact incoming message chosen by the sequencer.After a missed observation, the parent-chain number exposed by newly produced L2 blocks can temporarily trail the reader's latest observation. It catches up by one parent-chain block per produced L2 block. Existing stale ring-buffer entries are not rewritten, but they age out as the ring advances. The change prevents new gaps on the sequencer path described in the issue.
Validation
go test ./execution/gethexec -run '^TestNextSequencerParentChainBlockNumber' -count=1go run ./linters ./execution/gethexecgo vet ./execution/gethexecgit diff --checkFixes #4718