pub enum DecodeError {
BadMagic,
BadVersion,
BadCrc {
expected: u32,
actual: u32,
},
BadStatus(u8),
StallOnWire,
BadPid(u32),
BadTimestamp(u64),
BadNonce {
nonce: u64,
status: Status,
},
}Expand description
Error returned by Frame::decode and Status::try_from_u8.
The variants form an exhaustive list of validation failures the protocol can detect statically; everything else (timestamp drift, nonce regression) is policy enforced higher in the stack.
This enum is exhaustive. Adding a variant is a workspace-wide compile-error change that requires updating every match site explicitly.
Variants§
BadMagic
First two bytes did not equal MAGIC.
BadVersion
Version byte did not equal VERSION.
BadCrc
CRC-32C trailer at bytes 28..32 did not match the value computed
over bytes 0..28. Indicates wire corruption (cosmic ray / NIC
firmware / non-ECC RAM bit flip) on the UDS transport, or
in-process memory corruption between
crate::crypto::open and Frame::decode on the
secure-UDP transport. AEAD tag failures stay in the transport
layer (crypto::AuthError) and never surface as BadCrc.
Fields
BadStatus(u8)
Status byte did not match any known Status variant. The inner
value is the offending byte, surfaced for observer-side diagnostics.
StallOnWire
Observer-only status Status::Stall observed on the wire. Stall
is synthesized by varta-watch when a pid goes silent past its
threshold; agents emit only Ok, Degraded, or Critical. A
spoofed Stall frame would inject false liveness telemetry from
any pid, so the decoder rejects it at the single chokepoint.
BadPid(u32)
Reserved pid: 0 (kernel/scheduler) or 1 (init/systemd). No
legitimate agent runs at either pid; rejecting closes the “spoof
init has stalled” recovery-trigger attack on UDP listeners.
BadTimestamp(u64)
Reserved timestamp sentinel u64::MAX — the saturation value from
varta_client::Varta::beat’s .min(u64::MAX as u128) as u64.
Reaching it through real elapsed nanoseconds is not physically
possible.
BadNonce
Protocol invariant violation: nonce == NONCE_TERMINAL is reserved
for the panic hook’s terminal frame and MUST be paired with
Status::Critical. Carries the violating status for diagnostics.
Trait Implementations§
Source§impl Clone for DecodeError
impl Clone for DecodeError
Source§fn clone(&self) -> DecodeError
fn clone(&self) -> DecodeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DecodeError
Source§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
impl Eq for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
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()