Skip to content

How static mode works

In static mode the relayer treats a source event as a trigger. It submits one fixed call, signed by its own key, and never reads what the event says.

You will learn / You need

You will learn: what the listener and handler do in static mode, who signs and pays, and when to pick static mode over bridge mode. You need: the idea of a relayer from Relayers and cross-chain calls.

When to choose it

Static mode is Track B. Use it to measure the cost of the relayer path and of the destination call, without account abstraction (AA) in the way. Because the call never changes, every difference between two runs comes from the relayer, the network or the call itself.

Static mode
Signer The relayer key (EVENT_HANDLER_SIGNER), as an ordinary keypair transaction
Gas Coins owned by that same address, on the destination network
Call The fixed EVENT_HANDLER_TARGET, with EVENT_HANDLER_ARGS_JSON as arguments
Event body Ignored
Batching Off: one event, one transaction (BATCH_SIZE is ignored)
Acknowledgement Not available: BRIDGE_PROTOCOL_PHASES=3 is a startup error in static mode

For the real cross-chain path, where the event describes the call and the BridgeAA is the sender, use Track C. The full comparison is in Static mode and bridge mode.

The flow

sequenceDiagram
    participant S as Source chain
    participant L as event_listener
    participant H as event_handler
    participant D as Destination chain
    S->>L: event (polled every EVENT_LISTENER_POLL_MS)
    L->>H: POST /api/handle_event
    H-->>L: 202 queued
    Note over H: event body ignored
    H->>D: fixed call, signed by the relayer key
    D-->>H: effects
    H->>H: append a row to bridge_results.csv

The handler answers 202 as soon as the event is queued, before the destination transaction is sent. The listener therefore counts an event as delivered when it is queued, not when it lands.

What the listener does

stealth_name_service/backend/testing_backend/src/bin/event_listener.rs is the same in both modes.

  • Polling. It calls iotax_queryEvents on EVENT_LISTENER_RPC_URL every EVENT_LISTENER_POLL_MS milliseconds, in pages of 100.
  • Filter. The query selects one module, EVENT_LISTENER_PACKAGE_ID and EVENT_LISTENER_MODULE. If EVENT_LISTENER_EVENT_TYPE is set and not blank, an event is forwarded only when its fully qualified type contains that string. Other events are marked seen and skipped. Without the variable, every event of the module triggers a call.
  • Start point. With no saved cursor it asks for the newest event and starts after it, so only events emitted after the start are delivered. By default EVENT_LISTENER_RESET_CURSOR deletes the saved state at start, so a restart always begins at the chain tip. Events emitted while the listener is down are lost; set it to false to resume.
  • Forwarding. Each event is posted to EVENT_HANDLER_URL (or CONSENSUS_INGEST_URL when CONSENSUS_ENABLED is on). A rejected or failed post is retried on the next poll, and the cursor does not move past that page.
  • Deduplication. The listener remembers the ids of forwarded events, newest 10,000 by default (EVENT_LISTENER_DEDUPE_CAPACITY), in data/processed_events.json. An id is recorded only after a successful forward. See Replay protection is off-chain.

What the handler does in static mode

stealth_name_service/backend/testing_backend/src/bin/event_handler.rs, with EVENT_HANDLER_MODE unset or static.

  1. Startup. It checks that EVENT_HANDLER_SIGNER is in the keystore, then reads up to EVENT_HANDLER_GAS_COINS coins owned by that address on EVENT_HANDLER_NETWORK. No BridgeAA is looked up.
  2. Build. For each event it parses EVENT_HANDLER_TARGET, which must read <package_id>::<module>::<function>, and turns each element of EVENT_HANDLER_ARGS_JSON into a call argument. The call has no type arguments. A target that does not parse, or an argument that cannot be built, becomes a build_call failure row.
  3. Sign and submit. It claims a gas coin, signs the transaction with the relayer key and submits it, retrying up to three times.
  4. Record. It appends one row to data/bridge_results.csv and logs one line per transaction.

Two settings that look like they apply do not:

  • BATCH_SIZE is forced to 1, so the gas budget is LOADTEST_GAS_BUDGET_BRIDGE for each event.
  • EVENT_LISTENER_PACKAGE_ID is read by the handler only to set up acknowledgements, which static mode cannot run. The listener still needs it.

Check it worked

  • You can say who signs, who pays and what runs for a source event in static mode.
  • You can predict that an event body such as a different request argument changes nothing on the destination chain.

Next