reth_storage_api

Trait HashingWriter

Source
pub trait HashingWriter: Send + Sync {
    // Required methods
    fn unwind_account_hashing<'a>(
        &self,
        changesets: impl Iterator<Item = &'a (BlockNumber, AccountBeforeTx)>,
    ) -> ProviderResult<BTreeMap<B256, Option<Account>>>;
    fn unwind_account_hashing_range(
        &self,
        range: impl RangeBounds<BlockNumber>,
    ) -> ProviderResult<BTreeMap<B256, Option<Account>>>;
    fn insert_account_for_hashing(
        &self,
        accounts: impl IntoIterator<Item = (Address, Option<Account>)>,
    ) -> ProviderResult<BTreeMap<B256, Option<Account>>>;
    fn unwind_storage_hashing(
        &self,
        changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>,
    ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>;
    fn unwind_storage_hashing_range(
        &self,
        range: impl RangeBounds<BlockNumberAddress>,
    ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>;
    fn insert_storage_for_hashing(
        &self,
        storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>,
    ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>;
    fn insert_hashes(
        &self,
        range: RangeInclusive<BlockNumber>,
        end_block_hash: B256,
        expected_state_root: B256,
    ) -> ProviderResult<()>;
}
Expand description

Hashing Writer

Required Methods§

Source

fn unwind_account_hashing<'a>( &self, changesets: impl Iterator<Item = &'a (BlockNumber, AccountBeforeTx)>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Unwind and clear account hashing.

§Returns

Set of hashed keys of updated accounts.

Source

fn unwind_account_hashing_range( &self, range: impl RangeBounds<BlockNumber>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Unwind and clear account hashing in a given block range.

§Returns

Set of hashed keys of updated accounts.

Source

fn insert_account_for_hashing( &self, accounts: impl IntoIterator<Item = (Address, Option<Account>)>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

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

§Returns

Set of hashed keys of updated accounts.

Source

fn unwind_storage_hashing( &self, changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Unwind and clear storage hashing

§Returns

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

Source

fn unwind_storage_hashing_range( &self, range: impl RangeBounds<BlockNumberAddress>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Unwind and clear storage hashing in a given block range.

§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>)>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

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<BlockNumber>, end_block_hash: B256, expected_state_root: B256, ) -> ProviderResult<()>

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.

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<'b, T: 'b + HashingWriter + ?Sized> HashingWriter for &'b T
where &'b T: Send + Sync,

Source§

fn unwind_account_hashing<'a>( &self, changesets: impl Iterator<Item = &'a (BlockNumber, AccountBeforeTx)>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Source§

fn unwind_account_hashing_range( &self, range: impl RangeBounds<BlockNumber>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Source§

fn insert_account_for_hashing( &self, accounts: impl IntoIterator<Item = (Address, Option<Account>)>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Source§

fn unwind_storage_hashing( &self, changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Source§

fn unwind_storage_hashing_range( &self, range: impl RangeBounds<BlockNumberAddress>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Source§

fn insert_storage_for_hashing( &self, storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Source§

fn insert_hashes( &self, range: RangeInclusive<BlockNumber>, end_block_hash: B256, expected_state_root: B256, ) -> ProviderResult<()>

Source§

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

Source§

fn unwind_account_hashing<'a>( &self, changesets: impl Iterator<Item = &'a (BlockNumber, AccountBeforeTx)>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Source§

fn unwind_account_hashing_range( &self, range: impl RangeBounds<BlockNumber>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Source§

fn insert_account_for_hashing( &self, accounts: impl IntoIterator<Item = (Address, Option<Account>)>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Source§

fn unwind_storage_hashing( &self, changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Source§

fn unwind_storage_hashing_range( &self, range: impl RangeBounds<BlockNumberAddress>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Source§

fn insert_storage_for_hashing( &self, storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Source§

fn insert_hashes( &self, range: RangeInclusive<BlockNumber>, end_block_hash: B256, expected_state_root: B256, ) -> ProviderResult<()>

Source§

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

Source§

fn unwind_account_hashing<'a>( &self, changesets: impl Iterator<Item = &'a (BlockNumber, AccountBeforeTx)>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Source§

fn unwind_account_hashing_range( &self, range: impl RangeBounds<BlockNumber>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Source§

fn insert_account_for_hashing( &self, accounts: impl IntoIterator<Item = (Address, Option<Account>)>, ) -> ProviderResult<BTreeMap<B256, Option<Account>>>

Source§

fn unwind_storage_hashing( &self, changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Source§

fn unwind_storage_hashing_range( &self, range: impl RangeBounds<BlockNumberAddress>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Source§

fn insert_storage_for_hashing( &self, storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>, ) -> ProviderResult<HashMap<B256, BTreeSet<B256>>>

Source§

fn insert_hashes( &self, range: RangeInclusive<BlockNumber>, end_block_hash: B256, expected_state_root: B256, ) -> ProviderResult<()>

Implementors§