Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

FaultMask Bitfield (0x00..0x80)

u64se-seu-solana records all failure modalities as a transparent 8-bit bitmask (FaultMask).

#![allow(unused)]
fn main() {
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
pub struct FaultMask(pub u8);
}

Canonical Bit Allocation

BitHexConstant IdentifierFormal Invariant Violated
—0x00FaultMask::PASSAll invariants satisfied (0 violations)
00x01INACTIVE_OR_PAUSEDState machine is halted, paused, or uninitialized
10x02ROLE_UNAUTHORIZEDCaller requested a forbidden role or multi-hot bitmask
20x04TARGET_MISMATCHExpected target coordinate does not match committed target
30x08SELF_LOOP_FORBIDDENIllegal self-loop transition ($S_{i+1} = S_i$)
40x10BACKWARD_FORBIDDENIllegal backward/re-entrant transition ($S_{i+1} < S_i$)
50x20SLOT_TIME_SKEWClock drift from past epoch ($\Delta > \text{0x7FFF}$)
60x40RATE_LIMITEDSlot collision; duplicate transition within same slot ($\Delta = 0$)
70x80VALUE_OVERFLOWReserved for arithmetic coordinate boundary breach

Multiple Concurrent Fault Recording

Because FaultMask is a bitfield, a single evaluation step captures all simultaneous violations rather than short-circuiting on the first error.

For example, if an attacker attempts a backward transition with an unauthorized multi-bit role: $$\text{fault} = \text{ROLE_UNAUTHORIZED (0x02)} \mid \text{BACKWARD_FORBIDDEN (0x10)} = \mathbf{0x12}$$

This gives client-side monitors, MEV searchers, and circuit breakers complete observability into why an action was fenced off.


Helper Methods

#![allow(unused)]
fn main() {
impl FaultMask {
    /// Returns true if and only if zero fault bits are active.
    #[inline(always)]
    pub const fn is_pass(&self) -> bool {
        self.0 == Self::PASS
    }

    /// Tests for specific fault conditions.
    #[inline(always)]
    pub const fn contains(&self, bit: u8) -> bool {
        (self.0 & bit) != 0
    }
}
}