-
Notifications
You must be signed in to change notification settings - Fork 124
AggLayer CONFIG_AGG_BRIDGE note #2140
Copy link
Copy link
Closed
Labels
agglayerPRs or issues related to AggLayer bridging integrationPRs or issues related to AggLayer bridging integration
Milestone
Description
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
BridgeConfigaccount component to theAggLayerBridgecontract. - Defining a canonical
BRIDGE_CONFIGnetwork 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_faucetthat:- Reads the faucet
AccountIdfrom the note payload. - Adds the faucet to the bridge account's
faucet_registrystorage map. - Enforces basic authorization (only the authorized bridge admin can register faucets).
- Reads the faucet
- 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
- Bridge admin identifies a new token that should be bridged and that is supported by AggLayer.
- Bridge admin deploys a new
AggLayerFaucetcontract with the relevant metadata. - Bridge admin creates a new
BRIDGE_CONFIGnote containing the newly deployed faucet'sAccountId. - As the note is processed, it will call the
register_faucetprocedure on the bridge account. The procedure does the following:- Verify the note is coming from the admin account.
- Store the faucet entry in the
faucet_registrystorage map.
Open Questions
- How do we handle updates to the admin
AccountIditself? - 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:
- either in the faucet's storage (since we're most likely going to have a custom
AggLayerFaucetanyway) - or as part of the map's value here in
AggLayerBridge'sfaucet_registrymap
- either in the faucet's storage (since we're most likely going to have a custom
Future Considerations
The BridgeConfig component could be extended to support additional functionality:
deregister_faucetpause_bridgeupdate_admin(?)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
agglayerPRs or issues related to AggLayer bridging integrationPRs or issues related to AggLayer bridging integration