feat!: improve L2ToL1MessageWitness API#21231
Open
nventuro wants to merge 4 commits intomerge-train/fairiesfrom
Open
feat!: improve L2ToL1MessageWitness API#21231nventuro wants to merge 4 commits intomerge-train/fairiesfrom
nventuro wants to merge 4 commits intomerge-train/fairiesfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Refactors `computeL2ToL1MembershipWitness` to take a `txHash` instead of requiring the caller to pass the epoch number. The epoch, checkpoint index, block index, and tx index are now resolved internally via the node. Also adds `epochNumber` to `L2ToL1MembershipWitness` type, adds `getCheckpointsDataForEpoch` to `AztecNode`, and supports explicit `messageIndexInTx` for disambiguating duplicate messages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
The old API had two issues:
This changes things so that users no longer need to know the epoch, and instead query with
(message, txHash). If more than one message is found in the tx matchingmessage, we throw and request an additional optional parammessageIndexInTx. If this is passed, then we assert that the message at that index indeed matchesmessage.Most users should not need to pass the index, but it is there in case it is needed. It is expected that apps would know the messages they're interested in, and can look at indices from the tx effects.
Doing this requires fetching the epoch as well as checkpoint, block and tx indices from the node. There was no API for checkpoint data, so I exposed
getCheckpointsDataForEpochso that we can find the checkpoint's index in the epoch. I also added the epoch number to the tx receipt.I used Claude heavily here as I don't really know my way around the node and archiver code, but I think the result makes sense.
Closes #20874