plugin: refresh vm + main + runner

This commit is contained in:
2026-05-20 16:24:51 -07:00
parent a471a92113
commit c9dda742a6
3 changed files with 3 additions and 39 deletions
+3 -8
View File
@@ -160,15 +160,10 @@ var (
errShuttingDownVM = errors.New("shutting down VM")
)
// Package-level debug logging function
// Package-level debug logging — routes through the canonical luxfi/log
// logger at Debug level. No more /tmp/evm-debug.log sidecar.
func debugLog(msg string, args ...interface{}) {
f, err := os.OpenFile("/tmp/evm-debug.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return
}
defer f.Close()
fmt.Fprintf(f, "[EVM-DEBUG] "+msg+"\n", args...)
f.Sync()
log.Debug(fmt.Sprintf(msg, args...))
}
// legacyApiNames maps pre geth v1.10.20 api names to their updated counterparts.
-15
View File
@@ -5,27 +5,12 @@ package main
import (
"fmt"
"os"
"github.com/luxfi/evm/plugin/evm"
"github.com/luxfi/evm/plugin/runner"
"github.com/luxfi/version"
)
func init() {
// Debug: log that init() is called - this runs before main()
if f, err := os.OpenFile("/tmp/evm_init.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644); err == nil {
fmt.Fprintf(f, "[%d] init() started\n", os.Getpid())
f.Close()
}
}
func main() {
// Debug: log that main() is called
if f, err := os.OpenFile("/tmp/evm_main.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644); err == nil {
fmt.Fprintf(f, "[%d] main() started\n", os.Getpid())
f.Close()
}
versionString := fmt.Sprintf("Lux-EVM/%s [node=%s, rpcchainvm=%d]", evm.Version, version.Current, version.RPCChainVMProtocol)
runner.Run(versionString)
}
-16
View File
@@ -16,37 +16,21 @@ import (
)
func Run(versionStr string) {
// Debug logging to file
debugLog := func(msg string) {
if f, err := os.OpenFile("/tmp/evm_runner.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644); err == nil {
fmt.Fprintf(f, "[%d] %s\n", os.Getpid(), msg)
f.Close()
}
}
debugLog("Run() called with version: " + versionStr)
printVersion, err := PrintVersion()
if err != nil {
debugLog("PrintVersion error: " + err.Error())
fmt.Printf("couldn't get config: %s", err)
os.Exit(1)
}
debugLog(fmt.Sprintf("printVersion=%v", printVersion))
if printVersion && versionStr != "" {
fmt.Println(versionStr)
os.Exit(0)
}
debugLog("Setting ulimit")
if err := ulimit.Set(ulimit.DefaultFDLimit, log.Root()); err != nil {
debugLog("ulimit error: " + err.Error())
fmt.Printf("failed to set fd limit correctly due to: %s", err)
os.Exit(1)
}
debugLog("Calling rpc.Serve")
if err := rpc.Serve(context.Background(), log.Root(), &evm.VM{}); err != nil {
debugLog("rpc.Serve error: " + err.Error())
fmt.Printf("rpc.Serve error: %s\n", err)
os.Exit(1)
}
debugLog("rpc.Serve returned")
}