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.

storage_key_iter does return invalid second keys for StorageDoubleMap #11416

@sea212

Description

@sea212

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

When using storage_key_iter on a StorageDoubleMap with a ReversibleStorageHasher other than Identity, the second keys that are returned contain wrong values.

I am not quite sure if storage_key_iter was ever designed to be used with StorageDoubleMaps. In that case, a note in the documentation is crucial, otherwise devs might mess up their storage by assuming that it will work.

Steps to reproduce

I created a repository that contains a rust crate with a minimal example and three tests that can be used as a reference.

  1. Create StorageDoubleMap using Blake2_128Concat or Twox64Concat hasher. The key types should be i32, the value should be u32
  2. Insert an example value in the storage, like: (-12, -34) = 56
  3. Use storage_key_iter to iterate over the keys and values. The second key in the retrieved value should not match the second key in the inserted value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    J2-unconfirmedIssue might be valid, but it’s not yet known.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions