Skip to content

Commit

Permalink
Switch All construct_runtimes to New Syntax (paritytech#2979)
Browse files Browse the repository at this point in the history
Clean up all the old syntax.

---------

Co-authored-by: command-bot <>
Co-authored-by: gupnik <nikhilgupta.iitk@gmail.com>
Co-authored-by: Nikhil Gupta <17176722+gupnik@users.noreply.github.com>
Co-authored-by: Maksym H <1177472+mordamax@users.noreply.github.com>
  • Loading branch information
4 people authored Jan 22, 2024
1 parent 997d02e commit 53c113c
Show file tree
Hide file tree
Showing 95 changed files with 278 additions and 302 deletions.
2 changes: 1 addition & 1 deletion substrate/bin/minimal/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type SignedExtra = (
);

construct_runtime!(
pub struct Runtime {
pub enum Runtime {
System: frame_system,
Timestamp: pallet_timestamp,

Expand Down
2 changes: 1 addition & 1 deletion substrate/bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl pallet_template::Config for Runtime {

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub struct Runtime {
pub enum Runtime {
System: frame_system,
Timestamp: pallet_timestamp,
Aura: pallet_aura,
Expand Down
11 changes: 5 additions & 6 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2083,8 +2083,7 @@ impl pallet_mixnet::Config for Runtime {
}

construct_runtime!(
pub struct Runtime
{
pub enum Runtime {
System: frame_system,
Utility: pallet_utility,
Babe: pallet_babe,
Expand All @@ -2099,11 +2098,11 @@ construct_runtime!(
AssetConversionTxPayment: pallet_asset_conversion_tx_payment,
ElectionProviderMultiPhase: pallet_election_provider_multi_phase,
Staking: pallet_staking,
Beefy: pallet_beefy::{Pallet, Call, Storage, Config<T>, ValidateUnsigned},
Beefy: pallet_beefy,
// MMR leaf construction must be before session in order to have leaf contents
// refer to block<N-1> consistently. see substrate issue #11797 for details.
Mmr: pallet_mmr::{Pallet, Storage},
MmrLeaf: pallet_beefy_mmr::{Pallet, Storage},
Mmr: pallet_mmr,
MmrLeaf: pallet_beefy_mmr,
Session: pallet_session,
Democracy: pallet_democracy,
Council: pallet_collective::<Instance1>,
Expand All @@ -2118,7 +2117,7 @@ construct_runtime!(
ImOnline: pallet_im_online,
AuthorityDiscovery: pallet_authority_discovery,
Offences: pallet_offences,
Historical: pallet_session_historical::{Pallet},
Historical: pallet_session_historical,
RandomnessCollectiveFlip: pallet_insecure_randomness_collective_flip,
Identity: pallet_identity,
Society: pallet_society,
Expand Down
6 changes: 3 additions & 3 deletions substrate/frame/assets/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ type Block = frame_system::mocking::MockBlock<Test>;
construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>},
System: frame_system,
Balances: pallet_balances,
Assets: pallet_assets,
}
);

Expand Down
6 changes: 3 additions & 3 deletions substrate/frame/atomic-swap/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
AtomicSwap: pallet_atomic_swap::{Pallet, Call, Event<T>},
System: frame_system,
Balances: pallet_balances,
AtomicSwap: pallet_atomic_swap,
}
);

Expand Down
6 changes: 3 additions & 3 deletions substrate/frame/aura/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const SLOT_DURATION: u64 = 2;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
Aura: pallet_aura::{Pallet, Storage, Config<T>},
System: frame_system,
Timestamp: pallet_timestamp,
Aura: pallet_aura,
}
);

Expand Down
6 changes: 3 additions & 3 deletions substrate/frame/authority-discovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ mod tests {
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config<T>},
System: frame_system,
Session: pallet_session,
AuthorityDiscovery: pallet_authority_discovery,
}
);

Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/authorship/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ mod tests {
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Authorship: pallet_authorship::{Pallet, Storage},
System: frame_system,
Authorship: pallet_authorship,
}
);

Expand Down
7 changes: 3 additions & 4 deletions substrate/frame/bags-list/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ impl bags_list::Config for Runtime {

type Block = frame_system::mocking::MockBlock<Runtime>;
frame_support::construct_runtime!(
pub struct Runtime
{
System: frame_system::{Pallet, Call, Storage, Event<T>, Config<T>},
BagsList: bags_list::{Pallet, Call, Storage, Event<T>},
pub enum Runtime {
System: frame_system,
BagsList: bags_list,
}
);

Expand Down
9 changes: 4 additions & 5 deletions substrate/frame/balances/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ impl VariantCount for TestId {
}

frame_support::construct_runtime!(
pub struct Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>},
pub enum Test {
System: frame_system,
Balances: pallet_balances,
TransactionPayment: pallet_transaction_payment,
}
);

Expand Down
10 changes: 5 additions & 5 deletions substrate/frame/beefy-mmr/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ type Block = frame_system::mocking::MockBlock<Test>;
construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
Mmr: pallet_mmr::{Pallet, Storage},
Beefy: pallet_beefy::{Pallet, Config<T>, Storage},
BeefyMmr: pallet_beefy_mmr::{Pallet, Storage},
System: frame_system,
Session: pallet_session,
Mmr: pallet_mmr,
Beefy: pallet_beefy,
BeefyMmr: pallet_beefy_mmr,
}
);

Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/benchmarking/pov/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ mod mock {
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Baseline: crate::{Pallet, Call, Storage, Event<T>},
System: frame_system,
Baseline: crate,
}
);

Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/benchmarking/pov/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ mod mock {
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Baseline: crate::{Pallet, Call, Storage, Event<T>},
System: frame_system,
Baseline: crate,
}
);

Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/benchmarking/src/baseline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub mod mock {
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
System: frame_system,
}
);

Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/benchmarking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
TestPallet: pallet_test::{Pallet, Call, Storage},
System: frame_system,
TestPallet: pallet_test,
}
);

Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/benchmarking/src/tests_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
TestPallet: pallet_test::{Pallet, Call, Storage, Event<T>},
System: frame_system,
TestPallet: pallet_test,
}
);

