refactor(agglayer): use the standard FungibleFaucet for AggLayer faucets - #3525
Open
Fumuran wants to merge 4 commits into
Open
refactor(agglayer): use the standard FungibleFaucet for AggLayer faucets#3525Fumuran wants to merge 4 commits into
FungibleFaucet for AggLayer faucets#3525Fumuran wants to merge 4 commits into
Conversation
Fumuran
force-pushed
the
fumuran-claude/agglayer-standard-faucet
branch
from
August 17, 2026 15:38
c73dd18 to
382795a
Compare
melnikga
pushed a commit
to walnuthq/miden-base
that referenced
this pull request
Aug 21, 2026
…iden#3630) Codifies the format settled on while reviewing 0xMiden#3525, and applies the same discipline to issues. PRs get summary, changes, open questions; issues get problem, impact, direction. Test plans, command transcripts, per-file enumeration and process narration come out of both, since CI reports what passed and the diff or a permalink shows the code. Carves out what still earns length: correctness arguments, protocol-level consequences such as a changed commitment, deliberate convention deviations, and design questions genuinely put to the team. Sits alongside `concise-changelog-entries`, which applies the same principle to CHANGELOG lines. Co-authored-by: Claude (Opus) <noreply@anthropic.com>
…ucets The dedicated `agglayer::faucet` component had become vestigial: it re-exported `mint_and_send`, `receive_and_burn` and `has_procedure` from the standards library, a strict subset of what the standard `FungibleFaucet` component already exports, and `AggLayerFaucet` was a newtype over `FungibleFaucet` emitting its storage slots verbatim. The re-exports resolve to the same standards procedures, so the mint/burn MAST roots are unchanged by the swap and the reflective faucet-kind detection in the unified MINT/BURN note scripts keeps working. Critically, `AggLayerFaucet::new` fabricated the token name from the symbol, which left the AggLayer metadata hash preimage `abi.encode(name, symbol, decimals)` unrecoverable from faucet storage. The builders now take a real token name, which is what #2586 needs to verify the registered hash on-chain. - Remove the `miden-agglayer-faucet` MASM package, `asm/agglayer/faucet/`, `src/faucet.rs`, `AggLayerFaucet`, `AgglayerFaucetError` and the build.rs- generated `FAUCET_CODE_COMMITMENT`. Faucet identity is now established through `FungibleFaucet::try_from(&Account)`, which checks the interface rather than a commitment that had to hand-mirror the component stack. - `AggLayerFaucet::account_builder` / `::allowed_notes` become the free functions `agglayer_faucet_account_builder` / `agglayer_faucet_allowed_notes`, since the type they hung off no longer exists. The account's component stack is otherwise unchanged: Ownable2Step for the owner-gated mint and burn policies, RBAC plus `Authority::RbacControlled` for authority-gated configuration, the token policy manager, and `ConstantFeeManager`. - Add `MetadataHash::from_fungible_faucet` so call sites derive the registered hash from the faucet's own stored metadata instead of repeating three literals. The faucet code commitment changes. Closes #2585 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fumuran
force-pushed
the
fumuran-claude/agglayer-standard-faucet
branch
from
August 25, 2026 21:16
382795a to
5920451
Compare
- Keep `AggLayerFaucet` as a stateless namespace instead of moving its associated functions out to free functions in `lib.rs`. The type no longer wraps a `FungibleFaucet` or validates accounts, but `allowed_notes`, `procedure_roles`, `fee_manager_role` and `account_builder` stay grouped under it, mirroring `AggLayerBridge`. - Rename `agglayer_faucet_metadata` to `build_fungible_faucet`: it returns the `FungibleFaucet` component, not a metadata value. - Drop `test_metadata_hash_from_fungible_faucet_matches_token_info`, which compared `from_fungible_faucet` against the `from_token_info` it forwards to. The same redundant assertion is removed from `agglayer_faucet_is_a_bridge_owned_fungible_faucet`, where the field-by-field checks above it already cover the round-trip. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Fumuran
commented
Aug 26, 2026
- Reword the `AggLayerFaucet` doc to say what it is: a stateless helper holding deployment configuration, explicitly not an `AccountComponent`. - Trim `MetadataHash::from_fungible_faucet`'s doc to the suggested line. - Drop the `generate_agglayer_constants` note explaining why the faucet has no code commitment. - Cut SPEC 3.2 down to what is distinctive about an AggLayer faucet - bridge ownership, `owner_only` mint/burn, the note allowlist and the token name - instead of enumerating standard `FungibleFaucet` procedures and accessors. The old text also claimed the allowlist was limited to MINT and BURN, which has not been true since #3632. - Shorten the CHANGELOG entry to the suggested wording and point it at this PR rather than the issue. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Fumuran
marked this pull request as ready for review
August 26, 2026 15:44
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.
Summary
Closes #2585.
The
agglayer::faucetcomponent was vestigial: it re-exportedmint_and_send,receive_and_burnandhas_procedurefrom the standards library, a strict subset of what the standardFungibleFaucetcomponent exports, andAggLayerFaucetwas a newtype overFungibleFaucetemitting its storage slots verbatim. The re-exports resolve to the same standards procedures, so the mint/burn MAST roots are unchanged by the swap.The functional gap was the token name:
AggLayerFaucet::newfabricated it from the symbol, leaving the metadata hash preimageabi.encode(name, symbol, decimals)unrecoverable from faucet storage. #2586 needs it to verify the registered hash on-chain.Changes
miden-agglayer-faucetMASM package,AgglayerFaucetErrorand the generatedFAUCET_CODE_COMMITMENT. Faucet identity now comes fromFungibleFaucet::try_from(&Account), which checks the interface rather than a pinned commitment that had to hand-mirror the whole component stack.AggLayerFaucetbecomes a stateless namespace: it no longer wraps aFungibleFaucetor validates accounts, but still groupsallowed_notes,procedure_roles,fee_manager_roleandaccount_builder, mirroringAggLayerBridge. Call sites are unchanged.account_builderandcreate_existing_agglayer_faucettake a token name, and the newMetadataHash::from_fungible_faucetderives the registered hash from faucet storage so the two cannot drift.The component stack, the note allowlist and the asset-callback flag are unchanged. The faucet code commitment changes, and with it faucet account IDs.
miden-standardsis untouched.Open questions
TokenName::MAX_BYTESis 32, a policy cap below the 55-byte encoding capacity. Today an operator can work around it by registering a hash over the true long name while storing a shortened one; AggLayer: onchain verification of metadata hash during faucet registration #2586 closes that off, making 32 bytes a hard ceiling on foreign token names. Worth settling before that work starts.build_fungible_faucetpanics via.expecton an invalid token name, matching the existing convention fortoken_symbol. A name comes from a foreign ERC-20, so a fallible constructor may fit better."Native Token"while theMockChainBuilderfaucet it targets stores"NATIVE". Harmless today, will fail AggLayer: onchain verification of metadata hash during faucet registration #2586's check.🤖 Generated with Claude Code