fuzzing

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTransaction

func AddTransaction(dest *common.Address, gst *GstMaker)

func GasRandomizer

func GasRandomizer() valFunc

func MemRandomizer

func MemRandomizer() memFunc

func NewFP2toG2

func NewFP2toG2() []byte

func NewFPtoG1

func NewFPtoG1() []byte

func NewFieldElement

func NewFieldElement() []byte

func NewG1Add

func NewG1Add() []byte

func NewG1Exp

func NewG1Exp() []byte

func NewG1Mul

func NewG1Mul() []byte

func NewG1Point

func NewG1Point() []byte

func NewG2Add

func NewG2Add() []byte

func NewG2Exp

func NewG2Exp() []byte

func NewG2Mul

func NewG2Mul() []byte

func NewG2Point

func NewG2Point() []byte

func NewPairing

func NewPairing() []byte

NewPairing creates a new valid pairing. We create the following pairing: e(aMul1 * G1, bMul1 * G2) * e(aMul2 * G1, bMul2 * G2) * ... * e(aMuln * G1, bMuln * G2) == e(G1, G2) ^ s with s = sum(x: 1 -> n: (aMulx * bMulx))

func RandCall

func RandCall(gas, addr, val valFunc, memIn, memOut memFunc) []byte

func RandCall2200

func RandCall2200(addresses []common.Address) []byte

func RandCallBLS

func RandCallBLS() []byte

func RandCallBlake

func RandCallBlake() []byte

func RandCallECRecover

func RandCallECRecover() []byte

func RandCallSubroutine

func RandCallSubroutine(addresses []common.Address) []byte

func RandStorage

func RandStorage(maxSlots, maxVal int) map[common.Hash]common.Hash

RandStorage sets some slots

func RandStorageOps

func RandStorageOps() *program.Program

func ValueRandomizer

func ValueRandomizer() valFunc

Types

type GeneralStateTest

type GeneralStateTest map[string]*stJSON

func FromGeneralStateTest

func FromGeneralStateTest(name string) (*GeneralStateTest, error)

func GenerateBlakeTest

func GenerateBlakeTest(name string) *GeneralStateTest

GenerateBlakeTest generates a random test of the blake F precompile

func GenerateStateTest

func GenerateStateTest(name string) *GeneralStateTest

GenerateStateTest generates a random state tests

type GenesisAccount

type GenesisAccount struct {
	Code []byte `json:"code"`
	// N.B: parity demands storage even if it's empty
	Storage    map[common.Hash]common.Hash `json:"storage"`
	Balance    *big.Int                    `json:"balance" gencodec:"required"`
	Nonce      uint64                      `json:"nonce"`
	PrivateKey []byte                      `json:"secretKey,omitempty"` // for tests
}

GenesisAccount is an account in the state of the genesis block. Copied from go-ethereum, with the mod of making Storage mandatory

func (GenesisAccount) MarshalJSON

func (g GenesisAccount) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*GenesisAccount) UnmarshalJSON

func (g *GenesisAccount) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type GenesisAlloc

type GenesisAlloc map[common.Address]GenesisAccount

GenesisAlloc specifies the initial state that is part of the genesis block.

func (*GenesisAlloc) UnmarshalJSON

func (ga *GenesisAlloc) UnmarshalJSON(data []byte) error

type GstMaker

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

GstMaker is a construct to generate General State Tests

func BasicStateTest

func BasicStateTest(fork string) *GstMaker

func Generate2200BerlinTest

func Generate2200BerlinTest() *GstMaker

func Generate2200Test

func Generate2200Test() *GstMaker

func GenerateBLS

func GenerateBLS() (*GstMaker, []byte)

func GenerateBlake

func GenerateBlake() *GstMaker

func GenerateECRecover

func GenerateECRecover() (*GstMaker, []byte)

func GenerateSubroutineTest

func GenerateSubroutineTest() *GstMaker

func NewGstMaker

func NewGstMaker() *GstMaker

func (*GstMaker) AddAccount

func (g *GstMaker) AddAccount(address common.Address, a GenesisAccount)

func (*GstMaker) EnableFork

func (g *GstMaker) EnableFork(fork string)

func (*GstMaker) Fill

func (g *GstMaker) Fill(traceOutput io.Writer) error

FillTest uses go-ethereum internally to determine the state root and logs, and optionally outputs the trace to the given writer (if non-nil)

func (*GstMaker) GetDestination

func (g *GstMaker) GetDestination() common.Address

GetDestination returns the to- address from the tx

func (*GstMaker) SetCode

func (g *GstMaker) SetCode(address common.Address, code []byte)

SetCode sets the code at the given address (creating the account if it did not previously exist)

func (*GstMaker) SetPre

func (g *GstMaker) SetPre(genesis *GenesisAlloc)

func (*GstMaker) SetResult

func (g *GstMaker) SetResult(root, logs common.Hash)

func (*GstMaker) SetTx

func (g *GstMaker) SetTx(tx *StTransaction)

func (*GstMaker) ToGeneralStateTest

func (g *GstMaker) ToGeneralStateTest(name string) *GeneralStateTest

func (*GstMaker) ToStateTest

func (g *GstMaker) ToStateTest() (tests.StateTest, error)

func (*GstMaker) ToSubTest

func (g *GstMaker) ToSubTest() *stJSON

type StTransaction

type StTransaction struct {
	GasPrice   *big.Int `json:"gasPrice"`
	Nonce      uint64   `json:"nonce"`
	To         string   `json:"to"`
	Data       []string `json:"data"`
	GasLimit   []uint64 `json:"gasLimit"`
	Value      []string `json:"value"`
	PrivateKey []byte   `json:"secretKey"`
}

func (StTransaction) MarshalJSON

func (s StTransaction) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*StTransaction) UnmarshalJSON

func (s *StTransaction) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type StateSubtest

type StateSubtest struct {
	Fork  string
	Index int
}

StateSubtest selects a specific configuration of a General State Test.

type StateTest

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) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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