Rename ModuleToIndex to PalletRuntimeSetup (#7148)

* Rename `ModuleToIndex` to `PalletRuntimeSetup`

Besides the renaming it also adds support getting the name of a pallet
as configured in the runtime.

* Rename it to `PalletInfo`

* Remove accidentally added files
This commit is contained in:
Bastian Köcher
2020-09-22 15:39:56 +02:00
committed by GitHub
parent 22632efc5f
commit 86594727d9
62 changed files with 119 additions and 88 deletions
+7 -5
View File
@@ -117,7 +117,7 @@ use frame_support::{
decl_module, decl_event, decl_storage, decl_error, Parameter, ensure, debug,
storage,
traits::{
Contains, Get, ModuleToIndex, OnNewAccount, OnKilledAccount, IsDeadAccount, Happened,
Contains, Get, PalletInfo, OnNewAccount, OnKilledAccount, IsDeadAccount, Happened,
StoredMap, EnsureOrigin, OriginTrait, Filter,
},
weights::{
@@ -256,11 +256,13 @@ pub trait Trait: 'static + Eq + Clone {
/// Get the chain's current version.
type Version: Get<RuntimeVersion>;
/// Convert a module to its index in the runtime.
/// Provides information about the pallet setup in the runtime.
///
/// Expects the `ModuleToIndex` type that is being generated by `construct_runtime!` in the
/// runtime. For tests it is okay to use `()` as type (returns `0` for each input).
type ModuleToIndex: ModuleToIndex;
/// Expects the `PalletInfo` type that is being generated by `construct_runtime!` in the
/// runtime.
///
/// For tests it is okay to use `()` as type, however it will provide "useless" data.
type PalletInfo: PalletInfo;
/// Data to be associated with an account (other than nonce/transaction counter, which this
/// module does regardless).
+1 -1
View File
@@ -101,7 +101,7 @@ impl Trait for Test {
type AvailableBlockRatio = AvailableBlockRatio;
type MaximumBlockLength = MaximumBlockLength;
type Version = Version;
type ModuleToIndex = ();
type PalletInfo = ();
type AccountData = u32;
type OnNewAccount = ();
type OnKilledAccount = RecordKilled;