Skip to content

feat(AggLayer): faucet registry#2426

Merged
mmagician merged 47 commits intoagglayer-newfrom
mmagician-cursor-agglayer-faucet-registry-5caf
Feb 18, 2026
Merged

feat(AggLayer): faucet registry#2426
mmagician merged 47 commits intoagglayer-newfrom
mmagician-cursor-agglayer-faucet-registry-5caf

Conversation

@mmagician
Copy link
Collaborator

@mmagician mmagician commented Feb 11, 2026

Implement the AggLayer faucet registry for bridge asset validation and conversion.

Changes:

Faucet registry and configuration

  • Each AgglayerFaucet stores conversion metadata (origin token address, origin network, scale) in two new storage slots (conversion_info_1, conversion_info_2, since the token address takes up 5 elements)
  • Bridge account includes a faucet_registry storage map for registered faucets ([prefix, suffix, 0, 0] -> [flag, 0, 0, 0])
  • New bridge_config.masm module with register_faucet procedure (ATM anyone can register a faucet)
  • New CONFIG_AGG_BRIDGE note script to register faucets via issuing a note
  • Tests:
    • register a faucet via CONFIG_AGG_BRIDGE note

Bridging out uses the faucet registry

  • When we call bridge_out via B2AGG, the bridge validates the faucet is registered, then calls asset_to_origin_asset on the faucet via FPI to obtain the scaled amount (8 felts), origin token address (5 felts), and origin network (1 felt)
  • agglayer_faucet.masm exposes get_origin_token_address, get_origin_network, get_scale, and asset_to_origin_asset helper procedures, since the data in storage slots (esp. address) is crammed together
  • Tests:
    • bridge-out with registered faucet (full lifecycle including BURN)
    • bridge-out rejection for unregistered faucet

Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Feb 11, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@mmagician mmagician linked an issue Feb 11, 2026 that may be closed by this pull request
@mmagician mmagician changed the title AggLayer faucet registry feat(AggLayer): faucet registry Feb 11, 2026
@mmagician mmagician added the pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority label Feb 11, 2026
cursor bot pushed a commit that referenced this pull request Feb 11, 2026
Co-authored-by: marti <marti@hungrycats.studio>
@mmagician mmagician changed the base branch from mmagician-faucet-registry to mmagician-bridge-out-store-frontier February 12, 2026 09:13
@mmagician mmagician force-pushed the mmagician-cursor-agglayer-faucet-registry-5caf branch 2 times, most recently from aa8f85a to 25de59f Compare February 12, 2026 10:30
@mmagician mmagician marked this pull request as ready for review February 12, 2026 10:31
@mmagician mmagician requested a review from Copilot February 12, 2026 10:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements an AggLayer faucet registry and conversion-metadata flow to validate/convert bridge-out assets, including a new CONFIG_AGG_BRIDGE note path for registering faucets and updated bridge-out logic to use FPI conversion.

Changes:

  • Adds faucet conversion metadata storage (origin token address, origin network, scale) and helpers for packing/unpacking it.
  • Adds a bridge faucet_registry map plus bridge_config::register_faucet and a CONFIG_AGG_BRIDGE note/script to register faucets.
  • Updates bridge-out to require faucet registration and to call the faucet via FPI for origin-asset conversion; adds/updates tests and changelog entry.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/miden-testing/tests/agglayer/mod.rs Registers the new config_bridge test module.
