reth::providers

Trait HashingWriter

source
pub trait HashingWriter: Send + Sync {
    // Required methods
    fn unwind_account_hashing(
        &self,
        range: RangeInclusive<u64>,
    ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>;
    fn insert_account_for_hashing(
        &self,
        accounts: impl IntoIterator<Item = (Address, Option<Account>)>,
    ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>;
    fn unwind_storage_hashing(
        &self,
        range: Range<BlockNumberAddress>,
    ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>>, ProviderError>;
    fn insert_storage_for_hashing(
        &self,
        storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>,
    ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>>, ProviderError>;
    fn insert_hashes(
        &self,
        range: RangeInclusive<u64>,
        end_block_hash: FixedBytes<32>,
        expected_state_root: FixedBytes<32>,
    ) -> Result<(), ProviderError>;
}
Expand description

Hashing Writer

Required Methods§

source

fn unwind_account_hashing( &self, range: RangeInclusive<u64>, ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>

Unwind and clear account hashing.

§Returns

Set of hashed keys of updated accounts.

source

fn insert_account_for_hashing( &self, accounts: impl IntoIterator<Item = (Address, Option<Account>)>, ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>

Inserts all accounts into reth_db::tables::AccountsHistory table.

§Returns

Set of hashed keys of updated accounts.

source

fn unwind_storage_hashing( &self, range: Range<BlockNumberAddress>, ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>>, ProviderError>

Unwind and clear storage hashing

§Returns

Mapping of hashed keys of updated accounts to their respective updated hashed slots.

source

fn insert_storage_for_hashing( &self, storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>, ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>>, ProviderError>

Iterates over storages and inserts them to hashing table.

§Returns

Mapping of hashed keys of updated accounts to their respective updated hashed slots.

source

fn insert_hashes( &self, range: RangeInclusive<u64>, end_block_hash: FixedBytes<32>, expected_state_root: FixedBytes<32>, ) -> Result<(), ProviderError>

Calculate the hashes of all changed accounts and storages, and finally calculate the state root.

The hashes are calculated from fork_block_number + 1 to current_block_number.

The resulting state root is compared with expected_state_root.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, T> HashingWriter for &'a T
where T: 'a + HashingWriter + ?Sized, &'a T: Send + Sync,

source§

impl<T> HashingWriter for Box<T>
where T: HashingWriter + ?Sized, Box<T>: Send + Sync,

source§

impl<T> HashingWriter for Arc<T>
where T: HashingWriter + ?Sized, Arc<T>: Send + Sync,

Implementors§

source§

impl<TX, Spec> HashingWriter for DatabaseProvider<TX, Spec>
where TX: DbTxMut + DbTx, Spec: Send + Sync,