maple_runtime/runtime_core/
continuity.rs1use crate::types::*;
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct ContinuityProof {
12 pub resonator_id: ResonatorId,
14
15 pub checkpoint_time: chrono::DateTime<chrono::Utc>,
17
18 pub signature: Vec<u8>,
20
21 pub nonce: u64,
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct ContinuityRecord {
30 pub identity: ResonatorId,
32
33 pub presence_state: PresenceState,
35
36 pub attention_state: AttentionBudget,
38
39 pub couplings: Vec<Coupling>,
41
42 pub pending_commitments: Vec<CommitmentId>,
44
45 pub memory: Option<Vec<u8>>,
47
48 pub checkpoint_time: chrono::DateTime<chrono::Utc>,
50}
51
52impl ContinuityRecord {
53 pub fn new(
55 identity: ResonatorId,
56 presence_state: PresenceState,
57 attention_state: AttentionBudget,
58 couplings: Vec<Coupling>,
59 ) -> Self {
60 Self {
61 identity,
62 presence_state,
63 attention_state,
64 couplings,
65 pending_commitments: Vec::new(),
66 memory: None,
67 checkpoint_time: chrono::Utc::now(),
68 }
69 }
70
71 pub fn generate_proof(&self) -> ContinuityProof {
73 ContinuityProof {
75 resonator_id: self.identity,
76 checkpoint_time: self.checkpoint_time,
77 signature: Vec::new(), nonce: 0, }
80 }
81}