mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
Port the atomic import/export into the native dexvm matcher so the in-luxd D-Chain PRODUCES and CONSUMES the same primary-network shared-memory objects the 0x9999 precompile speaks — the owner's chosen model (D matches under its own consensus; C-Chain 0x9999 settles by consuming a node-local atomic object D produces; no BLS receipt, no external venue). - atomic.go: the seam. encodeSeamObject/decodeSeamObject reproduce the precompile's 69-byte wire (rail|owner|asset|amount|spent) BYTE-FOR-BYTE, and DeriveIntentID its id derivation — ONE wire across precompile/proxy/native. executeImport consumes a C->D object (Get under the C chain + shared-memory Remove) and funds the taker's native D account; executeExport debits the matched proceeds and writes a D->C object keyed exactly as ImportSettlement reads it, bound to the per-intent escrow (owner/asset/remaining) so Phase B's owner/asset/amount + per-taker-cap checks pass. commitSeamAtomic applies the removes/puts atomically with the block overlay (the platformvm acceptor pattern). No root change needed: the in-consensus matcher makes the atomic ops a pure function of the already-rooted txs (unlike the proxy's live venue). - vm.go: capture init.Runtime -> shared-memory handle + C-Chain id. - tx.go: TxImport (intentID) / TxExport (intentID|asset|amount|spent), both authorized by the cross-chain object, not a signature. - block.go: execute drives the seam in the account-scoped lane; Accept commits via commitSeamAtomic. - atomic_seam_e2e_test.go: two-phase e2e over REAL shared memory — Phase A intent -> native D import + a real crossing under D consensus -> native D export -> Phase B (the exact 0x9999 ImportSettlement consume) credits once; replay rejected; over-export beyond the locked principal rejected; conservation holds. Plus a golden-wire test pinning encodeSeamObject to the SAME cross-repo golden the precompile pins ImportSettlement against (native == precompile == proxy). go.sum: re-record re-tagged luxfi/[email protected] (stale hash blocked the build). go.mod: luxfi/runtime indirect -> direct (atomic.go uses it).