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_queryEventsonEVENT_LISTENER_RPC_URLeveryEVENT_LISTENER_POLL_MSmilliseconds, in pages of 100. - Filter. The query selects one module,
EVENT_LISTENER_PACKAGE_IDandEVENT_LISTENER_MODULE. IfEVENT_LISTENER_EVENT_TYPEis 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_CURSORdeletes 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 tofalseto resume. - Forwarding. Each event is posted to
EVENT_HANDLER_URL(orCONSENSUS_INGEST_URLwhenCONSENSUS_ENABLEDis 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), indata/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.
- Startup. It checks that
EVENT_HANDLER_SIGNERis in the keystore, then reads up toEVENT_HANDLER_GAS_COINScoins owned by that address onEVENT_HANDLER_NETWORK. NoBridgeAAis looked up. - Build. For each event it parses
EVENT_HANDLER_TARGET, which must read<package_id>::<module>::<function>, and turns each element ofEVENT_HANDLER_ARGS_JSONinto a call argument. The call has no type arguments. A target that does not parse, or an argument that cannot be built, becomes abuild_callfailure row. - Sign and submit. It claims a gas coin, signs the transaction with the relayer key and submits it, retrying up to three times.
- Record. It appends one row to
data/bridge_results.csvand logs one line per transaction.
Two settings that look like they apply do not:
BATCH_SIZEis forced to 1, so the gas budget isLOADTEST_GAS_BUDGET_BRIDGEfor each event.EVENT_LISTENER_PACKAGE_IDis 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
requestargument changes nothing on the destination chain.
Next¶
- Setting it up and sending events: configure the variables and trigger the relayer.
- Verifying and measuring: confirm a delivery and read the CSV.