21 Commits
Author SHA1 Message Date
zeekay d52e9ca2fb cevm: Go V1/V2/V3 are thin adapters over ExecuteBlock — one cgo path
Collapses the Go-side cgo entry points to a single canonical path:

  ExecuteBlock(backend, threads, txs, ctx, state)
    └─> C.gpu_execute_block_v4(...)

  ExecuteBlockV1(backend, txs)              -> ExecuteBlock + downcast
  ExecuteBlockV2(backend, threads, txs)     -> ExecuteBlock(nil, nil)
  ExecuteBlockV3(backend, threads, txs, ctx) -> ExecuteBlock(ctx, nil)
  ExecuteBlockV4 = ExecuteBlock (rename)

No more parallel C cgo calls. The luxcpp-side gpu_execute_block / _v2 / _v3
entries are now dead and can be removed in the next luxcpp release.

Health probe: the `callBridge` exception now applies on every backend
instead of GPU-only. The old V2 path masked kernel status with TxOK; the
canonical path surfaces the real CallNotSupported. Until the V5 kernel
implements CALL/CREATE on device, the probe accepts any clean return as
"dispatcher reached the bridge" — truth, not a mask.
2026-05-25 09:44:49 -07:00
zeekay 63862e904a cevm: ExecuteBlock is the canonical entry — one way only
Per "kill this version proliferation and have one and one way only":

- ExecuteBlock(backend, threads, txs, ctx, state) is the single canonical
  Go-side entry. Takes everything, returns everything.
- ExecuteBlockV1/V2/V3/V4 are marked Deprecated and retained as test-file
  compatibility shims pointing at the same underlying C ABI. New code MUST
  use ExecuteBlock.
- chains/evm/cevm/parallel/parallel.go switched to ExecuteBlock. parallel
  test suite still green.

The C-side ABI sprawl (gpu_execute_block / _v2 / _v3 / _v4) stays for now —
deleting them is a luxcpp/cevm refactor that ripples through internal
dispatch. The Go surface that consumers see is single-entry today; the C
cleanup is the next bounded follow-up in luxcpp.

CALL/CREATE on device — the "100% GPU EVM" gap — remains kernel-side work
in luxcpp/cevm/lib/evm/gpu/kernel/. The host-side scaffold (call_frame.hpp,
code_resolver.cpp, evmc_bridge.cpp, the GpuHostBridge type) is real but
the kernel CALL handler still emits TxCallNotSupported. That's the next
multi-week kernel push, not a Go-side change.
2026-05-24 23:01:11 -07:00
zeekay 223b307569 cevm: drop LUX_ prefix from env var — CEVM_STRICT
Per "no LUX_ in front of shit for no reason" — the strict-mode knob is
cevm-specific, not Lux-specific.

  LUX_CEVM_STRICT → CEVM_STRICT

Default unchanged (strict=on). Docs updated.
2026-05-24 18:51:42 -07:00
zeekay d084e4a839 cevm: TESTING_CUDA.md — cross-repo CUDA box validation checklist 2026-05-24 14:20:57 -07:00
zeekay 6d91317d83 cevm/parallel: strict GPU EVM by default — kill silent Go EVM fallback
Removes the silent (nil, nil) "fall through to Go EVM" return at the three
points where cevm V4 cannot complete a block on device:

  - tx value exceeds uint64
  - kernel returns TxCallNotSupported (CALL/CREATE family)
  - block has logs (V4 ABI has no per-tx logs)

Replaces each with declineBlock(reason, block, tx_index):

  * Default (LUX_CEVM_STRICT=1): returns ErrGPUEVMRequired so the caller
    cannot silently shadow-execute on the Go EVM. The lie that hid the
    missing GPU CALL/CREATE is removed.
  * Legacy (LUX_CEVM_STRICT=0): returns (nil, nil) for V4→V5 transition
    rollback only.

Every fallback records backend.RecordFallback(FallbackUnsupported, "cevm:<reason>")
so production observability surfaces the rate at which blocks decline.

V5 kernel spec lands at evm/cevm/V5_ABI.md: gpu_execute_block_v5 with
code-table, storage_root threading, per-tx logs. Strict mode becomes
unconditional once V5 ships and the env var retires.
2026-05-24 14:18:44 -07:00
zeekay 3e229caa8c chains/evm/cevm: switch to pkg-config: lux-cevm + lux-crypto-secp256k1
Replace the hand-rolled ${SRCDIR}/../../../../luxcpp/... CFLAGS+LDFLAGS
blocks in cevm_cgo.go and cevm_secp256k1.go with the canonical .pc
bundles. External Go consumers building from \$GOMODCACHE no longer
need a luxcpp checkout next to lux/; they only need the install prefix
on \$PKG_CONFIG_PATH.

