Skip to content

AggLayerBridgeIn contract (WIP) #1910

@mmagician

Description

@mmagician

Bridging summary
The overall flow for bridging in from AggLayer -> Miden
0. An oracle (external component) updates the Global Exit Root (GER) stored in the AggLayerBridgeIn contract

  1. Independently, a claim manager submits a AGG_CLAIM note to AggLayerFungibleFaucet
  2. The faucet queries the AggLayerBridgeIn to verify the validity of the claim
  3. If verified, mint the asset requested in the claim, and send it via a P2ID note to the target user

AggLayerBridgeIn contract interface

Storage

  • Slot 0(map) faucet_registry: AccountId (of the faucet) -> EMPTY_WORD (potentially mapping to some faucet metadata later)
  • Slot 1(value) oracle_account: AccountId (of the owner oracle that is able to update the GER)
  • Slot 2-3(value) (ger_upper, ger_lower): Global Exit Root. Unlike the Miden-originated values in LET, GER is constructed externally. We can't control its co-domain, and it could map to values that can't be represented by a Word in Miden. So we need two Words to represent a GER.
    TODO GER is actually a mapping

Internal procedures

Procedure exports

  • update_ger (called by the oracle). Expected stack [GER_UPPER, GER_LOWER]
    • check that note.sender == oracle_account
    • update GER (TODO is this a vector update?)
  • verify_claim (called by the faucet).

Questions:

  1. The initial Miden design separates out the bridge contract and the faucet contract. This is unlike PolygonZkEVMBridgeV2 with a consolidated approach: it is responsible for updating the LET & GER, but also holds the bridged out assets from users, and sends the assets to users when claimed.
    In terms of the number of notes sent, a combined approach would reduce the total number of notes (for bridging out, we wouldn't need a separate BURN note as the combined contract can handle that internally; for bridging in, there would be no change), but it wouldn't necessarily speed things up for the end-user (the user doesn't care about the BURN note being processed; the bridging is considered "final" once LET is updated).
  2. How to represent the Global Exit Root manager? It stores a potentially very large number of exit roots

Metadata

Metadata

Assignees

No one assigned

    Labels

    agglayerPRs or issues related to AggLayer bridging integrationstandardsRelated to standard note scripts or account components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions