mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
The in-luxd native D-Chain plugin served HTTP only (the dev left the ZAP socket to standalone cmd/dvenue: handler.go said 'the in-luxd plugin does NOT use this path'). Owner transport decision: the ZAP socket is the CANONICAL native ingestion in-luxd (the HFT path — binary wire, streaming, co-located on the pod), HTTP stays as the compat surface (web/exchange-api/ debug). Both fold over the ONE clobMethods core; transport is orthogonal to consensus, so it is safe to serve both — an order from either transport hits the identical submitTx -> mempool.Add -> Verify-match path, and validators replay from accepted block BYTES, never the wire. zapingest.go: the VM owns its transports. Initialize parses init.Config for an optional zapIngestAddr and, when set, opens rpc.Listen co-located in the plugin process bound to clobMethods (reusing RegisterCLOB, the existing socket seam) — served concurrently, closed on Shutdown. Enabled by DATA (the chain config the operator/genesis sets), NOT a build tag or forked entry point: one binary, one core, the transport set is a per-environment knob. Empty addr => HTTP-compat-only (in-process tests + cmd/dvenue, which runs its own socket, are unaffected). Malformed config fails fast at Initialize. TDD (all !cgo): - TestZAPIngestCrossingOrdersMatchInBlock: an order over the VM's OWN config-started socket (no manual RegisterCLOB) -> consensus -> committed fill. - TestZAPIngestSharesOneCoreWithHTTP: maker rests over ZAP, taker crosses over HTTP against the SAME book -> proves one core, two transports. - TestParseConfig / TestNoZAPIngestWhenUnset / TestZAPIngestStopsOnShutdown: config contract (forwards-only), no-op path, clean idempotent teardown. Additive: RegisterCLOB unchanged; CreateHandlers/ingest.go unchanged; the runner (cmd/dchain) unchanged — the socket is a VM concern driven by config.