aura_agent/runtime/effects/
tree.rs1use super::AuraEffectSystem;
2use async_trait::async_trait;
3use aura_core::AuraError;
4use aura_journal::commitment_tree::state::TreeState as JournalTreeState;
5
6#[async_trait]
7impl aura_protocol::effects::TreeEffects for AuraEffectSystem {
8 async fn get_current_state(&self) -> Result<JournalTreeState, AuraError> {
9 self.tree_handler.get_current_state().await
10 }
11
12 async fn get_current_commitment(&self) -> Result<aura_core::Hash32, AuraError> {
13 self.tree_handler.get_current_commitment().await
14 }
15
16 async fn get_current_epoch(&self) -> Result<aura_core::Epoch, AuraError> {
17 self.tree_handler.get_current_epoch().await
18 }
19
20 async fn apply_attested_op(
21 &self,
22 op: aura_core::AttestedOp,
23 ) -> Result<aura_core::Hash32, AuraError> {
24 self.tree_handler.apply_attested_op(op).await
25 }
26
27 async fn verify_aggregate_sig(
28 &self,
29 op: &aura_core::AttestedOp,
30 state: &JournalTreeState,
31 ) -> Result<bool, AuraError> {
32 self.tree_handler.verify_aggregate_sig(op, state).await
33 }
34
35 async fn add_leaf(
36 &self,
37 leaf: aura_core::LeafNode,
38 under: aura_core::NodeIndex,
39 ) -> Result<aura_core::TreeOpKind, AuraError> {
40 self.tree_handler.add_leaf(leaf, under).await
41 }
42
43 async fn remove_leaf(
44 &self,
45 leaf_id: aura_core::LeafId,
46 reason: u8,
47 ) -> Result<aura_core::TreeOpKind, AuraError> {
48 self.tree_handler.remove_leaf(leaf_id, reason).await
49 }
50
51 async fn change_policy(
52 &self,
53 node: aura_core::NodeIndex,
54 policy: aura_core::Policy,
55 ) -> Result<aura_core::TreeOpKind, AuraError> {
56 self.tree_handler.change_policy(node, policy).await
57 }
58
59 async fn rotate_epoch(
60 &self,
61 affected: Vec<aura_core::NodeIndex>,
62 ) -> Result<aura_core::TreeOpKind, AuraError> {
63 self.tree_handler.rotate_epoch(affected).await
64 }
65
66 async fn propose_snapshot(
67 &self,
68 cut: aura_protocol::effects::tree::Cut,
69 ) -> Result<aura_protocol::effects::tree::ProposalId, AuraError> {
70 self.tree_handler.propose_snapshot(cut).await
71 }
72
73 async fn approve_snapshot(
74 &self,
75 proposal_id: aura_protocol::effects::tree::ProposalId,
76 ) -> Result<aura_protocol::effects::tree::Partial, AuraError> {
77 self.tree_handler.approve_snapshot(proposal_id).await
78 }
79
80 async fn finalize_snapshot(
81 &self,
82 proposal_id: aura_protocol::effects::tree::ProposalId,
83 ) -> Result<aura_protocol::effects::tree::Snapshot, AuraError> {
84 self.tree_handler.finalize_snapshot(proposal_id).await
85 }
86
87 async fn apply_snapshot(
88 &self,
89 snapshot: &aura_protocol::effects::tree::Snapshot,
90 ) -> Result<(), AuraError> {
91 self.tree_handler.apply_snapshot(snapshot).await
92 }
93}