Skip to main content

DatabaseHashedPostState

Trait DatabaseHashedPostState 

Source
pub trait DatabaseHashedPostState: Sized {
    // Required method
    fn from_reverts(
        provider: &(impl ChangeSetReader + StorageChangeSetReader),
        range: RangeInclusive<BlockNumber>,
    ) -> Result<HashedPostStateSorted, ProviderError>;
}
Expand description

Extends [HashedPostStateSorted] with operations specific for working with a database transaction.

Required Methods§

Source

fn from_reverts( provider: &(impl ChangeSetReader + StorageChangeSetReader), range: RangeInclusive<BlockNumber>, ) -> Result<HashedPostStateSorted, ProviderError>

Initializes [HashedPostStateSorted] from reverts. Iterates over state reverts in the specified range and aggregates them into sorted hashed state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl DatabaseHashedPostState for HashedPostStateSorted

Source§

fn from_reverts( provider: &(impl ChangeSetReader + StorageChangeSetReader), range: RangeInclusive<BlockNumber>, ) -> Result<Self, ProviderError>

Builds a sorted hashed post-state from reverts.

Reads changesets one block at a time, so memory grows with the number of distinct changed keys rather than with the number of changeset rows in the range. HashSets track seen keys; changeset rows are already sorted, so no intermediate HashMap is needed.

  • Reads the first occurrence of each changed account/storage slot in the range.
  • Addresses are always keccak256-hashed.
  • Storage keys are always plain and are hashed via keccak256.
  • Returns keys already ordered for trie iteration.

Implementors§