github.com/ava-labs/avalanchego@v1.11.11/vms/secp256k1fx/vm.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package secp256k1fx
     5  
     6  import (
     7  	"github.com/ava-labs/avalanchego/codec"
     8  	"github.com/ava-labs/avalanchego/utils/logging"
     9  	"github.com/ava-labs/avalanchego/utils/timer/mockable"
    10  )
    11  
    12  // VM that this Fx must be run by
    13  type VM interface {
    14  	CodecRegistry() codec.Registry
    15  	Clock() *mockable.Clock
    16  	Logger() logging.Logger
    17  }
    18  
    19  var _ VM = (*TestVM)(nil)
    20  
    21  // TestVM is a minimal implementation of a VM
    22  type TestVM struct {
    23  	Clk   mockable.Clock
    24  	Codec codec.Registry
    25  	Log   logging.Logger
    26  }
    27  
    28  func (vm *TestVM) Clock() *mockable.Clock {
    29  	return &vm.Clk
    30  }
    31  
    32  func (vm *TestVM) CodecRegistry() codec.Registry {
    33  	return vm.Codec
    34  }
    35  
    36  func (vm *TestVM) Logger() logging.Logger {
    37  	return vm.Log
    38  }