common

package
v0.0.0-...-cfa6b07 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GethFlag = &cli.StringSliceFlag{
		Name:  "geth",
		Usage: "Location of go-ethereum 'evm' binary",
	}
	GethBatchFlag = &cli.StringSliceFlag{
		Name:  "gethbatch",
		Usage: "Location of go-ethereum 'evm' binary",
	}
	EelsFlag = &cli.StringSliceFlag{
		Name:  "eels",
		Usage: "Location of 'ethereum-spec-evm' binary",
	}
	EelsBatchFlag = &cli.StringSliceFlag{
		Name:  "eelsbatch",
		Usage: "Location of 'ethereum-spec-evm' binary",
	}
	NethermindFlag = &cli.StringSliceFlag{
		Name:  "nethermind",
		Usage: "Location of nethermind 'nethtest' binary",
	}
	NethBatchFlag = &cli.StringSliceFlag{
		Name:  "nethbatch",
		Usage: "Location of nethermind 'nethtest' binary",
	}
	BesuFlag = &cli.StringSliceFlag{
		Name:  "besu",
		Usage: "Location of besu vm binary",
	}
	BesuBatchFlag = &cli.StringSliceFlag{
		Name:  "besubatch",
		Usage: "Location of besu vm binary",
	}
	ErigonFlag = &cli.StringSliceFlag{
		Name:  "erigon",
		Usage: "Location of erigon 'evm' binary",
	}
	ErigonBatchFlag = &cli.StringSliceFlag{
		Name:  "erigonbatch",
		Usage: "Location of erigon 'evm' binary",
	}
	NimbusFlag = &cli.StringSliceFlag{
		Name:  "nimbus",
		Usage: "Location of nimbus 'evmstate' binary",
	}
	EvmoneFlag = &cli.StringSliceFlag{
		Name:  "evmone",
		Usage: "Location of evmone 'evmone' binary",
	}
	RethFlag = &cli.StringSliceFlag{
		Name:  "revme",
		Usage: "Location of reth 'revme' binary",
	}
	ThreadFlag = &cli.IntFlag{
		Name:  "parallel",
		Usage: "Number of parallel executions to use.",
		Value: runtime.NumCPU(),
	}
	LocationFlag = &cli.StringFlag{
		Name:  "outdir",
		Usage: "Location to place artefacts",
		Value: "/tmp",
	}
	NotifyFlag = &cli.StringFlag{
		Name:  "ntfy",
		Usage: "Topic to sent 'https://ntfy.sh/'-ping on exit (e.g. due to consensus issue)",
	}
	PrefixFlag = &cli.StringFlag{
		Name:  "prefix",
		Usage: "prefix of output files",
	}
	CountFlag = &cli.IntFlag{
		Name:  "count",
		Usage: "number of tests to generate",
		Value: 100,
	}
	TraceFlag = &cli.BoolFlag{
		Name: "trace",
		Usage: "if true, a trace will be generated along with the tests. \n" +
			"This is useful for debugging the usefulness of the tests",
	}
	SkipTraceFlag = &cli.BoolFlag{
		Name: "skiptrace",
		Usage: "If 'skiptrace' is set to true, then the evms will execute _without_ tracing, and only the final stateroot will be compared after execution.\n" +
			"This mode is faster, and can be used even if the clients-under-test has known errors in the trace-output, \n" +
			"but has a very high chance of missing cases which could be exploitable.",
	}
	VerbosityFlag = &cli.IntFlag{
		Name:  "verbosity",
		Usage: "sets the verbosity level (-4: DEBUG, 0: INFO, 4: WARN, 8: ERROR)",
		Value: 0,
	}

	VmFlags = []cli.Flag{
		GethFlag,
		GethBatchFlag,
		EelsFlag,
		EelsBatchFlag,
		NethermindFlag,
		NethBatchFlag,
		BesuFlag,
		BesuBatchFlag,
		ErigonFlag,
		ErigonBatchFlag,
		NimbusFlag,
		EvmoneFlag,
		RethFlag,
	}
)

Functions

func ConvertToStateTest

func ConvertToStateTest(name, fork string, alloc types.GenesisAlloc, gasLimit uint64, target common.Address) error

ConvertToStateTest is a utility to turn stuff into sharable state tests.

func Copy

func Copy(src, dst string) error

Copy the src file to dst. Any existing file will be overwritten and will not copy file attributes.

func ExecuteFuzzer

func ExecuteFuzzer(c *cli.Context, allClients bool, providerFn TestProviderFn, cleanupFiles bool) error

func GenerateAndExecute

func GenerateAndExecute(c *cli.Context, generatorFn GeneratorFn, name string) error

func NewEmptyStateDB

func NewEmptyStateDB() *state.StateDB

StateDBWithAlloc creates an empty statedb, or panics on error

func NewMemStateDB

func NewMemStateDB() state.Database

func RootsEqual

func RootsEqual(path string, c *cli.Context) (bool, error)

RootsEqual executes the test on the given path on all vms, and returns true if they all report the same post stateroot.

func RunSingleTest

func RunSingleTest(path string, c *cli.Context) (bool, error)

RunTests runs a test on all clients. Return values are : - true, nil: no consensus issue - true, err: test execution failed - false, err: a consensus issue found - false, nil: a consensus issue found

func StateDBWithAlloc

func StateDBWithAlloc(alloc types.GenesisAlloc) *state.StateDB

StateDBWithAlloc creates a statedb and populates with the given alloc.

func TestSpeed

func TestSpeed(dir string, c *cli.Context) error

Types

type BasicTracer

type BasicTracer struct{}

func (*BasicTracer) CaptureFault

func (n *BasicTracer) CaptureFault(pc uint64, op byte, gas, cost uint64, scope tracing.OpContext, depth int, err error)

func (*BasicTracer) GetResult

func (n *BasicTracer) GetResult() (json.RawMessage, error)

func (*BasicTracer) Hooks

func (n *BasicTracer) Hooks() *tracing.Hooks

func (*BasicTracer) Stop

func (n *BasicTracer) Stop(err error)

type GeneratorFn

type GeneratorFn func() *fuzzing.GstMaker

type PrintingTracer

type PrintingTracer struct {
	BasicTracer
}

func (*PrintingTracer) CaptureStart

func (n *PrintingTracer) CaptureStart(vm *tracing.VMContext, tx *types.Transaction, from common.Address)

func (*PrintingTracer) CaptureState

func (n *PrintingTracer) CaptureState(pc uint64, op byte, gas uint64, cost uint64, scope tracing.OpContext, input []byte, depth int, err error)

func (*PrintingTracer) Hooks

func (n *PrintingTracer) Hooks() *tracing.Hooks

type TestProviderFn

type TestProviderFn func(index, threadId int) (string, error)

Jump to

Keyboard shortcuts

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