fix(cheat-codes): wait for post-warp L2 block in warpL2TimeAtLeastTo#22796
Closed
AztecBot wants to merge 1 commit into
Closed
fix(cheat-codes): wait for post-warp L2 block in warpL2TimeAtLeastTo#22796AztecBot wants to merge 1 commit into
AztecBot wants to merge 1 commit into
Conversation
Collaborator
Author
|
Automatically closing this stale claudebox draft PR (no updates for 5+ days). Re-open if still needed. |
benesjan
pushed a commit
that referenced
this pull request
May 13, 2026
…23213) ## Summary Fixes the merge-queue failure in `e2e_blacklist_token_contract/shielding` ([CI run](http://ci.aztec-labs.com/d5485e6652b3f32a)) where every test fails in `applyMint` with `Invalid tx: Invalid expiration timestamp`. ## Root cause `warpL2TimeAtLeastTo` (introduced in #22084) calls `eth.warp` followed by `node.mineBlock()`. The sequencer's polling loop captures `nowSeconds`/`slot` at the top of each `work()` cycle. An in-flight cycle that started just before the warp will mine an L2 block at the *pre-warp* slot — L1 sync prunes that block from the canonical chain, but it lingers in local world state and the PXE anchors subsequent txs against it. With `MAX_TX_LIFETIME == CHANGE_ROLES_DELAY == 86400s`, the resulting `expiration_timestamp` lands exactly on the post-warp slot boundary and the validator rejects the tx as soon as the wall-clock crosses to the next slot. ## Fix After `eth.warp`, retry `mineBlock` until the latest L2 block's slot is at or past the slot corresponding to the warped timestamp. The first `mineBlock` may return a stale block produced by an in-flight cycle; the next triggers a fresh sequencer cycle that reads the post-warp time and builds a block at the post-warp slot. Subsequent txs then anchor against a fresh block whose `expiration_timestamp` is well in the future. The signature of `warpL2TimeAtLeastTo`/`warpL2TimeAtLeastBy` widens from `AztecNodeDebug` to `AztecNode & AztecNodeDebug` so we can read the latest block via `getBlockData('latest')`. All current callers already type their node as the intersection. This re-applies the diagnosis from the prior #22796 (which never merged), adapted to the current `getBlockData('latest')` API. Full analysis: https://gist.github.com/AztecBot/67815cbe3c3f853d97ec3345dfb0c985 ## Test plan - `e2e_blacklist_token_contract/shielding` (originally failing) - `e2e_blacklist_token_contract/{access_control,burn,minting,transfer_*,unshielding}` — share `applyBaseSetup` → `crossTimestampOfChange` - `e2e_contract_updates` - `composed/e2e_cheat_codes` (verifies the type-widening change still resolves the methods correctly) ClaudeBox log: https://claudebox.work/s/28594b4dc64f1cd0?run=1
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
Fixes the merge-queue failure in
e2e_blacklist_token_contract/shielding(CI run) where every test fails inapplyMintwithInvalid tx: Invalid expiration timestamp.Root cause
warpL2TimeAtLeastTo(introduced in #22084) callseth.warpfollowed bynode.mineBlock(). The sequencer's polling loop capturesnowSeconds/slotat the top of eachwork()cycle. An in-flight cycle that started just before the warp will mine a block at the pre-warp slot — L1 prunes that block, but it lingers in local world state and the PXE anchors subsequent txs against it. WithMAX_TX_LIFETIME == CHANGE_ROLES_DELAY == 86400s, the resultingexpiration_timestamplands exactly on the post-warp slot boundary and the validator rejects the tx as soon as the wall-clock crosses to the next slot.Concretely, from the failing log:
Fix
After
eth.warp, retrymineBlockuntil the latest L2 block's slot is at or past the slot corresponding to the warped timestamp. The first mineBlock may return a stale block produced by an in-flight cycle; the next mineBlock triggers a fresh sequencer cycle that reads the post-warp time and builds a block at the post-warp slot. Subsequent txs then anchor against a fresh block whoseexpiration_timestampis well in the future.Signature of
warpL2TimeAtLeastTo/warpL2TimeAtLeastBywidened fromAztecNodeDebugtoAztecNode & AztecNodeDebugso we can readgetBlockHeader(). The single composed test that passed onlyAztecNodeDebugis updated to merge the two clients.Full investigation and log excerpts: https://gist.github.com/AztecBot/d0ddeadeb0c1fbe424ffabdf93ee1207
Test plan
e2e_blacklist_token_contract/shielding(the originally-failing suite)e2e_blacklist_token_contract/access_control,transfer_*,unshielding, etc. — all shareapplyBaseSetupwhich callscrossTimestampOfChangee2e_contract_updatescomposed/e2e_cheat_codes(verifies the type-widening change still resolves the methods correctly)ClaudeBox log: https://claudebox.work/s/b25160ea81bb1152?run=1