Type Alias MemoryOverlayStateProvider

Source
pub type MemoryOverlayStateProvider<N> = MemoryOverlayStateProviderRef<'static, N>;
Expand description

A state provider that stores references to in-memory blocks along with their state as well as the historical state provider for fallback lookups.

Aliased Type§

struct MemoryOverlayStateProvider<N> { /* private fields */ }

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 248 bytes

Implementations

Source§

impl<'a, N: NodePrimitives> MemoryOverlayStateProviderRef<'a, N>

Source

pub fn new( historical: Box<dyn StateProvider + 'a>, in_memory: Vec<ExecutedBlockWithTrieUpdates<N>>, ) -> Self

Create new memory overlay state provider.

§Arguments
  • in_memory - the collection of executed ancestor blocks in reverse.
  • historical - a historical state provider for the latest ancestor block stored in the database.
Source

pub fn boxed(self) -> Box<dyn StateProvider + 'a>

Turn this state provider into a state provider

Trait Implementations

Source§

impl<N: NodePrimitives> AccountReader for MemoryOverlayStateProviderRef<'_, N>

Source§

fn basic_account(&self, address: &Address) -> ProviderResult<Option<Account>>

Get basic account information. Read more
Source§

impl<N: NodePrimitives> BlockHashReader for MemoryOverlayStateProviderRef<'_, N>

Source§

fn block_hash(&self, number: BlockNumber) -> ProviderResult<Option<B256>>

Get the hash of the block with the given number. Returns None if no block with this number exists.
Source§

fn canonical_hashes_range( &self, start: BlockNumber, end: BlockNumber, ) -> ProviderResult<Vec<B256>>

Get headers in range of block hashes or numbers Read more
§

fn convert_block_hash( &self, hash_or_number: HashOrNumber, ) -> Result<Option<FixedBytes<32>>, ProviderError>

Get the hash of the block with the given number. Returns None if no block with this number exists.
Source§

impl<N: NodePrimitives> HashedPostStateProvider for MemoryOverlayStateProviderRef<'_, N>

Source§

fn hashed_post_state(&self, bundle_state: &BundleState) -> HashedPostState

Returns the HashedPostState of the provided [BundleState].
Source§

impl<N: NodePrimitives> StateProofProvider for MemoryOverlayStateProviderRef<'_, N>

Source§

fn proof( &self, input: TrieInput, address: Address, slots: &[B256], ) -> ProviderResult<AccountProof>

Get account and storage proofs of target keys in the HashedPostState on top of the current state.
Source§

fn multiproof( &self, input: TrieInput, targets: MultiProofTargets, ) -> ProviderResult<MultiProof>

Generate [MultiProof] for target hashed account and corresponding hashed storage slot keys.
Source§

fn witness( &self, input: TrieInput, target: HashedPostState, ) -> ProviderResult<Vec<Bytes>>

Get trie witness for provided state.
Source§

impl<N: NodePrimitives> StateProvider for MemoryOverlayStateProviderRef<'_, N>

Source§

fn storage( &self, address: Address, storage_key: StorageKey, ) -> ProviderResult<Option<StorageValue>>

Get storage of given account.
Source§

fn bytecode_by_hash(&self, code_hash: &B256) -> ProviderResult<Option<Bytecode>>

Get account code by its hash
§

fn account_code( &self, addr: &Address, ) -> Result<Option<Bytecode>, ProviderError>

Get account code by its address. Read more
§

fn account_balance( &self, addr: &Address, ) -> Result<Option<Uint<256, 4>>, ProviderError>

Get account balance by its address. Read more
§

fn account_nonce(&self, addr: &Address) -> Result<Option<u64>, ProviderError>

Get account nonce by its address. Read more
Source§

impl<N: NodePrimitives> StateRootProvider for MemoryOverlayStateProviderRef<'_, N>

Source§

fn state_root(&self, state: HashedPostState) -> ProviderResult<B256>

Returns the state root of the BundleState on top of the current state. Read more
Source§

fn state_root_from_nodes(&self, input: TrieInput) -> ProviderResult<B256>

Returns the state root of the HashedPostState on top of the current state but reuses the intermediate nodes to speed up the computation. It’s up to the caller to construct the prefix sets and inform the provider of the trie paths that have changes.
Source§

fn state_root_with_updates( &self, state: HashedPostState, ) -> ProviderResult<(B256, TrieUpdates)>

Returns the state root of the HashedPostState on top of the current state with trie updates to be committed to the database.
Source§

fn state_root_from_nodes_with_updates( &self, input: TrieInput, ) -> ProviderResult<(B256, TrieUpdates)>

Returns state root and trie updates. See [StateRootProvider::state_root_from_nodes] for more info.
Source§

impl<N: NodePrimitives> StorageRootProvider for MemoryOverlayStateProviderRef<'_, N>

Source§

fn storage_root( &self, address: Address, storage: HashedStorage, ) -> ProviderResult<B256>

Returns the storage root of the HashedStorage for target address on top of the current state.
Source§

fn storage_proof( &self, address: Address, slot: B256, storage: HashedStorage, ) -> ProviderResult<StorageProof>

Returns the storage proof of the HashedStorage for target slot on top of the current state.
Source§

fn storage_multiproof( &self, address: Address, slots: &[B256], storage: HashedStorage, ) -> ProviderResult<StorageMultiProof>

Returns the storage multiproof for target slots.