Skip to content

fix(agglayer): replace NoAuth with NetworkAccount on bridge and faucet#2818

Draft
partylikeits1983 wants to merge 4 commits intoajl-network-account-componentfrom
ajl-agglayer-network-account
Draft

fix(agglayer): replace NoAuth with NetworkAccount on bridge and faucet#2818
partylikeits1983 wants to merge 4 commits intoajl-network-account-componentfrom
ajl-agglayer-network-account

Conversation

@partylikeits1983
Copy link
Copy Markdown
Contributor

@partylikeits1983 partylikeits1983 commented Apr 22, 2026

Summary

Closes #2797.

Installs the NetworkAccount auth component (added in #2817) on both the AggLayer bridge and the AggLayer faucet, with per-account whitelists of input-note script roots. This closes the forged-MINT attack surface: an attacker can no longer finalize an arbitrary transaction against the bridge and emit a bridge-authored MINT note.

Whitelists

  • Bridge: CLAIM, B2AGG, CONFIG_AGG_BRIDGE, UPDATE_GER
  • Faucet: MINT, BURN

Changes

  • crates/miden-agglayer/src/lib.rs — swap NoAuth for NetworkAccount in create_bridge_account, create_existing_bridge_account, create_agglayer_faucet, create_existing_agglayer_faucet. New helpers bridge_note_whitelist() / faucet_note_whitelist() and a claim_script_root() accessor mirroring the other note wrappers.
  • crates/miden-agglayer/build.rs — compute BRIDGE_CODE_COMMITMENT and FAUCET_CODE_COMMITMENT using NetworkAccount. Whitelist contents do not affect the commitment, so an empty whitelist suffices here.
  • crates/miden-testing/tests/agglayer/network_account_regression.rs — two regression tests that replay the NoAuth on the bridge account lets anyone emit bridge-authored MINT notes #2797 attack paths against a bridge account built with the production create_existing_bridge_account helper:
    1. bridge_rejects_tx_script_after_2797_fix — any tx with a tx script is rejected with ERR_NETWORK_ACCOUNT_TX_SCRIPT_NOT_ALLOWED.
    2. bridge_rejects_non_whitelisted_input_note_after_2797_fix — any tx consuming a non-whitelisted note is rejected with ERR_NETWORK_ACCOUNT_NOTE_NOT_WHITELISTED.

Stacking

This PR is the final one in the #2797 fix chain:

Stacked on top of ajl-network-account-component; rebase onto next once the parents merge.

Closes #2797.

Installs the NetworkAccount auth component (added in #2817) on both the
AggLayer bridge and the AggLayer faucet, with per-account whitelists of
input-note script roots. This closes the forged-MINT attack surface: an
attacker can no longer finalize an arbitrary transaction against the
bridge and emit a bridge-authored MINT note.

Whitelists:
- Bridge: CLAIM, B2AGG, CONFIG_AGG_BRIDGE, UPDATE_GER
- Faucet: MINT, BURN

Changes:
- crates/miden-agglayer/src/lib.rs: swap NoAuth for NetworkAccount in
  create_bridge_account, create_existing_bridge_account,
  create_agglayer_faucet, create_existing_agglayer_faucet. Add helper
  functions bridge_note_whitelist() and faucet_note_whitelist(), plus a
  claim_script_root() accessor mirroring the other note wrappers.
- crates/miden-agglayer/build.rs: compute BRIDGE_CODE_COMMITMENT and
  FAUCET_CODE_COMMITMENT using NetworkAccount (whitelist contents do not
  affect the commitment, so an empty whitelist suffices).
- crates/miden-testing/tests/agglayer/network_account_regression.rs: two
  regression tests that replay the #2797 attack paths (tx-script
  rejection and non-whitelisted-note rejection) against a bridge account
  built with the production `create_existing_bridge_account` helper.

Depends on #2816 (kernel tx_get_script_root) and #2817 (NetworkAccount
component).
@partylikeits1983 partylikeits1983 changed the title fix(agglayer): replace NoAuth with NetworkAccount on bridge and faucet (fixes #2797) fix(agglayer): replace NoAuth with NetworkAccount on bridge and faucet Apr 23, 2026
…d comments

- Rename bridge_rejects_tx_script_after_2797_fix ->
  bridge_rejects_tx_script and bridge_rejects_non_whitelisted_input_note_after_2797_fix ->
  bridge_rejects_non_whitelisted_input_note; the suffixes referenced a PR number that will not
  age well.
- Rewrite the module-level doc comment to describe the attack
  ("forged-MINT attack") instead of linking out to issue and PR numbers, which rot.
- Drop the build.rs comment about the whitelist being irrelevant to
  the code commitment; the surrounding "dummy metadata for code commitment"
  context already explains why empty placeholder values are fine here.
@partylikeits1983 partylikeits1983 self-assigned this Apr 23, 2026
@partylikeits1983 partylikeits1983 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 Apr 23, 2026
@partylikeits1983 partylikeits1983 marked this pull request as ready for review April 23, 2026 20:58
@mmagician
Copy link
Copy Markdown
Collaborator

Note: this and the supporting PR(s) should be cherry-picked into the agglayer branch after they land on next (or vice-versa) to make a follow-up to the audit simpler.

@partylikeits1983 partylikeits1983 marked this pull request as draft April 30, 2026 02:16
@PhilippGackstatter
Copy link
Copy Markdown
Contributor

I think this PR is a requirement before we can remove AccountStorageMode::Network (#2285). All standard network accounts we define (bridge + agglayer faucet, network fungible faucet) need to start using AuthNetworkAccount, so that we can identify them as network accounts via the NetworkAccountNoteAllowlist storage slot rather than the storage mode.

My understanding is this PR deals with the bridge and agglayer faucet, so the next step after this PR is to migrate the network fungible faucet (as created by create_network_fungible_faucet) and then remove the storage mode.

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.

3 participants