Expand Down
12 changes: 6 additions & 6 deletions substrate/frame/bounties/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Bounties: pallet_bounties::{Pallet, Call, Storage, Event<T>},
Bounties1: pallet_bounties::<Instance1>::{Pallet, Call, Storage, Event<T>},
Treasury: pallet_treasury::{Pallet, Call, Storage, Config<T>, Event<T>},
Treasury1: pallet_treasury::<Instance1>::{Pallet, Call, Storage, Config<T>, Event<T>},
System: frame_system,
Balances: pallet_balances,
Bounties: pallet_bounties,
Bounties1: pallet_bounties::<Instance1>,
Treasury: pallet_treasury,
Treasury1: pallet_treasury::<Instance1>,
}
);

Expand Down
10 changes: 5 additions & 5 deletions substrate/frame/child-bounties/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ type BountiesError = pallet_bounties::Error<Test>;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Bounties: pallet_bounties::{Pallet, Call, Storage, Event<T>},
Treasury: pallet_treasury::{Pallet, Call, Storage, Config<T>, Event<T>},
ChildBounties: pallet_child_bounties::{Pallet, Call, Storage, Event<T>},
System: frame_system,
Balances: pallet_balances,
Bounties: pallet_bounties,
Treasury: pallet_treasury,
ChildBounties: pallet_child_bounties,
}
);

Expand Down
11 changes: 6 additions & 5 deletions substrate/frame/collective/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, u64,
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Event<T>},
Collective: pallet_collective::<Instance1>::{Pallet, Call, Event<T>, Origin<T>, Config<T>},
CollectiveMajority: pallet_collective::<Instance2>::{Pallet, Call, Event<T>, Origin<T>, Config<T>},
DefaultCollective: pallet_collective::{Pallet, Call, Event<T>, Origin<T>, Config<T>},
Democracy: mock_democracy::{Pallet, Call, Event<T>},
System: frame_system,
Collective: pallet_collective::<Instance1>,
CollectiveMajority: pallet_collective::<Instance2>,
DefaultCollective: pallet_collective,
Democracy: mock_democracy,
}
);

Expand Down Expand Up @@ -176,6 +176,7 @@ impl ExtBuilder {

pub fn build(self) -> sp_io::TestExternalities {
let mut ext: sp_io::TestExternalities = RuntimeGenesisConfig {
system: frame_system::GenesisConfig::default(),
collective: pallet_collective::GenesisConfig {
members: self.collective_members,
phantom: Default::default(),
Expand Down
10 changes: 5 additions & 5 deletions substrate/frame/contracts/mock-network/src/relay_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ impl pallet_message_queue::Config for Runtime {

construct_runtime!(
pub enum Runtime {
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
ParasOrigin: origin::{Pallet, Origin},
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin},
MessageQueue: pallet_message_queue::{Pallet, Event<T>},
System: frame_system,
Balances: pallet_balances,
ParasOrigin: origin,
XcmPallet: pallet_xcm,
MessageQueue: pallet_message_queue,
}
);
14 changes: 7 additions & 7 deletions substrate/frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
Randomness: pallet_insecure_randomness_collective_flip::{Pallet, Storage},
Utility: pallet_utility::{Pallet, Call, Storage, Event},
Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>, HoldReason},
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>},
System: frame_system,
Balances: pallet_balances,
Timestamp: pallet_timestamp,
Randomness: pallet_insecure_randomness_collective_flip,
Utility: pallet_utility,
Contracts: pallet_contracts,
Proxy: pallet_proxy,
Dummy: pallet_dummy
}
);
Expand Down
6 changes: 3 additions & 3 deletions substrate/frame/conviction-voting/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Voting: pallet_conviction_voting::{Pallet, Call, Storage, Event<T>},
System: frame_system,
Balances: pallet_balances,
Voting: pallet_conviction_voting,
}
);

Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/core-fellowship/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
CoreFellowship: pallet_core_fellowship::{Pallet, Call, Storage, Event<T>},
System: frame_system,
CoreFellowship: pallet_core_fellowship,
}
);

Expand Down
8 changes: 4 additions & 4 deletions substrate/frame/democracy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
System: frame_system,
Balances: pallet_balances,
Preimage: pallet_preimage,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>},
Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>},
Scheduler: pallet_scheduler,
Democracy: pallet_democracy,
}
);

Expand Down
9 changes: 4 additions & 5 deletions substrate/frame/election-provider-multi-phase/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ pub type UncheckedExtrinsic =
sp_runtime::generic::UncheckedExtrinsic<AccountId, RuntimeCall, (), ()>;

frame_support::construct_runtime!(
pub struct Runtime
{
System: frame_system::{Pallet, Call, Event<T>, Config<T>},
Balances: pallet_balances::{Pallet, Call, Event<T>, Config<T>},
MultiPhase: multi_phase::{Pallet, Call, Event<T>},
pub enum Runtime {
System: frame_system,
Balances: pallet_balances,
MultiPhase: multi_phase,
}
);

Expand Down
5 changes: 2 additions & 3 deletions substrate/frame/election-provider-support/src/onchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ mod tests {
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;

frame_support::construct_runtime!(
pub struct Runtime
{
System: frame_system::{Pallet, Call, Event<T>},
pub enum Runtime {
System: frame_system,
}
);

Expand Down
Loading

0 comments on commit 53c113c

Please sign in to comment.