Skip to main content

exo_root/
error.rs

1//! Error type for root genesis authority operations.
2
3use thiserror::Error;
4
5/// Result alias used by the root genesis crate.
6pub type Result<T> = core::result::Result<T, RootError>;
7
8/// Failures returned by root genesis ceremony, DKG, signing, portal, and share
9/// protection operations.
10#[derive(Debug, Clone, PartialEq, Eq, Error)]
11pub enum RootError {
12    /// Ceremony policy or roster validation failed.
13    #[error("ceremony configuration rejected: {reason}")]
14    InvalidConfig { reason: String },
15
16    /// Canonical CBOR encoding failed before hashing or signing.
17    #[error("canonical encoding failed: {detail}")]
18    CanonicalEncoding { detail: String },
19
20    /// FROST DKG or threshold signing failed.
21    #[error("frost operation failed: {detail}")]
22    Frost { detail: String },
23
24    /// The supplied signer set does not satisfy the configured threshold.
25    #[error("threshold not met: required {required}, supplied {supplied}")]
26    ThresholdNotMet { required: u16, supplied: u16 },
27
28    /// A root signature or certifier envelope signature did not verify.
29    #[error("signature verification failed: {reason}")]
30    SignatureRejected { reason: String },
31
32    /// Root trust bundle contents are inconsistent with their signature or ID.
33    #[error("root bundle rejected: {reason}")]
34    BundleRejected { reason: String },
35
36    /// Portal relay policy rejected an envelope.
37    #[error("portal envelope rejected: {reason}")]
38    PortalRejected { reason: String },
39
40    /// Share sealing, opening, or pairwise payload protection failed.
41    #[error("share protection failed: {reason}")]
42    ProtectionFailed { reason: String },
43}