Help us shape the future of Go! Take the 2026 Go Developer Survey

ethtest

package
v1.20.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: GPL-3.0, LGPL-3.0, BSD-3-Clause Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

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

Chain is a lightweight blockchain-like store which can read a hivechain created chain.

func NewChain

func NewChain(dir string) (*Chain, error)

NewChain takes the given chain.rlp file, and decodes and returns the blocks from the file.

func (*Chain) AccountsInHashOrder

func (c *Chain) AccountsInHashOrder() []state.DumpAccount

AccountsInHashOrder returns all accounts of the head state, ordered by hash of address.

func (*Chain) Balance

func (c *Chain) Balance(addr common.Address) *big.Int

Balance returns the balance of an account at the head of the chain.

func (*Chain) CodeHashes

func (c *Chain) CodeHashes() []common.Hash

CodeHashes returns all bytecode hashes contained in the head state.

func (*Chain) ForkID

func (c *Chain) ForkID() forkid.ID

ForkID gets the fork id of the chain.

func (*Chain) GetBlock

func (c *Chain) GetBlock(number int) *types.Block

GetBlock returns the block at the specified number.

func (*Chain) GetHeaders

func (c *Chain) GetHeaders(req *eth.GetBlockHeadersPacket) ([]*types.Header, error)

GetHeaders returns the headers base on an ethGetPacketHeadersPacket.

func (*Chain) GetSender

func (c *Chain) GetSender(idx int) (common.Address, uint64)

GetSender returns the address associated with account at the index in the pre-funded accounts list.

func (*Chain) Head

func (c *Chain) Head() *types.Block

Head returns the chain head.

func (*Chain) IncNonce

func (c *Chain) IncNonce(addr common.Address, amt uint64)

IncNonce increases the specified signing account's pending nonce.

func (*Chain) Len

func (c *Chain) Len() int

Len returns the length of the chain.

func (*Chain) RootAt

func (c *Chain) RootAt(height int) common.Hash

RootAt returns the state root for the block at the given height.

func (*Chain) Shorten

func (c *Chain) Shorten(height int) *Chain

Shorten returns a copy chain of a desired height from the imported

func (*Chain) SignTx

func (c *Chain) SignTx(from common.Address, tx *types.Transaction) (*types.Transaction, error)

SignTx signs a transaction for the specified from account, so long as that account was in the hivechain accounts dump.

func (*Chain) TD

func (c *Chain) TD() *big.Int

TD calculates the total difficulty of the chain at the chain head.

type Conn

type Conn struct {
	*rlpx.Conn
	// contains filtered or unexported fields
}

Conn represents an individual connection with a peer

func (*Conn) Read

func (c *Conn) Read() (uint64, []byte, error)

Read reads a packet from the connection.

func (*Conn) ReadEth

func (c *Conn) ReadEth() (any, error)

ReadEth reads an Eth sub-protocol wire message.

func (*Conn) ReadMsg

func (c *Conn) ReadMsg(proto Proto, code uint64, msg any) error

ReadMsg attempts to read a devp2p message with a specific code.

func (*Conn) ReadSnap

func (c *Conn) ReadSnap() (any, error)

ReadSnap reads a snap/1 response with the given id from the connection.

func (*Conn) Write

func (c *Conn) Write(proto Proto, code uint64, msg any) error

Write writes a eth packet to the connection.

type EngineClient

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

EngineClient is a wrapper around engine-related data.

func NewEngineClient

func NewEngineClient(dir, url, jwt string) (*EngineClient, error)

NewEngineClient creates a new engine client.

type Hello

type Hello = protoHandshake

type Proto

type Proto int

Proto is an enum representing devp2p protocol types.

type Suite

type Suite struct {
	Dest *enode.Node
	// contains filtered or unexported fields
}

Suite represents a structure used to test a node's conformance to the eth protocol.

func NewSuite

func NewSuite(dest *enode.Node, chainDir, engineURL, jwt string) (*Suite, error)

NewSuite creates and returns a new eth-test suite that can be used to test the given node against the given blockchain data.

func (*Suite) EthTests

func (s *Suite) EthTests() []utesting.Test

func (*Suite) SnapTests

func (s *Suite) SnapTests() []utesting.Test

func (*Suite) TestBlobTxWithMismatchedSidecar

func (s *Suite) TestBlobTxWithMismatchedSidecar(t *utesting.T)

func (*Suite) TestBlobTxWithoutSidecar

func (s *Suite) TestBlobTxWithoutSidecar(t *utesting.T)

func (*Suite) TestBlobViolations

func (s *Suite) TestBlobViolations(t *utesting.T)

func (*Suite) TestBlockRangeUpdateFuture

func (s *Suite) TestBlockRangeUpdateFuture(t *utesting.T)

func (*Suite) TestBlockRangeUpdateHistoryExp

func (s *Suite) TestBlockRangeUpdateHistoryExp(t *utesting.T)

func (*Suite) TestBlockRangeUpdateInvalid

func (s *Suite) TestBlockRangeUpdateInvalid(t *utesting.T)

func (*Suite) TestGetBlockBodies

func (s *Suite) TestGetBlockBodies(t *utesting.T)

func (*Suite) TestGetBlockHeaders

func (s *Suite) TestGetBlockHeaders(t *utesting.T)

func (*Suite) TestGetNonexistentBlockHeaders

func (s *Suite) TestGetNonexistentBlockHeaders(t *utesting.T)

func (*Suite) TestGetReceipts

func (s *Suite) TestGetReceipts(t *utesting.T)

func (*Suite) TestInvalidTxs

func (s *Suite) TestInvalidTxs(t *utesting.T)

func (*Suite) TestLargeTxRequest

func (s *Suite) TestLargeTxRequest(t *utesting.T)

func (*Suite) TestMaliciousHandshake

func (s *Suite) TestMaliciousHandshake(t *utesting.T)

func (*Suite) TestNewPooledTxs

func (s *Suite) TestNewPooledTxs(t *utesting.T)

func (*Suite) TestSameRequestID

func (s *Suite) TestSameRequestID(t *utesting.T)

func (*Suite) TestSimultaneousRequests

func (s *Suite) TestSimultaneousRequests(t *utesting.T)

func (*Suite) TestSnapGetAccountRange

func (s *Suite) TestSnapGetAccountRange(t *utesting.T)

TestSnapGetAccountRange various forms of GetAccountRange requests.

func (*Suite) TestSnapGetByteCodes

func (s *Suite) TestSnapGetByteCodes(t *utesting.T)

TestSnapGetByteCodes various forms of GetByteCodes requests.

func (*Suite) TestSnapGetStorageRanges

func (s *Suite) TestSnapGetStorageRanges(t *utesting.T)

TestSnapGetStorageRanges various forms of GetStorageRanges requests.

func (*Suite) TestSnapStatus

func (s *Suite) TestSnapStatus(t *utesting.T)

func (*Suite) TestSnapTrieNodes

func (s *Suite) TestSnapTrieNodes(t *utesting.T)

TestSnapTrieNodes various forms of GetTrieNodes requests.

func (*Suite) TestStatus

func (s *Suite) TestStatus(t *utesting.T)

func (*Suite) TestTransaction

func (s *Suite) TestTransaction(t *utesting.T)

func (*Suite) TestZeroRequestID

func (s *Suite) TestZeroRequestID(t *utesting.T)

Jump to

Keyboard shortcuts

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