cevm_cgo.go consumes lux-cevm (libevm + libevm-gpu + transitive
GPU-host static archives).

cevm_secp256k1.go consumes lux-crypto-secp256k1 (libsecp256k1_cpu +
libkeccak_cpu). libsecp256k1_metal stays on the build-tree path with
the existing darwin-only anchor file until a separate .pc bundle for
the Metal driver lands.
2026-05-21 17:16:12 -07:00
zeekay 19da12f04b chains: complete Corona → Corona purge across thresholdvm + quantumvm + dexvm
Continuation of eb0b44e (quantumvm consumer-side leak after consensus
repo migration) — the rename was incomplete; this pass closes it.

Identifier renames in chains/{quantumvm,thresholdvm,dexvm}:
  - NTTForwardCorona / NTTInverseCorona / BatchNTTForwardCorona
        → NTTForward/Inverse/BatchNTTForwardCorona (Quasar GPU dispatch)
  - LaneCorona (CertLane enum)
        → LaneCorona
  - ProtocolCorona (Protocol enum)
        → ProtocolCorona (string value already "corona")
  - All Corona-prefixed local identifiers in quantumvm/{quasar,
    quasar_witness,block,vm,vm_test,signer,stamper,service}.go,
    thresholdvm/{client,protocols,rpc,types/{ceremony,share},
    runtime/m_chain_adapter,cert/lane_test,protocol_executor_test}.go,
    dexvm/factory.go

Directory + file rename:
  thresholdvm/protocol/corona_general/corona.go
        → thresholdvm/protocol/corona_general/corona.go
  package corona_general → package corona_general

evm/main.go: replace single `precompile/corona` blank-import with
the canonical LP-4200 unified PQCrypto block (mlkem 0x012201,
mldsa 0x012202, slhdsa 0x012203, pulsar 0x012204, p3q 0x012205,
corona 0x012206) + xwing.

External test that imports threshold's renamed wrapper:
  thresholdvm/protocol_executor_test.go now imports
  "github.com/luxfi/threshold/protocols/corona" (was protocols/corona).
  Resolves via the workspace `./threshold` entry pointing at the
  local renamed wrapper; downstream chains/go.mod still pins
  luxfi/threshold v1.5.5 and will tidy clean once threshold cuts the
  next tag.

Build: go build ./... PASS (only harmless duplicate-rpath warnings
from the cevm cgo link).
Tests:
  thresholdvm + subpackages PASS
  quantumvm PASS
