Add typedefs for storage types (#4654)

* Add typedefs for storage types

* Fix after merge
This commit is contained in:
Stanislav Tkach
2020-01-17 10:20:20 +02:00
committed by Bastian Köcher
parent 20ce6c120c
commit 482ca522cc
19 changed files with 202 additions and 160 deletions
@@ -17,7 +17,10 @@
//! Different types of changes trie input pairs.
use codec::{Decode, Encode, Input, Output, Error};
use crate::changes_trie::BlockNumber;
use crate::{
StorageKey, StorageValue,
changes_trie::BlockNumber
};
/// Key of { changed key => set of extrinsic indices } mapping.
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -25,7 +28,7 @@ pub struct ExtrinsicIndex<Number: BlockNumber> {
/// Block at which this key has been inserted in the trie.
pub block: Number,
/// Storage key this node is responsible for.
pub key: Vec<u8>,
pub key: StorageKey,
}
/// Value of { changed key => set of extrinsic indices } mapping.
@@ -37,7 +40,7 @@ pub struct DigestIndex<Number: BlockNumber> {
/// Block at which this key has been inserted in the trie.
pub block: Number,
/// Storage key this node is responsible for.
pub key: Vec<u8>,
pub key: StorageKey,
}
/// Key of { childtrie key => Childchange trie } mapping.
@@ -46,7 +49,7 @@ pub struct ChildIndex<Number: BlockNumber> {
/// Block at which this key has been inserted in the trie.
pub block: Number,
/// Storage key this node is responsible for.
pub storage_key: Vec<u8>,
pub storage_key: StorageKey,
}
/// Value of { changed key => block/digest block numbers } mapping.
@@ -89,8 +92,8 @@ impl<Number: BlockNumber> InputPair<Number> {
}
}
impl<Number: BlockNumber> Into<(Vec<u8>, Vec<u8>)> for InputPair<Number> {
fn into(self) -> (Vec<u8>, Vec<u8>) {
impl<Number: BlockNumber> Into<(StorageKey, StorageValue)> for InputPair<Number> {
fn into(self) -> (StorageKey, StorageValue) {
match self {
InputPair::ExtrinsicIndex(key, value) => (key.encode(), value.encode()),
InputPair::DigestIndex(key, value) => (key.encode(), value.encode()),