tests

package
v0.9.34 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2015 License: LGPL-2.1-or-later Imports: 26 Imported by: 267

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BlockSkipTests = []string{"SimpleTx3"}
	TransSkipTests = []string{"TransactionWithHihghNonce256"}
	StateSkipTests = []string{"mload32bitBound_return", "mload32bitBound_return2"}
	VmSkipTests    = []string{}
)

Functions

func LoadBlockTests

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

func RunBlockTest added in v0.9.32

func RunBlockTest(file string, skipTests []string) error

func RunBlockTestWithReader added in v0.9.32

func RunBlockTestWithReader(r io.Reader, skipTests []string) error

func RunState added in v0.9.32

func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, state.Logs, *big.Int, error)

func RunStateTest added in v0.9.32

func RunStateTest(p string, skipTests []string) error

func RunStateTestWithReader added in v0.9.32

func RunStateTestWithReader(r io.Reader, skipTests []string) error

func RunTransactionTests

func RunTransactionTests(file string, skipTests []string) error

func RunTransactionTestsWithReader added in v0.9.32

func RunTransactionTestsWithReader(r io.Reader, skipTests []string) error

func RunVm added in v0.9.32

func RunVm(state *state.StateDB, env, exec map[string]string) ([]byte, state.Logs, *big.Int, error)

func RunVmTest added in v0.9.32

func RunVmTest(p string, skipTests []string) error

func RunVmTestWithReader added in v0.9.32

func RunVmTestWithReader(r io.Reader, skipTests []string) error

func StateObjectFromAccount added in v0.9.32

func StateObjectFromAccount(db common.Database, addr string, account Account) *state.StateObject

Types

type Account added in v0.9.32

type Account struct {
	Balance string
	Code    string
	Nonce   string
	Storage map[string]string
}

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 Env added in v0.9.32

type Env struct {
	Gas *big.Int
	// contains filtered or unexported fields
}

func NewEnv added in v0.9.32

func NewEnv(state *state.StateDB) *Env

func NewEnvFromMap added in v0.9.32

func NewEnvFromMap(state *state.StateDB, envValues map[string]string, exeValues map[string]string) *Env

func (*Env) AddLog added in v0.9.32

func (self *Env) AddLog(log *state.Log)

func (*Env) AddStructLog added in v0.9.32

func (self *Env) AddStructLog(log vm.StructLog)

func (*Env) BlockNumber added in v0.9.32

func (self *Env) BlockNumber() *big.Int

func (*Env) Call added in v0.9.32

func (self *Env) Call(caller vm.ContextRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error)

func (*Env) CallCode added in v0.9.32

func (self *Env) CallCode(caller vm.ContextRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error)

func (*Env) Coinbase added in v0.9.32

func (self *Env) Coinbase() common.Address

func (self *Env) PrevHash() []byte { return self.parent }

func (*Env) Create added in v0.9.32

func (self *Env) Create(caller vm.ContextRef, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ContextRef)

func (*Env) Depth added in v0.9.32

func (self *Env) Depth() int

func (*Env) Difficulty added in v0.9.32

func (self *Env) Difficulty() *big.Int

func (*Env) GasLimit added in v0.9.32

func (self *Env) GasLimit() *big.Int

func (*Env) GetHash added in v0.9.32

func (self *Env) GetHash(n uint64) common.Hash

func (*Env) Origin added in v0.9.32

func (self *Env) Origin() common.Address

func (*Env) SetDepth added in v0.9.32

func (self *Env) SetDepth(i int)

func (*Env) State added in v0.9.32

func (self *Env) State() *state.StateDB

func (*Env) StructLogs added in v0.9.32

func (self *Env) StructLogs() []vm.StructLog

func (*Env) Time added in v0.9.32

func (self *Env) Time() int64

func (*Env) Transfer added in v0.9.32

func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error

func (*Env) VmType added in v0.9.32

func (self *Env) VmType() vm.Type

type Log added in v0.9.32

type Log struct {
	AddressF string   `json:"address"`
	DataF    string   `json:"data"`
	TopicsF  []string `json:"topics"`
	BloomF   string   `json:"bloom"`
}

func (Log) Address added in v0.9.32

func (self Log) Address() []byte

func (Log) Data added in v0.9.32

func (self Log) Data() []byte

func (Log) RlpData added in v0.9.32

func (self Log) RlpData() interface{}

func (Log) Topics added in v0.9.32

func (self Log) Topics() [][]byte

type Message added in v0.9.32

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

func NewMessage added in v0.9.32

func NewMessage(from common.Address, to *common.Address, data []byte, value, gas, price *big.Int, nonce uint64) Message

func (Message) Data added in v0.9.32

func (self Message) Data() []byte

func (Message) From added in v0.9.32

func (self Message) From() (common.Address, error)

func (Message) Gas added in v0.9.32

func (self Message) Gas() *big.Int

func (Message) GasPrice added in v0.9.32

func (self Message) GasPrice() *big.Int

func (Message) Hash added in v0.9.32

func (self Message) Hash() []byte

func (Message) Nonce added in v0.9.32

func (self Message) Nonce() uint64

func (Message) To added in v0.9.32

func (self Message) To() *common.Address

func (Message) Value added in v0.9.32

func (self Message) Value() *big.Int

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

type VmEnv added in v0.9.32

type VmEnv struct {
	CurrentCoinbase   string
	CurrentDifficulty string
	CurrentGasLimit   string
	CurrentNumber     string
	CurrentTimestamp  interface{}
	PreviousHash      string
}

type VmTest added in v0.9.32

type VmTest struct {
	Callcreates interface{}
	//Env         map[string]string
	Env           VmEnv
	Exec          map[string]string
	Transaction   map[string]string
	Logs          []Log
	Gas           string
	Out           string
	Post          map[string]Account
	Pre           map[string]Account
	PostStateRoot string
}

Jump to

Keyboard shortcuts

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