chore: regenerate umbrella crate, fix feature propagation

This commit is contained in:
2025-12-16 11:28:32 +03:00
parent dd6d48f528
commit 620b0e3aa0
1358 changed files with 9464 additions and 7656 deletions
@@ -25,7 +25,6 @@ use core::{fmt, marker::PhantomData};
use codec::{Decode, DecodeWithMemTracking, Encode};
use pezframe_support::{pezpallet_prelude::TransactionSource, traits::OriginTrait, Parameter};
use scale_info::TypeInfo;
use pezsp_runtime::{
impl_tx_ext_default,
traits::{
@@ -34,6 +33,7 @@ use pezsp_runtime::{
},
transaction_validity::{InvalidTransaction, ValidTransaction},
};
use scale_info::TypeInfo;
use crate::pezpallet_coownership::{Config, Origin};
@@ -30,20 +30,22 @@
//!
//! The [TransactionExtension](pezsp_runtime::traits::TransactionExtension) used in this example is
//! [AuthorizeCoownership](extensions::AuthorizeCoownership). If activated, the extension will
//! authorize 2 signers as coowners, with a [coowner origin](pezpallet_coownership::Origin) specific to
//! the [coownership example pezpallet](pezpallet_coownership), by validating a signature of the rest of
//! the transaction from each party. This means any extensions after ours in the pipeline, their
//! implicits and the actual call. The extension pipeline used in our example checks the genesis
//! hash, transaction version and mortality of the transaction after the `AuthorizeCoownership` runs
//! as we want these transactions to run regardless of what origin passes through them and/or we
//! want their implicit data in any signature authorization happening earlier in the pipeline.
//! authorize 2 signers as coowners, with a [coowner origin](pezpallet_coownership::Origin) specific
//! to the [coownership example pezpallet](pezpallet_coownership), by validating a signature of the
//! rest of the transaction from each party. This means any extensions after ours in the pipeline,
//! their implicits and the actual call. The extension pipeline used in our example checks the
//! genesis hash, transaction version and mortality of the transaction after the
//! `AuthorizeCoownership` runs as we want these transactions to run regardless of what origin
//! passes through them and/or we want their implicit data in any signature authorization happening
//! earlier in the pipeline.
//!
//! In this example, aside from the [AuthorizeCoownership](extensions::AuthorizeCoownership)
//! extension, we use the following pallets:
//! - [pezpallet_coownership] - provides a coowner origin and the functionality to authorize it.
//! - [pezpallet_assets] - a dummy asset pezpallet that tracks assets, identified by an
//! [AssetId](pezpallet_assets::AssetId), and their respective owners, which can be either an
//! [account](pezpallet_assets::Owner::Single) or a [pair of owners](pezpallet_assets::Owner::Double).
//! [account](pezpallet_assets::Owner::Single) or a [pair of
//! owners](pezpallet_assets::Owner::Double).
//!
//! Assets are created in [pezpallet_assets] using the
//! [create_asset](pezpallet_assets::Call::create_asset) call, which accepts traditionally signed
@@ -56,9 +58,9 @@
//! ### Example usage
#![doc = docify::embed!("src/tests.rs", create_coowned_asset_works)]
//!
//! This example does not focus on any pezpallet logic or syntax, but rather on `TransactionExtension`
//! functionality. The pallets used are just skeletons to provide storage state and custom origin
//! choices and requirements, as shown in the examples. Any weight and/or
//! This example does not focus on any pezpallet logic or syntax, but rather on
//! `TransactionExtension` functionality. The pallets used are just skeletons to provide storage
//! state and custom origin choices and requirements, as shown in the examples. Any weight and/or
//! transaction fee is out of scope for this example.
#![cfg_attr(not(feature = "std"), no_std)]
@@ -44,8 +44,8 @@ mod example_runtime {
VerifySignature<Runtime>,
// Nonce check (and increment) for the caller.
CheckNonce<Runtime>,
// If activated, will mutate the origin to a `pezpallet_coownership` origin of 2 accounts that
// own something.
// If activated, will mutate the origin to a `pezpallet_coownership` origin of 2 accounts
// that own something.
AuthorizeCoownership<Runtime, MultiSigner, MultiSignature>,
// Some other extensions that we want to run for every possible origin and we want captured
// in any and all signature and authorization schemes (such as the traditional account
@@ -92,7 +92,10 @@ fn create_asset_works() {
let res = xt.apply::<Runtime>(&uxt_info, uxt_len).unwrap();
// Asserting the results.
assert_eq!(pezframe_system::Account::<Runtime>::get(&alice_account).nonce, initial_nonce + 1);
assert_eq!(
pezframe_system::Account::<Runtime>::get(&alice_account).nonce,
initial_nonce + 1
);
assert_eq!(
pezpallet_assets::AssetOwners::<Runtime>::get(42),
Some(pezpallet_assets::Owner::<AccountId>::Single(alice_account))
@@ -184,7 +187,10 @@ fn create_coowned_asset_works() {
// Asserting the results.
assert!(res.is_ok());
assert_eq!(pezframe_system::Account::<Runtime>::get(charlie_account).nonce, initial_nonce + 1);
assert_eq!(
pezframe_system::Account::<Runtime>::get(charlie_account).nonce,
initial_nonce + 1
);
assert_eq!(
pezpallet_assets::AssetOwners::<Runtime>::get(42),
Some(pezpallet_assets::Owner::<AccountId>::Double(alice_account, bob_account))
+14 -14
View File
@@ -65,6 +65,7 @@ extern crate alloc;
use alloc::vec::Vec;
use codec::{Decode, DecodeWithMemTracking, Encode};
use core::marker::PhantomData;
use log::info;
use pezframe_support::{
dispatch::{ClassifyDispatch, DispatchClass, DispatchResult, Pays, PaysFee, WeighData},
pezpallet_prelude::TransactionSource,
@@ -72,8 +73,6 @@ use pezframe_support::{
weights::Weight,
};
use pezframe_system::ensure_signed;
use log::info;
use scale_info::TypeInfo;
use pezsp_runtime::{
impl_tx_ext_default,
traits::{
@@ -82,6 +81,7 @@ use pezsp_runtime::{
},
transaction_validity::{InvalidTransaction, ValidTransaction},
};
use scale_info::TypeInfo;
// Re-export pezpallet items so that they can be accessed from the crate namespace.
pub use pezpallet::*;
@@ -103,8 +103,8 @@ const MILLICENTS: u32 = 1_000_000_000;
// The `WeightData<T>` trait has access to the arguments of the dispatch that it wants to assign a
// weight to. Nonetheless, the trait itself cannot make any assumptions about what the generic type
// of the arguments (`T`) is. Based on our needs, we could replace `T` with a more concrete type
// while implementing the trait. The `pezpallet::weight` expects whatever implements `WeighData<T>` to
// replace `T` with a tuple of the dispatch arguments. This is exactly how we will craft the
// while implementing the trait. The `pezpallet::weight` expects whatever implements `WeighData<T>`
// to replace `T` with a tuple of the dispatch arguments. This is exactly how we will craft the
// implementation below.
//
// The rules of `WeightForSetDummy` are as follows:
@@ -173,8 +173,8 @@ pub mod pezpallet {
#[pezpallet::pezpallet]
pub struct Pezpallet<T>(_);
// This pezpallet implements the [`pezframe_support::traits::Hooks`] trait to define some logic to
// execute in some context.
// This pezpallet implements the [`pezframe_support::traits::Hooks`] trait to define some logic
// to execute in some context.
#[pezpallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
// `on_initialize` is executed at the beginning of the block before any extrinsic are
@@ -275,9 +275,9 @@ pub mod pezpallet {
// If you don't respect these rules, it is likely that your chain will be attackable.
//
// Each transaction must define a `#[pezpallet::weight(..)]` attribute to convey a set of
// static information about its dispatch. FRAME System and FRAME Executive pezpallet then use
// this information to properly execute the transaction, whilst keeping the total load of
// the chain in a moderate rate.
// static information about its dispatch. FRAME System and FRAME Executive pezpallet then
// use this information to properly execute the transaction, whilst keeping the total load
// of the chain in a moderate rate.
//
// The parenthesized value of the `#[pezpallet::weight(..)]` attribute can be any type that
// implements a set of traits, namely [`WeighData`], [`ClassifyDispatch`], and
@@ -447,11 +447,11 @@ impl<T: Config> Pezpallet<T> {
}
}
// Similar to other FRAME pallets, your pezpallet can also define a transaction extension and perform
// some checks and [pre/post]processing [before/after] the transaction. A transaction extension can
// be any decodable type that implements `TransactionExtension`. See the trait definition for the
// full list of bounds. As a convention, you can follow this approach to create an extension for
// your pezpallet:
// Similar to other FRAME pallets, your pezpallet can also define a transaction extension and
// perform some checks and [pre/post]processing [before/after] the transaction. A transaction
// extension can be any decodable type that implements `TransactionExtension`. See the trait
// definition for the full list of bounds. As a convention, you can follow this approach to create
// an extension for your pezpallet:
// - If the extension does not carry any data, then use a tuple struct with just a `marker`
// (needed for the compiler to accept `T: Config`) will suffice.
// - Otherwise, create a tuple struct which contains the external data. Of course, for the entire
@@ -23,9 +23,9 @@
//! # Default Config Pezpallet Example
//!
//! A simple example of a FRAME pezpallet that utilizes [`pezframe_support::derive_impl`] to demonstrate
//! the simpler way to implement `Config` trait of pallets. This example only showcases this in a
//! `mock.rs` environment, but the same applies to a real runtime as well.
//! A simple example of a FRAME pezpallet that utilizes [`pezframe_support::derive_impl`] to
//! demonstrate the simpler way to implement `Config` trait of pallets. This example only showcases
//! this in a `mock.rs` environment, but the same applies to a real runtime as well.
//!
//! See the source code of [`tests`] for a real examples.
//!
@@ -63,8 +63,8 @@ pub mod pezpallet {
/// in our tests below.
type OverwrittenDefaultValue: Get<u32>;
/// An input parameter that relies on `<Self as pezframe_system::Config>::AccountId`. This can
/// too have a default, as long as it is present in `pezframe_system::DefaultConfig`.
/// An input parameter that relies on `<Self as pezframe_system::Config>::AccountId`. This
/// can too have a default, as long as it is present in `pezframe_system::DefaultConfig`.
type CanDeriveDefaultFromSystem: Get<Self::AccountId>;
/// We might choose to declare as one that doesn't have a default, for whatever semantical
@@ -110,8 +110,8 @@ pub mod pezpallet {
type OverwrittenDefaultType = u32;
}
/// A type providing default configurations for this pezpallet in another environment. Examples
/// could be a teyrchain, or a solochain.
/// A type providing default configurations for this pezpallet in another environment.
/// Examples could be a teyrchain, or a solochain.
///
/// Appropriate derive for `pezframe_system::DefaultConfig` needs to be provided. In this
/// example, we simple derive `pezframe_system::config_preludes::TestDefaultConfig` again.
@@ -34,8 +34,8 @@ use pezframe_benchmarking::v2::*;
use pezframe_support::pezpallet_prelude::TransactionSource;
use pezframe_system::RawOrigin;
// To actually run this benchmark on pezpallet-example-kitchensink, we need to put this pezpallet into the
// runtime and compile it with `runtime-benchmarks` feature. The detail procedures are
// To actually run this benchmark on pezpallet-example-kitchensink, we need to put this pezpallet
// into the runtime and compile it with `runtime-benchmarks` feature. The detail procedures are
// documented at:
// https://docs.pezkuwichain.io/reference/how-to-guides/weights/add-benchmarks/
//
@@ -98,8 +98,8 @@ mod benchmarks {
}
// This line generates test cases for benchmarking, and could be run by:
// `cargo test -p pezpallet-example-kitchensink --all-features`, you will see one line per case:
// `test benchmarking::bench_set_foo_benchmark ... ok`
// `cargo test -p pezpallet-example-kitchensink --all-features`, you will see one line per
// case: `test benchmarking::bench_set_foo_benchmark ... ok`
// `test benchmarking::bench_set_foo_using_authorize_benchmark ... ok` in the result.
// `test benchmarking::bench_authorize_set_foo_using_authorize_benchmark ... ok` in the
// result.
@@ -27,9 +27,9 @@
//!
//! The kitchen-sink catalog of the the FRAME macros and their various syntax options.
//!
//! This example does not focus on pezpallet instancing, `dev_mode`, and does nto include any 'where'
//! clauses on `T`. These will both incur additional complexity to the syntax, but are not discussed
//! here.
//! This example does not focus on pezpallet instancing, `dev_mode`, and does nto include any
//! 'where' clauses on `T`. These will both incur additional complexity to the syntax, but are not
//! discussed here.
#![cfg_attr(not(feature = "std"), no_std)]
@@ -56,18 +56,19 @@ pub mod pezpallet {
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
/// The config trait of the pezpallet. You can basically do anything with the config trait that you
/// can do with a normal rust trait: import items consisting of types, constants and functions.
/// The config trait of the pezpallet. You can basically do anything with the config trait that
/// you can do with a normal rust trait: import items consisting of types, constants and
/// functions.
///
/// A very common pattern is for a pezpallet to import implementations of traits such as
/// [`pezframe_support::traits::Currency`], [`pezframe_support::traits::fungibles::Inspect`] and
/// [`pezframe_support::traits::Get`]. These are all types that the pezpallet is delegating to the top
/// level runtime to provide to it.
/// [`pezframe_support::traits::Get`]. These are all types that the pezpallet is delegating to
/// the top level runtime to provide to it.
///
/// The `FRAME`-specific syntax are:
///
/// * the use of `#[pezpallet::constant]`([`pezframe_support::procedural`]), which places a `Get`
/// implementation in the metadata.
/// * the use of `#[pezpallet::constant]`([`pezframe_support::procedural`]), which places a
/// `Get` implementation in the metadata.
/// * `type RuntimeEvent`, which is mandatory if your pezpallet has events. See TODO.
/// * Needless to say, because [`Config`] is bounded by [`pezframe_system::Config`], you can use
/// all the items from [`pezframe_system::Config`] as well, such as `AccountId`.
@@ -109,8 +110,8 @@ pub mod pezpallet {
const STORAGE_VERSION: pezframe_support::traits::StorageVersion = StorageVersion::new(1);
/// The pezpallet struct. There's nothing special to FRAME about this; it can implement functions
/// in an impl blocks, traits and so on.
/// The pezpallet struct. There's nothing special to FRAME about this; it can implement
/// functions in an impl blocks, traits and so on.
#[pezpallet::pezpallet]
#[pezpallet::without_storage_info]
#[pezpallet::storage_version(STORAGE_VERSION)]
@@ -262,9 +263,9 @@ pub mod pezpallet {
/// the variants actually use `<T: Config>`, the macro will generate a hidden `PhantomData`
/// variant.
///
/// The `generate_deposit` macro generates a function on `Pezpallet` called `deposit_event` which
/// will properly convert the error type of your pezpallet into `RuntimeEvent` (recall `type
/// RuntimeEvent: From<Event<Self>>`, so it can be converted) and deposit it via
/// The `generate_deposit` macro generates a function on `Pezpallet` called `deposit_event`
/// which will properly convert the error type of your pezpallet into `RuntimeEvent` (recall
/// `type RuntimeEvent: From<Event<Self>>`, so it can be converted) and deposit it via
/// `pezframe_system::Pezpallet::deposit_event`.
#[pezpallet::event]
#[pezpallet::generate_deposit(pub fn deposit_event)]
@@ -285,8 +286,8 @@ pub mod pezpallet {
SomethingBroke,
}
/// All the possible hooks that a pezpallet can have. See [`pezframe_support::traits::Hooks`] for more
/// info.
/// All the possible hooks that a pezpallet can have. See [`pezframe_support::traits::Hooks`]
/// for more info.
#[pezpallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
fn integrity_test() {}
@@ -327,15 +328,15 @@ pub mod pezpallet {
}
}
/// Allows you to define an enum on the pezpallet which will then instruct `construct_runtime` to
/// amalgamate all similarly-named enums from other pallets into an aggregate enum.
/// Allows you to define an enum on the pezpallet which will then instruct `construct_runtime`
/// to amalgamate all similarly-named enums from other pallets into an aggregate enum.
#[pezpallet::composite_enum]
pub enum HoldReason {
Staking,
}
/// Allows the pezpallet to provide some inherent. See [`pezframe_support::inherent::ProvideInherent`]
/// for more info.
/// Allows the pezpallet to provide some inherent. See
/// [`pezframe_support::inherent::ProvideInherent`] for more info.
#[pezpallet::inherent]
impl<T: Config> ProvideInherent for Pezpallet<T> {
type Call = Call<T>;
@@ -20,8 +20,8 @@
//! # Multi-Block Migrations Example Pezpallet
//!
//! This pezpallet serves as a minimal example of a pezpallet that uses the [Multi-Block Migrations
//! Framework](pezframe_support::migrations). You can observe how to configure it in a runtime in the
//! `pez-kitchensink-runtime` crate.
//! Framework](pezframe_support::migrations). You can observe how to configure it in a runtime in
//! the `pez-kitchensink-runtime` crate.
//!
//! ## Introduction and Purpose
//!
@@ -55,6 +55,7 @@ extern crate alloc;
use alloc::vec::Vec;
use codec::{Decode, DecodeWithMemTracking, Encode};
use lite_json::json::JsonValue;
use pezframe_support::traits::Get;
use pezframe_system::{
self as system,
@@ -64,7 +65,6 @@ use pezframe_system::{
},
pezpallet_prelude::BlockNumberFor,
};
use lite_json::json::JsonValue;
use pezsp_core::crypto::KeyTypeId;
use pezsp_runtime::{
offchain::{
@@ -111,7 +111,8 @@ pub mod crypto {
}
// implemented for mock runtime in test
impl pezframe_system::offchain::AppCrypto<<Sr25519Signature as Verify>::Signer, Sr25519Signature>
impl
pezframe_system::offchain::AppCrypto<<Sr25519Signature as Verify>::Signer, Sr25519Signature>
for TestAuthId
{
type RuntimeAppPublic = Public;
@@ -39,8 +39,8 @@
//!
//! ## Pezpallet Overview
//!
//! This example pezpallet contains a single storage item [`Value`](pezpallet::Value), which may be set by
//! any signed origin by calling the [`set_value`](crate::Call::set_value) extrinsic.
//! This example pezpallet contains a single storage item [`Value`](pezpallet::Value), which may be
//! set by any signed origin by calling the [`set_value`](crate::Call::set_value) extrinsic.
//!
//! For the purposes of this exercise, we imagine that in [`StorageVersion`] V0 of this pezpallet
//! [`Value`](pezpallet::Value) is a `u32`, and this what is currently stored on-chain.
@@ -51,7 +51,8 @@
//! pub type Value<T: Config> = StorageValue<_, u32>;
//! ```
//!
//! In [`StorageVersion`] V1 of the pezpallet a new struct [`CurrentAndPreviousValue`] is introduced:
//! In [`StorageVersion`] V1 of the pezpallet a new struct [`CurrentAndPreviousValue`] is
//! introduced:
#![doc = docify::embed!("src/lib.rs", CurrentAndPreviousValue)]
//! and [`Value`](pezpallet::Value) is updated to store this new struct instead of a `u32`:
#![doc = docify::embed!("src/lib.rs", Value)]
@@ -118,9 +119,9 @@
//!
//! Note that the storage migration logic is attached to a standalone struct implementing
//! [`UncheckedOnRuntimeUpgrade`], rather than implementing the
//! [`Hooks::on_runtime_upgrade`](pezframe_support::traits::Hooks::on_runtime_upgrade) hook directly on
//! the pezpallet. The pezpallet hook is better suited for special types of logic that need to execute on
//! every runtime upgrade, but not so much for one-off storage migrations.
//! [`Hooks::on_runtime_upgrade`](pezframe_support::traits::Hooks::on_runtime_upgrade) hook directly
//! on the pezpallet. The pezpallet hook is better suited for special types of logic that need to
//! execute on every runtime upgrade, but not so much for one-off storage migrations.
//!
//! ### `MigrateV0ToV1`
//!
@@ -48,5 +48,8 @@ impl pezpallet_template::Config for Test {
// Build genesis storage according to the mock runtime.
pub fn new_test_ext() -> pezsp_io::TestExternalities {
pezframe_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
pezframe_system::GenesisConfig::<Test>::default()
.build_storage()
.unwrap()
.into()
}
+22 -19
View File
@@ -22,37 +22,40 @@
//!
//! ## Pallets
//!
//! - [`pezpallet_example_basic`]: This pezpallet demonstrates concepts, APIs and structures common to
//! most FRAME runtimes.
//! - [`pezpallet_example_basic`]: This pezpallet demonstrates concepts, APIs and structures common
//! to most FRAME runtimes.
//!
//! - [`pezpallet_example_offchain_worker`]: This pezpallet demonstrates concepts, APIs and structures
//! common to most offchain workers.
//! - [`pezpallet_example_offchain_worker`]: This pezpallet demonstrates concepts, APIs and
//! structures common to most offchain workers.
//!
//! - [`pezpallet_default_config_example`]: This pezpallet demonstrates different ways to implement the
//! `Config` trait of pallets.
//! - [`pezpallet_default_config_example`]: This pezpallet demonstrates different ways to implement
//! the `Config` trait of pallets.
//!
//! - [`pezpallet_dev_mode`]: This pezpallet demonstrates the ease of requirements for a pezpallet in "dev
//! mode".
//! - [`pezpallet_dev_mode`]: This pezpallet demonstrates the ease of requirements for a pezpallet
//! in "dev mode".
//!
//! - [`pezpallet_example_kitchensink`]: This pezpallet demonstrates a catalog of all FRAME macros in use
//! and their various syntax options.
//! - [`pezpallet_example_kitchensink`]: This pezpallet demonstrates a catalog of all FRAME macros
//! in use and their various syntax options.
//!
//! - [`pezpallet_example_split`]: A simple example of a FRAME pezpallet demonstrating the ability to
//! split sections across multiple files.
//! - [`pezpallet_example_split`]: A simple example of a FRAME pezpallet demonstrating the ability
//! to split sections across multiple files.
//!
//! - [`pezpallet_example_frame_crate`]: Example pezpallet showcasing how one can be built using only the
//! - [`pezpallet_example_frame_crate`]: Example pezpallet showcasing how one can be built using
//! only the
//! `frame` umbrella crate.
//!
//! - [`pezpallet_example_single_block_migrations`]: An example pezpallet demonstrating best-practices for
//! writing storage migrations.
//! - [`pezpallet_example_single_block_migrations`]: An example pezpallet demonstrating
//! best-practices for writing storage migrations.
//!
//! - [`pezpallet_example_tasks`]: This pezpallet demonstrates the use of `Tasks` to execute service work.
//! - [`pezpallet_example_tasks`]: This pezpallet demonstrates the use of `Tasks` to execute service
//! work.
//!
//! - [`pezpallet_example_view_functions`]: This pezpallet demonstrates the use of view functions to query
//! pezpallet state.
//! - [`pezpallet_example_view_functions`]: This pezpallet demonstrates the use of view functions to
//! query pezpallet state.
//!
//! - [`pezpallet_example_authorization_tx_extension`]: An example `TransactionExtension` that
//! authorizes a custom origin through signature validation, along with two support pallets to
//! showcase the usage.
//!
//! **Tip**: Use `cargo doc --package <pezpallet-name> --open` to view each pezpallet's documentation.
//! **Tip**: Use `cargo doc --package <pezpallet-name> --open` to view each pezpallet's
//! documentation.
+13 -13
View File
@@ -55,7 +55,9 @@ fn runtime_task_enumerate_works_via_pezframe_system_config() {
Numbers::<Runtime>::insert(0, 1);
Numbers::<Runtime>::insert(1, 4);
assert_eq!(
<Runtime as pezframe_system::Config>::RuntimeTask::iter().collect::<Vec<_>>().len(),
<Runtime as pezframe_system::Config>::RuntimeTask::iter()
.collect::<Vec<_>>()
.len(),
2
);
});
@@ -77,7 +79,10 @@ fn runtime_task_enumerate_works_via_pallet_config() {
#[test]
fn task_index_works_at_pallet_level() {
new_test_ext().execute_with(|| {
assert_eq!(crate::pezpallet::Task::<Runtime>::AddNumberIntoTotal { i: 2u32 }.task_index(), 0);
assert_eq!(
crate::pezpallet::Task::<Runtime>::AddNumberIntoTotal { i: 2u32 }.task_index(),
0
);
});
}
@@ -85,11 +90,9 @@ fn task_index_works_at_pallet_level() {
fn task_index_works_at_runtime_level() {
new_test_ext().execute_with(|| {
assert_eq!(
<Runtime as pezframe_system::Config>::RuntimeTask::TasksExample(crate::pezpallet::Task::<
Runtime,
>::AddNumberIntoTotal {
i: 1u32
})
<Runtime as pezframe_system::Config>::RuntimeTask::TasksExample(
crate::pezpallet::Task::<Runtime>::AddNumberIntoTotal { i: 1u32 }
)
.task_index(),
0
);
@@ -104,12 +107,9 @@ fn task_execution_works() {
Numbers::<Runtime>::insert(0, 1);
Numbers::<Runtime>::insert(1, 4);
let task =
<Runtime as pezframe_system::Config>::RuntimeTask::TasksExample(crate::pezpallet::Task::<
Runtime,
>::AddNumberIntoTotal {
i: 1u32,
});
let task = <Runtime as pezframe_system::Config>::RuntimeTask::TasksExample(
crate::pezpallet::Task::<Runtime>::AddNumberIntoTotal { i: 1u32 },
);
assert_ok!(System::do_task(RuntimeOrigin::signed(1), task.clone(),));
assert_eq!(Numbers::<Runtime>::get(0), Some(1));
assert_eq!(Numbers::<Runtime>::get(1), None);
@@ -19,13 +19,15 @@
#![cfg(test)]
use crate::{
pezpallet::{self, Pezpallet},
pallet2,
pezpallet::{self, Pezpallet},
};
use codec::{Decode, Encode};
use scale_info::meta_type;
use pezframe_support::{derive_impl, pezpallet_prelude::PalletInfoAccess, view_functions::ViewFunction};
use pezframe_support::{
derive_impl, pezpallet_prelude::PalletInfoAccess, view_functions::ViewFunction,
};
use pezsp_io::hashing::twox_128;
use pezsp_metadata_ir::{
ItemDeprecationInfoIR, PalletViewFunctionMetadataIR, PalletViewFunctionParamMetadataIR,