reth_provider

Trait StateRootProvider

pub trait StateRootProvider: Send + Sync {
    // Required methods
    fn state_root(
        &self,
        hashed_state: HashedPostState,
    ) -> Result<FixedBytes<32>, ProviderError>;
    fn state_root_from_nodes(
        &self,
        input: TrieInput,
    ) -> Result<FixedBytes<32>, ProviderError>;
    fn state_root_with_updates(
        &self,
        hashed_state: HashedPostState,
    ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>;
    fn state_root_from_nodes_with_updates(
        &self,
        input: TrieInput,
    ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>;
}
Expand description

A type that can compute the state root of a given post state.

Required Methods§

fn state_root( &self, hashed_state: HashedPostState, ) -> Result<FixedBytes<32>, ProviderError>

Returns the state root of the BundleState on top of the current state.

§Note

It is recommended to provide a different implementation from state_root_with_updates since it affects the memory usage during state root computation.

fn state_root_from_nodes( &self, input: TrieInput, ) -> Result<FixedBytes<32>, ProviderError>

Returns the state root of the HashedPostState on top of the current state but re-uses 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.

fn state_root_with_updates( &self, hashed_state: HashedPostState, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

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

fn state_root_from_nodes_with_updates( &self, input: TrieInput, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

Returns state root and trie updates. See StateRootProvider::state_root_from_nodes for more info.

Implementations on Foreign Types§

§

impl StateRootProvider for StateProviderTest

§

fn state_root( &self, _hashed_state: HashedPostState, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_from_nodes( &self, _input: TrieInput, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_with_updates( &self, _hashed_state: HashedPostState, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

fn state_root_from_nodes_with_updates( &self, _input: TrieInput, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

impl<'a, N> StateRootProvider for MemoryOverlayStateProviderRef<'a, N>
where N: NodePrimitives,

§

fn state_root( &self, state: HashedPostState, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_from_nodes( &self, input: TrieInput, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_with_updates( &self, state: HashedPostState, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

fn state_root_from_nodes_with_updates( &self, input: TrieInput, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

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

§

fn state_root( &self, hashed_state: HashedPostState, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_from_nodes( &self, input: TrieInput, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_with_updates( &self, hashed_state: HashedPostState, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

fn state_root_from_nodes_with_updates( &self, input: TrieInput, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

impl<N> StateRootProvider for MemoryOverlayStateProvider<N>
where N: NodePrimitives,

§

fn state_root( &self, state: HashedPostState, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_from_nodes( &self, input: TrieInput, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_with_updates( &self, state: HashedPostState, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

fn state_root_from_nodes_with_updates( &self, input: TrieInput, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

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

§

fn state_root( &self, hashed_state: HashedPostState, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_from_nodes( &self, input: TrieInput, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_with_updates( &self, hashed_state: HashedPostState, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

fn state_root_from_nodes_with_updates( &self, input: TrieInput, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

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

§

fn state_root( &self, hashed_state: HashedPostState, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_from_nodes( &self, input: TrieInput, ) -> Result<FixedBytes<32>, ProviderError>

§

fn state_root_with_updates( &self, hashed_state: HashedPostState, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

§

fn state_root_from_nodes_with_updates( &self, input: TrieInput, ) -> Result<(FixedBytes<32>, TrieUpdates), ProviderError>

Implementors§