Replace 'Module' with 'Pallet' in construct_runtime macro (#8372)

* Use 'Pallet' struct in construct_runtime.

* Fix genesis and metadata macro.

* Fix 'Pallet' type alias.

* Replace 'Module' with 'Pallet' for all construct_runtime use cases.

* Replace more deprecated 'Module' struct.

* Bring back AllModules and AllPalletsWithSystem type, but deprecate them.

* Replace deprecated 'Module' struct from merge master.

* Minor fix.

* Fix UI tests.

* Revert UI override in derive_no_bound.

* Fix more deprecated 'Module' use from master branch.

* Fix more deprecated 'Module' use from master branch.
This commit is contained in:
Shaun Wang
2021-03-18 21:50:08 +13:00
committed by GitHub
parent 05f24931a9
commit 2e5522444a
157 changed files with 881 additions and 864 deletions
+14 -14
View File
@@ -451,13 +451,13 @@ impl From<frame_system::Event<Runtime>> for Event {
impl frame_support::traits::PalletInfo for Runtime {
fn index<P: 'static>() -> Option<usize> {
let type_id = sp_std::any::TypeId::of::<P>();
if type_id == sp_std::any::TypeId::of::<system::Module<Runtime>>() {
if type_id == sp_std::any::TypeId::of::<system::Pallet<Runtime>>() {
return Some(0)
}
if type_id == sp_std::any::TypeId::of::<pallet_timestamp::Module<Runtime>>() {
if type_id == sp_std::any::TypeId::of::<pallet_timestamp::Pallet<Runtime>>() {
return Some(1)
}
if type_id == sp_std::any::TypeId::of::<pallet_babe::Module<Runtime>>() {
if type_id == sp_std::any::TypeId::of::<pallet_babe::Pallet<Runtime>>() {
return Some(2)
}
@@ -465,13 +465,13 @@ impl frame_support::traits::PalletInfo for Runtime {
}
fn name<P: 'static>() -> Option<&'static str> {
let type_id = sp_std::any::TypeId::of::<P>();
if type_id == sp_std::any::TypeId::of::<system::Module<Runtime>>() {
if type_id == sp_std::any::TypeId::of::<system::Pallet<Runtime>>() {
return Some("System")
}
if type_id == sp_std::any::TypeId::of::<pallet_timestamp::Module<Runtime>>() {
if type_id == sp_std::any::TypeId::of::<pallet_timestamp::Pallet<Runtime>>() {
return Some("Timestamp")
}
if type_id == sp_std::any::TypeId::of::<pallet_babe::Module<Runtime>>() {
if type_id == sp_std::any::TypeId::of::<pallet_babe::Pallet<Runtime>>() {
return Some("Babe")
}
@@ -782,21 +782,21 @@ cfg_if! {
c: (3, 10),
genesis_authorities: system::authorities()
.into_iter().map(|x|(x, 1)).collect(),
randomness: <pallet_babe::Module<Runtime>>::randomness(),
randomness: <pallet_babe::Pallet<Runtime>>::randomness(),
allowed_slots: AllowedSlots::PrimaryAndSecondaryPlainSlots,
}
}
fn current_epoch_start() -> Slot {
<pallet_babe::Module<Runtime>>::current_epoch_start()
<pallet_babe::Pallet<Runtime>>::current_epoch_start()
}
fn current_epoch() -> sp_consensus_babe::Epoch {
<pallet_babe::Module<Runtime>>::current_epoch()
<pallet_babe::Pallet<Runtime>>::current_epoch()
}
fn next_epoch() -> sp_consensus_babe::Epoch {
<pallet_babe::Module<Runtime>>::next_epoch()
<pallet_babe::Pallet<Runtime>>::next_epoch()
}
fn submit_report_equivocation_unsigned_extrinsic(
@@ -1043,21 +1043,21 @@ cfg_if! {
c: (3, 10),
genesis_authorities: system::authorities()
.into_iter().map(|x|(x, 1)).collect(),
randomness: <pallet_babe::Module<Runtime>>::randomness(),
randomness: <pallet_babe::Pallet<Runtime>>::randomness(),
allowed_slots: AllowedSlots::PrimaryAndSecondaryPlainSlots,
}
}
fn current_epoch_start() -> Slot {
<pallet_babe::Module<Runtime>>::current_epoch_start()
<pallet_babe::Pallet<Runtime>>::current_epoch_start()
}
fn current_epoch() -> sp_consensus_babe::Epoch {
<pallet_babe::Module<Runtime>>::current_epoch()
<pallet_babe::Pallet<Runtime>>::current_epoch()
}
fn next_epoch() -> sp_consensus_babe::Epoch {
<pallet_babe::Module<Runtime>>::next_epoch()
<pallet_babe::Pallet<Runtime>>::next_epoch()
}
fn submit_report_equivocation_unsigned_extrinsic(