mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 00:57:57 +00:00
Child trie api changes BREAKING (#4857)
Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
|
||||
use std::any::{Any, TypeId};
|
||||
|
||||
use sp_storage::{ChildStorageKey, ChildInfo};
|
||||
use sp_storage::ChildInfo;
|
||||
|
||||
pub use scope_limited::{set_and_run_with_externalities, with_externalities};
|
||||
pub use extensions::{Extension, Extensions, ExtensionStore};
|
||||
@@ -62,8 +62,7 @@ pub trait Externalities: ExtensionStore {
|
||||
/// Returns an `Option` that holds the SCALE encoded hash.
|
||||
fn child_storage_hash(
|
||||
&self,
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
key: &[u8],
|
||||
) -> Option<Vec<u8>>;
|
||||
|
||||
@@ -72,8 +71,7 @@ pub trait Externalities: ExtensionStore {
|
||||
/// Returns an `Option` that holds the SCALE encoded hash.
|
||||
fn child_storage(
|
||||
&self,
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
key: &[u8],
|
||||
) -> Option<Vec<u8>>;
|
||||
|
||||
@@ -85,12 +83,11 @@ pub trait Externalities: ExtensionStore {
|
||||
/// Set child storage entry `key` of current contract being called (effective immediately).
|
||||
fn set_child_storage(
|
||||
&mut self,
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
key: Vec<u8>,
|
||||
value: Vec<u8>,
|
||||
) {
|
||||
self.place_child_storage(storage_key, child_info, key, Some(value))
|
||||
self.place_child_storage(child_info, key, Some(value))
|
||||
}
|
||||
|
||||
/// Clear a storage entry (`key`) of current contract being called (effective immediately).
|
||||
@@ -101,11 +98,10 @@ pub trait Externalities: ExtensionStore {
|
||||
/// Clear a child storage entry (`key`) of current contract being called (effective immediately).
|
||||
fn clear_child_storage(
|
||||
&mut self,
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
key: &[u8],
|
||||
) {
|
||||
self.place_child_storage(storage_key, child_info, key.to_vec(), None)
|
||||
self.place_child_storage(child_info, key.to_vec(), None)
|
||||
}
|
||||
|
||||
/// Whether a storage entry exists.
|
||||
@@ -116,11 +112,10 @@ pub trait Externalities: ExtensionStore {
|
||||
/// Whether a child storage entry exists.
|
||||
fn exists_child_storage(
|
||||
&self,
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
key: &[u8],
|
||||
) -> bool {
|
||||
self.child_storage(storage_key, child_info, key).is_some()
|
||||
self.child_storage(child_info, key).is_some()
|
||||
}
|
||||
|
||||
/// Returns the key immediately following the given key, if it exists.
|
||||
@@ -129,13 +124,12 @@ pub trait Externalities: ExtensionStore {
|
||||
/// Returns the key immediately following the given key, if it exists, in child storage.
|
||||
fn next_child_storage_key(
|
||||
&self,
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
key: &[u8],
|
||||
) -> Option<Vec<u8>>;
|
||||
|
||||
/// Clear an entire child storage.
|
||||
fn kill_child_storage(&mut self, storage_key: ChildStorageKey, child_info: ChildInfo);
|
||||
fn kill_child_storage(&mut self, child_info: &ChildInfo);
|
||||
|
||||
/// Clear storage entries which keys are start with the given prefix.
|
||||
fn clear_prefix(&mut self, prefix: &[u8]);
|
||||
@@ -143,8 +137,7 @@ pub trait Externalities: ExtensionStore {
|
||||
/// Clear child storage entries which keys are start with the given prefix.
|
||||
fn clear_child_prefix(
|
||||
&mut self,
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
prefix: &[u8],
|
||||
);
|
||||
|
||||
@@ -154,8 +147,7 @@ pub trait Externalities: ExtensionStore {
|
||||
/// Set or clear a child storage entry.
|
||||
fn place_child_storage(
|
||||
&mut self,
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
child_info: &ChildInfo,
|
||||
key: Vec<u8>,
|
||||
value: Option<Vec<u8>>,
|
||||
);
|
||||
@@ -178,7 +170,7 @@ pub trait Externalities: ExtensionStore {
|
||||
/// storage map will be removed.
|
||||
fn child_storage_root(
|
||||
&mut self,
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: &ChildInfo,
|
||||
) -> Vec<u8>;
|
||||
|
||||
/// Get the changes trie root of the current storage overlay at a block with given `parent`.
|
||||
|
||||
Reference in New Issue
Block a user