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
+3 -3
View File
@@ -17,7 +17,7 @@
use super::*;
use self::error::{Error, ErrorKind};
use sr_io::twox_128;
use sr_io::blake2_256;
use assert_matches::assert_matches;
use consensus::BlockOrigin;
use test_client::{self, runtime, AccountKeyring, TestClient, BlockBuilderExt};
@@ -88,7 +88,7 @@ fn should_send_initial_storage_changes_and_notifications() {
{
let api = State::new(Arc::new(test_client::new()), Subscriptions::new(remote));
let alice_balance_key = twox_128(&test_runtime::system::balance_of_key(AccountKeyring::Alice.into()));
let alice_balance_key = blake2_256(&test_runtime::system::balance_of_key(AccountKeyring::Alice.into()));
api.subscribe_storage(Default::default(), subscriber, Some(vec![
StorageKey(alice_balance_key.to_vec()),
@@ -147,7 +147,7 @@ fn should_query_storage() {
let block2_hash = add_block(1);
let genesis_hash = client.genesis_hash();
let alice_balance_key = twox_128(&test_runtime::system::balance_of_key(AccountKeyring::Alice.into()));
let alice_balance_key = blake2_256(&test_runtime::system::balance_of_key(AccountKeyring::Alice.into()));
let mut expected = vec![
StorageChangeSet {