mirror of
https://github.com/luxfi/bridge.git
synced 2026-09-24 00:26:46 +00:00
The bridge is permissionless and non-custodial. Authoritative quote
and swap state belong in chains/bridgevm (the B-Chain VM the
validator quorum runs); threshold key shares belong in T-Chain
across the validator set. The daemon's role is observe + broadcast —
not orchestrate, not custody.
Deleted (net -664 LOC):
- cmd/bridge/quote_engine.go (settlement math moved to bridgevm)
- cmd/bridge/coingecko_price_feed.go (no daemon-local price feed)
- cmd/bridge/coingecko_price_feed_test.go
Added (+290 LOC):
- cmd/bridge/quote_handler.go (REST → bchain.EstimateFee pass-through)
- cmd/bridge/resync_swaps.go (--resync-swaps reconciles local UX cache
against authoritative B-Chain state)
Updated:
- swap_store.go: declares the local store as a UX cache; B-Chain wins
on conflict. Header doc states the contract.
- signing_driver.go: header rewritten to declare observe + broadcast
role, no orchestration. Pipeline logic unchanged — it was already
a thin orchestrator, the docs lagged the architecture.
- swaps_handler.go: quote snapshot at create time calls bchain
bridge_estimateFee; no daemon-local QuoteEngine.
- api.go: NewAPI signature drops *QuoteEngine. Native routes register
when SwapStore + bchain client are both wired.
- main.go: dropped --coingecko* flags + price-feed wiring; added
--resync-swaps flag.
Tests updated to use an in-process mock B-Chain RPC for quote
snapshot. 32 cmd/bridge tests pass (15 new resync + bchain-mock).
BREAKING:
- --coingecko, --coingecko-url, --coingecko-api-key, --coingecko-cache-ttl,
--coingecko-timeout flags removed.
- --bchain-url is now required for /v1/bridge/quote + /v1/bridge/swaps
native registration. Without it those routes fall back to the
legacy reverse-proxy (or 503 when --backend is also unset).
- NewAPI signature lost its *QuoteEngine parameter.