This repository was 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.7k
[Feature] Introduce storage_alias for CountedStorageMap #13366
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
43b36a5
[Feature] Introduce storagage_alias for CountedStorageMap
ruseinov 1e45f30
bit more dry
ruseinov fc974b3
bit more dry
ruseinov b410020
address review comments
ruseinov 60ab3e8
some tests and fixes
ruseinov 51c45d3
Merge remote-tracking branch 'origin/master' into ru/feature/storage-…
82c71f9
fix ui tests
ruseinov 7ed34ff
Apply suggestions from code review
ruseinov 79378d1
compare metadata
ruseinov 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
some tests and fixes
- Loading branch information
commit 60ab3e86d5bb646b0ef2851620d17948e2cb0add
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1906,14 +1906,26 @@ fn assert_type_all_pallets_without_system_reversed_is_correct() { | |
|
|
||
| #[test] | ||
| fn test_storage_alias() { | ||
| use frame_support::Twox64Concat; | ||
|
|
||
| #[frame_support::storage_alias] | ||
| type Value<T: pallet::Config> | ||
| where | ||
| <T as frame_system::Config>::AccountId: From<SomeType1> + SomeAssociation1, | ||
| = StorageValue<pallet::Pallet<T>, u32, ValueQuery>; | ||
|
|
||
| #[frame_support::storage_alias] | ||
| type SomeCountedStorageMap<T: pallet2::Config> | ||
| where | ||
| <T as frame_system::Config>::AccountId: From<SomeType1> + SomeAssociation1, | ||
| = CountedStorageMap<pallet2::Pallet<T>, Twox64Concat, u8, u32>; | ||
|
|
||
| TestExternalities::default().execute_with(|| { | ||
| pallet::Value::<Runtime>::put(10); | ||
| assert_eq!(10, Value::<Runtime>::get()); | ||
|
|
||
| pallet2::SomeCountedStorageMap::<Runtime>::insert(10, 100); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also check that the returned meta-data is identical to the non-alias version?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Care to elaborate?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done in 79378d1 |
||
| assert_eq!(Some(100), SomeCountedStorageMap::<Runtime>::get(10)); | ||
| assert_eq!(1, SomeCountedStorageMap::<Runtime>::count()); | ||
| }) | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.