tests

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package tests implements execution of VNT JSON tests.

Index

Constants

This section is empty.

Variables

View Source
var Forks = map[string]*params.ChainConfig{
	"Frontier": {
		ChainID: big.NewInt(1),
	},
	"Hubble": {
		ChainID:     big.NewInt(1),
		HubbleBlock: big.NewInt(0),
	},
	"EIP158": {
		ChainID:     big.NewInt(1),
		HubbleBlock: big.NewInt(0),
	},
	"Byzantium": {
		ChainID:     big.NewInt(1),
		HubbleBlock: big.NewInt(0),
	},
	"FrontierToHomesteadAt5": {
		ChainID:     big.NewInt(1),
		HubbleBlock: big.NewInt(5),
	},
	"HomesteadToEIP150At5": {
		ChainID:     big.NewInt(1),
		HubbleBlock: big.NewInt(0),
	},
	"EIP158ToByzantiumAt5": {
		ChainID:     big.NewInt(1),
		HubbleBlock: big.NewInt(0),
	},
}

Forks table defines supported forks and their chain config.

Functions

func MakePreState

func MakePreState(db vntdb.Database, accounts core.GenesisAlloc) *state.StateDB

Types

type BlockTest

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

A BlockTest checks handling of entire blocks.

func (*BlockTest) Run

func (t *BlockTest) Run() error

func (*BlockTest) UnmarshalJSON

func (t *BlockTest) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler interface.

type DifficultyTest

type DifficultyTest struct {
	ParentTimestamp    *big.Int `json:"parentTimestamp"`
	ParentDifficulty   *big.Int `json:"parentDifficulty"`
	CurrentTimestamp   *big.Int `json:"currentTimestamp"`
	CurrentBlockNumber uint64   `json:"currentBlockNumber"`
	CurrentDifficulty  *big.Int `json:"currentDifficulty"`
}

func (DifficultyTest) MarshalJSON

func (d DifficultyTest) MarshalJSON() ([]byte, error)

func (*DifficultyTest) Run

func (test *DifficultyTest) Run(config *params.ChainConfig) error

func (*DifficultyTest) UnmarshalJSON

func (d *DifficultyTest) UnmarshalJSON(input []byte) error

type RLPTest

type RLPTest struct {
	// If the value of In is "INVALID" or "VALID", the test
	// checks whether Out can be decoded into a value of
	// type interface{}.
	//
	// For other JSON values, In is treated as a driver for
	// calls to rlp.Stream. The test also verifies that encoding
	// In produces the bytes in Out.
	In interface{}

	// Out is a hex-encoded RLP value.
	Out string
}

RLPTest is the JSON structure of a single RLP test.

func (*RLPTest) Run

func (t *RLPTest) Run() error

Run executes the test.

type StateSubtest

type StateSubtest struct {
	Fork  string
	Index int
}

StateSubtest selects a specific configuration of a General State Test.

type StateTest

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

StateTest checks transaction processing without block context.

func (*StateTest) Run

func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateDB, error)

Run executes a specific subtest.

func (*StateTest) Subtests

func (t *StateTest) Subtests() []StateSubtest

Subtests returns all valid subtests of the test.

func (*StateTest) UnmarshalJSON

func (t *StateTest) UnmarshalJSON(in []byte) error

type TransactionTest

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

TransactionTest checks RLP decoding and sender derivation of transactions.

func (*TransactionTest) Run

func (tt *TransactionTest) Run(config *params.ChainConfig) error

type UnsupportedForkError

type UnsupportedForkError struct {
	Name string
}

UnsupportedForkError is returned when a test requests a fork that isn't implemented.

func (UnsupportedForkError) Error

func (e UnsupportedForkError) Error() string

type WAVMTest

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

WAVMTest checks VM execution without block or transaction context.

func (*WAVMTest) Run

func (t *WAVMTest) Run(vmconfig vm.Config) error

func (*WAVMTest) UnmarshalJSON

func (t *WAVMTest) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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