StatelessTrie

Trait StatelessTrie 

Source
pub trait StatelessTrie: Debug {
    // Required methods
    fn new(
        witness: &ExecutionWitness,
        pre_state_root: B256,
    ) -> Result<(Self, B256Map<Bytecode>), StatelessValidationError>
       where Self: Sized;
    fn account(
        &self,
        address: Address,
    ) -> Result<Option<TrieAccount>, ProviderError>;
    fn storage(
        &self,
        address: Address,
        slot: U256,
    ) -> Result<U256, ProviderError>;
    fn calculate_state_root(
        &mut self,
        state: HashedPostState,
    ) -> Result<B256, StatelessValidationError>;
}
Expand description

Trait for stateless trie implementations that can be used for stateless validation.

Required Methods§

Source

fn new( witness: &ExecutionWitness, pre_state_root: B256, ) -> Result<(Self, B256Map<Bytecode>), StatelessValidationError>
where Self: Sized,

Initialize the stateless trie using the ExecutionWitness

Source

fn account( &self, address: Address, ) -> Result<Option<TrieAccount>, ProviderError>

Returns the TrieAccount that corresponds to the Address

This method will error if the ExecutionWitness is not able to guarantee that the account is missing from the Trie and the witness was complete.

Source

fn storage(&self, address: Address, slot: U256) -> Result<U256, ProviderError>

Returns the storage slot value that corresponds to the given (address, slot) tuple.

This method will error if the ExecutionWitness is not able to guarantee that the storage was missing from the Trie and the witness was complete.

Source

fn calculate_state_root( &mut self, state: HashedPostState, ) -> Result<B256, StatelessValidationError>

Computes the new state root from the HashedPostState.

Implementors§