evm: derive plugin VM ID from luxfi/constants.EVMID; bump luxfi/gpu v1.0.1

- cmd/vmid prints constants.EVMID — Go source of truth for the C-Chain VM
  ID. Build scripts and Makefile now call this instead of hardcoding the
  base58 string. Drops a stale subnet-evm ID (ag3GReYP…) from the Makefile.
- scripts/build.sh: default output is build/evm; INSTALL=1 installs under
  the derived VMID at \$LUX_PLUGIN_DIR. Codesigns on darwin in-line so a
  fresh binary doesn't get SIGKILLed by gatekeeper post-cp.
- core/parallel/gpu_bridge.go: build tag flipped from \`!nogpu\` (opt-out)
  to \`gpu\` (opt-in) so default builds don't drag in luxfi/gpu cgo.
- go.mod: luxfi/gpu v0.30.0 → v1.0.1. v0.30.0 referenced removed MLX
  symbols (mlx_from_slice_int64 etc.); v1.0.1 migrated to lux/gpu.h and
  builds cleanly with -tags gpu and -tags \"cevm gpu\".
- LLM.md: build commands updated; \"no canonical / no aliases\" reflects
  reality (single VMID, one filename, derived from Go).
This commit is contained in:
2026-05-11 22:36:46 -07:00
parent 953fd6cc17
commit 458178730d
14 changed files with 93 additions and 56 deletions
+13 -8
View File
@@ -1432,17 +1432,22 @@ Canonical mainnet hashes/state root and required precompiles live in
```bash
cd ~/work/lux/evm
# Default Go EVM (used for production C-Chain plugin)
GOWORK=off go build -o /tmp/evm-plugin ./plugin/
# Default: builds and installs the plugin at the canonical path
# (~/.lux/plugins/<EVMID> where EVMID = CB58(ids.ID{'e','v','m'}) per luxfi/constants.EVMID).
# Handles codesign on darwin in one shot. No hardcoded plugin paths, no aliases.
./scripts/build.sh
# C++ EVM (real GPU)
GOWORK=off go build -tags cevm -o /tmp/evm-cevm ./plugin/
# Install at canonical VM ID (CB58 of ids.ID{'e','v','m'} per luxfi/constants.EVMID)
cp /tmp/evm-plugin ~/work/lux/node/build/plugins/mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6
codesign --force --sign - ~/work/lux/node/build/plugins/mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6
# Variants (build, then have luxd point its --plugin-dir at the chosen build):
./scripts/build.sh /tmp/evm-default # plain Go EVM (default)
GOFLAGS='-tags cevm' ./scripts/build.sh /tmp/evm-cevm # C++ backend (real GPU)
GOFLAGS='-tags revm' ./scripts/build.sh /tmp/evm-revm # Rust REVM backend
```
The plugin filename is the binary's location: luxd's chain manager looks up
`<plugin-dir>/<VMID>` and `constants.EVMID = ids.ID{'e','v','m'}` (CB58 =
`mgj786NP…`) is the canonical primary-network C-Chain ID. Same ID is used
for every EVM-based L2 chain in Lux. No second filename, no aliases.
### Known upstream gaps
- `luxfi/gpu@v0.30.0` MLX C bindings unimplemented — stubs in
+16 -15
View File
@@ -5,9 +5,10 @@ EVM_PATH := $(shell pwd)
# Load constants
GOPATH := $(shell go env GOPATH)
DEFAULT_PLUGIN_DIR := $(HOME)/.lux/plugins
# VM ID for "Lux EVM" - computed as base58(sha256(pad32("Lux EVM")))
DEFAULT_VM_ID := ag3GReYPNuSR17rUP8acMdZipQBikdXNRKDyFszAysmy3vDXE
LUX_PLUGIN_DIR ?= $(HOME)/.lux/plugins
# EVM VM ID derived from luxfi/constants.EVMID via cmd/vmid — no base58 hardcoded.
# Lazily expanded so `make help` etc. don't pay the `go run` cost.
EVM_VMID = $(shell go run ./cmd/vmid)
# Git info
EVM_COMMIT := $(shell git rev-parse HEAD 2>/dev/null || echo "unknown")
@@ -78,27 +79,27 @@ fix-deps:
go mod download
@echo "Dependencies fixed."
# Install to default plugin directory (copy binary)
# Install to plugin directory (copy binary). VM ID derived from go constants.
install: build
@echo "Installing EVM plugin to $(DEFAULT_PLUGIN_DIR)"
@mkdir -p $(DEFAULT_PLUGIN_DIR)
@cp build/evm $(DEFAULT_PLUGIN_DIR)/$(DEFAULT_VM_ID)
@echo "Installed: $(DEFAULT_PLUGIN_DIR)/$(DEFAULT_VM_ID)"
@vmid="$$(go run ./cmd/vmid)"; \
mkdir -p $(LUX_PLUGIN_DIR); \
install -m 0755 build/evm $(LUX_PLUGIN_DIR)/$$vmid; \
[ "$$(uname -s)" = "Darwin" ] && codesign --force --sign - $(LUX_PLUGIN_DIR)/$$vmid >/dev/null 2>&1 || true; \
echo "Installed: $(LUX_PLUGIN_DIR)/$$vmid"
# Link to plugins/current directory (symlink for development)
# Symlink for development (rebuild → no reinstall step needed)
link: build
@echo "Linking EVM plugin to $(DEFAULT_PLUGIN_DIR)/current"
@mkdir -p $(DEFAULT_PLUGIN_DIR)/current
@rm -f $(DEFAULT_PLUGIN_DIR)/current/$(DEFAULT_VM_ID)
@ln -s $(EVM_PATH)/build/evm $(DEFAULT_PLUGIN_DIR)/current/$(DEFAULT_VM_ID)
@echo "Linked: $(DEFAULT_PLUGIN_DIR)/current/$(DEFAULT_VM_ID) -> $(EVM_PATH)/build/evm"
@vmid="$$(go run ./cmd/vmid)"; \
mkdir -p $(LUX_PLUGIN_DIR); \
ln -sf $(EVM_PATH)/build/evm $(LUX_PLUGIN_DIR)/$$vmid; \
echo "Linked: $(LUX_PLUGIN_DIR)/$$vmid -> $(EVM_PATH)/build/evm"
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf build/
@rm -rf bin/
@rm -f $(DEFAULT_PLUGIN_DIR)/$(DEFAULT_VM_ID)
@vmid="$$(go run ./cmd/vmid 2>/dev/null)" && rm -f $(LUX_PLUGIN_DIR)/$$vmid || true
# Run all tests
test:
+16
View File
@@ -0,0 +1,16 @@
// Copyright (C) 2025-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// vmid prints the canonical EVM VM ID derived from luxfi/constants.EVMID.
// Used by build/install scripts so no shell file hardcodes the base58 string.
package main
import (
"fmt"
"github.com/luxfi/constants"
)
func main() {
fmt.Println(constants.EVMID)
}
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright (C) 2025-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build cgo && darwin && !nogpu
//go:build cgo && darwin && gpu
// Bridge that connects the EVM parallel interface to the lux/gpu package.
// Build with: CGO_ENABLED=1 go build -tags parallel,gpu
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright (C) 2025-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build cgo && darwin && !nogpu
//go:build cgo && darwin && gpu
package parallel
+1 -1
View File
@@ -24,7 +24,7 @@ require (
github.com/luxfi/filesystem v0.0.1
github.com/luxfi/geth v1.16.90
github.com/luxfi/go-bip39 v1.1.2
github.com/luxfi/gpu v0.30.0
github.com/luxfi/gpu v1.0.1
github.com/luxfi/ids v1.2.9
github.com/luxfi/log v1.4.1
github.com/luxfi/math v1.2.4
+2 -2
View File
@@ -230,8 +230,8 @@ github.com/luxfi/geth v1.16.90 h1:LLvhUggNyK2bZSN1gtH3yknVB8YPXcS9sHrqTZwWpfg=
github.com/luxfi/geth v1.16.90/go.mod h1:ynzwEXqLboNr1R1wdht/SqYnGINtaU4lYajR779JxgE=
github.com/luxfi/go-bip39 v1.1.2 h1:p+wLMPGs6MLQh7q0YIsmy2EhHL7LHiELEGTJko6t/Jg=
github.com/luxfi/go-bip39 v1.1.2/go.mod h1:96de9VkR2kY/ASAnhMtvt3TSh+PZkAFAngNj0GjRGDo=
github.com/luxfi/gpu v0.30.0 h1:k+7EDp/WHTa0176zXet1UXTl8IcZcp1ZkS8GUJ5l2iU=
github.com/luxfi/gpu v0.30.0/go.mod h1:7pFsHqra1Vrmy2aGXVEPKeKsPR+Bn+QmBXuByK3fdPA=
github.com/luxfi/gpu v1.0.1 h1:7cDJTwTZ8Wk5KmyzsiGPe1nekyTgsSG6LJ+4rgKim8E=
github.com/luxfi/gpu v1.0.1/go.mod h1:8r1ReBPsLx1zmcA3GksKD4J7azP52FSTU/LpT9TyYHE=
github.com/luxfi/ids v1.2.9 h1:+yjdhXW99drnd2Zlp1u/p8k3G23W3/1btJQ4ogHawUI=
github.com/luxfi/ids v1.2.9/go.mod h1:khJOEdOPxd22yn0jcVrnbX1ADa0GHn5Y74gvCzN5BYc=
github.com/luxfi/lattice/v7 v7.0.0 h1:d1vgan6mlb2KtwYfPc1g69uxVYaoVYZmlrIm4aCO88w=
+29 -17
View File
@@ -1,27 +1,39 @@
#!/usr/bin/env bash
#
# Build the Lux EVM plugin.
#
# ./scripts/build.sh # → build/evm
# ./scripts/build.sh /custom/path # → /custom/path
# INSTALL=1 ./scripts/build.sh # also installs to $LUX_PLUGIN_DIR/<vmid>
#
# The VM ID for the install path is derived at runtime from luxfi/constants.EVMID
# via cmd/vmid — no base58 strings are hardcoded in shell.
set -o errexit
set -o nounset
set -o pipefail
# Root directory
EVM_PATH=$(
cd "$(dirname "${BASH_SOURCE[0]}")"
cd .. && pwd
)
# Load the constants
EVM_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")"; cd .. && pwd)
source "$EVM_PATH"/scripts/constants.sh
if [[ $# -eq 1 ]]; then
BINARY_PATH=$1
elif [[ $# -eq 0 ]]; then
BINARY_PATH="$DEFAULT_PLUGIN_DIR/$DEFAULT_VM_ID"
else
echo "Invalid arguments to build evm. Requires zero (default binary path) or one argument to specify the binary path."
exit 1
BINARY_PATH="${1:-$EVM_PATH/build/evm}"
echo "Building EVM @ GitCommit: $EVM_COMMIT at $BINARY_PATH"
mkdir -p "$(dirname "$BINARY_PATH")"
go build \
-ldflags "-X github.com/luxfi/evm/plugin/evm.GitCommit=$EVM_COMMIT $STATIC_LD_FLAGS" \
-o "$BINARY_PATH" \
"$EVM_PATH"/plugin/*.go
if [[ "$(uname -s)" == "Darwin" ]]; then
codesign --force --sign - "$BINARY_PATH" >/dev/null 2>&1 || true
fi
# Build Subnet EVM, which is run as a subprocess
echo "Building Subnet EVM @ GitCommit: $EVM_COMMIT at $BINARY_PATH"
go build -ldflags "-X github.com/luxfi/evm/plugin/evm.GitCommit=$EVM_COMMIT $STATIC_LD_FLAGS" -o "$BINARY_PATH" "plugin/"*.go
if [[ "${INSTALL:-}" == "1" ]]; then
mkdir -p "$LUX_PLUGIN_DIR"
install -m 0755 "$BINARY_PATH" "$LUX_PLUGIN_DIR/$EVM_VMID"
if [[ "$(uname -s)" == "Darwin" ]]; then
codesign --force --sign - "$LUX_PLUGIN_DIR/$EVM_VMID" >/dev/null 2>&1 || true
fi
echo "Installed $LUX_PLUGIN_DIR/$EVM_VMID"
fi
+1 -1
View File
@@ -54,7 +54,7 @@ echo "Generating compose configuration"
gen_antithesis_compose_config "${IMAGE_TAG}" "${EVM_PATH}/tests/antithesis/gencomposeconfig" \
"${EVM_PATH}/build/antithesis" \
"LUXD_PATH=${LUXD_CLONE_PATH}/build/luxd \
LUXD_PLUGIN_DIR=${DEFAULT_PLUGIN_DIR}"
LUXD_PLUGIN_DIR=${LUX_PLUGIN_DIR}"
build_antithesis_images "${GO_VERSION}" "${IMAGE_PREFIX}" "antithesis-evm" "${IMAGE_TAG}" \
"${LUXD_IMAGE_TAG}" "${EVM_PATH}/tests/antithesis/Dockerfile" \
+1 -1
View File
@@ -68,7 +68,7 @@ else
DOCKER_CMD="${DOCKER_CMD} --load"
fi
VM_ID=${VM_ID:-"${DEFAULT_VM_ID}"}
VM_ID=${VM_ID:-"${EVM_VMID}"}
# Default to the release image. Will need to be overridden when testing against unreleased versions.
LUXD_NODE_IMAGE="${LUXD_NODE_IMAGE:-${LUXD_IMAGE_NAME}:${LUX_VERSION}}"
+9 -6
View File
@@ -7,12 +7,15 @@ set -euo pipefail
# Set the PATHS
GOPATH="$(go env GOPATH)"
DEFAULT_PLUGIN_DIR="${HOME}/.lux/plugins"
DEFAULT_VM_NAME="evm"
# Canonical Lux EVM VM ID = CB58(ids.ID{'e','v','m'}) per luxfi/constants.EVMID.
# Single ID for both C-Chain and EVM-based L2 chains. The legacy `srEXiWaH…`
# (legacy upstream brand) is NOT used in Lux.
DEFAULT_VM_ID="mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6"
# Default install dir for luxd plugins. Overridable.
LUX_PLUGIN_DIR="${LUX_PLUGIN_DIR:-${HOME}/.lux/plugins}"
# Canonical EVM VM ID — derived from luxfi/constants.EVMID (Go source of truth),
# not a hardcoded base58 string. Cached per shell invocation.
if [[ -z "${EVM_VMID:-}" ]]; then
EVM_VMID="$(cd "${EVM_PATH:-$(dirname "${BASH_SOURCE[0]}")/..}" && go run ./cmd/vmid)"
fi
# Lux docker hub
# luxfi/node - defaults to local as to avoid unintentional pushes
+1 -1
View File
@@ -121,4 +121,4 @@ cp "${BUILD_DIR}"/luxd "${LUXD_PATH}"
echo "Installed Luxd release ${LUX_VERSION}"
echo "Luxd Path: ${LUXD_PATH}"
echo "Plugin Dir: ${DEFAULT_PLUGIN_DIR}"
echo "Plugin Dir: ${LUX_PLUGIN_DIR}"
+1 -1
View File
@@ -18,7 +18,7 @@ source "$EVM_PATH"/scripts/constants.sh
# Set up lux binary path and assume build directory is set
LUXD_BUILD_PATH=${LUXD_BUILD_PATH:-"$GOPATH/src/github.com/luxfi/luxd/build"}
LUXD_PATH=${LUXD_PATH:-"$LUXD_BUILD_PATH/luxd"}
LUXD_PLUGIN_DIR=${LUXD_PLUGIN_DIR:-"$DEFAULT_PLUGIN_DIR"}
LUXD_PLUGIN_DIR=${LUXD_PLUGIN_DIR:-"$LUX_PLUGIN_DIR"}
DATA_DIR=${DATA_DIR:-/tmp/evm-start-node/$(date "+%Y-%m-%d%:%H:%M:%S")}
mkdir -p "$DATA_DIR"
+1 -1
View File
@@ -55,7 +55,7 @@ build_and_test() {
done
}
VM_ID="${VM_ID:-${DEFAULT_VM_ID}}"
VM_ID="${VM_ID:-${EVM_VMID}}"
echo "checking build of single-arch image"
build_and_test "evm_luxd" "${VM_ID}" false "luxd"