2019-03-22 14:30:18 -06:00
|
|
|
use serde_derive::{Deserialize, Serialize};
|
|
|
|
use solana_sdk::hash::Hash;
|
|
|
|
use solana_sdk::pubkey::Pubkey;
|
|
|
|
use solana_sdk::signature::Signature;
|
|
|
|
|
2019-04-02 13:08:55 -07:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
2019-03-22 14:30:18 -06:00
|
|
|
pub enum ProofStatus {
|
2019-04-02 13:08:55 -07:00
|
|
|
Skipped,
|
2019-03-22 14:30:18 -06:00
|
|
|
Valid,
|
|
|
|
NotValid,
|
2019-04-02 13:08:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for ProofStatus {
|
|
|
|
fn default() -> Self {
|
|
|
|
ProofStatus::Skipped
|
|
|
|
}
|
2019-03-22 14:30:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct ProofInfo {
|
|
|
|
pub id: Pubkey,
|
|
|
|
pub signature: Signature,
|
|
|
|
pub sha_state: Hash,
|
2019-04-02 13:08:55 -07:00
|
|
|
pub status: ProofStatus,
|
2019-03-22 14:30:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct ValidationInfo {
|
|
|
|
pub id: Pubkey,
|
|
|
|
pub proof_mask: Vec<ProofStatus>,
|
|
|
|
}
|
|
|
|
|
2019-04-02 13:08:55 -07:00
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub enum StorageContract {
|
|
|
|
//don't move this
|
|
|
|
Default,
|
2019-03-22 14:30:18 -06:00
|
|
|
|
2019-04-02 13:08:55 -07:00
|
|
|
ValidatorStorage {
|
|
|
|
entry_height: u64,
|
|
|
|
hash: Hash,
|
|
|
|
lockout_validations: Vec<Vec<ProofInfo>>,
|
|
|
|
reward_validations: Vec<Vec<ProofInfo>>,
|
|
|
|
},
|
|
|
|
ReplicatorStorage {
|
|
|
|
proofs: Vec<ProofInfo>,
|
|
|
|
reward_validations: Vec<Vec<ProofInfo>>,
|
|
|
|
},
|
2019-03-22 14:30:18 -06:00
|
|
|
}
|