#[cfg_attr(feature = "thiserror", derive(thiserror::Error))]
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum AttestationError {
#[cfg_attr(
feature = "thiserror",
error("aggregate Schnorr signature verification failed")
)]
InvalidAggregateSignature,
#[cfg_attr(
feature = "thiserror",
error("malformed signature component (e.g. non-canonical Schnorr scalar)")
)]
InvalidSignature,
#[cfg_attr(
feature = "thiserror",
error("insufficient signers: popcount(signers_bitmap) < signatures_required")
)]
InsufficientSigners,
#[cfg_attr(
feature = "thiserror",
error("signers_bitmap is not a subset of the derived selection bitmap")
)]
SignersNotSubsetOfSelection,
#[cfg_attr(
feature = "thiserror",
error("invalid signers_bitmap (bits outside [0, node_count) or malformed)")
)]
InvalidSignersBitmap,
#[cfg_attr(
feature = "thiserror",
error("selection-group bitmap derivation failed")
)]
GroupBitmapDerivationFailed,
#[cfg_attr(
feature = "thiserror",
error("ordered_signers.len() does not match popcount(signers_bitmap)")
)]
SignerCountMismatch,
#[cfg_attr(feature = "thiserror", error("invalid registry version"))]
InvalidRegistryVersion,
#[cfg_attr(
feature = "thiserror",
error("signer account missing, extra, or owned by another program")
)]
MissingSignerAccount,
#[cfg_attr(
feature = "thiserror",
error("node account index does not match bitmap")
)]
InvalidNodeIndex,
#[cfg_attr(
feature = "thiserror",
error("previous-version remove remapping requested without valid transition metadata")
)]
InvalidTransitionAccount,
}
#[cfg(all(test, feature = "thiserror"))]
mod tests {
use super::*;
use std::error::Error;
#[test]
fn implements_error_and_display() {
let err = AttestationError::InsufficientSigners;
assert!(err.source().is_none());
assert!(err.to_string().contains("insufficient signers"));
}
}