-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Default keys to something enumerable #4610
Comments
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 |
I think it should be better make the transition be removing default hasher and reintroducing later. |
adding the new default can be done whenever people think it is ready, the change is very similar to the code before the PR that removed the default, you just have to change 2 lines in the parsing in decl_storage |
I think we should just stick to no default hasher as it is done now. Being explicit for this is probably better anyway. |
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)
The text was updated successfully, but these errors were encountered: