Expand description
Implementation of the eth wire protocol.
§Feature Flags
serde(default): Enable serde supportarbitrary: Addsproptestandarbitrarysupport for wire types.
Modules§
- blocks
- Implements the
GetBlockHeaders,GetBlockBodies,BlockHeaders, andBlockBodiesmessage types. - broadcast
- Types for broadcasting new data.
- capability
- All capability related types
- disconnect_
reason RLPxdisconnect reason sent to/received from peer- errors
- Error types for stream variants
- eth_
snap_ stream - Ethereum and snap combined protocol stream implementation.
- 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
RLPxconnection - receipts
- Implements the
GetReceiptsandReceiptsmessage types. - snap
- Implements Ethereum SNAP message types.
Snap protocol runs on top of
RLPxfacilitating the exchange of Ethereum state snapshots between peers Reference: Ethereum Snapshot Protocol - state
- Implements the
GetNodeDataandNodeDatamessage types. - transactions
- Implements the
GetPooledTransactionsandPooledTransactionsmessage types. - version
- Support for representing the version of the
eth
Structs§
- Account
Data - Account data in the response.
- Account
Range Message - Response containing a number of consecutive accounts and the Merkle proofs for the entire range.
- Basic
Network Primitives - Basic implementation of
NetworkPrimitivescombining [NodePrimitives] and a pooled transaction. - Block
Bodies - The response to
GetBlockBodies, containing the block bodies that the peer knows about if any were found. - Block
Hash Number - A block hash and a block number.
- Block
Headers - The response to
GetBlockHeaders, containing headers if any headers were found. - Block
Range Update - The earliest block, the latest block and hash of the latest block which can be provided. See BlockRangeUpdate.
- Byte
Codes Message - 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.
- EthStream
- An
EthStreamwraps over anyStreamthat yields bytes and makes it compatible with eth-networking protocol messages, which get RLP encoded/decoded. - EthStream
Inner - Contains eth protocol specific logic for processing messages
- GetAccount
Range Message - Request for a range of accounts from the state trie.
- GetBlock
Bodies - A request for a peer to return block bodies for the given block hashes.
- GetBlock
Headers - A request for a peer to return block headers starting at the requested block.
The peer must return at most
limitheaders. If thereversefield istrue, the headers will be returned starting atstart_block, traversing towards the genesis block. Otherwise, headers will be returned starting atstart_block, traversing towards the latest block. - GetByte
Codes Message - Request to get a number of requested contract codes.
- GetNode
Data - A request for state tree nodes corresponding to the given hashes.
This message was removed in
eth/67, only clients runningeth/66or earlier will respond to this message. - GetPooled
Transactions - A list of transaction hashes that the peer would like transaction bodies for.
- GetReceipts
- A request for transaction receipts from the given block hashes.
- GetStorage
Ranges Message - Request for the storage slots of multiple accounts’ storage tries.
- GetTrie
Nodes Message - Request a number of state (either account or storage) Merkle trie nodes by path
- Hello
Message - Raw rlpx protocol message used in the
p2phandshake, containing information about the supportedRLPxprotocol version and capabilities. - Hello
Message Builder - Builder for
HelloMessageWithProtocols - Hello
Message With Protocols - This is a superset of
HelloMessagethat 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.
- NewBlock
Hashes - This informs peers of new blocks that have appeared on the network.
- NewPooled
Transaction Hashes66 - This informs peers of transaction hashes for transactions that have appeared on the network, but have not been included in a block.
- NewPooled
Transaction Hashes68 - Same as
NewPooledTransactionHashes66but extends that beside the transaction hashes, the node sends the transaction types and their sizes (as defined in EIP-2718) as well. - Node
Data - The response to
GetNodeData, containing the state tree nodes or contract bytecode corresponding to the requested hashes. - P2PStream
- A
P2PStreamwraps over anyStreamthat yields bytes and makes it compatible withp2pprotocol messages. - Partially
Valid Data - Data that has passed an initial validation pass that is not specific to any mempool message type.
- Pooled
Transactions - The response to
GetPooledTransactions, containing the transaction bodies associated with the requested hashes. - Protocol
Message - An
ethprotocol message, containing a message ID and payload. - RawCapability
Message - A Capability message consisting of the message-id and the payload.
- Receipts
- The response to
GetReceipts, containing receipt lists that correspond to each block requested. - Receipts69
- Eth/69 receipt response type that removes bloom filters from the protocol.
- Request
TxHashes - Hashes to request from a peer.
- Shared
Transactions - Same as
Transactionsbut 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.
- Status
Builder - Builder type for constructing a
UnifiedStatusmessage. - Status
Eth69 - Similar to
Status, but foreth/69version, which does not contain thetotal_difficultyfield. - Storage
Data - Storage slot data in the response.
- Storage
Ranges Message - 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.
- Trie
Nodes Message - Response containing a number of requested state trie nodes
- Trie
Path - Path in the trie for an account and its storage
- Unauthed
EthStream - An un-authenticated
EthStream. This is consumed and returns aEthStreamafter theStatushandshake is completed. - Unauthed
P2PStream - An un-authenticated
P2PStream. This is consumed and returns aP2PStreamafter theHellohandshake is completed. - Unified
Status UnifiedStatusis an internal superset of all ETH status fields for alleth/versions.- Unknown
Disconnect Reason - This represents an unknown disconnect reason with the given code.
- Valid
Announcement Data - Partially validated data from an announcement or a
PooledTransactionsresponse.
Enums§
- Disconnect
Reason RLPxdisconnect reason.- EthMessage
- Represents a message in the eth wire protocol, versions 66, 67, 68 and 69.
- EthMessageID
- Represents message IDs for eth protocol messages.
- EthVersion
- The
ethprotocol version. - Hash
OrNumber - Either a hash or a block number
- Headers
Direction - Represents the direction for a headers request depending on the
reversefield of the request. - NewPooled
Transaction Hashes - A wrapper type for all different new pooled transaction types
- P2PMessage
- This represents only the reserved
p2psubprotocol messages. - P2PMessageID
- Message IDs for
p2psubprotocol messages. - Protocol
Version RLPxp2pprotocol version- Snap
Message Id - Message IDs for the snap sync protocol
- Snap
Protocol Message - Represents all types of messages in the snap sync protocol.
- Status
Message StatusMessagecan store either the Legacy version (with TD) or the eth/69 version (omits TD).
Constants§
- HANDSHAKE_
TIMEOUT HANDSHAKE_TIMEOUTdetermines the amount of time to wait before determining that ap2phandshake has timed out.- MAX_
MESSAGE_ SIZE MAX_MESSAGE_SIZEis the maximum cap on the size of a protocol message.- MAX_
RESERVED_ MESSAGE_ ID MAX_RESERVED_MESSAGE_IDis the maximum message ID reserved for thep2psubprotocol. 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
ethto disconnect from a peer, using lower-level disconnect functions (such as those that exist in thep2pprotocol) if the underlying stream supports it. - Dedup
Payload - Validation pass that checks for unique transaction hashes.
- Disconnect
P2P - Gracefully disconnects the connection by sending a disconnect message and stop reading new messages.
- Encodable2718
- Encoding trait for EIP-2718 envelopes.
- Handle
Mempool Data - Interface for handling mempool message data. Used in various filters in pipelines in
TransactionsManagerand in queries toTransactionPool. - Handle
Versioned Mempool Data - Extension of
HandleMempoolDatainterface, for mempool messages that are versioned. - NetPrimitives
For - This is a helper trait for use in bounds, where some of the
NetworkPrimitivesassociated types must be the same as the [NodePrimitives] associated types. - Network
Primitives - Abstraction over primitive types which might appear in network messages.
- NewBlock
Payload - A trait for block payloads transmitted through p2p.
Type Aliases§
- Block
Hash OrNumber - A block hash or a block number
- Eth68
TxMetadata - Value in
PartiallyValidDatamap obtained from an announcement. - EthNetwork
Primitives - Network primitive types used by Ethereum networks.