Skip to content

feat(AggLayer): implement verify_leaf_bridge#2288

Merged
mmagician merged 21 commits intoagglayer-fixed-2from
mmagician-verify-leaf-bridge
Feb 1, 2026
Merged

feat(AggLayer): implement verify_leaf_bridge#2288
mmagician merged 21 commits intoagglayer-fixed-2from
mmagician-verify-leaf-bridge

Conversation

@mmagician
Copy link
Collaborator

@mmagician mmagician commented Jan 16, 2026

closes #2276

@mmagician mmagician changed the base branch from next to agglayer January 16, 2026 15:33
@mmagician mmagician changed the title feat: implement verify_leaf_bridge feat(AggLayer): implement verify_leaf_bridge Jan 16, 2026
@mmagician mmagician added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Jan 16, 2026
@mmagician
Copy link
Collaborator Author

Added a :no changelog" label (as this PR is included in the changelog entry from #2295)

@mmagician mmagician marked this pull request as ready for review January 16, 2026 17:44
@mmagician mmagician added the agglayer PRs or issues related to AggLayer bridging integration label Jan 21, 2026
@mmagician mmagician requested a review from bobbinth January 21, 2026 15:24
* feat: verify_leaf stubbed

feat: fill some TODOs

* chore: test global index processing

* chore: update comments

* self review

* changelog
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I left some comments inline - most should be pretty easy to address.

Comment on lines -22 to 23
#! Outputs: [LEAF_VALUE]
#! Outputs: [LEAF_VALUE[8]]
#!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to keep the TODO here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but I wonder if a better name for this module is global_exit_tree.masm. It seems like most (if not all) functionality here is about global exit trees. And the naming would also be consistent with local_exit_tree.masm module we already have.

#! Outputs: [leaf_index]
#!
#! Invocation: exec
pub proc process_global_index_mainnet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having this procedure be pub makes it a part of the account interface. AFAICT, this is an internal procedure, and so, should probably not be pub.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has unit tests, IIRC making the procedure public was necessary for that?

cursoragent and others added 3 commits January 28, 2026 12:55
Addresses PR feedback: clarify that mainnet exit root is at exit_roots_ptr
and rollup exit root is at exit_roots_ptr + 8.

Co-authored-by: marti <marti@hungrycats.studio>
This procedure has been replaced by verify_merkle_proof and is no longer used.

Co-authored-by: marti <marti@hungrycats.studio>
Addresses PR feedback: organize the file with clear section headers for:
- Constants (storage slots and memory layout)
- Errors
- Public interface procedures
- Helper procedures

Co-authored-by: marti <marti@hungrycats.studio>
@mmagician mmagician force-pushed the mmagician-verify-leaf-bridge branch from b68528b to 86d7153 Compare January 28, 2026 12:58
@mmagician mmagician changed the base branch from agglayer to agglayer-fixed-2 January 28, 2026 12:58
@mmagician mmagician force-pushed the mmagician-verify-leaf-bridge branch from 31aff4e to 1b3acaf Compare January 28, 2026 14:30
@mmagician
Copy link
Collaborator Author

I know this has been approved already, but I've done a rather large rebase (on top of agglayer-fixed-2 for cleaner history) - hence the new request for reviews.

This comment was marked as resolved.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you. I left some comments inline - mostly about adding clarity and improving code organization.

Comment on lines +56 to +61
#! Verifies a Merkle proof for a leaf value against a root.
#!
#! Inputs: [smt_proof_ptr, leaf_index, LEAF_VALUE[8], root_ptr]
#! Outputs: []
#!
pub proc verify_merkle_proof
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this procedure will panic if the proof cannot be verified, right? If so, would be good to say this explicitly.

Also, I'm assuming we are panicking rather than returning a boolean too keep the interfaces consistent with Solidity code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the proc here is just a stub, and the panic docs are already addressed by Andrew in #2361

Also, I'm assuming we are panicking rather than returning a boolean too keep the interfaces consistent with Solidity code?

indeed

@mmagician mmagician merged commit 768b496 into agglayer-fixed-2 Feb 1, 2026
15 checks passed
@mmagician mmagician deleted the mmagician-verify-leaf-bridge branch February 1, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agglayer PRs or issues related to AggLayer bridging integration no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AggLayer: implement verify_leaf_bridge

5 participants