ethtest

package
v0.0.0-...-c273f30 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountRange

type AccountRange snap.AccountRangePacket

func (AccountRange) Code

func (msg AccountRange) Code() int

func (AccountRange) ReqID

func (msg AccountRange) ReqID() uint64

type BlockBodies

type BlockBodies eth.BlockBodiesPacket66

BlockBodies is the network packet for block content distribution.

func (BlockBodies) Code

func (msg BlockBodies) Code() int

func (BlockBodies) ReqID

func (msg BlockBodies) ReqID() uint64

type BlockHeaders

type BlockHeaders eth.BlockHeadersPacket66

func (BlockHeaders) Code

func (msg BlockHeaders) Code() int

func (BlockHeaders) ReqID

func (msg BlockHeaders) ReqID() uint64

type ByteCodes

type ByteCodes snap.ByteCodesPacket

func (ByteCodes) Code

func (msg ByteCodes) Code() int

func (ByteCodes) ReqID

func (msg ByteCodes) ReqID() uint64

type Chain

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

func (*Chain) ForkID

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

ForkID gets the fork id of the chain.

func (*Chain) GetHeaders

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

func (*Chain) Head

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

Head returns the chain head.

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

func (*Chain) Shorten

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

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

func (*Chain) TD

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

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

func (*Chain) TotalDifficultyAt

func (c *Chain) TotalDifficultyAt(height int) *big.Int

TotalDifficultyAt calculates the total difficulty of the chain at the given block height.

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() Message

Read reads an eth66 packet from the connection.

func (*Conn) ReadSnap

func (c *Conn) ReadSnap(id uint64) (Message, error)

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

func (*Conn) Write

func (c *Conn) Write(msg Message) error

Write writes a eth packet to the connection.

type Disconnect

type Disconnect struct {
	Reason p2p.DiscReason
}

Disconnect is the RLP structure for a disconnect message.

func (Disconnect) Code

func (msg Disconnect) Code() int

func (Disconnect) ReqID

func (msg Disconnect) ReqID() uint64

type Error

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

func (*Error) Code

func (e *Error) Code() int

func (*Error) Error

func (e *Error) Error() string

func (*Error) ReqID

func (e *Error) ReqID() uint64

func (*Error) String

func (e *Error) String() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type GetAccountRange

type GetAccountRange snap.GetAccountRangePacket

GetAccountRange represents an account range query.

func (GetAccountRange) Code

func (msg GetAccountRange) Code() int

func (GetAccountRange) ReqID

func (msg GetAccountRange) ReqID() uint64

type GetBlockBodies

type GetBlockBodies eth.GetBlockBodiesPacket66

GetBlockBodies represents a GetBlockBodies request

func (GetBlockBodies) Code

func (msg GetBlockBodies) Code() int

func (GetBlockBodies) ReqID

func (msg GetBlockBodies) ReqID() uint64

type GetBlockHeaders

type GetBlockHeaders eth.GetBlockHeadersPacket66

GetBlockHeaders represents a block header query.

func (GetBlockHeaders) Code

func (msg GetBlockHeaders) Code() int

func (GetBlockHeaders) ReqID

func (msg GetBlockHeaders) ReqID() uint64

type GetByteCodes

type GetByteCodes snap.GetByteCodesPacket

func (GetByteCodes) Code

func (msg GetByteCodes) Code() int

func (GetByteCodes) ReqID

func (msg GetByteCodes) ReqID() uint64

type GetPooledTransactions

type GetPooledTransactions eth.GetPooledTransactionsPacket66

func (GetPooledTransactions) Code

func (msg GetPooledTransactions) Code() int

func (GetPooledTransactions) ReqID

func (msg GetPooledTransactions) ReqID() uint64

type GetStorageRanges

type GetStorageRanges snap.GetStorageRangesPacket

func (GetStorageRanges) Code

func (msg GetStorageRanges) Code() int

func (GetStorageRanges) ReqID

func (msg GetStorageRanges) ReqID() uint64

type GetTrieNodes

type GetTrieNodes snap.GetTrieNodesPacket

func (GetTrieNodes) Code

func (msg GetTrieNodes) Code() int

func (GetTrieNodes) ReqID

func (msg GetTrieNodes) ReqID() uint64

type Hello

type Hello struct {
	Version    uint64
	Name       string
	Caps       []p2p.Cap
	ListenPort uint64
	ID         []byte // secp256k1 public key

	// Ignore additional fields (for forward compatibility).
	Rest []rlp.RawValue `rlp:"tail"`
}

Hello is the RLP structure of the protocol handshake.

func (Hello) Code

func (msg Hello) Code() int

func (Hello) ReqID

func (msg Hello) ReqID() uint64

type Message

type Message interface {
	Code() int
	ReqID() uint64
}

type NewBlock

type NewBlock eth.NewBlockPacket

NewBlock is the network packet for the block propagation message.

func (NewBlock) Code

func (msg NewBlock) Code() int

func (NewBlock) ReqID

func (msg NewBlock) ReqID() uint64

type NewBlockHashes

type NewBlockHashes eth.NewBlockHashesPacket

NewBlockHashes is the network packet for the block announcements.

func (NewBlockHashes) Code

func (msg NewBlockHashes) Code() int

func (NewBlockHashes) ReqID

func (msg NewBlockHashes) ReqID() uint64

type NewPooledTransactionHashes

type NewPooledTransactionHashes eth.NewPooledTransactionHashesPacket

NewPooledTransactionHashes is the network packet for the tx hash propagation message.

func (NewPooledTransactionHashes) Code

func (msg NewPooledTransactionHashes) Code() int

func (NewPooledTransactionHashes) ReqID

func (msg NewPooledTransactionHashes) ReqID() uint64

type Ping

type Ping struct{}

func (Ping) Code

func (msg Ping) Code() int

func (Ping) ReqID

func (msg Ping) ReqID() uint64

type Pong

type Pong struct{}

func (Pong) Code

func (msg Pong) Code() int

func (Pong) ReqID

func (msg Pong) ReqID() uint64

type PooledTransactions

type PooledTransactions eth.PooledTransactionsPacket66

func (PooledTransactions) Code

func (msg PooledTransactions) Code() int

func (PooledTransactions) ReqID

func (msg PooledTransactions) ReqID() uint64

type Status

type Status eth.StatusPacket

Status is the network packet for the status message for eth/64 and later.

func (Status) Code

func (msg Status) Code() int

func (Status) ReqID

func (msg Status) ReqID() uint64

type StorageRanges

type StorageRanges snap.StorageRangesPacket

func (StorageRanges) Code

func (msg StorageRanges) Code() int

func (StorageRanges) ReqID

func (msg StorageRanges) ReqID() uint64

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, chainfile string, genesisfile 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) TestBlockHashAnnounce

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

TestBlockHashAnnounce sends a new block hash announcement and expects the node to perform a `GetBlockHeaders` request.

func (*Suite) TestBroadcast

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

TestBroadcast tests whether a block announcement is correctly propagated to the node's peers.

func (*Suite) TestGetBlockBodies

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

TestGetBlockBodies tests whether the given node can respond to a `GetBlockBodies` request and that the response is accurate.

func (*Suite) TestGetBlockHeaders

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

TestGetBlockHeaders tests whether the given node can respond to an eth `GetBlockHeaders` request and that the response is accurate.

func (*Suite) TestLargeAnnounce

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

TestLargeAnnounce tests the announcement mechanism with a large block.

func (*Suite) TestLargeTxRequest

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

TestLargeTxRequest tests whether a node can fulfill a large GetPooledTransactions request.

func (*Suite) TestMaliciousHandshake

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

TestMaliciousHandshake tries to send malicious data during the handshake.

func (*Suite) TestMaliciousStatus

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

TestMaliciousStatus sends a status package with a large total difficulty.

func (*Suite) TestMaliciousTx

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

TestMaliciousTx sends several invalid transactions and tests whether the node will propagate them.

func (*Suite) TestNewPooledTxs

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

TestNewPooledTxs tests whether a node will do a GetPooledTransactions request upon receiving a NewPooledTransactionHashes announcement.

func (*Suite) TestOldAnnounce

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

TestOldAnnounce tests the announcement mechanism with an old block.

func (*Suite) TestSameRequestID

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

TestSameRequestID sends two requests with the same request ID to a single node.

func (*Suite) TestSimultaneousRequests

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

TestSimultaneousRequests sends two simultaneous `GetBlockHeader` requests from the same connection with different request IDs and checks to make sure the node responds with the correct headers per request.

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)

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

TestStatus attempts to connect to the given node and exchange a status message with it on the eth protocol.

func (*Suite) TestTransaction

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

TestTransaction sends a valid transaction to the node and checks if the transaction gets propagated.

func (*Suite) TestZeroRequestID

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

TestZeroRequestID checks that a message with a request ID of zero is still handled by the node.

type Transactions

type Transactions eth.TransactionsPacket

func (Transactions) Code

func (msg Transactions) Code() int

func (Transactions) ReqID

func (msg Transactions) ReqID() uint64

type TrieNodes

type TrieNodes snap.TrieNodesPacket

func (TrieNodes) Code

func (msg TrieNodes) Code() int

func (TrieNodes) ReqID

func (msg TrieNodes) ReqID() uint64

Jump to

Keyboard shortcuts

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