Skip to main content

Stargate Bridge Registry Surface

Product boundary
  • Stargate chain and path-baseline APIs, registry services, and operator seed/completeness tools are Pro capabilities.
The entire Stargate surface is Pro (commercial license, excluded from the OSS build), including the exec.stargate.send and exec.stargate.dst_observe executors. None of this ships in the AGPL-3.0-or-later OSS repo. OSS code reaches the Stargate registry only through the sanctioned pro_loader boundary. If you are reading this from the OSS distribution, these modules will not be present.

Operator flow: configure, approve, execute, observe, recover, stop

  1. Configure the commercial deployment, Pro package/loader gate, MG_STARGATE_ENABLED, required EVM RPC endpoints, and registry records.
  2. Approve the route under the normal QTG approval and allowlist controls.
  3. Execute a path only after registry, quote, and signer checks succeed.
  4. Observe source and destination evidence through the configured path.
  5. Recover from durable execution evidence rather than guessing an ambiguous outcome.
  6. Stop and escalate when recovery evidence is incomplete or contradictory.

1. Registry Pattern Overview

Stargate lane execution is split across three operator-managed registry layers: From an operator perspective, this is the usual way to read it:
  1. stargate_pools is the raw registry inventory produced by discovery/refresh.
  2. stargate_chain_registry is the operator-owned registry that condenses pool rows into chain-level control-plane facts.
  3. stargate_path_baseline is the allow/deny + SLO layer that declares actual template-path readiness.
In other words, chain_registry is the anchor for chain metadata, and path_baseline decides whether that path is allowed for operation.

2. Stargate Registry Admin

2.1 Auth boundary

This write surface reuses the existing HMAC admin purpose throughout. No new purpose was added.
  • route module guard: require_admin_hmac()
  • accepted roles: admin (route-registered; the _ALL route set covers admin/operator/agent)
  • canonical route-purpose mapping source: interfaces/api/middleware/auth/hmac.py
Read-only routes (GET /v3/stargate/chains, GET /v3/stargate/path-baselines, and single-item lookups) require the admin or operator role, and the table below covers only the write/admin surface.

2.2 Admin route table

2.3 Field and schema notes

ChainRegistryRow response fields:
  • chain
  • endpoint_identity
  • finality_age_seconds
  • snapshot_version
  • snapshot_stale
  • stale_detected_at
  • operator_label
  • snapshot_at
  • created_at
  • updated_at
PathBaselineRow response fields:
  • src_chain
  • dst_chain
  • asset
  • expected_latency_seconds
  • detection_latency_budget_seconds
  • fee_native_budget
  • enabled
  • disabled_reason
  • last_drill_pass_at
  • last_drill_evidence_path
  • baseline_source
  • operator_label
  • cost_policy_revision
  • max_token_fee_bps
  • max_quote_degradation_bps
  • max_native_messaging_fee_wei
  • max_source_gas_fee_wei
  • enforced_options_raw_hex
  • lz_receive_gas
  • lz_receive_value
  • enforced_options_observed_at
  • last_unsafe_observed_at
  • last_unsafe_reason
  • src_pool_address_at_snapshot
  • dst_eid_at_snapshot
  • created_at
  • updated_at
Route modules return asdict(row) payloads, so the JSON shape is the service dataclass shape directly. The create/update request schemas also accept the cost-evidence fields above — they are what “cost evidence enforcement” gates dispatch against.

2.4 Typical operator workflow

The most common operator sequence is below.
  1. Seed chain registry from discovered pools. Pro operator tool seed_stargate_chain_registry (--operator-label ops.seed).
  2. Seed path baselines from a reviewed JSON payload. Pro operator tool seed_stargate_path_baseline with the reviewed path-baselines.json (--operator-label ops.seed).
  3. Check completeness against template coverage. Pro operator tool stargate_path_baseline_completeness.
  4. Backfill or fix missing paths, then call POST /v3/stargate/path-baselines/{src}/{dst}/{asset}/drill-pass after a successful drill and evidence upload.
  5. When a chain/path is retired, remove it through the corresponding DELETE admin route so the audit table records the removal operator.
CLI intent:
  • seed_stargate_chain_registry backfills stargate_chain_registry from distinct (chain, eid) pairs in stargate_pools
  • seed_stargate_path_baseline applies reviewed baseline JSON into stargate_path_baseline
  • stargate_path_baseline_completeness reports missing or disabled template paths and exits non-zero when gaps remain

2.5 Idempotency and audit semantics

Admin writes are intentionally audit-heavy, but they do not emit pointless new versions when nothing changed. chain_registry and path_baseline share the same mutation semantics:
  • POST create: inserts row, writes create audit
  • PUT with material field change: mutates row, increments version where applicable, writes update audit
  • PUT with no material field change and same operator label: no-op, no new audit row
  • PUT with no material field change but different operator label: writes touch audit so operator custody change is visible
  • DELETE: writes delete audit first, then removes the live row
Delete audit convention matters:
  • audit row captures the last live snapshot before removal
  • before_json and after_json both contain that snapshot
  • row deletion happens after the audit insert so Postgres foreign-key enforcement is satisfied
This pattern lets the operator reconstruct “what was deleted” from the audit log alone, without depending on permissive database behavior.

2.6 Failure semantics

Common route outcomes:
  • 404: unknown chain or missing baseline (StargateChainRegistryNotFound, BaselineMissingError)
  • 409: EID collision on chain registry upsert (StargateChainEidConflict)
  • 403: HMAC purpose is not admin or all
The admin API is deliberately small: it exposes registry ownership, not free discovery. Discovery/refresh flows feed the admin surface; refresh-registry, set-trust, preapprove, and revoke-preapprove are operator review gates mounted in stargate_admin.py over discovery output.

2.7 Pool verification endpoint binding

Refreshing a pool verifies one configured RPC endpoint at a time. It first requires an exact, strictly encoded eth_chainId, then a valid nonempty eth_getCode response for the pool. The first candidate that meets both tests is fixed for every later token, LayerZero endpoint/EID, shared-decimals, ERC-20-decimals, and block read. The block read is itself a strict lowercase JSON-RPC quantity inside the selected-endpoint error boundary; malformed output or provider failure is rpc_error, never an exception or a fallback. A mismatch or RPC failure after selection never falls through to another endpoint. When no endpoint qualifies, empty_code has precedence over chain_id_mismatch, and chain_id_mismatch has precedence over unreachable only when every valid chain-id response was nonmatching. The drift worker records the endpoint ordinal/count and expected/observed numeric chain IDs, never a raw RPC URL, provider response, or exception message.

2.8 Mainnet KMS runtime opt-in

The base Compose stack deliberately starts both application services with signing disabled. Do not change that default or rename the opt-in overlay to docker-compose.override.yml. For a reviewed Stargate mainnet drill, use exactly these two files, in this order:
infra/docker-compose.stargate-kms-mainnet.yml affects only qtg-mainnet. It selects aws_kms_evm, enables Stargate, keeps raw-key settings empty, and bind-mounts the dedicated profile directory read-only at /root/.aws. It pins AWS_CONFIG_FILE and AWS_SHARED_CREDENTIALS_FILE to the mounted config and credentials files, and blanks inherited AWS access-key/session-token values. It does not declare AWS access keys, session tokens, private keys, or HMAC secrets. The KMS key identifier and signer registry key are identifiers, not cryptographic material. The dedicated directory must contain only the named drill profile’s AWS configuration and credentials — never the operator’s full ${HOME}/.aws. The overlay explicitly clears MG_LOCAL_SIGNER_AWS_ENDPOINT_URL, AWS_ENDPOINT_URL, and AWS_ENDPOINT_URL_KMS, so the KMS client cannot inherit an arbitrary endpoint. Before starting a signing-capable worker, run this read-only database audit. It fails closed if either a non-drill READY/in-flight node exists or any nonterminal node still references the selected signer key/address:
After the JEP-82 migration is applied and this audit is empty, build the exact checked-out source, record its image ID/revision, then recreate only mainnet:
Stop immediately; do not recreate or run a drill if any of the following is true:
  • config --quiet rejects a required KMS value, the dedicated profile directory is absent, or it contains credentials beyond the drill profile.
  • The pre-start database audit returns any row. Do not start workers around non-drill work or a reused signer; resolve it first.
  • The intended KMS profile cannot perform the required signer health check, or its derived EVM address does not equal the authority signer and approved round-trip sender.
  • MG_EVM_RPC_ENDPOINTS_JSON lacks an explicit non-public endpoint for either selected chain; the drill refuses default RPC endpoints.
  • Either endpoint cannot serve the destination observer’s GUID-bound paged eth_getLogs lookback. The observer snapshots the destination head and reads the 3,001-block safety window in newest-first, inclusive 10-block pages (then only new blocks plus a small reorg overlap after a complete miss). If a provider rejects even that bounded read or the scan exceeds its explicit page budget, preserve the saved hash/GUID and investigate the read-only observer; never retry or rebroadcast the send.
  • The migration head, registry pool trust/preapproval, enabled path baseline, destination allowlist, or signer expected-identity gate is not satisfied.
  • Any existing node has ambiguous Stargate broadcast evidence. Preserve the known hash and recover/poll it; never initiate a second send as a retry.
Using this overlay enables a signing-capable process; it is not approval to sign or broadcast. The drill still requires its separate one-time execution approval.