Improve storage_alias and make UnlockAndUnreserveAllFunds independent of the pallet#14773
Conversation
| /// | ||
| /// If generics are passed, this is assumed to be a pallet and the pallet name should be used. | ||
| /// Otherwise use the verbatim passed name as prefix. | ||
| Backwards, |
There was a problem hiding this comment.
Legacy or Compatibility? Otherwise it sounds like it interprets something backwards.
|
|
||
| #[docify::export] | ||
| #[test] | ||
| fn storage_alias_guess() { |
There was a problem hiding this comment.
Maybe one test that the backwards compatibility works?
sam0x17
left a comment
There was a problem hiding this comment.
found a bunch of minor grammar/wording nits. Might need to re-wrap a few of the doc paragraphs if you accept them
frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs
Outdated
Show resolved
Hide resolved
frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs
Outdated
Show resolved
Hide resolved
frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs
Outdated
Show resolved
Hide resolved
frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs
Outdated
Show resolved
Hide resolved
frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: Sam Johnson <sam@durosoft.com>
|
bot fmt |
|
@bkchr https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3395811 was started for your command Comment |
|
@bkchr Command |
|
bot merge |
|
Waiting for commit status. |
liamaharon
left a comment
There was a problem hiding this comment.
Perfect, thank you!
I have implemented and tested this on my Gov V1 unlock PR (commit with changes:
paritytech/polkadot@5e440c1) and it works great.
Additional benefit: we can wipe the pallet storage in the same migration we unlock the funds.
storage_alias and make UnlockAndUnreserveAllFunds indepenend of the palletstorage_alias and make UnlockAndUnreserveAllFunds independent of the pallet
…dent of the pallet (#14773) * Make `storage_alias` more generic over the `prefix` * Make `UnlockAndUnreserveAllFunds` indepenend from the pallet * FMT * Fix error reporting * Rename prefix type * Add test * Apply suggestions from code review Co-authored-by: Sam Johnson <sam@durosoft.com> * ".git/.scripts/commands/fmt/fmt.sh" --------- Co-authored-by: Sam Johnson <sam@durosoft.com> Co-authored-by: command-bot <>
This pull request is doing two things:
It improve
storage_aliasby making it more generic over the prefix to use. Currentlystorage_aliastries to guess based on the generics if the user wants to use the pallet name or a fixed identifier as prefix. This pull requests changes the macro to take an additional attribute that tells it what prefix type the user wants. Besides that a third prefix type is added, a type that implementsGet<&'static str>can also be provided as prefix. See the docs in the code for more information on how this works.pallet_democracy::UnlockAndUnreserveAllFundsis made independent of the presence of thepallet-democracypallet. This means that the migration can be used without the pallet still being used in the runtime. The user only needs to implement theUnlockConfigfor some type that is then passed toUnlockAndUnreserveAllFundsto forward certain information that are required by the migration.Besides this the pull request also puts some tests in
frame-supportinto their own file to clean up thelib.rs.