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.
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.
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.
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.
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.
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
impl Debug for MessageValidationError
Source§impl Display for MessageValidationError
impl Display for MessageValidationError
impl Eq for MessageValidationError
Source§impl Error for MessageValidationError
impl Error for MessageValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()