Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Migrate pallet-collective to the new pallet attribute macro #9115

Merged
41 commits merged into from
Sep 14, 2021
Merged

Migrate pallet-collective to the new pallet attribute macro #9115

41 commits merged into from
Sep 14, 2021

Conversation

koushiro
Copy link
Contributor

@koushiro koushiro commented Jun 15, 2021

Part of #7882

Migrate the pallet-collective to the new pallet attribute macro

diff council-before.json council-after.json:

4c4
<     "prefix": "Instance1Collective",
---
>     "prefix": "Council",

diff technical-committee-before.json technical-committee-after.json:

4c4
<     "prefix": "Instance2Collective",
---
>     "prefix": "TechnicalCommittee",

⚠️ Breaking Change ⚠️

From https://crates.parity.io/frame_support/attr.pallet.html#checking-upgrade-guidelines

storages now use PalletInfo for module_prefix instead of the one given to decl_storage: Thus any use of this pallet in construct_runtime! should be careful to update name in order not to break storage or to upgrade storage (moreover for instantiable pallet). If pallet is published, make sure to warn about this breaking change.

So users of the pallet must be careful about the name they used in construct_runtime!. Hence the runtime-migration label, which might not be needed depending on the configuration of the pallet.

polkadot and kusama use Counciland TechnicalCommittee as pallet name, but the current module prefix is Instance1Collective and Instance2Collective respectively , thus need to migrate the storages.


polkadot companion: paritytech/polkadot#3265

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
@koushiro koushiro marked this pull request as ready for review June 16, 2021 10:52
@koushiro
Copy link
Contributor Author

@shawntabrizi @thiolliere PTAL

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
@gui1117 gui1117 added A0-please_review Pull request needs code review. B3-apinoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Jun 24, 2021
Copy link
Contributor

@gui1117 gui1117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me,

I tested the migration with try-runtime on polkadot block 6,163,183

frame/collective/src/lib.rs Outdated Show resolved Hide resolved
frame/collective/src/migrations/v3_1.rs Outdated Show resolved Hide resolved
@gui1117 gui1117 added the D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. label Jun 24, 2021
koushiro and others added 7 commits June 25, 2021 00:13
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
@gui1117
Copy link
Contributor

gui1117 commented Sep 10, 2021

to check all the empty emptyness or that there is only key after a prefix I think we can use https://paritytech.github.io/substrate/frame_support/storage/migration/fn.storage_iter.html

EDIT: sorry I talk to fast, it only works for storages.

EDIT EDIT: maybe this can be used: https://paritytech.github.io/substrate/frame_support/storage/struct.PrefixIterator.html

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
@gui1117
Copy link
Contributor

gui1117 commented Sep 10, 2021

I think the migration should look like this: #9746
Or maybe we can even remove some assert which can lead to false positive (like asserting some key has been moved).

Copy link
Contributor

@gui1117 gui1117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the migration checks are not very accurate, I think it should be improved similarly to this #9746

Once this is done, I'll do the try-runtime on polkadot/kusama and approve

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Copy link
Contributor

@gui1117 gui1117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
…rate

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
@gui1117
Copy link
Contributor

gui1117 commented Sep 10, 2021

the CI has failed due to some flacky test, but AFAIK some fix are ongoing. I tried to test the companion with try-runtime on polkadot and kusama and it was successful. I think we can merge once we solve our CI issue.

@gui1117
Copy link
Contributor

gui1117 commented Sep 14, 2021

bot merge

@ghost
Copy link

ghost commented Sep 14, 2021

Trying merge.

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants