go-ethereum: github.com/axiomzen/go-ethereum/tests Index | Files

package tests

import "github.com/axiomzen/go-ethereum/tests"

Package tests implements execution of Ethereum JSON tests.

Index

Package Files

block_test_util.go difficulty_test_util.go gen_btheader.go gen_difficultytest.go gen_stenv.go gen_sttransaction.go gen_vmexec.go init.go rlp_test_util.go state_test_util.go transaction_test_util.go vm_test_util.go

Variables

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),
        PetersburgBlock:     big.NewInt(10000000),
    },
    "ConstantinopleFix": {
        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),
        PetersburgBlock:     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 table defines supported forks and their chain config.

func FromHex Uses

func FromHex(s string) ([]byte, error)

FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x". This is copy-pasted from bytes.go, which does not return the error

func MakePreState Uses

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

type BlockTest Uses

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

A BlockTest checks handling of entire blocks.

func (*BlockTest) Run Uses

func (t *BlockTest) Run() error

func (*BlockTest) UnmarshalJSON Uses

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

UnmarshalJSON implements json.Unmarshaler interface.

type DifficultyTest Uses

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

func (DifficultyTest) MarshalJSON Uses

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

MarshalJSON marshals as JSON.

func (*DifficultyTest) Run Uses

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

func (*DifficultyTest) UnmarshalJSON Uses

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

UnmarshalJSON unmarshals from JSON.

type RLPTest Uses

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 Uses

func (t *RLPTest) Run() error

Run executes the test.

type StateSubtest Uses

type StateSubtest struct {
    Fork  string
    Index int
}

StateSubtest selects a specific configuration of a General State Test.

type StateTest Uses

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

StateTest checks transaction processing without block context. See https://github.com/ethereum/EIPs/issues/176 for the test format specification.

func (*StateTest) Run Uses

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

Run executes a specific subtest.

func (*StateTest) Subtests Uses

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

Subtests returns all valid subtests of the test.

func (*StateTest) UnmarshalJSON Uses

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

type TransactionTest Uses

type TransactionTest struct {
    RLP            hexutil.Bytes `json:"rlp"`
    Byzantium      ttFork
    Constantinople ttFork
    EIP150         ttFork
    EIP158         ttFork
    Frontier       ttFork
    Homestead      ttFork
}

TransactionTest checks RLP decoding and sender derivation of transactions.

func (*TransactionTest) Run Uses

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

type UnsupportedForkError Uses

type UnsupportedForkError struct {
    Name string
}

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

func (UnsupportedForkError) Error Uses

func (e UnsupportedForkError) Error() string

type VMTest Uses

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

VMTest checks EVM execution without block or transaction context. See https://github.com/ethereum/tests/wiki/VM-Tests for the test format specification.

func (*VMTest) Run Uses

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

func (*VMTest) UnmarshalJSON Uses

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

Package tests imports 22 packages (graph). Updated 2019-07-06. Refresh now. Tools for package owners.