ethtest

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 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) (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) 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(height int) *big.Int

TD calculates the total difficulty of the chain.

func (*Chain) WriteTo

func (c *Chain) WriteTo(writer io.Writer) error

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

func (*Conn) ReadAndServe

func (c *Conn) ReadAndServe(chain *Chain, timeout time.Duration) Message

ReadAndServe serves GetBlockHeaders requests while waiting on another message from the node.

func (*Conn) Write

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

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

func (e *Error) String() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

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 GetPooledTransactions

type GetPooledTransactions eth.GetPooledTransactionsPacket

func (GetPooledTransactions) Code

func (gpt GetPooledTransactions) 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

type NewPooledTransactionHashes eth.NewPooledTransactionHashesPacket

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

func (NewPooledTransactionHashes) Code

func (nb NewPooledTransactionHashes) Code() int

type Ping

type Ping struct{}

func (Ping) Code

func (p Ping) Code() int

type Pong

type Pong struct{}

func (Pong) Code

func (p Pong) Code() int

type PooledTransactions

type PooledTransactions eth.PooledTransactionsPacket

func (PooledTransactions) Code

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 Suite

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

Suite represents a structure used to test the eth protocol of a node(s).

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

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

func (*Suite) Eth66Tests

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

func (*Suite) EthTests

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

func (*Suite) Is_66

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

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

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

func (*Suite) TestBroadcast_66

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

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

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

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

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

func (*Suite) TestGetBlockHeaders

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

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

func (*Suite) TestGetBlockHeaders_66

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

TestGetBlockHeaders_66 tests whether the given node can respond to an eth66 `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) TestLargeAnnounce_66

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

TestLargeAnnounce_66 tests the announcement mechanism with a large block.

func (*Suite) TestLargeTxRequest_66

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

TestLargeTxRequest_66 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) TestMaliciousHandshake_66

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

TestMaliciousHandshake_66 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) TestMaliciousStatus_66

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

TestMaliciousStatus_66 sends a status package with a large total difficulty.

func (*Suite) TestMaliciousTx

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

func (*Suite) TestMaliciousTx_66

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

func (*Suite) TestNewPooledTxs_66

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

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

func (*Suite) TestOldAnnounce

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

func (*Suite) TestOldAnnounce_66

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

func (*Suite) TestSameRequestID_66

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

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

func (*Suite) TestSimultaneousRequests_66

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

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

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, and then check to make sure the chain head is correct.

func (*Suite) TestStatus_66

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

TestStatus_66 attempts to connect to the given node and exchange a status message with it on the eth66 protocol, and then check to make sure the chain head is correct.

func (*Suite) TestTransaction

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

func (*Suite) TestTransaction_66

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

func (*Suite) TestZeroRequestID_66

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

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

type Transactions

type Transactions eth.TransactionsPacket

func (Transactions) Code

func (t Transactions) Code() int

Jump to

Keyboard shortcuts

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