Skip to main content

dpp/errors/consensus/signature/
basic_bls_error.rs

1use crate::consensus::signature::signature_error::SignatureError;
2use crate::consensus::ConsensusError;
3use crate::errors::ProtocolError;
4use platform_serialization_derive::{
5    PlatformDeserializeTrusted, PlatformDeserializeUntrusted, PlatformSerialize,
6};
7use thiserror::Error;
8
9use bincode::{Decode, DecodeUntrusted, Encode};
10
11#[derive(
12    Error,
13    Debug,
14    Clone,
15    PartialEq,
16    Eq,
17    Default,
18    Encode,
19    Decode,
20    PlatformSerialize,
21    PlatformDeserializeTrusted,
22    PlatformDeserializeUntrusted,
23    DecodeUntrusted,
24)]
25#[error("bls signing error {message}")]
26#[platform_serialize(unversioned)]
27pub struct BasicBLSError {
28    message: String,
29}
30
31/*
32
33DO NOT CHANGE ORDER OF FIELDS WITHOUT INTRODUCING OF NEW VERSION
34
35*/
36
37impl BasicBLSError {
38    pub fn new(message: String) -> Self {
39        Self { message }
40    }
41}
42
43impl From<BasicBLSError> for ConsensusError {
44    fn from(err: BasicBLSError) -> Self {
45        Self::SignatureError(SignatureError::BasicBLSError(err))
46    }
47}