BlockId removal: refactor: StorageProvider (#6160)

* BlockId removal: refactor: StorageProvider

It changes the arguments of `Backend::StorageProvider` trait from:
block: `BlockId<Block>` to: hash: `&Block::Hash`

* Update node/client/src/lib.rs

Co-authored-by: Bastian Köcher <info@kchr.de>

* update lockfile for {"substrate"}

Co-authored-by: Bastian Köcher <info@kchr.de>
Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2022-10-18 16:01:26 +02:00
committed by GitHub
parent befaec4cee
commit 699cc55d7b
2 changed files with 198 additions and 197 deletions
+180 -179
View File
File diff suppressed because it is too large Load Diff
+18 -18
View File
@@ -421,63 +421,63 @@ impl sc_client_api::BlockBackend<Block> for Client {
impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
fn storage(
&self,
id: &BlockId<Block>,
hash: &<Block as BlockT>::Hash,
key: &StorageKey,
) -> sp_blockchain::Result<Option<StorageData>> {
with_client! {
self,
client,
{
client.storage(id, key)
client.storage(hash, key)
}
}
}
fn storage_keys(
&self,
id: &BlockId<Block>,
hash: &<Block as BlockT>::Hash,
key_prefix: &StorageKey,
) -> sp_blockchain::Result<Vec<StorageKey>> {
with_client! {
self,
client,
{
client.storage_keys(id, key_prefix)
client.storage_keys(hash, key_prefix)
}
}
}
fn storage_hash(
&self,
id: &BlockId<Block>,
hash: &<Block as BlockT>::Hash,
key: &StorageKey,
) -> sp_blockchain::Result<Option<<Block as BlockT>::Hash>> {
with_client! {
self,
client,
{
client.storage_hash(id, key)
client.storage_hash(hash, key)
}
}
}
fn storage_pairs(
&self,
id: &BlockId<Block>,
hash: &<Block as BlockT>::Hash,
key_prefix: &StorageKey,
) -> sp_blockchain::Result<Vec<(StorageKey, StorageData)>> {
with_client! {
self,
client,
{
client.storage_pairs(id, key_prefix)
client.storage_pairs(hash, key_prefix)
}
}
}
fn storage_keys_iter<'a>(
&self,
id: &BlockId<Block>,
hash: &<Block as BlockT>::Hash,
prefix: Option<&'a StorageKey>,
start_key: Option<&StorageKey>,
) -> sp_blockchain::Result<
@@ -487,14 +487,14 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
self,
client,
{
client.storage_keys_iter(id, prefix, start_key)
client.storage_keys_iter(hash, prefix, start_key)
}
}
}
fn child_storage(
&self,
id: &BlockId<Block>,
hash: &<Block as BlockT>::Hash,
child_info: &ChildInfo,
key: &StorageKey,
) -> sp_blockchain::Result<Option<StorageData>> {
@@ -502,14 +502,14 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
self,
client,
{
client.child_storage(id, child_info, key)
client.child_storage(hash, child_info, key)
}
}
}
fn child_storage_keys(
&self,
id: &BlockId<Block>,
hash: &<Block as BlockT>::Hash,
child_info: &ChildInfo,
key_prefix: &StorageKey,
) -> sp_blockchain::Result<Vec<StorageKey>> {
@@ -517,14 +517,14 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
self,
client,
{
client.child_storage_keys(id, child_info, key_prefix)
client.child_storage_keys(hash, child_info, key_prefix)
}
}
}
fn child_storage_keys_iter<'a>(
&self,
id: &BlockId<Block>,
hash: &<Block as BlockT>::Hash,
child_info: ChildInfo,
prefix: Option<&'a StorageKey>,
start_key: Option<&StorageKey>,
@@ -535,14 +535,14 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
self,
client,
{
client.child_storage_keys_iter(id, child_info, prefix, start_key)
client.child_storage_keys_iter(hash, child_info, prefix, start_key)
}
}
}
fn child_storage_hash(
&self,
id: &BlockId<Block>,
hash: &<Block as BlockT>::Hash,
child_info: &ChildInfo,
key: &StorageKey,
) -> sp_blockchain::Result<Option<<Block as BlockT>::Hash>> {
@@ -550,7 +550,7 @@ impl sc_client_api::StorageProvider<Block, crate::FullBackend> for Client {
self,
client,
{
client.child_storage_hash(id, child_info, key)
client.child_storage_hash(hash, child_info, key)
}
}
}