#!/bin/bash # Switch the C-Chain EVM implementation. # Usage: ./switch-evm.sh [evm|evmgpu|revm|cpp] set -e CCHAIN_VMID="mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6" PLUGIN_DIR="${HOME}/.lux/plugins/current" case "${1:-}" in evm|go|default) TARGET="${HOME}/work/lux/evm/build/evm" LABEL="Go EVM (geth/coreth, sequential)" ;; evmgpu|gpu|parallel) TARGET="${HOME}/work/lux/evmgpu/build/evmgpu" LABEL="Go EVM-GPU (Block-STM parallel)" ;; revm|rust|reth) TARGET="${HOME}/work/hanzo/evm/target/release/revm" LABEL="Rust EVM (reth/revm)" ;; cpp|evmone|c++) echo "C++ EVM requires EVMC→ZAP adapter (not yet available as standalone plugin)" echo "Use the C++ benchmark directly: cd ~/work/luxcpp/evm/build && ./bin/evm-bench-block" exit 1 ;; status|"") CURRENT=$(readlink "${PLUGIN_DIR}/${CCHAIN_VMID}" 2>/dev/null || echo "binary (not symlinked)") echo "Current C-Chain EVM: ${CURRENT}" echo "" echo "Available:" echo " evm Go EVM (geth/coreth, sequential)" echo " evmgpu Go EVM-GPU (Block-STM parallel)" echo " revm Rust EVM (reth/revm)" echo " cpp C++ EVM (evmone, benchmark only)" echo "" echo "Usage: $0 " exit 0 ;; *) echo "Unknown EVM: $1" echo "Options: evm, evmgpu, revm, cpp" exit 1 ;; esac if [ ! -f "${TARGET}" ]; then echo "Binary not found: ${TARGET}" echo "Build it first." exit 1 fi # Back up current binary if it's not a symlink if [ -f "${PLUGIN_DIR}/${CCHAIN_VMID}" ] && [ ! -L "${PLUGIN_DIR}/${CCHAIN_VMID}" ]; then mv "${PLUGIN_DIR}/${CCHAIN_VMID}" "${PLUGIN_DIR}/${CCHAIN_VMID}.bak" echo "Backed up original binary" fi ln -sf "${TARGET}" "${PLUGIN_DIR}/${CCHAIN_VMID}" echo "C-Chain EVM switched to: ${LABEL}" echo " ${TARGET}" echo "" echo "Restart luxd for changes to take effect."