1#[cfg_attr(feature = "thiserror", derive(thiserror::Error))]
11#[derive(Debug, PartialEq, Eq, Copy, Clone)]
12pub enum AttestationError {
13 #[cfg_attr(
16 feature = "thiserror",
17 error("aggregate Schnorr signature verification failed")
18 )]
19 InvalidAggregateSignature,
20 #[cfg_attr(
23 feature = "thiserror",
24 error("malformed signature component (e.g. non-canonical Schnorr scalar)")
25 )]
26 InvalidSignature,
27 #[cfg_attr(
29 feature = "thiserror",
30 error("insufficient signers: popcount(signers_bitmap) < signatures_required")
31 )]
32 InsufficientSigners,
33 #[cfg_attr(
35 feature = "thiserror",
36 error("signers_bitmap is not a subset of the derived selection bitmap")
37 )]
38 SignersNotSubsetOfSelection,
39 #[cfg_attr(
41 feature = "thiserror",
42 error("invalid signers_bitmap (bits outside [0, node_count) or malformed)")
43 )]
44 InvalidSignersBitmap,
45 #[cfg_attr(
48 feature = "thiserror",
49 error("selection-group bitmap derivation failed")
50 )]
51 GroupBitmapDerivationFailed,
52 #[cfg_attr(
54 feature = "thiserror",
55 error("ordered_signers.len() does not match popcount(signers_bitmap)")
56 )]
57 SignerCountMismatch,
58 #[cfg_attr(feature = "thiserror", error("invalid registry version"))]
60 InvalidRegistryVersion,
61 #[cfg_attr(
63 feature = "thiserror",
64 error("signer account missing, extra, or owned by another program")
65 )]
66 MissingSignerAccount,
67 #[cfg_attr(
69 feature = "thiserror",
70 error("node account index does not match bitmap")
71 )]
72 InvalidNodeIndex,
73 #[cfg_attr(
75 feature = "thiserror",
76 error("previous-version remove remapping requested without valid transition metadata")
77 )]
78 InvalidTransitionAccount,
79}
80
81#[cfg(all(test, feature = "thiserror"))]
82mod tests {
83 use super::*;
84 use std::error::Error;
85
86 #[test]
87 fn implements_error_and_display() {
88 let err = AttestationError::InsufficientSigners;
89 assert!(err.source().is_none());
90 assert!(err.to_string().contains("insufficient signers"));
91 }
92}