feat(eth-wire) add missing docs (#5467)

This commit is contained in:
DoTheBestToGetTheBest
2023-11-17 04:57:07 -08:00
committed by GitHub
parent c0fe64700a
commit b03d0106ae

View File

@ -7,20 +7,33 @@ use std::io;
/// Errors when sending/receiving messages /// Errors when sending/receiving messages
#[derive(thiserror::Error, Debug)] #[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
pub enum EthStreamError { pub enum EthStreamError {
#[error(transparent)] #[error(transparent)]
/// Error of the underlying P2P connection.
P2PStreamError(#[from] P2PStreamError), P2PStreamError(#[from] P2PStreamError),
#[error(transparent)] #[error(transparent)]
/// Failed to parse peer's version.
ParseVersionError(#[from] ParseVersionError), ParseVersionError(#[from] ParseVersionError),
#[error(transparent)] #[error(transparent)]
/// Failed Ethereum handshake.
EthHandshakeError(#[from] EthHandshakeError), EthHandshakeError(#[from] EthHandshakeError),
#[error("message id {1:?} is invalid for version {0:?}")] #[error("message id {1:?} is invalid for version {0:?}")]
/// Flags an unrecognized message ID for a given protocol version.
EthInvalidMessageError(EthVersion, EthMessageID), EthInvalidMessageError(EthVersion, EthMessageID),
#[error("message size ({0}) exceeds max length (10MB)")] #[error("message size ({0}) exceeds max length (10MB)")]
/// Received a message whose size exceeds the standard limit.
MessageTooBig(usize), MessageTooBig(usize),
#[error("TransactionHashes invalid len of fields: hashes_len={hashes_len} types_len={types_len} sizes_len={sizes_len}")] #[error("TransactionHashes invalid len of fields: hashes_len={hashes_len} types_len={types_len} sizes_len={sizes_len}")]
TransactionHashesInvalidLenOfFields { hashes_len: usize, types_len: usize, sizes_len: usize }, /// Received malformed transaction hashes message with discrepancies in field lengths.
TransactionHashesInvalidLenOfFields {
/// The number of transaction hashes.
hashes_len: usize,
/// The number of transaction types.
types_len: usize,
/// The number of transaction sizes.
sizes_len: usize,
},
} }
// === impl EthStreamError === // === impl EthStreamError ===