ethtest

package
v0.0.0-...-e305a27 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2023 The go-ethereum Authors This file is part of go-ethereum.

go-ethereum is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

go-ethereum is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addresses

type Addresses []common.Address

func (Addresses) Len

func (a Addresses) Len() int

func (Addresses) Less

func (a Addresses) Less(i, j int) bool

func (Addresses) Swap

func (a Addresses) Swap(i, j int)

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

func (s *Suite) TestBlobViolations(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) 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) TestMaliciousStatus

func (s *Suite) TestMaliciousStatus(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