Crate reth_eth_wire

Source
Expand description

Implementation of the eth wire protocol.

§Feature Flags

  • serde (default): Enable serde support
  • arbitrary: Adds proptest and arbitrary support for wire types.

Modules§

blocks
Implements the GetBlockHeaders, GetBlockBodies, BlockHeaders, and BlockBodies message types.
broadcast
Types for broadcasting new data.
capability
All capability related types
disconnect_reason
RLPx disconnect reason sent to/received from peer
errors
Error types for stream variants
handshake
Handshake logic
header
Header types.
message
Implements Ethereum wire protocol for versions 66, 67, and 68. Defines structs/enums for messages, request-response pairs, and broadcasts. Handles compatibility with EthVersion.
multiplex
Rlpx protocol multiplexer and satellite stream
primitives
Abstraction over primitive types in network messages.
protocol
A Protocol defines a P2P subprotocol in an RLPx connection
receipts
Implements the GetReceipts and Receipts message types.
state
Implements the GetNodeData and NodeData message types.
transactions
Implements the GetPooledTransactions and PooledTransactions message types.
version
Support for representing the version of the eth

Structs§

AccountData
Account data in the response.
AccountRangeMessage
Response containing a number of consecutive accounts and the Merkle proofs for the entire range.
BlockBodies
The response to GetBlockBodies, containing the block bodies that the peer knows about if any were found.
BlockHashNumber
A block hash and a block number.
BlockHeaders
The response to GetBlockHeaders, containing headers if any headers were found.
ByteCodesMessage
Response containing a number of requested contract codes.
Capabilities
Represents all capabilities of a node.
Capability
A message indicating a supported capability and capability version.
EthNetworkPrimitives
Network primitive types used by Ethereum networks.
EthStream
An EthStream wraps over any Stream that yields bytes and makes it compatible with eth-networking protocol messages, which get RLP encoded/decoded.
GetAccountRangeMessage
Request for a range of accounts from the state trie.
GetBlockBodies
A request for a peer to return block bodies for the given block hashes.
GetBlockHeaders
A request for a peer to return block headers starting at the requested block. The peer must return at most limit headers. If the reverse field is true, the headers will be returned starting at start_block, traversing towards the genesis block. Otherwise, headers will be returned starting at start_block, traversing towards the latest block.
GetByteCodesMessage
Request to get a number of requested contract codes.
GetNodeData
A request for state tree nodes corresponding to the given hashes. This message was removed in eth/67, only clients running eth/66 or earlier will respond to this message.
GetPooledTransactions
A list of transaction hashes that the peer would like transaction bodies for.
GetReceipts
A request for transaction receipts from the given block hashes.
GetStorageRangesMessage
Request for the storage slots of multiple accounts’ storage tries.
GetTrieNodesMessage
Request a number of state (either account or storage) Merkle trie nodes by path
HelloMessage
Raw rlpx protocol message used in the p2p handshake, containing information about the supported RLPx protocol version and capabilities.
HelloMessageBuilder
Builder for HelloMessageWithProtocols
HelloMessageWithProtocols
This is a superset of HelloMessage that provides additional protocol Protocol information about the number of messages used by each capability in order to do proper message ID multiplexing.
NewBlock
A new block with the current total difficulty, which includes the difficulty of the returned block.
NewBlockHashes
This informs peers of new blocks that have appeared on the network.
NewPooledTransactionHashes66
This informs peers of transaction hashes for transactions that have appeared on the network, but have not been included in a block.
NewPooledTransactionHashes68
Same as NewPooledTransactionHashes66 but extends that beside the transaction hashes, the node sends the transaction types and their sizes (as defined in EIP-2718) as well.
NodeData
The response to GetNodeData, containing the state tree nodes or contract bytecode corresponding to the requested hashes.
P2PStream
A P2PStream wraps over any Stream that yields bytes and makes it compatible with p2p protocol messages.
PartiallyValidData
Data that has passed an initial validation pass that is not specific to any mempool message type.
PooledTransactions
The response to GetPooledTransactions, containing the transaction bodies associated with the requested hashes.
ProtocolMessage
An eth protocol message, containing a message ID and payload.
Receipts
The response to GetReceipts, containing receipt lists that correspond to each block requested.
RequestTxHashes
Hashes to request from a peer.
SharedTransactions
Same as Transactions but this is intended as egress message send from local to many peers.
Status
The status message is used in the eth protocol handshake to ensure that peers are on the same network and are following the same fork.
StatusBuilder
Builder for Status messages.
StatusEth69
Similar to Status, but for eth/69 version, which does not contain the total_difficulty field.
StorageData
Storage slot data in the response.
StorageRangesMessage
Response containing a number of consecutive storage slots for the requested account and optionally the merkle proofs for the last range (boundary proofs) if it only partially covers the storage trie.
Transactions
This informs peers of transactions that have appeared on the network and are not yet included in a block.
TrieNodesMessage
Response containing a number of requested state trie nodes
TriePath
Path in the trie for an account and its storage
UnauthedEthStream
An un-authenticated EthStream. This is consumed and returns a EthStream after the Status handshake is completed.
UnauthedP2PStream
An un-authenticated P2PStream. This is consumed and returns a P2PStream after the Hello handshake is completed.
UnknownDisconnectReason
This represents an unknown disconnect reason with the given code.
ValidAnnouncementData
Partially validated data from an announcement or a PooledTransactions response.

Enums§

DisconnectReason
RLPx disconnect reason.
EthMessage
Represents a message in the eth wire protocol, versions 66, 67 and 68.
EthMessageID
Represents message IDs for eth protocol messages.
EthVersion
The eth protocol version.
HashOrNumber
Either a hash or a block number
HeadersDirection
Represents the direction for a headers request depending on the reverse field of the request.
NewPooledTransactionHashes
A wrapper type for all different new pooled transaction types
P2PMessage
This represents only the reserved p2p subprotocol messages.
P2PMessageID
Message IDs for p2p subprotocol messages.
ProtocolVersion
RLPx p2p protocol version
SnapMessageId
Message IDs for the snap sync protocol
SnapProtocolMessage
Represents all types of messages in the snap sync protocol.

Constants§

HANDSHAKE_TIMEOUT
HANDSHAKE_TIMEOUT determines the amount of time to wait before determining that a p2p handshake has timed out.
MAX_MESSAGE_SIZE
MAX_MESSAGE_SIZE is the maximum cap on the size of a protocol message.
MAX_RESERVED_MESSAGE_ID
MAX_RESERVED_MESSAGE_ID is the maximum message ID reserved for the p2p subprotocol. If there are any incoming messages with an ID greater than this, they are subprotocol messages.

Traits§

CanDisconnect
This trait is meant to allow higher level protocols like eth to disconnect from a peer, using lower-level disconnect functions (such as those that exist in the p2p protocol) if the underlying stream supports it.
DedupPayload
Validation pass that checks for unique transaction hashes.
DisconnectP2P
Gracefully disconnects the connection by sending a disconnect message and stop reading new messages.
Encodable2718
Encoding trait for EIP-2718 envelopes.
HandleMempoolData
Interface for handling mempool message data. Used in various filters in pipelines in TransactionsManager and in queries to TransactionPool.
HandleVersionedMempoolData
Extension of HandleMempoolData interface, for mempool messages that are versioned.
NetPrimitivesFor
This is a helper trait for use in bounds, where some of the NetworkPrimitives associated types must be the same as the [NodePrimitives] associated types.
NetworkPrimitives
Abstraction over primitive types which might appear in network messages. See crate::EthMessage for more context.

Type Aliases§

BlockHashOrNumber
A block hash or a block number
Eth68TxMetadata
Value in PartiallyValidData map obtained from an announcement.