node: dchain build-tag split -- public build excludes D-Chain + private deps

vms.go drops the dexvm import+entry, calls appendDChainVM; vms_dchain.go (//go:build dchain)
links it, vms_nodchain.go (//go:build !dchain) no-ops; vms/dexvm alias gated //go:build
dchain + doc_nodchain.go placeholder. Genesis-gate (constants.DexVMID, no pkg dep) retained.
VERIFIED: public 'go list -deps ./node/' has ZERO chains/dexvm|luxfi/dex|gpu-kernels|luxcpp;
-tags dchain brings them in. Both builds green.

Consensus change -- held for human review before merge/push (bundles with merkle-activation).
This commit is contained in:
zeekay
2026-06-17 13:31:58 -07:00
parent 14f638c918
commit ad7d6dfaa6
10 changed files with 156 additions and 4 deletions
+48
View File
@@ -0,0 +1,48 @@
# Consensus Package - AI Assistant Guide
This package is node-side glue around the canonical consensus engine in
`github.com/luxfi/consensus`. It does NOT implement the protocol — the
protocol lives in that module.
## Package Structure
- `acceptor.go` - Node-side block-acceptance callbacks (chain-ID-keyed)
- `quasar/` - Node-side wiring around `consensus/protocol/quasar`
- `zap/` - ZAP agentic-consensus / DID bridge (self-contained, opt-in)
## Acceptor
`Acceptor` interface called when consensus accepts a block / vertex.
`AcceptorGroup` manages multiple acceptors per chain — used by the indexer
and warp IPC. The variant here differs from the canonical
`luxfi/consensus/core.Acceptor` (different signature: `*runtime.Runtime`
instead of `context.Context`, plus chain-ID-keyed registration).
## Quasar Wiring
The `quasar/` subpackage wraps `github.com/luxfi/consensus/protocol/quasar`
with node-specific adapters (P-Chain validator state, BLS signing keys,
Corona threshold coordinator stub).
### Signature Types
```go
SignatureTypeBLS // Classical BLS
SignatureTypeCorona // Post-quantum threshold
SignatureTypeQuasar // Hybrid BLS + Corona
SignatureTypeMLDSA // Fallback ML-DSA
```
## Testing
```bash
GOWORK=off go test ./consensus/... -v
```
## Dependencies
- `github.com/luxfi/consensus` - Canonical consensus protocol (engine,
protocol/quasar, types, etc.)
- `github.com/luxfi/ids` - ID types
- `github.com/luxfi/log` - Logging
- `github.com/luxfi/runtime` - Runtime context for acceptors
+9 -3
View File
@@ -8,7 +8,6 @@ import (
"github.com/luxfi/chains/aivm"
"github.com/luxfi/chains/bridgevm"
"github.com/luxfi/chains/dexvm"
"github.com/luxfi/chains/graphvm"
"github.com/luxfi/chains/identityvm"
"github.com/luxfi/chains/keyvm"
@@ -28,14 +27,18 @@ type vmEntry struct {
factory vms.Factory
}
// registerOptionalVMs registers the 11 optional VMs (A/B/D/G/I/K/O/Q/R/T/Z).
// registerOptionalVMs registers the optional VMs (A/B/G/I/K/O/Q/R/T/Z).
// Primary network (P/X/C) is registered separately.
// Session (S-Chain) is a standalone plugin at github.com/luxfi/session/plugin.
//
// The D-Chain (DEXVM) proxy is registered ONLY in the `dchain` build (see
// vms_dchain.go / vms_nodchain.go): the public OSS luxd MUST NOT even link the
// proxy/D-Chain tree (public-build purity). appendDChainVM is the seam — a
// no-op in the default build, the real registration under -tags dchain.
func (n *Node) registerOptionalVMs() error {
entries := []vmEntry{
{"AIVM (A-Chain)", aivm.VMID, &aivm.Factory{}},
{"BridgeVM (B-Chain)", bridgevm.VMID, &bridgevm.Factory{}},
{"DEXVM (D-Chain)", dexvm.VMID, &dexvm.Factory{}},
{"GraphVM (G-Chain)", graphvm.VMID, &graphvm.Factory{}},
{"IdentityVM (I-Chain)", identityvm.VMID, &identityvm.Factory{}},
{"KeyVM (K-Chain)", keyvm.VMID, &keyvm.Factory{}},
@@ -46,6 +49,9 @@ func (n *Node) registerOptionalVMs() error {
{"ZKVM (Z-Chain)", zkvm.VMID, &zkvm.Factory{}},
}
// D-Chain proxy VM: linked + appended only under -tags dchain.
appendDChainVM(n, &entries)
registered := 0
for _, e := range entries {
if err := n.VMManager.RegisterFactory(context.Background(), e.id, e.factory); err != nil {
+22
View File
@@ -0,0 +1,22 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build dchain
package node
import "github.com/luxfi/chains/dexvm"
// appendDChainVM links the D-Chain (DEXVM) proxy and appends its factory to the
// optional-VM registration set. This file compiles ONLY under -tags dchain, so
// the chains/dexvm import — and the entire proxy/D-Chain tree behind it — is
// absent from the public OSS luxd binary (public-build purity).
//
// Defense in depth: even a dchain-tagged binary will not INSTANTIATE the chain
// unless D-Chain is present in genesis (the genesis-gate in node.go). Three
// independent layers gate the venue: public can't link it; venue without
// D-Chain genesis links-but-doesn't-run it; venue + genesis runs it.
func appendDChainVM(n *Node, entries *[]vmEntry) {
*entries = append(*entries, vmEntry{"DEXVM (D-Chain)", dexvm.VMID, &dexvm.Factory{}})
n.Log.Info("D-Chain (DEXVM) proxy linked (dchain build)")
}
+13
View File
@@ -0,0 +1,13 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build !dchain
package node
// appendDChainVM is a no-op in the public (non-dchain) build: the D-Chain
// (DEXVM) proxy is NOT linked, so `go build ./...` of luxd does not import
// github.com/luxfi/chains/dexvm at all and the entire proxy/D-Chain tree is
// absent from the public binary. The venue build (-tags dchain) links it via
// vms_dchain.go.
func appendDChainVM(_ *Node, _ *[]vmEntry) {}
+7 -1
View File
@@ -1,6 +1,8 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build dchain
// Package dexvm re-exports the canonical DEX VM from
// github.com/luxfi/chains/dexvm so existing callers that imported
// github.com/luxfi/node/vms/dexvm pre-extraction keep working
@@ -9,7 +11,11 @@
// New code should import the canonical path:
// "github.com/luxfi/chains/dexvm"
//
// This package is a thin alias wrapper kept for backward compatibility.
// This package is a thin alias wrapper kept for backward compatibility. It is
// gated behind the `dchain` build tag: it imports github.com/luxfi/chains/dexvm
// (the D-Chain proxy tree), which MUST be absent from the public OSS luxd build
// (public-build purity). Nothing in-tree imports this alias; it exists only for
// out-of-tree backward compatibility, and only a venue (dchain) build links it.
package dexvm
import (
+17
View File
@@ -0,0 +1,17 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build !dchain
// Package dexvm is, in the public (non-dchain) build, an INTENTIONALLY EMPTY
// backward-compatibility shim.
//
// The real alias (dexvm.go) re-exports github.com/luxfi/chains/dexvm and is
// gated behind the `dchain` build tag, because importing the D-Chain proxy tree
// would violate public-build purity (the public OSS luxd must not link
// chains/dexvm). This file exists only so the package has a buildable Go source
// in the public build — otherwise `go test ./...` would report "build
// constraints exclude all Go files" for this directory. Nothing in-tree imports
// this package; it is kept solely for out-of-tree backward compatibility under
// a venue (dchain) build.
package dexvm
+19
View File
@@ -0,0 +1,19 @@
# platformvm
**Org:** luxfi · **Ecosystem:** lux · **Path:** `/Users/a/work/lux/luxfi/platformvm`
**Origin:** https://github.com/luxfi/platformvm.git
## Discovery
This file (`CLAUDE.md`) is the canonical agent-facing readme; `LLM.md` is a symlink to it. Update either name and both stay in sync.
## Where to look first
- `README.md` — human-facing overview (if present)
- `package.json` / `Cargo.toml` / `pyproject.toml` / `go.mod` — language & deps
- `.github/workflows/` — CI surface
- `docs/` — extended docs (if present)
## Sibling repos
See the org-level `LLM.md` at `/Users/a/work/lux/luxfi/LLM.md` for the full inventory of sibling repos and inter-repo dependencies.
+1
View File
@@ -0,0 +1 @@
CLAUDE.md
+19
View File
@@ -0,0 +1,19 @@
# exchangevm
**Org:** luxfi · **Ecosystem:** lux · **Path:** `/Users/a/work/lux/luxfi/exchangevm`
**Origin:** https://github.com/luxfi/exchangevm.git
## Discovery
This file (`CLAUDE.md`) is the canonical agent-facing readme; `LLM.md` is a symlink to it. Update either name and both stay in sync.
## Where to look first
- `README.md` — human-facing overview (if present)
- `package.json` / `Cargo.toml` / `pyproject.toml` / `go.mod` — language & deps
- `.github/workflows/` — CI surface
- `docs/` — extended docs (if present)
## Sibling repos
See the org-level `LLM.md` at `/Users/a/work/lux/luxfi/LLM.md` for the full inventory of sibling repos and inter-repo dependencies.
+1
View File
@@ -0,0 +1 @@
CLAUDE.md