-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix storage expansion in pallet section #6023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+99
−10
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b322a26
fix pallet section storage
eagr 4aa84ef
alternative
eagr 91c0b19
move into frame-support-test
eagr 7caaea8
reorg tests
eagr 12a6de8
Merge branch 'master' into pallet-section-storage
eagr 61d1715
license
eagr 03082ee
prdoc
eagr 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 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
32 changes: 32 additions & 0 deletions
32
substrate/frame/support/test/tests/split_ui/pass/split_storage.rs
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 |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| use frame_support::pallet_macros::import_section; | ||
|
|
||
| mod storage; | ||
|
|
||
| #[import_section(storage::storage)] | ||
| #[frame_support::pallet(dev_mode)] | ||
| pub mod pallet { | ||
| use frame_support::pallet_prelude::*; | ||
| use frame_system::pallet_prelude::*; | ||
|
|
||
| const STORAGE_VERSION: StorageVersion = StorageVersion::new(8); | ||
|
|
||
| #[pallet::pallet] | ||
| #[pallet::storage_version(STORAGE_VERSION)] | ||
| pub struct Pallet<T>(_); | ||
|
|
||
| #[pallet::config] | ||
| pub trait Config: frame_system::Config {} | ||
|
|
||
| #[pallet::call] | ||
| impl<T: Config> Pallet<T> { | ||
| pub fn increment_value(_origin: OriginFor<T>) -> DispatchResult { | ||
| Value::<T>::mutate(|v| { | ||
| v.saturating_add(1) | ||
| }); | ||
| Ok(()) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fn main() { | ||
| } |
10 changes: 10 additions & 0 deletions
10
substrate/frame/support/test/tests/split_ui/pass/storage.rs
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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| use frame_support::pallet_macros::pallet_section; | ||
|
|
||
| #[pallet_section] | ||
| mod storage { | ||
| #[pallet::storage] | ||
| pub type Value<T> = StorageValue<_, u32, ValueQuery>; | ||
|
|
||
| #[pallet::storage] | ||
| pub type Map<T> = StorageMap<_, _, u32, u32, ValueQuery>; | ||
| } |
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.