crates/miden-testing/tests/agglayer/config_bridge.rs Adds test coverage for faucet registration via CONFIG_AGG_BRIDGE.
crates/miden-testing/tests/agglayer/bridge_out.rs Updates bridge-out tests for registry + FPI conversion and adds an unregistered-faucet rejection test.
crates/miden-testing/tests/agglayer/bridge_in.rs Updates faucet creation in bridge-in test to include conversion metadata params.
crates/miden-agglayer/src/lib.rs Exposes ConfigAggBridgeNote, adds conversion-slot/key helpers, and extends bridge/faucet account builders with new storage.
crates/miden-agglayer/src/errors/agglayer.rs Adds new MASM error constants for config note + registry failures.
crates/miden-agglayer/src/config_note.rs Introduces Rust utilities for creating CONFIG_AGG_BRIDGE notes.
crates/miden-agglayer/asm/note_scripts/CONFIG_AGG_BRIDGE.masm New note script that registers faucets by calling bridge_config::register_faucet.
crates/miden-agglayer/asm/bridge/bridge_out.masm Enforces registry allowlist and performs FPI conversion before building the leaf + BURN note.
crates/miden-agglayer/asm/bridge/bridge_config.masm New procedure to set faucet registry sentinel entries in bridge storage.
crates/miden-agglayer/asm/bridge/agglayer_faucet.masm Adds faucet-side helpers and asset_to_origin_asset for FPI conversion.
CHANGELOG.md Documents the new faucet registry + config note + FPI-based conversion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mmagician mmagician force-pushed the mmagician-bridge-out-store-frontier branch from 1266876 to 8303a1a Compare February 12, 2026 10:46
@mmagician mmagician force-pushed the mmagician-cursor-agglayer-faucet-registry-5caf branch from 25de59f to 61826f8 Compare February 12, 2026 10:54
Copy link
Contributor

@partylikeits1983 partylikeits1983 left a comment

Choose a reason for hiding this comment

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

Looks great!

@mmagician
Copy link
Collaborator Author

@copilot address the nits from the latest PR review from partylikeits1983

Copy link
Contributor

Copilot AI commented Feb 12, 2026

@mmagician I've opened a new pull request, #2440, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

@partylikeits1983 partylikeits1983 left a comment

Choose a reason for hiding this comment

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

Looks great! However, I do think we should have a check on who can register faucets, but this can be done in a later followup PR.

https://github.com/0xMiden/miden-base/pull/2426/changes#r2804764047

mmagician and others added 9 commits February 15, 2026 15:04
The add.N values should all be add.1 (incrementing the running
pointer by 1 each time), not add.1, add.2, add.3, add.4 which
caused addresses to skip (P, P+1, P+3, P+6, P+10 instead of
P, P+1, P+2, P+3, P+4).

Also includes byte-order fixes (u256_le_to_abi, swap_u32_bytes
for originNetwork and leafType) and test infrastructure for
verifying the root against Solidity vectors.

Status: the MMR root computation via call is verified correct
(test_mmr_append_via_call passes). The write_address_to_memory
fix changed the bridge_out root. Still investigating a remaining
mismatch related to u256_le_to_abi + mem_store_double_word_unaligned
interaction.

Co-authored-by: marti <marti@hungrycats.studio>
mmagician and others added 13 commits February 16, 2026 16:58
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…sor-bridge-out-component-implementation-details-5737
Signed-off-by: Marti <marti@miden.team>
Signed-off-by: Marti <marti@miden.team>
Co-authored-by: marti <marti@hungrycats.studio>
Signed-off-by: Marti <marti@miden.team>
Co-authored-by: marti <marti@hungrycats.studio>
Signed-off-by: Marti <marti@miden.team>
Co-authored-by: marti <marti@hungrycats.studio>
Signed-off-by: Marti <marti@miden.team>
Co-authored-by: marti <marti@hungrycats.studio>
Signed-off-by: Marti <marti@miden.team>
Co-authored-by: marti <marti@hungrycats.studio>
Signed-off-by: Marti <marti@miden.team>
Signed-off-by: Marti <marti@miden.team>
@mmagician mmagician force-pushed the mmagician-cursor-bridge-out-component-implementation-details-5737 branch from 2698ce5 to 3bfb9d3 Compare February 17, 2026 19:43
mmagician and others added 5 commits February 18, 2026 10:09
…sor-bridge-out-component-implementation-details-5737
…tails-5737' into mmagician-cursor-agglayer-faucet-registry-5caf

Co-authored-by: marti <marti@hungrycats.studio>
Co-authored-by: marti <marti@hungrycats.studio>
Base automatically changed from mmagician-cursor-bridge-out-component-implementation-details-5737 to agglayer-new February 18, 2026 13:06
@mmagician mmagician force-pushed the mmagician-cursor-agglayer-faucet-registry-5caf branch from dc2f012 to 43e0bb0 Compare February 18, 2026 19:07
@mmagician mmagician merged commit be765b0 into agglayer-new Feb 18, 2026
15 checks passed
@mmagician mmagician deleted the mmagician-cursor-agglayer-faucet-registry-5caf branch February 18, 2026 20:00
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 pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AggLayer: Faucet registry storage in AggLayerBridge

5 participants