mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 01:38:04 +00:00
Add typedefs for storage types (#4654)
* Add typedefs for storage types * Fix after merge
This commit is contained in:
committed by
Bastian Köcher
parent
20ce6c120c
commit
482ca522cc
@@ -17,7 +17,8 @@
|
||||
//! Concrete externalities implementation.
|
||||
|
||||
use crate::{
|
||||
backend::Backend, OverlayedChanges, StorageTransactionCache,
|
||||
StorageKey, StorageValue, OverlayedChanges, StorageTransactionCache,
|
||||
backend::Backend,
|
||||
changes_trie::State as ChangesTrieState,
|
||||
};
|
||||
|
||||
@@ -130,7 +131,7 @@ where
|
||||
B: 'a + Backend<H>,
|
||||
N: crate::changes_trie::BlockNumber,
|
||||
{
|
||||
pub fn storage_pairs(&self) -> Vec<(Vec<u8>, Vec<u8>)> {
|
||||
pub fn storage_pairs(&self) -> Vec<(StorageKey, StorageValue)> {
|
||||
use std::collections::HashMap;
|
||||
|
||||
self.backend.pairs().iter()
|
||||
@@ -151,7 +152,7 @@ where
|
||||
B: 'a + Backend<H>,
|
||||
N: crate::changes_trie::BlockNumber,
|
||||
{
|
||||
fn storage(&self, key: &[u8]) -> Option<Vec<u8>> {
|
||||
fn storage(&self, key: &[u8]) -> Option<StorageValue> {
|
||||
let _guard = sp_panic_handler::AbortGuard::force_abort();
|
||||
let result = self.overlay.storage(key).map(|x| x.map(|x| x.to_vec())).unwrap_or_else(||
|
||||
self.backend.storage(key).expect(EXT_NOT_ALLOWED_TO_FAIL));
|
||||
@@ -178,7 +179,7 @@ where
|
||||
result.map(|r| r.encode())
|
||||
}
|
||||
|
||||
fn original_storage(&self, key: &[u8]) -> Option<Vec<u8>> {
|
||||
fn original_storage(&self, key: &[u8]) -> Option<StorageValue> {
|
||||
let _guard = sp_panic_handler::AbortGuard::force_abort();
|
||||
let result = self.backend.storage(key).expect(EXT_NOT_ALLOWED_TO_FAIL);
|
||||
|
||||
@@ -207,7 +208,7 @@ where
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
key: &[u8],
|
||||
) -> Option<Vec<u8>> {
|
||||
) -> Option<StorageValue> {
|
||||
let _guard = sp_panic_handler::AbortGuard::force_abort();
|
||||
let result = self.overlay
|
||||
.child_storage(storage_key.as_ref(), key)
|
||||
@@ -256,7 +257,7 @@ where
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
key: &[u8],
|
||||
) -> Option<Vec<u8>> {
|
||||
) -> Option<StorageValue> {
|
||||
let _guard = sp_panic_handler::AbortGuard::force_abort();
|
||||
let result = self.backend
|
||||
.child_storage(storage_key.as_ref(), child_info, key)
|
||||
@@ -332,7 +333,7 @@ where
|
||||
result
|
||||
}
|
||||
|
||||
fn next_storage_key(&self, key: &[u8]) -> Option<Vec<u8>> {
|
||||
fn next_storage_key(&self, key: &[u8]) -> Option<StorageKey> {
|
||||
let next_backend_key = self.backend.next_storage_key(key).expect(EXT_NOT_ALLOWED_TO_FAIL);
|
||||
let next_overlay_key_change = self.overlay.next_storage_key_change(key);
|
||||
|
||||
@@ -352,7 +353,7 @@ where
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
key: &[u8],
|
||||
) -> Option<Vec<u8>> {
|
||||
) -> Option<StorageKey> {
|
||||
let next_backend_key = self.backend
|
||||
.next_child_storage_key(storage_key.as_ref(), child_info, key)
|
||||
.expect(EXT_NOT_ALLOWED_TO_FAIL);
|
||||
@@ -376,7 +377,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn place_storage(&mut self, key: Vec<u8>, value: Option<Vec<u8>>) {
|
||||
fn place_storage(&mut self, key: StorageKey, value: Option<StorageValue>) {
|
||||
trace!(target: "state-trace", "{:04x}: Put {}={:?}",
|
||||
self.id,
|
||||
HexDisplay::from(&key),
|
||||
@@ -396,8 +397,8 @@ where
|
||||
&mut self,
|
||||
storage_key: ChildStorageKey,
|
||||
child_info: ChildInfo,
|
||||
key: Vec<u8>,
|
||||
value: Option<Vec<u8>>,
|
||||
key: StorageKey,
|
||||
value: Option<StorageValue>,
|
||||
) {
|
||||
trace!(target: "state-trace", "{:04x}: PutChild({}) {}={:?}",
|
||||
self.id,
|
||||
|
||||
Reference in New Issue
Block a user