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

Implement transparent hashing for contract storage #11029

@athei

Description

@athei

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

Metadata

Metadata

Assignees

Labels

J0-enhancementAn additional feature request.Z2-mediumCan be fixed by a coder with good Rust knowledge but little knowledge of the codebase.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions