sigil-czac · error
Source declarations, signatures and documentation for error.
Source: sigil/node/sigil-czac/src/error.rs. SHA-256: a5e03869ecccc65a95e64b60deb12a4ed1b7113f62b9b6d22663042d7bd19fc5.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
error::CzacError
Error types for the Cross-Zone Agent Communication protocol.
22 error codes covering all CZAC protocol layers: envelope, routing, channel, session, flow control, payment, and settlement. All errors produced by the CZAC protocol stack.
#[derive(Debug, Clone, thiserror::Error)]
pub enum CzacError {
// -- Envelope (4) -------------------------------------------------------
/// Envelope signature verification failed.
#[error("envelope: invalid signature — {0}")]
InvalidSignature(String),
/// Envelope has expired (TTL exceeded).
#[error("envelope: message expired — age {age_secs}s exceeds ttl {ttl_secs}s")]
MessageExpired { age_secs: u64, ttl_secs: u64 },
/// Envelope nonce has already been seen (replay attempt).
#[error("envelope: replay detected — nonce already consumed")]
ReplayDetected,
/// Envelope serialization or deserialization failed.
#[error("envelope: serialization error — {0}")]
SerializationError(String),
// -- Routing (3) --------------------------------------------------------
/// The requested zone was not found in the routing table.
#[error("routing: zone not found — {zone_id}")]
ZoneNotFound { zone_id: String },
/// A zone endpoint registration was invalid or conflicting.
#[error("routing: invalid endpoint — {0}")]
InvalidEndpoint(String),
/// No route exists to the target zone.
#[error("routing: no route to zone {zone_id}")]
NoRoute { zone_id: String },
// -- Channel (5) --------------------------------------------------------
/// The channel was not found.
#[error("channel: not found — {channel_id}")]
ChannelNotFound { channel_id: String },
/// The channel is in an unexpected state for the requested operation.
#[error("channel: invalid state transition from {from} to {to}")]
InvalidChannelState { from: String, to: String },
/// The handshake message is out of order or unexpected.
#[error("channel: unexpected handshake step — {0}")]
HandshakeError(String),
/// A duplicate channel initiation was attempted.
#[error("channel: duplicate initiation — channel {channel_id} already exists")]
DuplicateChannel { channel_id: String },
/// The channel has timed out (no activity within threshold).
#[error("channel: timed out — channel {channel_id} idle for {idle_secs}s")]
ChannelTimeout { channel_id: String, idle_secs: u64 },
// -- Session (2) --------------------------------------------------------
/// Session encryption or decryption failed.
#[error("session: crypto error — {0}")]
SessionCryptoError(String),
/// Session keys need rekeying (nonce counter exhausted).
#[error("session: rekey required — {messages_sent} messages sent, limit {limit}")]
RekeyRequired { messages_sent: u64, limit: u64 },
// -- Flow Control (3) ---------------------------------------------------
/// No send credits available (backpressured).
#[error("flow: no credits available — {available} of {required} credits")]
NoCredits { available: u64, required: u64 },
/// The priority queue is full.
#[error("flow: queue full — {queue_depth} messages queued")]
QueueFull { queue_depth: usize },
/// Invalid priority value.
#[error("flow: invalid priority — {0}")]
InvalidPriority(String),
// -- Payment (3) --------------------------------------------------------
/// Payment channel balance invariant violated (a + b != escrow).
#[error(
"payment: balance invariant violated — a={balance_a} + b={balance_b} != escrow={escrow}"
)]
BalanceInvariant {
balance_a: u64,
balance_b: u64,
escrow: u64,
},
/// The payment channel is in an invalid state for the requested operation.
#[error("payment: invalid state — {0}")]
InvalidPaymentState(String),
/// The balance update sequence is stale or out of order.
#[error("payment: stale update — got seq {got}, expected > {expected}")]
StaleUpdate { got: u64, expected: u64 },
// -- Settlement (2) -----------------------------------------------------
/// Settlement proof verification failed.
#[error("settlement: invalid proof — {0}")]
InvalidProof(String),
/// The dispute window has not yet elapsed.
#[error("settlement: dispute window active — {blocks_remaining} blocks remaining")]
DisputeWindowActive { blocks_remaining: u64 },
}Source line: 8.