mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
Moves Block to frame_system instead of construct_runtime and removes Header and BlockNumber (#14437)
* Initial setup * Adds node block * Uses UncheckedExtrinsic and removes Where section * Updates frame_system to use Block * Adds deprecation warning * Fixes pallet-timestamp * Removes Header and BlockNumber * Addresses review comments * Addresses review comments * Adds comment about compiler bug * Removes where clause * Refactors code * Fixes errors in cargo check * Fixes errors in cargo check * Fixes warnings in cargo check * Formatting * Fixes construct_runtime tests * Uses import instead of full path for BlockNumber * Uses import instead of full path for Header * Formatting * Fixes construct_runtime tests * Fixes imports in benchmarks * Formatting * Fixes construct_runtime tests * Formatting * Minor updates * Fixes construct_runtime ui tests * Fixes construct_runtime ui tests with 1.70 * Fixes docs * Fixes docs * Adds u128 mock block type * Fixes split example * fixes for cumulus * ".git/.scripts/commands/fmt/fmt.sh" * Updates new tests * Fixes fully-qualified path in few places * Formatting * Update frame/examples/default-config/src/lib.rs Co-authored-by: Juan <juangirini@gmail.com> * Update frame/support/procedural/src/construct_runtime/mod.rs Co-authored-by: Juan <juangirini@gmail.com> * ".git/.scripts/commands/fmt/fmt.sh" * Addresses some review comments * Fixes build * ".git/.scripts/commands/fmt/fmt.sh" * Update frame/democracy/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/democracy/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/support/procedural/src/construct_runtime/mod.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/support/procedural/src/construct_runtime/mod.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Addresses review comments * Updates trait bounds * Minor fix * ".git/.scripts/commands/fmt/fmt.sh" * Removes unnecessary bound * ".git/.scripts/commands/fmt/fmt.sh" * Updates test * Fixes build * Adds a bound for header * ".git/.scripts/commands/fmt/fmt.sh" * Removes where block * Minor fix * Minor fix * Fixes tests * ".git/.scripts/commands/update-ui/update-ui.sh" 1.70 * Updates test * Update primitives/runtime/src/traits.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update primitives/runtime/src/traits.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Updates doc * Updates doc --------- Co-authored-by: command-bot <> Co-authored-by: Juan <juangirini@gmail.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -19,12 +19,12 @@ use crate::construct_runtime::Pallet;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::quote;
|
||||
use std::str::FromStr;
|
||||
use syn::{Ident, TypePath};
|
||||
use syn::Ident;
|
||||
|
||||
pub fn expand_outer_inherent(
|
||||
runtime: &Ident,
|
||||
block: &TypePath,
|
||||
unchecked_extrinsic: &TypePath,
|
||||
block: &TokenStream,
|
||||
unchecked_extrinsic: &TokenStream,
|
||||
pallet_decls: &[Pallet],
|
||||
scrate: &TokenStream,
|
||||
) -> TokenStream {
|
||||
|
||||
@@ -19,13 +19,13 @@ use crate::construct_runtime::{parse::PalletPath, Pallet};
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::quote;
|
||||
use std::str::FromStr;
|
||||
use syn::{Ident, TypePath};
|
||||
use syn::Ident;
|
||||
|
||||
pub fn expand_runtime_metadata(
|
||||
runtime: &Ident,
|
||||
pallet_declarations: &[Pallet],
|
||||
scrate: &TokenStream,
|
||||
extrinsic: &TypePath,
|
||||
extrinsic: &TokenStream,
|
||||
system_path: &PalletPath,
|
||||
) -> TokenStream {
|
||||
let pallets = pallet_declarations
|
||||
|
||||
@@ -216,10 +216,7 @@ use frame_support_procedural_tools::{
|
||||
generate_crate_access, generate_crate_access_2018, generate_hidden_includes,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use parse::{
|
||||
ExplicitRuntimeDeclaration, ImplicitRuntimeDeclaration, Pallet, RuntimeDeclaration,
|
||||
WhereSection,
|
||||
};
|
||||
use parse::{ExplicitRuntimeDeclaration, ImplicitRuntimeDeclaration, Pallet, RuntimeDeclaration};
|
||||
use proc_macro::TokenStream;
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
use quote::quote;
|
||||
@@ -337,19 +334,14 @@ fn construct_runtime_explicit_to_explicit_expanded(
|
||||
fn construct_runtime_final_expansion(
|
||||
definition: ExplicitRuntimeDeclaration,
|
||||
) -> Result<TokenStream2> {
|
||||
let ExplicitRuntimeDeclaration {
|
||||
name,
|
||||
where_section: WhereSection { block, node_block, unchecked_extrinsic },
|
||||
pallets,
|
||||
pallets_token,
|
||||
} = definition;
|
||||
let ExplicitRuntimeDeclaration { name, pallets, pallets_token, where_section } = definition;
|
||||
|
||||
let system_pallet =
|
||||
pallets.iter().find(|decl| decl.name == SYSTEM_PALLET_NAME).ok_or_else(|| {
|
||||
syn::Error::new(
|
||||
pallets_token.span.join(),
|
||||
"`System` pallet declaration is missing. \
|
||||
Please add this line: `System: frame_system::{Pallet, Call, Storage, Config, Event<T>},`",
|
||||
Please add this line: `System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},`",
|
||||
)
|
||||
})?;
|
||||
if !system_pallet.cfg_pattern.is_empty() {
|
||||
@@ -379,6 +371,10 @@ fn construct_runtime_final_expansion(
|
||||
let scrate = generate_crate_access(hidden_crate_name, "frame-support");
|
||||
let scrate_decl = generate_hidden_includes(hidden_crate_name, "frame-support");
|
||||
|
||||
let frame_system = generate_crate_access_2018("frame-system")?;
|
||||
let block = quote!(<#name as #frame_system::Config>::Block);
|
||||
let unchecked_extrinsic = quote!(<#block as #scrate::sp_runtime::traits::Block>::Extrinsic);
|
||||
|
||||
let outer_event =
|
||||
expand::expand_outer_enum(&name, &pallets, &scrate, expand::OuterEnumType::Event)?;
|
||||
let outer_error =
|
||||
@@ -407,7 +403,21 @@ fn construct_runtime_final_expansion(
|
||||
let integrity_test = decl_integrity_test(&scrate);
|
||||
let static_assertions = decl_static_assertions(&name, &pallets, &scrate);
|
||||
|
||||
let warning =
|
||||
where_section.map_or(None, |where_section| {
|
||||
Some(proc_macro_warning::Warning::new_deprecated("WhereSection")
|
||||
.old("use a `where` clause in `construct_runtime`")
|
||||
.new("use `frame_system::Config` to set the `Block` type and delete this clause.
|
||||
It is planned to be removed in December 2023")
|
||||
.help_links(&["https://github.com/paritytech/substrate/pull/14437"])
|
||||
.span(where_section.span)
|
||||
.build(),
|
||||
)
|
||||
});
|
||||
|
||||
let res = quote!(
|
||||
#warning
|
||||
|
||||
#scrate_decl
|
||||
|
||||
// Prevent UncheckedExtrinsic to print unused warning.
|
||||
@@ -421,9 +431,6 @@ fn construct_runtime_final_expansion(
|
||||
#scrate::scale_info::TypeInfo
|
||||
)]
|
||||
pub struct #name;
|
||||
impl #scrate::sp_runtime::traits::GetNodeBlockType for #name {
|
||||
type NodeBlock = #node_block;
|
||||
}
|
||||
impl #scrate::sp_runtime::traits::GetRuntimeBlockType for #name {
|
||||
type RuntimeBlock = #block;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ pub enum RuntimeDeclaration {
|
||||
#[derive(Debug)]
|
||||
pub struct ImplicitRuntimeDeclaration {
|
||||
pub name: Ident,
|
||||
pub where_section: WhereSection,
|
||||
pub where_section: Option<WhereSection>,
|
||||
pub pallets: Vec<PalletDeclaration>,
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ pub struct ImplicitRuntimeDeclaration {
|
||||
#[derive(Debug)]
|
||||
pub struct ExplicitRuntimeDeclaration {
|
||||
pub name: Ident,
|
||||
pub where_section: WhereSection,
|
||||
pub where_section: Option<WhereSection>,
|
||||
pub pallets: Vec<Pallet>,
|
||||
pub pallets_token: token::Brace,
|
||||
}
|
||||
@@ -90,7 +90,7 @@ impl Parse for RuntimeDeclaration {
|
||||
}
|
||||
|
||||
let name = input.parse::<syn::Ident>()?;
|
||||
let where_section = input.parse()?;
|
||||
let where_section = if input.peek(token::Where) { Some(input.parse()?) } else { None };
|
||||
let pallets =
|
||||
input.parse::<ext::Braces<ext::Punctuated<PalletDeclaration, Token![,]>>>()?;
|
||||
let pallets_token = pallets.token;
|
||||
@@ -122,6 +122,7 @@ impl Parse for RuntimeDeclaration {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct WhereSection {
|
||||
pub span: Span,
|
||||
pub block: syn::TypePath,
|
||||
pub node_block: syn::TypePath,
|
||||
pub unchecked_extrinsic: syn::TypePath,
|
||||
@@ -130,6 +131,7 @@ pub struct WhereSection {
|
||||
impl Parse for WhereSection {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
input.parse::<token::Where>()?;
|
||||
|
||||
let mut definitions = Vec::new();
|
||||
while !input.peek(token::Brace) {
|
||||
let definition: WhereDefinition = input.parse()?;
|
||||
@@ -153,7 +155,7 @@ impl Parse for WhereSection {
|
||||
);
|
||||
return Err(Error::new(*kind_span, msg))
|
||||
}
|
||||
Ok(Self { block, node_block, unchecked_extrinsic })
|
||||
Ok(Self { span: input.span(), block, node_block, unchecked_extrinsic })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -856,7 +856,7 @@ pub fn storage_alias(_: TokenStream, input: TokenStream) -> TokenStream {
|
||||
/// type RuntimeOrigin = RuntimeOrigin;
|
||||
/// type OnSetCode = ();
|
||||
/// type PalletInfo = PalletInfo;
|
||||
/// type Header = Header;
|
||||
/// type Block = Block;
|
||||
/// // We decide to override this one.
|
||||
/// type AccountData = pallet_balances::AccountData<u64>;
|
||||
/// }
|
||||
@@ -902,7 +902,7 @@ pub fn storage_alias(_: TokenStream, input: TokenStream) -> TokenStream {
|
||||
/// type RuntimeOrigin = RuntimeOrigin;
|
||||
/// type OnSetCode = ();
|
||||
/// type PalletInfo = PalletInfo;
|
||||
/// type Header = Header;
|
||||
/// type Block = Block;
|
||||
/// type AccountData = pallet_balances::AccountData<u64>;
|
||||
/// type Version = <TestDefaultConfig as DefaultConfig>::Version;
|
||||
/// type BlockWeights = <TestDefaultConfig as DefaultConfig>::BlockWeights;
|
||||
@@ -1559,7 +1559,7 @@ pub fn unbounded(_: TokenStream, _: TokenStream) -> TokenStream {
|
||||
/// ```ignore
|
||||
/// #[pallet::storage]
|
||||
/// #[pallet::whitelist_storage]
|
||||
/// pub(super) type Number<T: Config> = StorageValue<_, T::BlockNumber, ValueQuery>;
|
||||
/// pub(super) type Number<T: Config> = StorageValue<_, frame_system::pallet_prelude::BlockNumberFor::<T>, ValueQuery>;
|
||||
/// ```
|
||||
///
|
||||
/// NOTE: As with all `pallet::*` attributes, this one _must_ be written as
|
||||
|
||||
@@ -75,7 +75,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
let frame_system = &def.frame_system;
|
||||
quote::quote! {
|
||||
impl<#type_impl_gen>
|
||||
#frame_support::traits::Hooks<<T as #frame_system::Config>::BlockNumber>
|
||||
#frame_support::traits::Hooks<#frame_system::pallet_prelude::BlockNumberFor::<T>>
|
||||
for #pallet_ident<#type_use_gen> #where_clause {}
|
||||
}
|
||||
} else {
|
||||
@@ -137,50 +137,50 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
#hooks_impl
|
||||
|
||||
impl<#type_impl_gen>
|
||||
#frame_support::traits::OnFinalize<<T as #frame_system::Config>::BlockNumber>
|
||||
#frame_support::traits::OnFinalize<#frame_system::pallet_prelude::BlockNumberFor::<T>>
|
||||
for #pallet_ident<#type_use_gen> #where_clause
|
||||
{
|
||||
fn on_finalize(n: <T as #frame_system::Config>::BlockNumber) {
|
||||
fn on_finalize(n: #frame_system::pallet_prelude::BlockNumberFor::<T>) {
|
||||
#frame_support::sp_tracing::enter_span!(
|
||||
#frame_support::sp_tracing::trace_span!("on_finalize")
|
||||
);
|
||||
<
|
||||
Self as #frame_support::traits::Hooks<
|
||||
<T as #frame_system::Config>::BlockNumber
|
||||
#frame_system::pallet_prelude::BlockNumberFor::<T>
|
||||
>
|
||||
>::on_finalize(n)
|
||||
}
|
||||
}
|
||||
|
||||
impl<#type_impl_gen>
|
||||
#frame_support::traits::OnIdle<<T as #frame_system::Config>::BlockNumber>
|
||||
#frame_support::traits::OnIdle<#frame_system::pallet_prelude::BlockNumberFor::<T>>
|
||||
for #pallet_ident<#type_use_gen> #where_clause
|
||||
{
|
||||
fn on_idle(
|
||||
n: <T as #frame_system::Config>::BlockNumber,
|
||||
n: #frame_system::pallet_prelude::BlockNumberFor::<T>,
|
||||
remaining_weight: #frame_support::weights::Weight
|
||||
) -> #frame_support::weights::Weight {
|
||||
<
|
||||
Self as #frame_support::traits::Hooks<
|
||||
<T as #frame_system::Config>::BlockNumber
|
||||
#frame_system::pallet_prelude::BlockNumberFor::<T>
|
||||
>
|
||||
>::on_idle(n, remaining_weight)
|
||||
}
|
||||
}
|
||||
|
||||
impl<#type_impl_gen>
|
||||
#frame_support::traits::OnInitialize<<T as #frame_system::Config>::BlockNumber>
|
||||
#frame_support::traits::OnInitialize<#frame_system::pallet_prelude::BlockNumberFor::<T>>
|
||||
for #pallet_ident<#type_use_gen> #where_clause
|
||||
{
|
||||
fn on_initialize(
|
||||
n: <T as #frame_system::Config>::BlockNumber
|
||||
n: #frame_system::pallet_prelude::BlockNumberFor::<T>
|
||||
) -> #frame_support::weights::Weight {
|
||||
#frame_support::sp_tracing::enter_span!(
|
||||
#frame_support::sp_tracing::trace_span!("on_initialize")
|
||||
);
|
||||
<
|
||||
Self as #frame_support::traits::Hooks<
|
||||
<T as #frame_system::Config>::BlockNumber
|
||||
#frame_system::pallet_prelude::BlockNumberFor::<T>
|
||||
>
|
||||
>::on_initialize(n)
|
||||
}
|
||||
@@ -205,7 +205,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
|
||||
<
|
||||
Self as #frame_support::traits::Hooks<
|
||||
<T as #frame_system::Config>::BlockNumber
|
||||
#frame_system::pallet_prelude::BlockNumberFor::<T>
|
||||
>
|
||||
>::on_runtime_upgrade()
|
||||
}
|
||||
@@ -215,7 +215,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
<
|
||||
Self
|
||||
as
|
||||
#frame_support::traits::Hooks<<T as #frame_system::Config>::BlockNumber>
|
||||
#frame_support::traits::Hooks<#frame_system::pallet_prelude::BlockNumberFor::<T>>
|
||||
>::pre_upgrade()
|
||||
}
|
||||
|
||||
@@ -226,19 +226,19 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
<
|
||||
Self
|
||||
as
|
||||
#frame_support::traits::Hooks<<T as #frame_system::Config>::BlockNumber>
|
||||
#frame_support::traits::Hooks<#frame_system::pallet_prelude::BlockNumberFor::<T>>
|
||||
>::post_upgrade(state)
|
||||
}
|
||||
}
|
||||
|
||||
impl<#type_impl_gen>
|
||||
#frame_support::traits::OffchainWorker<<T as #frame_system::Config>::BlockNumber>
|
||||
#frame_support::traits::OffchainWorker<#frame_system::pallet_prelude::BlockNumberFor::<T>>
|
||||
for #pallet_ident<#type_use_gen> #where_clause
|
||||
{
|
||||
fn offchain_worker(n: <T as #frame_system::Config>::BlockNumber) {
|
||||
fn offchain_worker(n: #frame_system::pallet_prelude::BlockNumberFor::<T>) {
|
||||
<
|
||||
Self as #frame_support::traits::Hooks<
|
||||
<T as #frame_system::Config>::BlockNumber
|
||||
#frame_system::pallet_prelude::BlockNumberFor::<T>
|
||||
>
|
||||
>::offchain_worker(n)
|
||||
}
|
||||
@@ -253,7 +253,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
fn integrity_test() {
|
||||
<
|
||||
Self as #frame_support::traits::Hooks<
|
||||
<T as #frame_system::Config>::BlockNumber
|
||||
#frame_system::pallet_prelude::BlockNumberFor::<T>
|
||||
>
|
||||
>::integrity_test()
|
||||
}
|
||||
@@ -262,17 +262,17 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl<#type_impl_gen>
|
||||
#frame_support::traits::TryState<<T as #frame_system::Config>::BlockNumber>
|
||||
#frame_support::traits::TryState<#frame_system::pallet_prelude::BlockNumberFor::<T>>
|
||||
for #pallet_ident<#type_use_gen> #where_clause
|
||||
{
|
||||
fn try_state(
|
||||
n: <T as #frame_system::Config>::BlockNumber,
|
||||
n: #frame_system::pallet_prelude::BlockNumberFor::<T>,
|
||||
_s: #frame_support::traits::TryStateSelect
|
||||
) -> Result<(), #frame_support::sp_runtime::TryRuntimeError> {
|
||||
#log_try_state
|
||||
<
|
||||
Self as #frame_support::traits::Hooks<
|
||||
<T as #frame_system::Config>::BlockNumber
|
||||
#frame_system::pallet_prelude::BlockNumberFor::<T>
|
||||
>
|
||||
>::try_state(n)
|
||||
}
|
||||
|
||||
@@ -645,259 +645,6 @@ impl<T> PaysFee<T> for (u64, Pays) {
|
||||
// END TODO
|
||||
|
||||
/// Declares a `Module` struct and a `Call` enum, which implements the dispatch logic.
|
||||
///
|
||||
/// ## Declaration
|
||||
///
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{Config, ensure_signed};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
///
|
||||
/// // Private functions are dispatchable, but not available to other
|
||||
/// // FRAME pallets.
|
||||
/// #[weight = 0]
|
||||
/// fn my_function(origin, var: u64) -> dispatch::DispatchResult {
|
||||
/// // Your implementation
|
||||
/// Ok(())
|
||||
/// }
|
||||
///
|
||||
/// // Public functions are both dispatchable and available to other
|
||||
/// // FRAME pallets.
|
||||
/// #[weight = 0]
|
||||
/// pub fn my_public_function(origin) -> dispatch::DispatchResult {
|
||||
/// // Your implementation
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
///
|
||||
/// The declaration is set with the header where:
|
||||
///
|
||||
/// * `Module`: The struct generated by the macro, with type `Config`.
|
||||
/// * `Call`: The enum generated for every pallet, which implements
|
||||
/// [`Callable`](./dispatch/trait.Callable.html).
|
||||
/// * `origin`: Alias of `T::RuntimeOrigin`.
|
||||
/// * `Result`: The expected return type from pallet functions.
|
||||
///
|
||||
/// The first parameter of dispatchable functions must always be `origin`.
|
||||
///
|
||||
/// ### Shorthand Example
|
||||
///
|
||||
/// The macro automatically expands a shorthand function declaration to return the
|
||||
/// [`DispatchResult`] type. These functions are the same:
|
||||
///
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{Config, ensure_signed};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// #[weight = 0]
|
||||
/// fn my_long_function(origin) -> dispatch::DispatchResult {
|
||||
/// // Your implementation
|
||||
/// Ok(())
|
||||
/// }
|
||||
///
|
||||
/// #[weight = 0]
|
||||
/// fn my_short_function(origin) {
|
||||
/// // Your implementation
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
///
|
||||
/// ### Consuming only portions of the annotated static weight
|
||||
///
|
||||
/// Per default a callable function consumes all of its static weight as declared via
|
||||
/// the #\[weight\] attribute. However, there are use cases where only a portion of this
|
||||
/// weight should be consumed. In that case the static weight is charged pre dispatch and
|
||||
/// the difference is refunded post dispatch.
|
||||
///
|
||||
/// In order to make use of this feature the function must return `DispatchResultWithPostInfo`
|
||||
/// in place of the default `DispatchResult`. Then the actually consumed weight can be returned.
|
||||
/// To consume a non default weight while returning an error
|
||||
/// [`WithPostDispatchInfo::with_weight`](./weight/trait.WithPostDispatchInfo.html) can be used
|
||||
/// to augment any error with custom weight information.
|
||||
///
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::{weights::Weight, dispatch::{DispatchResultWithPostInfo, WithPostDispatchInfo, PostDispatchInfo}};
|
||||
/// # use frame_system::{Config, ensure_signed};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// #[weight = 1_000_000]
|
||||
/// fn my_long_function(origin, do_expensive_calc: bool) -> DispatchResultWithPostInfo {
|
||||
/// ensure_signed(origin).map_err(|e| e.with_weight(Weight::from_parts(100_000, 0)))?;
|
||||
/// if do_expensive_calc {
|
||||
/// // do the expensive calculation
|
||||
/// // ...
|
||||
/// // return None to indicate that we are using all weight (the default)
|
||||
/// return Ok(None::<Weight>.into());
|
||||
/// }
|
||||
/// // expensive calculation not executed: use only a portion of the weight
|
||||
/// Ok(PostDispatchInfo { actual_weight: Some(Weight::from_parts(100_000, 0)), ..Default::default() })
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
///
|
||||
/// ### Transactional Function Example
|
||||
///
|
||||
/// Transactional function discards all changes to storage if it returns `Err`, or commits if
|
||||
/// `Ok`, via the #\[transactional\] attribute. Note the attribute must be after #\[weight\].
|
||||
/// The #\[transactional\] attribute is deprecated since it is the default behaviour.
|
||||
///
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::transactional;
|
||||
/// # use frame_system::Config;
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// #[weight = 0]
|
||||
/// #[transactional]
|
||||
/// fn my_short_function(origin) {
|
||||
/// // Your implementation
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
///
|
||||
/// ### Privileged Function Example
|
||||
///
|
||||
/// A privileged function checks that the origin of the call is `ROOT`.
|
||||
///
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{Config, ensure_signed, ensure_root};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// #[weight = 0]
|
||||
/// fn my_privileged_function(origin) -> dispatch::DispatchResult {
|
||||
/// ensure_root(origin)?;
|
||||
/// // Your implementation
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
///
|
||||
/// ### Attributes on Functions
|
||||
///
|
||||
/// Attributes on functions are supported, but must be in the order of:
|
||||
/// 1. Optional #\[doc\] attribute.
|
||||
/// 2. #\[weight\] attribute.
|
||||
/// 3. Optional function attributes, for instance #\[transactional\]. Those function attributes will
|
||||
/// be written only on the dispatchable functions implemented on `Module`, not on the `Call` enum
|
||||
/// variant.
|
||||
///
|
||||
/// ## Multiple Module Instances Example
|
||||
///
|
||||
/// A Substrate module can be built such that multiple instances of the same module can be used
|
||||
/// within a single runtime. For example, the [Balances module](../pallet_balances/index.html) can
|
||||
/// be added multiple times to your runtime in order to support multiple, independent currencies for
|
||||
/// your blockchain. Here is an example of how you would declare such a module using the
|
||||
/// `decl_module!` macro:
|
||||
///
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::ensure_signed;
|
||||
/// # pub struct DefaultInstance;
|
||||
/// # pub trait Instance: 'static {}
|
||||
/// # impl Instance for DefaultInstance {}
|
||||
/// pub trait Config<I: Instance=DefaultInstance>: frame_system::Config {}
|
||||
///
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config<I>, I: Instance = DefaultInstance> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// // Your implementation
|
||||
/// }
|
||||
/// }
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
///
|
||||
/// Note: `decl_storage` must be called to generate `Instance` trait and optionally
|
||||
/// `DefaultInstance` type.
|
||||
///
|
||||
/// ## Where clause
|
||||
///
|
||||
/// Besides the default `origin: T::RuntimeOrigin`, you can also pass other bounds to the module
|
||||
/// declaration. This where bound will be replicated to all types generated by this macro. The
|
||||
/// chaining of multiple trait bounds with `+` is not supported. If multiple bounds for one type are
|
||||
/// required, it needs to be split up into multiple bounds.
|
||||
///
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{self as system, ensure_signed};
|
||||
/// pub trait Config: system::Config where Self::AccountId: From<u32> {}
|
||||
///
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin, T::AccountId: From<u32> {
|
||||
/// // Your implementation
|
||||
/// }
|
||||
/// }
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
///
|
||||
/// ## Reserved Functions
|
||||
///
|
||||
/// The following are reserved function signatures:
|
||||
///
|
||||
/// * `deposit_event`: Helper function for depositing an [event](https://docs.substrate.io/main-docs/build/events-errors/).
|
||||
/// The default behavior is to call `deposit_event` from the [System
|
||||
/// module](../frame_system/index.html). However, you can write your own implementation for events
|
||||
/// in your runtime. To use the default behavior, add `fn deposit_event() = default;` to your
|
||||
/// `Module`.
|
||||
///
|
||||
/// The following reserved functions also take the block number (with type `T::BlockNumber`) as an
|
||||
/// optional input:
|
||||
///
|
||||
/// * `on_runtime_upgrade`: Executes at the beginning of a block prior to on_initialize when there
|
||||
/// is a runtime upgrade. This allows each module to upgrade its storage before the storage items
|
||||
/// are used. As such, **calling other modules must be avoided**!! Using this function will
|
||||
/// implement the [`OnRuntimeUpgrade`](../sp_runtime/traits/trait.OnRuntimeUpgrade.html) trait.
|
||||
/// Function signature must be `fn on_runtime_upgrade() -> frame_support::weights::Weight`.
|
||||
///
|
||||
/// * `on_initialize`: Executes at the beginning of a block. Using this function will
|
||||
/// implement the [`OnInitialize`](./trait.OnInitialize.html) trait.
|
||||
/// Function signature can be either:
|
||||
/// * `fn on_initialize(n: BlockNumber) -> frame_support::weights::Weight` or
|
||||
/// * `fn on_initialize() -> frame_support::weights::Weight`
|
||||
///
|
||||
/// * `on_idle`: Executes at the end of a block. Passes a remaining weight to provide a threshold
|
||||
/// for when to execute non vital functions. Using this function will implement the
|
||||
/// [`OnIdle`](./traits/trait.OnIdle.html) trait.
|
||||
/// Function signature is:
|
||||
/// * `fn on_idle(n: BlockNumber, remaining_weight: Weight) -> frame_support::weights::Weight`
|
||||
///
|
||||
/// * `on_finalize`: Executes at the end of a block. Using this function will
|
||||
/// implement the [`OnFinalize`](./traits/trait.OnFinalize.html) trait.
|
||||
/// Function signature can be either:
|
||||
/// * `fn on_finalize(n: BlockNumber) -> frame_support::weights::Weight` or
|
||||
/// * `fn on_finalize() -> frame_support::weights::Weight`
|
||||
///
|
||||
/// * `offchain_worker`: Executes at the beginning of a block and produces extrinsics for a future
|
||||
/// block upon completion. Using this function will implement the
|
||||
/// [`OffchainWorker`](./traits/trait.OffchainWorker.html) trait.
|
||||
/// * `integrity_test`: Executes in a test generated by `construct_runtime`, note it doesn't execute
|
||||
/// in an externalities-provided environment. Implement
|
||||
/// [`IntegrityTest`](./trait.IntegrityTest.html) trait.
|
||||
#[macro_export]
|
||||
#[deprecated(note = "Will be removed after July 2023; use the attribute `#[pallet]` macro instead.
|
||||
For more info, see: <https://github.com/paritytech/substrate/pull/13705>")]
|
||||
@@ -3587,7 +3334,7 @@ mod weight_tests {
|
||||
#[pallet::config]
|
||||
#[pallet::disable_frame_system_supertrait_check]
|
||||
pub trait Config: 'static {
|
||||
type BlockNumber: Parameter + Default + MaxEncodedLen;
|
||||
type Block: Parameter + sp_runtime::traits::Block;
|
||||
type AccountId;
|
||||
type Balance;
|
||||
type BaseCallFilter: crate::traits::Contains<Self::RuntimeCall>;
|
||||
@@ -3653,6 +3400,11 @@ mod weight_tests {
|
||||
|
||||
pub mod pallet_prelude {
|
||||
pub type OriginFor<T> = <T as super::Config>::RuntimeOrigin;
|
||||
|
||||
pub type HeaderFor<T> =
|
||||
<<T as super::Config>::Block as sp_runtime::traits::HeaderProvider>::HeaderT;
|
||||
|
||||
pub type BlockNumberFor<T> = <HeaderFor<T> as sp_runtime::traits::Header>::Number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3665,10 +3417,6 @@ mod weight_tests {
|
||||
|
||||
crate::construct_runtime!(
|
||||
pub enum Runtime
|
||||
where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: self::frame_system,
|
||||
}
|
||||
@@ -3682,7 +3430,7 @@ mod weight_tests {
|
||||
}
|
||||
|
||||
impl Config for Runtime {
|
||||
type BlockNumber = BlockNumber;
|
||||
type Block = Block;
|
||||
type AccountId = AccountId;
|
||||
type Balance = Balance;
|
||||
type BaseCallFilter = crate::traits::Everything;
|
||||
|
||||
@@ -21,51 +21,6 @@
|
||||
pub use sp_runtime::traits::{BadOrigin, LookupError};
|
||||
|
||||
/// Declare an error type for a runtime module.
|
||||
///
|
||||
/// `decl_error!` supports only variants that do not hold any data. The dispatchable
|
||||
/// functions return [`DispatchResult`](sp_runtime::DispatchResult). The error type
|
||||
/// implements `From<ErrorType> for DispatchResult` to make the error type usable as error
|
||||
/// in the dispatchable functions.
|
||||
///
|
||||
/// It is required that the error type is registered in `decl_module!` to make the error
|
||||
/// exported in the metadata.
|
||||
///
|
||||
/// # Usage
|
||||
///
|
||||
/// ```
|
||||
/// # use frame_support::{decl_error, decl_module};
|
||||
/// #
|
||||
/// decl_error! {
|
||||
/// /// Errors that can occur in my module.
|
||||
/// pub enum MyError for Module<T: Config> {
|
||||
/// /// Hey this is an error message that indicates bla.
|
||||
/// MyCoolErrorMessage,
|
||||
/// /// You are just not cool enough for my module!
|
||||
/// YouAreNotCoolEnough,
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// # use frame_system::Config;
|
||||
///
|
||||
/// // You need to register the error type in `decl_module!` as well to make the error
|
||||
/// // exported in the metadata.
|
||||
///
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Config> for enum Call where origin: T::RuntimeOrigin {
|
||||
/// type Error = MyError<T>;
|
||||
///
|
||||
/// #[weight = 0]
|
||||
/// fn do_something(origin) -> frame_support::dispatch::DispatchResult {
|
||||
/// Err(MyError::<T>::YouAreNotCoolEnough.into())
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
///
|
||||
/// For instantiable modules you also need to give the instance generic type and bound to the
|
||||
/// error declaration.
|
||||
#[macro_export]
|
||||
#[deprecated(note = "Will be removed after July 2023; use the attribute `#[pallet]` macro instead.
|
||||
For more info, see: <https://github.com/paritytech/substrate/pull/13705>")]
|
||||
|
||||
@@ -834,7 +834,7 @@ pub mod tests {
|
||||
use sp_runtime::{generic, traits::BlakeTwo256, BuildStorage};
|
||||
use sp_std::result;
|
||||
|
||||
pub use self::frame_system::{Config, Pallet};
|
||||
pub use self::frame_system::{pallet_prelude::*, Config, Pallet};
|
||||
|
||||
#[pallet]
|
||||
pub mod frame_system {
|
||||
@@ -849,7 +849,7 @@ pub mod tests {
|
||||
#[pallet::config]
|
||||
#[pallet::disable_frame_system_supertrait_check]
|
||||
pub trait Config: 'static {
|
||||
type BlockNumber: Parameter + Default + MaxEncodedLen;
|
||||
type Block: Parameter + sp_runtime::traits::Block;
|
||||
type AccountId;
|
||||
type BaseCallFilter: crate::traits::Contains<Self::RuntimeCall>;
|
||||
type RuntimeOrigin;
|
||||
@@ -879,12 +879,12 @@ pub mod tests {
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn generic_data)]
|
||||
pub type GenericData<T: Config> =
|
||||
StorageMap<_, Identity, T::BlockNumber, T::BlockNumber, ValueQuery>;
|
||||
StorageMap<_, Identity, BlockNumberFor<T>, BlockNumberFor<T>, ValueQuery>;
|
||||
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn generic_data2)]
|
||||
pub type GenericData2<T: Config> =
|
||||
StorageMap<_, Blake2_128Concat, T::BlockNumber, T::BlockNumber, OptionQuery>;
|
||||
StorageMap<_, Blake2_128Concat, BlockNumberFor<T>, BlockNumberFor<T>, OptionQuery>;
|
||||
|
||||
#[pallet::storage]
|
||||
pub type DataDM<T> =
|
||||
@@ -894,10 +894,10 @@ pub mod tests {
|
||||
pub type GenericDataDM<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
T::BlockNumber,
|
||||
BlockNumberFor<T>,
|
||||
Identity,
|
||||
T::BlockNumber,
|
||||
T::BlockNumber,
|
||||
BlockNumberFor<T>,
|
||||
BlockNumberFor<T>,
|
||||
ValueQuery,
|
||||
>;
|
||||
|
||||
@@ -905,10 +905,10 @@ pub mod tests {
|
||||
pub type GenericData2DM<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
T::BlockNumber,
|
||||
BlockNumberFor<T>,
|
||||
Twox64Concat,
|
||||
T::BlockNumber,
|
||||
T::BlockNumber,
|
||||
BlockNumberFor<T>,
|
||||
BlockNumberFor<T>,
|
||||
OptionQuery,
|
||||
>;
|
||||
|
||||
@@ -919,7 +919,7 @@ pub mod tests {
|
||||
Blake2_128Concat,
|
||||
u32,
|
||||
Blake2_128Concat,
|
||||
T::BlockNumber,
|
||||
BlockNumberFor<T>,
|
||||
Vec<u32>,
|
||||
ValueQuery,
|
||||
>;
|
||||
@@ -956,6 +956,11 @@ pub mod tests {
|
||||
|
||||
pub mod pallet_prelude {
|
||||
pub type OriginFor<T> = <T as super::Config>::RuntimeOrigin;
|
||||
|
||||
pub type HeaderFor<T> =
|
||||
<<T as super::Config>::Block as sp_runtime::traits::HeaderProvider>::HeaderT;
|
||||
|
||||
pub type BlockNumberFor<T> = <HeaderFor<T> as sp_runtime::traits::Header>::Number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -967,17 +972,13 @@ pub mod tests {
|
||||
|
||||
crate::construct_runtime!(
|
||||
pub enum Runtime
|
||||
where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: self::frame_system,
|
||||
}
|
||||
);
|
||||
|
||||
impl Config for Runtime {
|
||||
type BlockNumber = BlockNumber;
|
||||
type Block = Block;
|
||||
type AccountId = AccountId;
|
||||
type BaseCallFilter = crate::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
@@ -1005,12 +1006,8 @@ pub mod tests {
|
||||
fn storage_alias_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
#[crate::storage_alias]
|
||||
type GenericData2<T> = StorageMap<
|
||||
System,
|
||||
Blake2_128Concat,
|
||||
<T as Config>::BlockNumber,
|
||||
<T as Config>::BlockNumber,
|
||||
>;
|
||||
type GenericData2<T> =
|
||||
StorageMap<System, Blake2_128Concat, BlockNumberFor<T>, BlockNumberFor<T>>;
|
||||
|
||||
assert_eq!(Pallet::<Runtime>::generic_data2(5), None);
|
||||
GenericData2::<Runtime>::insert(5, 5);
|
||||
@@ -1018,12 +1015,8 @@ pub mod tests {
|
||||
|
||||
/// Some random docs that ensure that docs are accepted
|
||||
#[crate::storage_alias]
|
||||
pub type GenericData<T> = StorageMap<
|
||||
Test2,
|
||||
Blake2_128Concat,
|
||||
<T as Config>::BlockNumber,
|
||||
<T as Config>::BlockNumber,
|
||||
>;
|
||||
pub type GenericData<T> =
|
||||
StorageMap<Test2, Blake2_128Concat, BlockNumberFor<T>, BlockNumberFor<T>>;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -257,12 +257,9 @@ pub fn migrate_from_pallet_version_to_storage_version<
|
||||
/// # Examples:
|
||||
/// ```ignore
|
||||
/// construct_runtime! {
|
||||
/// pub enum Runtime where
|
||||
/// Block = Block,
|
||||
/// NodeBlock = primitives::Block,
|
||||
/// UncheckedExtrinsic = UncheckedExtrinsic
|
||||
/// pub enum Runtime
|
||||
/// {
|
||||
/// System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0,
|
||||
/// System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 0,
|
||||
///
|
||||
/// SomePalletToRemove: pallet_something::{Pallet, Call, Storage, Event<T>} = 1,
|
||||
/// AnotherPalletToRemove: pallet_something_else::{Pallet, Call, Storage, Event<T>} = 2,
|
||||
|
||||
@@ -58,7 +58,7 @@ mod tests {
|
||||
#[pallet::config]
|
||||
#[pallet::disable_frame_system_supertrait_check]
|
||||
pub trait Config: 'static {
|
||||
type BlockNumber;
|
||||
type Block: sp_runtime::traits::Block;
|
||||
type AccountId;
|
||||
type BaseCallFilter: crate::traits::Contains<Self::RuntimeCall>;
|
||||
type RuntimeOrigin;
|
||||
@@ -102,6 +102,11 @@ mod tests {
|
||||
|
||||
pub mod pallet_prelude {
|
||||
pub type OriginFor<T> = <T as super::Config>::RuntimeOrigin;
|
||||
|
||||
pub type HeaderFor<T> =
|
||||
<<T as super::Config>::Block as sp_runtime::traits::HeaderProvider>::HeaderT;
|
||||
|
||||
pub type BlockNumberFor<T> = <HeaderFor<T> as sp_runtime::traits::Header>::Number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,18 +118,14 @@ mod tests {
|
||||
|
||||
crate::construct_runtime!(
|
||||
pub enum Runtime
|
||||
where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: self::frame_system,
|
||||
}
|
||||
);
|
||||
|
||||
impl self::frame_system::Config for Runtime {
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
type Block = Block;
|
||||
type BaseCallFilter = crate::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
|
||||
@@ -58,13 +58,12 @@ impl frame_system::Config for Runtime {
|
||||
type Index = u128;
|
||||
type Hash = H256;
|
||||
type Hashing = BlakeTwo256;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type BlockHashCount = ConstU64<2400>;
|
||||
type Version = Version;
|
||||
type AccountData = ();
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
@@ -83,12 +82,7 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
|
||||
construct_runtime!(
|
||||
pub struct Runtime
|
||||
where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
pub struct Runtime {
|
||||
System: frame_system,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#![deny(warnings)]
|
||||
|
||||
pub use frame_support::dispatch::RawOrigin;
|
||||
use frame_system::pallet_prelude::BlockNumberFor;
|
||||
|
||||
pub use self::pallet::*;
|
||||
|
||||
@@ -126,12 +127,12 @@ pub mod pallet_prelude {
|
||||
/// tests!
|
||||
pub struct TestRandomness<T>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<Output: codec::Decode + Default, T> frame_support::traits::Randomness<Output, T::BlockNumber>
|
||||
for TestRandomness<T>
|
||||
impl<Output: codec::Decode + Default, T>
|
||||
frame_support::traits::Randomness<Output, BlockNumberFor<T>> for TestRandomness<T>
|
||||
where
|
||||
T: frame_system::Config,
|
||||
{
|
||||
fn random(subject: &[u8]) -> (Output, T::BlockNumber) {
|
||||
fn random(subject: &[u8]) -> (Output, BlockNumberFor<T>) {
|
||||
use sp_runtime::traits::TrailingZeroInput;
|
||||
|
||||
(
|
||||
|
||||
@@ -22,9 +22,13 @@
|
||||
#![recursion_limit = "128"]
|
||||
|
||||
use codec::MaxEncodedLen;
|
||||
use frame_support::{parameter_types, traits::PalletInfo as _};
|
||||
use frame_support::{
|
||||
derive_impl, parameter_types, traits::PalletInfo as _, weights::RuntimeDbWeight,
|
||||
};
|
||||
use frame_system::limits::{BlockLength, BlockWeights};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::sr25519;
|
||||
use sp_api::RuntimeVersion;
|
||||
use sp_core::{sr25519, ConstU64};
|
||||
use sp_runtime::{
|
||||
generic,
|
||||
traits::{BlakeTwo256, Verify},
|
||||
@@ -37,9 +41,8 @@ parameter_types! {
|
||||
|
||||
#[frame_support::pallet(dev_mode)]
|
||||
mod module1 {
|
||||
use self::frame_system::pallet_prelude::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(_);
|
||||
@@ -75,10 +78,9 @@ mod module1 {
|
||||
|
||||
#[frame_support::pallet(dev_mode)]
|
||||
mod module2 {
|
||||
use self::frame_system::pallet_prelude::*;
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
@@ -122,10 +124,9 @@ mod nested {
|
||||
|
||||
#[frame_support::pallet(dev_mode)]
|
||||
pub mod module3 {
|
||||
use self::frame_system::pallet_prelude::*;
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
@@ -180,10 +181,9 @@ mod nested {
|
||||
|
||||
#[frame_support::pallet(dev_mode)]
|
||||
pub mod module3 {
|
||||
use self::frame_system::pallet_prelude::*;
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
@@ -256,15 +256,10 @@ pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
use frame_support_test as system;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet, Call, Event<T>, Origin<T>} = 30,
|
||||
System: frame_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<T>, Origin},
|
||||
Module1_2: module1::<Instance2>::{Pallet, Call, Storage, Event<T>, Origin<T>},
|
||||
@@ -280,15 +275,18 @@ frame_support::construct_runtime!(
|
||||
}
|
||||
);
|
||||
|
||||
impl frame_support_test::Config for Runtime {
|
||||
type BlockNumber = BlockNumber;
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Runtime {
|
||||
type AccountId = AccountId;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<AccountId>;
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type DbWeight = ();
|
||||
type OnSetCode = ();
|
||||
type Block = Block;
|
||||
type BlockHashCount = ConstU64<10>;
|
||||
}
|
||||
|
||||
impl module1::Config<module1::Instance1> for Runtime {
|
||||
@@ -336,7 +334,7 @@ fn test_pub() -> AccountId {
|
||||
fn check_modules_error_type() {
|
||||
sp_io::TestExternalities::default().execute_with(|| {
|
||||
assert_eq!(
|
||||
Module1_1::fail(system::Origin::<Runtime>::Root.into()),
|
||||
Module1_1::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 31,
|
||||
error: [0; 4],
|
||||
@@ -344,7 +342,7 @@ fn check_modules_error_type() {
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
Module2::fail(system::Origin::<Runtime>::Root.into()),
|
||||
Module2::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 32,
|
||||
error: [0; 4],
|
||||
@@ -352,7 +350,7 @@ fn check_modules_error_type() {
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
Module1_2::fail(system::Origin::<Runtime>::Root.into()),
|
||||
Module1_2::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 33,
|
||||
error: [0; 4],
|
||||
@@ -360,7 +358,7 @@ fn check_modules_error_type() {
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
NestedModule3::fail(system::Origin::<Runtime>::Root.into()),
|
||||
NestedModule3::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 34,
|
||||
error: [0; 4],
|
||||
@@ -368,7 +366,7 @@ fn check_modules_error_type() {
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
Module1_3::fail(system::Origin::<Runtime>::Root.into()),
|
||||
Module1_3::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 6,
|
||||
error: [0; 4],
|
||||
@@ -376,7 +374,7 @@ fn check_modules_error_type() {
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
Module1_4::fail(system::Origin::<Runtime>::Root.into()),
|
||||
Module1_4::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 3,
|
||||
error: [0; 4],
|
||||
@@ -384,7 +382,7 @@ fn check_modules_error_type() {
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
Module1_5::fail(system::Origin::<Runtime>::Root.into()),
|
||||
Module1_5::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 4,
|
||||
error: [0; 4],
|
||||
@@ -392,7 +390,7 @@ fn check_modules_error_type() {
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
Module1_6::fail(system::Origin::<Runtime>::Root.into()),
|
||||
Module1_6::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 1,
|
||||
error: [0; 4],
|
||||
@@ -400,7 +398,7 @@ fn check_modules_error_type() {
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
Module1_7::fail(system::Origin::<Runtime>::Root.into()),
|
||||
Module1_7::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 2,
|
||||
error: [0; 4],
|
||||
@@ -408,7 +406,7 @@ fn check_modules_error_type() {
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
Module1_8::fail(system::Origin::<Runtime>::Root.into()),
|
||||
Module1_8::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 12,
|
||||
error: [0; 4],
|
||||
@@ -416,7 +414,7 @@ fn check_modules_error_type() {
|
||||
})),
|
||||
);
|
||||
assert_eq!(
|
||||
Module1_9::fail(system::Origin::<Runtime>::Root.into()),
|
||||
Module1_9::fail(frame_system::Origin::<Runtime>::Root.into()),
|
||||
Err(DispatchError::Module(ModuleError {
|
||||
index: 13,
|
||||
error: [0; 4],
|
||||
@@ -436,7 +434,7 @@ fn integrity_test_works() {
|
||||
fn origin_codec() {
|
||||
use codec::Encode;
|
||||
|
||||
let origin = OriginCaller::system(system::RawOrigin::None);
|
||||
let origin = OriginCaller::system(frame_system::RawOrigin::None);
|
||||
assert_eq!(origin.encode()[0], 30);
|
||||
|
||||
let origin = OriginCaller::Module1_1(module1::Origin(Default::default()));
|
||||
@@ -471,7 +469,8 @@ fn origin_codec() {
|
||||
fn event_codec() {
|
||||
use codec::Encode;
|
||||
|
||||
let event = system::Event::<Runtime>::ExtrinsicSuccess;
|
||||
let event =
|
||||
frame_system::Event::<Runtime>::ExtrinsicSuccess { dispatch_info: Default::default() };
|
||||
assert_eq!(RuntimeEvent::from(event).encode()[0], 30);
|
||||
|
||||
let event = module1::Event::<Runtime, module1::Instance1>::A(test_pub());
|
||||
@@ -508,7 +507,7 @@ fn event_codec() {
|
||||
#[test]
|
||||
fn call_codec() {
|
||||
use codec::Encode;
|
||||
assert_eq!(RuntimeCall::System(system::Call::noop {}).encode()[0], 30);
|
||||
assert_eq!(RuntimeCall::System(frame_system::Call::remark { remark: vec![1] }).encode()[0], 30);
|
||||
assert_eq!(RuntimeCall::Module1_1(module1::Call::fail {}).encode()[0], 31);
|
||||
assert_eq!(RuntimeCall::Module2(module2::Call::fail {}).encode()[0], 32);
|
||||
assert_eq!(RuntimeCall::Module1_2(module1::Call::fail {}).encode()[0], 33);
|
||||
@@ -639,15 +638,67 @@ fn call_subtype_conversion() {
|
||||
fn test_metadata() {
|
||||
use frame_support::metadata::{v14::*, *};
|
||||
use scale_info::meta_type;
|
||||
use sp_core::Encode;
|
||||
|
||||
fn maybe_docs(doc: Vec<&'static str>) -> Vec<&'static str> {
|
||||
if cfg!(feature = "no-metadata-docs") {
|
||||
vec![]
|
||||
} else {
|
||||
doc
|
||||
}
|
||||
}
|
||||
|
||||
let pallets = vec![
|
||||
PalletMetadata {
|
||||
name: "System",
|
||||
storage: None,
|
||||
calls: Some(meta_type::<system::Call<Runtime>>().into()),
|
||||
event: Some(meta_type::<system::Event<Runtime>>().into()),
|
||||
constants: vec![],
|
||||
error: Some(meta_type::<system::Error<Runtime>>().into()),
|
||||
calls: Some(meta_type::<frame_system::Call<Runtime>>().into()),
|
||||
event: Some(meta_type::<frame_system::Event<Runtime>>().into()),
|
||||
constants: vec![
|
||||
PalletConstantMetadata {
|
||||
name: "BlockWeights",
|
||||
ty: meta_type::<BlockWeights>(),
|
||||
value: BlockWeights::default().encode(),
|
||||
docs: maybe_docs(vec![" Block & extrinsics weights: base values and limits."]),
|
||||
},
|
||||
PalletConstantMetadata {
|
||||
name: "BlockLength",
|
||||
ty: meta_type::<BlockLength>(),
|
||||
value: BlockLength::default().encode(),
|
||||
docs: maybe_docs(vec![" The maximum length of a block (in bytes)."]),
|
||||
},
|
||||
PalletConstantMetadata {
|
||||
name: "BlockHashCount",
|
||||
ty: meta_type::<u64>(),
|
||||
value: 10u64.encode(),
|
||||
docs: maybe_docs(vec![" Maximum number of block number to block hash mappings to keep (oldest pruned first)."]),
|
||||
},
|
||||
PalletConstantMetadata {
|
||||
name: "DbWeight",
|
||||
ty: meta_type::<RuntimeDbWeight>(),
|
||||
value: RuntimeDbWeight::default().encode(),
|
||||
docs: maybe_docs(vec![" The weight of runtime database operations the runtime can invoke.",]),
|
||||
},
|
||||
PalletConstantMetadata {
|
||||
name: "Version",
|
||||
ty: meta_type::<RuntimeVersion>(),
|
||||
value: RuntimeVersion::default().encode(),
|
||||
docs: maybe_docs(vec![ " Get the chain's current version."]),
|
||||
},
|
||||
PalletConstantMetadata {
|
||||
name: "SS58Prefix",
|
||||
ty: meta_type::<u16>(),
|
||||
value: 0u16.encode(),
|
||||
docs: maybe_docs(vec![
|
||||
" The designated SS58 prefix of this chain.",
|
||||
"",
|
||||
" This replaces the \"ss58Format\" property declared in the chain spec. Reason is",
|
||||
" that the runtime should know about the prefix in order to make use of it as",
|
||||
" an identifier of the chain.",
|
||||
]),
|
||||
},
|
||||
],
|
||||
error: Some(meta_type::<frame_system::Error<Runtime>>().into()),
|
||||
index: 30,
|
||||
},
|
||||
PalletMetadata {
|
||||
@@ -781,7 +832,7 @@ fn test_metadata() {
|
||||
fn pallet_in_runtime_is_correct() {
|
||||
assert_eq!(PalletInfo::index::<System>().unwrap(), 30);
|
||||
assert_eq!(PalletInfo::name::<System>().unwrap(), "System");
|
||||
assert_eq!(PalletInfo::module_name::<System>().unwrap(), "system");
|
||||
assert_eq!(PalletInfo::module_name::<System>().unwrap(), "frame_system");
|
||||
assert!(PalletInfo::crate_version::<System>().is_some());
|
||||
|
||||
assert_eq!(PalletInfo::index::<Module1_1>().unwrap(), 31);
|
||||
|
||||
+2
-5
@@ -20,12 +20,9 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Sign
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet exclude_parts { Pallet } use_parts { Pallet },
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
error: Unexpected tokens, expected one of `=`, `,`
|
||||
--> tests/construct_runtime_ui/both_use_and_excluded_parts.rs:29:43
|
||||
--> tests/construct_runtime_ui/both_use_and_excluded_parts.rs:26:43
|
||||
|
|
||||
29 | Pallet: pallet exclude_parts { Pallet } use_parts { Pallet },
|
||||
26 | Pallet: pallet exclude_parts { Pallet } use_parts { Pallet },
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0412]: cannot find type `RuntimeCall` in this scope
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet},
|
||||
Balance: balances::{Pallet},
|
||||
|
||||
+8
-8
@@ -1,11 +1,11 @@
|
||||
error: Two pallets with the same name!
|
||||
--> $DIR/conflicting_module_name.rs:10:3
|
||||
|
|
||||
10 | Balance: balances::{Pallet},
|
||||
| ^^^^^^^
|
||||
--> tests/construct_runtime_ui/conflicting_module_name.rs:7:3
|
||||
|
|
||||
7 | Balance: balances::{Pallet},
|
||||
| ^^^^^^^
|
||||
|
||||
error: Two pallets with the same name!
|
||||
--> $DIR/conflicting_module_name.rs:11:3
|
||||
|
|
||||
11 | Balance: balances::{Pallet},
|
||||
| ^^^^^^^
|
||||
--> tests/construct_runtime_ui/conflicting_module_name.rs:8:3
|
||||
|
|
||||
8 | Balance: balances::{Pallet},
|
||||
| ^^^^^^^
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = Uxt,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+442
@@ -0,0 +1,442 @@
|
||||
error: use of deprecated constant `WhereSection::_w`:
|
||||
It is deprecated to use a `where` clause in `construct_runtime`.
|
||||
Please instead use `frame_system::Config` to set the `Block` type and delete this clause.
|
||||
It is planned to be removed in December 2023.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/14437>
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | / construct_runtime! {
|
||||
4 | | pub struct Runtime where
|
||||
5 | | Block = Block,
|
||||
6 | | NodeBlock = Block,
|
||||
... |
|
||||
10 | | }
|
||||
11 | | }
|
||||
| |_^
|
||||
|
|
||||
= note: `-D deprecated` implied by `-D warnings`
|
||||
= note: this error originates in the macro `frame_support::match_and_insert` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
note: required by a bound in `frame_system::Event`
|
||||
--> $WORKSPACE/frame/system/src/lib.rs
|
||||
|
|
||||
| pub enum Event<T: Config> {
|
||||
| ^^^^^^ required by this bound in `Event`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied in `RuntimeEvent`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
note: required because it appears within the type `RuntimeEvent`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `Clone`
|
||||
--> $RUST/core/src/clone.rs
|
||||
|
|
||||
| pub trait Clone: Sized {
|
||||
| ^^^^^ required by this bound in `Clone`
|
||||
= note: this error originates in the derive macro `Clone` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied in `RuntimeEvent`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
note: required because it appears within the type `RuntimeEvent`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `EncodeLike`
|
||||
--> $CARGO/parity-scale-codec-3.6.1/src/encode_like.rs
|
||||
|
|
||||
| pub trait EncodeLike<T: Encode = Self>: Sized + Encode {}
|
||||
| ^^^^^ required by this bound in `EncodeLike`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied in `RuntimeEvent`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
note: required because it appears within the type `RuntimeEvent`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `Decode`
|
||||
--> $CARGO/parity-scale-codec-3.6.1/src/codec.rs
|
||||
|
|
||||
| pub trait Decode: Sized {
|
||||
| ^^^^^ required by this bound in `Decode`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied in `frame_system::Event<Runtime>`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
= note: required because it appears within the type `Event<Runtime>`
|
||||
note: required by a bound in `From`
|
||||
--> $RUST/core/src/convert/mod.rs
|
||||
|
|
||||
| pub trait From<T>: Sized {
|
||||
| ^ required by this bound in `From`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied in `frame_system::Event<Runtime>`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
= note: required because it appears within the type `Event<Runtime>`
|
||||
note: required by a bound in `TryInto`
|
||||
--> $RUST/core/src/convert/mod.rs
|
||||
|
|
||||
| pub trait TryInto<T>: Sized {
|
||||
| ^ required by this bound in `TryInto`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | construct_runtime! {
|
||||
| ^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `RawOrigin<_>: TryFrom<OriginCaller>` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
= help: the trait `TryFrom<OriginCaller>` is implemented for `RawOrigin<<Runtime as Config>::AccountId>`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
= help: the trait `Callable<T>` is implemented for `Pallet<T>`
|
||||
= note: required for `Pallet<Runtime>` to implement `Callable<Runtime>`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
= note: required for `Pallet<Runtime>` to implement `Callable<Runtime>`
|
||||
note: required because it appears within the type `RuntimeCall`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `Clone`
|
||||
--> $RUST/core/src/clone.rs
|
||||
|
|
||||
| pub trait Clone: Sized {
|
||||
| ^^^^^ required by this bound in `Clone`
|
||||
= note: this error originates in the derive macro `Clone` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
= note: required for `Pallet<Runtime>` to implement `Callable<Runtime>`
|
||||
note: required because it appears within the type `RuntimeCall`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `EncodeLike`
|
||||
--> $CARGO/parity-scale-codec-3.6.1/src/encode_like.rs
|
||||
|
|
||||
| pub trait EncodeLike<T: Encode = Self>: Sized + Encode {}
|
||||
| ^^^^^ required by this bound in `EncodeLike`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
= note: required for `Pallet<Runtime>` to implement `Callable<Runtime>`
|
||||
note: required because it appears within the type `RuntimeCall`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `Decode`
|
||||
--> $CARGO/parity-scale-codec-3.6.1/src/codec.rs
|
||||
|
|
||||
| pub trait Decode: Sized {
|
||||
| ^^^^^ required by this bound in `Decode`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:9:3
|
||||
|
|
||||
9 | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
| ^^^^^^ the trait `Config` is not implemented for `Runtime`
|
||||
|
|
||||
note: required by a bound in `frame_system::GenesisConfig`
|
||||
--> $WORKSPACE/frame/system/src/lib.rs
|
||||
|
|
||||
| pub struct GenesisConfig<T: Config> {
|
||||
| ^^^^^^ required by this bound in `GenesisConfig`
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied in `RuntimeEvent`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
note: required because it appears within the type `RuntimeEvent`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `Result`
|
||||
--> $RUST/core/src/result.rs
|
||||
|
|
||||
| pub enum Result<T, E> {
|
||||
| ^ required by this bound in `Result`
|
||||
= note: this error originates in the derive macro `self::sp_api_hidden_includes_construct_runtime::hidden_include::codec::Decode` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied in `RuntimeEvent`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
note: required because it appears within the type `RuntimeEvent`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `TryInto`
|
||||
--> $RUST/core/src/convert/mod.rs
|
||||
|
|
||||
| pub trait TryInto<T>: Sized {
|
||||
| ^^^^^ required by this bound in `TryInto`
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `Runtime: Config` is not satisfied
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
= note: required for `Pallet<Runtime>` to implement `Callable<Runtime>`
|
||||
note: required because it appears within the type `RuntimeCall`
|
||||
--> tests/construct_runtime_ui/deprecated_where_block.rs:3:1
|
||||
|
|
||||
3 | // construct_runtime! {
|
||||
4 | || pub struct Runtime where
|
||||
5 | || Block = Block,
|
||||
6 | || NodeBlock = Block,
|
||||
... ||
|
||||
10 | || }
|
||||
11 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
note: required by a bound in `Result`
|
||||
--> $RUST/core/src/result.rs
|
||||
|
|
||||
| pub enum Result<T, E> {
|
||||
| ^ required by this bound in `Result`
|
||||
= note: this error originates in the derive macro `self::sp_api_hidden_includes_construct_runtime::hidden_include::codec::Decode` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet},
|
||||
Balance: balances::{Config, Call, Config<T>, Origin<T>},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error: `Config` was already declared before. Please remove the duplicate declaration
|
||||
--> $DIR/double_module_parts.rs:10:37
|
||||
|
|
||||
10 | Balance: balances::{Config, Call, Config<T>, Origin<T>},
|
||||
| ^^^^^^
|
||||
--> tests/construct_runtime_ui/double_module_parts.rs:7:37
|
||||
|
|
||||
7 | Balance: balances::{Config, Call, Config<T>, Origin<T>},
|
||||
| ^^^^^^
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
system: ,
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error: expected one of: `crate`, `self`, `super`, identifier
|
||||
--> $DIR/empty_pallet_path.rs:9:11
|
||||
--> tests/construct_runtime_ui/empty_pallet_path.rs:6:11
|
||||
|
|
||||
9 | system: ,
|
||||
6 | system: ,
|
||||
| ^
|
||||
|
||||
@@ -25,12 +25,9 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Sign
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet exclude_parts { Call },
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
error: Invalid pallet part specified, the pallet `Pallet` doesn't have the `Call` part. Available parts are: `Pallet`, `Storage`.
|
||||
--> tests/construct_runtime_ui/exclude_undefined_part.rs:34:34
|
||||
--> tests/construct_runtime_ui/exclude_undefined_part.rs:31:34
|
||||
|
|
||||
34 | Pallet: pallet exclude_parts { Call },
|
||||
31 | Pallet: pallet exclude_parts { Call },
|
||||
| ^^^^
|
||||
|
||||
error[E0412]: cannot find type `RuntimeCall` in this scope
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
#[cfg(test)]
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
error: `System` pallet declaration is feature gated, please remove any `#[cfg]` attributes
|
||||
--> tests/construct_runtime_ui/feature_gated_system_pallet.rs:10:3
|
||||
|
|
||||
10 | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
| ^^^^^^
|
||||
--> tests/construct_runtime_ui/feature_gated_system_pallet.rs:7:3
|
||||
|
|
||||
7 | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
| ^^^^^^
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet},
|
||||
Balance: balances::<Instance1>::{Call<T>, Origin<T>},
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
error: `Call` is not allowed to have generics. Only the following pallets are allowed to have generics: `Event`, `Error`, `Origin`, `Config`.
|
||||
--> $DIR/generics_in_invalid_module.rs:10:36
|
||||
|
|
||||
10 | Balance: balances::<Instance1>::{Call<T>, Origin<T>},
|
||||
| ^^^^
|
||||
--> tests/construct_runtime_ui/generics_in_invalid_module.rs:7:36
|
||||
|
|
||||
7 | Balance: balances::<Instance1>::{Call<T>, Origin<T>},
|
||||
| ^^^^
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet},
|
||||
#[cfg(feature = 1)]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
error: feature = 1
|
||||
^ expected one of `<key>`, `all`, `any`, `not` here
|
||||
--> tests/construct_runtime_ui/invalid_meta_literal.rs:10:3
|
||||
|
|
||||
10 | #[cfg(feature = 1)]
|
||||
| ^
|
||||
--> tests/construct_runtime_ui/invalid_meta_literal.rs:7:3
|
||||
|
|
||||
7 | #[cfg(feature = 1)]
|
||||
| ^
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
system: System::(),
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
error: Unexpected tokens, expected one of `::$ident` `::{`, `exclude_parts`, `use_parts`, `=`, `,`
|
||||
--> tests/construct_runtime_ui/invalid_module_details.rs:9:17
|
||||
--> tests/construct_runtime_ui/invalid_module_details.rs:6:17
|
||||
|
|
||||
9 | system: System::(),
|
||||
6 | system: System::(),
|
||||
| ^
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
system: System::{enum},
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
error: expected one of: `Pallet`, `Call`, `Storage`, `Event`, `Error`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`, `FreezeReason`, `HoldReason`, `LockId`, `SlashReason`
|
||||
--> $DIR/invalid_module_details_keyword.rs:9:20
|
||||
--> tests/construct_runtime_ui/invalid_module_details_keyword.rs:6:20
|
||||
|
|
||||
9 | system: System::{enum},
|
||||
6 | system: System::{enum},
|
||||
| ^^^^
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet},
|
||||
Balance: balances::{Unexpected},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error: expected one of: `Pallet`, `Call`, `Storage`, `Event`, `Error`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`, `FreezeReason`, `HoldReason`, `LockId`, `SlashReason`
|
||||
--> $DIR/invalid_module_entry.rs:10:23
|
||||
|
|
||||
10 | Balance: balances::{Unexpected},
|
||||
| ^^^^^^^^^^
|
||||
--> tests/construct_runtime_ui/invalid_module_entry.rs:7:23
|
||||
|
|
||||
7 | Balance: balances::{Unexpected},
|
||||
| ^^^^^^^^^^
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
system: System ?
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
error: Unexpected tokens, expected one of `::$ident` `::{`, `exclude_parts`, `use_parts`, `=`, `,`
|
||||
--> $DIR/invalid_token_after_module.rs:9:18
|
||||
--> tests/construct_runtime_ui/invalid_token_after_module.rs:6:18
|
||||
|
|
||||
9 | system: System ?
|
||||
6 | system: System ?
|
||||
| ^
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
system ?
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
error: expected `:`
|
||||
--> $DIR/invalid_token_after_name.rs:9:10
|
||||
--> tests/construct_runtime_ui/invalid_token_after_name.rs:6:10
|
||||
|
|
||||
9 | system ?
|
||||
6 | system ?
|
||||
| ^
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system expanded::{}::{Pallet},
|
||||
Balance: balances::<Instance1> expanded::{}::{Event},
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
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> expanded::{}::{Event},
|
||||
| ^^^^^^^
|
||||
--> tests/construct_runtime_ui/missing_event_generic_on_module_with_instance.rs:7:3
|
||||
|
|
||||
7 | Balance: balances::<Instance1> expanded::{}::{Event},
|
||||
| ^^^^^^^
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
system: System::<>,
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
error: expected identifier
|
||||
--> $DIR/missing_module_instance.rs:9:20
|
||||
--> tests/construct_runtime_ui/missing_module_instance.rs:6:20
|
||||
|
|
||||
9 | system: System::<>,
|
||||
6 | system: System::<>,
|
||||
| ^
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system expanded::{}::{Pallet},
|
||||
Balance: balances::<Instance1> expanded::{}::{Origin},
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
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> expanded::{}::{Origin},
|
||||
| ^^^^^^^
|
||||
--> tests/construct_runtime_ui/missing_origin_generic_on_module_with_instance.rs:7:3
|
||||
|
|
||||
7 | Balance: balances::<Instance1> expanded::{}::{Origin},
|
||||
| ^^^^^^^
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
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
|
||||
error: `System` pallet declaration is missing. Please add this line: `System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},`
|
||||
--> tests/construct_runtime_ui/missing_system_module.rs:5:2
|
||||
|
|
||||
8 | / {
|
||||
9 | | }
|
||||
5 | / {
|
||||
6 | | }
|
||||
| |_____^
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -1,5 +0,0 @@
|
||||
error: expected `where`
|
||||
--> tests/construct_runtime_ui/missing_where_block.rs:4:21
|
||||
|
|
||||
4 | pub struct Runtime {}
|
||||
| ^
|
||||
+2
-6
@@ -23,13 +23,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -47,10 +46,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet1: pallet::{Pallet},
|
||||
|
||||
+9
-9
@@ -1,7 +1,7 @@
|
||||
error: The number of pallets exceeds the maximum number of tuple elements. To increase this limit, enable the tuples-96 feature of [frame_support].
|
||||
--> tests/construct_runtime_ui/number_of_pallets_exceeds_tuple_size.rs:50:2
|
||||
--> tests/construct_runtime_ui/number_of_pallets_exceeds_tuple_size.rs:49:2
|
||||
|
|
||||
50 | pub struct Runtime where
|
||||
49 | pub struct Runtime
|
||||
| ^^^
|
||||
|
||||
error[E0412]: cannot find type `RuntimeCall` in this scope
|
||||
@@ -34,26 +34,26 @@ error[E0412]: cannot find type `RuntimeOrigin` in this scope
|
||||
| ^^^^^^^^^^^^^ help: you might have meant to use the associated type: `Self::RuntimeOrigin`
|
||||
|
||||
error[E0412]: cannot find type `RuntimeCall` in this scope
|
||||
--> tests/construct_runtime_ui/number_of_pallets_exceeds_tuple_size.rs:27:21
|
||||
--> tests/construct_runtime_ui/number_of_pallets_exceeds_tuple_size.rs:26:21
|
||||
|
|
||||
27 | type RuntimeCall = RuntimeCall;
|
||||
26 | type RuntimeCall = RuntimeCall;
|
||||
| ^^^^^^^^^^^ help: you might have meant to use the associated type: `Self::RuntimeCall`
|
||||
|
||||
error[E0412]: cannot find type `RuntimeEvent` in this scope
|
||||
--> tests/construct_runtime_ui/number_of_pallets_exceeds_tuple_size.rs:33:22
|
||||
--> tests/construct_runtime_ui/number_of_pallets_exceeds_tuple_size.rs:32:22
|
||||
|
|
||||
33 | type RuntimeEvent = RuntimeEvent;
|
||||
32 | type RuntimeEvent = RuntimeEvent;
|
||||
| ^^^^^^^^^^^^ help: you might have meant to use the associated type: `Self::RuntimeEvent`
|
||||
|
||||
error[E0412]: cannot find type `PalletInfo` in this scope
|
||||
--> tests/construct_runtime_ui/number_of_pallets_exceeds_tuple_size.rs:39:20
|
||||
--> tests/construct_runtime_ui/number_of_pallets_exceeds_tuple_size.rs:38:20
|
||||
|
|
||||
39 | type PalletInfo = PalletInfo;
|
||||
38 | type PalletInfo = PalletInfo;
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
help: you might have meant to use the associated type
|
||||
|
|
||||
39 | type PalletInfo = Self::PalletInfo;
|
||||
38 | type PalletInfo = Self::PalletInfo;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
help: consider importing this trait
|
||||
|
|
||||
|
||||
@@ -48,13 +48,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -72,10 +71,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet::{Pallet},
|
||||
|
||||
+9
-9
@@ -1,13 +1,13 @@
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> tests/construct_runtime_ui/pallet_error_too_large.rs:74:1
|
||||
--> tests/construct_runtime_ui/pallet_error_too_large.rs:73:1
|
||||
|
|
||||
74 | / construct_runtime! {
|
||||
75 | | pub struct Runtime where
|
||||
76 | | Block = Block,
|
||||
77 | | NodeBlock = Block,
|
||||
... |
|
||||
82 | | }
|
||||
83 | | }
|
||||
| |_^ the evaluated program panicked at 'The maximum encoded size of the error type in the `Pallet` pallet exceeds `MAX_MODULE_ERROR_ENCODED_SIZE`', $DIR/tests/construct_runtime_ui/pallet_error_too_large.rs:74:1
|
||||
73 | / construct_runtime! {
|
||||
74 | | pub struct Runtime
|
||||
75 | | {
|
||||
76 | | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
77 | | Pallet: pallet::{Pallet},
|
||||
78 | | }
|
||||
79 | | }
|
||||
| |_^ the evaluated program panicked at 'The maximum encoded size of the error type in the `Pallet` pallet exceeds `MAX_MODULE_ERROR_ENCODED_SIZE`', $DIR/tests/construct_runtime_ui/pallet_error_too_large.rs:73:1
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -23,13 +23,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -47,10 +46,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet::{Pallet, Call},
|
||||
|
||||
@@ -4,13 +4,13 @@ error: `Pallet` does not have #[pallet::call] defined, perhaps you should remove
|
||||
5 | #[frame_support::pallet]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
49 | / construct_runtime! {
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
48 | / construct_runtime! {
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet::{Pallet, Call},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `pallet::__substrate_call_check::is_call_part_defined` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -23,13 +23,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -47,10 +46,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet expanded::{}::{Pallet, Event},
|
||||
|
||||
+15
-15
@@ -4,27 +4,27 @@ error: `Pallet` does not have #[pallet::event] defined, perhaps you should remov
|
||||
5 | #[frame_support::pallet]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
49 | / construct_runtime! {
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
48 | / construct_runtime! {
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Event},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `pallet::__substrate_event_check::is_event_part_defined` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0412]: cannot find type `Event` in module `pallet`
|
||||
--> tests/construct_runtime_ui/undefined_event_part.rs:49:1
|
||||
--> tests/construct_runtime_ui/undefined_event_part.rs:48:1
|
||||
|
|
||||
49 | / construct_runtime! {
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
48 | / construct_runtime! {
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Event},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_^ not found in `pallet`
|
||||
|
|
||||
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
+2
-6
@@ -23,13 +23,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -47,10 +46,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet expanded::{}::{Pallet, Config},
|
||||
|
||||
+15
-15
@@ -4,27 +4,27 @@ error: `Pallet` does not have #[pallet::genesis_config] defined, perhaps you sho
|
||||
5 | #[frame_support::pallet]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
49 | / construct_runtime! {
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
48 | / construct_runtime! {
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Config},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `pallet::__substrate_genesis_config_check::is_genesis_config_defined` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0412]: cannot find type `GenesisConfig` in module `pallet`
|
||||
--> tests/construct_runtime_ui/undefined_genesis_config_part.rs:49:1
|
||||
--> tests/construct_runtime_ui/undefined_genesis_config_part.rs:48:1
|
||||
|
|
||||
49 | / construct_runtime! {
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
48 | / construct_runtime! {
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Config},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_^ not found in `pallet`
|
||||
|
|
||||
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -23,13 +23,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -47,10 +46,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet expanded::{}::{Pallet, Inherent},
|
||||
|
||||
+47
-47
@@ -4,31 +4,31 @@ error: `Pallet` does not have #[pallet::inherent] defined, perhaps you should re
|
||||
5 | #[frame_support::pallet]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
49 | / construct_runtime! {
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
48 | / construct_runtime! {
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Inherent},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `pallet::__substrate_inherent_check::is_inherent_part_defined` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: no function or associated item named `create_inherent` found for struct `pallet::Pallet` in the current scope
|
||||
--> tests/construct_runtime_ui/undefined_inherent_part.rs:49:1
|
||||
--> tests/construct_runtime_ui/undefined_inherent_part.rs:48:1
|
||||
|
|
||||
11 | pub struct Pallet<T>(_);
|
||||
| -------------------- function or associated item `create_inherent` not found for this struct
|
||||
...
|
||||
49 | construct_runtime! {
|
||||
48 | construct_runtime! {
|
||||
| _^
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Inherent},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_^ function or associated item not found in `Pallet<Runtime>`
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
@@ -37,19 +37,19 @@ error[E0599]: no function or associated item named `create_inherent` found for s
|
||||
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: no function or associated item named `is_inherent` found for struct `pallet::Pallet` in the current scope
|
||||
--> tests/construct_runtime_ui/undefined_inherent_part.rs:49:1
|
||||
--> tests/construct_runtime_ui/undefined_inherent_part.rs:48:1
|
||||
|
|
||||
11 | pub struct Pallet<T>(_);
|
||||
| -------------------- function or associated item `is_inherent` not found for this struct
|
||||
...
|
||||
49 | construct_runtime! {
|
||||
48 | construct_runtime! {
|
||||
| _^
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Inherent},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_^ function or associated item not found in `Pallet<Runtime>`
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
@@ -58,19 +58,19 @@ error[E0599]: no function or associated item named `is_inherent` found for struc
|
||||
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: no function or associated item named `check_inherent` found for struct `pallet::Pallet` in the current scope
|
||||
--> tests/construct_runtime_ui/undefined_inherent_part.rs:49:1
|
||||
--> tests/construct_runtime_ui/undefined_inherent_part.rs:48:1
|
||||
|
|
||||
11 | pub struct Pallet<T>(_);
|
||||
| -------------------- function or associated item `check_inherent` not found for this struct
|
||||
...
|
||||
49 | construct_runtime! {
|
||||
48 | construct_runtime! {
|
||||
| _^
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Inherent},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_^ function or associated item not found in `Pallet<Runtime>`
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
@@ -79,19 +79,19 @@ error[E0599]: no function or associated item named `check_inherent` found for st
|
||||
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: no associated item named `INHERENT_IDENTIFIER` found for struct `pallet::Pallet` in the current scope
|
||||
--> tests/construct_runtime_ui/undefined_inherent_part.rs:49:1
|
||||
--> tests/construct_runtime_ui/undefined_inherent_part.rs:48:1
|
||||
|
|
||||
11 | pub struct Pallet<T>(_);
|
||||
| -------------------- associated item `INHERENT_IDENTIFIER` not found for this struct
|
||||
...
|
||||
49 | construct_runtime! {
|
||||
48 | construct_runtime! {
|
||||
| _^
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Inherent},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_^ associated item not found in `Pallet<Runtime>`
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
@@ -100,19 +100,19 @@ error[E0599]: no associated item named `INHERENT_IDENTIFIER` found for struct `p
|
||||
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: no function or associated item named `is_inherent_required` found for struct `pallet::Pallet` in the current scope
|
||||
--> tests/construct_runtime_ui/undefined_inherent_part.rs:49:1
|
||||
--> tests/construct_runtime_ui/undefined_inherent_part.rs:48:1
|
||||
|
|
||||
11 | pub struct Pallet<T>(_);
|
||||
| -------------------- function or associated item `is_inherent_required` not found for this struct
|
||||
...
|
||||
49 | construct_runtime! {
|
||||
48 | construct_runtime! {
|
||||
| _^
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Inherent},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_^ function or associated item not found in `Pallet<Runtime>`
|
||||
|
|
||||
= help: items from traits can only be used if the trait is implemented and in scope
|
||||
|
||||
@@ -23,13 +23,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -47,10 +46,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet expanded::{}::{Pallet, Origin},
|
||||
|
||||
+15
-15
@@ -4,27 +4,27 @@ error: `Pallet` does not have #[pallet::origin] defined, perhaps you should remo
|
||||
5 | #[frame_support::pallet]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
49 | / construct_runtime! {
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
48 | / construct_runtime! {
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Origin},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `pallet::__substrate_origin_check::is_origin_part_defined` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0412]: cannot find type `Origin` in module `pallet`
|
||||
--> tests/construct_runtime_ui/undefined_origin_part.rs:49:1
|
||||
--> tests/construct_runtime_ui/undefined_origin_part.rs:48:1
|
||||
|
|
||||
49 | / construct_runtime! {
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
48 | / construct_runtime! {
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet expanded::{}::{Pallet, Origin},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_^ not found in `pallet`
|
||||
|
|
||||
= note: this error originates in the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
+2
-6
@@ -23,13 +23,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -47,10 +46,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet::{Pallet, ValidateUnsigned},
|
||||
|
||||
+29
-31
@@ -4,48 +4,46 @@ error: `Pallet` does not have #[pallet::validate_unsigned] defined, perhaps you
|
||||
5 | #[frame_support::pallet]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
49 | / construct_runtime! {
|
||||
50 | | pub struct Runtime where
|
||||
51 | | Block = Block,
|
||||
52 | | NodeBlock = Block,
|
||||
... |
|
||||
57 | | }
|
||||
58 | | }
|
||||
48 | / construct_runtime! {
|
||||
49 | | pub struct Runtime
|
||||
50 | | {
|
||||
51 | | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | | Pallet: pallet::{Pallet, ValidateUnsigned},
|
||||
53 | | }
|
||||
54 | | }
|
||||
| |_- in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `pallet::__substrate_validate_unsigned_check::is_validate_unsigned_part_defined` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: no variant or associated item named `Pallet` found for enum `RuntimeCall` in the current scope
|
||||
--> tests/construct_runtime_ui/undefined_validate_unsigned_part.rs:56:3
|
||||
--> tests/construct_runtime_ui/undefined_validate_unsigned_part.rs:52:3
|
||||
|
|
||||
49 | // construct_runtime! {
|
||||
50 | || pub struct Runtime where
|
||||
51 | || Block = Block,
|
||||
52 | || NodeBlock = Block,
|
||||
... ||
|
||||
55 | || System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
56 | || Pallet: pallet::{Pallet, ValidateUnsigned},
|
||||
48 | // construct_runtime! {
|
||||
49 | || pub struct Runtime
|
||||
50 | || {
|
||||
51 | || System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | || Pallet: pallet::{Pallet, ValidateUnsigned},
|
||||
| || -^^^^^^ variant or associated item not found in `RuntimeCall`
|
||||
| ||________|
|
||||
| |
|
||||
... |
|
||||
|
||||
error[E0599]: no function or associated item named `pre_dispatch` found for struct `pallet::Pallet` in the current scope
|
||||
--> tests/construct_runtime_ui/undefined_validate_unsigned_part.rs:49:1
|
||||
--> tests/construct_runtime_ui/undefined_validate_unsigned_part.rs:48:1
|
||||
|
|
||||
11 | pub struct Pallet<T>(_);
|
||||
| -------------------- function or associated item `pre_dispatch` not found for this struct
|
||||
...
|
||||
49 | construct_runtime! {
|
||||
48 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
50 | || pub struct Runtime where
|
||||
51 | || Block = Block,
|
||||
52 | || NodeBlock = Block,
|
||||
... ||
|
||||
57 | || }
|
||||
58 | || }
|
||||
49 | || pub struct Runtime
|
||||
50 | || {
|
||||
51 | || System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | || Pallet: pallet::{Pallet, ValidateUnsigned},
|
||||
53 | || }
|
||||
54 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
@@ -56,21 +54,21 @@ error[E0599]: no function or associated item named `pre_dispatch` found for stru
|
||||
= note: this error originates in the macro `frame_support::construct_runtime` which comes from the expansion of the macro `construct_runtime` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0599]: no function or associated item named `validate_unsigned` found for struct `pallet::Pallet` in the current scope
|
||||
--> tests/construct_runtime_ui/undefined_validate_unsigned_part.rs:49:1
|
||||
--> tests/construct_runtime_ui/undefined_validate_unsigned_part.rs:48:1
|
||||
|
|
||||
11 | pub struct Pallet<T>(_);
|
||||
| -------------------- function or associated item `validate_unsigned` not found for this struct
|
||||
...
|
||||
49 | construct_runtime! {
|
||||
48 | construct_runtime! {
|
||||
| __^
|
||||
| | _|
|
||||
| ||
|
||||
50 | || pub struct Runtime where
|
||||
51 | || Block = Block,
|
||||
52 | || NodeBlock = Block,
|
||||
... ||
|
||||
57 | || }
|
||||
58 | || }
|
||||
49 | || pub struct Runtime
|
||||
50 | || {
|
||||
51 | || System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
52 | || Pallet: pallet::{Pallet, ValidateUnsigned},
|
||||
53 | || }
|
||||
54 | || }
|
||||
| ||_- in this macro invocation
|
||||
... |
|
||||
|
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet},
|
||||
#[cfg(feature(test))]
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
error: feature(test)
|
||||
^ expected one of `=`, `,`, `)` here
|
||||
--> tests/construct_runtime_ui/unsupported_meta_structure.rs:10:3
|
||||
|
|
||||
10 | #[cfg(feature(test))]
|
||||
| ^
|
||||
--> tests/construct_runtime_ui/unsupported_meta_structure.rs:7:3
|
||||
|
|
||||
7 | #[cfg(feature(test))]
|
||||
| ^
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet},
|
||||
#[attr]
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
error: Unsupported attribute, only #[cfg] is supported on pallet declarations in `construct_runtime`
|
||||
--> tests/construct_runtime_ui/unsupported_pallet_attr.rs:10:3
|
||||
|
|
||||
10 | #[attr]
|
||||
| ^
|
||||
--> tests/construct_runtime_ui/unsupported_pallet_attr.rs:7:3
|
||||
|
|
||||
7 | #[attr]
|
||||
| ^
|
||||
|
||||
@@ -25,12 +25,9 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Sign
|
||||
impl pallet::Config for Runtime {}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet use_parts { Call },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
error: Invalid pallet part specified, the pallet `Pallet` doesn't have the `Call` part. Available parts are: `Pallet`, `Storage`.
|
||||
--> tests/construct_runtime_ui/use_undefined_part.rs:34:30
|
||||
--> tests/construct_runtime_ui/use_undefined_part.rs:31:30
|
||||
|
|
||||
34 | Pallet: pallet use_parts { Call },
|
||||
31 | Pallet: pallet use_parts { Call },
|
||||
| ^^^^
|
||||
|
||||
error[E0412]: cannot find type `RuntimeCall` in this scope
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
// limitations under the License.
|
||||
|
||||
use codec::Encode;
|
||||
use frame_support::{storage::unhashed, StoragePrefixedMap};
|
||||
use sp_core::sr25519;
|
||||
use frame_support::{derive_impl, storage::unhashed, StoragePrefixedMap};
|
||||
use frame_system::pallet_prelude::BlockNumberFor;
|
||||
|
||||
use sp_core::{sr25519, ConstU32};
|
||||
use sp_io::{
|
||||
hashing::{blake2_128, twox_128, twox_64},
|
||||
TestExternalities,
|
||||
@@ -31,7 +33,6 @@ use sp_runtime::{
|
||||
mod no_instance {
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
@@ -59,7 +60,7 @@ mod no_instance {
|
||||
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn test_generic_value)]
|
||||
pub type TestGenericValue<T: Config> = StorageValue<_, T::BlockNumber, OptionQuery>;
|
||||
pub type TestGenericValue<T: Config> = StorageValue<_, BlockNumberFor<T>, OptionQuery>;
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn foo2)]
|
||||
pub type TestGenericDoubleMap<T: Config> = StorageDoubleMap<
|
||||
@@ -67,7 +68,7 @@ mod no_instance {
|
||||
Blake2_128Concat,
|
||||
u32,
|
||||
Blake2_128Concat,
|
||||
T::BlockNumber,
|
||||
BlockNumberFor<T>,
|
||||
u32,
|
||||
ValueQuery,
|
||||
>;
|
||||
@@ -75,8 +76,8 @@ mod no_instance {
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub value: u32,
|
||||
pub test_generic_value: T::BlockNumber,
|
||||
pub test_generic_double_map: Vec<(u32, T::BlockNumber, u32)>,
|
||||
pub test_generic_value: BlockNumberFor<T>,
|
||||
pub test_generic_double_map: Vec<(u32, BlockNumberFor<T>, u32)>,
|
||||
}
|
||||
|
||||
impl<T: Config> Default for GenesisConfig<T> {
|
||||
@@ -105,7 +106,6 @@ mod no_instance {
|
||||
mod instance {
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
|
||||
@@ -136,7 +136,7 @@ mod instance {
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn test_generic_value)]
|
||||
pub type TestGenericValue<T: Config<I>, I: 'static = ()> =
|
||||
StorageValue<_, T::BlockNumber, OptionQuery>;
|
||||
StorageValue<_, BlockNumberFor<T>, OptionQuery>;
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn foo2)]
|
||||
pub type TestGenericDoubleMap<T: Config<I>, I: 'static = ()> = StorageDoubleMap<
|
||||
@@ -144,7 +144,7 @@ mod instance {
|
||||
Blake2_128Concat,
|
||||
u32,
|
||||
Blake2_128Concat,
|
||||
T::BlockNumber,
|
||||
BlockNumberFor<T>,
|
||||
u32,
|
||||
ValueQuery,
|
||||
>;
|
||||
@@ -152,8 +152,8 @@ mod instance {
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
pub value: u32,
|
||||
pub test_generic_value: T::BlockNumber,
|
||||
pub test_generic_double_map: Vec<(u32, T::BlockNumber, u32)>,
|
||||
pub test_generic_value: BlockNumberFor<T>,
|
||||
pub test_generic_double_map: Vec<(u32, BlockNumberFor<T>, u32)>,
|
||||
pub phantom: PhantomData<I>,
|
||||
}
|
||||
|
||||
@@ -201,27 +201,25 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Runtime
|
||||
where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
|
||||
{
|
||||
System: frame_support_test,
|
||||
System: frame_system,
|
||||
FinalKeysNone: no_instance,
|
||||
FinalKeysSome: instance,
|
||||
Instance2FinalKeysSome: instance::<Instance2>,
|
||||
}
|
||||
);
|
||||
|
||||
impl frame_support_test::Config for Runtime {
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type Block = Block;
|
||||
type BlockHashCount = ConstU32<10>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type DbWeight = ();
|
||||
type OnSetCode = ();
|
||||
}
|
||||
|
||||
impl no_instance::Config for Runtime {}
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use sp_core::sr25519;
|
||||
use frame_support::derive_impl;
|
||||
use frame_system::pallet_prelude::BlockNumberFor;
|
||||
use sp_core::{sr25519, ConstU32};
|
||||
use sp_runtime::{
|
||||
generic,
|
||||
traits::{BlakeTwo256, Verify},
|
||||
@@ -25,7 +27,6 @@ use sp_runtime::{
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
@@ -39,11 +40,11 @@ pub mod pallet {
|
||||
#[pallet::storage]
|
||||
#[pallet::unbounded]
|
||||
pub type AppendableDM<T: Config> =
|
||||
StorageDoubleMap<_, Identity, u32, Identity, T::BlockNumber, Vec<u32>>;
|
||||
StorageDoubleMap<_, Identity, u32, Identity, BlockNumberFor<T>, Vec<u32>>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub t: Vec<(u32, T::BlockNumber, Vec<u32>)>,
|
||||
pub t: Vec<(u32, BlockNumberFor<T>, Vec<u32>)>,
|
||||
}
|
||||
|
||||
impl<T: Config> Default for GenesisConfig<T> {
|
||||
@@ -71,25 +72,23 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Test
|
||||
where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
|
||||
{
|
||||
System: frame_support_test,
|
||||
System: frame_system,
|
||||
MyPallet: pallet,
|
||||
}
|
||||
);
|
||||
|
||||
impl frame_support_test::Config for Test {
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type Block = Block;
|
||||
type BlockHashCount = ConstU32<10>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type DbWeight = ();
|
||||
type OnSetCode = ();
|
||||
}
|
||||
|
||||
impl pallet::Config for Test {}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#![recursion_limit = "128"]
|
||||
|
||||
use frame_support::{
|
||||
derive_impl,
|
||||
inherent::{InherentData, InherentIdentifier, MakeFatalError, ProvideInherent},
|
||||
metadata_ir::{
|
||||
PalletStorageMetadataIR, StorageEntryMetadataIR, StorageEntryModifierIR,
|
||||
@@ -25,6 +26,7 @@ use frame_support::{
|
||||
},
|
||||
traits::ConstU32,
|
||||
};
|
||||
use frame_system::pallet_prelude::BlockNumberFor;
|
||||
use sp_core::sr25519;
|
||||
use sp_runtime::{
|
||||
generic,
|
||||
@@ -39,10 +41,9 @@ pub trait Currency {}
|
||||
// * Origin, Inherent, Event
|
||||
#[frame_support::pallet(dev_mode)]
|
||||
mod module1 {
|
||||
use self::frame_system::pallet_prelude::*;
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(_);
|
||||
@@ -77,7 +78,7 @@ mod module1 {
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
pub value: <T as Config<I>>::GenericType,
|
||||
pub test: <T as frame_system::Config>::BlockNumber,
|
||||
pub test: BlockNumberFor<T>,
|
||||
}
|
||||
|
||||
impl<T: Config<I>, I: 'static> Default for GenesisConfig<T, I> {
|
||||
@@ -89,7 +90,7 @@ mod module1 {
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I>
|
||||
where
|
||||
T::BlockNumber: std::fmt::Display,
|
||||
BlockNumberFor<T>: std::fmt::Display,
|
||||
{
|
||||
fn build(&self) {
|
||||
<Value<T, I>>::put(self.value.clone());
|
||||
@@ -123,7 +124,7 @@ mod module1 {
|
||||
#[pallet::inherent]
|
||||
impl<T: Config<I>, I: 'static> ProvideInherent for Pallet<T, I>
|
||||
where
|
||||
T::BlockNumber: From<u32>,
|
||||
BlockNumberFor<T>: From<u32>,
|
||||
{
|
||||
type Call = Call<T, I>;
|
||||
type Error = MakeFatalError<()>;
|
||||
@@ -150,7 +151,6 @@ mod module1 {
|
||||
mod module2 {
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
|
||||
@@ -198,7 +198,7 @@ mod module2 {
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I>
|
||||
where
|
||||
T::BlockNumber: std::fmt::Display,
|
||||
BlockNumberFor<T>: std::fmt::Display,
|
||||
{
|
||||
fn build(&self) {
|
||||
<Value<T, I>>::put(self.value.clone());
|
||||
@@ -252,7 +252,6 @@ mod module2 {
|
||||
mod module3 {
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
|
||||
@@ -277,12 +276,9 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Sign
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub enum Runtime
|
||||
{
|
||||
System: frame_support_test::{Pallet, Call, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Event<T>},
|
||||
Module1_1: module1::<Instance1>::{
|
||||
Pallet, Call, Storage, Event<T>, Config<T>, Origin<T>, Inherent
|
||||
},
|
||||
@@ -303,15 +299,16 @@ frame_support::construct_runtime!(
|
||||
}
|
||||
);
|
||||
|
||||
impl frame_support_test::Config for Runtime {
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type Block = Block;
|
||||
type BlockHashCount = ConstU32<10>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type DbWeight = ();
|
||||
type OnSetCode = ();
|
||||
}
|
||||
|
||||
impl module1::Config<module1::Instance1> for Runtime {
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use frame_support::derive_impl;
|
||||
use frame_system::pallet_prelude::BlockNumberFor;
|
||||
use sp_core::{sr25519, ConstU64};
|
||||
use sp_runtime::{
|
||||
generic,
|
||||
@@ -25,10 +27,8 @@ use sp_runtime::{
|
||||
mod module {
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
|
||||
pub type Request<T> =
|
||||
(<T as frame_system::Config>::AccountId, Role, <T as frame_system::Config>::BlockNumber);
|
||||
pub type Request<T> = (<T as frame_system::Config>::AccountId, Role, BlockNumberFor<T>);
|
||||
pub type Requests<T> = Vec<Request<T>>;
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
|
||||
@@ -46,35 +46,35 @@ mod module {
|
||||
pub max_actors: u32,
|
||||
|
||||
// payouts are made at this block interval
|
||||
pub reward_period: T::BlockNumber,
|
||||
pub reward_period: BlockNumberFor<T>,
|
||||
|
||||
// minimum amount of time before being able to unstake
|
||||
pub bonding_period: T::BlockNumber,
|
||||
pub bonding_period: BlockNumberFor<T>,
|
||||
|
||||
// how long tokens remain locked for after unstaking
|
||||
pub unbonding_period: T::BlockNumber,
|
||||
pub unbonding_period: BlockNumberFor<T>,
|
||||
|
||||
// minimum period required to be in service. unbonding before this time is highly penalized
|
||||
pub min_service_period: T::BlockNumber,
|
||||
pub min_service_period: BlockNumberFor<T>,
|
||||
|
||||
// "startup" time allowed for roles that need to sync their infrastructure
|
||||
// with other providers before they are considered in service and punishable for
|
||||
// not delivering required level of service.
|
||||
pub startup_grace_period: T::BlockNumber,
|
||||
pub startup_grace_period: BlockNumberFor<T>,
|
||||
}
|
||||
|
||||
impl<T: Config> Default for RoleParameters<T> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
max_actors: 10,
|
||||
reward_period: T::BlockNumber::default(),
|
||||
unbonding_period: T::BlockNumber::default(),
|
||||
reward_period: BlockNumberFor::<T>::default(),
|
||||
unbonding_period: BlockNumberFor::<T>::default(),
|
||||
|
||||
// not currently used
|
||||
min_actors: 5,
|
||||
bonding_period: T::BlockNumber::default(),
|
||||
min_service_period: T::BlockNumber::default(),
|
||||
startup_grace_period: T::BlockNumber::default(),
|
||||
bonding_period: BlockNumberFor::<T>::default(),
|
||||
min_service_period: BlockNumberFor::<T>::default(),
|
||||
startup_grace_period: BlockNumberFor::<T>::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ mod module {
|
||||
/// tokens locked until given block number
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn bondage)]
|
||||
pub type Bondage<T: Config> = StorageMap<_, Blake2_128Concat, T::AccountId, T::BlockNumber>;
|
||||
pub type Bondage<T: Config> = StorageMap<_, Blake2_128Concat, T::AccountId, BlockNumberFor<T>>;
|
||||
|
||||
/// First step before enter a role is registering intent with a new account/key.
|
||||
/// This is done by sending a role_entry_request() from the new account.
|
||||
@@ -161,27 +161,23 @@ pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
impl frame_support_test::Config for Runtime {
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type Block = Block;
|
||||
type BlockHashCount = ConstU64<10>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type DbWeight = ();
|
||||
type OnSetCode = ();
|
||||
}
|
||||
|
||||
impl module::Config for Runtime {}
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime
|
||||
where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_support_test,
|
||||
pub struct Runtime {
|
||||
System: frame_system,
|
||||
Module: module,
|
||||
}
|
||||
);
|
||||
@@ -189,6 +185,7 @@ frame_support::construct_runtime!(
|
||||
#[test]
|
||||
fn create_genesis_config() {
|
||||
let config = RuntimeGenesisConfig {
|
||||
system: Default::default(),
|
||||
module: module::GenesisConfig {
|
||||
request_life_time: 0,
|
||||
enable_storage_role: true,
|
||||
|
||||
@@ -19,15 +19,18 @@
|
||||
|
||||
#![recursion_limit = "128"]
|
||||
|
||||
use frame_support::traits::{Contains, OriginTrait};
|
||||
use frame_support::{
|
||||
derive_impl,
|
||||
traits::{Contains, OriginTrait},
|
||||
};
|
||||
use sp_core::ConstU32;
|
||||
use sp_runtime::{generic, traits::BlakeTwo256};
|
||||
|
||||
mod nested {
|
||||
#[frame_support::pallet(dev_mode)]
|
||||
pub mod module {
|
||||
use self::frame_system::pallet_prelude::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
@@ -75,9 +78,8 @@ mod nested {
|
||||
|
||||
#[frame_support::pallet(dev_mode)]
|
||||
pub mod module {
|
||||
use self::frame_system::pallet_prelude::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
pub struct Pallet<T>(_);
|
||||
@@ -160,26 +162,24 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, (),
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum RuntimeOriginTest where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub enum RuntimeOriginTest
|
||||
{
|
||||
System: frame_support_test,
|
||||
System: frame_system,
|
||||
NestedModule: nested::module,
|
||||
Module: module,
|
||||
}
|
||||
);
|
||||
|
||||
impl frame_support_test::Config for RuntimeOriginTest {
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for RuntimeOriginTest {
|
||||
type BaseCallFilter = BaseCallFilter;
|
||||
type Block = Block;
|
||||
type BlockHashCount = ConstU32<10>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type DbWeight = ();
|
||||
type OnSetCode = ();
|
||||
}
|
||||
|
||||
impl nested::module::Config for RuntimeOriginTest {
|
||||
|
||||
@@ -657,13 +657,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -709,10 +708,7 @@ pub type UncheckedExtrinsic =
|
||||
sp_runtime::testing::TestXt<RuntimeCall, frame_system::CheckNonZeroSender<Runtime>>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
// Exclude part `Storage` in order not to check its metadata in tests.
|
||||
System: frame_system exclude_parts { Pallet, Storage },
|
||||
|
||||
@@ -292,13 +292,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -336,10 +335,7 @@ pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, (), ()>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
// Exclude part `Storage` in order not to check its metadata in tests.
|
||||
System: frame_system exclude_parts { Storage },
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use frame_support::traits::ConstU32;
|
||||
use frame_support::{derive_impl, traits::ConstU32};
|
||||
|
||||
mod common;
|
||||
|
||||
@@ -25,31 +25,16 @@ pub type Header = sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo2
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, (), ()>;
|
||||
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type Block = Block;
|
||||
type BlockHashCount = ConstU32<10>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
type AccountData = ();
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
|
||||
impl common::outer_enums::pallet::Config for Runtime {
|
||||
@@ -72,10 +57,7 @@ impl common::outer_enums::pallet3::Config<common::outer_enums::pallet::Instance1
|
||||
}
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
// Exclude part `Storage` in order not to check its metadata in tests.
|
||||
System: frame_system::{Pallet, Config<T>, Call, Event<T> },
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use frame_support::traits::ConstU32;
|
||||
use frame_support::{derive_impl, traits::ConstU32};
|
||||
|
||||
mod common;
|
||||
|
||||
@@ -25,31 +25,16 @@ pub type Header = sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo2
|
||||
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, (), ()>;
|
||||
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type Block = Block;
|
||||
type BlockHashCount = ConstU32<10>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
type AccountData = ();
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
|
||||
impl common::outer_enums::pallet::Config for Runtime {
|
||||
@@ -72,10 +57,7 @@ impl common::outer_enums::pallet3::Config<common::outer_enums::pallet::Instance1
|
||||
}
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
// Exclude part `Storage` in order not to check its metadata in tests.
|
||||
System: frame_system exclude_parts { Storage },
|
||||
|
||||
@@ -61,13 +61,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -89,10 +88,7 @@ pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
|
||||
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<u32, RuntimeCall, (), ()>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
// Exclude part `Storage` in order not to check its metadata in tests.
|
||||
System: frame_system exclude_parts { Pallet, Storage },
|
||||
|
||||
@@ -14,13 +14,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = frame_support::traits::ConstU32<250>;
|
||||
type BlockWeights = ();
|
||||
@@ -38,10 +37,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub struct Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub struct Runtime
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: test_pallet::{Pallet, Config<T>},
|
||||
|
||||
@@ -37,13 +37,12 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u32;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type Version = ();
|
||||
@@ -58,10 +57,7 @@ impl frame_system::Config for Runtime {
|
||||
}
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
pub enum Runtime
|
||||
{
|
||||
System: frame_system,
|
||||
}
|
||||
|
||||
@@ -71,12 +71,11 @@ impl frame_system::Config for Runtime {
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = Index;
|
||||
type BlockNumber = BlockNumber;
|
||||
type Hash = sp_runtime::testing::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = AccountId;
|
||||
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Block = Block;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type DbWeight = ();
|
||||
@@ -94,12 +93,7 @@ impl frame_system::Config for Runtime {
|
||||
impl Config for Runtime {}
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub struct Runtime
|
||||
where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
pub struct Runtime {
|
||||
System: frame_system,
|
||||
MyPallet: pallet,
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
#![allow(deprecated)]
|
||||
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, assert_storage_noop,
|
||||
assert_noop, assert_ok, assert_storage_noop, derive_impl,
|
||||
dispatch::DispatchResult,
|
||||
storage::{with_transaction, TransactionOutcome::*},
|
||||
transactional,
|
||||
};
|
||||
use sp_core::sr25519;
|
||||
use sp_core::{sr25519, ConstU32};
|
||||
use sp_io::TestExternalities;
|
||||
use sp_runtime::{
|
||||
generic,
|
||||
@@ -36,10 +36,9 @@ pub use self::pallet::*;
|
||||
|
||||
#[frame_support::pallet]
|
||||
pub mod pallet {
|
||||
use self::frame_system::pallet_prelude::*;
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_support_test as frame_system;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::generate_store(pub (super) trait Store)]
|
||||
@@ -82,25 +81,23 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Runtime
|
||||
where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
|
||||
{
|
||||
System: frame_support_test,
|
||||
System: frame_system,
|
||||
MyPallet: pallet,
|
||||
}
|
||||
);
|
||||
|
||||
impl frame_support_test::Config for Runtime {
|
||||
type BlockNumber = BlockNumber;
|
||||
type AccountId = AccountId;
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type Block = Block;
|
||||
type BlockHashCount = ConstU32<10>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type DbWeight = ();
|
||||
type OnSetCode = ();
|
||||
}
|
||||
|
||||
impl Config for Runtime {}
|
||||
|
||||
@@ -27,9 +27,9 @@ use frame_support::{
|
||||
weights::constants::RocksDbWeight,
|
||||
};
|
||||
use frame_system::Config;
|
||||
use sp_core::ConstU64;
|
||||
use sp_runtime::BuildStorage;
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
|
||||
#[frame_support::pallet]
|
||||
@@ -64,10 +64,7 @@ mod dummy_pallet {
|
||||
impl dummy_pallet::Config for Test {}
|
||||
|
||||
construct_runtime!(
|
||||
pub enum Test where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
pub enum Test
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||
DummyPallet: dummy_pallet::{Pallet, Config<T>, Storage} = 1,
|
||||
@@ -77,6 +74,8 @@ construct_runtime!(
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type Block = Block;
|
||||
type BlockHashCount = ConstU64<10>;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
|
||||
Reference in New Issue
Block a user