Files
zeekay 36995dd6da refactor(fx): TestVM.Clk pointer + nil-safe Logger guard
- secp256k1fx.TestVM.Clk: change from value to pointer so test cases
  can share a single clock without copy. Clock() returns vm.Clk
  directly (nil if unset; tests that exercise time set it).
- secp256k1fx.Fx.Initialize: guard against nil Logger before IsZero()
  check. Previously panicked when VM had no logger; now noops cleanly.
- nftfx, propertyfx, secp256k1fx tests + benches: construct TestVM
  with explicit &mockable.Clock{}.
2026-06-04 17:06:07 -07:00

33 lines
656 B
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package secp256k1fx
import (
log "github.com/luxfi/log"
"github.com/luxfi/timer/mockable"
)
// VM that this Fx must be run by. ZAP-native: no runtime codec
// registration — wire schemas are compile-time static.
type VM interface {
Clock() *mockable.Clock
Logger() log.Logger
}
var _ VM = (*TestVM)(nil)
// TestVM is a minimal implementation of a VM
type TestVM struct {
Clk *mockable.Clock
Log log.Logger
}
func (vm *TestVM) Clock() *mockable.Clock {
return vm.Clk
}
func (vm *TestVM) Logger() log.Logger {
return vm.Log
}