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_without_propierties_hash: DigestIdentifier,
24        propierties_hash: DigestIdentifier,
25        event_request_hash: DigestIdentifier,
26        viewpoints_hash: DigestIdentifier,
27    },
28    Create {
29        vali_req_hash: DigestIdentifier,
30        subject_metadata: Box<Metadata>,
31    },
32    Abort(String),
33    TimeOut,
34    Reboot,
35}
36
37#[derive(Debug, Error, Clone)]
38pub enum ValidatorError {
39    #[error("Can not verify {data} signature")]
40    InvalidSignature { data: &'static str },
41    #[error("The signer {signer} is not what was expected")]
42    InvalidSigner { signer: String },
43    #[error("The value {value} does not match the expected value")]
44    InvalidData { value: &'static str },
45    #[error("An internal problem has occurred: {problem}")]
46    InternalError { problem: String },
47    #[error("The action could not be performed: {action}")]
48    InvalidOperation { action: &'static str },
49    #[error("The governance version is different from what was expected")]
50    OutOfVersion,
51}
52
53pub enum ResponseSummary {
54    Reboot,
55    Ok,
56}