Skip to main content

ave_core/validation/
response.rs

1use ave_common::identity::DigestIdentifier;
2use borsh::{BorshDeserialize, BorshSerialize};
3use serde::{Deserialize, Serialize};
4use thiserror::Error;
5
6use crate::subject::Metadata;
7
8/// A Enum representing a validation response.
9#[derive(
10    Debug,
11    Clone,
12    Serialize,
13    Deserialize,
14    PartialEq,
15    Eq,
16    Hash,
17    BorshSerialize,
18    BorshDeserialize,
19)]
20pub enum ValidationRes {
21    Response {
22        vali_req_hash: DigestIdentifier,
23        modified_metadata_hash: DigestIdentifier,
24    },
25    Create {
26        vali_req_hash: DigestIdentifier,
27        subject_metadata: Box<Metadata>,
28    },
29    Abort(String),
30    TimeOut,
31    Reboot,
32}
33
34#[derive(Debug, Error, Clone)]
35pub enum ValidatorError {
36    #[error("Can not verify {data} signature")]
37    InvalidSignature { data: &'static str },
38    #[error("The signer {signer} is not what was expected")]
39    InvalidSigner { signer: String },
40    #[error("The value {value} does not match the expected value")]
41    InvalidData { value: &'static str },
42    #[error("An internal problem has occurred: {problem}")]
43    InternalError { problem: String },
44    #[error("The action could not be performed: {action}")]
45    InvalidOperation { action: &'static str },
46    #[error("The governance version is different from what was expected")]
47    OutOfVersion,
48}
49
50pub enum ResponseSummary {
51    Reboot,
52    Ok,
53}