Skip to content

Managing the ACL

How to authorise more source-chain senders in a BridgeAA that already exists, in batches, and how to check that they landed.

You will learn / You need

You will learn: what an ACL entry means, why adding one cannot go through /api/SendPTB, and the generate, apply and --verify workflow of bridge_acl_add. You need: a created account that holds its own gas coins (setup), the relayer key in the keystore, and the addresses to authorise in the same keystore. See Account abstraction and BridgeAA for what the ACL is.

BRIDGE_ACL_SOURCE_SENDERS only applies at creation. For an existing account, use bridge_acl_add: it finds keystore addresses not yet authorised, splits them into batches of one transaction each, and submits them. It cannot go through /api/SendPTB, because add_acl_entry must be sent by the account itself, and the account object has no key for /api/SendPTB to sign with. No relayed intent can authorise it either: the authenticator only matches calls with pure arguments, and add_acl_entry takes &mut BridgeAA.

cd stealth_name_service/backend/testing_backend
EVENT_HANDLER_KEYSTORE_PATH=./iota.keystore cargo run --bin bridge_acl_add -- generate --batches 30
EVENT_HANDLER_KEYSTORE_PATH=./iota.keystore cargo run --bin bridge_acl_add -- apply ../agent/payloads/acl --dry-run
EVENT_HANDLER_KEYSTORE_PATH=./iota.keystore cargo run --bin bridge_acl_add -- apply ../agent/payloads/acl --verify

Each entry maps a source address to the relayer's public key: the key says who may originate a request, the value says who vouches for it. A failed batch can be re-run alone, since add_acl_entry overwrites rather than aborting.

How a batch works

flowchart LR
    K[keystore addresses] --> G["generate<br/>compare with the ACL on chain"]
    G --> B["batch files<br/>../agent/payloads/acl"]
    B --> A["apply<br/>one transaction per file"]
    A --> V["--verify<br/>re-read the ACL"]
  • generate compares the keystore addresses that have a local key pair with the ACL on chain, leaves out the relayer (its bootstrap entry always exists), and writes one JSON file per transaction. The files are reviewable before anything is signed. It checks that BRIDGE_TARGET_PACKAGE exists on the network and stops otherwise.
  • apply signs and submits the files in filename order, one transaction each. Each transaction is an anchor call to bridge_target::record, which satisfies the authenticator, followed by one add_acl_entry per sender. The batch file records account_id and source_chain_id, and apply refuses a file generated for a different deployment. The package, the target chain, the relayer and the node still come from .env.
  • The account pays the gas, so it needs its own coins. Coins held by the relayer are not eligible.
  • --dry-run builds and signs every batch and submits nothing. --verify re-reads the ACL and fails if any applied sender is missing, naming a few of them; it does nothing under --dry-run.

Flags, defaults and the environment variables each subcommand reads are in bridge_acl_add. The default --gas-budget is 500000000, also read from BRIDGE_ACL_GAS_BUDGET: a batch of about 34 entries creates about 34 dynamic fields, far more than one record call.

BRIDGE_TARGET_PACKAGE

.env_sample says no binary reads BRIDGE_TARGET_PACKAGE. The code disagrees: generate in stealth_name_service/backend/testing_backend/src/bin/bridge_acl_add.rs and stealth_name_service/backend/testing_backend/src/bin/bridge_aa_coins.rs both require it, as the package of the anchor call. The event handler does not read it.

Check it worked

  • generate prints the batches it wrote and the files appear under ../agent/payloads/acl.
  • apply --verify ends with Verify: N/N applied senders present.
  • A request from one of the new senders is no longer aborted with ESenderNotInAcl (code 1).

Next