Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Default keys to something enumerable #4610
Right now, we default to using Blake2-256 for maps and double-maps. This guarantees security but comes at a cost of being unable to enumerate the keys (we can enumerate the values but only the hashes of the keys).
We should replace this default with Blake2-128-Concat. This provides 128-bits of security against trie-unbalancing attacks which should be just as secure as Blake2-256 since we were never going to be worrying about all 256 bits being equal, while at the same time, is secure against birthday attacks as it concatenates the preimage and also (for the same reason) includes the key.
First PR (pre-2.0):
Second PR (post-2.0)
Why not provide some new parameter to a decl storage line that stores the key with the value in a tuple? For the user it would make no difference, up to the point where he wants to iterate the keys. We could implement an extra trait, if the new attribute is set.
that's another way, yeah. in both cases there should be no significant change for the user (in both cases, the default should be to include the key and the user should need to take action for anything else).
this way is slightly more space efficient (fewer bytes stored as it's