Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Implement transparent hashing for contract storage #11029

Closed
athei opened this issue Mar 14, 2022 · 0 comments · Fixed by #11501
Closed

Implement transparent hashing for contract storage #11029

athei opened this issue Mar 14, 2022 · 0 comments · Fixed by #11501
Assignees
Labels
J0-enhancement An additional feature request. Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase.

Comments

@athei
Copy link
Member

athei commented Mar 14, 2022

Right now all the storage functions used by contracts take a fixed 32 byte key as input. The contracts pallet hashes this key with blake2_256.

This completely removes the possibility to iterate over (key, value) pairs. The fixed key size also forces contracts to either hash or pad their keys which adds additional complexity.

We should do the following:

  • Add a new version for all storage primitives that take a variable sized key.
  • Hash the key with blake2_128_concat instead of blake2_256.
  • Add a new Get type to the Config that constitutes the limit of the key. Not to the Schedule.
  • Benchmark these functions with the maximum key size.
  • I think a sensible default for this max key size could be 128byte.

This is needed for use-ink/ink#1134

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request. Z2-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants