Skip to content

docs(agglayer): add Faucet Registry section to the spec#2584

Merged
mmagician merged 10 commits intoagglayerfrom
mmagician-claude/agglayer-faucet-registry-spec
Mar 23, 2026
Merged

docs(agglayer): add Faucet Registry section to the spec#2584
mmagician merged 10 commits intoagglayerfrom
mmagician-claude/agglayer-faucet-registry-spec

Conversation

@mmagician
Copy link
Copy Markdown
Collaborator

@mmagician mmagician commented Mar 11, 2026

Adds a new section to the AggLayer bridging spec covering faucet registration for both bridge-in (non-native ERC20 tokens) and bridge-out (Miden-native tokens) flows

Summary

  • Section 6.1: How non-native ERC20 faucets are created and registered on Miden via CONFIG_AGG_BRIDGE notes for bridging in.
  • Section 6.2: How Miden-native tokens would be registered on EVM chains (bridge-out path).

@mmagician mmagician force-pushed the mmagician-claude/agglayer-faucet-registry-spec branch from 8e3e02a to d74cf1c Compare March 11, 2026 11:07
@mmagician mmagician force-pushed the mmagician-claude/agglayer-metadata-hash branch from 2affd1c to d6d9127 Compare March 11, 2026 11:12
@mmagician mmagician force-pushed the mmagician-claude/agglayer-faucet-registry-spec branch from d74cf1c to d819e24 Compare March 11, 2026 11:13
@mmagician mmagician added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Mar 11, 2026
@mmagician mmagician force-pushed the mmagician-claude/agglayer-faucet-registry-spec branch from d819e24 to 60eeafd Compare March 11, 2026 11:17
@mmagician mmagician added 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 labels Mar 12, 2026
Base automatically changed from mmagician-claude/agglayer-metadata-hash to agglayer March 19, 2026 13:58
claude added 2 commits March 20, 2026 08:13
Link #2585 (token name storage) and #2586 (on-chain metadata hash
verification) in the implementation status notes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mmagician mmagician force-pushed the mmagician-claude/agglayer-faucet-registry-spec branch from 628c5d6 to 5d3b954 Compare March 20, 2026 08:14
Section 6 (Faucet Registry) now accurately describes the current
implementation:
- Two registries: faucet_registry_map + token_registry_map
- register_faucet performs atomic two-step registration
- lookup_faucet_by_token_address for bridge-in token resolution
- Updated storage slot names (removed miden:: prefix)
- AggLayerFaucet struct moved to src/faucet.rs
- Companion components (Ownable2Step, OwnerControlled) documented
- CONFIG_AGG_BRIDGE note now carries origin_token_address (7 felts)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mmagician and others added 2 commits March 23, 2026 09:01
Replace the "not yet implemented" placeholder with a concrete
description of how Miden-native faucets use the same registration
and bridging flow as wrapped faucets. The origin_token_address is
the faucet's own AccountId embedded as an Ethereum address via
EthAddressFormat::from_account_id. The EVM bridge deploys a
TokenWrapped ERC20 deterministically on first claim.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mmagician and others added 2 commits March 23, 2026 09:32
The CREATE2 salt is tokenInfoHash (derived from originNetwork +
originTokenAddress), not the metadata hash. The metadata bytes are
used to initialize the wrapped token's name, symbol, and decimals.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
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

Adds documentation to the AggLayer bridging spec describing how faucets/tokens are registered for bridge-in and bridge-out flows, including how the bridge’s faucet and token registries are populated and used.

Changes:

  • Add a new “Faucet Registry” section defining native vs wrapped tokens and describing the two bridge registries.
  • Document bridge-in faucet creation/registration on Miden via CONFIG_AGG_BRIDGE / bridge_config::register_faucet.
  • Document bridge-out behavior for Miden-native assets and how wrapped ERC20s are deployed/initialized on EVM chains using the metadata hash.

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

mmagician and others added 2 commits March 23, 2026 11:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mmagician mmagician marked this pull request as ready for review March 23, 2026 10:22
@mmagician mmagician changed the title docs(agglayer): add Section 6 - Faucet Registry to SPEC docs(agglayer): add Faucet Registry section to the spec Mar 23, 2026
Copy link
Copy Markdown
Member

@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 good. Read through the doc and the only thing that stood out was the nit comment I left below.

Question though, do we need to resolve #2585 & #2586 ASAP?

Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
@mmagician
Copy link
Copy Markdown
Collaborator Author

Question though, do we need to resolve #2585 & #2586 ASAP?

not urgent - for now we just rely on the trust assumption in the bridge admin to register metadata correctly. So the flow is functional already

