Files
precompile/dex
zeekay 6ea3143281 dex: LP-311 stateless 0x9999 conduit + host AtomicStager seam + real-StateDB reap-noop proof
Decomplect step 1 (LP-311 §5, the gate to live). The 0x9999 settlement conduit
drifted into a SECOND venue: it kept an order book + a per-asset/per-account ledger
+ atomic-staging records in its OWN account storage. Because 0x9999 is AlwaysOn and
dispatched by address, an ERC-20-only deposit leaves it EMPTY (nonce==0 ∧ balance==0
∧ codeHash==∅; storage is NOT part of EIP-158 empty()), so geth Finalise(true) reaps
the account AND its storage -> seamReserve stranded, zero fill. The shipped "fix" was
a nonce marker on 0x9999 (preserves the complect).

This adds the LP-311 STATELESS CONDUIT that dissolves the hazard at its cause:

- contract/atomic_stager.go: AtomicStager optional host capability (StageExport/
  ConsumeImport). The conduit moves cross-chain value objects through the HOST's
  non-empty staging account, never its own (reapable) account.

- dex/conduit.go: conduitForwardCredit / conduitApplyRelease. Escrow is native
  balance or the TOKEN's trie; the ledger + book live on the D-Chain venue; cross-
  domain objects are staged via AtomicStager. ZERO durable SetState(0x9999). The
  nonce marker is unnecessary and unused on this path. Reuses the proven C<->D object
  codec (native_wire.go), DeriveIntentID, and the raw escrow helpers (native balance /
  pullERC20Terminal under-delivery guard).

- dex/conduit_reap_test.go: the INVERSION of native_zap_realstate_test.go over a REAL
  *state.StateDB (EIP-158 on) + REAL cross-chain atomic.SharedMemory + a minimal-but-
  real D-Chain ledger venue. Drives ERC-20 deposit -> D-credit -> withdraw and proves:
  0x9999 holds ZERO own storage, is reaped at Finalise(true) as a NO-OP, escrow (token
  trie) + claim (D ledger) intact + withdrawable, conservation holds (no mint/loss).
  Plus the crisp RED/GREEN discriminator: same record reaped on empty 0x9999, survives
  on the non-empty host account.

Tests: TestConduit_OwnStorageReapIsNoOp_RealStateDB,
TestConduit_ReapDiscriminator_HostAccountVsConduit — GREEN (GOWORK=off CGO_ENABLED=0);
full dex suite green (no regressions). SYNC carry-fills no-fork primitive verified
green in chains/dexvm (TestRED_PerValidatorRelay_SplitsConsensus: identical roots, 0
venue calls at Verify).

Forward-only, patch-bump cascade. Old braided money path retained pending cutover
(repoint dispatch + delete C-side ledger -> D, embedded-venue deletion).
2026-06-27 16:59:13 -07:00
..