tests

package
v0.0.0-...-39cdb81 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

包测试实现了以太坊JSON测试的执行。

Index

Constants

This section is empty.

Variables

View Source
var Forks = map[string]*params.ChainConfig{
	"Frontier": {
		ChainID: big.NewInt(1),
	},
	"Homestead": {
		ChainID:        big.NewInt(1),
		HomesteadBlock: big.NewInt(0),
	},
	"EIP150": {
		ChainID:        big.NewInt(1),
		HomesteadBlock: big.NewInt(0),
		EIP150Block:    big.NewInt(0),
	},
	"EIP158": {
		ChainID:        big.NewInt(1),
		HomesteadBlock: big.NewInt(0),
		EIP150Block:    big.NewInt(0),
		EIP155Block:    big.NewInt(0),
		EIP158Block:    big.NewInt(0),
	},
	"Byzantium": {
		ChainID:        big.NewInt(1),
		HomesteadBlock: big.NewInt(0),
		EIP150Block:    big.NewInt(0),
		EIP155Block:    big.NewInt(0),
		EIP158Block:    big.NewInt(0),
		DAOForkBlock:   big.NewInt(0),
		ByzantiumBlock: big.NewInt(0),
	},
	"Constantinople": {
		ChainID:             big.NewInt(1),
		HomesteadBlock:      big.NewInt(0),
		EIP150Block:         big.NewInt(0),
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		DAOForkBlock:        big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
	},
	"FrontierToHomesteadAt5": {
		ChainID:        big.NewInt(1),
		HomesteadBlock: big.NewInt(5),
	},
	"HomesteadToEIP150At5": {
		ChainID:        big.NewInt(1),
		HomesteadBlock: big.NewInt(0),
		EIP150Block:    big.NewInt(5),
	},
	"HomesteadToDaoAt5": {
		ChainID:        big.NewInt(1),
		HomesteadBlock: big.NewInt(0),
		DAOForkBlock:   big.NewInt(5),
		DAOForkSupport: true,
	},
	"EIP158ToByzantiumAt5": {
		ChainID:        big.NewInt(1),
		HomesteadBlock: big.NewInt(0),
		EIP150Block:    big.NewInt(0),
		EIP155Block:    big.NewInt(0),
		EIP158Block:    big.NewInt(0),
		ByzantiumBlock: big.NewInt(5),
	},
	"ByzantiumToConstantinopleAt5": {
		ChainID:             big.NewInt(1),
		HomesteadBlock:      big.NewInt(0),
		EIP150Block:         big.NewInt(0),
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(5),
	},
}

forks表定义支持的forks及其链配置。

Functions

func MakePreState

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

Types

type BlockTest

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

块测试检查整个块的处理。

func (*BlockTest) Run

func (t *BlockTest) Run() error

func (*BlockTest) UnmarshalJSON

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

unmashaljson实现json.unmasheler接口。

type DifficultyTest

type DifficultyTest struct {
	ParentTimestamp    *big.Int    `json:"parentTimestamp"`
	ParentDifficulty   *big.Int    `json:"parentDifficulty"`
	UncleHash          common.Hash `json:"parentUncles"`
	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 {
	//如果in的值为“无效”或“有效”,则测试
	//检查是否可以将out解码为值
	//键入interface。
	//
	//对于其他JSON值,in被视为
	//调用rlp.stream。测试还验证编码
	//In产生输入输出字节。
	In interface{}

	//out是十六进制编码的rlp值。
	Out string
}

rlp test是单个rlp测试的JSON结构。

func (*RLPTest) Run

func (t *RLPTest) Run() error

运行执行测试。

type StateSubtest

type StateSubtest struct {
	Fork  string
	Index int
}

StateSubTest选择常规状态测试的特定配置。

type StateTest

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

StateTest检查没有块上下文的事务处理。 有关测试格式规范,请参阅https://github.com/ethereum/eips/issues/176。

func (*StateTest) Run

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

运行执行特定的子测试。

func (*StateTest) Subtests

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

子测试返回测试的所有有效子测试。

func (*StateTest) UnmarshalJSON

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

type TransactionTest

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

TransactionTest检查事务的rlp解码和发送方派生。

func (*TransactionTest) Run

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

type UnsupportedForkError

type UnsupportedForkError struct {
	Name string
}

当测试请求未实现的分叉时,将返回UnsupportedWorkError。

func (UnsupportedForkError) Error

func (e UnsupportedForkError) Error() string

type VMTest

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

vmtest检查没有块或事务上下文的evm执行。 有关测试格式规范,请参阅https://github.com/ethereum/tests/wiki/vm-tests。

func (*VMTest) Run

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

func (*VMTest) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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