-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Migrate pallet-membership to the new pallet attribute macro
#9080
Conversation
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
|
@KiChjang PTAL |
|
bot merge |
|
Trying merge. |
|
merging master should probably fix CI, but we need to test one time with try-runtime the companion before the merge IMHO, I'll do once I have proper connection. Or we should try the try-runtime bot |
|
bot merge cancel |
|
Merge cancelled. |
|
there was a new release, let's wait for PR to cleanup and get the new version and empty migration, kusama to get the runtime upgrade, then we can update this PR and do test with try-runtime on kusama |
now we need to store the new version manually.
|
I tested with try-runtime on kusama with command In the companion I deleted previous migration of 9090 and added new one. maybe this can be reviewed here paritytech/polkadot#3731 |
…migrate-pallet-membership
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
|
bot merge |
|
Waiting for commit status. |
Part of #7882
Migrate the
pallet-membershipto the new pallet attribute macrometadata generated by old macro
{ "name": "TechnicalMembership", "storage": { "prefix": "Instance1Membership", "entries": [ { "name": "Members", "modifier": "Default", "ty": { "Plain": "Vec<T::AccountId>" }, "default": [ 0 ], "documentation": [ " The current membership, stored as an ordered Vec." ] }, { "name": "Prime", "modifier": "Optional", "ty": { "Plain": "T::AccountId" }, "default": [ 0 ], "documentation": [ " The current prime member, if one exists." ] } ] }, "calls": [ { "name": "add_member", "arguments": [ { "name": "who", "ty": "T::AccountId" } ], "documentation": [ " Add a member `who` to the set.", "", " May only be called from `T::AddOrigin`." ] }, { "name": "remove_member", "arguments": [ { "name": "who", "ty": "T::AccountId" } ], "documentation": [ " Remove a member `who` from the set.", "", " May only be called from `T::RemoveOrigin`." ] }, { "name": "swap_member", "arguments": [ { "name": "remove", "ty": "T::AccountId" }, { "name": "add", "ty": "T::AccountId" } ], "documentation": [ " Swap out one member `remove` for another `add`.", "", " May only be called from `T::SwapOrigin`.", "", " Prime membership is *not* passed from `remove` to `add`, if extant." ] }, { "name": "reset_members", "arguments": [ { "name": "members", "ty": "Vec<T::AccountId>" } ], "documentation": [ " Change the membership to a new set, disregarding the existing membership. Be nice and", " pass `members` pre-sorted.", "", " May only be called from `T::ResetOrigin`." ] }, { "name": "change_key", "arguments": [ { "name": "new", "ty": "T::AccountId" } ], "documentation": [ " Swap out the sending member for some other key `new`.", "", " May only be called from `Signed` origin of a current member.", "", " Prime membership is passed from the origin account to `new`, if extant." ] }, { "name": "set_prime", "arguments": [ { "name": "who", "ty": "T::AccountId" } ], "documentation": [ " Set the prime member. Must be a current member.", "", " May only be called from `T::PrimeOrigin`." ] }, { "name": "clear_prime", "arguments": [], "documentation": [ " Remove the prime member if it exists.", "", " May only be called from `T::PrimeOrigin`." ] } ], "event": [ { "name": "MemberAdded", "arguments": [], "documentation": [ " The given member was added; see the transaction for who." ] }, { "name": "MemberRemoved", "arguments": [], "documentation": [ " The given member was removed; see the transaction for who." ] }, { "name": "MembersSwapped", "arguments": [], "documentation": [ " Two members were swapped; see the transaction for who." ] }, { "name": "MembersReset", "arguments": [], "documentation": [ " The membership was reset; see the transaction for who the new set is." ] }, { "name": "KeyChanged", "arguments": [], "documentation": [ " One of the members' keys changed." ] }, { "name": "Dummy", "arguments": [ "sp_std::marker::PhantomData<(AccountId, Event)>" ], "documentation": [ " Phantom member, never used." ] } ], "constants": [], "errors": [ { "name": "AlreadyMember", "documentation": [ " Already a member." ] }, { "name": "NotMember", "documentation": [ " Not a member." ] } ], "index": 15 }metadata generated by new macro
{ "name": "TechnicalMembership", "storage": { "prefix": "TechnicalMembership", "entries": [ { "name": "Members", "modifier": "Default", "ty": { "Plain": "Vec<T::AccountId>" }, "default": [ 0 ], "documentation": [ " The current membership, stored as an ordered Vec." ] }, { "name": "Prime", "modifier": "Optional", "ty": { "Plain": "T::AccountId" }, "default": [ 0 ], "documentation": [ " The current prime member, if one exists." ] } ] }, "calls": [ { "name": "add_member", "arguments": [ { "name": "who", "ty": "T::AccountId" } ], "documentation": [ " Add a member `who` to the set.", "", " May only be called from `T::AddOrigin`." ] }, { "name": "remove_member", "arguments": [ { "name": "who", "ty": "T::AccountId" } ], "documentation": [ " Remove a member `who` from the set.", "", " May only be called from `T::RemoveOrigin`." ] }, { "name": "swap_member", "arguments": [ { "name": "remove", "ty": "T::AccountId" }, { "name": "add", "ty": "T::AccountId" } ], "documentation": [ " Swap out one member `remove` for another `add`.", "", " May only be called from `T::SwapOrigin`.", "", " Prime membership is *not* passed from `remove` to `add`, if extant." ] }, { "name": "reset_members", "arguments": [ { "name": "members", "ty": "Vec<T::AccountId>" } ], "documentation": [ " Change the membership to a new set, disregarding the existing membership. Be nice and", " pass `members` pre-sorted.", "", " May only be called from `T::ResetOrigin`." ] }, { "name": "change_key", "arguments": [ { "name": "new", "ty": "T::AccountId" } ], "documentation": [ " Swap out the sending member for some other key `new`.", "", " May only be called from `Signed` origin of a current member.", "", " Prime membership is passed from the origin account to `new`, if extant." ] }, { "name": "set_prime", "arguments": [ { "name": "who", "ty": "T::AccountId" } ], "documentation": [ " Set the prime member. Must be a current member.", "", " May only be called from `T::PrimeOrigin`." ] }, { "name": "clear_prime", "arguments": [], "documentation": [ " Remove the prime member if it exists.", "", " May only be called from `T::PrimeOrigin`." ] } ], "event": [ { "name": "MemberAdded", "arguments": [], "documentation": [ " The given member was added; see the transaction for who." ] }, { "name": "MemberRemoved", "arguments": [], "documentation": [ " The given member was removed; see the transaction for who." ] }, { "name": "MembersSwapped", "arguments": [], "documentation": [ " Two members were swapped; see the transaction for who." ] }, { "name": "MembersReset", "arguments": [], "documentation": [ " The membership was reset; see the transaction for who the new set is." ] }, { "name": "KeyChanged", "arguments": [], "documentation": [ " One of the members' keys changed." ] }, { "name": "Dummy", "arguments": [ "sp_std::marker::PhantomData<(AccountId, Event)>" ], "documentation": [ " Phantom member, never used." ] } ], "constants": [], "errors": [ { "name": "AlreadyMember", "documentation": [ " Already a member." ] }, { "name": "NotMember", "documentation": [ " Not a member." ] } ], "index": 15 }diff:
From https://crates.parity.io/frame_support/attr.pallet.html#checking-upgrade-guidelines
So users of the pallet must be careful about the name they used in
construct_runtime!. Hence theruntime-migrationlabel, which might not be needed depending on the configuration of the pallet.polkadotandkusamauseTechnicalMembershipas pallet name (but the current module_prefix isInstance1Membership), thus need to migrate the storages.polkadot companion: paritytech/polkadot#3263