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
- Configure the commercial deployment, Pro package/loader gate,
MG_STARGATE_ENABLED, required EVM RPC endpoints, and registry records. - Approve the route under the normal QTG approval and allowlist controls.
- Execute a path only after registry, quote, and signer checks succeed.
- Observe source and destination evidence through the configured path.
- Recover from durable execution evidence rather than guessing an ambiguous outcome.
- 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:
stargate_poolsis the raw registry inventory produced by discovery/refresh.stargate_chain_registryis the operator-owned registry that condenses pool rows into chain-level control-plane facts.stargate_path_baselineis the allow/deny + SLO layer that declares actual template-path readiness.
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 HMACadmin purpose throughout.
No new purpose was added.
- route module guard:
require_admin_hmac() - accepted roles:
admin(route-registered; the_ALLroute set covers admin/operator/agent) - canonical route-purpose mapping source:
interfaces/api/middleware/auth/hmac.py
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:
chainendpoint_identityfinality_age_secondssnapshot_versionsnapshot_stalestale_detected_atoperator_labelsnapshot_atcreated_atupdated_at
PathBaselineRow response fields:
src_chaindst_chainassetexpected_latency_secondsdetection_latency_budget_secondsfee_native_budgetenableddisabled_reasonlast_drill_pass_atlast_drill_evidence_pathbaseline_sourceoperator_labelcost_policy_revisionmax_token_fee_bpsmax_quote_degradation_bpsmax_native_messaging_fee_weimax_source_gas_fee_weienforced_options_raw_hexlz_receive_gaslz_receive_valueenforced_options_observed_atlast_unsafe_observed_atlast_unsafe_reasonsrc_pool_address_at_snapshotdst_eid_at_snapshotcreated_atupdated_at
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.- Seed chain registry from discovered pools.
Pro operator tool
seed_stargate_chain_registry(--operator-label ops.seed). - Seed path baselines from a reviewed JSON payload.
Pro operator tool
seed_stargate_path_baselinewith the reviewedpath-baselines.json(--operator-label ops.seed). - Check completeness against template coverage.
Pro operator tool
stargate_path_baseline_completeness. - Backfill or fix missing paths, then call
POST /v3/stargate/path-baselines/{src}/{dst}/{asset}/drill-passafter a successful drill and evidence upload. - When a chain/path is retired, remove it through the corresponding
DELETEadmin route so the audit table records the removal operator.
seed_stargate_chain_registrybackfillsstargate_chain_registryfrom distinct(chain, eid)pairs instargate_poolsseed_stargate_path_baselineapplies reviewed baseline JSON intostargate_path_baselinestargate_path_baseline_completenessreports 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:
POSTcreate: inserts row, writescreateauditPUTwith material field change: mutates row, increments version where applicable, writesupdateauditPUTwith no material field change and same operator label: no-op, no new audit rowPUTwith no material field change but different operator label: writestouchaudit so operator custody change is visibleDELETE: writesdeleteaudit first, then removes the live row
- audit row captures the last live snapshot before removal
before_jsonandafter_jsonboth contain that snapshot- row deletion happens after the audit insert so Postgres foreign-key enforcement is satisfied
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 notadminorall
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 encodedeth_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 todocker-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:
config --quietrejects 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_JSONlacks 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_getLogslookback. 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.