mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
backend_auto.go used to auto-select CppEVM when a GPU was detected
("parallel backend: GPU detected, backend=cevm, gpu=Metal"). But
cevmExecutor.ExecuteTransaction returned (nil, nil) — every tx fell
through to Go EVM regardless. The "GPU acceleration" log line was
misleading; the real path was always Go EVM.
Per LP-108 "one and one only": collapsed auto-select to GoEVM. The
GPU presence is still detected and logged honestly:
parallel backend: Go EVM (Block-STM across all cores)
cores=10 gpu_status="Metal (detected; cevm dispatch wiring
pending — runs Go EVM)"
To re-enable CppEVM auto-selection, the per-tx → batched-block
adapter in backend_cevm.go::ExecuteTransaction must be completed
AND a parity test against Go EVM Block-STM must pass.
Documented the gap in backend_cevm.go and backend_revm.go executor
comments. The (nil, nil) return is the documented "this backend
declines; use Go EVM" contract that the parallel framework's
DefaultTransactionExecutor expects (parallel.go:107).
Build verified: CGO_ENABLED=0 go build ./core/parallel/... clean.
Reference cevm bridge that needs wiring:
github.com/luxfi/chains/evm/cevm/cevm_cgo.go::ExecuteBlock
takes []Transaction (block-batch), TransactionExecutor is per-tx;
adapter must accumulate per-tx work and submit at block close.
This is the production-wiring counterpart to LP-108 Phase 4 vapor
deletion. The "GPU EVM is plumbed" claim is now contingent on the
adapter, not on ambient registration.
58 lines
1.6 KiB
Go
58 lines
1.6 KiB
Go
// Copyright (C) 2025-2026, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
//go:build revm
|
|
|
|
package parallel
|
|
|
|
// revm backend — Rust EVM via FFI.
|
|
//
|
|
// Build with: go build -tags revm
|
|
//
|
|
// Requires: librustc_revm.a (compiled from luxfi/revm)
|
|
//
|
|
// Features:
|
|
// - Native Block-STM parallel execution (primary advantage)
|
|
// - Rust memory safety guarantees
|
|
// - Good single-threaded performance (~1.5x vs Go EVM)
|
|
//
|
|
// The FFI bridge passes StateDB operations through cgo callbacks:
|
|
// Go StateDB ← cgo → Rust revm::Database trait impl
|
|
//
|
|
// FFI bridge to luxfi/revm (requires Rust lib)
|
|
|
|
import (
|
|
"github.com/luxfi/evm/core/state"
|
|
"github.com/luxfi/geth/core/types"
|
|
"github.com/luxfi/geth/core/vm"
|
|
ethparams "github.com/luxfi/geth/params"
|
|
)
|
|
|
|
func init() {
|
|
RegisterTransactionExecutor(RustEVM, &revmExecutor{})
|
|
}
|
|
|
|
type revmExecutor struct{}
|
|
|
|
func (r *revmExecutor) Backend() EVMBackend { return RustEVM }
|
|
|
|
// ExecuteTransaction dispatches to revm.
|
|
//
|
|
// LP-108 (2026-05-04): same gap as cevm — the FFI bridge to revm
|
|
// is not wired. Until the adapter lands and a parity test passes,
|
|
// returns (nil, nil) — the documented "decline" contract that the
|
|
// parallel framework expects (see parallel.go DefaultTransactionExecutor).
|
|
func (r *revmExecutor) ExecuteTransaction(
|
|
config *ethparams.ChainConfig,
|
|
header *types.Header,
|
|
tx *types.Transaction,
|
|
statedb *state.StateDB,
|
|
vmCfg vm.Config,
|
|
gasPool uint64,
|
|
) (*types.Receipt, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (r *revmExecutor) SupportsParallel() bool { return true }
|
|
func (r *revmExecutor) SupportsGPU() bool { return false }
|