Skip to content

AggLayer CONFIG_AGG_BRIDGE note #2140

@mmagician

Description

@mmagician

Summary

The AggLayerBridge account must maintain a registry of authorized bridge tokens. To register a faucet, a dedicated Bridge Admin must inject configuration updates using network notes.

To support this, we propose:

  • Adding a dedicated BridgeConfig account component to the AggLayerBridge contract.
  • Defining a canonical BRIDGE_CONFIG network note.
  • Implementing basic validation to ensure that only notes from the authorized admin account can update the bridge configuration.

Proposed Design

1. Account component

We add a very simple account component to the AggLayerBridge account: BridgeConfig component.

Responsibilities:

  • Expose a dedicated procedure register_faucet that:
    • Reads the faucet AccountId from the note payload.
    • Adds the faucet to the bridge account's faucet_registry storage map.
    • Enforces basic authorization (only the authorized bridge admin can register faucets).
  • Store the authorized bridge admin AccountId (likely a multisig, but unimportant here)
    • Only notes from this account are considered valid for configuration updates.

This component would be part of the larger AggLayerBridge account.

Storage Layout

The BridgeConfig component utilizes the following storage slots (as defined in the AggLayerBridgeIn contract spec):

  • Slot 0 (map) faucet_registry: AccountId (of the faucet) → EMPTY_WORD (see "Open Questions" below)
    • A storage map tracking all registered faucets. The presence of an entry indicates the faucet is authorized.
  • Slot 1 (value) admin_account: AccountId (of the bridge admin)

MASM Interface

#! Registers a new faucet in the AggLayer bridge account's faucet registry.
#!
#! This procedure is invoked when a `BRIDGE_CONFIG` note is processed.
#! It verifies that the note sender is the authorized bridge admin and then
#! writes the new faucet entry into the bridge account's `faucet_registry` storage map.
#!
#! Inputs:  [faucet_id_prefix, faucet_id_suffix]
#! Outputs: []
#!
#! Panics if:
#! - the note sender is not the configured bridge admin.
#! - the faucet is already registered.
#!
#! Invocation: call.register_faucet
pub proc register_faucet
    # TODO:
    # - load and check authorized admin against note sender
    # - (optional) validate the faucet AccountId
    # - check that faucet is not already registered (Q: is this done automatically by using a map for storage?)
    # - write faucet entry into faucet_registry storage map
end

2. Network note

use.agglayer::bridge_config

#! This procedure calls into the bridge component's `register_faucet` procedure.
#!
#! Inputs:  [faucet_id_prefix, faucet_id_suffix, pad(14)]
#! Outputs: [pad(16)]
#!
#! Where:
#! - faucet_id_prefix is the prefix felt of the faucet's AccountId.
#! - faucet_id_suffix is the suffix felt of the faucet's AccountId.
#!
#! Panics if:
#! - the call to `register_faucet` panics.
#!
#! Invocation: call
begin
    # IN:  [faucet_id_prefix, faucet_id_suffix, pad(14)]

    call.bridge_config::register_faucet
    # => [pad(16)]
end

3. Flow

  1. Bridge admin identifies a new token that should be bridged and that is supported by AggLayer.
  2. Bridge admin deploys a new AggLayerFaucet contract with the relevant metadata.
  3. Bridge admin creates a new BRIDGE_CONFIG note containing the newly deployed faucet's AccountId.
  4. As the note is processed, it will call the register_faucet procedure on the bridge account. The procedure does the following:
    1. Verify the note is coming from the admin account.
    2. Store the faucet entry in the faucet_registry storage map.

Open Questions

  • How do we handle updates to the admin AccountId itself?
  • Where is faucet metadata stored? In this proposal we're assuming an empty value in the map for simplicity. In practice, faucet metadata such as #decimals need to be present somewhere:

Future Considerations

The BridgeConfig component could be extended to support additional functionality:

  • deregister_faucet
  • pause_bridge
  • update_admin (?)

Metadata

Metadata

Labels

agglayerPRs or issues related to AggLayer bridging integration

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions