optimize double map first key hash (#2451)

* fix double map encoding it is now encoded as specified in the doc
This commit is contained in:
thiolliere
2019-05-06 08:44:36 +02:00
committed by GitHub
parent 5a820db7f5
commit b0c21da94f
6 changed files with 89 additions and 16 deletions
+2 -2
View File
@@ -54,7 +54,7 @@ use proc_macro::TokenStream;
///
/// `hasher($hash)` is optional and its default is `blake2_256`.
///
/// /!\ Be careful with each key in the map that is inserted in the trie `$hash(module_name ++ storage_name ++ key)`.
/// /!\ Be careful with each key in the map that is inserted in the trie `$hash(module_name ++ " " ++ storage_name ++ encoding(key))`.
/// If the keys are not trusted (e.g. can be set by a user), a cryptographic `hasher` such as
/// `blake2_256` must be used. Otherwise, other values in storage can be compromised.
///
@@ -71,7 +71,7 @@ use proc_macro::TokenStream;
/// The final key is calculated as follows:
///
/// ```nocompile
/// $hash(module_name ++ storage_name ++ first_key) ++ $hash2(second_key)
/// $hash(module_name ++ " " ++ storage_name ++ encoding(first_key)) ++ $hash2(encoding(second_key))
/// ```
///
/// If the first key is untrusted, a cryptographic `hasher` such as `blake2_256` must be used.