Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Companion for substrate#13284 #6653

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 14 additions & 38 deletions node/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
use polkadot_primitives::{
runtime_api::ParachainHost, AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce,
};
use sc_client_api::{AuxStore, Backend as BackendT, BlockchainEvents, KeyIterator, UsageProvider};
use sc_client_api::{
AuxStore, Backend as BackendT, BlockchainEvents, KeysIter, PairsIter, UsageProvider,
};
use sc_executor::NativeElseWasmExecutor;
use sp_api::{CallApiAt, Encode, NumberFor, ProvideRuntimeApi};
use sp_blockchain::{HeaderBackend, HeaderMetadata};
Expand Down Expand Up @@ -438,20 +440,6 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
}
}

fn storage_keys(
&self,
hash: <Block as BlockT>::Hash,
key_prefix: &StorageKey,
) -> sp_blockchain::Result<Vec<StorageKey>> {
with_client! {
self,
client,
{
client.storage_keys(hash, key_prefix)
}
}
}

fn storage_hash(
&self,
hash: <Block as BlockT>::Hash,
Expand All @@ -469,30 +457,33 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
fn storage_pairs(
&self,
hash: <Block as BlockT>::Hash,
key_prefix: &StorageKey,
) -> sp_blockchain::Result<Vec<(StorageKey, StorageData)>> {
key_prefix: Option<&StorageKey>,
start_key: Option<&StorageKey>,
) -> sp_blockchain::Result<
PairsIter<<crate::FullBackend as sc_client_api::Backend<Block>>::State, Block>,
> {
with_client! {
self,
client,
{
client.storage_pairs(hash, key_prefix)
client.storage_pairs(hash, key_prefix, start_key)
}
}
}

fn storage_keys_iter(
fn storage_keys(
&self,
hash: <Block as BlockT>::Hash,
prefix: Option<&StorageKey>,
start_key: Option<&StorageKey>,
) -> sp_blockchain::Result<
KeyIterator<<crate::FullBackend as sc_client_api::Backend<Block>>::State, Block>,
KeysIter<<crate::FullBackend as sc_client_api::Backend<Block>>::State, Block>,
> {
with_client! {
self,
client,
{
client.storage_keys_iter(hash, prefix, start_key)
client.storage_keys(hash, prefix, start_key)
}
}
}
Expand All @@ -513,34 +504,19 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
}

fn child_storage_keys(
&self,
hash: <Block as BlockT>::Hash,
child_info: &ChildInfo,
key_prefix: &StorageKey,
) -> sp_blockchain::Result<Vec<StorageKey>> {
with_client! {
self,
client,
{
client.child_storage_keys(hash, child_info, key_prefix)
}
}
}

fn child_storage_keys_iter(
&self,
hash: <Block as BlockT>::Hash,
child_info: ChildInfo,
prefix: Option<&StorageKey>,
start_key: Option<&StorageKey>,
) -> sp_blockchain::Result<
KeyIterator<<crate::FullBackend as sc_client_api::Backend<Block>>::State, Block>,
KeysIter<<crate::FullBackend as sc_client_api::Backend<Block>>::State, Block>,
> {
with_client! {
self,
client,
{
client.child_storage_keys_iter(hash, child_info, prefix, start_key)
client.child_storage_keys(hash, child_info, prefix, start_key)
}
}
}
Expand Down