Stubbed out bridging-out flow: B2AGG note -> AggLayerBridgeOut contract -> BURN note#2023
Stubbed out bridging-out flow: B2AGG note -> AggLayerBridgeOut contract -> BURN note#2023
B2AGG note -> AggLayerBridgeOut contract -> BURN note#2023Conversation
f7a0204 to
9c18c62
Compare
9c18c62 to
10e3470
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR implements a stubbed-out bridging-out flow for the AggLayer integration, establishing the infrastructure for transferring assets from Miden to the AggLayer. The implementation creates a B2AGG note type that can be consumed by accounts with the bridge_out component, which then generates a BURN note to destroy the bridged assets.
Key changes:
- Adds B2AGG note script that validates bridge-out requests and calls the bridge_out account component
- Implements bridge_out account component with stubbed MMR frontier functions and burn note creation
- Introduces utility functions for Ethereum address conversion to/from Felt values
- Includes comprehensive integration test covering the full bridge-out flow
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/miden-testing/tests/lib.rs | Adds agglayer module to test suite |
| crates/miden-testing/tests/agglayer/mod.rs | Declares bridge_out test module |
| crates/miden-testing/tests/agglayer/bridge_out.rs | Comprehensive integration test for B2AGG note → bridge_out component → BURN note flow |
| crates/miden-lib/src/lib.rs | Exposes new agglayer module |
| crates/miden-lib/src/errors/note_script_errors.rs | Adds error constants for B2AGG note validation |
| crates/miden-lib/src/agglayer/utils.rs | Provides Ethereum address conversion utilities |
| crates/miden-lib/src/agglayer/mod.rs | Main module exposing B2AGG script and bridge_out component |
| crates/miden-lib/build.rs | Adds build support for agglayer library, note scripts, and account components |
| crates/miden-lib/asm/agglayer/note_scripts/B2AGG.masm | Assembly implementation of B2AGG note script with validation and reclaim logic |
| crates/miden-lib/asm/agglayer/account_components/bridge_out.masm | Assembly implementation of bridge_out component with stubbed MMR functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/miden-lib/asm/agglayer/account_components/bridge_out.masm
Outdated
Show resolved
Hide resolved
crates/miden-lib/asm/agglayer/account_components/bridge_out.masm
Outdated
Show resolved
Hide resolved
crates/miden-lib/asm/agglayer/account_components/bridge_out.masm
Outdated
Show resolved
Hide resolved
crates/miden-lib/asm/agglayer/account_components/bridge_out.masm
Outdated
Show resolved
Hide resolved
crates/miden-lib/asm/agglayer/account_components/bridge_out.masm
Outdated
Show resolved
Hide resolved
crates/miden-lib/asm/agglayer/account_components/bridge_out.masm
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
d496d57 to
c758274
Compare
mmagician
left a comment
There was a problem hiding this comment.
I added minor comments regarding the docs, but leaving another approval, great work ✅
crates/miden-lib/asm/agglayer/account_components/bridge_out.masm
Outdated
Show resolved
Hide resolved
bobbinth
left a comment
There was a problem hiding this comment.
Looks good! Thank you! I left just a couple of small comments inline.
Co-authored-by: Marti <marti@miden.team>
B2AGGNote andAggLayerBridgeOutComponentThis PR adds the
B2AGGnote script and theAggLayerBridgeOutcomponent with stubbed-out MMR functionality. This PR includes tests covering both bridge-out and reclaim scenarios forB2AGGnotes.Note Structure
The
NoteInputsto theB2AGGnote consist of a destination chain ID (u32) and 5u32values representing a 160-bit EVM address (20 bytes).The
B2AGGnote has a total of 6 inputs with the following layout:Test Scenarios
The test in
crates/miden-testing/tests/agglayer/bridge_out.rsvalidates two scenarios:Bridge-Out Scenario
B2AGGnote to transfer assets from Miden to an EVM chain.B2AGGnote is consumed by a bridge account using theAggLayerBridgeOutcomponent.BURNnote is created and consumed by the network faucet.Reclaim Scenario
B2AGGnote (same account as sender).BURNnote.Additional Changes
Note: This PR also adds helper functions to convert Ethereum addresses represented as strings to a vector of
Feltvalues.This PR resolves #2007
Builds on #1995 & #1925