testutils

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const KECCAK_EMPTY = "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"

Variables

View Source
var AccountPrefix = []byte{0x01}

Functions

func Faucet

func Faucet(kvStore *MockKVStore, address common.Address, amount *big.Int)

func MockBlock added in v0.0.8

func MockBlock(num int64) types.BlockEnv

func MockTx added in v0.0.8

func MockTx(caller common.Address, transactTo [20]byte, txData []byte, nonce uint64) types.TransactionEnv

Types

type AccountInfo

type AccountInfo struct {
	Balance  *big.Int
	Nonce    uint64
	CodeHash [32]byte
}

72 Byte

func AccountInfoFromBytes

func AccountInfoFromBytes(data []byte) (AccountInfo, error)

func ExtractAccountInfo

func ExtractAccountInfo(kvStore *MockKVStore, caller common.Address) AccountInfo

func (AccountInfo) ToBytes

func (accountInfo AccountInfo) ToBytes() []byte

type Bytecode

type Bytecode []byte

type KVStore

type KVStore interface {
	Get(key []byte) []byte
	Set(key, value []byte)
	Delete(key []byte)
	Iterator(start, end []byte) dbm.Iterator
	ReverseIterator(start, end []byte) dbm.Iterator
}

KVStore defines the interface for key-value store operations.

type MockKVStore

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

func NewMockKVStore

func NewMockKVStore() *MockKVStore

func (*MockKVStore) CreateEOA

func (k *MockKVStore) CreateEOA(accountKey []byte) ([]byte, error)

func (MockKVStore) Delete

func (l MockKVStore) Delete(key []byte)

Delete wraps the underlying DB's Delete method panicing on error.

func (MockKVStore) Get

func (l MockKVStore) Get(key []byte) []byte

Get wraps the underlying DB's Get method panicing on error.

func (MockKVStore) Iterator

func (l MockKVStore) Iterator(start, end []byte) dbm.Iterator

Iterator wraps the underlying DB's Iterator method panicing on error.

func (MockKVStore) ReverseIterator

func (l MockKVStore) ReverseIterator(start, end []byte) dbm.Iterator

ReverseIterator wraps the underlying DB's ReverseIterator method panicing on error.

func (MockKVStore) Set

func (l MockKVStore) Set(key, value []byte)

Set wraps the underlying DB's Set method panicing on error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