Files
chains/evm/LLM.md
T
Hanzo AI e9bef3383a Consolidate VMs into single chains module; cevm Metal anchor + V4 dispatch
VM consolidation (one module, one place only):
- Removed per-VM go.mod/go.sum/VERSION from {aivm,bridgevm,dexvm,evm,
  graphvm,identityvm,keyvm,oraclevm,quantumvm,relayvm,thresholdvm,zkvm}
- All VMs now compile under github.com/luxfi/chains root module
- aivm/, dexvm/, identityvm/, keyvm/, oraclevm/ factory.go + vm.go updated
  for AccelHost wiring

cevm Go-side (evm/cevm/):
- cevm.go, cevm_cgo.go, cevm_nocgo.go: ExecuteBlockV4(backend, threads,
  txs, ctx, state) with StateAccount snapshot
- cevm_secp256k1.go: BatchRecoverSenders Metal LDFLAGS
- cevm_secp256k1_metal_anchor_darwin.{c,go}: anchor to keep linker from
  dropping libsecp256k1_metal.a
- cevm_secp256k1_nocgo.go: stub for non-cgo builds
- plugin.go, fetch-luxcpp.sh, luxcpp-SHA256SUMS, LUXCPP_VERSION:
  pinned luxcpp consumption
- evm/cevm/parallel/parallel.go: BlockExecutor adapter calls
  cevm.ExecuteBlockV4 with state snapshot built from txs+statedb

Quantum/ZK witness:
- quantumvm/quasar_witness.go, zkvm/zwitness.go

go.mod: removed dead `replace github.com/ethereum/go-ethereum => luxfi/geth`
directive (caused dual-path conflict after math semver bump; no remaining
ethereum/go-ethereum imports in source). go mod tidy clean.

Tests: TestBatchRecoverSenders PASS through Metal anchor (cevm package).
2026-05-05 10:17:49 -07:00

1.4 KiB

chains/evm — AI Assistant Context

C-Chain VM plugin entry point. Spawns luxfi/evm.VM{} over rpcchainvm and imports every precompile package by side effect (registry pattern).

Execution backend

Backend selection lives in backend_cgo.go / backend_nocgo.go (single cgo-tag pair, no other build flags). main.go calls selectExecutionBackend once at startup, before serving rpcchainvm.

  • cgo: imports github.com/luxfi/chains/evm/cevm to link luxcpp shared libs (libevm, libevm-gpu, libluxgpu, libcevm_precompiles), runs cevm.Health() probes, and calls parallel.SetBackend(AutoEVM). Active backend is CppEVM iff luxfi/evm is built with -tags cevm; otherwise GoEVM (geth) — without losing the GPU ecrecover bridge that registers itself under cgo && darwin in luxfi/evm/core/parallel/gpu_bridge.go.
  • !cgo: parallel.SetBackend(GoEVM). Pure-Go fallback.

Block STM

Implemented upstream in ~/work/luxcpp/cevm/lib/evm/gpu/. Reachable from Go via cevm.ExecuteBlockV3(backend=CPUParallel|GPUMetal|GPUCUDA, ...). The luxfi/evm tx-executor stub currently does NOT dispatch into ExecuteBlockV3 — that wire-up is a luxfi/evm-repo change.

PQ finality

Out of scope. Blocks become PQ-final via P-Chain inclusion (Quasar). See ~/work/lux/consensus/LLM.md.

Build verification

GOWORK=off CGO_ENABLED=0 go build ./...   # nocgo path
GOWORK=off CGO_ENABLED=1 go build ./...   # cgo path (links luxcpp libs)