-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Make Pallet ModuleId and LockIdentifier Configurable #5695
Make Pallet ModuleId and LockIdentifier Configurable #5695
Conversation
It looks like @emostov signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
Looks about right, can you please check spacing issues with the lines you have introduced (we use tabs), and there seems to be compilation error, maybe just needs to merge master. |
Sync with main report
I merged in upstream/master and it looks like there still is a compilation error in some of the CI jobs. I did a release build and later ran all the non-ignored tests locally. Both seemed to finish without an issue. Not sure what else to try/look at regarding the compilation error. Planning on having an accompanying Polkadot PR up within the next 24hrs as long as I can find a quick resolution to the CI errors. |
…able-module-id merge master
There was a problem hiding this 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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just 2 nitpicks.
frame/elections-phragmen/src/lib.rs
Outdated
@@ -1124,7 +1130,7 @@ mod tests { | |||
|
|||
fn has_lock(who: &u64) -> u64 { | |||
let lock = Balances::locks(who)[0].clone(); | |||
assert_eq!(lock.id, MODULE_ID); | |||
assert_eq!(lock.id, *b"phrelect"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert_eq!(lock.id, *b"phrelect"); | |
assert_eq!(lock.id, ElectionsPhragmenModuleId::get()); |
frame/elections/src/lib.rs
Outdated
@@ -147,6 +145,8 @@ type ApprovalFlag = u32; | |||
const APPROVAL_FLAG_LEN: usize = 32; | |||
|
|||
pub trait Trait: frame_system::Trait { | |||
type ModuleId: Get<LockIdentifier>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a doc comment /// Identifier for the elections-phragmen pallet's lock
and also an equivalent doc comment for elections
.
… into zeke/fix/configurable-module-id Merge in origin branch
Co-Authored-By: Amar Singh <[email protected]>
Please merge master to fix the conflict. |
…emostov/substrate into zeke/fix/configurable-module-id merge origin
Before this gets merged, should I take any steps to ensure that the polkadot companion PR can be merged in quick succession? |
Can we as push to your branch? |
I think you are asking if you can push to my branch? If so, the answer is: yes. Let me know if I need to do anything on my end to make that happen. |
* add module ids to kusama runtime * update kusam with polkadot runtimes to have moduleids configured * trivial * define module id for treasury in crowdfund.rs * crodfund builds without issue * remove commented out code * switch crowdfund to configurable moduleid * test-runtime passing * trivial syntax * add module id to mock * Update `Cargo.lock` Co-authored-by: zeke <[email protected]>
* transition treasury to configurable moduleids * make election module id configurable * convert runtime and pallet to accept module id config elections-phragmen * add ModuleId to evm pallet * change society pallet to configurable module id * delete commented out module_id * delete commented out code and merge in upstream master * try and convert 4 whitespace to tab * fix remaining space to tab conversions * trivial cleaning * delete comment from elections-phragrems tests * trivial * Update frame/elections-phragmen/src/lib.rs * add docs for elections and elections phragmen * make has_lock test get moduleid dynamically * Apply suggestions from code review Co-Authored-By: Amar Singh <[email protected]> * make sure get is imported to evm Co-authored-by: Shawn Tabrizi <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Amar Singh <[email protected]> Co-authored-by: Benjamin Kampmann <[email protected]>
Closes #5149
This PR aims to switch
MODULE_ID
from being hardcoded into pallets over to being specified in runtime configuration.polkadot companion: paritytech/polkadot#1007
Below are the pallets changed and notes:
treasury
elections
elections
does not appear to be incorporated currently.elections-phragrem
assert_eq!(lock.id, MODULE_ID);
toassert_eq!(lock.id, *b"phrelect");
becauseMODULE_ID
is no longer defined. However, I am not sure if the right value should be dynamic.evm
evm
does not appear to be incorporated currently.Society
Before you submitting, please check that:
Fixes #228
orRelated #1337
.After you've read this notice feel free to remove it.
Thank you!
✄ -----------------------------------------------------------------------------