ethtest

package
v1.10.21 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 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 added in v1.10.16

type AccountRange snap.AccountRangePacket

func (AccountRange) Code added in v1.10.16

func (g AccountRange) Code() int

type BlockBodies

type BlockBodies eth.BlockBodiesPacket

BlockBodies is the network packet for block content distribution.

func (BlockBodies) Code

func (bb BlockBodies) Code() int

type BlockHeaders

type BlockHeaders eth.BlockHeadersPacket

func (BlockHeaders) Code

func (bh BlockHeaders) Code() int

type ByteCodes added in v1.10.16

type ByteCodes snap.ByteCodesPacket

func (ByteCodes) Code added in v1.10.16

func (g ByteCodes) Code() int

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 added in v1.9.23

func (c *Chain) GetHeaders(req GetBlockHeaders) (BlockHeaders, 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 added in v1.10.16

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 added in v1.10.4

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 eth packet from the connection.

func (*Conn) Read66 added in v1.10.4

func (c *Conn) Read66() (uint64, Message)

Read66 reads an eth66 packet from the connection.

func (*Conn) ReadSnap added in v1.10.16

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.

func (*Conn) Write66 added in v1.10.4

func (c *Conn) Write66(req eth.Packet, code int) error

Write66 writes an eth66 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 (d Disconnect) Code() int

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) String added in v1.9.24

func (e *Error) String() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type GetAccountRange added in v1.10.16

type GetAccountRange snap.GetAccountRangePacket

GetAccountRange represents an account range query.

func (GetAccountRange) Code added in v1.10.16

func (g GetAccountRange) Code() int

type GetBlockBodies

type GetBlockBodies eth.GetBlockBodiesPacket

GetBlockBodies represents a GetBlockBodies request

func (GetBlockBodies) Code

func (gbb GetBlockBodies) Code() int

type GetBlockHeaders

type GetBlockHeaders eth.GetBlockHeadersPacket

GetBlockHeaders represents a block header query.

func (GetBlockHeaders) Code

func (g GetBlockHeaders) Code() int

type GetByteCodes added in v1.10.16

type GetByteCodes snap.GetByteCodesPacket

func (GetByteCodes) Code added in v1.10.16

func (g GetByteCodes) Code() int

type GetPooledTransactions added in v1.10.3

type GetPooledTransactions eth.GetPooledTransactionsPacket

func (GetPooledTransactions) Code added in v1.10.3

func (gpt GetPooledTransactions) Code() int

type GetStorageRanges added in v1.10.16

type GetStorageRanges snap.GetStorageRangesPacket

func (GetStorageRanges) Code added in v1.10.16

func (g GetStorageRanges) Code() int

type GetTrieNodes added in v1.10.16

type GetTrieNodes snap.GetTrieNodesPacket

func (GetTrieNodes) Code added in v1.10.16

func (g GetTrieNodes) Code() int

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 (h Hello) Code() int

type Message

type Message interface {
	Code() int
}

type NewBlock

type NewBlock eth.NewBlockPacket

NewBlock is the network packet for the block propagation message.

func (NewBlock) Code

func (nb NewBlock) Code() int

type NewBlockHashes

type NewBlockHashes eth.NewBlockHashesPacket

NewBlockHashes is the network packet for the block announcements.

func (NewBlockHashes) Code

func (nbh NewBlockHashes) Code() int

type NewPooledTransactionHashes added in v1.9.25

type NewPooledTransactionHashes eth.NewPooledTransactionHashesPacket

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

func (NewPooledTransactionHashes) Code added in v1.9.25

func (nb NewPooledTransactionHashes) Code() int

type Ping added in v1.9.23

type Ping struct{}

func (Ping) Code added in v1.9.23

func (p Ping) Code() int

type Pong added in v1.9.23

type Pong struct{}

func (Pong) Code added in v1.9.23

func (p Pong) Code() int

type PooledTransactions added in v1.10.3

type PooledTransactions eth.PooledTransactionsPacket

func (PooledTransactions) Code added in v1.10.3

func (pt PooledTransactions) Code() int

type Status

type Status eth.StatusPacket

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

func (Status) Code

func (s Status) Code() int

type StorageRanges added in v1.10.16

type StorageRanges snap.StorageRangesPacket

func (StorageRanges) Code added in v1.10.16

func (g StorageRanges) Code() int

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) AllEthTests added in v1.10.2

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

func (*Suite) Eth66Tests added in v1.10.2

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

func (*Suite) EthTests added in v1.10.0

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

func (*Suite) Is_66 added in v1.10.2

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

Is_66 checks if the node supports the eth66 protocol version, and if not, exists the test suite

func (*Suite) SnapTests added in v1.10.16

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

func (*Suite) TestBlockHashAnnounce65 added in v1.10.13

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

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

func (*Suite) TestBlockHashAnnounce66 added in v1.10.4

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

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

func (*Suite) TestBroadcast65 added in v1.10.13

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

TestBroadcast65 tests whether a block announcement is correctly propagated to the given node's peer(s).

func (*Suite) TestBroadcast66 added in v1.10.4

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

TestBroadcast66 tests whether a block announcement is correctly propagated to the given node's peer(s) on the eth66 protocol.

func (*Suite) TestGetBlockBodies65 added in v1.10.13

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

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

func (*Suite) TestGetBlockBodies66 added in v1.10.4

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

TestGetBlockBodies66 tests whether the given node can respond to a `GetBlockBodies` request and that the response is accurate over the eth66 protocol.

func (*Suite) TestGetBlockHeaders65 added in v1.10.13

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

TestGetBlockHeaders65 tests whether the given node can respond to a `GetBlockHeaders` request accurately.

func (*Suite) TestGetBlockHeaders66 added in v1.10.4

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

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

func (*Suite) TestLargeAnnounce65 added in v1.10.13

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

TestLargeAnnounce65 tests the announcement mechanism with a large block.

func (*Suite) TestLargeAnnounce66 added in v1.10.4

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

TestLargeAnnounce66 tests the announcement mechanism with a large block over the eth66 protocol.

func (*Suite) TestLargeTxRequest66 added in v1.10.4

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

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

func (*Suite) TestMaliciousHandshake65 added in v1.10.13

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

TestMaliciousHandshake65 tries to send malicious data during the handshake.

func (*Suite) TestMaliciousHandshake66 added in v1.10.4

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

TestMaliciousHandshake66 tries to send malicious data during the handshake.

func (*Suite) TestMaliciousStatus65 added in v1.10.13

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

TestMaliciousStatus65 sends a status package with a large total difficulty.

func (*Suite) TestMaliciousStatus66 added in v1.10.4

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

TestMaliciousStatus66 sends a status package with a large total difficulty over the eth66 protocol.

func (*Suite) TestMaliciousTx65 added in v1.10.13

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

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

func (*Suite) TestMaliciousTx66 added in v1.10.4

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

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

func (*Suite) TestNewPooledTxs66 added in v1.10.4

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

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

func (*Suite) TestOldAnnounce65 added in v1.10.13

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

TestOldAnnounce65 tests the announcement mechanism with an old block.

func (*Suite) TestOldAnnounce66 added in v1.10.4

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

TestOldAnnounce66 tests the announcement mechanism with an old block, over the eth66 protocol.

func (*Suite) TestSameRequestID66 added in v1.10.4

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

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

func (*Suite) TestSimultaneousRequests66 added in v1.10.4

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

TestSimultaneousRequests66 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 added in v1.10.16

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

TestSnapGetAccountRange various forms of GetAccountRange requests.

func (*Suite) TestSnapGetByteCodes added in v1.10.16

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

TestSnapGetByteCodes various forms of GetByteCodes requests.

func (*Suite) TestSnapGetStorageRanges added in v1.10.16

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

TestSnapGetStorageRange various forms of GetStorageRanges requests.

func (*Suite) TestSnapStatus added in v1.10.16

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

func (*Suite) TestSnapTrieNodes added in v1.10.16

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

TestSnapTrieNodes various forms of GetTrieNodes requests.

func (*Suite) TestStatus65 added in v1.10.13

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

TestStatus65 attempts to connect to the given node and exchange a status message with it.

func (*Suite) TestStatus66 added in v1.10.4

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

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

func (*Suite) TestTransaction65 added in v1.10.13

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

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

func (*Suite) TestTransaction66 added in v1.10.4

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

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

func (*Suite) TestZeroRequestID66 added in v1.10.4

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

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

type Transactions added in v1.9.25

type Transactions eth.TransactionsPacket

func (Transactions) Code added in v1.9.25

func (t Transactions) Code() int

type TrieNodes added in v1.10.16

type TrieNodes snap.TrieNodesPacket

func (TrieNodes) Code added in v1.10.16

func (g TrieNodes) Code() int

Jump to

Keyboard shortcuts

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