StateDB

Trait StateDB 

pub trait StateDB: Database {
    // Required methods
    fn set_state_clear_flag(&mut self, has_state_clear: bool);
    fn increment_balances(
        &mut self,
        balances: impl IntoIterator<Item = (Address, u128)>,
    ) -> Result<(), Self::Error>;
}
Available on crate feature evm only.
Expand description

A type which has the state of the blockchain.

This trait encapsulates some of the functionality found in State

Required Methods§

fn set_state_clear_flag(&mut self, has_state_clear: bool)

State clear EIP-161 is enabled in Spurious Dragon hardfork.

fn increment_balances( &mut self, balances: impl IntoIterator<Item = (Address, u128)>, ) -> Result<(), Self::Error>

Iterates over received balances and increment all account balances.

Note: If account is not found inside cache state it will be loaded from database.

Update will create transitions for all accounts that are updated.

If using this to implement withdrawals, zero balances must be filtered out before calling this function.

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§

§

impl<T> StateDB for &mut T
where T: StateDB,

auto_impl unable to reconcile return associated type from supertrait

§

fn set_state_clear_flag(&mut self, has_state_clear: bool)

§

fn increment_balances( &mut self, balances: impl IntoIterator<Item = (Address, u128)>, ) -> Result<(), <&mut T as Database>::Error>

Implementors§

§

impl<DB> StateDB for State<DB>
where DB: Database,