mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-02 07:07:24 +00:00
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:
@@ -19,90 +19,90 @@ mod parse;
|
||||
|
||||
use frame_support_procedural_tools::syn_ext as ext;
|
||||
use frame_support_procedural_tools::{generate_crate_access, generate_hidden_includes};
|
||||
use parse::{ModuleDeclaration, RuntimeDefinition, WhereSection, ModulePart};
|
||||
use parse::{PalletDeclaration, RuntimeDefinition, WhereSection, PalletPart};
|
||||
use proc_macro::TokenStream;
|
||||
use proc_macro2::{TokenStream as TokenStream2};
|
||||
use quote::quote;
|
||||
use syn::{Ident, Result, TypePath};
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// The fixed name of the system module.
|
||||
const SYSTEM_MODULE_NAME: &str = "System";
|
||||
/// The fixed name of the system pallet.
|
||||
const SYSTEM_PALLET_NAME: &str = "System";
|
||||
|
||||
/// The complete definition of a module with the resulting fixed index.
|
||||
/// The complete definition of a pallet with the resulting fixed index.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Module {
|
||||
pub struct Pallet {
|
||||
pub name: Ident,
|
||||
pub index: u8,
|
||||
pub module: Ident,
|
||||
pub pallet: Ident,
|
||||
pub instance: Option<Ident>,
|
||||
pub module_parts: Vec<ModulePart>,
|
||||
pub pallet_parts: Vec<PalletPart>,
|
||||
}
|
||||
|
||||
impl Module {
|
||||
/// Get resolved module parts
|
||||
fn module_parts(&self) -> &[ModulePart] {
|
||||
&self.module_parts
|
||||
impl Pallet {
|
||||
/// Get resolved pallet parts
|
||||
fn pallet_parts(&self) -> &[PalletPart] {
|
||||
&self.pallet_parts
|
||||
}
|
||||
|
||||
/// Find matching parts
|
||||
fn find_part(&self, name: &str) -> Option<&ModulePart> {
|
||||
self.module_parts.iter().find(|part| part.name() == name)
|
||||
fn find_part(&self, name: &str) -> Option<&PalletPart> {
|
||||
self.pallet_parts.iter().find(|part| part.name() == name)
|
||||
}
|
||||
|
||||
/// Return whether module contains part
|
||||
/// Return whether pallet contains part
|
||||
fn exists_part(&self, name: &str) -> bool {
|
||||
self.find_part(name).is_some()
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert from the parsed module to their final information.
|
||||
/// Assign index to each modules using same rules as rust for fieldless enum.
|
||||
/// Convert from the parsed pallet to their final information.
|
||||
/// Assign index to each pallet using same rules as rust for fieldless enum.
|
||||
/// I.e. implicit are assigned number incrementedly from last explicit or 0.
|
||||
fn complete_modules(decl: impl Iterator<Item = ModuleDeclaration>) -> syn::Result<Vec<Module>> {
|
||||
fn complete_pallets(decl: impl Iterator<Item = PalletDeclaration>) -> syn::Result<Vec<Pallet>> {
|
||||
let mut indices = HashMap::new();
|
||||
let mut last_index: Option<u8> = None;
|
||||
let mut names = HashMap::new();
|
||||
|
||||
decl
|
||||
.map(|module| {
|
||||
let final_index = match module.index {
|
||||
.map(|pallet| {
|
||||
let final_index = match pallet.index {
|
||||
Some(i) => i,
|
||||
None => last_index.map_or(Some(0), |i| i.checked_add(1))
|
||||
.ok_or_else(|| {
|
||||
let msg = "Module index doesn't fit into u8, index is 256";
|
||||
syn::Error::new(module.name.span(), msg)
|
||||
let msg = "Pallet index doesn't fit into u8, index is 256";
|
||||
syn::Error::new(pallet.name.span(), msg)
|
||||
})?,
|
||||
};
|
||||
|
||||
last_index = Some(final_index);
|
||||
|
||||
if let Some(used_module) = indices.insert(final_index, module.name.clone()) {
|
||||
if let Some(used_pallet) = indices.insert(final_index, pallet.name.clone()) {
|
||||
let msg = format!(
|
||||
"Module indices are conflicting: Both modules {} and {} are at index {}",
|
||||
used_module,
|
||||
module.name,
|
||||
"Pallet indices are conflicting: Both pallets {} and {} are at index {}",
|
||||
used_pallet,
|
||||
pallet.name,
|
||||
final_index,
|
||||
);
|
||||
let mut err = syn::Error::new(used_module.span(), &msg);
|
||||
err.combine(syn::Error::new(module.name.span(), msg));
|
||||
let mut err = syn::Error::new(used_pallet.span(), &msg);
|
||||
err.combine(syn::Error::new(pallet.name.span(), msg));
|
||||
return Err(err);
|
||||
}
|
||||
|
||||
if let Some(used_module) = names.insert(module.name.clone(), module.name.span()) {
|
||||
let msg = "Two modules with the same name!";
|
||||
if let Some(used_pallet) = names.insert(pallet.name.clone(), pallet.name.span()) {
|
||||
let msg = "Two pallets with the same name!";
|
||||
|
||||
let mut err = syn::Error::new(used_module, &msg);
|
||||
err.combine(syn::Error::new(module.name.span(), &msg));
|
||||
let mut err = syn::Error::new(used_pallet, &msg);
|
||||
err.combine(syn::Error::new(pallet.name.span(), &msg));
|
||||
return Err(err);
|
||||
}
|
||||
|
||||
Ok(Module {
|
||||
name: module.name,
|
||||
Ok(Pallet {
|
||||
name: pallet.name,
|
||||
index: final_index,
|
||||
module: module.module,
|
||||
instance: module.instance,
|
||||
module_parts: module.module_parts,
|
||||
pallet: pallet.pallet,
|
||||
instance: pallet.instance,
|
||||
pallet_parts: pallet.pallet_parts,
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
@@ -124,55 +124,55 @@ fn construct_runtime_parsed(definition: RuntimeDefinition) -> Result<TokenStream
|
||||
unchecked_extrinsic,
|
||||
..
|
||||
},
|
||||
modules:
|
||||
pallets:
|
||||
ext::Braces {
|
||||
content: ext::Punctuated { inner: modules, .. },
|
||||
token: modules_token,
|
||||
content: ext::Punctuated { inner: pallets, .. },
|
||||
token: pallets_token,
|
||||
},
|
||||
..
|
||||
} = definition;
|
||||
|
||||
let modules = complete_modules(modules.into_iter())?;
|
||||
let pallets = complete_pallets(pallets.into_iter())?;
|
||||
|
||||
let system_module = modules.iter()
|
||||
.find(|decl| decl.name == SYSTEM_MODULE_NAME)
|
||||
let system_pallet = pallets.iter()
|
||||
.find(|decl| decl.name == SYSTEM_PALLET_NAME)
|
||||
.ok_or_else(|| syn::Error::new(
|
||||
modules_token.span,
|
||||
"`System` module declaration is missing. \
|
||||
Please add this line: `System: frame_system::{Module, Call, Storage, Config, Event<T>},`",
|
||||
pallets_token.span,
|
||||
"`System` pallet declaration is missing. \
|
||||
Please add this line: `System: frame_system::{Pallet, Call, Storage, Config, Event<T>},`",
|
||||
))?;
|
||||
|
||||
let hidden_crate_name = "construct_runtime";
|
||||
let scrate = generate_crate_access(&hidden_crate_name, "frame-support");
|
||||
let scrate_decl = generate_hidden_includes(&hidden_crate_name, "frame-support");
|
||||
|
||||
let all_but_system_modules = modules.iter().filter(|module| module.name != SYSTEM_MODULE_NAME);
|
||||
let all_but_system_pallets = pallets.iter().filter(|pallet| pallet.name != SYSTEM_PALLET_NAME);
|
||||
|
||||
let outer_event = decl_outer_event(
|
||||
&name,
|
||||
modules.iter(),
|
||||
pallets.iter(),
|
||||
&scrate,
|
||||
)?;
|
||||
|
||||
let outer_origin = decl_outer_origin(
|
||||
&name,
|
||||
all_but_system_modules,
|
||||
&system_module,
|
||||
all_but_system_pallets,
|
||||
&system_pallet,
|
||||
&scrate,
|
||||
)?;
|
||||
let all_modules = decl_all_modules(&name, modules.iter());
|
||||
let module_to_index = decl_pallet_runtime_setup(&modules, &scrate);
|
||||
let all_pallets = decl_all_pallets(&name, pallets.iter());
|
||||
let pallet_to_index = decl_pallet_runtime_setup(&pallets, &scrate);
|
||||
|
||||
let dispatch = decl_outer_dispatch(&name, modules.iter(), &scrate);
|
||||
let metadata = decl_runtime_metadata(&name, modules.iter(), &scrate, &unchecked_extrinsic);
|
||||
let outer_config = decl_outer_config(&name, modules.iter(), &scrate);
|
||||
let dispatch = decl_outer_dispatch(&name, pallets.iter(), &scrate);
|
||||
let metadata = decl_runtime_metadata(&name, pallets.iter(), &scrate, &unchecked_extrinsic);
|
||||
let outer_config = decl_outer_config(&name, pallets.iter(), &scrate);
|
||||
let inherent = decl_outer_inherent(
|
||||
&block,
|
||||
&unchecked_extrinsic,
|
||||
modules.iter(),
|
||||
pallets.iter(),
|
||||
&scrate,
|
||||
);
|
||||
let validate_unsigned = decl_validate_unsigned(&name, modules.iter(), &scrate);
|
||||
let validate_unsigned = decl_validate_unsigned(&name, pallets.iter(), &scrate);
|
||||
let integrity_test = decl_integrity_test(&scrate);
|
||||
|
||||
let res = quote!(
|
||||
@@ -197,9 +197,9 @@ fn construct_runtime_parsed(definition: RuntimeDefinition) -> Result<TokenStream
|
||||
|
||||
#outer_origin
|
||||
|
||||
#all_modules
|
||||
#all_pallets
|
||||
|
||||
#module_to_index
|
||||
#pallet_to_index
|
||||
|
||||
#dispatch
|
||||
|
||||
@@ -219,16 +219,16 @@ fn construct_runtime_parsed(definition: RuntimeDefinition) -> Result<TokenStream
|
||||
|
||||
fn decl_validate_unsigned<'a>(
|
||||
runtime: &'a Ident,
|
||||
module_declarations: impl Iterator<Item = &'a Module>,
|
||||
pallet_declarations: impl Iterator<Item = &'a Pallet>,
|
||||
scrate: &'a TokenStream2,
|
||||
) -> TokenStream2 {
|
||||
let modules_tokens = module_declarations
|
||||
.filter(|module_declaration| module_declaration.exists_part("ValidateUnsigned"))
|
||||
.map(|module_declaration| &module_declaration.name);
|
||||
let pallets_tokens = pallet_declarations
|
||||
.filter(|pallet_declaration| pallet_declaration.exists_part("ValidateUnsigned"))
|
||||
.map(|pallet_declaration| &pallet_declaration.name);
|
||||
quote!(
|
||||
#scrate::impl_outer_validate_unsigned!(
|
||||
impl ValidateUnsigned for #runtime {
|
||||
#( #modules_tokens )*
|
||||
#( #pallets_tokens )*
|
||||
}
|
||||
);
|
||||
)
|
||||
@@ -237,13 +237,13 @@ fn decl_validate_unsigned<'a>(
|
||||
fn decl_outer_inherent<'a>(
|
||||
block: &'a syn::TypePath,
|
||||
unchecked_extrinsic: &'a syn::TypePath,
|
||||
module_declarations: impl Iterator<Item = &'a Module>,
|
||||
pallet_declarations: impl Iterator<Item = &'a Pallet>,
|
||||
scrate: &'a TokenStream2,
|
||||
) -> TokenStream2 {
|
||||
let modules_tokens = module_declarations.filter_map(|module_declaration| {
|
||||
let maybe_config_part = module_declaration.find_part("Inherent");
|
||||
let pallets_tokens = pallet_declarations.filter_map(|pallet_declaration| {
|
||||
let maybe_config_part = pallet_declaration.find_part("Inherent");
|
||||
maybe_config_part.map(|_| {
|
||||
let name = &module_declaration.name;
|
||||
let name = &pallet_declaration.name;
|
||||
quote!(#name,)
|
||||
})
|
||||
});
|
||||
@@ -253,7 +253,7 @@ fn decl_outer_inherent<'a>(
|
||||
Block = #block,
|
||||
UncheckedExtrinsic = #unchecked_extrinsic
|
||||
{
|
||||
#(#modules_tokens)*
|
||||
#(#pallets_tokens)*
|
||||
}
|
||||
);
|
||||
)
|
||||
@@ -261,37 +261,37 @@ fn decl_outer_inherent<'a>(
|
||||
|
||||
fn decl_outer_config<'a>(
|
||||
runtime: &'a Ident,
|
||||
module_declarations: impl Iterator<Item = &'a Module>,
|
||||
pallet_declarations: impl Iterator<Item = &'a Pallet>,
|
||||
scrate: &'a TokenStream2,
|
||||
) -> TokenStream2 {
|
||||
let modules_tokens = module_declarations
|
||||
.filter_map(|module_declaration| {
|
||||
module_declaration.find_part("Config").map(|part| {
|
||||
let pallets_tokens = pallet_declarations
|
||||
.filter_map(|pallet_declaration| {
|
||||
pallet_declaration.find_part("Config").map(|part| {
|
||||
let transformed_generics: Vec<_> = part
|
||||
.generics
|
||||
.params
|
||||
.iter()
|
||||
.map(|param| quote!(<#param>))
|
||||
.collect();
|
||||
(module_declaration, transformed_generics)
|
||||
(pallet_declaration, transformed_generics)
|
||||
})
|
||||
})
|
||||
.map(|(module_declaration, generics)| {
|
||||
let module = &module_declaration.module;
|
||||
.map(|(pallet_declaration, generics)| {
|
||||
let pallet = &pallet_declaration.pallet;
|
||||
let name = Ident::new(
|
||||
&format!("{}Config", module_declaration.name),
|
||||
module_declaration.name.span(),
|
||||
&format!("{}Config", pallet_declaration.name),
|
||||
pallet_declaration.name.span(),
|
||||
);
|
||||
let instance = module_declaration.instance.as_ref().into_iter();
|
||||
let instance = pallet_declaration.instance.as_ref().into_iter();
|
||||
quote!(
|
||||
#name =>
|
||||
#module #(#instance)* #(#generics)*,
|
||||
#pallet #(#instance)* #(#generics)*,
|
||||
)
|
||||
});
|
||||
quote!(
|
||||
#scrate::impl_outer_config! {
|
||||
pub struct GenesisConfig for #runtime where AllModulesWithSystem = AllModulesWithSystem {
|
||||
#(#modules_tokens)*
|
||||
pub struct GenesisConfig for #runtime where AllPalletsWithSystem = AllPalletsWithSystem {
|
||||
#(#pallets_tokens)*
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -299,63 +299,63 @@ fn decl_outer_config<'a>(
|
||||
|
||||
fn decl_runtime_metadata<'a>(
|
||||
runtime: &'a Ident,
|
||||
module_declarations: impl Iterator<Item = &'a Module>,
|
||||
pallet_declarations: impl Iterator<Item = &'a Pallet>,
|
||||
scrate: &'a TokenStream2,
|
||||
extrinsic: &TypePath,
|
||||
) -> TokenStream2 {
|
||||
let modules_tokens = module_declarations
|
||||
.filter_map(|module_declaration| {
|
||||
module_declaration.find_part("Module").map(|_| {
|
||||
let filtered_names: Vec<_> = module_declaration
|
||||
.module_parts()
|
||||
let pallets_tokens = pallet_declarations
|
||||
.filter_map(|pallet_declaration| {
|
||||
pallet_declaration.find_part("Pallet").map(|_| {
|
||||
let filtered_names: Vec<_> = pallet_declaration
|
||||
.pallet_parts()
|
||||
.iter()
|
||||
.filter(|part| part.name() != "Module")
|
||||
.filter(|part| part.name() != "Pallet")
|
||||
.map(|part| part.ident())
|
||||
.collect();
|
||||
(module_declaration, filtered_names)
|
||||
(pallet_declaration, filtered_names)
|
||||
})
|
||||
})
|
||||
.map(|(module_declaration, filtered_names)| {
|
||||
let module = &module_declaration.module;
|
||||
let name = &module_declaration.name;
|
||||
let instance = module_declaration
|
||||
.map(|(pallet_declaration, filtered_names)| {
|
||||
let pallet = &pallet_declaration.pallet;
|
||||
let name = &pallet_declaration.name;
|
||||
let instance = pallet_declaration
|
||||
.instance
|
||||
.as_ref()
|
||||
.map(|name| quote!(<#name>))
|
||||
.into_iter();
|
||||
|
||||
let index = module_declaration.index;
|
||||
let index = pallet_declaration.index;
|
||||
|
||||
quote!(
|
||||
#module::Module #(#instance)* as #name { index #index } with #(#filtered_names)*,
|
||||
#pallet::Pallet #(#instance)* as #name { index #index } with #(#filtered_names)*,
|
||||
)
|
||||
});
|
||||
quote!(
|
||||
#scrate::impl_runtime_metadata!{
|
||||
for #runtime with modules where Extrinsic = #extrinsic
|
||||
#(#modules_tokens)*
|
||||
for #runtime with pallets where Extrinsic = #extrinsic
|
||||
#(#pallets_tokens)*
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fn decl_outer_dispatch<'a>(
|
||||
runtime: &'a Ident,
|
||||
module_declarations: impl Iterator<Item = &'a Module>,
|
||||
pallet_declarations: impl Iterator<Item = &'a Pallet>,
|
||||
scrate: &'a TokenStream2,
|
||||
) -> TokenStream2 {
|
||||
let modules_tokens = module_declarations
|
||||
.filter(|module_declaration| module_declaration.exists_part("Call"))
|
||||
.map(|module_declaration| {
|
||||
let module = &module_declaration.module;
|
||||
let name = &module_declaration.name;
|
||||
let index = module_declaration.index;
|
||||
quote!(#[codec(index = #index)] #module::#name)
|
||||
let pallets_tokens = pallet_declarations
|
||||
.filter(|pallet_declaration| pallet_declaration.exists_part("Call"))
|
||||
.map(|pallet_declaration| {
|
||||
let pallet = &pallet_declaration.pallet;
|
||||
let name = &pallet_declaration.name;
|
||||
let index = pallet_declaration.index;
|
||||
quote!(#[codec(index = #index)] #pallet::#name)
|
||||
});
|
||||
|
||||
quote!(
|
||||
#scrate::impl_outer_dispatch! {
|
||||
pub enum Call for #runtime where origin: Origin {
|
||||
#(#modules_tokens,)*
|
||||
#(#pallets_tokens,)*
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -363,32 +363,32 @@ fn decl_outer_dispatch<'a>(
|
||||
|
||||
fn decl_outer_origin<'a>(
|
||||
runtime_name: &'a Ident,
|
||||
modules_except_system: impl Iterator<Item = &'a Module>,
|
||||
system_module: &'a Module,
|
||||
pallets_except_system: impl Iterator<Item = &'a Pallet>,
|
||||
system_pallet: &'a Pallet,
|
||||
scrate: &'a TokenStream2,
|
||||
) -> syn::Result<TokenStream2> {
|
||||
let mut modules_tokens = TokenStream2::new();
|
||||
for module_declaration in modules_except_system {
|
||||
if let Some(module_entry) = module_declaration.find_part("Origin") {
|
||||
let module = &module_declaration.module;
|
||||
let instance = module_declaration.instance.as_ref();
|
||||
let generics = &module_entry.generics;
|
||||
let mut pallets_tokens = TokenStream2::new();
|
||||
for pallet_declaration in pallets_except_system {
|
||||
if let Some(pallet_entry) = pallet_declaration.find_part("Origin") {
|
||||
let pallet = &pallet_declaration.pallet;
|
||||
let instance = pallet_declaration.instance.as_ref();
|
||||
let generics = &pallet_entry.generics;
|
||||
if instance.is_some() && generics.params.is_empty() {
|
||||
let msg = format!(
|
||||
"Instantiable module with no generic `Origin` cannot \
|
||||
be constructed: module `{}` must have generic `Origin`",
|
||||
module_declaration.name
|
||||
"Instantiable pallet with no generic `Origin` cannot \
|
||||
be constructed: pallet `{}` must have generic `Origin`",
|
||||
pallet_declaration.name
|
||||
);
|
||||
return Err(syn::Error::new(module_declaration.name.span(), msg));
|
||||
return Err(syn::Error::new(pallet_declaration.name.span(), msg));
|
||||
}
|
||||
let index = module_declaration.index;
|
||||
let tokens = quote!(#[codec(index = #index)] #module #instance #generics,);
|
||||
modules_tokens.extend(tokens);
|
||||
let index = pallet_declaration.index;
|
||||
let tokens = quote!(#[codec(index = #index)] #pallet #instance #generics,);
|
||||
pallets_tokens.extend(tokens);
|
||||
}
|
||||
}
|
||||
|
||||
let system_name = &system_module.module;
|
||||
let system_index = system_module.index;
|
||||
let system_name = &system_pallet.pallet;
|
||||
let system_index = system_pallet.index;
|
||||
|
||||
Ok(quote!(
|
||||
#scrate::impl_outer_origin! {
|
||||
@@ -396,7 +396,7 @@ fn decl_outer_origin<'a>(
|
||||
system = #system_name,
|
||||
system_index = #system_index
|
||||
{
|
||||
#modules_tokens
|
||||
#pallets_tokens
|
||||
}
|
||||
}
|
||||
))
|
||||
@@ -404,89 +404,99 @@ fn decl_outer_origin<'a>(
|
||||
|
||||
fn decl_outer_event<'a>(
|
||||
runtime_name: &'a Ident,
|
||||
module_declarations: impl Iterator<Item = &'a Module>,
|
||||
pallet_declarations: impl Iterator<Item = &'a Pallet>,
|
||||
scrate: &'a TokenStream2,
|
||||
) -> syn::Result<TokenStream2> {
|
||||
let mut modules_tokens = TokenStream2::new();
|
||||
for module_declaration in module_declarations {
|
||||
if let Some(module_entry) = module_declaration.find_part("Event") {
|
||||
let module = &module_declaration.module;
|
||||
let instance = module_declaration.instance.as_ref();
|
||||
let generics = &module_entry.generics;
|
||||
let mut pallets_tokens = TokenStream2::new();
|
||||
for pallet_declaration in pallet_declarations {
|
||||
if let Some(pallet_entry) = pallet_declaration.find_part("Event") {
|
||||
let pallet = &pallet_declaration.pallet;
|
||||
let instance = pallet_declaration.instance.as_ref();
|
||||
let generics = &pallet_entry.generics;
|
||||
if instance.is_some() && generics.params.is_empty() {
|
||||
let msg = format!(
|
||||
"Instantiable module with no generic `Event` cannot \
|
||||
be constructed: module `{}` must have generic `Event`",
|
||||
module_declaration.name,
|
||||
"Instantiable pallet with no generic `Event` cannot \
|
||||
be constructed: pallet `{}` must have generic `Event`",
|
||||
pallet_declaration.name,
|
||||
);
|
||||
return Err(syn::Error::new(module_declaration.name.span(), msg));
|
||||
return Err(syn::Error::new(pallet_declaration.name.span(), msg));
|
||||
}
|
||||
|
||||
let index = module_declaration.index;
|
||||
let tokens = quote!(#[codec(index = #index)] #module #instance #generics,);
|
||||
modules_tokens.extend(tokens);
|
||||
let index = pallet_declaration.index;
|
||||
let tokens = quote!(#[codec(index = #index)] #pallet #instance #generics,);
|
||||
pallets_tokens.extend(tokens);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(quote!(
|
||||
#scrate::impl_outer_event! {
|
||||
pub enum Event for #runtime_name {
|
||||
#modules_tokens
|
||||
#pallets_tokens
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
fn decl_all_modules<'a>(
|
||||
fn decl_all_pallets<'a>(
|
||||
runtime: &'a Ident,
|
||||
module_declarations: impl Iterator<Item = &'a Module>,
|
||||
pallet_declarations: impl Iterator<Item = &'a Pallet>,
|
||||
) -> TokenStream2 {
|
||||
let mut types = TokenStream2::new();
|
||||
let mut names = Vec::new();
|
||||
for module_declaration in module_declarations {
|
||||
let type_name = &module_declaration.name;
|
||||
let module = &module_declaration.module;
|
||||
for pallet_declaration in pallet_declarations {
|
||||
let type_name = &pallet_declaration.name;
|
||||
let pallet = &pallet_declaration.pallet;
|
||||
let mut generics = vec![quote!(#runtime)];
|
||||
generics.extend(
|
||||
module_declaration
|
||||
pallet_declaration
|
||||
.instance
|
||||
.iter()
|
||||
.map(|name| quote!(#module::#name)),
|
||||
.map(|name| quote!(#pallet::#name)),
|
||||
);
|
||||
let type_decl = quote!(
|
||||
pub type #type_name = #module::Module <#(#generics),*>;
|
||||
pub type #type_name = #pallet::Pallet <#(#generics),*>;
|
||||
);
|
||||
types.extend(type_decl);
|
||||
names.push(&module_declaration.name);
|
||||
names.push(&pallet_declaration.name);
|
||||
}
|
||||
// Make nested tuple structure like (((Babe, Consensus), Grandpa), ...)
|
||||
// But ignore the system module.
|
||||
let all_modules = names.iter()
|
||||
.filter(|n| **n != SYSTEM_MODULE_NAME)
|
||||
// But ignore the system pallet.
|
||||
let all_pallets = names.iter()
|
||||
.filter(|n| **n != SYSTEM_PALLET_NAME)
|
||||
.fold(TokenStream2::default(), |combined, name| quote!((#name, #combined)));
|
||||
|
||||
let all_modules_with_system = names.iter()
|
||||
let all_pallets_with_system = names.iter()
|
||||
.fold(TokenStream2::default(), |combined, name| quote!((#name, #combined)));
|
||||
|
||||
quote!(
|
||||
#types
|
||||
/// All pallets included in the runtime as a nested tuple of types.
|
||||
/// Excludes the System pallet.
|
||||
pub type AllModules = ( #all_modules );
|
||||
pub type AllPallets = ( #all_pallets );
|
||||
/// All pallets included in the runtime as a nested tuple of types.
|
||||
pub type AllModulesWithSystem = ( #all_modules_with_system );
|
||||
pub type AllPalletsWithSystem = ( #all_pallets_with_system );
|
||||
|
||||
/// All modules included in the runtime as a nested tuple of types.
|
||||
/// Excludes the System pallet.
|
||||
#[deprecated(note = "use `AllPallets` instead")]
|
||||
#[allow(dead_code)]
|
||||
pub type AllModules = ( #all_pallets );
|
||||
/// All modules included in the runtime as a nested tuple of types.
|
||||
#[deprecated(note = "use `AllPalletsWithSystem` instead")]
|
||||
#[allow(dead_code)]
|
||||
pub type AllModulesWithSystem = ( #all_pallets_with_system );
|
||||
)
|
||||
}
|
||||
|
||||
fn decl_pallet_runtime_setup(
|
||||
module_declarations: &[Module],
|
||||
pallet_declarations: &[Pallet],
|
||||
scrate: &TokenStream2,
|
||||
) -> TokenStream2 {
|
||||
let names = module_declarations.iter().map(|d| &d.name);
|
||||
let names2 = module_declarations.iter().map(|d| &d.name);
|
||||
let name_strings = module_declarations.iter().map(|d| d.name.to_string());
|
||||
let indices = module_declarations.iter()
|
||||
.map(|module| module.index as usize);
|
||||
let names = pallet_declarations.iter().map(|d| &d.name);
|
||||
let names2 = pallet_declarations.iter().map(|d| &d.name);
|
||||
let name_strings = pallet_declarations.iter().map(|d| d.name.to_string());
|
||||
let indices = pallet_declarations.iter()
|
||||
.map(|pallet| pallet.index as usize);
|
||||
|
||||
quote!(
|
||||
/// Provides an implementation of `PalletInfo` to provide information
|
||||
@@ -527,7 +537,7 @@ fn decl_integrity_test(scrate: &TokenStream2) -> TokenStream2 {
|
||||
|
||||
#[test]
|
||||
pub fn runtime_integrity_tests() {
|
||||
<AllModules as #scrate::traits::IntegrityTest>::integrity_test();
|
||||
<AllPallets as #scrate::traits::IntegrityTest>::integrity_test();
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ mod keyword {
|
||||
syn::custom_keyword!(Block);
|
||||
syn::custom_keyword!(NodeBlock);
|
||||
syn::custom_keyword!(UncheckedExtrinsic);
|
||||
syn::custom_keyword!(Module);
|
||||
syn::custom_keyword!(Pallet);
|
||||
syn::custom_keyword!(Call);
|
||||
syn::custom_keyword!(Storage);
|
||||
syn::custom_keyword!(Event);
|
||||
@@ -44,7 +44,7 @@ pub struct RuntimeDefinition {
|
||||
pub enum_token: Token![enum],
|
||||
pub name: Ident,
|
||||
pub where_section: WhereSection,
|
||||
pub modules: ext::Braces<ext::Punctuated<ModuleDeclaration, Token![,]>>,
|
||||
pub pallets: ext::Braces<ext::Punctuated<PalletDeclaration, Token![,]>>,
|
||||
}
|
||||
|
||||
impl Parse for RuntimeDefinition {
|
||||
@@ -54,7 +54,7 @@ impl Parse for RuntimeDefinition {
|
||||
enum_token: input.parse()?,
|
||||
name: input.parse()?,
|
||||
where_section: input.parse()?,
|
||||
modules: input.parse()?,
|
||||
pallets: input.parse()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -150,20 +150,20 @@ impl Parse for WhereDefinition {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ModuleDeclaration {
|
||||
pub struct PalletDeclaration {
|
||||
pub name: Ident,
|
||||
/// Optional fixed index (e.g. `MyPallet ... = 3,`)
|
||||
pub index: Option<u8>,
|
||||
pub module: Ident,
|
||||
pub pallet: Ident,
|
||||
pub instance: Option<Ident>,
|
||||
pub module_parts: Vec<ModulePart>,
|
||||
pub pallet_parts: Vec<PalletPart>,
|
||||
}
|
||||
|
||||
impl Parse for ModuleDeclaration {
|
||||
impl Parse for PalletDeclaration {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
let name = input.parse()?;
|
||||
let _: Token![:] = input.parse()?;
|
||||
let module = input.parse()?;
|
||||
let pallet = input.parse()?;
|
||||
let instance = if input.peek(Token![::]) && input.peek3(Token![<]) {
|
||||
let _: Token![::] = input.parse()?;
|
||||
let _: Token![<] = input.parse()?;
|
||||
@@ -175,7 +175,7 @@ impl Parse for ModuleDeclaration {
|
||||
};
|
||||
|
||||
let _: Token![::] = input.parse()?;
|
||||
let module_parts = parse_module_parts(input)?;
|
||||
let pallet_parts = parse_pallet_parts(input)?;
|
||||
|
||||
let index = if input.peek(Token![=]) {
|
||||
input.parse::<Token![=]>()?;
|
||||
@@ -188,9 +188,9 @@ impl Parse for ModuleDeclaration {
|
||||
|
||||
let parsed = Self {
|
||||
name,
|
||||
module,
|
||||
pallet,
|
||||
instance,
|
||||
module_parts,
|
||||
pallet_parts,
|
||||
index,
|
||||
};
|
||||
|
||||
@@ -198,14 +198,14 @@ impl Parse for ModuleDeclaration {
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse [`ModulePart`]'s from a braces enclosed list that is split by commas, e.g.
|
||||
/// Parse [`PalletPart`]'s from a braces enclosed list that is split by commas, e.g.
|
||||
///
|
||||
/// `{ Call, Event }`
|
||||
fn parse_module_parts(input: ParseStream) -> Result<Vec<ModulePart>> {
|
||||
let module_parts :ext::Braces<ext::Punctuated<ModulePart, Token![,]>> = input.parse()?;
|
||||
fn parse_pallet_parts(input: ParseStream) -> Result<Vec<PalletPart>> {
|
||||
let pallet_parts :ext::Braces<ext::Punctuated<PalletPart, Token![,]>> = input.parse()?;
|
||||
|
||||
let mut resolved = HashSet::new();
|
||||
for part in module_parts.content.inner.iter() {
|
||||
for part in pallet_parts.content.inner.iter() {
|
||||
if !resolved.insert(part.name()) {
|
||||
let msg = format!(
|
||||
"`{}` was already declared before. Please remove the duplicate declaration",
|
||||
@@ -215,12 +215,12 @@ fn parse_module_parts(input: ParseStream) -> Result<Vec<ModulePart>> {
|
||||
}
|
||||
}
|
||||
|
||||
Ok(module_parts.content.inner.into_iter().collect())
|
||||
Ok(pallet_parts.content.inner.into_iter().collect())
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ModulePartKeyword {
|
||||
Module(keyword::Module),
|
||||
pub enum PalletPartKeyword {
|
||||
Pallet(keyword::Pallet),
|
||||
Call(keyword::Call),
|
||||
Storage(keyword::Storage),
|
||||
Event(keyword::Event),
|
||||
@@ -230,12 +230,12 @@ pub enum ModulePartKeyword {
|
||||
ValidateUnsigned(keyword::ValidateUnsigned),
|
||||
}
|
||||
|
||||
impl Parse for ModulePartKeyword {
|
||||
impl Parse for PalletPartKeyword {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
let lookahead = input.lookahead1();
|
||||
|
||||
if lookahead.peek(keyword::Module) {
|
||||
Ok(Self::Module(input.parse()?))
|
||||
if lookahead.peek(keyword::Pallet) {
|
||||
Ok(Self::Pallet(input.parse()?))
|
||||
} else if lookahead.peek(keyword::Call) {
|
||||
Ok(Self::Call(input.parse()?))
|
||||
} else if lookahead.peek(keyword::Storage) {
|
||||
@@ -256,11 +256,11 @@ impl Parse for ModulePartKeyword {
|
||||
}
|
||||
}
|
||||
|
||||
impl ModulePartKeyword {
|
||||
impl PalletPartKeyword {
|
||||
/// Returns the name of `Self`.
|
||||
fn name(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Module(_) => "Module",
|
||||
Self::Pallet(_) => "Pallet",
|
||||
Self::Call(_) => "Call",
|
||||
Self::Storage(_) => "Storage",
|
||||
Self::Event(_) => "Event",
|
||||
@@ -276,21 +276,21 @@ impl ModulePartKeyword {
|
||||
Ident::new(self.name(), self.span())
|
||||
}
|
||||
|
||||
/// Returns `true` if this module part is allowed to have generic arguments.
|
||||
/// Returns `true` if this pallet part is allowed to have generic arguments.
|
||||
fn allows_generic(&self) -> bool {
|
||||
Self::all_generic_arg().iter().any(|n| *n == self.name())
|
||||
}
|
||||
|
||||
/// Returns the names of all module parts that allow to have a generic argument.
|
||||
/// Returns the names of all pallet parts that allow to have a generic argument.
|
||||
fn all_generic_arg() -> &'static [&'static str] {
|
||||
&["Event", "Origin", "Config"]
|
||||
}
|
||||
}
|
||||
|
||||
impl Spanned for ModulePartKeyword {
|
||||
impl Spanned for PalletPartKeyword {
|
||||
fn span(&self) -> Span {
|
||||
match self {
|
||||
Self::Module(inner) => inner.span(),
|
||||
Self::Pallet(inner) => inner.span(),
|
||||
Self::Call(inner) => inner.span(),
|
||||
Self::Storage(inner) => inner.span(),
|
||||
Self::Event(inner) => inner.span(),
|
||||
@@ -303,21 +303,21 @@ impl Spanned for ModulePartKeyword {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ModulePart {
|
||||
pub keyword: ModulePartKeyword,
|
||||
pub struct PalletPart {
|
||||
pub keyword: PalletPartKeyword,
|
||||
pub generics: syn::Generics,
|
||||
}
|
||||
|
||||
impl Parse for ModulePart {
|
||||
impl Parse for PalletPart {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
let keyword: ModulePartKeyword = input.parse()?;
|
||||
let keyword: PalletPartKeyword = input.parse()?;
|
||||
|
||||
let generics: syn::Generics = input.parse()?;
|
||||
if !generics.params.is_empty() && !keyword.allows_generic() {
|
||||
let valid_generics = ModulePart::format_names(ModulePartKeyword::all_generic_arg());
|
||||
let valid_generics = PalletPart::format_names(PalletPartKeyword::all_generic_arg());
|
||||
let msg = format!(
|
||||
"`{}` is not allowed to have generics. \
|
||||
Only the following modules are allowed to have generics: {}.",
|
||||
Only the following pallets are allowed to have generics: {}.",
|
||||
keyword.name(),
|
||||
valid_generics,
|
||||
);
|
||||
@@ -331,18 +331,18 @@ impl Parse for ModulePart {
|
||||
}
|
||||
}
|
||||
|
||||
impl ModulePart {
|
||||
impl PalletPart {
|
||||
pub fn format_names(names: &[&'static str]) -> String {
|
||||
let res: Vec<_> = names.iter().map(|s| format!("`{}`", s)).collect();
|
||||
res.join(", ")
|
||||
}
|
||||
|
||||
/// The name of this module part.
|
||||
/// The name of this pallet part.
|
||||
pub fn name(&self) -> &'static str {
|
||||
self.keyword.name()
|
||||
}
|
||||
|
||||
/// The name of this module part as `Ident`.
|
||||
/// The name of this pallet part as `Ident`.
|
||||
pub fn ident(&self) -> Ident {
|
||||
self.keyword.ident()
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ use proc_macro::TokenStream;
|
||||
/// construct_runtime!(
|
||||
/// pub enum Runtime with ... {
|
||||
/// ...,
|
||||
/// Example: example::{Module, Storage, ..., Config<T>},
|
||||
/// Example: example::{Pallet, Storage, ..., Config<T>},
|
||||
/// ...,
|
||||
/// }
|
||||
/// );
|
||||
@@ -258,13 +258,13 @@ pub fn decl_storage(input: TokenStream) -> TokenStream {
|
||||
/// NodeBlock = runtime::Block,
|
||||
/// UncheckedExtrinsic = UncheckedExtrinsic
|
||||
/// {
|
||||
/// System: system::{Module, Call, Event<T>, Config<T>} = 0,
|
||||
/// Test: test::{Module, Call} = 1,
|
||||
/// Test2: test_with_long_module::{Module, Event<T>},
|
||||
/// System: system::{Pallet, Call, Event<T>, Config<T>} = 0,
|
||||
/// Test: test::{Pallet, Call} = 1,
|
||||
/// Test2: test_with_long_module::{Pallet, Event<T>},
|
||||
///
|
||||
/// // Module with instances
|
||||
/// Test3_Instance1: test3::<Instance1>::{Module, Call, Storage, Event<T, I>, Config<T, I>, Origin<T, I>},
|
||||
/// Test3_DefaultInstance: test3::{Module, Call, Storage, Event<T>, Config<T>, Origin<T>} = 4,
|
||||
/// Test3_Instance1: test3::<Instance1>::{Pallet, Call, Storage, Event<T, I>, Config<T, I>, Origin<T, I>},
|
||||
/// Test3_DefaultInstance: test3::{Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>} = 4,
|
||||
/// }
|
||||
/// )
|
||||
/// ```
|
||||
@@ -306,7 +306,7 @@ pub fn decl_storage(input: TokenStream) -> TokenStream {
|
||||
/// # Type definitions
|
||||
///
|
||||
/// * The macro generates a type alias for each pallet to their `Module` (or `Pallet`).
|
||||
/// E.g. `type System = frame_system::Module<Runtime>`
|
||||
/// E.g. `type System = frame_system::Pallet<Runtime>`
|
||||
#[proc_macro]
|
||||
pub fn construct_runtime(input: TokenStream) -> TokenStream {
|
||||
construct_runtime::construct_runtime(input)
|
||||
|
||||
@@ -102,6 +102,8 @@ pub fn expand_pallet_struct(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
/// Type alias to `Pallet`, to be used by `construct_runtime`.
|
||||
///
|
||||
/// Generated by `pallet` attribute macro.
|
||||
#[deprecated(note = "use `Pallet` instead")]
|
||||
#[allow(dead_code)]
|
||||
pub type Module<#type_decl_gen> = #pallet_ident<#type_use_gen>;
|
||||
|
||||
// Implement `GetPalletVersion` for `Pallet`
|
||||
|
||||
@@ -1375,11 +1375,11 @@ macro_rules! decl_module {
|
||||
impl<$trait_instance: $trait_name$(<I>, $instance: $instantiable)?> $module<$trait_instance $(, $instance)?>
|
||||
where $( $other_where_bounds )*
|
||||
{
|
||||
/// Deposits an event using `frame_system::Module::deposit_event`.
|
||||
/// Deposits an event using `frame_system::Pallet::deposit_event`.
|
||||
$vis fn deposit_event(
|
||||
event: impl Into<< $trait_instance as $trait_name $(<$instance>)? >::Event>
|
||||
) {
|
||||
<$system::Module<$trait_instance>>::deposit_event(event.into())
|
||||
<$system::Pallet<$trait_instance>>::deposit_event(event.into())
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1859,6 +1859,11 @@ macro_rules! decl_module {
|
||||
>($crate::sp_std::marker::PhantomData<($trait_instance, $( $instance)?)>) where
|
||||
$( $other_where_bounds )*;
|
||||
|
||||
/// Type alias to `Module`, to be used by `construct_runtime`.
|
||||
#[allow(dead_code)]
|
||||
pub type Pallet<$trait_instance $(, $instance $( = $module_default_instance)?)?>
|
||||
= $mod_type<$trait_instance $(, $instance)?>;
|
||||
|
||||
$crate::decl_module! {
|
||||
@impl_on_initialize
|
||||
{ $system }
|
||||
|
||||
@@ -56,7 +56,7 @@ macro_rules! __impl_outer_config_types {
|
||||
/// specific genesis configuration.
|
||||
///
|
||||
/// ```ignore
|
||||
/// pub struct GenesisConfig for Runtime where AllModulesWithSystem = AllModulesWithSystem {
|
||||
/// pub struct GenesisConfig for Runtime where AllPalletsWithSystem = AllPalletsWithSystem {
|
||||
/// rust_module_one: Option<ModuleOneConfig>,
|
||||
/// ...
|
||||
/// }
|
||||
@@ -65,7 +65,7 @@ macro_rules! __impl_outer_config_types {
|
||||
macro_rules! impl_outer_config {
|
||||
(
|
||||
pub struct $main:ident for $concrete:ident where
|
||||
AllModulesWithSystem = $all_modules_with_system:ident
|
||||
AllPalletsWithSystem = $all_pallets_with_system:ident
|
||||
{
|
||||
$( $config:ident =>
|
||||
$snake:ident $( $instance:ident )? $( <$generic:ident> )*, )*
|
||||
@@ -103,7 +103,7 @@ macro_rules! impl_outer_config {
|
||||
)*
|
||||
|
||||
$crate::BasicExternalities::execute_with_storage(storage, || {
|
||||
<$all_modules_with_system as $crate::traits::OnGenesis>::on_genesis();
|
||||
<$all_pallets_with_system as $crate::traits::OnGenesis>::on_genesis();
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -58,7 +58,7 @@ pub use frame_metadata::{
|
||||
///
|
||||
/// struct Runtime;
|
||||
/// frame_support::impl_runtime_metadata! {
|
||||
/// for Runtime with modules where Extrinsic = UncheckedExtrinsic
|
||||
/// for Runtime with pallets where Extrinsic = UncheckedExtrinsic
|
||||
/// module0::Module as Module0 { index 0 } with,
|
||||
/// module1::Module as Module1 { index 1 } with,
|
||||
/// module2::Module as Module2 { index 2 } with Storage,
|
||||
@@ -69,7 +69,7 @@ pub use frame_metadata::{
|
||||
#[macro_export]
|
||||
macro_rules! impl_runtime_metadata {
|
||||
(
|
||||
for $runtime:ident with modules where Extrinsic = $ext:ident
|
||||
for $runtime:ident with pallets where Extrinsic = $ext:ident
|
||||
$( $rest:tt )*
|
||||
) => {
|
||||
impl $runtime {
|
||||
@@ -421,7 +421,7 @@ mod tests {
|
||||
impl crate::traits::PalletInfo for TestRuntime {
|
||||
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<TestRuntime>>() {
|
||||
if type_id == sp_std::any::TypeId::of::<system::Pallet<TestRuntime>>() {
|
||||
return Some(0)
|
||||
}
|
||||
if type_id == sp_std::any::TypeId::of::<EventModule>() {
|
||||
@@ -435,7 +435,7 @@ mod tests {
|
||||
}
|
||||
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<TestRuntime>>() {
|
||||
if type_id == sp_std::any::TypeId::of::<system::Pallet<TestRuntime>>() {
|
||||
return Some("System")
|
||||
}
|
||||
if type_id == sp_std::any::TypeId::of::<EventModule>() {
|
||||
@@ -492,8 +492,8 @@ mod tests {
|
||||
}
|
||||
|
||||
impl_runtime_metadata!(
|
||||
for TestRuntime with modules where Extrinsic = TestExtrinsic
|
||||
system::Module as System { index 0 } with Event,
|
||||
for TestRuntime with pallets where Extrinsic = TestExtrinsic
|
||||
system::Pallet as System { index 0 } with Event,
|
||||
event_module::Module as Module { index 1 } with Event Call,
|
||||
event_module2::Module as Module2 { index 2 } with Event Storage Call,
|
||||
);
|
||||
|
||||
@@ -67,7 +67,7 @@ where
|
||||
|
||||
(
|
||||
Output::decode(&mut TrailingZeroInput::new(subject)).unwrap_or_default(),
|
||||
frame_system::Module::<T>::block_number(),
|
||||
frame_system::Pallet::<T>::block_number(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,17 +138,17 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module, Call, Event<T>, Origin<T>} = 30,
|
||||
Module1_1: module1::<Instance1>::{Module, Call, Storage, Event<T>, Origin<T>},
|
||||
Module2: module2::{Module, Call, Storage, Event, Origin},
|
||||
Module1_2: module1::<Instance2>::{Module, Call, Storage, Event<T>, Origin<T>},
|
||||
Module1_3: module1::<Instance3>::{Module, Storage} = 6,
|
||||
Module1_4: module1::<Instance4>::{Module, Call} = 3,
|
||||
Module1_5: module1::<Instance5>::{Module, Event<T>},
|
||||
Module1_6: module1::<Instance6>::{Module, Call, Storage, Event<T>, Origin<T>} = 1,
|
||||
Module1_7: module1::<Instance7>::{Module, Call, Storage, Event<T>, Origin<T>},
|
||||
Module1_8: module1::<Instance8>::{Module, Call, Storage, Event<T>, Origin<T>} = 12,
|
||||
Module1_9: module1::<Instance9>::{Module, Call, Storage, Event<T>, Origin<T>},
|
||||
System: system::{Pallet, Call, Event<T>, Origin<T>} = 30,
|
||||
Module1_1: module1::<Instance1>::{Pallet, Call, Storage, Event<T>, Origin<T>},
|
||||
Module2: module2::{Pallet, Call, Storage, Event, Origin},
|
||||
Module1_2: module1::<Instance2>::{Pallet, Call, Storage, Event<T>, Origin<T>},
|
||||
Module1_3: module1::<Instance3>::{Pallet, Storage} = 6,
|
||||
Module1_4: module1::<Instance4>::{Pallet, Call} = 3,
|
||||
Module1_5: module1::<Instance5>::{Pallet, Event<T>},
|
||||
Module1_6: module1::<Instance6>::{Pallet, Call, Storage, Event<T>, Origin<T>} = 1,
|
||||
Module1_7: module1::<Instance7>::{Pallet, Call, Storage, Event<T>, Origin<T>},
|
||||
Module1_8: module1::<Instance8>::{Pallet, Call, Storage, Event<T>, Origin<T>} = 12,
|
||||
Module1_9: module1::<Instance9>::{Pallet, Call, Storage, Event<T>, Origin<T>},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
error: Module indices are conflicting: Both modules System and Pallet1 are at index 0
|
||||
error: Pallet indices are conflicting: Both pallets System and Pallet1 are at index 0
|
||||
--> $DIR/conflicting_index.rs:9:3
|
||||
|
|
||||
9 | System: system::{},
|
||||
| ^^^^^^
|
||||
|
||||
error: Module indices are conflicting: Both modules System and Pallet1 are at index 0
|
||||
error: Pallet indices are conflicting: Both pallets System and Pallet1 are at index 0
|
||||
--> $DIR/conflicting_index.rs:10:3
|
||||
|
|
||||
10 | Pallet1: pallet1::{} = 0,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
error: Module indices are conflicting: Both modules System and Pallet3 are at index 5
|
||||
error: Pallet indices are conflicting: Both pallets System and Pallet3 are at index 5
|
||||
--> $DIR/conflicting_index_2.rs:9:3
|
||||
|
|
||||
9 | System: system::{} = 5,
|
||||
| ^^^^^^
|
||||
|
||||
error: Module indices are conflicting: Both modules System and Pallet3 are at index 5
|
||||
error: Pallet indices are conflicting: Both pallets System and Pallet3 are at index 5
|
||||
--> $DIR/conflicting_index_2.rs:12:3
|
||||
|
|
||||
12 | Pallet3: pallet3::{},
|
||||
|
||||
@@ -6,9 +6,9 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module},
|
||||
Balance: balances::{Module},
|
||||
Balance: balances::{Module},
|
||||
System: system::{Pallet},
|
||||
Balance: balances::{Pallet},
|
||||
Balance: balances::{Pallet},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
error: Two modules with the same name!
|
||||
error: Two pallets with the same name!
|
||||
--> $DIR/conflicting_module_name.rs:10:3
|
||||
|
|
||||
10 | Balance: balances::{Module},
|
||||
10 | Balance: balances::{Pallet},
|
||||
| ^^^^^^^
|
||||
|
||||
error: Two modules with the same name!
|
||||
error: Two pallets with the same name!
|
||||
--> $DIR/conflicting_module_name.rs:11:3
|
||||
|
|
||||
11 | Balance: balances::{Module},
|
||||
11 | Balance: balances::{Pallet},
|
||||
| ^^^^^^^
|
||||
|
||||
@@ -6,7 +6,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module},
|
||||
System: system::{Pallet},
|
||||
Balance: balances::{Config, Call, Config<T>, Origin<T>},
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module},
|
||||
System: system::{Pallet},
|
||||
Balance: balances::<Instance1>::{Call<T>, Origin<T>},
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
error: `Call` is not allowed to have generics. Only the following modules are allowed to have generics: `Event`, `Origin`, `Config`.
|
||||
error: `Call` is not allowed to have generics. Only the following pallets are allowed to have generics: `Event`, `Origin`, `Config`.
|
||||
--> $DIR/generics_in_invalid_module.rs:10:36
|
||||
|
|
||||
10 | Balance: balances::<Instance1>::{Call<T>, Origin<T>},
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
error: expected one of: `Module`, `Call`, `Storage`, `Event`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`
|
||||
error: expected one of: `Pallet`, `Call`, `Storage`, `Event`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`
|
||||
--> $DIR/invalid_module_details_keyword.rs:9:20
|
||||
|
|
||||
9 | system: System::{enum},
|
||||
|
||||
@@ -6,7 +6,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module},
|
||||
System: system::{Pallet},
|
||||
Balance: balances::{Error},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
error: expected one of: `Module`, `Call`, `Storage`, `Event`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`
|
||||
error: expected one of: `Pallet`, `Call`, `Storage`, `Event`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`
|
||||
--> $DIR/invalid_module_entry.rs:10:23
|
||||
|
|
||||
10 | Balance: balances::{Error},
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module},
|
||||
System: system::{Pallet},
|
||||
Balance: balances::<Instance1>::{Event},
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
error: Instantiable module with no generic `Event` cannot be constructed: module `Balance` must have generic `Event`
|
||||
error: Instantiable pallet with no generic `Event` cannot be constructed: pallet `Balance` must have generic `Event`
|
||||
--> $DIR/missing_event_generic_on_module_with_instance.rs:10:3
|
||||
|
|
||||
10 | Balance: balances::<Instance1>::{Event},
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module},
|
||||
System: system::{Pallet},
|
||||
Balance: balances::<Instance1>::{Origin},
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
error: Instantiable module with no generic `Origin` cannot be constructed: module `Balance` must have generic `Origin`
|
||||
error: Instantiable pallet with no generic `Origin` cannot be constructed: pallet `Balance` must have generic `Origin`
|
||||
--> $DIR/missing_origin_generic_on_module_with_instance.rs:10:3
|
||||
|
|
||||
10 | Balance: balances::<Instance1>::{Origin},
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
error: `System` module declaration is missing. Please add this line: `System: frame_system::{Module, Call, Storage, Config, Event<T>},`
|
||||
error: `System` pallet declaration is missing. Please add this line: `System: frame_system::{Pallet, Call, Storage, Config, Event<T>},`
|
||||
--> $DIR/missing_system_module.rs:8:2
|
||||
|
|
||||
8 | {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
error: Module index doesn't fit into u8, index is 256
|
||||
error: Pallet index doesn't fit into u8, index is 256
|
||||
--> $DIR/more_than_256_modules.rs:10:3
|
||||
|
|
||||
10 | Pallet256: pallet256::{},
|
||||
|
||||
@@ -264,24 +264,24 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module, Call, Event<T>},
|
||||
System: system::{Pallet, Call, Event<T>},
|
||||
Module1_1: module1::<Instance1>::{
|
||||
Module, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
Module1_2: module1::<Instance2>::{
|
||||
Module, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
Module2: module2::{Module, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent},
|
||||
Module2: module2::{Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent},
|
||||
Module2_1: module2::<Instance1>::{
|
||||
Module, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
Module2_2: module2::<Instance2>::{
|
||||
Module, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
Module2_3: module2::<Instance3>::{
|
||||
Module, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
Module3: module3::{Module, Call},
|
||||
Module3: module3::{Pallet, Call},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -177,8 +177,8 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module, Call, Event<T>},
|
||||
Module: module::{Module, Call, Storage, Config},
|
||||
System: system::{Pallet, Call, Event<T>},
|
||||
Module: module::{Pallet, Call, Storage, Config},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -418,9 +418,9 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Module, Call, Event<T>},
|
||||
Example: pallet::{Module, Call, Event<T>, Config, Storage, Inherent, Origin<T>, ValidateUnsigned},
|
||||
Example2: pallet2::{Module, Call, Event, Config<T>, Storage},
|
||||
System: frame_system::{Pallet, Call, Event<T>},
|
||||
Example: pallet::{Pallet, Call, Event<T>, Config, Storage, Inherent, Origin<T>, ValidateUnsigned},
|
||||
Example2: pallet2::{Pallet, Call, Event, Config<T>, Storage},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -559,11 +559,11 @@ fn pallet_hooks_expand() {
|
||||
TestExternalities::default().execute_with(|| {
|
||||
frame_system::Pallet::<Runtime>::set_block_number(1);
|
||||
|
||||
assert_eq!(AllModules::on_initialize(1), 10);
|
||||
AllModules::on_finalize(1);
|
||||
assert_eq!(AllPallets::on_initialize(1), 10);
|
||||
AllPallets::on_finalize(1);
|
||||
|
||||
assert_eq!(pallet::Pallet::<Runtime>::storage_version(), None);
|
||||
assert_eq!(AllModules::on_runtime_upgrade(), 30);
|
||||
assert_eq!(AllPallets::on_runtime_upgrade(), 30);
|
||||
assert_eq!(
|
||||
pallet::Pallet::<Runtime>::storage_version(),
|
||||
Some(pallet::Pallet::<Runtime>::current_version()),
|
||||
|
||||
@@ -247,10 +247,10 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Module, Call, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Event<T>},
|
||||
// NOTE: name Example here is needed in order to have same module prefix
|
||||
Example: pallet::{Module, Call, Event<T>, Config<T>, Storage},
|
||||
PalletOld: pallet_old::{Module, Call, Event<T>, Config<T>, Storage},
|
||||
Example: pallet::{Pallet, Call, Event<T>, Config<T>, Storage},
|
||||
PalletOld: pallet_old::{Pallet, Call, Event<T>, Config<T>, Storage},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -259,13 +259,13 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Module, Call, Event<T>},
|
||||
Example: pallet::{Module, Call, Event<T>, Config<T>, Storage},
|
||||
PalletOld: pallet_old::{Module, Call, Event<T>, Config<T>, Storage},
|
||||
Instance2Example: pallet::<Instance2>::{Module, Call, Event<T>, Config<T>, Storage},
|
||||
PalletOld2: pallet_old::<Instance2>::{Module, Call, Event<T>, Config<T>, Storage},
|
||||
Instance3Example: pallet::<Instance3>::{Module, Call, Event<T>, Config<T>, Storage},
|
||||
PalletOld3: pallet_old::<Instance3>::{Module, Call, Event<T>, Config<T>, Storage},
|
||||
System: frame_system::{Pallet, Call, Event<T>},
|
||||
Example: pallet::{Pallet, Call, Event<T>, Config<T>, Storage},
|
||||
PalletOld: pallet_old::{Pallet, Call, Event<T>, Config<T>, Storage},
|
||||
Instance2Example: pallet::<Instance2>::{Pallet, Call, Event<T>, Config<T>, Storage},
|
||||
PalletOld2: pallet_old::<Instance2>::{Pallet, Call, Event<T>, Config<T>, Storage},
|
||||
Instance3Example: pallet::<Instance3>::{Pallet, Call, Event<T>, Config<T>, Storage},
|
||||
PalletOld3: pallet_old::<Instance3>::{Pallet, Call, Event<T>, Config<T>, Storage},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -288,13 +288,13 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Module, Call, Event<T>},
|
||||
Example: pallet::{Module, Call, Event<T>, Config, Storage, Inherent, Origin<T>, ValidateUnsigned},
|
||||
System: frame_system::{Pallet, Call, Event<T>},
|
||||
Example: pallet::{Pallet, Call, Event<T>, Config, Storage, Inherent, Origin<T>, ValidateUnsigned},
|
||||
Instance1Example: pallet::<Instance1>::{
|
||||
Module, Call, Event<T>, Config, Storage, Inherent, Origin<T>, ValidateUnsigned
|
||||
Pallet, Call, Event<T>, Config, Storage, Inherent, Origin<T>, ValidateUnsigned
|
||||
},
|
||||
Example2: pallet2::{Module, Call, Event<T>, Config<T>, Storage},
|
||||
Instance1Example2: pallet2::<Instance1>::{Module, Call, Event<T>, Config<T>, Storage},
|
||||
Example2: pallet2::{Pallet, Call, Event<T>, Config<T>, Storage},
|
||||
Instance1Example2: pallet2::<Instance1>::{Pallet, Call, Event<T>, Config<T>, Storage},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -377,19 +377,19 @@ fn instance_expand() {
|
||||
#[test]
|
||||
fn pallet_expand_deposit_event() {
|
||||
TestExternalities::default().execute_with(|| {
|
||||
frame_system::Module::<Runtime>::set_block_number(1);
|
||||
frame_system::Pallet::<Runtime>::set_block_number(1);
|
||||
pallet::Call::<Runtime>::foo(3).dispatch_bypass_filter(None.into()).unwrap();
|
||||
assert_eq!(
|
||||
frame_system::Module::<Runtime>::events()[0].event,
|
||||
frame_system::Pallet::<Runtime>::events()[0].event,
|
||||
Event::pallet(pallet::Event::Something(3)),
|
||||
);
|
||||
});
|
||||
|
||||
TestExternalities::default().execute_with(|| {
|
||||
frame_system::Module::<Runtime>::set_block_number(1);
|
||||
frame_system::Pallet::<Runtime>::set_block_number(1);
|
||||
pallet::Call::<Runtime, pallet::Instance1>::foo(3).dispatch_bypass_filter(None.into()).unwrap();
|
||||
assert_eq!(
|
||||
frame_system::Module::<Runtime>::events()[0].event,
|
||||
frame_system::Pallet::<Runtime>::events()[0].event,
|
||||
Event::pallet_Instance1(pallet::Event::Something(3)),
|
||||
);
|
||||
});
|
||||
@@ -480,14 +480,14 @@ fn storage_expand() {
|
||||
#[test]
|
||||
fn pallet_hooks_expand() {
|
||||
TestExternalities::default().execute_with(|| {
|
||||
frame_system::Module::<Runtime>::set_block_number(1);
|
||||
frame_system::Pallet::<Runtime>::set_block_number(1);
|
||||
|
||||
assert_eq!(AllModules::on_initialize(1), 21);
|
||||
AllModules::on_finalize(1);
|
||||
assert_eq!(AllPallets::on_initialize(1), 21);
|
||||
AllPallets::on_finalize(1);
|
||||
|
||||
assert_eq!(pallet::Pallet::<Runtime>::storage_version(), None);
|
||||
assert_eq!(pallet::Pallet::<Runtime, pallet::Instance1>::storage_version(), None);
|
||||
assert_eq!(AllModules::on_runtime_upgrade(), 61);
|
||||
assert_eq!(AllPallets::on_runtime_upgrade(), 61);
|
||||
assert_eq!(
|
||||
pallet::Pallet::<Runtime>::storage_version(),
|
||||
Some(pallet::Pallet::<Runtime>::current_version()),
|
||||
@@ -499,27 +499,27 @@ fn pallet_hooks_expand() {
|
||||
|
||||
// The order is indeed reversed due to https://github.com/paritytech/substrate/issues/6280
|
||||
assert_eq!(
|
||||
frame_system::Module::<Runtime>::events()[0].event,
|
||||
frame_system::Pallet::<Runtime>::events()[0].event,
|
||||
Event::pallet_Instance1(pallet::Event::Something(11)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Module::<Runtime>::events()[1].event,
|
||||
frame_system::Pallet::<Runtime>::events()[1].event,
|
||||
Event::pallet(pallet::Event::Something(10)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Module::<Runtime>::events()[2].event,
|
||||
frame_system::Pallet::<Runtime>::events()[2].event,
|
||||
Event::pallet_Instance1(pallet::Event::Something(21)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Module::<Runtime>::events()[3].event,
|
||||
frame_system::Pallet::<Runtime>::events()[3].event,
|
||||
Event::pallet(pallet::Event::Something(20)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Module::<Runtime>::events()[4].event,
|
||||
frame_system::Pallet::<Runtime>::events()[4].event,
|
||||
Event::pallet_Instance1(pallet::Event::Something(31)),
|
||||
);
|
||||
assert_eq!(
|
||||
frame_system::Module::<Runtime>::events()[5].event,
|
||||
frame_system::Pallet::<Runtime>::events()[5].event,
|
||||
Event::pallet(pallet::Event::Something(30)),
|
||||
);
|
||||
})
|
||||
|
||||
@@ -174,15 +174,15 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Module, Call, Event<T>},
|
||||
Module1: module1::{Module, Call},
|
||||
Module2: module2::{Module, Call},
|
||||
Module2_1: module2::<Instance1>::{Module, Call},
|
||||
Module2_2: module2::<Instance2>::{Module, Call},
|
||||
Pallet3: pallet3::{Module, Call},
|
||||
Pallet4: pallet4::{Module, Call},
|
||||
Pallet4_1: pallet4::<Instance1>::{Module, Call},
|
||||
Pallet4_2: pallet4::<Instance2>::{Module, Call},
|
||||
System: frame_system::{Pallet, Call, Event<T>},
|
||||
Module1: module1::{Pallet, Call},
|
||||
Module2: module2::{Pallet, Call},
|
||||
Module2_1: module2::<Instance1>::{Pallet, Call},
|
||||
Module2_2: module2::<Instance2>::{Pallet, Call},
|
||||
Pallet3: pallet3::{Pallet, Call},
|
||||
Pallet4: pallet4::{Pallet, Call},
|
||||
Pallet4_1: pallet4::<Instance1>::{Pallet, Call},
|
||||
Pallet4_2: pallet4::<Instance2>::{Pallet, Call},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -218,7 +218,7 @@ fn check_pallet_version(pallet: &str) {
|
||||
#[test]
|
||||
fn on_runtime_upgrade_sets_the_pallet_versions_in_storage() {
|
||||
sp_io::TestExternalities::new_empty().execute_with(|| {
|
||||
AllModules::on_runtime_upgrade();
|
||||
AllPallets::on_runtime_upgrade();
|
||||
|
||||
check_pallet_version("Module1");
|
||||
check_pallet_version("Module2");
|
||||
@@ -237,7 +237,7 @@ fn on_runtime_upgrade_overwrites_old_version() {
|
||||
let key = get_pallet_version_storage_key_for_pallet("Module2");
|
||||
sp_io::storage::set(&key, &SOME_TEST_VERSION.encode());
|
||||
|
||||
AllModules::on_runtime_upgrade();
|
||||
AllPallets::on_runtime_upgrade();
|
||||
|
||||
check_pallet_version("Module1");
|
||||
check_pallet_version("Module2");
|
||||
|
||||
@@ -109,8 +109,8 @@ mod tests {
|
||||
NodeBlock = TestBlock,
|
||||
UncheckedExtrinsic = TestUncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||
PalletTest: pallet_test::{Module, Call, Storage, Event<T>, Config, ValidateUnsigned, Inherent},
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
PalletTest: pallet_test::{Pallet, Call, Storage, Event<T>, Config, ValidateUnsigned, Inherent},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user