Skip to main content

mithril_common/messages/proof_v2/
error.rs

1use thiserror::Error;
2
3use crate::StdError;
4
5/// Error encountered or produced by the verification of a set of proofs.
6#[derive(Error, Debug)]
7pub enum VerifyProofsV2Error {
8    /// The verification of an individual [crate::messages::MkSetProofMessagePart] failed.
9    #[error("Invalid set proof for {subject} hashes: {hashes:?}")]
10    InvalidSetProof {
11        /// Type of the item that failed the verification
12        subject: &'static str,
13        /// Hashes of the invalid items
14        hashes: Vec<String>,
15        /// Error source
16        source: StdError,
17    },
18
19    /// No certified items to verify in the set proof
20    #[error("There's no certified {0} to verify")]
21    NoCertifiedItem(&'static str),
22
23    /// An individual [crate::messages::MkSetProofMessagePart] could not be converted to a
24    /// [crate::entities::MkSetProof] for verification.
25    #[error("Malformed data or unknown {0} set proof format")]
26    MalformedData(&'static str, #[source] StdError),
27}