2026-05-14 09:33:22 -07:00
zeekay 374b538c4e evm: drop precompile/quasar blank-import — retired in upstream
quasar/* shipped a forgeable Verkle stub at 0x0300..0020 plus classical
BLS/Hybrid at 0x0300..0021-25 — pre-LP-4200 cruft now deleted at
github.com/luxfi/precompile. The canonical PQ verifiers live in the
LP-4200 0x012200 block.
2026-05-13 15:29:37 -07:00
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
zeekay d1c3a18106 LP-108 ENSURE: cevm/parallel — block-batched BlockExecutor for luxfi/evm
Real adapter wiring cevm.ExecuteBlockV3 through luxfi/evm's
BlockExecutor interface. Replaces the (nil, nil) stub in
luxfi/evm/core/parallel/backend_cevm.go with an actual block-batch
dispatch.

Why this lives in chains/evm/cevm/parallel and not luxfi/evm:
* Import direction: luxfi/evm declares the interface; cevm consumer
  imports luxfi/evm to satisfy it. Parallel-evm shouldn't import cevm.
* Build gate: this file requires the cgo bridge in cevm_cgo.go to
  link libcevm.a + libluxgpu. Operators opt in by importing this
  package; default builds skip it.

5-stage adapter:
1. Build []cevm.Transaction from types.Transactions (sender recovery,
   To+code load, Value/GasPrice uint64 conversion).
2. Build cevm.BlockContext (timestamp, number, chain id, basefee,
   coinbase, prevrandao, gas limit, blob basefee).
3. Dispatch one cevm.ExecuteBlockV3 cgo call.
4. Detect TxCallNotSupported — fall through to Go EVM (return nil,nil)
   rather than mix backends mid-block.
5. Reconstruct receipts. PARITY-CRITICAL: until cevm V3 ABI exposes
   per-tx logs, we only enable the path for value-transfer-only
   blocks (no Data, no Code at To). Otherwise fall through.

Wiring example (operator bootstrap):

  import (
      "github.com/luxfi/evm/core/parallel"
      cevmparallel "github.com/luxfi/chains/evm/cevm/parallel"
      "github.com/luxfi/chains/evm/cevm"
  )
  parallel.RegisterExecutor(&cevmparallel.Executor{
      CevmBackend: cevm.GPUMetal,
      Threads:     0,
  })

Build verified: CGO_ENABLED=0 GOWORK=off go build . — clean.

Production gate (LP-108):
* Correctness test: parity vs Go EVM Block-STM, value-transfer
  blocks first; non-value-transfer blocked until V3-logs ABI.
* Single canonical owner: this is the one cevm BlockExecutor.
* Reproducible bench: pending — needs an end-to-end harness that
  runs both Go EVM and cevm on the same value-transfer block stream.

Open work-items (tracked):
* cevm V3 ABI per-tx logs export (consensus-blocking for non-value
  blocks).
* CALL/CREATE on cevm GPU (status=5 fallback today).
* evm-parity-test 0/133 (real CPU/GPU divergence; gas accounting +
  EIP-2929).
2026-05-04 17:36:37 -07:00
zeekay 2a86eaedde fix(submodules): resolve build/test failures across 6 chains
- evm: bump precompile to v0.5.12 + fhe to v1.8.0 + gpu to v0.31.1
  (gpu v0.30.0 had unresolved C.mlx_* CGO symbols)
- aivm, bridgevm, quantumvm: go mod tidy
- thresholdvm, zkvm: bump genproto to v0.0.0-20260217215200-42d3e9bedb6d
  to resolve ambiguous googleapis/api/annotations import

All 12 chains now build and tests pass with GOWORK=off.

Refs #248
2026-04-28 02:51:06 -07:00
zeekay 9049355ca1 fix: refresh stale go.sum hashes for luxfi/[email protected]
Pre-existing drift from before/during luxgpu migration: go.sum had stale
h1 hashes for luxfi/[email protected] that no longer matched the module
proxy contents, causing 'checksum mismatch' SECURITY ERROR on every
build/test.

Refreshed sums via 'go mod download' to canonical proxy.golang.org values.
No version bumps; no source changes.
2026-04-28 00:25:40 -07:00
zeekay b74f5eba49 refactor: rename packages bvm/gvm/qvm/tvm/zvm to match dir names
Consistent naming: directory = package = binary.
- bvm → bridgevm
- gvm → graphvm
- qvm → quantumvm
- tvm → thresholdvm
- zvm → zkvm

Also: delete teleportvm/ and servicenodevm/ chain wrappers.
- teleportvm was duplicate of bridgevm+relayvm+oraclevm (separated chains)
- servicenodevm was renamed to sessionvm and lives at github.com/luxfi/session

One name, one package, one place.
2026-04-13 05:15:42 -07:00
zeekay 1ddd623fb5 evm: remove deprecated umbrella comment stubs (packages deleted in precompile c81f2b3) 2026-04-13 00:02:37 -07:00
zeekay 62db1ef16d fix: remove deleted aes/chacha20/ecies imports, bump deps
precompile v0.5.10: key-exposure packages removed (C-03)
evm v0.8.49: registry cleaned, precompile dep updated
2026-04-12 20:57:55 -07:00
zeekay fdc8eef737 fix: remove dead attestation import, drop secret-key precompiles (L-09)
- Remove attestation blank import (no init/module registration, dead code)
- Remove aes, chacha20, ecies (secret keys in calldata are public on-chain)
- Update comments for hpke (seal only) and ring (verify only)
2026-04-12 20:36:10 -07:00
zeekay 92cf4e52d1 feat: import 10 new precompile packages into Lux EVM
bls12381, poseidon, x25519, xwing, aes, chacha20, pedersen,
babyjubjub, pasta, curve25519
2026-04-12 19:54:46 -07:00
zeekay c9b1d759ab feat: all 22 explicit precompiles — remove pqcrypto/quantum/threshold umbrellas 2026-04-12 19:36:30 -07:00
zeekay 4b9263cf35 feat: enable all 18 precompiles on C-Chain EVM 2026-04-12 19:20:57 -07:00
zeekay 7412e14089 fix: update evm deps to match node v1.23.x 2026-04-12 18:11:50 -07:00
zeekay ea6e37dc24 feat: VM plugin monorepo — 14 independent binaries
Each VM builds as a standalone binary that the Lux node loads via
--plugin-dir. Node no longer bakes optional VMs in-process.

VMs: evm, dexvm, aivm, bridgevm, graphvm, identityvm, keyvm,
oraclevm, quantumvm, relayvm, servicenodevm, teleportvm,
thresholdvm, zkvm.

All 13 node-dependent VMs compile and report version correctly.
EVM requires CGo (luxcpp) — builds in CI only.
2026-04-12 13:05:45 -07:00