evms

package
v0.0.0-...-a12cc4b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2024 License: GPL-3.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Nethermind does not support refundcounter
	ClearRefunds = true

	// Nethermind reports the change in memory on step earlier than others. E.g.
	// MSTORE shows the _new_ memory, besu/geth shows the old memory until the next op.
	// This could be handled differently, e.g. clearing only on mem-expanding ops.
	ClearMemSize = true

	// Nethermind reports the change in memory on step earlier than others. E.g.
	// MSTORE shows the _new_ memory, besu/geth shows the old memory until the next op.
	// Unfortunately, nethermind also "forgets" the memsize when an error occurs, reporting
	// memsize zero (see testdata/traces/stackUnderflow_nonzeroMem.json). So we use
	// ClearMemSize instead
	ClearMemSizeOnExpand = true

	// Nethermind is missing returnData
	ClearReturndata = true

	// Besu sometimes reports GasCost of 0x7fffffffffffffff, along with ,"error":"Out of gas"
	ClearGascost = true
)

Variables

This section is empty.

Functions

func CompareFiles

func CompareFiles(vms []Evm, readers []io.Reader) (bool, int, string)

CompareFiles returns true if the files are equal, along with the number of line s compared

func CustomMarshal

func CustomMarshal(log *opLog) []byte

CustomMarshal writes a logger.Structlog element into a concise json format. OBS! This output format will omit all stack element except the last 6 items.

func JsonMarshal

func JsonMarshal(log *logger.StructLog) []byte

func NewJsonlScanner

func NewJsonlScanner(clientName string, input io.Reader, errOut io.Writer) *jsonlScanner

NewJsonlScanner creates new jsonl scanner. Callers must call Release() after usage is done, for optimal pool usage.

func StdErrOutput

func StdErrOutput(c *exec.Cmd) ([]byte, error)

StdErrOutput runs the command and returns its standard error.

Types

type BesuBatchVM

type BesuBatchVM struct {
	BesuVM
	// contains filtered or unexported fields
}

BesuBatchVM is s Evm-interface wrapper around the `evmtool` binary, based on Besu. The BatchVM spins up one 'master' instance of the VM, and uses that to execute tests

func NewBesuBatchVM

func NewBesuBatchVM(path, name string) *BesuBatchVM

func (*BesuBatchVM) Close

func (vm *BesuBatchVM) Close()

func (*BesuBatchVM) GetStateRoot

func (evm *BesuBatchVM) GetStateRoot(path string) (root, command string, err error)

func (*BesuBatchVM) Instance

func (evm *BesuBatchVM) Instance(threadId int) Evm

func (*BesuBatchVM) RunStateTest

