From 0b46e16dcdc9012810726bee410047fea8be7cf9 Mon Sep 17 00:00:00 2001 From: DoTheBestToGetTheBest <146037313+DoTheBestToGetTheBest@users.noreply.github.com> Date: Wed, 15 Nov 2023 15:31:45 -0800 Subject: [PATCH] feat(eth-wire): update docs (#5450) --- crates/net/eth-wire/src/errors/eth.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/net/eth-wire/src/errors/eth.rs b/crates/net/eth-wire/src/errors/eth.rs index 6839bccac3e4..c941b787d887 100644 --- a/crates/net/eth-wire/src/errors/eth.rs +++ b/crates/net/eth-wire/src/errors/eth.rs @@ -56,24 +56,37 @@ impl From for EthStreamError { } } -/// Error variants that can occur during the `eth` sub-protocol handshake. +/// Error that can occur during the `eth` sub-protocol handshake. #[derive(thiserror::Error, Debug)] -#[allow(missing_docs)] + pub enum EthHandshakeError { + /// Status message received or sent outside of the handshake process. #[error("status message can only be recv/sent in handshake")] StatusNotInHandshake, + /// Receiving a non-status message during the handshake phase. #[error("received non-status message when trying to handshake")] NonStatusMessageInHandshake, #[error("no response received when sending out handshake")] + /// No response received during the handshake process. NoResponse, #[error(transparent)] + /// Invalid fork data. InvalidFork(#[from] ValidationError), #[error("mismatched genesis in status message: {0}")] + /// Mismatch in the genesis block during status exchange. MismatchedGenesis(GotExpectedBoxed), #[error("mismatched protocol version in status message: {0}")] + /// Mismatched protocol versions in status messages. MismatchedProtocolVersion(GotExpected), #[error("mismatched chain in status message: {0}")] + /// Mismatch in chain details in status messages. MismatchedChain(GotExpected), #[error("total difficulty bitlen is too large: got {got}, maximum {maximum}")] - TotalDifficultyBitLenTooLarge { got: usize, maximum: usize }, + /// Excessively large total difficulty bit lengths. + TotalDifficultyBitLenTooLarge { + /// The actual bit length of the total difficulty. + got: usize, + /// The maximum allowed bit length for the total difficulty. + maximum: usize, + }, }