Skip to content

Commit cddfc37

Browse files
committed
plugin/evm: remove deprecated DexZap live-backend wiring; precompile v0.5.49
The C-Chain DEX settles certified D-Chain fill receipts at the 0x9999 precompile (LP-9999); it never queries a live matcher. Remove the deprecated DexZapEndpoint -> SetBackend(NewZAPEngine()) wiring from vm.go and the DexZapEndpoint config knob: a synchronous in-block ZAP query against the D-Chain's moving book forks consensus (each validator observes differently-timed fills -> divergent StateRoot, proven by chains/dexvm TestRED_PerValidatorRelay_SplitsConsensus). ZAP survives only as the dexvm's own build-path transport, never as a C-Chain live backend. Receipts ride in V4 swap hookData and are verified inline (deterministic BLS). Bump github.com/luxfi/precompile v0.5.47 -> v0.5.49 to embed the complete, red-swarm-hardened 0x9999 receipt-settlement surface.
1 parent e496c97 commit cddfc37

5 files changed

Lines changed: 19 additions & 40 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require (
3232
github.com/luxfi/metric v1.5.8
3333
github.com/luxfi/p2p v1.21.1
3434
github.com/luxfi/pq v1.0.3
35-
github.com/luxfi/precompile v0.5.47
35+
github.com/luxfi/precompile v0.5.49
3636
github.com/luxfi/runtime v1.1.1
3737
github.com/luxfi/sys v0.1.0
3838
github.com/luxfi/timer v1.0.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ github.com/luxfi/p2p v1.21.1 h1:gmz1JMDhzHIL3dQlhwIDvR4OlFuhNVfnWUl/ipYhAIo=
276276
github.com/luxfi/p2p v1.21.1/go.mod h1:SsNPR5fPGWWNem9plGWhSmRqyDoysJ3kPAN0zG0g3iw=
277277
github.com/luxfi/pq v1.0.3 h1:pFlQm1+5FuKTDUh2y/23bXWkN4I2Rc5iuxJypwDFFMs=
278278
github.com/luxfi/pq v1.0.3/go.mod h1:8bppZcRElfrVt0n3nYCZW3iX1TvhvzNbdjNdK1irgIE=
279-
github.com/luxfi/precompile v0.5.47 h1:YeigusKzHzYTc5xdT4w33WMH9pPd773LyrjUKoqVzJg=
280-
github.com/luxfi/precompile v0.5.47/go.mod h1:X5QPX4y/Q9AQn5gqO+BrscKPX2R/FOUtINx/bGqutqA=
279+
github.com/luxfi/precompile v0.5.49 h1:WvrSBsNdhdydmz7RxiGH6AdICOQk/A/UKlCP6KWpfbg=
280+
github.com/luxfi/precompile v0.5.49/go.mod h1:aR523IXj+VQAIU1CYP/64dVwKK93DDssHj1tGFdzLTY=
281281
github.com/luxfi/proto v1.3.4 h1:dNrdQ/414Pe9otIekVUmQ9QLqemaMFK43H4N3DIbuzQ=
282282
github.com/luxfi/proto v1.3.4/go.mod h1:S80KrTzISCktptit/pWLzk6nHgagjJS86qbQL6gHutE=
283283
github.com/luxfi/resource v0.0.1 h1:mTh+ICWSy548GTUSSyx7V/X5dV18oEwxZeQEYGJQhD4=

plugin/evm/config/config.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -290,18 +290,12 @@ type Config struct {
290290
// the older flag names.
291291
PQ bool `json:"pq,omitempty"`
292292

293-
// DexZapEndpoint points the DEX precompile (LP-9010 V4 PoolManager) at a
294-
// node-local D-Chain (dexvm) over ZAP instead of the in-process embedded
295-
// engine. Empty (the default) keeps the embedded engine — current behavior,
296-
// fully self-contained, no external dependency.
297-
//
298-
// CONSENSUS SAFETY: this is consensus-deterministic ONLY when every
299-
// validator runs the IDENTICAL node-local D-Chain at the IDENTICAL pinned
300-
// version. The endpoint MUST be node-local (e.g. a loopback/unix socket to
301-
// the dexvm on the same host) and version-pinned across the validator set —
302-
// a remote or version-skewed backend produces divergent state and forks the
303-
// chain. Operators flipping this knob own that invariant.
304-
DexZapEndpoint string `json:"dex-zap-endpoint"`
293+
// NOTE: the former DexZapEndpoint knob is REMOVED. The C-Chain DEX precompile
294+
// (0x9999) settles certified D-Chain fill receipts INLINE (deterministic BLS
295+
// verify); it never points at a live matcher backend (a synchronous in-block
296+
// query against the D-Chain's moving book forks consensus). The dexvm's ZAP
297+
// transport is internal to chains/dexvm and not configured here. See
298+
// precompile/dex/settle9999.go.
305299
}
306300

307301
// TxPoolConfig contains the transaction pool config to be passed

plugin/evm/config/config_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,6 @@ func TestUnmarshalConfig(t *testing.T) {
7171
Config{StateSyncIDs: "NodeID-CaBYJ9kzHvrQFiYWowMkJGAQKGMJqZoat"},
7272
false,
7373
},
74-
{
75-
// The DEX ZAP flip is configurable: a set endpoint decodes into the
76-
// field that vm.go gates the SetBackend(NewZAPEngine(...)) call on.
77-
// Empty (the zero-value default, covered by the empty-config cases
78-
// above) leaves the embedded engine = the inert, self-contained
79-
// default a public node runs.
80-
"dex zap endpoint set",
81-
[]byte(`{"dex-zap-endpoint": "127.0.0.1:9099"}`),
82-
Config{DexZapEndpoint: "127.0.0.1:9099"},
83-
false,
84-
},
8574
{
8675
"empty transaction history ",
8776
[]byte(`{}`),

plugin/evm/vm.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ import (
7575
// Force-load precompiles to trigger registration
7676
_ "github.com/luxfi/evm/precompile/registry"
7777

78-
dexprecompile "github.com/luxfi/precompile/dex"
7978

8079
"github.com/luxfi/geth/common"
8180
"github.com/luxfi/geth/ethdb"
@@ -401,19 +400,16 @@ func (vm *VM) Initialize(ctx context.Context, init block.Init) error {
401400
}
402401
}
403402

404-
// Wire the DEX precompile backend BEFORE genesis/pool init. SetBackend
405-
// errors once any pool state exists, so it MUST run before parseGenesis.
406-
// Empty endpoint = embedded engine (the package default) — opt-in flip,
407-
// dormant until configured. When set, point the LP-9010 PoolManager at the
408-
// node-local D-Chain (dexvm) over ZAP so any Lux-derived EVM shares one
409-
// unified DEX. See config.DexZapEndpoint for the consensus-safety invariant.
410-
if vm.config.DexZapEndpoint != "" {
411-
engine := dexprecompile.NewZAPEngine(vm.config.DexZapEndpoint, 2*time.Second)
412-
if err := dexprecompile.SetBackend(engine); err != nil {
413-
return fmt.Errorf("failed to install DEX ZAP backend at %q: %w", vm.config.DexZapEndpoint, err)
414-
}
415-
log.Info("DEX precompile backend installed", "brand", engine.Brand(), "endpoint", vm.config.DexZapEndpoint)
416-
}
403+
// DEX settlement model (settled architecture): the C-Chain DEX precompile
404+
// SETTLES certified D-Chain fill receipts at 0x9999; it does NOT query a live
405+
// matcher backend. The deprecated DexZapEndpoint -> SetBackend(NewZAPEngine())
406+
// wiring is REMOVED — a synchronous in-block ZAP query against the D-Chain's
407+
// moving order book forks consensus (each validator observes differently-timed
408+
// fills => divergent StateRoot, proven by chains/dexvm TestRED_PerValidator
409+
// Relay_SplitsConsensus). ZAP survives ONLY as the dexvm's own build-path
410+
// transport (chains/dexvm), never as a C-Chain live backend. Receipts ride in
411+
// the V4 swap hookData and are verified inline (deterministic BLS), so there is
412+
// no backend to install here. See precompile/dex/settle9999.go.
417413

418414
debugLog("Calling parseGenesis with genesisAllocFile=%q, upgradeBytes len=%d", vm.config.GenesisAllocFile, len(upgradeBytes))
419415
fmt.Fprintf(os.Stderr, "[GENESIS-BYTES-DEBUG] len=%d first500=%s\n", len(genesisBytes), string(genesisBytes[:min(500, len(genesisBytes))]))

0 commit comments

Comments
 (0)