Files
evmgpu/core/vm/runtime/env.go
zooqueen 28942737fc fix(build): re-pin [email protected], restore core/vm/runtime, gate GPU-opcode cgo
Four orthogonal fixes so 'GOWORK=off CGO_ENABLED=1 go build ./...' compiles
the real slot-level Block-STM (core/parallel + state_processor) again:

1. upgrade: re-pin v1.0.1-0.20260603055252-f51810805436 -> v1.0.1. The pinned
   pseudo-version commit was force-pushed off origin (orphaned); the published
   v1.0.1 tag resolves to the same tree (bd889e9). params, which imports
   upgrade, now builds.

2. gpu: re-pin v1.0.2 -> v1.0.1 (matches sibling luxfi/evm). gpu v1.0.2's
   e2e_cgo.go calls lux_gpu_{mldsa,slhdsa}_verify_batch with a stale arg list
   that no longer matches the C header (cgo 'not enough arguments'); v1.0.1
   compiles clean against the installed header.

3. core/vm/runtime: restore the package. An UNANCHORED  entry
    silently excluded core/vm/runtime/, so cmd/evm/runner.go imported
   a package that was never committed. Anchored the ignore to /runtime (root
   build artifact) and added the package (ported from luxfi/evm, rewired to
   evmgpu's forked core/state.StateDB).

4. gpu_evm.go: add the missing  build tag (cgo && darwin && arm64 ->
   gpu && cgo && darwin && arm64), aligning the GPU-opcode dispatcher with its
   own test (gpu_evm_test.go) and doc comment. Without it the lux-cevm-linked
   cgo file was compiled on every darwin build, forcing an absent native dep
   on the default build. GPU-opcode dispatch is now opt-in behind -tags gpu;
   the pure-Go STM core and the luxfi/gpu ecrecover path stay default.

Verified: ./core/... ./params/... ./cmd/evm build (CGO=1, install pkg-config).
plugin/cmd/abigen link only against absent native archives (accel embeds a
broken relative -L; pqclean/lattice not install-complete) — pre-existing and
identical in luxfi/evm, not introduced here.
2026-06-21 22:39:06 -07:00

60 lines
1.9 KiB
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//
// This file is a derived work, based on the go-ethereum library whose original
// notices appear below.
//
// It is distributed under a license compatible with the licensing terms of the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********
// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package runtime
import (
"github.com/luxfi/evmgpu/core"
"github.com/luxfi/geth/core/vm"
)
func NewEnv(cfg *Config) *vm.EVM {
txContext := vm.TxContext{
Origin: cfg.Origin,
GasPrice: cfg.GasPrice,
BlobHashes: cfg.BlobHashes,
BlobFeeCap: cfg.BlobFeeCap,
}
blockContext := vm.BlockContext{
CanTransfer: core.CanTransfer,
Transfer: core.Transfer,
GetHash: cfg.GetHashFn,
Coinbase: cfg.Coinbase,
BlockNumber: cfg.BlockNumber,
Time: cfg.Time,
Difficulty: cfg.Difficulty,
GasLimit: cfg.GasLimit,
BaseFee: cfg.BaseFee,
BlobBaseFee: cfg.BlobBaseFee,
Random: cfg.Random,
}
evm := vm.NewEVM(blockContext, cfg.State, cfg.ChainConfig, cfg.EVMConfig)
evm.SetTxContext(txContext)
return evm
}