test: close root-cause race in warpL2TimeAtLeastBy timestamp check - #24285
Closed
AztecBot wants to merge 1 commit into
Closed
test: close root-cause race in warpL2TimeAtLeastBy timestamp check#24285AztecBot wants to merge 1 commit into
AztecBot wants to merge 1 commit into
Conversation
warpL2TimeAtLeastBy reads the L1 timestamp to derive its target, then warpL2TimeAtLeastTo re-read L1 for its future-check guard. A live sequencer can warp L1 forward by a full slot between the two reads, pushing the small sub-slot target into the past and throwing 'is not in the future' even though the downstream slot/mine logic uses fresh rollup state and would advance time correctly. This is the composed e2e_cheat_codes flake that #24279 mitigated with a test-level retry. Funnel both public methods through a private #warpL2TimeAtLeastTo that takes the caller's already-observed L1 timestamp, so warpL2TimeAtLeastBy reuses the single read its target was derived from. target = base + duration (base >= currentL1, duration > 0) is then always strictly in the future, closing the race window at its root. Public signatures are unchanged; the direct warpL2TimeAtLeastTo guard (and its 'past timestamp throws' test) still reads L1 itself.
Collaborator
Author
|
Automatically closing this stale claudebox draft PR (no updates for 5+ days). Re-open if still needed. |
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.
Why
The
merge-train/spartan-v5train PR (#24272) was dequeued from the merge queue. Investigating the two merge-queue runs showed two distinct causes:e2e_cheat_codes › warpL2TimeAtLeastBy with sub-slot duration auto-adjusts to next slotthrewwarpL2TimeAtLeastTo: target timestamp <T> is not in the future (current L1 timestamp is <T+11>). This is the composed cheat-code timestamp race.x8-fullgrind's build instance went unreachable (SSM command … did not succeed … status=Failed, statusDetails=Undeliverable, responseCode=-1) after ~76 min; the other 7 grinds passed with #24279 present.#24279 mitigated the race at the test level with a 5-attempt retry helper. This PR removes the race at its root so the retry is no longer load-bearing.
The race
warpL2TimeAtLeastByreads the L1 timestamp to derivetarget = max(L2, L1) + duration, then delegated towarpL2TimeAtLeastTo, which re-read L1 for its future-check guard. A live sequencer can warp L1 forward by a full slot between those two reads, so for a small sub-slotdurationthe freshly-read L1 overtakestargetand the guard throwsis not in the future— even though the downstream slot/mine logic uses freshrollupstate and would have advanced time correctly.The fix
Funnel both public methods through a private
#warpL2TimeAtLeastTo(node, targetBigInt, currentTimestamp)that takes the caller's already-observed L1 timestamp.warpL2TimeAtLeastBynow reuses the single L1 read its target was derived from, sotarget = base + duration(withbase ≥ currentL1andduration > 0) is always strictly in the future — the throw window is gone. The publicwarpL2TimeAtLeastTostill reads L1 itself for direct callers, preserving thewarpL2TimeAtLeastTo with past timestamp throwsbehavior. Public signatures are unchanged.Testing
cheat_codes.ts; all external callers use the unchanged public methods. A full local./bootstrap.sh ciwas not runnable in this environment (it orchestrates remote EC2 grind instances and the composede2e_cheat_codestest needs a live docker-compose network), so verification runs through the train's merge-queue CI.Created by claudebox · group:
slackbot