dpp/errors/consensus/signature/
signature_error.rs

1use crate::consensus::signature::{
2    BasicBLSError, BasicECDSAError, IdentityNotFoundError, InvalidIdentityPublicKeyTypeError,
3    InvalidSignaturePublicKeySecurityLevelError, InvalidStateTransitionSignatureError,
4    MissingPublicKeyError, PublicKeyIsDisabledError, PublicKeySecurityLevelNotMetError,
5    SignatureShouldNotBePresentError, UncompressedPublicKeyNotAllowedError,
6    WrongPublicKeyPurposeError,
7};
8use crate::consensus::ConsensusError;
9use bincode::{Decode, Encode};
10use thiserror::Error;
11
12use crate::consensus::signature::invalid_signature_public_key_purpose_error::InvalidSignaturePublicKeyPurposeError;
13use crate::errors::ProtocolError;
14use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize};
15
16#[derive(
17    Error, Debug, PartialEq, Encode, Decode, PlatformSerialize, PlatformDeserialize, Clone,
18)]
19pub enum SignatureError {
20    /*
21
22    DO NOT CHANGE ORDER OF VARIANTS WITHOUT INTRODUCING OF NEW VERSION
23
24    */
25    #[error(transparent)]
26    IdentityNotFoundError(IdentityNotFoundError),
27
28    #[error(transparent)]
29    InvalidIdentityPublicKeyTypeError(InvalidIdentityPublicKeyTypeError),
30
31    #[error(transparent)]
32    InvalidStateTransitionSignatureError(InvalidStateTransitionSignatureError),
33
34    #[error(transparent)]
35    MissingPublicKeyError(MissingPublicKeyError),
36
37    #[error(transparent)]
38    InvalidSignaturePublicKeyPurposeError(InvalidSignaturePublicKeyPurposeError),
39
40    #[error(transparent)]
41    InvalidSignaturePublicKeySecurityLevelError(InvalidSignaturePublicKeySecurityLevelError),
42
43    #[error(transparent)]
44    WrongPublicKeyPurposeError(WrongPublicKeyPurposeError),
45
46    #[error(transparent)]
47    PublicKeyIsDisabledError(PublicKeyIsDisabledError),
48
49    #[error(transparent)]
50    PublicKeySecurityLevelNotMetError(PublicKeySecurityLevelNotMetError),
51
52    #[error(transparent)]
53    SignatureShouldNotBePresentError(SignatureShouldNotBePresentError),
54
55    #[error(transparent)]
56    BasicECDSAError(BasicECDSAError),
57
58    #[error(transparent)]
59    BasicBLSError(BasicBLSError),
60
61    #[error(transparent)]
62    UncompressedPublicKeyNotAllowedError(UncompressedPublicKeyNotAllowedError),
63}
64
65impl From<SignatureError> for ConsensusError {
66    fn from(err: SignatureError) -> Self {
67        Self::SignatureError(err)
68    }
69}