Files
chains/evm/cevmreport.go
zeekayandHanzo Dev c1e4934ab7 The plugin says what it linked; it does not choose an EVM
luxfi/evm dropped in-process backend switching (2f9a3158): choosing an EVM
is choosing which plugin binary the host runs, and the switch it replaced
never ran a block — its executor returned nil, nil and its tagged build did
not compile. The callers stayed here, so this package no longer built
against evm at all: parallel.SetBackend, AutoEVM, GoEVM, ActiveBackend and
AvailableBackends are gone.

What is left is worth saying out loud, so one file reports it: the C++
library's ABI, the backends it offers, and the health battery each answered.
The cevm package carries its own build tags, so the cgo/nocgo split in the
caller went with them.

Two tests went too. They asserted that selection left a runnable lane
active and that it was idempotent, and there is no selection to be
idempotent about; that a build reports what it cannot execute is still
covered. The package went from listing no tests at all — it did not compile
— to running ten.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-17 20:56:19 -07:00

40 lines
1.3 KiB
Go

// What this binary can execute with: the C++ library's ABI, the backends it
// offers, and what each answered to the health battery.
//
// There is nothing to select. Choosing an EVM is choosing which plugin binary
// the host runs, not a switch inside the Go EVM, so this only says what came
// up. The cevm package carries its own build tags, so one file serves every
// build: without the native library linked it reports the one backend it has.
package main
import (
"github.com/luxfi/chains/evm/cevm"
"github.com/luxfi/log"
)
func reportCevm(logger log.Logger) {
logger.Info("cevm linked",
"abi", cevm.LibraryABIVersion(),
"backends", cevm.AvailableBackends(),
)
for _, h := range cevm.Health() {
report(logger, h)
}
}
// report says what one cevm backend answered to the health battery.
//
// It is separate from the report above because it is the only part that
// depends on what the health check found: a build with no library linked has
// exactly one report and it is never healthy, so a check folded into the loop
// could only ever be read one way.
func report(logger log.Logger, h cevm.HealthReport) {
if h.OK {
logger.Info("cevm backend healthy",
"backend", h.Name, "probes", h.ProbesRun, "gas", h.GasUsed)
return
}
logger.Warn("cevm backend not healthy",
"backend", h.Name, "probe", h.Probe, "err", h.Err)
}