Trait HashingWriter
pub trait HashingWriter: Send + Sync {
// Required methods
fn unwind_account_hashing<'a>(
&self,
changesets: impl Iterator<Item = &'a (u64, AccountBeforeTx)>,
) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>;
fn unwind_account_hashing_range(
&self,
range: impl RangeBounds<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,
changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>,
) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>;
fn unwind_storage_hashing_range(
&self,
range: impl RangeBounds<BlockNumberAddress>,
) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>;
fn insert_storage_for_hashing(
&self,
storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>,
) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, 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§
fn unwind_account_hashing<'a>(
&self,
changesets: impl Iterator<Item = &'a (u64, AccountBeforeTx)>,
) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>
fn unwind_account_hashing<'a>( &self, changesets: impl Iterator<Item = &'a (u64, AccountBeforeTx)>, ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>
fn unwind_account_hashing_range(
&self,
range: impl RangeBounds<u64>,
) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>
fn unwind_account_hashing_range( &self, range: impl RangeBounds<u64>, ) -> Result<BTreeMap<FixedBytes<32>, Option<Account>>, ProviderError>
Unwind and clear account hashing in a given block range.
§Returns
Set of hashed keys of updated accounts.
fn insert_account_for_hashing(
&self,
accounts: impl IntoIterator<Item = (Address, Option<Account>)>,
) -> 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>
Inserts all accounts into [reth_db::tables::AccountsHistory] table.
§Returns
Set of hashed keys of updated accounts.
fn unwind_storage_hashing(
&self,
changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>,
) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
fn unwind_storage_hashing( &self, changesets: impl Iterator<Item = (BlockNumberAddress, StorageEntry)>, ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
Unwind and clear storage hashing
§Returns
Mapping of hashed keys of updated accounts to their respective updated hashed slots.
fn unwind_storage_hashing_range(
&self,
range: impl RangeBounds<BlockNumberAddress>,
) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
fn unwind_storage_hashing_range( &self, range: impl RangeBounds<BlockNumberAddress>, ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
Unwind and clear storage hashing in a given block range.
§Returns
Mapping of hashed keys of updated accounts to their respective updated hashed slots.
fn insert_storage_for_hashing(
&self,
storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>,
) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
fn insert_storage_for_hashing( &self, storages: impl IntoIterator<Item = (Address, impl IntoIterator<Item = StorageEntry>)>, ) -> Result<HashMap<FixedBytes<32>, BTreeSet<FixedBytes<32>>, RandomState>, ProviderError>
Iterates over storages and inserts them to hashing table.
§Returns
Mapping of hashed keys of updated accounts to their respective updated hashed slots.
fn insert_hashes(
&self,
range: RangeInclusive<u64>,
end_block_hash: FixedBytes<32>,
expected_state_root: FixedBytes<32>,
) -> Result<(), ProviderError>
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
.
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.