func (evm *BesuBatchVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

type BesuVM

type BesuVM struct {
	// contains filtered or unexported fields
}

BesuVM is s Evm-interface wrapper around the `evmtool` binary, based on Besu.

func NewBesuVM

func NewBesuVM(path, name string) *BesuVM

func (*BesuVM) Close

func (vm *BesuVM) Close()

func (*BesuVM) Copy

func (evm *BesuVM) Copy(out io.Writer, input io.Reader)

feed reads from the reader, does some geth-specific filtering and outputs items onto the channel

func (*BesuVM) GetStateRoot

func (vm *BesuVM) GetStateRoot(path string) (root, command string, err error)

func (*BesuVM) Instance

func (evm *BesuVM) Instance(int) Evm

func (*BesuVM) Name

func (evm *BesuVM) Name() string

func (*BesuVM) ParseStateRoot

func (vm *BesuVM) ParseStateRoot(data []byte) (string, error)

ParseStateRoot reads the stateroot from the combined output.

func (*BesuVM) RunStateTest

func (evm *BesuVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

func (*BesuVM) Stats

func (evm *BesuVM) Stats() []any

type EelsBatchVM

type EelsBatchVM struct {
	EelsEVM
	// contains filtered or unexported fields
}

The EelsBatchVM spins up one 'master' instance of the VM, and uses that to execute tests

func NewEelsBatchVM

func NewEelsBatchVM(path, name string) *EelsBatchVM

func (*EelsBatchVM) Close

func (vm *EelsBatchVM) Close()

func (*EelsBatchVM) GetStateRoot

func (evm *EelsBatchVM) GetStateRoot(path string) (root, command string, err error)

func (*EelsBatchVM) Instance

func (evm *EelsBatchVM) Instance(threadId int) Evm

func (*EelsBatchVM) RunStateTest

func (evm *EelsBatchVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

type EelsEVM

type EelsEVM struct {
	// contains filtered or unexported fields
}

EelsEVM is s Evm-interface wrapper around the `evm` binary, based on go-ethereum.

func NewEelsEVM

func NewEelsEVM(path string, name string) *EelsEVM

func (*EelsEVM) Close

func (vm *EelsEVM) Close()

func (*EelsEVM) Copy

func (evm *EelsEVM) Copy(out io.Writer, input io.Reader)

Copy reads from the reader, does some geth-specific filtering and outputs items onto the channel

func (*EelsEVM) GetStateRoot

func (evm *EelsEVM) GetStateRoot(path string) (root, command string, err error)

GetStateRoot runs the test and returns the stateroot This currently only works for non-filled statetests. TODO: make it work even if the test is filled. Either by getting the whole trace, or adding stateroot to exec std output even in success-case

func (*EelsEVM) Instance

func (evm *EelsEVM) Instance(int) Evm

func (*EelsEVM) Name

func (evm *EelsEVM) Name() string

func (*EelsEVM) ParseStateRoot

func (evm *EelsEVM) ParseStateRoot(data []byte) (string, error)

ParseStateRoot reads geth's stateroot from the combined output.

func (*EelsEVM) RunStateTest

func (evm *EelsEVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

func (*EelsEVM) Stats

func (evm *EelsEVM) Stats() []any

type ErigonBatchVM

type ErigonBatchVM struct {
	ErigonVM
	// contains filtered or unexported fields
}

The ErigonBatchVM spins up one 'master' instance of the VM, and uses that to execute tests

func NewErigonBatchVM

func NewErigonBatchVM(path, name string) *ErigonBatchVM

func (*ErigonBatchVM) Close

func (vm *ErigonBatchVM) Close()

func (*ErigonBatchVM) GetStateRoot

func (evm *ErigonBatchVM) GetStateRoot(path string) (root, command string, err error)

func (*ErigonBatchVM) Instance

func (evm *ErigonBatchVM) Instance(threadId int) Evm

func (*ErigonBatchVM) RunStateTest

func (evm *ErigonBatchVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

type ErigonVM

type ErigonVM struct {
	// contains filtered or unexported fields
}

ErigonVM is s Evm-interface wrapper around the eroigon `evm` binary

func NewErigonVM

func NewErigonVM(path, name string) *ErigonVM

func (*ErigonVM) Close

func (vm *ErigonVM) Close()

func (*ErigonVM) Copy

func (evm *ErigonVM) Copy(out io.Writer, input io.Reader)

Copy reads from the reader, does some geth-specific filtering and outputs items onto the channel

func (*ErigonVM) GetStateRoot

func (evm *ErigonVM) GetStateRoot(path string) (root, command string, err error)

GetStateRoot runs the test and returns the stateroot This currently only works for non-filled statetests. TODO: make it work even if the test is filled. Either by getting the whole trace, or adding stateroot to exec std output even in success-case

func (*ErigonVM) Instance

func (evm *ErigonVM) Instance(int) Evm

func (*ErigonVM) Name

func (evm *ErigonVM) Name() string

func (*ErigonVM) ParseStateRoot

func (evm *ErigonVM) ParseStateRoot(data []byte) (string, error)

ParseStateRoot reads the stateroot from the combined output.

func (*ErigonVM) RunStateTest

func (evm *ErigonVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

func (*ErigonVM) Stats

func (evm *ErigonVM) Stats() []any

type Evm

type Evm interface {
	// RunStateTest runs the statetest on the underlying EVM, and writes
	// the output to the given writer
	RunStateTest(path string, writer io.Writer, skipTrace bool) (*tracingResult, error)
	// GetStateRoot runs the test and returns the stateroot
	GetStateRoot(path string) (root, command string, err error)
	// ParseStateRoot reads the stateroot from the combined output.
	ParseStateRoot([]byte) (string, error)
	// Copy takes the 'raw' output from the VM, and writes the
	// canonical output to the given writer
	Copy(out io.Writer, input io.Reader)
	//Open() // Preparare for execution
	Close() // Tear down processes
	Name() string
	Stats() []any

	// Instance delivers an instance of the EVM which will be executed per-thread.
	// This method may deliver the same instance each time, but it may also
	// deliver e.g. a unique version which has preallocated buffers. Such an instance
	// is not concurrency-safe, but is fine to deliver in this method.
	Instance(threadId int) Evm
}

The Evm interface represents external EVM implementations, which can be e.g. docker instances or binaries

type EvmoneVM

type EvmoneVM struct {
	// contains filtered or unexported fields
}

func NewEvmoneVM

func NewEvmoneVM(path string, name string) *EvmoneVM

func (*EvmoneVM) Close

func (vm *EvmoneVM) Close()

func (*EvmoneVM) Copy

func (evm *EvmoneVM) Copy(out io.Writer, input io.Reader)

func (*EvmoneVM) GetStateRoot

func (evm *EvmoneVM) GetStateRoot(path string) (root, command string, err error)

func (*EvmoneVM) Instance

func (evm *EvmoneVM) Instance(int) Evm

func (*EvmoneVM) Name

func (evm *EvmoneVM) Name() string

func (*EvmoneVM) ParseStateRoot

func (evm *EvmoneVM) ParseStateRoot(data []byte) (root string, err error)

func (*EvmoneVM) RunStateTest

func (evm *EvmoneVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

func (*EvmoneVM) Stats

func (evm *EvmoneVM) Stats() []any

type GethBatchVM

type GethBatchVM struct {
	GethEVM
	// contains filtered or unexported fields
}

The GethBatchVM spins up one 'master' instance of the VM, and uses that to execute tests

func NewGethBatchVM

func NewGethBatchVM(path, name string) *GethBatchVM

func (*GethBatchVM) Close

func (vm *GethBatchVM) Close()

func (*GethBatchVM) GetStateRoot

func (evm *GethBatchVM) GetStateRoot(path string) (root, command string, err error)

func (*GethBatchVM) Instance

func (evm *GethBatchVM) Instance(threadId int) Evm

func (*GethBatchVM) RunStateTest

func (evm *GethBatchVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

type GethEVM

type GethEVM struct {
	// contains filtered or unexported fields
}

GethEVM is s Evm-interface wrapper around the `evm` binary, based on go-ethereum.

func NewGethEVM

func NewGethEVM(path string, name string) *GethEVM

func (*GethEVM) Close

func (vm *GethEVM) Close()

func (*GethEVM) Copy

func (evm *GethEVM) Copy(out io.Writer, input io.Reader)

Copy reads from the reader, does some geth-specific filtering and outputs items onto the channel

func (*GethEVM) GetStateRoot

func (evm *GethEVM) GetStateRoot(path string) (root, command string, err error)

GetStateRoot runs the test and returns the stateroot This currently only works for non-filled statetests. TODO: make it work even if the test is filled. Either by getting the whole trace, or adding stateroot to exec std output even in success-case

func (*GethEVM) Instance

func (evm *GethEVM) Instance(int) Evm

func (*GethEVM) Name

func (evm *GethEVM) Name() string

func (*GethEVM) ParseStateRoot

func (evm *GethEVM) ParseStateRoot(data []byte) (string, error)

ParseStateRoot reads geth's stateroot from the combined output.

func (*GethEVM) RunStateTest

func (evm *GethEVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

func (*GethEVM) Stats

func (evm *GethEVM) Stats() []any

type NethermindBatchVM

type NethermindBatchVM struct {
	NethermindVM
	// contains filtered or unexported fields
}

The NethermindBatchVM spins up one 'master' instance of the VM, and uses that to execute tests

func NewNethermindBatchVM

func NewNethermindBatchVM(path, name string) *NethermindBatchVM

func (*NethermindBatchVM) Close

func (vm *NethermindBatchVM) Close()

func (*NethermindBatchVM) GetStateRoot

func (evm *NethermindBatchVM) GetStateRoot(path string) (root, command string, err error)

func (*NethermindBatchVM) Instance

func (evm *NethermindBatchVM) Instance(threadId int) Evm

func (*NethermindBatchVM) RunStateTest

func (evm *NethermindBatchVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

type NethermindVM

type NethermindVM struct {
	// contains filtered or unexported fields
}

NethermindVM is s Evm-interface wrapper around the `nethtest` binary, based on Nethermind.

func NewNethermindVM

func NewNethermindVM(path, name string) *NethermindVM

func (*NethermindVM) Close

func (vm *NethermindVM) Close()

func (*NethermindVM) Copy

func (evm *NethermindVM) Copy(out io.Writer, input io.Reader)

feed reads from the reader, does some vm-specific filtering and outputs items onto the channel

func (*NethermindVM) GetStateRoot

func (evm *NethermindVM) GetStateRoot(path string) (root, command string, err error)

GetStateRoot runs the test and returns the stateroot

func (*NethermindVM) Instance

func (evm *NethermindVM) Instance(threadId int) Evm

func (*NethermindVM) Name

func (evm *NethermindVM) Name() string

func (*NethermindVM) ParseStateRoot

func (evm *NethermindVM) ParseStateRoot(data []byte) (string, error)

getStateRoot reads the stateroot from the combined output.

func (*NethermindVM) RunStateTest

func (evm *NethermindVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

func (*NethermindVM) Stats

func (evm *NethermindVM) Stats() []any

type NimbusEVM

type NimbusEVM struct {
	// contains filtered or unexported fields
}

NimbusEVM is s Evm-interface wrapper around the `evmstate` binary, based on nimbus-eth1.

func NewNimbusEVM

func NewNimbusEVM(path string, name string) *NimbusEVM

func (*NimbusEVM) Close

func (vm *NimbusEVM) Close()

func (*NimbusEVM) Copy

func (evm *NimbusEVM) Copy(out io.Writer, input io.Reader)

func (*NimbusEVM) GetStateRoot

func (evm *NimbusEVM) GetStateRoot(path string) (root, command string, err error)

GetStateRoot runs the test and returns the stateroot This currently only works for non-filled statetests. TODO: make it work even if the test is filled. Either by getting the whole trace, or adding stateroot to exec std output even in success-case

func (*NimbusEVM) Instance

func (evm *NimbusEVM) Instance(int) Evm

func (*NimbusEVM) Name

func (evm *NimbusEVM) Name() string

func (*NimbusEVM) ParseStateRoot

func (evm *NimbusEVM) ParseStateRoot(data []byte) (string, error)

ParseStateRoot reads geth's stateroot from the combined output.

func (*NimbusEVM) RunStateTest

func (evm *NimbusEVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

RunStateTest implements the Evm interface

func (*NimbusEVM) Stats

func (evm *NimbusEVM) Stats() []any

type RethVM

type RethVM struct {
	// contains filtered or unexported fields
}

func NewRethVM

func NewRethVM(path string, name string) *RethVM

func (*RethVM) Close

func (vm *RethVM) Close()

func (*RethVM) Copy

func (evm *RethVM) Copy(out io.Writer, input io.Reader)

func (*RethVM) GetStateRoot

func (evm *RethVM) GetStateRoot(path string) (root, command string, err error)

func (*RethVM) Instance

func (evm *RethVM) Instance(int) Evm

func (*RethVM) Name

func (evm *RethVM) Name() string

func (*RethVM) ParseStateRoot

func (evm *RethVM) ParseStateRoot(data []byte) (root string, err error)

func (*RethVM) RunStateTest

func (evm *RethVM) RunStateTest(path string, out io.Writer, speedTest bool) (*tracingResult, error)

func (*RethVM) Stats

func (evm *RethVM) Stats() []any

type VmStat

type VmStat struct {
	// contains filtered or unexported fields
}

func (*VmStat) Stats

func (stat *VmStat) Stats() []any

func (*VmStat) TraceDone

func (stat *VmStat) TraceDone(start time.Time) (time.Duration, bool)

TraceDone marks the tracing speed metric, and returns 'true' if the test is 'slow'.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL