Skip to main content

MessageValidationError

Enum MessageValidationError 

Source
pub enum MessageValidationError {
    RateTooLarge {
        rate: u64,
    },
    RateIsZero,
    InvalidSlashSigLen {
        len: usize,
    },
    InvalidVoucherSigLen {
        len: usize,
    },
    InvalidBindingSigLen {
        len: usize,
    },
    StreamErrorWithOk,
    MissingStreamError,
    VoucherRejectedInResponse,
    EmptyChunk,
    ChunkTooLarge {
        frame_len: usize,
    },
    EmptyCapabilitySignature,
}
Expand description

Errors produced when validating wire-decoded protocol messages.

RateTooLarge surfaces from the Deserialize impl on ProbeResponseBody (postcard wraps it as postcard::Error which the framing layer maps to crate::FrameError::Decode). InvalidSlashSigLen is a requester-side obligation enforced via ProbeResponse::validate — it is intentionally NOT enforced at decode time so the handler can build the response before signing it.

Variants§

§

RateTooLarge

rate_per_mb exceeds MAX_RATE_PER_MB.

Fields

§rate: u64

The rate that was offered.

§

RateIsZero

rate_per_mb is zero. A zero rate trivially wins client selection (score rate × rtt × scale / reputation² → 0, sorting to the top) while earning the node nothing — an obvious misconfiguration. Nodes reject it at config resolution; requesters MUST also reject it on receive (#252, ADR 005 §Rate bounds validation). Enforced via ProbeResponse::validate / StreamResponse::validate, not at decode time, so a handler can still build a response before signing it.

§

InvalidSlashSigLen

slash_sig is missing or not SLASH_SIG_LEN bytes. ADR 014 §1 mandates a non-empty signature on every ProbeResponse; the EOA-only off-chain signing path (ADR 024 §Off-Chain Signature Verification — EOA Recovery Only) makes that exactly SLASH_SIG_LEN, which requesters MUST reject deviations from.

Fields

§len: usize

The signature length that was offered.

§

InvalidVoucherSigLen

A wire crate::client::Voucher’s signature is not crate::client::VOUCHER_SIG_LEN bytes. The EOA off-chain voucher signing form (ADR 024 §Off-Chain Signature Verification — EOA Recovery Only) is exactly that length; receivers reject deviations before reconstructing the EIP-712 typed data.

Fields

§len: usize

The signature length that was offered.

§

InvalidBindingSigLen

A wire crate::client::ClientBinding’s binding_signature is not crate::client::BINDING_SIG_LEN bytes. The BindNodeId attestation is the same EOA off-chain signing form (ADR 024 §Off-Chain ERC-1271 Verification); receivers reject deviations before decdn_incentive recovers the bound address.

Fields

§len: usize

The signature length that was offered.

§

StreamErrorWithOk

A crate::client::StreamResponse carries body.ok == true yet also an error. A node MUST NOT both promise to serve and report a failure (ADR 005 §cdn/client/v1). Enforced via crate::client::StreamResponseExt::validate.

§

MissingStreamError

A crate::client::StreamResponse carries body.ok == false but no error code. A refusal MUST name its reason (ADR 005 §cdn/client/v1). Enforced via crate::client::StreamResponseExt::validate.

§

VoucherRejectedInResponse

A crate::client::StreamResponse carries a mid-stream-only crate::client::StreamError::VoucherRejected in its error field. That variant rides exclusively in crate::client::ClientMessage::StreamError (ADR 005 §VoucherRejected semantics). Enforced via crate::client::StreamResponseExt::validate.

§

EmptyChunk

A crate::client::ChunkData carries a zero-length payload. ADR 005 §Frame size permits a shorter final frame, never an empty one: an empty frame advances neither the receiver’s cumulative byte count nor its voucher accounting, so an unbounded run of them drives the receive loop without application-level progress (#1088). Enforced by crate::client::ChunkData::new, the try_from decode gate, and every encode_chunk_* helper (crate::client::encode_chunk_frame, crate::client::encode_chunk_frame_headers, and the crate-private one the latter builds on) — every route to a frame body.

§

ChunkTooLarge

The postcard message body of a crate::client::ChunkData frame — discriminant + length prefix + payload, which is the length the framing prefix announces — exceeds crate::framing::MAX_MESSAGE_SIZE (ADR 013 §Wire Framing).

The field is named for what it holds: this is always larger than the payload_len the caller passed in, so comparing it against that is a category error.

Fields

§frame_len: usize

The refused frame-body length, in bytes.

§

EmptyCapabilitySignature

A wire crate::client::WireCapability’s owner_signature is empty. The EOA form is exactly crate::client::VOUCHER_SIG_LEN bytes but an ERC-1271 contract-signer form may be longer, so only the non-empty floor is a wire-level check; the rest is decdn_incentive’s job (ADR 024 §Off-Chain Signature Verification — EOA Recovery Only).

Trait Implementations§

Source§

impl Debug for MessageValidationError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for MessageValidationError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for MessageValidationError

Source§

impl Error for MessageValidationError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for MessageValidationError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MessageValidationError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.