AccountTreeStorage

Trait AccountTreeStorage 

Source
pub trait AccountTreeStorage {
    // Required methods
    fn root(&self) -> Word;
    fn num_accounts(&self) -> usize;
    fn open(&self, account_id: AccountId) -> AccountWitness;
    fn get(&self, account_id: AccountId) -> Word;
    fn compute_mutations(
        &self,
        accounts: impl IntoIterator<Item = (AccountId, Word)>,
    ) -> Result<AccountMutationSet, AccountTreeError>;
    fn apply_mutations_with_reversion(
        &mut self,
        mutations: AccountMutationSet,
    ) -> Result<AccountMutationSet, AccountTreeError>;
    fn contains_account_id_prefix(&self, prefix: AccountIdPrefix) -> bool;
}
Expand description

Trait abstracting operations over different account tree backends.

Required Methods§

Source

fn root(&self) -> Word

Returns the root hash of the tree.

Source

fn num_accounts(&self) -> usize

Returns the number of accounts in the tree.

Source

fn open(&self, account_id: AccountId) -> AccountWitness

Opens an account and returns its witness.

Source

fn get(&self, account_id: AccountId) -> Word

Gets the account state commitment.

Source

fn compute_mutations( &self, accounts: impl IntoIterator<Item = (AccountId, Word)>, ) -> Result<AccountMutationSet, AccountTreeError>

Computes mutations for applying account updates.

Source

fn apply_mutations_with_reversion( &mut self, mutations: AccountMutationSet, ) -> Result<AccountMutationSet, AccountTreeError>

Applies mutations with reversion data.

Source

fn contains_account_id_prefix(&self, prefix: AccountIdPrefix) -> bool

Checks if the tree contains an account with the given prefix.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<S> AccountTreeStorage for AccountTree<LargeSmt<S>>
where S: SmtStorage,

Implementors§