Extends ChildStateBackend and ChildStateAPI with ReadProofs (#8812)

* Extends ChildStateBackend and ChildStateAPI with ReadProofs

The following changes integrate the existing `read_child_proof`
from the `ProofProvider` into the ChildStateBackend, so that a
read proof can be generated from a full client via an rpc call.

* Cleanup formatting
This commit is contained in:
Frederik Schulz
2021-05-17 11:59:10 +02:00
committed by GitHub
parent fcf83c0278
commit 59f34ab8bc
4 changed files with 64 additions and 0 deletions
@@ -23,6 +23,7 @@ use sp_core::storage::{StorageKey, PrefixedStorageKey, StorageData};
use crate::state::error::FutureResult;
pub use self::gen_client::Client as ChildStateClient;
use crate::state::ReadProof;
/// Substrate child state API
///
@@ -68,4 +69,13 @@ pub trait ChildStateApi<Hash> {
key: StorageKey,
hash: Option<Hash>
) -> FutureResult<Option<u64>>;
/// Returns proof of storage for child key entries at a specific block's state.
#[rpc(name = "state_getChildReadProof")]
fn read_child_proof(
&self,
child_storage_key: PrefixedStorageKey,
keys: Vec<StorageKey>,
hash: Option<Hash>,
) -> FutureResult<ReadProof<Hash>>;
}