Skip to main content

StateRangeProvider

Trait StateRangeProvider 

Source
pub trait StateRangeProvider {
    // Required methods
    fn account_range(
        &self,
        start: FixedBytes<32>,
        limit: FixedBytes<32>,
        response_bytes: usize,
    ) -> Result<RangeResponse<(FixedBytes<32>, Account)>, ProviderError>;
    fn storage_root_by_hash(
        &self,
        hashed_address: FixedBytes<32>,
    ) -> Result<FixedBytes<32>, ProviderError>;
    fn storage_range(
        &self,
        hashed_address: FixedBytes<32>,
        start: FixedBytes<32>,
        limit: FixedBytes<32>,
        response_bytes: usize,
    ) -> Result<Option<RangeResponse<(FixedBytes<32>, Uint<256, 4>)>>, ProviderError>;
    fn account_range_proof(
        &self,
        keys: &[FixedBytes<32>],
    ) -> Result<Vec<Bytes>, ProviderError>;
    fn storage_range_proof(
        &self,
        hashed_address: FixedBytes<32>,
        keys: &[FixedBytes<32>],
    ) -> Result<Vec<Bytes>, ProviderError>;
}
Expand description

A type that can iterate over consecutive hashed accounts and storage slots, and generate boundary proofs for them, for serving snap/2 (EIP-8189) GetAccountRange/GetStorageRanges requests. Hash-native throughout, unlike StorageRootProvider.

Required Methods§

Source

fn account_range( &self, start: FixedBytes<32>, limit: FixedBytes<32>, response_bytes: usize, ) -> Result<RangeResponse<(FixedBytes<32>, Account)>, ProviderError>

Returns accounts (hash, account) in [start, limit], bounded by response_bytes.

Source

fn storage_root_by_hash( &self, hashed_address: FixedBytes<32>, ) -> Result<FixedBytes<32>, ProviderError>

Returns the storage root for hashed_address without needing its address preimage.

Source

fn storage_range( &self, hashed_address: FixedBytes<32>, start: FixedBytes<32>, limit: FixedBytes<32>, response_bytes: usize, ) -> Result<Option<RangeResponse<(FixedBytes<32>, Uint<256, 4>)>>, ProviderError>

Same as Self::account_range, but for the storage slots of hashed_address.

Returns None if hashed_address isn’t present in the account trie at the pinned state root, distinct from an account that is present but has no storage.

Source

fn account_range_proof( &self, keys: &[FixedBytes<32>], ) -> Result<Vec<Bytes>, ProviderError>

Returns an account-trie boundary proof for the already-hashed keys.

Source

fn storage_range_proof( &self, hashed_address: FixedBytes<32>, keys: &[FixedBytes<32>], ) -> Result<Vec<Bytes>, ProviderError>

Same as Self::account_range_proof, but for the storage trie of hashed_address.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<'a, T> StateRangeProvider for &'a T
where T: 'a + StateRangeProvider + ?Sized,

Source§

fn account_range( &self, start: FixedBytes<32>, limit: FixedBytes<32>, response_bytes: usize, ) -> Result<RangeResponse<(FixedBytes<32>, Account)>, ProviderError>

Source§

fn storage_root_by_hash( &self, hashed_address: FixedBytes<32>, ) -> Result<FixedBytes<32>, ProviderError>

Source§

fn storage_range( &self, hashed_address: FixedBytes<32>, start: FixedBytes<32>, limit: FixedBytes<32>, response_bytes: usize, ) -> Result<Option<RangeResponse<(FixedBytes<32>, Uint<256, 4>)>>, ProviderError>

Source§

fn account_range_proof( &self, keys: &[FixedBytes<32>], ) -> Result<Vec<Bytes>, ProviderError>

Source§

fn storage_range_proof( &self, hashed_address: FixedBytes<32>, keys: &[FixedBytes<32>], ) -> Result<Vec<Bytes>, ProviderError>

Source§

impl<T> StateRangeProvider for Arc<T>

Source§

fn account_range( &self, start: FixedBytes<32>, limit: FixedBytes<32>, response_bytes: usize, ) -> Result<RangeResponse<(FixedBytes<32>, Account)>, ProviderError>

Source§

fn storage_root_by_hash( &self, hashed_address: FixedBytes<32>, ) -> Result<FixedBytes<32>, ProviderError>

Source§

fn storage_range( &self, hashed_address: FixedBytes<32>, start: FixedBytes<32>, limit: FixedBytes<32>, response_bytes: usize, ) -> Result<Option<RangeResponse<(FixedBytes<32>, Uint<256, 4>)>>, ProviderError>

Source§

fn account_range_proof( &self, keys: &[FixedBytes<32>], ) -> Result<Vec<Bytes>, ProviderError>

Source§

fn storage_range_proof( &self, hashed_address: FixedBytes<32>, keys: &[FixedBytes<32>], ) -> Result<Vec<Bytes>, ProviderError>

Source§

impl<T> StateRangeProvider for Box<T>

Source§

fn account_range( &self, start: FixedBytes<32>, limit: FixedBytes<32>, response_bytes: usize, ) -> Result<RangeResponse<(FixedBytes<32>, Account)>, ProviderError>

Source§

fn storage_root_by_hash( &self, hashed_address: FixedBytes<32>, ) -> Result<FixedBytes<32>, ProviderError>

Source§

fn storage_range( &self, hashed_address: FixedBytes<32>, start: FixedBytes<32>, limit: FixedBytes<32>, response_bytes: usize, ) -> Result<Option<RangeResponse<(FixedBytes<32>, Uint<256, 4>)>>, ProviderError>

Source§

fn account_range_proof( &self, keys: &[FixedBytes<32>], ) -> Result<Vec<Bytes>, ProviderError>

Source§

fn storage_range_proof( &self, hashed_address: FixedBytes<32>, keys: &[FixedBytes<32>], ) -> Result<Vec<Bytes>, ProviderError>

Implementors§

Source§

impl<T: NodePrimitives, ChainSpec> StateRangeProvider for MockEthProvider<T, ChainSpec>

Available on crate features test-utils only.