1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use borsh::{BorshDeserialize, BorshSerialize};
use serde::{Deserialize, Serialize};

use crate::{
    commons::models::evaluation::EvaluationRequest, identifier::DigestIdentifier,
    signature::Signature, KeyIdentifier, ValueWrapper,
};

use self::errors::EvaluatorErrorResponses;
#[cfg(feature = "evaluation")]
pub mod compiler;

mod errors;
#[cfg(feature = "evaluation")]
mod manager;
#[cfg(feature = "evaluation")]
pub use manager::EvaluatorManager;
#[cfg(feature = "evaluation")]
mod runner;

#[derive(Clone, Debug, Serialize, Deserialize, BorshSerialize, BorshDeserialize)]
pub enum EvaluatorMessage {
    EvaluationEvent {
        evaluation_request: EvaluationRequest,
        sender: KeyIdentifier,
    },
    AskForEvaluation(EvaluationRequest),
}

#[derive(Clone, Debug)]
pub enum EvaluatorResponse {
    AskForEvaluation(Result<(), EvaluatorErrorResponses>),
}
#[derive(Clone, Debug)]
pub struct AskForEvaluationResponse {
    pub governance_version: u64,
    pub hash_new_state: DigestIdentifier,
    pub json_patch: ValueWrapper,
    pub success: bool,
    pub approval_required: bool,
    pub signature: Signature,
}