mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
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:
@@ -382,6 +382,14 @@ pub trait ChildStateBackend<Block: BlockT, Client>: Send + Sync + 'static
|
||||
Block: BlockT + 'static,
|
||||
Client: Send + Sync + 'static,
|
||||
{
|
||||
/// Returns proof of storage for a child key entries at a specific block's state.
|
||||
fn read_child_proof(
|
||||
&self,
|
||||
block: Option<Block::Hash>,
|
||||
storage_key: PrefixedStorageKey,
|
||||
keys: Vec<StorageKey>,
|
||||
) -> FutureResult<ReadProof<Block::Hash>>;
|
||||
|
||||
/// Returns the keys with prefix from a child storage,
|
||||
/// leave prefix empty to get all the keys.
|
||||
fn storage_keys(
|
||||
@@ -431,6 +439,15 @@ impl<Block, Client> ChildStateApi<Block::Hash> for ChildState<Block, Client>
|
||||
{
|
||||
type Metadata = crate::Metadata;
|
||||
|
||||
fn read_child_proof(
|
||||
&self,
|
||||
child_storage_key: PrefixedStorageKey,
|
||||
keys: Vec<StorageKey>,
|
||||
block: Option<Block::Hash>,
|
||||
) -> FutureResult<ReadProof<Block::Hash>> {
|
||||
self.backend.read_child_proof(block, child_storage_key, keys)
|
||||
}
|
||||
|
||||
fn storage(
|
||||
&self,
|
||||
storage_key: PrefixedStorageKey,
|
||||
@@ -466,6 +483,7 @@ impl<Block, Client> ChildStateApi<Block::Hash> for ChildState<Block, Client>
|
||||
) -> FutureResult<Option<u64>> {
|
||||
self.backend.storage_size(block, storage_key, key)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn client_err(err: sp_blockchain::Error) -> Error {
|
||||
|
||||
Reference in New Issue
Block a user