This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Implement StorageNMap #8635
Merged
Merged
Implement StorageNMap #8635
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
8456583
Implement StorageNMap
KiChjang a52724a
Change copyright date to 2021
KiChjang 42513d2
Rewrite keys to use impl_for_tuples instead of recursion
KiChjang a89bf41
Implement prefix iteration on StorageNMap
KiChjang 6b17d09
Implement EncodeLike for key arguments
KiChjang 09b34ab
Rename KeyGenerator::Arg to KeyGenerator::KArg
KiChjang 976e337
Support StorageNMap in decl_storage and #[pallet::storage] macros
KiChjang 09be192
Use StorageNMap in assets pallet
KiChjang 54b38e7
Support migrate_keys in StorageNMap
KiChjang a3b48a7
Reduce line characters on select files
KiChjang 69fbed3
Refactor crate imports in decl_storage macros
KiChjang d5598e5
Some more line char reductions and doc comment update
KiChjang bbf8459
Update UI test expectations
KiChjang 9fbf1ad
Revert whitespace changes to untouched files
KiChjang 275f5a5
Merge branch 'master' into pr/8635
shawntabrizi 7686c7b
Generate Key struct instead of a 1-tuple when only 1 pair of key and …
KiChjang b83dbf2
Revert formatting changes to unrelated files
KiChjang 994e170
Introduce KeyGeneratorInner
KiChjang c3e4b9f
Add tests for StorageNMap in FRAMEv2 pallet macro
KiChjang 55c8544
Small fixes to unit tests for StorageNMap
KiChjang c0b1516
Bump runtime metadata version
KiChjang fdc3e13
Remove unused import
KiChjang c041a6c
Update tests to use runtime metadata v13
KiChjang ce13f5e
Introduce and use EncodeLikeTuple as a trait bound for KArg
KiChjang 1aeda76
Add some rustdocs
KiChjang 3671857
Revert usage of StorageNMap in assets pallet
KiChjang 707cf45
Make use of ext::PunctuatedTrailing
KiChjang 6e264ef
Merge remote-tracking branch 'upstream/master' into storage-n-map
KiChjang e8f9740
Merge remote-tracking branch 'upstream/master' into storage-n-map
KiChjang 2ff4de0
Add rustdoc for final_hash
KiChjang f75bc5a
Fix StorageNMap proc macro expansions for single key cases
KiChjang 02b7ce3
Create associated const in KeyGenerator for hasher metadata
KiChjang e142267
Refactor code according to comments from Basti
KiChjang dbcb1f6
Add module docs for generator/nmap.rs
KiChjang d207d77
Re-export storage::Key as NMapKey in pallet prelude
KiChjang f259f46
Seal the EncodeLikeTuple trait
KiChjang b081885
Extract sealing code out of key.rs
KiChjang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should bump the metadata version. Because third-parties won't be able to make sense of this new variant.
Thus releasing RuntimeMetadataV13:
Also we could remove other variant as they can all be expressed as a NMap but I think it is better for compatibility to keep them (basically
Plain
would be aNMap
withkeys
andhashers
being array of length 0,Map
would be aNMap
with keys and arrays of length 1, etc..). cc @jacogr(Also it would make more sense to have something like
DecodeDifferentArray<(DecodeDifferentStr, StorageHasher)>
or something like this maybe, to ensure keys and hashers are of same length.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. This is the first I have seen this. This is a major revamp on my side for everything storage related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yes, this is correct bumping - with metadata you can just change at will - it needs a bump to avoid issue like we have in the v9-late iteration metadata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacogr we wont spring anything on you here. This should be unused in the runtime for now, and might only get used in assets in the near future for a triple map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is fine, appreciate it. Do bear in mind that once merged, it does immediately make Substrate master non-supported (if any enum changes are made to the storage descriptors or the metadata version is bumped), even if unused in practice.