Skip to content

Commit ca9822a

Browse files
authored
Simplify construct_runtime syntax (#674)
* simplify construct_runtime (#634) * all pallets use the new construct_runtime syntax (#634)
1 parent 42a4284 commit ca9822a

File tree

8 files changed

+152
-151
lines changed

8 files changed

+152
-151
lines changed

node/src/chain_specs/litentry.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,5 +236,6 @@ fn generate_genesis(
236236
aura_ext: Default::default(),
237237
parachain_system: Default::default(),
238238
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
239+
transaction_payment: Default::default(),
239240
}
240241
}

node/src/chain_specs/litmus.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,5 +238,7 @@ fn generate_genesis(
238238
parachain_system: Default::default(),
239239
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
240240
teerex: TeerexConfig { allow_sgx_debug_mode: true },
241+
transaction_payment: Default::default(),
242+
tokens: Default::default(),
241243
}
242244
}

node/src/chain_specs/moonbase.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,5 +221,7 @@ fn generate_genesis(
221221
aura_ext: Default::default(),
222222
parachain_system: Default::default(),
223223
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
224+
transaction_payment: Default::default(),
225+
tokens: Default::default(),
224226
}
225227
}

node/src/chain_specs/rococo.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,7 @@ fn generate_genesis(
222222
parachain_system: Default::default(),
223223
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
224224
teerex: TeerexConfig { allow_sgx_debug_mode: true },
225+
transaction_payment: Default::default(),
226+
tokens: Default::default(),
225227
}
226228
}

runtime/litentry/src/lib.rs

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -760,32 +760,30 @@ construct_runtime! {
760760
UncheckedExtrinsic = UncheckedExtrinsic,
761761
{
762762
// Core
763-
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0,
764-
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 1,
765-
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 2,
766-
Utility: pallet_utility::{Pallet, Call, Event} = 3,
767-
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 4,
768-
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 5,
769-
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 6,
763+
System: frame_system = 0,
764+
Timestamp: pallet_timestamp = 1,
765+
Scheduler: pallet_scheduler = 2,
766+
Utility: pallet_utility = 3,
767+
Multisig: pallet_multisig = 4,
768+
Proxy: pallet_proxy = 5,
769+
Preimage: pallet_preimage = 6,
770770

771771
// Token related
772-
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
773-
Vesting: pallet_vesting::{Pallet, Call, Storage, Event<T>, Config<T>} = 11,
774-
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 12,
775-
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 13,
772+
Balances: pallet_balances = 10,
773+
Vesting: pallet_vesting = 11,
774+
TransactionPayment: pallet_transaction_payment = 12,
775+
Treasury: pallet_treasury = 13,
776776

777777
// Governance
778-
Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>} = 21,
779-
Council: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 22,
780-
CouncilMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 23,
781-
TechnicalCommittee: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 24,
782-
TechnicalCommitteeMembership: pallet_membership::<Instance2>::{Pallet, Call, Storage, Event<T>, Config<T>} = 25,
778+
Democracy: pallet_democracy = 21,
779+
Council: pallet_collective::<Instance1> = 22,
780+
CouncilMembership: pallet_membership::<Instance1> = 23,
781+
TechnicalCommittee: pallet_collective::<Instance2> = 24,
782+
TechnicalCommitteeMembership: pallet_membership::<Instance2> = 25,
783783

784784
// Parachain
785-
ParachainSystem: cumulus_pallet_parachain_system::{
786-
Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
787-
} = 30,
788-
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 31,
785+
ParachainSystem: cumulus_pallet_parachain_system = 30,
786+
ParachainInfo: parachain_info = 31,
789787

790788
// Collator support
791789
// About the order of these 5 pallets, the comment in cumulus seems to be outdated.
@@ -799,26 +797,26 @@ construct_runtime! {
799797
//
800798
// also see the comment above `AllPalletsWithSystem` and
801799
// https://github.com/litentry/litentry-parachain/issues/336
802-
Authorship: pallet_authorship::{Pallet, Call, Storage} = 40,
803-
CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event<T>, Config<T>} = 41,
804-
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 42,
805-
Aura: pallet_aura::{Pallet, Storage, Config<T>} = 43,
806-
AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 44,
800+
Authorship: pallet_authorship = 40,
801+
CollatorSelection: pallet_collator_selection = 41,
802+
Session: pallet_session = 42,
803+
Aura: pallet_aura = 43,
804+
AuraExt: cumulus_pallet_aura_ext = 44,
807805

808806
// XCM helpers
809-
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,
810-
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin, Config} = 51,
811-
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,
812-
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,
807+
XcmpQueue: cumulus_pallet_xcmp_queue = 50,
808+
PolkadotXcm: pallet_xcm = 51,
809+
CumulusXcm: cumulus_pallet_xcm = 52,
810+
DmpQueue: cumulus_pallet_dmp_queue = 53,
813811

814812
// Litentry pallets
815-
ChainBridge: pallet_bridge::{Pallet, Call, Storage, Event<T>} = 60,
816-
BridgeTransfer: pallet_bridge_transfer::{Pallet, Call, Event<T>, Storage} = 61,
817-
Drop3: pallet_drop3::{Pallet, Call, Storage, Event<T>} = 62,
818-
ExtrinsicFilter: pallet_extrinsic_filter::{Pallet, Call, Storage, Event<T>} = 63,
813+
ChainBridge: pallet_bridge = 60,
814+
BridgeTransfer: pallet_bridge_transfer = 61,
815+
Drop3: pallet_drop3 = 62,
816+
ExtrinsicFilter: pallet_extrinsic_filter = 63,
819817

820818
// TMP
821-
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 255,
819+
Sudo: pallet_sudo = 255,
822820
}
823821
}
824822

runtime/litmus/src/lib.rs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -794,32 +794,30 @@ construct_runtime! {
794794
UncheckedExtrinsic = UncheckedExtrinsic,
795795
{
796796
// Core
797-
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0,
798-
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 1,
799-
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 2,
800-
Utility: pallet_utility::{Pallet, Call, Event} = 3,
801-
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 4,
802-
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 5,
803-
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 6,
797+
System: frame_system = 0,
798+
Timestamp: pallet_timestamp= 1,
799+
Scheduler: pallet_scheduler = 2,
800+
Utility: pallet_utility = 3,
801+
Multisig: pallet_multisig = 4,
802+
Proxy: pallet_proxy = 5,
803+
Preimage: pallet_preimage = 6,
804804

805805
// Token related
806-
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
807-
Vesting: pallet_vesting::{Pallet, Call, Storage, Event<T>, Config<T>} = 11,
808-
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 12,
809-
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 13,
806+
Balances: pallet_balances= 10,
807+
Vesting: pallet_vesting = 11,
808+
TransactionPayment: pallet_transaction_payment = 12,
809+
Treasury: pallet_treasury = 13,
810810

811811
// Governance
812-
Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>} = 21,
813-
Council: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 22,
814-
CouncilMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 23,
815-
TechnicalCommittee: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 24,
816-
TechnicalCommitteeMembership: pallet_membership::<Instance2>::{Pallet, Call, Storage, Event<T>, Config<T>} = 25,
812+
Democracy: pallet_democracy = 21,
813+
Council: pallet_collective::<Instance1> = 22,
814+
CouncilMembership: pallet_membership::<Instance1> = 23,
815+
TechnicalCommittee: pallet_collective::<Instance2> = 24,
816+
TechnicalCommitteeMembership: pallet_membership::<Instance2>= 25,
817817

818818
// Parachain
819-
ParachainSystem: cumulus_pallet_parachain_system::{
820-
Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
821-
} = 30,
822-
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 31,
819+
ParachainSystem: cumulus_pallet_parachain_system = 30,
820+
ParachainInfo: parachain_info = 31,
823821

824822
// Collator support
825823
// About the order of these 5 pallets, the comment in cumulus seems to be outdated.
@@ -833,34 +831,34 @@ construct_runtime! {
833831
//
834832
// also see the comment above `AllPalletsWithSystem` and
835833
// https://github.com/litentry/litentry-parachain/issues/336
836-
Authorship: pallet_authorship::{Pallet, Call, Storage} = 40,
837-
CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event<T>, Config<T>} = 41,
838-
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 42,
839-
Aura: pallet_aura::{Pallet, Storage, Config<T>} = 43,
840-
AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 44,
834+
Authorship: pallet_authorship = 40,
835+
CollatorSelection: pallet_collator_selection= 41,
836+
Session: pallet_session = 42,
837+
Aura: pallet_aura = 43,
838+
AuraExt: cumulus_pallet_aura_ext = 44,
841839

842840
// XCM helpers
843-
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,
844-
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 51,
845-
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,
846-
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,
847-
XTokens: orml_xtokens::{Pallet, Call, Storage, Event<T>} = 54,
848-
Tokens: orml_tokens::{Pallet, Call, Storage, Event<T>} = 55,
841+
XcmpQueue: cumulus_pallet_xcmp_queue = 50,
842+
PolkadotXcm: pallet_xcm = 51,
843+
CumulusXcm: cumulus_pallet_xcm = 52,
844+
DmpQueue: cumulus_pallet_dmp_queue = 53,
845+
XTokens: orml_xtokens = 54,
846+
Tokens: orml_tokens = 55,
849847

850848
// Litmus pallets
851-
ChainBridge: pallet_bridge::{Pallet, Call, Storage, Event<T>} = 60,
852-
BridgeTransfer: pallet_bridge_transfer::{Pallet, Call, Event<T>, Storage} = 61,
853-
Drop3: pallet_drop3::{Pallet, Call, Storage, Event<T>} = 62,
854-
ExtrinsicFilter: pallet_extrinsic_filter::{Pallet, Call, Storage, Event<T>} = 63,
855-
IdentityManagement: pallet_identity_management::{Pallet, Call, Storage, Event<T>} = 64,
856-
AssetManager: pallet_asset_manager::{Pallet, Call, Storage, Event<T>} = 65,
849+
ChainBridge: pallet_bridge = 60,
850+
BridgeTransfer: pallet_bridge_transfer = 61,
851+
Drop3: pallet_drop3 = 62,
852+
ExtrinsicFilter: pallet_extrinsic_filter = 63,
853+
IdentityManagement: pallet_identity_management = 64,
854+
AssetManager: pallet_asset_manager = 65,
857855

858856
// TEE
859-
Teerex: pallet_teerex::{Pallet, Call, Config, Storage, Event<T>} = 90,
860-
Sidechain: pallet_sidechain::{Pallet, Call, Storage, Event<T>} = 91,
857+
Teerex: pallet_teerex = 90,
858+
Sidechain: pallet_sidechain = 91,
861859

862860
// TMP
863-
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 255,
861+
Sudo: pallet_sudo= 255,
864862
}
865863
}
866864

@@ -884,13 +882,15 @@ impl Contains<Call> for BaseCallFilter {
884882
}
885883

886884
pub struct SafeModeFilter;
885+
887886
impl Contains<Call> for SafeModeFilter {
888887
fn contains(_call: &Call) -> bool {
889888
false
890889
}
891890
}
892891

893892
pub struct NormalModeFilter;
893+
894894
impl Contains<Call> for NormalModeFilter {
895895
fn contains(call: &Call) -> bool {
896896
matches!(

runtime/moonbase/src/lib.rs

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -767,32 +767,30 @@ construct_runtime! {
767767
UncheckedExtrinsic = UncheckedExtrinsic,
768768
{
769769
// Core
770-
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0,
771-
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 1,
772-
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 2,
773-
Utility: pallet_utility::{Pallet, Call, Event} = 3,
774-
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 4,
775-
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 5,
776-
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 6,
770+
System: frame_system = 0,
771+
Timestamp: pallet_timestamp = 1,
772+
Scheduler: pallet_scheduler = 2,
773+
Utility: pallet_utility= 3,
774+
Multisig: pallet_multisig = 4,
775+
Proxy: pallet_proxy = 5,
776+
Preimage: pallet_preimage = 6,
777777

778778
// Token related
779-
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
780-
Vesting: pallet_vesting::{Pallet, Call, Storage, Event<T>, Config<T>} = 11,
781-
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 12,
782-
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 13,
779+
Balances: pallet_balances = 10,
780+
Vesting: pallet_vesting = 11,
781+
TransactionPayment: pallet_transaction_payment = 12,
782+
Treasury: pallet_treasury = 13,
783783

784784
// Governance
785-
Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>} = 21,
786-
Council: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 22,
787-
CouncilMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 23,
788-
TechnicalCommittee: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 24,
789-
TechnicalCommitteeMembership: pallet_membership::<Instance2>::{Pallet, Call, Storage, Event<T>, Config<T>} = 25,
785+
Democracy: pallet_democracy = 21,
786+
Council: pallet_collective::<Instance1> = 22,
787+
CouncilMembership: pallet_membership::<Instance1> = 23,
788+
TechnicalCommittee: pallet_collective::<Instance2> = 24,
789+
TechnicalCommitteeMembership: pallet_membership::<Instance2> = 25,
790790

791791
// Parachain
792-
ParachainSystem: cumulus_pallet_parachain_system::{
793-
Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
794-
} = 30,
795-
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 31,
792+
ParachainSystem: cumulus_pallet_parachain_system = 30,
793+
ParachainInfo: parachain_info = 31,
796794

797795
// Collator support
798796
// About the order of these 5 pallets, the comment in cumulus seems to be outdated.
@@ -806,29 +804,29 @@ construct_runtime! {
806804
//
807805
// also see the comment above `AllPalletsWithSystem` and
808806
// https://github.com/litentry/litentry-parachain/issues/336
809-
Authorship: pallet_authorship::{Pallet, Call, Storage} = 40,
810-
CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event<T>, Config<T>} = 41,
811-
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 42,
812-
Aura: pallet_aura::{Pallet, Storage, Config<T>} = 43,
813-
AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 44,
807+
Authorship: pallet_authorship = 40,
808+
CollatorSelection: pallet_collator_selection = 41,
809+
Session: pallet_session = 42,
810+
Aura: pallet_aura = 43,
811+
AuraExt: cumulus_pallet_aura_ext = 44,
814812

815813
// XCM helpers
816-
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,
817-
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 51,
818-
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,
819-
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,
820-
XTokens: orml_xtokens::{Pallet, Call, Storage, Event<T>} = 54,
821-
Tokens: orml_tokens::{Pallet, Call, Storage, Event<T>} = 55,
814+
XcmpQueue: cumulus_pallet_xcmp_queue = 50,
815+
PolkadotXcm: pallet_xcm = 51,
816+
CumulusXcm: cumulus_pallet_xcm = 52,
817+
DmpQueue: cumulus_pallet_dmp_queue = 53,
818+
XTokens: orml_xtokens = 54,
819+
Tokens: orml_tokens = 55,
822820

823821
// Moonbase pallets
824-
ChainBridge: pallet_bridge::{Pallet, Call, Storage, Event<T>} = 60,
825-
BridgeTransfer: pallet_bridge_transfer::{Pallet, Call, Event<T>, Storage} = 61,
826-
Drop3: pallet_drop3::{Pallet, Call, Storage, Event<T>} = 62,
827-
ExtrinsicFilter: pallet_extrinsic_filter::{Pallet, Call, Storage, Event<T>} = 63,
828-
AssetManager: pallet_asset_manager::{Pallet, Call, Storage, Event<T>} = 65, // save 64 for TEE identity Manager?
822+
ChainBridge: pallet_bridge = 60,
823+
BridgeTransfer: pallet_bridge_transfer = 61,
824+
Drop3: pallet_drop3 = 62,
825+
ExtrinsicFilter: pallet_extrinsic_filter = 63,
826+
AssetManager: pallet_asset_manager = 65, // save 64 for TEE identity Manager?
829827

830828
// TMP
831-
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 255,
829+
Sudo: pallet_sudo = 255,
832830
}
833831
}
834832

0 commit comments

Comments
 (0)