fix(bot): check L1-to-L2 message readiness against PXE sync tip#24004
Open
spalladino wants to merge 4 commits into
Open
fix(bot): check L1-to-L2 message readiness against PXE sync tip#24004spalladino wants to merge 4 commits into
spalladino wants to merge 4 commits into
Conversation
The bot waits for L1-to-L2 message readiness against the latest tip while its embedded PXE may sync to an older tip (e.g. proven/checkpointed). This let readiness pass on a newer proposed/latest block while PXE simulation anchored to a tip where the message was not yet in the message tree, crashing the bot when it then tried to consume the message. Extend isL1ToL2MessageReady/waitForL1ToL2MessageReady to accept an optional chain tip (default latest, preserving existing behavior) and thread the PXE syncChainTip from bot setup through BotRunner and BotFactory into all readiness checks, including CrossChainBot message selection.
Collaborator
Flakey Tests🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry. |
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 bot waits for its Fee Juice bridge claim with
waitForL1ToL2MessageReadyand then immediately simulates the account deployment that consumes the claim. Readiness was always evaluated against thelatestblock, but the bot's embedded PXE can be configured to sync to a slower tip (e.g.syncChainTip=checkpointed). When the tips diverge, readiness passes while the PXE simulation anchors to an older block whose message tree does not contain the message yet, and simulation fails withNo L1 to L2 message found for message hash ..., sending the bot into a crash loop where it repeatedly validates a claim it cannot consume.Approach
Make readiness answer the question the consumer actually needs: is the message present at the same chain tip the consuming PXE will anchor its simulation to?
isL1ToL2MessageReady/waitForL1ToL2MessageReadyaccept an optional chain tip (BlockTag), defaulting tolatestso existing callers are unaffected. The helper compares the message checkpoint against the block at the requested tip.addBotextractssyncChainTipfrom the same PXE options its callers use to build the embedded wallet, and threads it throughBotRunner→ botcreate→BotFactory. This keeps the readiness tip from drifting from the PXE's actual config. Polling the node at the PXE's configured tip (rather than exposing the PXE anchor) is required for the wait to make progress, since the PXE synchronizer is pull-on-demand and its anchor only advances onpxe.sync().BotFactory, the cross-chain setup wait, and the steady-state message selection inCrossChainBot.API changes
isL1ToL2MessageReady(node, msgHash, chainTip?)andwaitForL1ToL2MessageReady(node, msgHash, { timeoutSeconds, chainTip? })in@aztec/aztec.js/messagingaccept an optionalBlockTag(default'latest', preserving previous behavior). Their node dependency narrowed fromgetBlockto the cheapergetBlockData.Changes
utils/cross_chain.ts; new unit tests covering the latest fallback and the tip-aware path.BotRunner,Bot/AmmBot/CrossChainBot.create, andBotFactoryaccept the PXE sync tip and use it at every L1-to-L2 readiness check.addBotextractssyncChainTipfrom the PXE options and passes it toBotRunner.Fixes A-1155