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
+9 -9
View File
@@ -676,7 +676,7 @@ macro_rules! impl_benchmark {
( $( $name_extra:ident ),* )
) => {
impl<T: Config $(<$instance>, $instance: $instance_bound )? >
$crate::Benchmarking<$crate::BenchmarkResults> for Module<T $(, $instance)? >
$crate::Benchmarking<$crate::BenchmarkResults> for Pallet<T $(, $instance)? >
where T: frame_system::Config, $( $where_clause )*
{
fn benchmarks(extra: bool) -> $crate::Vec<&'static [u8]> {
@@ -744,8 +744,8 @@ macro_rules! impl_benchmark {
>::instance(&selected_benchmark, c, verify)?;
// Set the block number to at least 1 so events are deposited.
if $crate::Zero::is_zero(&frame_system::Module::<T>::block_number()) {
frame_system::Module::<T>::set_block_number(1u32.into());
if $crate::Zero::is_zero(&frame_system::Pallet::<T>::block_number()) {
frame_system::Pallet::<T>::set_block_number(1u32.into());
}
// Commit the externalities to the database, flushing the DB cache.
@@ -915,8 +915,8 @@ macro_rules! impl_benchmark_test {
>::instance(&selected_benchmark, &c, true)?;
// Set the block number to at least 1 so events are deposited.
if $crate::Zero::is_zero(&frame_system::Module::<T>::block_number()) {
frame_system::Module::<T>::set_block_number(1u32.into());
if $crate::Zero::is_zero(&frame_system::Pallet::<T>::block_number()) {
frame_system::Pallet::<T>::set_block_number(1u32.into());
}
// Run execution + verification
@@ -961,7 +961,7 @@ macro_rules! impl_benchmark_test {
/// When called in `pallet_example` as
///
/// ```rust,ignore
/// impl_benchmark_test_suite!(Module, crate::tests::new_test_ext(), crate::tests::Test);
/// impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::tests::Test);
/// ```
///
/// It expands to the equivalent of:
@@ -1019,11 +1019,11 @@ macro_rules! impl_benchmark_test {
/// }
///
/// mod tests {
/// // because of macro syntax limitations, neither Module nor benches can be paths, but both have
/// // because of macro syntax limitations, neither Pallet nor benches can be paths, but both have
/// // to be idents in the scope of `impl_benchmark_test_suite`.
/// use crate::{benches, Module};
/// use crate::{benches, Pallet};
///
/// impl_benchmark_test_suite!(Module, new_test_ext(), Test, benchmarks_path = benches);
/// impl_benchmark_test_suite!(Pallet, new_test_ext(), Test, benchmarks_path = benches);
///
/// // new_test_ext and the Test item are defined later in this module
/// }