tests

package
v0.9.22 Latest Latest
Warning

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

Go to latest
Published: May 17, 2015 License: LGPL-2.1-or-later Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadBlockTests

func LoadBlockTests(file string) (map[string]*BlockTest, error)

LoadBlockTests loads a block test JSON file.

func LoadJSON

func LoadJSON(file string, val interface{}) error

LoadJSON reads the given file and unmarshals its content.

func RunTransactionTests

func RunTransactionTests(file string, notWorking map[string]bool) error

Types

type BlockTest

type BlockTest struct {
	Genesis *types.Block

	Json *btJSON
	// contains filtered or unexported fields
}

Block Test JSON Format

func (*BlockTest) InsertPreState

func (t *BlockTest) InsertPreState(ethereum *eth.Ethereum) (*state.StateDB, error)

InsertPreState populates the given database with the genesis accounts defined by the test.

func (*BlockTest) TryBlocksInsert

func (t *BlockTest) TryBlocksInsert(chainManager *core.ChainManager) error

See https://github.com/ethereum/tests/wiki/Blockchain-Tests-II

Whether a block is valid or not is a bit subtle, it's defined by presence of
blockHeader, transactions and uncleHeaders fields. If they are missing, the block is
invalid and we must verify that we do not accept it.

Since some tests mix valid and invalid blocks we need to check this for every block.

If a block is invalid it does not necessarily fail the test, if it's invalidness is
expected we are expected to ignore it and continue processing and then validate the
post state.

func (*BlockTest) ValidatePostState

func (t *BlockTest) ValidatePostState(statedb *state.StateDB) error

type TransactionTest

type TransactionTest struct {
	Rlp         string
	Sender      string
	Transaction TtTransaction
}

type TtTransaction

type TtTransaction struct {
	Data     string
	GasLimit string
	GasPrice string
	Nonce    string
	R        string
	S        string
	To       string
	V        string
	Value    string
}

Transaction Test JSON Format

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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