mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Child trie api changes BREAKING (#4857)
Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -26,7 +26,7 @@ use sp_state_machine::{
|
||||
ChangesTrieState, ChangesTrieStorage as StateChangesTrieStorage, ChangesTrieTransaction,
|
||||
StorageCollection, ChildStorageCollection,
|
||||
};
|
||||
use sp_storage::{StorageData, StorageKey, ChildInfo};
|
||||
use sp_storage::{StorageData, StorageKey, PrefixedStorageKey, ChildInfo};
|
||||
use crate::{
|
||||
blockchain::{
|
||||
Backend as BlockchainBackend, well_known_cache_keys
|
||||
@@ -280,6 +280,7 @@ impl<'a, State, Block> Iterator for KeyIterator<'a, State, Block> where
|
||||
Some(StorageKey(next_key))
|
||||
}
|
||||
}
|
||||
|
||||
/// Provides acess to storage primitives
|
||||
pub trait StorageProvider<Block: BlockT, B: Backend<Block>> {
|
||||
/// Given a `BlockId` and a key, return the value under the key in that block.
|
||||
@@ -310,8 +311,7 @@ pub trait StorageProvider<Block: BlockT, B: Backend<Block>> {
|
||||
fn child_storage(
|
||||
&self,
|
||||
id: &BlockId<Block>,
|
||||
storage_key: &StorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
key: &StorageKey
|
||||
) -> sp_blockchain::Result<Option<StorageData>>;
|
||||
|
||||
@@ -319,8 +319,7 @@ pub trait StorageProvider<Block: BlockT, B: Backend<Block>> {
|
||||
fn child_storage_keys(
|
||||
&self,
|
||||
id: &BlockId<Block>,
|
||||
child_storage_key: &StorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
key_prefix: &StorageKey
|
||||
) -> sp_blockchain::Result<Vec<StorageKey>>;
|
||||
|
||||
@@ -328,8 +327,7 @@ pub trait StorageProvider<Block: BlockT, B: Backend<Block>> {
|
||||
fn child_storage_hash(
|
||||
&self,
|
||||
id: &BlockId<Block>,
|
||||
storage_key: &StorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
key: &StorageKey
|
||||
) -> sp_blockchain::Result<Option<Block::Hash>>;
|
||||
|
||||
@@ -351,7 +349,7 @@ pub trait StorageProvider<Block: BlockT, B: Backend<Block>> {
|
||||
&self,
|
||||
first: NumberFor<Block>,
|
||||
last: BlockId<Block>,
|
||||
storage_key: Option<&StorageKey>,
|
||||
storage_key: Option<&PrefixedStorageKey>,
|
||||
key: &StorageKey
|
||||
) -> sp_blockchain::Result<Vec<(NumberFor<Block>, u32)>>;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ use sp_runtime::{
|
||||
},
|
||||
generic::BlockId
|
||||
};
|
||||
use sp_core::ChangesTrieConfigurationRange;
|
||||
use sp_core::{ChangesTrieConfigurationRange, storage::PrefixedStorageKey};
|
||||
use sp_state_machine::StorageProof;
|
||||
use sp_blockchain::{
|
||||
HeaderMetadata, well_known_cache_keys, HeaderBackend, Cache as BlockchainCache,
|
||||
@@ -81,12 +81,7 @@ pub struct RemoteReadChildRequest<Header: HeaderT> {
|
||||
/// Header of block at which read is performed.
|
||||
pub header: Header,
|
||||
/// Storage key for child.
|
||||
pub storage_key: Vec<u8>,
|
||||
/// Child trie source information.
|
||||
pub child_info: Vec<u8>,
|
||||
/// Child type, its required to resolve `child_info`
|
||||
/// content and choose child implementation.
|
||||
pub child_type: u32,
|
||||
pub storage_key: PrefixedStorageKey,
|
||||
/// Child storage key to read.
|
||||
pub keys: Vec<Vec<u8>>,
|
||||
/// Number of times to retry request. None means that default RETRY_COUNT is used.
|
||||
@@ -110,7 +105,7 @@ pub struct RemoteChangesRequest<Header: HeaderT> {
|
||||
/// Proofs for roots of ascendants of tries_roots.0 are provided by the remote node.
|
||||
pub tries_roots: (Header::Number, Header::Hash, Vec<Header::Hash>),
|
||||
/// Optional Child Storage key to read.
|
||||
pub storage_key: Option<Vec<u8>>,
|
||||
pub storage_key: Option<PrefixedStorageKey>,
|
||||
/// Storage key to read.
|
||||
pub key: Vec<u8>,
|
||||
/// Number of times to retry request. None means that default RETRY_COUNT is used.
|
||||
|
||||
@@ -19,7 +19,7 @@ use sp_runtime::{
|
||||
traits::{Block as BlockT},
|
||||
};
|
||||
use crate::{StorageProof, ChangesProof};
|
||||
use sp_storage::{ChildInfo, StorageKey};
|
||||
use sp_storage::{ChildInfo, StorageKey, PrefixedStorageKey};
|
||||
|
||||
/// Interface for providing block proving utilities.
|
||||
pub trait ProofProvider<Block: BlockT> {
|
||||
@@ -35,8 +35,7 @@ pub trait ProofProvider<Block: BlockT> {
|
||||
fn read_child_proof(
|
||||
&self,
|
||||
id: &BlockId<Block>,
|
||||
storage_key: &[u8],
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
keys: &mut dyn Iterator<Item=&[u8]>,
|
||||
) -> sp_blockchain::Result<StorageProof>;
|
||||
|
||||
@@ -65,7 +64,7 @@ pub trait ProofProvider<Block: BlockT> {
|
||||
last: Block::Hash,
|
||||
min: Block::Hash,
|
||||
max: Block::Hash,
|
||||
storage_key: Option<&StorageKey>,
|
||||
storage_key: Option<&PrefixedStorageKey>,
|
||||
key: &StorageKey,
|
||||
) -> sp_blockchain::Result<ChangesProof<Block::Header>>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user