Trait sc_client_api::proof_provider::ProofProvider

source ·
pub trait ProofProvider<Block: BlockT> {
    // Required methods
    fn read_proof(
        &self,
        hash: Block::Hash,
        keys: &mut dyn Iterator<Item = &[u8]>,
    ) -> Result<StorageProof>;
    fn read_child_proof(
        &self,
        hash: Block::Hash,
        child_info: &ChildInfo,
        keys: &mut dyn Iterator<Item = &[u8]>,
    ) -> Result<StorageProof>;
    fn execution_proof(
        &self,
        hash: Block::Hash,
        method: &str,
        call_data: &[u8],
    ) -> Result<(Vec<u8>, StorageProof)>;
    fn read_proof_collection(
        &self,
        hash: Block::Hash,
        start_keys: &[Vec<u8>],
        size_limit: usize,
    ) -> Result<(CompactProof, u32)>;
    fn storage_collection(
        &self,
        hash: Block::Hash,
        start_key: &[Vec<u8>],
        size_limit: usize,
    ) -> Result<Vec<(KeyValueStorageLevel, bool)>>;
    fn verify_range_proof(
        &self,
        root: Block::Hash,
        proof: CompactProof,
        start_keys: &[Vec<u8>],
    ) -> Result<(KeyValueStates, usize)>;
}
Expand description

Interface for providing block proving utilities.

Required Methods§

source

fn read_proof( &self, hash: Block::Hash, keys: &mut dyn Iterator<Item = &[u8]>, ) -> Result<StorageProof>

Reads storage value at a given block + key, returning read proof.

source

fn read_child_proof( &self, hash: Block::Hash, child_info: &ChildInfo, keys: &mut dyn Iterator<Item = &[u8]>, ) -> Result<StorageProof>

Reads child storage value at a given block + storage_key + key, returning read proof.

source

fn execution_proof( &self, hash: Block::Hash, method: &str, call_data: &[u8], ) -> Result<(Vec<u8>, StorageProof)>

Execute a call to a contract on top of state in a block of given hash AND returning execution proof.

No changes are made.

source

fn read_proof_collection( &self, hash: Block::Hash, start_keys: &[Vec<u8>], size_limit: usize, ) -> Result<(CompactProof, u32)>

Given a Hash iterate over all storage values starting at start_keys. Last start_keys element contains last accessed key value. With multiple start_keys, first start_keys element is the current storage key of of the last accessed child trie. at last level the value to start at exclusively. Proofs is build until size limit is reached and always include at least one key following start_keys. Returns combined proof and the numbers of collected keys.

source

fn storage_collection( &self, hash: Block::Hash, start_key: &[Vec<u8>], size_limit: usize, ) -> Result<Vec<(KeyValueStorageLevel, bool)>>

Given a Hash iterate over all storage values starting at start_key. Returns collected keys and values. Returns the collected keys values content of the top trie followed by the collected keys values of child tries. Only child tries with their root part of the collected content or related to start_key are attached. For each collected state a boolean indicates if state reach end.

source

fn verify_range_proof( &self, root: Block::Hash, proof: CompactProof, start_keys: &[Vec<u8>], ) -> Result<(KeyValueStates, usize)>

Verify read storage proof for a set of keys. Returns collected key-value pairs and a the nested state depth of current iteration or 0 if completed.

Implementors§