@mmagician mmagician enabled auto-merge (squash) March 23, 2026 11:31
@mmagician mmagician merged commit 7ca0beb into agglayer Mar 23, 2026
17 checks passed
@mmagician mmagician deleted the mmagician-claude/agglayer-faucet-registry-spec branch March 23, 2026 11:46
mmagician added a commit that referenced this pull request Mar 23, 2026
* refactor: refactor `EthAddress` and `EthEmbeddedAccountId` (#2622)

* Rename the `MMR Frontier` structure (#2642)

* refactor: rename MMR frontier

* docs: use LET instead of MTF in user-facing docs, improve docs

* chore: update changelog

* docs: use append insread of add in terms of LET

* refactor: rename bridge memory-reading procedures to use `load_*` prefix (#2650)

Resolves #2640 by renaming private bridge_in.masm procedures that read
from memory to use `load_*` prefix, distinguishing them from `get_*`
procedures that read from account storage:

- get_origin_token_address -> load_origin_token_address
- get_raw_claim_amount -> load_raw_claim_amount
- get_destination_account_id_data -> load_destination_address
  (also extracts eth_address::to_account_id call to the call site)

Removes the TODO comment from faucet/mod.masm since the name conflict
is resolved.

Co-authored-by: Claude (Opus) <noreply@anthropic.com>

* docs(agglayer): add Faucet Registry section to the spec (#2584)

* docs(agglayer): add Section 6 - Faucet Registry to SPEC.md

* docs(agglayer): add issue references to SPEC Section 6

Link #2585 (token name storage) and #2586 (on-chain metadata hash
verification) in the implementation status notes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs(agglayer): update Section 6 to reflect two-step faucet registration

Section 6 (Faucet Registry) now accurately describes the current
implementation:
- Two registries: faucet_registry_map + token_registry_map
- register_faucet performs atomic two-step registration
- lookup_faucet_by_token_address for bridge-in token resolution
- Updated storage slot names (removed miden:: prefix)
- AggLayerFaucet struct moved to src/faucet.rs
- Companion components (Ownable2Step, OwnerControlled) documented
- CONFIG_AGG_BRIDGE note now carries origin_token_address (7 felts)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs(agglayer): clarify Miden-native faucet bridging in Section 6.2

Replace the "not yet implemented" placeholder with a concrete
description of how Miden-native faucets use the same registration
and bridging flow as wrapped faucets. The origin_token_address is
the faucet's own AccountId embedded as an Ethereum address via
EthAddressFormat::from_account_id. The EVM bridge deploys a
TokenWrapped ERC20 deterministically on first claim.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: polish sec 6

* docs(agglayer): fix CREATE2 salt description in Miden-native faucets

The CREATE2 salt is tokenInfoHash (derived from originNetwork +
originTokenAddress), not the metadata hash. The metadata bytes are
used to initialize the wrapped token's name, symbol, and decimals.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Update crates/miden-agglayer/SPEC.md

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

* Update crates/miden-agglayer/SPEC.md

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

* Update crates/miden-agglayer/SPEC.md

Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>

---------

Co-authored-by: Claude (Opus) <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>

* docs(agglayer): update the spec to latest code state (#2649)

* docs(agglayer): update SPEC Sections 1-5 to latest code state

Align the spec with the current agglayer branch after the CLAIM flow
re-orientation and faucet registry migration:

- Section 1: CLAIM now targets bridge (not faucet); add MINT note row
- Section 2.1: Add bridge_in::claim; update register_faucet to two-step
  registration (faucet_registry + token_registry); replace
  verify_leaf_bridge with claim procedure; add new storage slots
  (token_registry_map, claim_nullifiers, cgi_chain_hash); update
  rpo256 references to poseidon2
- Section 2.2: Replace faucet::claim with mint_and_send; add
  get_metadata_hash and get_scale; add metadata_hash storage slots
  and companion component notes
- Section 3: Update CLAIM consumption to target bridge; update
  CONFIG_AGG_BRIDGE to 7-felt layout; update BURN serial_num to
  poseidon2; update P2ID generation source; add MINT note type (3.7)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs(agglayer): document Ownable2Step sender validation on MINT notes

The MINT note's sender (bridge) is validated by the faucet's
owner_only mint policy via Ownable2Step::assert_sender_is_owner.
This ensures only the bridge account can trigger minting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs(agglayer): address review comments on SPEC Sections 1-5

- Fix GER merge order: poseidon2::merge(GER_LOWER, GER_UPPER)
- Add advice map mention to bridge_in::claim inputs
- Simplify MINT note details in step 8, point to Section 3.7
- Remove implicit "[0,0,0,0] if absent" from storage tables
- Use "lower/upper word" instead of hash_0..hash_7 in value encodings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Apply suggestions from code review

Co-authored-by: Marti <marcin.gorny.94@protonmail.com>

* chore: update conventions

* Update crates/miden-agglayer/SPEC.md

Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>

* chore: remove distinction between element notation

---------

Co-authored-by: Claude (Opus) <noreply@anthropic.com>
Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>

* refactor: update Keccak256 hash aliases and rework GlobalIndex (#2661)

---------

Co-authored-by: Alexander John Lee <77119221+partylikeits1983@users.noreply.github.com>
Co-authored-by: Andrey Khmuro <andrey@polygon.technology>
Co-authored-by: Claude (Opus) <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 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.

docs(AggLayer): document faucet registry & token registry

4 participants