This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add iteration with key information when using $hash_concat #5238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #4362
When iterating on a storage_map which use twox_64_concat we must be able to get the key alongside the value. This PR create a new function on StoragePrefixedMap to make it possible.
In future PR:
DoubleMap::iter_prefix (which iter on all the second key associated to one first key) can't iterate with key information yet. I will do in a following PR
Additionnal notes
The fact the the iteration stop immediately if a value fail to decode was made to follow the same behavior of StoragPrefixedMap::iter(). Though maybe we should move both implementation to just ignore failed to decode value.
Alternative implementation
If having () instead of key when the hasher doesn't give information is too confusing we could also go in another direction by making such function available with a
where
statement.Though to do so I would actually prefer merging StorageMap and generator::StorageMap and having the function
iter_with_info()... where Hasher: HasherWithInfo
.