mina_tree/sparse_ledger/
mod.rs1#[allow(clippy::module_inception)]
2mod sparse_ledger;
3mod sparse_ledger_impl;
4
5use mina_curves::pasta::Fp;
6pub use sparse_ledger::*;
7
8use crate::{
9 proofs::zkapp::LedgerWithHash, scan_state::transaction_logic::AccountState, Account, AccountId,
10};
11
12pub trait LedgerIntf {
17 type Location: Clone + std::fmt::Debug;
18
19 fn get(&self, addr: &Self::Location) -> Option<Box<Account>>;
20 fn location_of_account(&self, account_id: &AccountId) -> Option<Self::Location>;
21 fn set(&mut self, addr: &Self::Location, account: Box<Account>);
22 fn get_or_create(
23 &mut self,
24 account_id: &AccountId,
25 ) -> Result<(AccountState, Box<Account>, Self::Location), String>;
26 fn create_new_account(&mut self, account_id: AccountId, account: Account) -> Result<(), ()>;
27 fn remove_accounts_exn(&mut self, account_ids: &[AccountId]);
28 fn merkle_root(&mut self) -> Fp;
29 fn empty(depth: usize) -> Self;
30 fn create_masked(&self) -> Self;
31 fn apply_mask(&mut self, mask: Self);
32
33 fn account_locations(&self) -> Vec<Self::Location>;
37}
38
39#[allow(unused)]
40impl LedgerIntf for LedgerWithHash {
41 type Location = <SparseLedger as LedgerIntf>::Location;
42
43 fn get(&self, addr: &Self::Location) -> Option<Box<Account>> {
44 todo!()
45 }
46 fn location_of_account(&self, account_id: &AccountId) -> Option<Self::Location> {
47 todo!()
48 }
49 fn set(&mut self, addr: &Self::Location, account: Box<Account>) {
50 todo!()
51 }
52 fn get_or_create(
53 &mut self,
54 account_id: &AccountId,
55 ) -> Result<(AccountState, Box<Account>, Self::Location), String> {
56 todo!()
57 }
58 fn create_new_account(&mut self, account_id: AccountId, account: Account) -> Result<(), ()> {
59 todo!()
60 }
61 fn remove_accounts_exn(&mut self, account_ids: &[AccountId]) {
62 todo!()
63 }
64 fn merkle_root(&mut self) -> Fp {
65 todo!()
66 }
67 fn empty(depth: usize) -> Self {
68 todo!()
69 }
70 fn create_masked(&self) -> Self {
71 todo!()
72 }
73 fn apply_mask(&mut self, mask: Self) {
74 todo!()
75 }
76 fn account_locations(&self) -> Vec<Self::Location> {
77 todo!()
78 }
79}