testcase

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBlockReward

func AddBlockReward(currState *WorldState, addr [20]byte, b *uint256.Int)

func CompareWorldState

func CompareWorldState(stateA, stateB *WorldState) (bool, error)

func PrintBlock

func PrintBlock(fout io.Writer, block *TestBlock)

func PrintTestCases

func PrintTestCases(fout io.Writer, cases []TestCase)

func PrintWorldState

func PrintWorldState(fout io.Writer, state *WorldState)

func RunOneCase

func RunOneCase(args []string, printLog bool, runTestCase RunTestCaseFn)

func RunOneDir

func RunOneDir(args []string, printLog bool, runTestCase RunTestCaseFn)

func RunOneFile

func RunOneFile(args []string, runTestCase RunTestCaseFn)

func StorageKeyLess

func StorageKeyLess(k1, k2 StorageKey) bool

func UpdateWorldState

func UpdateWorldState(world *WorldState, key, value []byte)

Types

type BasicAccount

type BasicAccount struct {
	Balance  uint256.Int
	Nonce    uint64
	Sequence uint64
}

type BytecodeInfo

type BytecodeInfo struct {
	Bytecode []byte
	Codehash [32]byte
}

type DumbSigner

type DumbSigner struct {
}

func (*DumbSigner) ChainID

func (signer *DumbSigner) ChainID() *big.Int

func (*DumbSigner) Equal

func (signer *DumbSigner) Equal(s coretypes.Signer) bool

Equal returns true if the given signer is the same as the receiver.

func (*DumbSigner) Hash

func (signer *DumbSigner) Hash(tx *coretypes.Transaction) common.Hash

Hash returns the hash to be signed.

func (*DumbSigner) Sender

func (signer *DumbSigner) Sender(tx *coretypes.Transaction) (addr common.Address, err error)

Sender returns the sender address of the transaction.

func (*DumbSigner) SignatureValues

func (signer *DumbSigner) SignatureValues(tx *coretypes.Transaction, sig []byte) (r, s, v *big.Int, err error)

SignatureValues returns the raw R, S, V values corresponding to the given signature.

type EvmLog

type EvmLog struct {
	Address [20]byte
	Data    []byte
	Topics  [][32]byte
}

type RunTestCaseFn

type RunTestCaseFn func(filename string, theCase *TestCase, printLog bool)

type StorageKey

type StorageKey struct {
	AccountSeq uint64
	Key        [32]byte
}

type TestBlock

type TestBlock struct {
	types.BlockInfo
	TxList []*Tx
}

func NewTestBlock

func NewTestBlock() *TestBlock

type TestCase

type TestCase struct {
	Name      string
	ImplState WorldState
	RefState  WorldState
	Blocks    []*TestBlock
}

func NewTestCase

func NewTestCase(s string) TestCase

func ReadTestCases

func ReadTestCases(filename string) (result []TestCase)

func ReadTestCasesFromString

func ReadTestCasesFromString(str string) (result []TestCase)

type Tx

type Tx struct {
	From     [20]byte
	To       [20]byte
	Nonce    uint64
	Value    uint256.Int
	GasPrice uint256.Int
	Gas      uint64
	Data     []byte
}

func (Tx) ToEthTx

func (tx Tx) ToEthTx() *coretypes.Transaction

type WorldState

type WorldState struct {
	CreationCounters [256]uint64
	BlockHashes      [512][32]byte
	Bytecodes        map[[20]byte]BytecodeInfo
	Accounts         map[[20]byte]*BasicAccount
	Values           map[StorageKey][]byte
}

func GetWorldStateFromMads

func GetWorldStateFromMads(mads *ads.ADS) *WorldState

func NewWorldState

func NewWorldState() WorldState

func (WorldState) Clone

func (world WorldState) Clone() (out WorldState)

func (WorldState) SumAllBalance

func (world WorldState) SumAllBalance() *uint256.Int

Jump to

Keyboard shortcuts

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