Forward port blake2 storage support (#2360)

* move storage maps to blake2_128 (#2268)

* remove default hash, introduce twox_128 and blake2

* use blake2_128 & create ext_blake2_128

* refactor code

* add benchmark

* factorize generator

* fix

* parameterizable hasher

* some fix

* fix

* fix

* fix

* metadata

* fix

* remove debug print

* map -> blake2_256

* fix test

* fix test

* Apply suggestions from code review

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* impl twox 128 concat (#2353)

* impl twox_128_concat

* comment addressed

* fix

* impl twox_128->64_concat

* fix test

* Fix compilation and cleanup some docs

* Apply suggestions from code review

Co-Authored-By: bkchr <bkchr@users.noreply.github.com>
This commit is contained in:
Bastian Köcher
2019-04-24 11:05:22 +02:00
committed by Gavin Wood
parent 21d1ee4e99
commit f0862606b7
38 changed files with 1101 additions and 732 deletions
+12 -27
View File
@@ -24,29 +24,19 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn
/// # Simple Event Example:
///
/// ```rust
/// #[macro_use]
/// extern crate srml_support;
/// #[macro_use]
/// extern crate parity_codec as codec;
///
/// decl_event!(
/// pub enum Event {
/// srml_support::decl_event!(
/// pub enum Event {
/// Success,
/// Failure(String),
/// }
/// );
///
///# fn main() {}
/// ```
///
/// # Generic Event Example:
///
/// ```rust
/// #[macro_use]
/// extern crate srml_support;
/// extern crate parity_codec as codec;
/// #[macro_use]
/// extern crate parity_codec;
///
/// trait Trait {
/// type Balance;
/// type Token;
@@ -54,8 +44,8 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn
///
/// mod event1 {
/// // Event that specifies the generic parameter explicitly (`Balance`).
/// decl_event!(
/// pub enum Event<T> where Balance = <T as super::Trait>::Balance {
/// srml_support::decl_event!(
/// pub enum Event<T> where Balance = <T as super::Trait>::Balance {
/// Message(Balance),
/// }
/// );
@@ -65,8 +55,8 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn
/// // Event that uses the generic parameter `Balance`.
/// // If no name for the generic parameter is specified explicitly,
/// // the name will be taken from the type name of the trait.
/// decl_event!(
/// pub enum Event<T> where <T as super::Trait>::Balance {
/// srml_support::decl_event!(
/// pub enum Event<T> where <T as super::Trait>::Balance {
/// Message(Balance),
/// }
/// );
@@ -74,12 +64,13 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn
///
/// mod event3 {
/// // And we even support declaring multiple generic parameters!
/// decl_event!(
/// pub enum Event<T> where <T as super::Trait>::Balance, <T as super::Trait>::Token {
/// srml_support::decl_event!(
/// pub enum Event<T> where <T as super::Trait>::Balance, <T as super::Trait>::Token {
/// Message(Balance, Token),
/// }
/// );
/// }
///
///# fn main() {}
/// ```
///
@@ -88,12 +79,6 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn
/// # Generic Event with Instance Example:
///
/// ```rust
/// #[macro_use]
/// extern crate srml_support;
/// extern crate parity_codec as codec;
/// #[macro_use]
/// extern crate parity_codec;
///
///# struct DefaultInstance;
///# trait Instance {}
///# impl Instance for DefaultInstance {}
@@ -103,7 +88,7 @@ pub use srml_metadata::{EventMetadata, DecodeDifferent, OuterEventMetadata, FnEn
/// }
///
/// // For module with instances, DefaultInstance is optionnal
/// decl_event!(
/// srml_support::decl_event!(
/// pub enum Event<T, I: Instance = DefaultInstance> where
/// <T as Trait>::Balance,
/// <T as Trait>::Token
@@ -504,7 +489,7 @@ macro_rules! __impl_outer_event_json_metadata {
mod tests {
use super::*;
use serde::Serialize;
use parity_codec::{Encode, Decode};
use codec::{Encode, Decode};
mod system {
pub trait Trait {