mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
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.
This commit is contained in:
@@ -32,7 +32,7 @@ require (
|
||||
github.com/luxfi/metric v1.5.8
|
||||
github.com/luxfi/p2p v1.21.1
|
||||
github.com/luxfi/pq v1.0.3
|
||||
github.com/luxfi/precompile v0.5.47
|
||||
github.com/luxfi/precompile v0.5.49
|
||||
github.com/luxfi/runtime v1.1.1
|
||||
github.com/luxfi/sys v0.1.0
|
||||
github.com/luxfi/timer v1.0.2
|
||||
|
||||
@@ -276,8 +276,8 @@ github.com/luxfi/p2p v1.21.1 h1:gmz1JMDhzHIL3dQlhwIDvR4OlFuhNVfnWUl/ipYhAIo=
|
||||
github.com/luxfi/p2p v1.21.1/go.mod h1:SsNPR5fPGWWNem9plGWhSmRqyDoysJ3kPAN0zG0g3iw=
|
||||
github.com/luxfi/pq v1.0.3 h1:pFlQm1+5FuKTDUh2y/23bXWkN4I2Rc5iuxJypwDFFMs=
|
||||
github.com/luxfi/pq v1.0.3/go.mod h1:8bppZcRElfrVt0n3nYCZW3iX1TvhvzNbdjNdK1irgIE=
|
||||
github.com/luxfi/precompile v0.5.47 h1:YeigusKzHzYTc5xdT4w33WMH9pPd773LyrjUKoqVzJg=
|
||||
github.com/luxfi/precompile v0.5.47/go.mod h1:X5QPX4y/Q9AQn5gqO+BrscKPX2R/FOUtINx/bGqutqA=
|
||||
github.com/luxfi/precompile v0.5.49 h1:WvrSBsNdhdydmz7RxiGH6AdICOQk/A/UKlCP6KWpfbg=
|
||||
github.com/luxfi/precompile v0.5.49/go.mod h1:aR523IXj+VQAIU1CYP/64dVwKK93DDssHj1tGFdzLTY=
|
||||
github.com/luxfi/proto v1.3.4 h1:dNrdQ/414Pe9otIekVUmQ9QLqemaMFK43H4N3DIbuzQ=
|
||||
github.com/luxfi/proto v1.3.4/go.mod h1:S80KrTzISCktptit/pWLzk6nHgagjJS86qbQL6gHutE=
|
||||
github.com/luxfi/resource v0.0.1 h1:mTh+ICWSy548GTUSSyx7V/X5dV18oEwxZeQEYGJQhD4=
|
||||
|
||||
@@ -290,18 +290,12 @@ type Config struct {
|
||||
// the older flag names.
|
||||
PQ bool `json:"pq,omitempty"`
|
||||
|
||||
// DexZapEndpoint points the DEX precompile (LP-9010 V4 PoolManager) at a
|
||||
// node-local D-Chain (dexvm) over ZAP instead of the in-process embedded
|
||||
// engine. Empty (the default) keeps the embedded engine — current behavior,
|
||||
// fully self-contained, no external dependency.
|
||||
//
|
||||
// CONSENSUS SAFETY: this is consensus-deterministic ONLY when every
|
||||
// validator runs the IDENTICAL node-local D-Chain at the IDENTICAL pinned
|
||||
// version. The endpoint MUST be node-local (e.g. a loopback/unix socket to
|
||||
// the dexvm on the same host) and version-pinned across the validator set —
|
||||
// a remote or version-skewed backend produces divergent state and forks the
|
||||
// chain. Operators flipping this knob own that invariant.
|
||||
DexZapEndpoint string `json:"dex-zap-endpoint"`
|
||||
// NOTE: the former DexZapEndpoint knob is REMOVED. The C-Chain DEX precompile
|
||||
// (0x9999) settles certified D-Chain fill receipts INLINE (deterministic BLS
|
||||
// verify); it never points at a live matcher backend (a synchronous in-block
|
||||
// query against the D-Chain's moving book forks consensus). The dexvm's ZAP
|
||||
// transport is internal to chains/dexvm and not configured here. See
|
||||
// precompile/dex/settle9999.go.
|
||||
}
|
||||
|
||||
// TxPoolConfig contains the transaction pool config to be passed
|
||||
|
||||
@@ -71,17 +71,6 @@ func TestUnmarshalConfig(t *testing.T) {
|
||||
Config{StateSyncIDs: "NodeID-CaBYJ9kzHvrQFiYWowMkJGAQKGMJqZoat"},
|
||||
false,
|
||||
},
|
||||
{
|
||||
// The DEX ZAP flip is configurable: a set endpoint decodes into the
|
||||
// field that vm.go gates the SetBackend(NewZAPEngine(...)) call on.
|
||||
// Empty (the zero-value default, covered by the empty-config cases
|
||||
// above) leaves the embedded engine = the inert, self-contained
|
||||
// default a public node runs.
|
||||
"dex zap endpoint set",
|
||||
[]byte(`{"dex-zap-endpoint": "127.0.0.1:9099"}`),
|
||||
Config{DexZapEndpoint: "127.0.0.1:9099"},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"empty transaction history ",
|
||||
[]byte(`{}`),
|
||||
|
||||
+10
-14
@@ -75,7 +75,6 @@ import (
|
||||
// Force-load precompiles to trigger registration
|
||||
_ "github.com/luxfi/evm/precompile/registry"
|
||||
|
||||
dexprecompile "github.com/luxfi/precompile/dex"
|
||||
|
||||
"github.com/luxfi/geth/common"
|
||||
"github.com/luxfi/geth/ethdb"
|
||||
@@ -401,19 +400,16 @@ func (vm *VM) Initialize(ctx context.Context, init block.Init) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Wire the DEX precompile backend BEFORE genesis/pool init. SetBackend
|
||||
// errors once any pool state exists, so it MUST run before parseGenesis.
|
||||
// Empty endpoint = embedded engine (the package default) — opt-in flip,
|
||||
// dormant until configured. When set, point the LP-9010 PoolManager at the
|
||||
// node-local D-Chain (dexvm) over ZAP so any Lux-derived EVM shares one
|
||||
// unified DEX. See config.DexZapEndpoint for the consensus-safety invariant.
|
||||
if vm.config.DexZapEndpoint != "" {
|
||||
engine := dexprecompile.NewZAPEngine(vm.config.DexZapEndpoint, 2*time.Second)
|
||||
if err := dexprecompile.SetBackend(engine); err != nil {
|
||||
return fmt.Errorf("failed to install DEX ZAP backend at %q: %w", vm.config.DexZapEndpoint, err)
|
||||
}
|
||||
log.Info("DEX precompile backend installed", "brand", engine.Brand(), "endpoint", vm.config.DexZapEndpoint)
|
||||
}
|
||||
// DEX settlement model (settled architecture): the C-Chain DEX precompile
|
||||
// SETTLES certified D-Chain fill receipts at 0x9999; it does NOT query a live
|
||||
// matcher backend. The deprecated DexZapEndpoint -> SetBackend(NewZAPEngine())
|
||||
// wiring is REMOVED — a synchronous in-block ZAP query against the D-Chain's
|
||||
// moving order book forks consensus (each validator observes differently-timed
|
||||
// fills => divergent StateRoot, proven by chains/dexvm TestRED_PerValidator
|
||||
// Relay_SplitsConsensus). ZAP survives ONLY as the dexvm's own build-path
|
||||
// transport (chains/dexvm), never as a C-Chain live backend. Receipts ride in
|
||||
// the V4 swap hookData and are verified inline (deterministic BLS), so there is
|
||||
// no backend to install here. See precompile/dex/settle9999.go.
|
||||
|
||||
debugLog("Calling parseGenesis with genesisAllocFile=%q, upgradeBytes len=%d", vm.config.GenesisAllocFile, len(upgradeBytes))
|
||||
fmt.Fprintf(os.Stderr, "[GENESIS-BYTES-DEBUG] len=%d first500=%s\n", len(genesisBytes), string(genesisBytes[:min(500, len(genesisBytes))]))
|
||||
|
||||
Reference in New Issue
Block a user