Repository navigation
fix(engine-api): never assemble a block older than its parent - #221
Merged
Merged
Conversation
The CL passes its wall-clock second as the timestamp of every assembled block, and the engine API used it as given. When the sequencer's clock steps back, or HA leadership moves to a node whose clock is behind, that second falls below the parent's timestamp. Every follower rejects such a block (TimestampIsInPast), but the sequencer imports the payload it built through the already-seen path without re-validating the header, so it makes the block canonical and keeps building on it: the chain splits. Under HA the followers' FSM panics on the failed apply and the cluster stalls. Raise the requested timestamp to the earliest one the header rules accept: the parent's own timestamp from Emerald on, one second later before it. Only sequencer assembly is adjusted; newSafeL2Block rebuilds blocks already committed to L1 and keeps their timestamps as given. A warning is logged whenever a timestamp is raised, since it means the sequencer clock is behind.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
dylanCai9
approved these changes
Nov 10, 2026
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
time.Now().Unix()as the timestamp of everyengine_assembleL2BlockV2call, andbuild_l2_payloadused it unchanged. Themax(parent + 1, now)default only applied when no timestamp was passed.timestamp < parent.timestamp. Followers reject it withTimestampIsInPast. The sequencer does not: the built payload is already in the engine tree, so its ownengine_newL2BlockV2returns through the already-seen path without header validation, the block becomes canonical and the sequencer keeps building on it.engine_newSafeL2Blockis unchanged: derivation rebuilds blocks already committed to L1 and must reproduce them exactly.morph-geth after Emerald has the same exposure (its worker raises a stale timestamp to
parent + 1, butPreparethen caps it at the local clock, and the leader skips verification of its own block), so this is not a regression of the migration, but the reth sequencer no longer has it.Tests
morph-engine-api):payload_timestampraises assembly timestamps behind the parent (to the parent's from Emerald on, one second past it before), keeps valid ones, keeps derivation timestamps as given, and keeps themax(parent + 1, now)default.engine.rs, two nodes):assemble_l2_block_v2_raises_timestamp_behind_parent(all forks active) andassemble_l2_block_v2_raises_timestamp_past_parent_before_emerald(pre-Emerald schedule). Block 2 is assembled with a timestamp five seconds behind block 1, comes back at block 1's timestamp (one second later before Emerald), and becomes canonical on both the sequencer and a follower. With the fix reverted both fail on the timestamp assertion: the block comes back with the requested timestamp (5) instead of 10 / 11.make lint,make clippy-e2e,cargo test --doc --all(6 passed),make test(910 passed),make test-e2e(130 passed).Scope
Found in the pre-migration sequencer/validator audit (SEQB-01 / SEQ-ENG-01). This PR only fixes the timestamp. The sequencer still imports the payloads it builds through the already-seen path without header or pre-execution validation, so any other disagreement between the builder and the consensus rules (for example a
--morph.max-tx-payload-bytesabove the consensus limit) would still reach followers unchecked.