Files
chains/evm/cevm/metal_resource_test.go
zeekayandHanzo Dev acd68484d7 The cevm binding reads ABI 7, and declines a library of another
ABIVersion is 7, the go_bridge.h ABI in which ok says whether the result is
the block's. The binding does not compile against a header that names
another, and init reads the loaded library's gpu_abi_version() instead of
panicking on it: against a library of another ABI, ExecuteBlock calls
nothing and declines every block, and a result of another ABI is declined
too, so the caller runs them on its own EVM.

The native tests hold the library to that contract. A block of funded plain
transfers runs on a GPU lane to TxOK at 21000 gas each, or is declined there
when the host has no device, and a CPU lane declines it; a batch with code
or calldata is declined on every lane. The opcode, bytecode and gas-parity
tests ran code through the entry, which runs none, and are gone; the
block-context and sustained-Metal tests run transfers. A test that needs a
device skips on a GPU lane that declines. The tests that pin the build with
no library linked moved to cevm_nolib_test.go, outside the native build,
where they failed.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-23 11:27:54 -07:00

25 lines
802 B
Go

//go:build cgo && lux_cevm_native
package cevm
import "testing"
// TestMetalSustainedExecution guards against a device path that builds its
// pipelines and queues on every call: a process doing sustained work piles
// them up until the driver faults, which no single execution shows. Running
// the same block of transfers many times reproduces that in seconds, and
// every run must still be the block's answer.
func TestMetalSustainedExecution(t *testing.T) {
if !contains(deviceLanes(t), GPUMetal) {
t.Skip("Metal runs no block on this host")
}
txs, ctx, state := transfers(1)
const runs = 250
for i := range runs {
r, err := ExecuteBlock(GPUMetal, 1, txs, &ctx, state)
if err != nil || !allTransfers(r, 1) {
t.Fatalf("run %d of %d: err=%v result=%+v", i+1, runs, err, r)
}
}
}