Files
chains/evm/cevm/LLM.md
T
zeekay 38a694bde4 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.5 KiB

cevm — AI Assistant Context

Go FFI shim around the C++ EVM (~/work/luxcpp/cevm).

Build modes

  • cgo: links libevm, libevm-gpu, libluxgpu, libcevm_precompiles. Exposes CPUSequential, CPUParallel (Block-STM), GPUMetal (darwin), GPUCUDA (linux).
  • !cgo: returns CPUSequential only; ExecuteBlock* return errors.

API surface is identical across modes (cevm.go is shared, cevm_cgo.go / cevm_nocgo.go provide the implementation).

Block STM status

Real, present in ~/work/luxcpp/cevm/lib/evm/gpu/:

  • CPU: parallel_engine.cpp, parallel_host.hpp, mv_memory.{cpp,hpp} (MVHashMap)
  • Metal: metal/block_stm.metal, metal/block_stm_host.{mm,hpp}
  • CUDA: cuda/block_stm.cu, cuda/block_stm_host.{cpp,hpp}

Driven from Go via ExecuteBlockV3(backend=CPUParallel|GPU{Metal,CUDA}, ...).

C-Chain wiring

Default execution path on the C-Chain plugin (~/work/lux/chains/evm) uses the luxfi/evm/core/parallel registry. Under cgo, importing luxfi/cevm links the luxcpp libs and parallel.SetBackend(AutoEVM) resolves to CppEVM iff luxfi/evm itself is built with -tags cevm. Under !cgo, GoEVM (geth) is the only path.

The luxfi/evm-side cevmExecutor.ExecuteTransaction is currently a stub (returns nil → falls back to geth interpreter); completing it to dispatch into cevm.ExecuteBlockV3 is a luxfi/evm-repo change, not done here.

PQ finality

C-Chain blocks become PQ-final via P-Chain inclusion (Quasar = BLS + Corona lattice). This package does not sign anything itself. See ~/work/lux/consensus/LLM.md.