chore: regenerate umbrella crate, fix feature propagation
This commit is contained in:
@@ -21,9 +21,6 @@
|
||||
use crate::traits::UnfilteredDispatchable;
|
||||
use codec::{Codec, Decode, DecodeWithMemTracking, Encode, EncodeLike, MaxEncodedLen};
|
||||
use core::fmt;
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use pezsp_runtime::{
|
||||
generic::{CheckedExtrinsic, UncheckedExtrinsic},
|
||||
traits::{
|
||||
@@ -32,6 +29,9 @@ use pezsp_runtime::{
|
||||
DispatchError,
|
||||
};
|
||||
use pezsp_weights::Weight;
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The return type of a `Dispatchable` in frame. When returned explicitly from
|
||||
/// a dispatchable function it allows overriding the default `PostDispatchInfo`
|
||||
@@ -60,8 +60,9 @@ pub type CallableCallFor<A, R> = <A as Callable<R>>::RuntimeCall;
|
||||
/// Means to checks if the dispatchable is feeless.
|
||||
///
|
||||
/// This is automatically implemented for all dispatchables during pezpallet expansion.
|
||||
/// If a call is marked by [`#[pezpallet::feeless_if]`](`macro@pezframe_support_procedural::feeless_if`)
|
||||
/// attribute, the corresponding closure is checked.
|
||||
/// If a call is marked by
|
||||
/// [`#[pezpallet::feeless_if]`](`macro@pezframe_support_procedural::feeless_if`) attribute, the
|
||||
/// corresponding closure is checked.
|
||||
pub trait CheckIfFeeless {
|
||||
/// The Origin type of the runtime.
|
||||
type Origin;
|
||||
@@ -1207,7 +1208,6 @@ mod per_dispatch_class_tests {
|
||||
#[cfg(test)]
|
||||
mod test_extensions {
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
impl_tx_ext_default,
|
||||
traits::{
|
||||
@@ -1217,6 +1217,7 @@ mod test_extensions {
|
||||
transaction_validity::TransactionValidityError,
|
||||
};
|
||||
use pezsp_weights::Weight;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
use super::{DispatchResult, PostDispatchInfo};
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
//! # FRAME integration
|
||||
//!
|
||||
//! The FRAME macros implement
|
||||
//! [`UnfilteredDispatchable`](pezframe_support::traits::UnfilteredDispatchable) for each pezpallet `Call`
|
||||
//! enum. Part of this implementation is the call to [`run_in_context`], so that each call to
|
||||
//! [`UnfilteredDispatchable`](pezframe_support::traits::UnfilteredDispatchable) for each pezpallet
|
||||
//! `Call` enum. Part of this implementation is the call to [`run_in_context`], so that each call to
|
||||
//! [`UnfilteredDispatchable::dispatch_bypass_filter`](crate::traits::UnfilteredDispatchable::dispatch_bypass_filter)
|
||||
//! or [`Dispatchable::dispatch`](pezsp_runtime::traits::Dispatchable::dispatch) will run in a dispatch
|
||||
//! context.
|
||||
//! or [`Dispatchable::dispatch`](pezsp_runtime::traits::Dispatchable::dispatch) will run in a
|
||||
//! dispatch context.
|
||||
//!
|
||||
//! # Example
|
||||
//!
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
//! Some instance placeholder to be used in [`pezframe_support::pezpallet`] attribute macro.
|
||||
//!
|
||||
//! [`pezframe_support::pezpallet`] attribute macro does only requires the instance generic `I` to be
|
||||
//! static (contrary to `decl_*` macro which requires instance generic to implement
|
||||
//! [`pezframe_support::pezpallet`] attribute macro does only requires the instance generic `I` to
|
||||
//! be static (contrary to `decl_*` macro which requires instance generic to implement
|
||||
//! [`pezframe_support::traits::Instance`]).
|
||||
//!
|
||||
//! Thus support provides some instance types to be used, This allow some instantiable pezpallet to
|
||||
@@ -28,12 +28,12 @@
|
||||
//! pub trait Config<I: 'static = ()>: another_pallet::Config<I> {}
|
||||
//! ```
|
||||
//!
|
||||
//! NOTE: [`pezframe_support::pezpallet`] will reexport them inside the module, in order to make them
|
||||
//! accessible to [`pezframe_support::construct_runtime`].
|
||||
//! NOTE: [`pezframe_support::pezpallet`] will reexport them inside the module, in order to make
|
||||
//! them accessible to [`pezframe_support::construct_runtime`].
|
||||
|
||||
/// `Instance1` to be used for instantiable pallets defined with the
|
||||
/// [`#[pezpallet]`](`pezframe_support::pezpallet`) macro. Instances 2-16 are also available but are hidden
|
||||
/// from docs.
|
||||
/// [`#[pezpallet]`](`pezframe_support::pezpallet`) macro. Instances 2-16 are also available but are
|
||||
/// hidden from docs.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, crate::RuntimeDebugNoBound)]
|
||||
pub struct Instance1;
|
||||
|
||||
|
||||
@@ -57,9 +57,6 @@ pub mod __private {
|
||||
pub use impl_trait_for_tuples;
|
||||
pub use log;
|
||||
pub use paste;
|
||||
pub use scale_info;
|
||||
pub use serde;
|
||||
pub use serde_json;
|
||||
pub use pezsp_core::{Get, OpaqueMetadata, Void};
|
||||
pub use pezsp_crypto_hashing_proc_macro;
|
||||
pub use pezsp_inherents;
|
||||
@@ -77,6 +74,9 @@ pub mod __private {
|
||||
pub use pezsp_state_machine::BasicExternalities;
|
||||
pub use pezsp_std;
|
||||
pub use pezsp_tracing;
|
||||
pub use scale_info;
|
||||
pub use serde;
|
||||
pub use serde_json;
|
||||
pub use tt_call::*;
|
||||
}
|
||||
|
||||
@@ -128,8 +128,8 @@ pub use pezsp_runtime::{
|
||||
};
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::TypeId;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// A unified log target for support operations.
|
||||
pub const LOG_TARGET: &str = "runtime::pezframe-support";
|
||||
@@ -146,17 +146,18 @@ impl TypeId for PalletId {
|
||||
const TYPE_ID: [u8; 4] = *b"modl";
|
||||
}
|
||||
|
||||
/// Generate a [`#[pezpallet::storage]`](pezpallet_macros::storage) alias outside of a pezpallet.
|
||||
/// Generate a [`#[pezpallet::storage]`](pezpallet_macros::storage) alias outside of a
|
||||
/// pezpallet.
|
||||
///
|
||||
/// This storage alias works similarly to the [`#[pezpallet::storage]`](pezpallet_macros::storage)
|
||||
/// attribute macro. It supports [`StorageValue`](storage::types::StorageValue),
|
||||
/// [`StorageMap`](storage::types::StorageMap),
|
||||
/// This storage alias works similarly to the
|
||||
/// [`#[pezpallet::storage]`](pezpallet_macros::storage) attribute macro. It supports
|
||||
/// [`StorageValue`](storage::types::StorageValue), [`StorageMap`](storage::types::StorageMap),
|
||||
/// [`StorageDoubleMap`](storage::types::StorageDoubleMap) and
|
||||
/// [`StorageNMap`](storage::types::StorageNMap). The main difference to the normal
|
||||
/// [`#[pezpallet::storage]`](pezpallet_macros::storage) is the flexibility around declaring the
|
||||
/// storage prefix to use. The storage prefix determines where to find the value in the
|
||||
/// storage. [`#[pezpallet::storage]`](pezpallet_macros::storage) uses the name of the pezpallet as
|
||||
/// declared in [`construct_runtime!`].
|
||||
/// [`#[pezpallet::storage]`](pezpallet_macros::storage) is the flexibility around declaring
|
||||
/// the storage prefix to use. The storage prefix determines where to find the value in the
|
||||
/// storage. [`#[pezpallet::storage]`](pezpallet_macros::storage) uses the name of the
|
||||
/// pezpallet as declared in [`construct_runtime!`].
|
||||
///
|
||||
/// The flexibility around declaring the storage prefix makes this macro very useful for
|
||||
/// writing migrations etc.
|
||||
@@ -166,9 +167,10 @@ impl TypeId for PalletId {
|
||||
/// There are different ways to declare the `prefix` to use. The `prefix` type can either be
|
||||
/// declared explicitly by passing it to the macro as an attribute or by letting the macro
|
||||
/// guess on what the `prefix` type is. The `prefix` is always passed as the first generic
|
||||
/// argument to the type declaration. When using [`#[pezpallet::storage]`](pezpallet_macros::storage)
|
||||
/// this first generic argument is always `_`. Besides declaring the `prefix`, the rest of the
|
||||
/// type declaration works as with [`#[pezpallet::storage]`](pezpallet_macros::storage).
|
||||
/// argument to the type declaration. When using
|
||||
/// [`#[pezpallet::storage]`](pezpallet_macros::storage) this first generic argument is always
|
||||
/// `_`. Besides declaring the `prefix`, the rest of the type declaration works as with
|
||||
/// [`#[pezpallet::storage]`](pezpallet_macros::storage).
|
||||
///
|
||||
/// 1. Use the `verbatim` prefix type. This prefix type uses the given identifier as the
|
||||
/// `prefix`:
|
||||
@@ -178,8 +180,8 @@ impl TypeId for PalletId {
|
||||
/// configured in [`construct_runtime!`] as the `prefix`:
|
||||
#[doc = docify::embed!("src/tests/storage_alias.rs", pezpallet_name_attribute)]
|
||||
/// It requires that the given prefix type implements
|
||||
/// [`PalletInfoAccess`](traits::PalletInfoAccess) (which is always the case for FRAME pezpallet
|
||||
/// structs). In the example above, `Pezpallet<T>` is the prefix type.
|
||||
/// [`PalletInfoAccess`](traits::PalletInfoAccess) (which is always the case for FRAME
|
||||
/// pezpallet structs). In the example above, `Pezpallet<T>` is the prefix type.
|
||||
///
|
||||
/// 3. Use the `dynamic` prefix type. This prefix type calls [`Get::get()`](traits::Get::get)
|
||||
/// to get the `prefix`:
|
||||
@@ -187,8 +189,8 @@ impl TypeId for PalletId {
|
||||
/// It requires that the given prefix type implements [`Get<'static str>`](traits::Get).
|
||||
///
|
||||
/// 4. Let the macro "guess" what kind of prefix type to use. This only supports verbatim or
|
||||
/// pezpallet name. The macro uses the presence of generic arguments to the prefix type as an
|
||||
/// indication that it should use the pezpallet name as the `prefix`:
|
||||
/// pezpallet name. The macro uses the presence of generic arguments to the prefix type as
|
||||
/// an indication that it should use the pezpallet name as the `prefix`:
|
||||
#[doc = docify::embed!("src/tests/storage_alias.rs", storage_alias_guess)]
|
||||
pub use pezframe_support_procedural::storage_alias;
|
||||
|
||||
@@ -444,7 +446,6 @@ pub mod pezpallet_prelude {
|
||||
pub use core::marker::PhantomData;
|
||||
pub use pezframe_support::pezpallet_macros::*;
|
||||
pub use pezframe_support_procedural::{inject_runtime_type, register_default_impl};
|
||||
pub use scale_info::TypeInfo;
|
||||
pub use pezsp_inherents::MakeFatalError;
|
||||
pub use pezsp_runtime::{
|
||||
traits::{
|
||||
@@ -460,6 +461,7 @@ pub mod pezpallet_prelude {
|
||||
DispatchError, RuntimeDebug, MAX_MODULE_ERROR_ENCODED_SIZE,
|
||||
};
|
||||
pub use pezsp_weights::Weight;
|
||||
pub use scale_info::TypeInfo;
|
||||
}
|
||||
|
||||
/// The pezpallet macro has 2 purposes:
|
||||
@@ -488,7 +490,8 @@ pub mod pezpallet_prelude {
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// The documentation for each individual part can be found at [pezframe_support::pezpallet_macros]
|
||||
/// The documentation for each individual part can be found at
|
||||
/// [pezframe_support::pezpallet_macros]
|
||||
///
|
||||
/// ## Dev Mode (`#[pezpallet(dev_mode)]`)
|
||||
///
|
||||
@@ -517,8 +520,9 @@ pub mod pezpallet_prelude {
|
||||
/// * Call indices no longer need to be specified on every `#[pezpallet::call]` declaration. By
|
||||
/// default, dev mode pallets will assume a call index based on the order of the call.
|
||||
/// * All storages are marked as unbounded, meaning you do not need to implement
|
||||
/// [`MaxEncodedLen`](pezframe_support::pezpallet_prelude::MaxEncodedLen) on storage types. This is
|
||||
/// equivalent to specifying `#[pezpallet::unbounded]` on all storage type definitions.
|
||||
/// [`MaxEncodedLen`](pezframe_support::pezpallet_prelude::MaxEncodedLen) on storage types.
|
||||
/// This is equivalent to specifying `#[pezpallet::unbounded]` on all storage type
|
||||
/// definitions.
|
||||
/// * Storage hashers no longer need to be specified and can be replaced by `_`. In dev mode,
|
||||
/// these will be replaced by `Blake2_128Concat`. In case of explicit key-binding, `Hasher`
|
||||
/// can simply be ignored when in `dev_mode`.
|
||||
@@ -572,20 +576,20 @@ pub mod pezpallet_prelude {
|
||||
/// It also implements on the pezpallet:
|
||||
///
|
||||
/// * [`GetStorageVersion`](pezframe_support::traits::GetStorageVersion)
|
||||
/// * [`OnGenesis`](pezframe_support::traits::OnGenesis): contains some logic to write the pezpallet
|
||||
/// version into storage.
|
||||
/// * [`PalletInfoAccess`](pezframe_support::traits::PalletInfoAccess) to ease access to pezpallet
|
||||
/// information given by [`pezframe_support::traits::PalletInfo`]. (The implementation uses the
|
||||
/// associated type [`pezframe_support::traits::PalletInfo`]).
|
||||
/// * [`StorageInfoTrait`](pezframe_support::traits::StorageInfoTrait) to give information about
|
||||
/// storages.
|
||||
/// * [`OnGenesis`](pezframe_support::traits::OnGenesis): contains some logic to write the
|
||||
/// pezpallet version into storage.
|
||||
/// * [`PalletInfoAccess`](pezframe_support::traits::PalletInfoAccess) to ease access to
|
||||
/// pezpallet information given by [`pezframe_support::traits::PalletInfo`]. (The
|
||||
/// implementation uses the associated type [`pezframe_support::traits::PalletInfo`]).
|
||||
/// * [`StorageInfoTrait`](pezframe_support::traits::StorageInfoTrait) to give information
|
||||
/// about storages.
|
||||
///
|
||||
/// If the attribute `set_storage_max_encoded_len` is set then the macro calls
|
||||
/// [`StorageInfoTrait`](pezframe_support::traits::StorageInfoTrait) for each storage in the
|
||||
/// implementation of [`StorageInfoTrait`](pezframe_support::traits::StorageInfoTrait) for the
|
||||
/// pezpallet. Otherwise, it implements
|
||||
/// [`StorageInfoTrait`](pezframe_support::traits::StorageInfoTrait) for the pezpallet using the
|
||||
/// [`PartialStorageInfoTrait`](pezframe_support::traits::PartialStorageInfoTrait)
|
||||
/// [`StorageInfoTrait`](pezframe_support::traits::StorageInfoTrait) for the pezpallet using
|
||||
/// the [`PartialStorageInfoTrait`](pezframe_support::traits::PartialStorageInfoTrait)
|
||||
/// implementation of storages.
|
||||
///
|
||||
/// ## Note on deprecation.
|
||||
@@ -717,9 +721,9 @@ pub mod pezpallet_macros {
|
||||
/// Declares a storage as unbounded in potential size.
|
||||
///
|
||||
/// When implementing the storage info (when `#[pezpallet::generate_storage_info]` is
|
||||
/// specified on the pezpallet struct placeholder), the size of the storage will be declared
|
||||
/// as unbounded. This can be useful for storage which can never go into PoV (Proof of
|
||||
/// Validity).
|
||||
/// specified on the pezpallet struct placeholder), the size of the storage will be
|
||||
/// declared as unbounded. This can be useful for storage which can never go into PoV
|
||||
/// (Proof of Validity).
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
@@ -780,8 +784,8 @@ pub mod pezpallet_macros {
|
||||
/// Ensures the trait item will not be used as a default with the
|
||||
/// `#[derive_impl(..)]` attribute macro.
|
||||
///
|
||||
/// The optional attribute `#[pezpallet::no_default]` can be attached to trait items within a
|
||||
/// `Config` trait impl that has [`#[pezpallet::config(with_default)]`](`config`)
|
||||
/// The optional attribute `#[pezpallet::no_default]` can be attached to trait items within
|
||||
/// a `Config` trait impl that has [`#[pezpallet::config(with_default)]`](`config`)
|
||||
/// attached.
|
||||
pub use pezframe_support_procedural::no_default;
|
||||
|
||||
@@ -789,21 +793,21 @@ pub mod pezpallet_macros {
|
||||
/// [`#[import_section]`](`import_section`).
|
||||
///
|
||||
/// Note that sections are imported by their module name/ident, and should be referred to
|
||||
/// by their _full path_ from the perspective of the target pezpallet. Do not attempt to make
|
||||
/// use of `use` statements to bring pezpallet sections into scope, as this will not work
|
||||
/// (unless you do so as part of a wildcard import, in which case it will work).
|
||||
/// by their _full path_ from the perspective of the target pezpallet. Do not attempt to
|
||||
/// make use of `use` statements to bring pezpallet sections into scope, as this will not
|
||||
/// work (unless you do so as part of a wildcard import, in which case it will work).
|
||||
///
|
||||
/// ## Naming Logistics
|
||||
///
|
||||
/// Also note that because of how `#[pezpallet_section]` works, pezpallet section names must be
|
||||
/// globally unique _within the crate in which they are defined_. For more information on
|
||||
/// why this must be the case, see macro_magic's
|
||||
/// Also note that because of how `#[pezpallet_section]` works, pezpallet section names
|
||||
/// must be globally unique _within the crate in which they are defined_. For more
|
||||
/// information on why this must be the case, see macro_magic's
|
||||
/// [`#[export_tokens]`](https://docs.rs/macro_magic/latest/macro_magic/attr.export_tokens.html) macro.
|
||||
///
|
||||
/// Optionally, you may provide an argument to `#[pezpallet_section]` such as
|
||||
/// `#[pezpallet_section(some_ident)]`, in the event that there is another pezpallet section in
|
||||
/// same crate with the same ident/name. The ident you specify can then be used instead of
|
||||
/// the module's ident name when you go to import it via
|
||||
/// `#[pezpallet_section(some_ident)]`, in the event that there is another pezpallet
|
||||
/// section in same crate with the same ident/name. The ident you specify can then be used
|
||||
/// instead of the module's ident name when you go to import it via
|
||||
/// [`#[import_section]`](`import_section`).
|
||||
pub use pezframe_support_procedural::pezpallet_section;
|
||||
|
||||
@@ -915,9 +919,9 @@ pub mod pezpallet_macros {
|
||||
/// `use` statements within your pezpallet section, so they are imported as well, or by
|
||||
/// otherwise ensuring that you have the same imports on the target pezpallet.
|
||||
///
|
||||
/// It is perfectly permissible to import multiple pezpallet sections into the same pezpallet,
|
||||
/// which can be done by having multiple `#[import_section(something)]` attributes
|
||||
/// attached to the pezpallet.
|
||||
/// It is perfectly permissible to import multiple pezpallet sections into the same
|
||||
/// pezpallet, which can be done by having multiple `#[import_section(something)]`
|
||||
/// attributes attached to the pezpallet.
|
||||
///
|
||||
/// Note that sections are imported by their module name/ident, and should be referred to
|
||||
/// by their _full path_ from the perspective of the target pezpallet.
|
||||
@@ -944,7 +948,8 @@ pub mod pezpallet_macros {
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// See [`pezpallet::storage`](`pezframe_support::pezpallet_macros::storage`) for more info.
|
||||
/// See [`pezpallet::storage`](`pezframe_support::pezpallet_macros::storage`) for more
|
||||
/// info.
|
||||
pub use pezframe_support_procedural::getter;
|
||||
|
||||
/// Defines constants that are added to the constant field of
|
||||
@@ -1036,9 +1041,9 @@ pub mod pezpallet_macros {
|
||||
/// ```
|
||||
///
|
||||
/// I.e. a regular trait definition named `Config`, with the supertrait
|
||||
/// [`pezframe_system::pezpallet::Config`](../../pezframe_system/pezpallet/trait.Config.html), and
|
||||
/// optionally other supertraits and a where clause. (Specifying other supertraits here is
|
||||
/// known as [tight coupling](https://docs.pezkuwichain.io/reference/how-to-guides/pezpallet-design/use-tight-coupling/))
|
||||
/// [`pezframe_system::pezpallet::Config`](../../pezframe_system/pezpallet/trait.Config.
|
||||
/// html), and optionally other supertraits and a where clause. (Specifying other
|
||||
/// supertraits here is known as [tight coupling](https://docs.pezkuwichain.io/reference/how-to-guides/pezpallet-design/use-tight-coupling/))
|
||||
///
|
||||
/// ## Optional: `with_default`
|
||||
///
|
||||
@@ -1081,15 +1086,16 @@ pub mod pezpallet_macros {
|
||||
/// As shown above:
|
||||
/// * you may attach the [`#[pezpallet::no_default]`](`no_default`)
|
||||
/// attribute to specify that a particular trait item _cannot_ be used as a default when a
|
||||
/// test `Config` is derived using the [`#[derive_impl(..)]`](`pezframe_support::derive_impl`)
|
||||
/// attribute macro. This will cause that particular trait item to simply not appear in
|
||||
/// default testing configs based on this config (the trait item will not be included in
|
||||
/// `DefaultConfig`).
|
||||
/// test `Config` is derived using the
|
||||
/// [`#[derive_impl(..)]`](`pezframe_support::derive_impl`) attribute macro. This will
|
||||
/// cause that particular trait item to simply not appear in default testing configs based
|
||||
/// on this config (the trait item will not be included in `DefaultConfig`).
|
||||
/// * you may attach the [`#[pezpallet::no_default_bounds]`](`no_default_bounds`)
|
||||
/// attribute to specify that a particular trait item can be used as a default when a
|
||||
/// test `Config` is derived using the [`#[derive_impl(..)]`](`pezframe_support::derive_impl`)
|
||||
/// attribute macro. But its bounds cannot be enforced at this point and should be
|
||||
/// discarded when generating the default config trait.
|
||||
/// test `Config` is derived using the
|
||||
/// [`#[derive_impl(..)]`](`pezframe_support::derive_impl`) attribute macro. But its
|
||||
/// bounds cannot be enforced at this point and should be discarded when generating the
|
||||
/// default config trait.
|
||||
/// * you may not specify any attribute to generate a trait item in the default config
|
||||
/// trait.
|
||||
///
|
||||
@@ -1108,11 +1114,11 @@ pub mod pezpallet_macros {
|
||||
///
|
||||
/// Consequently:
|
||||
/// - Any items that rely on externalities _must_ be marked with
|
||||
/// [`#[pezpallet::no_default]`](`no_default`) or your trait will fail to compile when used
|
||||
/// with [`derive_impl`](`pezframe_support::derive_impl`).
|
||||
/// - Items marked with [`#[pezpallet::no_default]`](`no_default`) are entirely excluded from
|
||||
/// the `DefaultConfig` trait, and therefore any impl of `DefaultConfig` doesn't need to
|
||||
/// implement such items.
|
||||
/// [`#[pezpallet::no_default]`](`no_default`) or your trait will fail to compile when
|
||||
/// used with [`derive_impl`](`pezframe_support::derive_impl`).
|
||||
/// - Items marked with [`#[pezpallet::no_default]`](`no_default`) are entirely excluded
|
||||
/// from the `DefaultConfig` trait, and therefore any impl of `DefaultConfig` doesn't
|
||||
/// need to implement such items.
|
||||
///
|
||||
/// For more information, see:
|
||||
/// * [`pezframe_support::derive_impl`].
|
||||
@@ -1246,8 +1252,8 @@ pub mod pezpallet_macros {
|
||||
/// [`ValidateUnsigned`](pezframe_support::pezpallet_prelude::ValidateUnsigned) for
|
||||
/// type `Pezpallet<T>`, and some optional where clause.
|
||||
///
|
||||
/// NOTE: There is also the [`pezsp_runtime::traits::TransactionExtension`] trait that can be
|
||||
/// used to add some specific logic for transaction validation.
|
||||
/// NOTE: There is also the [`pezsp_runtime::traits::TransactionExtension`] trait that can
|
||||
/// be used to add some specific logic for transaction validation.
|
||||
///
|
||||
/// ## Macro expansion
|
||||
///
|
||||
@@ -1258,9 +1264,9 @@ pub mod pezpallet_macros {
|
||||
/// Allows defining view functions on a pezpallet.
|
||||
///
|
||||
/// A pezpallet view function is a read-only function providing access to the state of the
|
||||
/// pezpallet from both outside and inside the runtime. It should provide a _stable_ interface
|
||||
/// for querying the state of the pezpallet, avoiding direct storage access and upgrading
|
||||
/// along with the runtime.
|
||||
/// pezpallet from both outside and inside the runtime. It should provide a _stable_
|
||||
/// interface for querying the state of the pezpallet, avoiding direct storage access and
|
||||
/// upgrading along with the runtime.
|
||||
///
|
||||
/// ## Syntax
|
||||
/// View functions methods must be read-only and always return some output. A
|
||||
@@ -1295,23 +1301,23 @@ pub mod pezpallet_macros {
|
||||
///
|
||||
/// ## Usage and implementation details
|
||||
/// To allow outside access to pezpallet view functions, you need to add a runtime API that
|
||||
/// accepts view function queries and dispatches them to the right pezpallet. You can do that
|
||||
/// by implementing the
|
||||
/// accepts view function queries and dispatches them to the right pezpallet. You can do
|
||||
/// that by implementing the
|
||||
/// [`RuntimeViewFunction`](pezframe_support::view_functions::runtime_api::RuntimeViewFunction)
|
||||
/// trait for the runtime inside an [`impl_runtime_apis!`](pezsp_api::impl_runtime_apis)
|
||||
/// block.
|
||||
///
|
||||
/// The `RuntimeViewFunction` trait implements a hashing-based dispatching mechanism to
|
||||
/// dispatch view functions to the right method in the right pezpallet based on their IDs. A
|
||||
/// view function ID depends both on its pezpallet and on its method signature, so it remains
|
||||
/// stable as long as those two elements are not modified. In general, pezpallet view
|
||||
/// functions should expose a _stable_ interface and changes to the method signature are
|
||||
/// strongly discouraged. For more details on the dispatching mechanism, see the
|
||||
/// dispatch view functions to the right method in the right pezpallet based on their IDs.
|
||||
/// A view function ID depends both on its pezpallet and on its method signature, so it
|
||||
/// remains stable as long as those two elements are not modified. In general, pezpallet
|
||||
/// view functions should expose a _stable_ interface and changes to the method signature
|
||||
/// are strongly discouraged. For more details on the dispatching mechanism, see the
|
||||
/// [`DispatchViewFunction`](pezframe_support::view_functions::DispatchViewFunction) trait.
|
||||
pub use pezframe_support_procedural::view_functions;
|
||||
|
||||
/// Allows defining a struct implementing the [`Get`](pezframe_support::traits::Get) trait to
|
||||
/// ease the use of storage types.
|
||||
/// Allows defining a struct implementing the [`Get`](pezframe_support::traits::Get) trait
|
||||
/// to ease the use of storage types.
|
||||
///
|
||||
/// This attribute is meant to be used alongside [`#[pezpallet::storage]`](`storage`) to
|
||||
/// define a storage's default value. This attribute can be used multiple times.
|
||||
@@ -1498,8 +1504,8 @@ pub mod pezpallet_macros {
|
||||
///
|
||||
/// ### Macro expansion
|
||||
///
|
||||
/// The macro implements the [`pezpallet_skip_feeless_payment::CheckIfFeeless`] trait on the
|
||||
/// dispatchable and calls the corresponding closure in the implementation.
|
||||
/// The macro implements the [`pezpallet_skip_feeless_payment::CheckIfFeeless`] trait on
|
||||
/// the dispatchable and calls the corresponding closure in the implementation.
|
||||
///
|
||||
/// [`pezpallet_skip_feeless_payment::SkipCheckIfFeeless`]: ../../pezpallet_skip_feeless_payment/struct.SkipCheckIfFeeless.html
|
||||
/// [`pezpallet_skip_feeless_payment::CheckIfFeeless`]: ../../pezpallet_skip_feeless_payment/struct.SkipCheckIfFeeless.html
|
||||
@@ -1562,8 +1568,8 @@ pub mod pezpallet_macros {
|
||||
///
|
||||
/// ## Note on deprecation of Errors
|
||||
///
|
||||
/// - Usage of `deprecated` attribute will propagate deprecation information to the pezpallet
|
||||
/// metadata where the item was declared.
|
||||
/// - Usage of `deprecated` attribute will propagate deprecation information to the
|
||||
/// pezpallet metadata where the item was declared.
|
||||
/// - For general usage examples of `deprecated` attribute please refer to <https://doc.rust-lang.org/nightly/reference/attributes/diagnostics.html#the-deprecated-attribute>
|
||||
/// - It's possible to deprecated either certain variants inside the `Error` or the whole
|
||||
/// `Error` itself. If both the `Error` and its variants are deprecated a compile error
|
||||
@@ -1618,8 +1624,8 @@ pub mod pezpallet_macros {
|
||||
///
|
||||
/// ## Note on deprecation of Events
|
||||
///
|
||||
/// - Usage of `deprecated` attribute will propagate deprecation information to the pezpallet
|
||||
/// metadata where the item was declared.
|
||||
/// - Usage of `deprecated` attribute will propagate deprecation information to the
|
||||
/// pezpallet metadata where the item was declared.
|
||||
/// - For general usage examples of `deprecated` attribute please refer to <https://doc.rust-lang.org/nightly/reference/attributes/diagnostics.html#the-deprecated-attribute>
|
||||
/// - It's possible to deprecated either certain variants inside the `Event` or the whole
|
||||
/// `Event` itself. If both the `Event` and its variants are deprecated a compile error
|
||||
@@ -1749,11 +1755,12 @@ pub mod pezpallet_macros {
|
||||
/// ## Weight info
|
||||
///
|
||||
/// Each call needs to define a weight.
|
||||
/// * The weight can be defined explicitly using the attribute `#[pezpallet::weight($expr)]`
|
||||
/// (Note that argument of the call are available inside the expression).
|
||||
/// * The weight can be defined explicitly using the attribute
|
||||
/// `#[pezpallet::weight($expr)]` (Note that argument of the call are available inside
|
||||
/// the expression).
|
||||
/// * Or it can be defined implicitly, the weight info for the calls needs to be specified
|
||||
/// in the call attribute: `#[pezpallet::call(weight = $WeightInfo)]`, then each call that
|
||||
/// doesn't have explicit weight will use `$WeightInfo::$call_name` as the weight.
|
||||
/// in the call attribute: `#[pezpallet::call(weight = $WeightInfo)]`, then each call
|
||||
/// that doesn't have explicit weight will use `$WeightInfo::$call_name` as the weight.
|
||||
///
|
||||
/// * Or it can be simply ignored when the pezpallet is in `dev_mode`.
|
||||
///
|
||||
@@ -1827,8 +1834,8 @@ pub mod pezpallet_macros {
|
||||
///
|
||||
/// ## Note on deprecation of Calls
|
||||
///
|
||||
/// - Usage of `deprecated` attribute will propagate deprecation information to the pezpallet
|
||||
/// metadata where the item was declared.
|
||||
/// - Usage of `deprecated` attribute will propagate deprecation information to the
|
||||
/// pezpallet metadata where the item was declared.
|
||||
/// - For general usage examples of `deprecated` attribute please refer to <https://doc.rust-lang.org/nightly/reference/attributes/diagnostics.html#the-deprecated-attribute>
|
||||
/// - Usage of `allow(deprecated)` on the item will propagate this attribute to the
|
||||
/// generated code.
|
||||
@@ -1885,8 +1892,8 @@ pub mod pezpallet_macros {
|
||||
pub use pezframe_support_procedural::genesis_config;
|
||||
|
||||
/// Allows you to define how the state of your pezpallet at genesis is built. This
|
||||
/// takes as input the `GenesisConfig` type (as `self`) and constructs the pezpallet's initial
|
||||
/// state.
|
||||
/// takes as input the `GenesisConfig` type (as `self`) and constructs the pezpallet's
|
||||
/// initial state.
|
||||
///
|
||||
/// The fields of the `GenesisConfig` can in turn be populated by the chain-spec.
|
||||
///
|
||||
@@ -1947,8 +1954,8 @@ pub mod pezpallet_macros {
|
||||
pub use pezframe_support_procedural::genesis_build;
|
||||
|
||||
/// Allows adding an associated type trait bounded by
|
||||
/// [`Get`](pezframe_support::pezpallet_prelude::Get) from [`pezpallet::config`](`macro@config`)
|
||||
/// into metadata.
|
||||
/// [`Get`](pezframe_support::pezpallet_prelude::Get) from
|
||||
/// [`pezpallet::config`](`macro@config`) into metadata.
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
@@ -1969,8 +1976,8 @@ pub mod pezpallet_macros {
|
||||
///
|
||||
/// ## Note on deprecation of constants
|
||||
///
|
||||
/// - Usage of `deprecated` attribute will propagate deprecation information to the pezpallet
|
||||
/// metadata where the item was declared.
|
||||
/// - Usage of `deprecated` attribute will propagate deprecation information to the
|
||||
/// pezpallet metadata where the item was declared.
|
||||
/// - For general usage examples of `deprecated` attribute please refer to <https://doc.rust-lang.org/nightly/reference/attributes/diagnostics.html#the-deprecated-attribute>
|
||||
/// - Usage of `allow(deprecated)` on the item will propagate this attribute to the
|
||||
/// generated code.
|
||||
@@ -1983,7 +1990,8 @@ pub mod pezpallet_macros {
|
||||
/// Storage items are pointers to data stored on-chain (the *blockchain state*), under a
|
||||
/// specific key. The exact key is dependent on the type of the storage.
|
||||
///
|
||||
/// > From the perspective of this pezpallet, the entire blockchain state is abstracted behind
|
||||
/// > From the perspective of this pezpallet, the entire blockchain state is abstracted
|
||||
/// > behind
|
||||
/// > a key-value api, namely [`pezsp_io::storage`].
|
||||
///
|
||||
/// ## Storage Types
|
||||
@@ -2016,8 +2024,8 @@ pub mod pezpallet_macros {
|
||||
/// Each `Key` type requires its own designated `Hasher` declaration, so that
|
||||
/// [`StorageDoubleMap`](pezframe_support::storage::types::StorageDoubleMap) needs two of
|
||||
/// each, and [`StorageNMap`](pezframe_support::storage::types::StorageNMap) needs `N` such
|
||||
/// pairs. Since [`StorageValue`](pezframe_support::storage::types::StorageValue) only stores
|
||||
/// a single element, no configuration of hashers is needed.
|
||||
/// pairs. Since [`StorageValue`](pezframe_support::storage::types::StorageValue) only
|
||||
/// stores a single element, no configuration of hashers is needed.
|
||||
///
|
||||
/// ### Syntax
|
||||
///
|
||||
@@ -2077,24 +2085,25 @@ pub mod pezpallet_macros {
|
||||
///
|
||||
/// There are three types of queries:
|
||||
///
|
||||
/// 1. [`OptionQuery`](pezframe_support::storage::types::OptionQuery): The default query type.
|
||||
/// It returns `Some(V)` if the value is present, or `None` if it isn't, where `V` is
|
||||
/// the value type.
|
||||
/// 2. [`ValueQuery`](pezframe_support::storage::types::ValueQuery): Returns the value itself
|
||||
/// if present; otherwise, it returns `Default::default()`. This behavior can be
|
||||
/// 1. [`OptionQuery`](pezframe_support::storage::types::OptionQuery): The default query
|
||||
/// type. It returns `Some(V)` if the value is present, or `None` if it isn't, where `V`
|
||||
/// is the value type.
|
||||
/// 2. [`ValueQuery`](pezframe_support::storage::types::ValueQuery): Returns the value
|
||||
/// itself if present; otherwise, it returns `Default::default()`. This behavior can be
|
||||
/// adjusted with the `OnEmpty` generic parameter, which defaults to `OnEmpty =
|
||||
/// GetDefault`.
|
||||
/// 3. [`ResultQuery`](pezframe_support::storage::types::ResultQuery): Returns `Result<V, E>`,
|
||||
/// where `V` is the value type.
|
||||
/// 3. [`ResultQuery`](pezframe_support::storage::types::ResultQuery): Returns `Result<V,
|
||||
/// E>`, where `V` is the value type.
|
||||
///
|
||||
/// See [`QueryKind`](pezframe_support::storage::types::QueryKindTrait) for further examples.
|
||||
/// See [`QueryKind`](pezframe_support::storage::types::QueryKindTrait) for further
|
||||
/// examples.
|
||||
///
|
||||
/// ### Optimized Appending
|
||||
///
|
||||
/// All storage items — such as
|
||||
/// [`StorageValue`](pezframe_support::storage::types::StorageValue),
|
||||
/// [`StorageMap`](pezframe_support::storage::types::StorageMap), and their variants—offer an
|
||||
/// `::append()` method optimized for collections. Using this method avoids the
|
||||
/// [`StorageMap`](pezframe_support::storage::types::StorageMap), and their variants—offer
|
||||
/// an `::append()` method optimized for collections. Using this method avoids the
|
||||
/// inefficiency of decoding and re-encoding entire collections when adding items. For
|
||||
/// instance, consider the storage declaration `type MyVal<T> = StorageValue<_, Vec<u8>,
|
||||
/// ValueQuery>`. With `MyVal` storing a large list of bytes, `::append()` lets you
|
||||
@@ -2121,9 +2130,9 @@ pub mod pezpallet_macros {
|
||||
/// ### Hashers
|
||||
///
|
||||
/// For all storage types, except
|
||||
/// [`StorageValue`](pezframe_support::storage::types::StorageValue), a set of hashers needs
|
||||
/// to be specified. The choice of hashers is crucial, especially in production chains. The
|
||||
/// purpose of storage hashers in maps is to ensure the keys of a map are
|
||||
/// [`StorageValue`](pezframe_support::storage::types::StorageValue), a set of hashers
|
||||
/// needs to be specified. The choice of hashers is crucial, especially in production
|
||||
/// chains. The purpose of storage hashers in maps is to ensure the keys of a map are
|
||||
/// uniformly distributed. An unbalanced map/trie can lead to inefficient performance.
|
||||
///
|
||||
/// In general, hashers are categorized as either cryptographically secure or not. The
|
||||
@@ -2149,10 +2158,11 @@ pub mod pezpallet_macros {
|
||||
///
|
||||
/// Internally, every storage type generates a "prefix". This prefix serves as the initial
|
||||
/// segment of the key utilized to store values in the on-chain state (i.e., the final key
|
||||
/// used in [`pezsp_io::storage`](pezsp_io::storage)). For all storage types, the following rule
|
||||
/// applies:
|
||||
/// used in [`pezsp_io::storage`](pezsp_io::storage)). For all storage types, the following
|
||||
/// rule applies:
|
||||
///
|
||||
/// > The storage prefix begins with `twox128(pezpallet_prefix) ++ twox128(STORAGE_PREFIX)`,
|
||||
/// > The storage prefix begins with `twox128(pezpallet_prefix) ++
|
||||
/// > twox128(STORAGE_PREFIX)`,
|
||||
/// > where
|
||||
/// > `pezpallet_prefix` is the name assigned to the pezpallet instance in
|
||||
/// > [`pezframe_support::construct_runtime`](pezframe_support::construct_runtime), and
|
||||
@@ -2160,9 +2170,9 @@ pub mod pezpallet_macros {
|
||||
/// > as
|
||||
/// > `Foo` in `type Foo<T> = StorageValue<..>`.
|
||||
///
|
||||
/// For [`StorageValue`](pezframe_support::storage::types::StorageValue), no additional key is
|
||||
/// required. For map types, the prefix is extended with one or more keys defined by the
|
||||
/// map.
|
||||
/// For [`StorageValue`](pezframe_support::storage::types::StorageValue), no additional key
|
||||
/// is required. For map types, the prefix is extended with one or more keys defined by
|
||||
/// the map.
|
||||
///
|
||||
/// #### Example
|
||||
#[doc = docify::embed!("src/lib.rs", example_storage_value_map_prefixes)]
|
||||
@@ -2197,8 +2207,8 @@ pub mod pezpallet_macros {
|
||||
///
|
||||
/// ## Note on deprecation of storage items
|
||||
///
|
||||
/// - Usage of `deprecated` attribute will propagate deprecation information to the pezpallet
|
||||
/// metadata where the storage item was declared.
|
||||
/// - Usage of `deprecated` attribute will propagate deprecation information to the
|
||||
/// pezpallet metadata where the storage item was declared.
|
||||
/// - For general usage examples of `deprecated` attribute please refer to <https://doc.rust-lang.org/nightly/reference/attributes/diagnostics.html#the-deprecated-attribute>
|
||||
/// - Usage of `allow(deprecated)` on the item will propagate this attribute to the
|
||||
/// generated code.
|
||||
@@ -2270,7 +2280,9 @@ pub mod pezpallet_macros {
|
||||
pub use pezframe_support_procedural::origin;
|
||||
}
|
||||
|
||||
#[deprecated(note = "Will be removed after July 2023; Use `pezsp_runtime::traits` directly instead.")]
|
||||
#[deprecated(
|
||||
note = "Will be removed after July 2023; Use `pezsp_runtime::traits` directly instead."
|
||||
)]
|
||||
pub mod error {
|
||||
#[doc(hidden)]
|
||||
pub use pezsp_runtime::traits::{BadOrigin, LookupError};
|
||||
|
||||
@@ -264,14 +264,14 @@ pub fn migrate_from_pallet_version_to_storage_version<
|
||||
/// pezpallet.
|
||||
///
|
||||
/// This struct is generic over two parameters:
|
||||
/// - `P` is a type that implements the `Get` trait for a static string, representing the pezpallet's
|
||||
/// name.
|
||||
/// - `P` is a type that implements the `Get` trait for a static string, representing the
|
||||
/// pezpallet's name.
|
||||
/// - `DbWeight` is a type that implements the `Get` trait for `RuntimeDbWeight`, providing the
|
||||
/// weight for database operations.
|
||||
///
|
||||
/// On runtime upgrade, the `on_runtime_upgrade` function will clear all storage items associated
|
||||
/// with the specified pezpallet, logging the number of keys removed. If the `try-runtime` feature is
|
||||
/// enabled, the `pre_upgrade` and `post_upgrade` functions can be used to verify the storage
|
||||
/// with the specified pezpallet, logging the number of keys removed. If the `try-runtime` feature
|
||||
/// is enabled, the `pre_upgrade` and `post_upgrade` functions can be used to verify the storage
|
||||
/// removal before and after the upgrade.
|
||||
///
|
||||
/// # Examples:
|
||||
@@ -314,8 +314,8 @@ pub fn migrate_from_pallet_version_to_storage_version<
|
||||
pub struct RemovePallet<P: Get<&'static str>, DbWeight: Get<RuntimeDbWeight>>(
|
||||
PhantomData<(P, DbWeight)>,
|
||||
);
|
||||
impl<P: Get<&'static str>, DbWeight: Get<RuntimeDbWeight>> pezframe_support::traits::OnRuntimeUpgrade
|
||||
for RemovePallet<P, DbWeight>
|
||||
impl<P: Get<&'static str>, DbWeight: Get<RuntimeDbWeight>>
|
||||
pezframe_support::traits::OnRuntimeUpgrade for RemovePallet<P, DbWeight>
|
||||
{
|
||||
fn on_runtime_upgrade() -> pezframe_support::weights::Weight {
|
||||
let hashed_prefix = twox_128(P::get().as_bytes());
|
||||
@@ -369,8 +369,8 @@ impl<P: Get<&'static str>, DbWeight: Get<RuntimeDbWeight>> pezframe_support::tra
|
||||
/// `RemoveStorage` is a utility struct used to remove a storage item from a specific pezpallet.
|
||||
///
|
||||
/// This struct is generic over three parameters:
|
||||
/// - `P` is a type that implements the [`Get`] trait for a static string, representing the pezpallet's
|
||||
/// name.
|
||||
/// - `P` is a type that implements the [`Get`] trait for a static string, representing the
|
||||
/// pezpallet's name.
|
||||
/// - `S` is a type that implements the [`Get`] trait for a static string, representing the storage
|
||||
/// name.
|
||||
/// - `DbWeight` is a type that implements the [`Get`] trait for [`RuntimeDbWeight`], providing the
|
||||
@@ -721,8 +721,10 @@ pub trait SteppedMigrations {
|
||||
///
|
||||
/// Returns `None` if the index is out of bounds.
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn nth_post_upgrade(n: u32, _state: Vec<u8>)
|
||||
-> Option<Result<(), pezsp_runtime::TryRuntimeError>>;
|
||||
fn nth_post_upgrade(
|
||||
n: u32,
|
||||
_state: Vec<u8>,
|
||||
) -> Option<Result<(), pezsp_runtime::TryRuntimeError>>;
|
||||
|
||||
/// The maximal encoded length across all cursors.
|
||||
fn cursor_max_encoded_len() -> usize;
|
||||
@@ -882,7 +884,10 @@ impl<T: SteppedMigration> SteppedMigrations for T {
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn nth_post_upgrade(n: u32, state: Vec<u8>) -> Option<Result<(), pezsp_runtime::TryRuntimeError>> {
|
||||
fn nth_post_upgrade(
|
||||
n: u32,
|
||||
state: Vec<u8>,
|
||||
) -> Option<Result<(), pezsp_runtime::TryRuntimeError>> {
|
||||
if n != 0 {
|
||||
defensive!("nth_post_upgrade should only be called with n==0");
|
||||
}
|
||||
@@ -970,7 +975,10 @@ impl SteppedMigrations for Tuple {
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn nth_post_upgrade(n: u32, state: Vec<u8>) -> Option<Result<(), pezsp_runtime::TryRuntimeError>> {
|
||||
fn nth_post_upgrade(
|
||||
n: u32,
|
||||
state: Vec<u8>,
|
||||
) -> Option<Result<(), pezsp_runtime::TryRuntimeError>> {
|
||||
let mut i = 0;
|
||||
|
||||
for_tuples! ( #(
|
||||
|
||||
@@ -208,7 +208,8 @@ pub fn kill(child_info: &ChildInfo, key: &[u8]) {
|
||||
/// Get a Vec of bytes from storage.
|
||||
pub fn get_raw(child_info: &ChildInfo, key: &[u8]) -> Option<Vec<u8>> {
|
||||
match child_info.child_type() {
|
||||
ChildType::ParentKeyId => pezsp_io::default_child_storage::get(child_info.storage_key(), key),
|
||||
ChildType::ParentKeyId =>
|
||||
pezsp_io::default_child_storage::get(child_info.storage_key(), key),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -311,8 +311,8 @@ pub fn take_storage_item<K: Encode + Sized, T: Decode + Sized, H: StorageHasher>
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// If a pezpallet named "my_example" has 2 storages named "Foo" and "Bar" and the pezpallet is renamed
|
||||
/// "my_new_example_name", a migration can be:
|
||||
/// If a pezpallet named "my_example" has 2 storages named "Foo" and "Bar" and the pezpallet is
|
||||
/// renamed "my_new_example_name", a migration can be:
|
||||
/// ```
|
||||
/// # use pezframe_support::storage::migration::move_storage_from_pallet;
|
||||
/// # pezsp_io::TestExternalities::new_empty().execute_with(|| {
|
||||
|
||||
@@ -885,8 +885,9 @@ pub trait StorageNMap<K: KeyGenerator, V: FullCodec> {
|
||||
|
||||
/// Attempt to remove items from the map matching a `partial_key` prefix.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
|
||||
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
|
||||
/// deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given map, it is important that no further items
|
||||
/// are inserted into the map which match the `partial key`. If so, then the map may not be
|
||||
@@ -1391,8 +1392,9 @@ pub trait StoragePrefixedMap<Value: FullCodec> {
|
||||
|
||||
/// Attempt to remove all items from the map.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
|
||||
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
|
||||
/// deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given map, it is important that no further items
|
||||
/// are inserted into the map. If so, then the map may not be empty when the resultant
|
||||
@@ -1752,8 +1754,8 @@ mod test {
|
||||
use super::*;
|
||||
use crate::{assert_ok, hash::Identity, pezpallet_prelude::NMapKey, Twox128};
|
||||
use bounded_vec::BoundedVec;
|
||||
use pezframe_support::traits::ConstU32;
|
||||
use generator::StorageValue as _;
|
||||
use pezframe_support::traits::ConstU32;
|
||||
use pezsp_crypto_hashing::twox_128;
|
||||
use pezsp_io::TestExternalities;
|
||||
use weak_bounded_vec::WeakBoundedVec;
|
||||
|
||||
@@ -59,7 +59,10 @@ impl<'a> StorageNoopGuard<'a> {
|
||||
|
||||
/// Creates a new [`StorageNoopGuard`] with a custom error message.
|
||||
pub fn from_error_message(error_message: &'a str) -> Self {
|
||||
Self { storage_root: pezsp_io::storage::root(pezsp_runtime::StateVersion::V1), error_message }
|
||||
Self {
|
||||
storage_root: pezsp_io::storage::root(pezsp_runtime::StateVersion::V1),
|
||||
error_message,
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets a custom error message for a [`StorageNoopGuard`].
|
||||
|
||||
@@ -338,8 +338,9 @@ where
|
||||
|
||||
/// Attempt to remove all items from the map.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
|
||||
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
|
||||
/// deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given map, it is important that no further items
|
||||
/// are inserted into the map. If so, then the map may not be empty when the resultant
|
||||
|
||||
@@ -239,8 +239,9 @@ where
|
||||
|
||||
/// Attempt to remove items from the map matching a `partial_key` prefix.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
|
||||
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
|
||||
/// deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given map, it is important that no further items
|
||||
/// are inserted into the map which match the `partial key`. If so, then the map may not be
|
||||
@@ -401,8 +402,9 @@ where
|
||||
|
||||
/// Attempt to remove all items from the map.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
|
||||
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
|
||||
/// deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given map, it is important that no further items
|
||||
/// are inserted into the map. If so, then the map may not be empty when the resultant
|
||||
|
||||
@@ -330,8 +330,9 @@ where
|
||||
|
||||
/// Attempt to remove items from the map matching a `first_key` prefix.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
|
||||
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
|
||||
/// deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given map, it is important that no further items
|
||||
/// are inserted into the map which match the `first_key`. If so, then the map may not be
|
||||
@@ -523,8 +524,9 @@ where
|
||||
|
||||
/// Attempt to remove all items from the map.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
|
||||
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
|
||||
/// deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given map, it is important that no further items
|
||||
/// are inserted into the map. If so, then the map may not be empty when the resultant
|
||||
|
||||
@@ -89,8 +89,8 @@ where
|
||||
Key: FullCodec + MaxEncodedLen,
|
||||
{
|
||||
fn get() -> u32 {
|
||||
// The `max_len` of the key hash plus the pezpallet prefix and storage prefix (which both are
|
||||
// hashed with `Twox128`).
|
||||
// The `max_len` of the key hash plus the pezpallet prefix and storage prefix (which both
|
||||
// are hashed with `Twox128`).
|
||||
let z = Hasher::max_len::<Key>() + Twox128::max_len::<()>() * 2;
|
||||
z as u32
|
||||
}
|
||||
@@ -336,8 +336,9 @@ where
|
||||
|
||||
/// Attempt to remove all items from the map.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
|
||||
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
|
||||
/// deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given map, it is important that no further items
|
||||
/// are inserted into the map. If so, then the map may not be empty when the resultant
|
||||
|
||||
@@ -37,8 +37,8 @@ use pezsp_runtime::SaturatedConversion;
|
||||
/// A type representing an *NMap* in storage. This structure associates an arbitrary number of keys
|
||||
/// with a value of a specified type stored on-chain.
|
||||
///
|
||||
/// For example, [`StorageDoubleMap`](pezframe_support::storage::types::StorageDoubleMap) is a special
|
||||
/// case of an *NMap* with N = 2.
|
||||
/// For example, [`StorageDoubleMap`](pezframe_support::storage::types::StorageDoubleMap) is a
|
||||
/// special case of an *NMap* with N = 2.
|
||||
///
|
||||
/// For general information regarding the `#[pezpallet::storage]` attribute, refer to
|
||||
/// [`crate::pezpallet_macros::storage`].
|
||||
@@ -238,8 +238,9 @@ where
|
||||
|
||||
/// Attempt to remove items from the map matching a `partial_key` prefix.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
|
||||
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
|
||||
/// deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given map, it is important that no further items
|
||||
/// are inserted into the map which match the `partial key`. If so, then the map may not be
|
||||
@@ -402,8 +403,9 @@ where
|
||||
|
||||
/// Attempt to remove all items from the map.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result.
|
||||
/// Once the resultant `maybe_cursor` field is `None`, then no further items remain to be
|
||||
/// deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given map, it is important that no further items
|
||||
/// are inserted into the map. If so, then the map may not be empty when the resultant
|
||||
|
||||
@@ -127,8 +127,8 @@ pub fn kill_prefix(prefix: &[u8], limit: Option<u32>) -> pezsp_io::KillStorageRe
|
||||
/// cursor need not be passed in and a `None` may be passed instead. This exception may be useful
|
||||
/// then making this call solely from a block-hook such as `on_initialize`.
|
||||
///
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once the
|
||||
/// resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
/// Returns [`MultiRemovalResults`](pezsp_io::MultiRemovalResults) to inform about the result. Once
|
||||
/// the resultant `maybe_cursor` field is `None`, then no further items remain to be deleted.
|
||||
///
|
||||
/// NOTE: After the initial call for any given child storage, it is important that no keys further
|
||||
/// keys are inserted. If so, then they may or may not be deleted by subsequent calls.
|
||||
|
||||
@@ -128,8 +128,8 @@ fn pezpallet_name_attribute() {
|
||||
Value::<Runtime>::put(1);
|
||||
assert_eq!(1, Value::<Runtime>::get().unwrap());
|
||||
|
||||
// The prefix is the pezpallet name. In this case the pezpallet name is `System` as declared in
|
||||
// `construct_runtime!`.
|
||||
// The prefix is the pezpallet name. In this case the pezpallet name is `System` as declared
|
||||
// in `construct_runtime!`.
|
||||
assert_eq!(&b"System"[..], Value::<Runtime>::pezpallet_prefix());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ impl AggregatedKeyValue for () {
|
||||
|
||||
/// Allows to create a `ParameterStore` from a `RuntimeParameterStore`.
|
||||
///
|
||||
/// This concretization is useful when configuring pallets, since a pezpallet will require a parameter
|
||||
/// store for its own KV type and not the aggregated runtime-wide KV type.
|
||||
/// This concretization is useful when configuring pallets, since a pezpallet will require a
|
||||
/// parameter store for its own KV type and not the aggregated runtime-wide KV type.
|
||||
pub struct ParameterStoreAdapter<PS, KV>(core::marker::PhantomData<(PS, KV)>);
|
||||
|
||||
impl<PS, KV> ParameterStore<KV> for ParameterStoreAdapter<PS, KV>
|
||||
|
||||
@@ -25,16 +25,16 @@ use core::marker::PhantomData;
|
||||
/// ## Notes
|
||||
///
|
||||
/// The pezpallet error enum has a maximum encoded size as defined by
|
||||
/// [`pezframe_support::MAX_MODULE_ERROR_ENCODED_SIZE`]. If the pezpallet error type exceeds this size
|
||||
/// limit, a static assertion during compilation will fail. The compilation error will be in the
|
||||
/// format of `error[E0080]: evaluation of constant value failed` due to the usage of
|
||||
/// [`pezframe_support::MAX_MODULE_ERROR_ENCODED_SIZE`]. If the pezpallet error type exceeds this
|
||||
/// size limit, a static assertion during compilation will fail. The compilation error will be in
|
||||
/// the format of `error[E0080]: evaluation of constant value failed` due to the usage of
|
||||
/// const assertions.
|
||||
pub trait PalletError: Encode + Decode {
|
||||
/// The maximum encoded size for the implementing type.
|
||||
///
|
||||
/// This will be used to check whether the pezpallet error type is less than or equal to
|
||||
/// [`pezframe_support::MAX_MODULE_ERROR_ENCODED_SIZE`], and if it is, a compilation error will be
|
||||
/// thrown.
|
||||
/// [`pezframe_support::MAX_MODULE_ERROR_ENCODED_SIZE`], and if it is, a compilation error will
|
||||
/// be thrown.
|
||||
const MAX_ENCODED_SIZE: usize;
|
||||
}
|
||||
|
||||
|
||||
@@ -397,8 +397,8 @@ impl_for_tuples_attr! {
|
||||
/// > because they are not part of the consensus/main block building logic. See
|
||||
/// > [`OffchainWorker`](crate::traits::misc::OffchainWorker) for more information.
|
||||
///
|
||||
/// To learn more about the execution of hooks see the FRAME `Executive` pezpallet which is in charge
|
||||
/// of dispatching extrinsics and calling hooks in the correct order.
|
||||
/// To learn more about the execution of hooks see the FRAME `Executive` pezpallet which is in
|
||||
/// charge of dispatching extrinsics and calling hooks in the correct order.
|
||||
pub trait Hooks<BlockNumber> {
|
||||
/// Block initialization hook. This is called at the very beginning of block execution.
|
||||
///
|
||||
@@ -414,8 +414,8 @@ pub trait Hooks<BlockNumber> {
|
||||
/// complexity. For example, do not execute any unbounded iterations.
|
||||
///
|
||||
/// NOTE: This function is called BEFORE ANY extrinsic in a block is applied, including inherent
|
||||
/// extrinsics. Hence for instance, if you runtime includes `pezpallet-timestamp`, the `timestamp`
|
||||
/// is not yet up to date at this point.
|
||||
/// extrinsics. Hence for instance, if you runtime includes `pezpallet-timestamp`, the
|
||||
/// `timestamp` is not yet up to date at this point.
|
||||
fn on_initialize(_n: BlockNumber) -> Weight {
|
||||
Weight::zero()
|
||||
}
|
||||
@@ -461,9 +461,9 @@ pub trait Hooks<BlockNumber> {
|
||||
/// Hook executed when a code change (aka. a "runtime upgrade") is detected by the FRAME
|
||||
/// `Executive` pezpallet.
|
||||
///
|
||||
/// Be aware that this is called before [`Hooks::on_initialize`] of any pezpallet; therefore, a lot
|
||||
/// of the critical storage items such as `block_number` in system pezpallet might have not been
|
||||
/// set yet.
|
||||
/// Be aware that this is called before [`Hooks::on_initialize`] of any pezpallet; therefore, a
|
||||
/// lot of the critical storage items such as `block_number` in system pezpallet might have not
|
||||
/// been set yet.
|
||||
///
|
||||
/// Similar to [`Hooks::on_initialize`], any code in this block is mandatory and MUST execute.
|
||||
/// It is strongly recommended to dry-run the execution of these hooks using
|
||||
|
||||
@@ -23,10 +23,10 @@ use crate::defensive;
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, FullCodec, MaxEncodedLen};
|
||||
use core::{cmp::Ordering, fmt::Debug, marker::PhantomData};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_core::{ConstU32, Get, TypedGet};
|
||||
use pezsp_runtime::{traits::Convert, BoundedSlice, RuntimeDebug};
|
||||
use pezsp_weights::{Weight, WeightMeter};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// Errors that can happen when attempting to process a message with
|
||||
/// [`ProcessMessage::process_message()`].
|
||||
|
||||
@@ -185,7 +185,10 @@ impl StorageVersion {
|
||||
/// See [`STORAGE_VERSION_STORAGE_KEY_POSTFIX`] on how this key is built.
|
||||
pub fn storage_key<P: PalletInfoAccess>() -> [u8; 32] {
|
||||
let pezpallet_name = P::name();
|
||||
crate::storage::storage_prefix(pezpallet_name.as_bytes(), STORAGE_VERSION_STORAGE_KEY_POSTFIX)
|
||||
crate::storage::storage_prefix(
|
||||
pezpallet_name.as_bytes(),
|
||||
STORAGE_VERSION_STORAGE_KEY_POSTFIX,
|
||||
)
|
||||
}
|
||||
|
||||
/// Put this storage version for the given pezpallet into the storage.
|
||||
@@ -268,8 +271,8 @@ impl Add<u16> for StorageVersion {
|
||||
/// If you (the reader) end up here, it probably means that you tried to compare
|
||||
/// [`GetStorageVersion::on_chain_storage_version`] against
|
||||
/// [`GetStorageVersion::in_code_storage_version`]. This basically means that the
|
||||
/// [`storage_version`](crate::pezpallet_macros::storage_version) is missing from the pezpallet where the
|
||||
/// mentioned functions are being called, and needs to be defined.
|
||||
/// [`storage_version`](crate::pezpallet_macros::storage_version) is missing from the pezpallet
|
||||
/// where the mentioned functions are being called, and needs to be defined.
|
||||
#[derive(Debug, Default)]
|
||||
pub struct NoStorageVersionSet;
|
||||
|
||||
@@ -279,8 +282,8 @@ pub struct NoStorageVersionSet;
|
||||
/// 1. An in-code storage version
|
||||
/// 2. An on-chain storage version
|
||||
///
|
||||
/// The in-code storage version is the version of the pezpallet as defined in the runtime blob, and the
|
||||
/// on-chain storage version is the version of the pezpallet stored on-chain.
|
||||
/// The in-code storage version is the version of the pezpallet as defined in the runtime blob, and
|
||||
/// the on-chain storage version is the version of the pezpallet stored on-chain.
|
||||
///
|
||||
/// Storage versions should be only ever be out of sync when a pezpallet has been updated to a new
|
||||
/// version and the in-code version is incremented, but the migration has not yet been executed
|
||||
@@ -291,16 +294,17 @@ pub struct NoStorageVersionSet;
|
||||
pub trait GetStorageVersion {
|
||||
/// This type is generated by the [`pezpallet`](crate::pezpallet) macro.
|
||||
///
|
||||
/// If the [`storage_version`](crate::pezpallet_macros::storage_version) attribute isn't specified,
|
||||
/// this is set to [`NoStorageVersionSet`] to signify that it is missing.
|
||||
/// If the [`storage_version`](crate::pezpallet_macros::storage_version) attribute isn't
|
||||
/// specified, this is set to [`NoStorageVersionSet`] to signify that it is missing.
|
||||
///
|
||||
/// If the [`storage_version`](crate::pezpallet_macros::storage_version) attribute is specified,
|
||||
/// this is be set to a [`StorageVersion`] corresponding to the attribute.
|
||||
///
|
||||
/// The intention of using [`NoStorageVersionSet`] instead of defaulting to a [`StorageVersion`]
|
||||
/// of zero is to prevent developers from forgetting to set
|
||||
/// [`storage_version`](crate::pezpallet_macros::storage_version) when it is required, like in the
|
||||
/// case that they wish to compare the in-code storage version to the on-chain storage version.
|
||||
/// [`storage_version`](crate::pezpallet_macros::storage_version) when it is required, like in
|
||||
/// the case that they wish to compare the in-code storage version to the on-chain storage
|
||||
/// version.
|
||||
type InCodeStorageVersion;
|
||||
|
||||
#[deprecated(
|
||||
|
||||
@@ -21,9 +21,9 @@ use crate::dispatch::{DispatchResult, Parameter};
|
||||
use alloc::{vec, vec::Vec};
|
||||
use codec::{CompactLen, Decode, DecodeLimit, Encode, EncodeLike, Input, MaxEncodedLen};
|
||||
use impl_trait_for_tuples::impl_for_tuples;
|
||||
use scale_info::{build::Fields, meta_type, Path, Type, TypeInfo, TypeParameter};
|
||||
use pezsp_arithmetic::traits::{CheckedAdd, CheckedMul, CheckedSub, One, Saturating};
|
||||
use pezsp_core::bounded::bounded_vec::TruncateFrom;
|
||||
use scale_info::{build::Fields, meta_type, Path, Type, TypeInfo, TypeParameter};
|
||||
|
||||
use core::cmp::Ordering;
|
||||
#[doc(hidden)]
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
|
||||
use alloc::borrow::Cow;
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, EncodeLike, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_core::RuntimeDebug;
|
||||
use pezsp_runtime::{
|
||||
traits::{ConstU32, Hash},
|
||||
DispatchError,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
pub type BoundedInline = crate::BoundedVec<u8, ConstU32<128>>;
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ use core::marker::PhantomData;
|
||||
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, FullCodec, MaxEncodedLen};
|
||||
use pezframe_support::{CloneNoBound, EqNoBound, Parameter, PartialEqNoBound};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_core::ConstU32;
|
||||
use pezsp_runtime::{traits::Member, BoundedVec, DispatchError, DispatchResult, RuntimeDebug};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// Identity of personhood.
|
||||
///
|
||||
|
||||
@@ -22,8 +22,8 @@ use super::PreimageProvider;
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Codec, Decode, DecodeWithMemTracking, Encode, EncodeLike, MaxEncodedLen};
|
||||
use core::{fmt::Debug, result::Result};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{traits::Saturating, DispatchError, RuntimeDebug};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// Information relating to the period of a scheduled task. First item is the length of the
|
||||
/// period and the second is the number of times it should be executed in total before the task
|
||||
|
||||
@@ -20,20 +20,20 @@
|
||||
use alloc::{collections::btree_set::BTreeSet, vec, vec::Vec};
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, FullCodec, MaxEncodedLen};
|
||||
use core::{marker::PhantomData, mem, ops::Drop};
|
||||
use pezframe_support::CloneNoBound;
|
||||
use impl_trait_for_tuples::impl_for_tuples;
|
||||
use scale_info::TypeInfo;
|
||||
use pezframe_support::CloneNoBound;
|
||||
pub use pezsp_core::storage::TrackedStorageKey;
|
||||
use pezsp_core::Get;
|
||||
use pezsp_runtime::{
|
||||
traits::{Convert, Member},
|
||||
DispatchError, RuntimeDebug,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// An instance of a pezpallet in the storage.
|
||||
///
|
||||
/// It is required that these instances are unique, to support multiple instances per pezpallet in the
|
||||
/// same runtime!
|
||||
/// It is required that these instances are unique, to support multiple instances per pezpallet in
|
||||
/// the same runtime!
|
||||
///
|
||||
/// E.g. for module MyModule default instance will have prefix "MyModule" and other instances
|
||||
/// "InstanceNMyModule".
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
use alloc::{vec, vec::IntoIter};
|
||||
use codec::FullCodec;
|
||||
use core::{fmt::Debug, iter::Iterator};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::DispatchError;
|
||||
use pezsp_weights::Weight;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// Contain's re-exports of all the supporting types for the [`Task`] trait. Used in the macro
|
||||
/// expansion of `RuntimeTask`.
|
||||
@@ -32,9 +32,9 @@ pub mod __private {
|
||||
pub use alloc::{vec, vec::IntoIter};
|
||||
pub use codec::FullCodec;
|
||||
pub use core::{fmt::Debug, iter::Iterator};
|
||||
pub use scale_info::TypeInfo;
|
||||
pub use pezsp_runtime::DispatchError;
|
||||
pub use pezsp_weights::Weight;
|
||||
pub use scale_info::TypeInfo;
|
||||
}
|
||||
|
||||
/// A general-purpose trait which defines a type of service work (i.e., work to performed by an
|
||||
|
||||
@@ -37,11 +37,12 @@
|
||||
//!
|
||||
//! ### Usage Example
|
||||
//!
|
||||
//! This example shows how to interact with pezpallet-uniques (assuming the pezpallet called Uniques in
|
||||
//! the chain’s Runtime) via the asset ops.
|
||||
//! This example shows how to interact with pezpallet-uniques (assuming the pezpallet called Uniques
|
||||
//! in the chain’s Runtime) via the asset ops.
|
||||
//!
|
||||
//! If you are interested in the implementation example, you can look at the pezpallet-uniques
|
||||
//! implementation. You can check out the pezpallet-uniques tests if you want more examples of usage.
|
||||
//! implementation. You can check out the pezpallet-uniques tests if you want more examples of
|
||||
//! usage.
|
||||
//!
|
||||
//! ```rust,ignore
|
||||
//! type Collection = pezpallet_uniques::asset_ops::Collection<Uniques>;
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
use super::*;
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_core::RuntimeDebug;
|
||||
use pezsp_runtime::traits::Convert;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// The `CheckState` is a strategy that accepts an `Inspect` value and the `Inner` strategy.
|
||||
///
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
//! The reservable currency trait.
|
||||
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_core::Get;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
use super::{super::misc::BalanceStatus, Currency};
|
||||
use crate::{
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
//! See the [`crate::traits::fungible`] doc for more information about fungible traits
|
||||
//! including the place of the Freezes in FRAME.
|
||||
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_arithmetic::{
|
||||
traits::{CheckedAdd, CheckedSub},
|
||||
ArithmeticError,
|
||||
};
|
||||
use pezsp_runtime::{DispatchResult, TokenError};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
use crate::{ensure, traits::tokens::Fortitude};
|
||||
|
||||
|
||||
@@ -31,12 +31,12 @@ use crate::{
|
||||
Restriction::{self, Free, OnHold},
|
||||
},
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_arithmetic::{
|
||||
traits::{CheckedAdd, CheckedSub, Zero},
|
||||
ArithmeticError,
|
||||
};
|
||||
use pezsp_runtime::{DispatchError, DispatchResult, Saturating, TokenError};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -181,7 +181,8 @@ impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalance
|
||||
/// Converts a `fungibles` `imbalance` instance to an instance of a `fungible` imbalance type.
|
||||
///
|
||||
/// This function facilitates imbalance conversions within the implementations of
|
||||
/// [`pezframe_support::traits::fungibles::UnionOf`], [`pezframe_support::traits::fungible::UnionOf`], and
|
||||
/// [`pezframe_support::traits::fungibles::UnionOf`],
|
||||
/// [`pezframe_support::traits::fungible::UnionOf`], and
|
||||
/// [`pezframe_support::traits::fungible::ItemOf`] adapters. It is intended only for internal use
|
||||
/// within the current crate.
|
||||
pub(crate) fn from_fungibles<
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
//! Adapter to use `fungibles::*` implementations as `fungible::*`.
|
||||
//!
|
||||
//! This allows for a `fungibles` asset, e.g. from the `pezpallet_assets` pezpallet, to be used when a
|
||||
//! `fungible` asset is expected.
|
||||
//! This allows for a `fungibles` asset, e.g. from the `pezpallet_assets` pezpallet, to be used when
|
||||
//! a `fungible` asset is expected.
|
||||
//!
|
||||
//! See the [`crate::traits::fungible`] doc for more information about fungible traits.
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
//! transfer.
|
||||
//!
|
||||
//! - **Held Balance**: Held balance still belongs to the account holder, but is suspended — it
|
||||
//! cannot be transferred or used for most operations. It may be slashed by the pezpallet that placed
|
||||
//! the hold.
|
||||
//! cannot be transferred or used for most operations. It may be slashed by the pezpallet that
|
||||
//! placed the hold.
|
||||
//!
|
||||
//! Multiple holds stack rather than overlay. This means that if an account has
|
||||
//! 3 holds for 100 units, the account can spend its funds for any reason down to 300 units, at
|
||||
@@ -164,9 +164,9 @@ mod union_of;
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
|
||||
use core::marker::PhantomData;
|
||||
use pezframe_support_procedural::{CloneNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound};
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use pezsp_runtime::Saturating;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
use super::{
|
||||
Fortitude::{Force, Polite},
|
||||
@@ -179,12 +179,12 @@ pub use hold::{
|
||||
};
|
||||
pub use imbalance::{Credit, Debt, HandleImbalanceDrop, Imbalance};
|
||||
pub use item_of::ItemOf;
|
||||
pub use regular::{
|
||||
Balanced, DecreaseIssuance, Dust, IncreaseIssuance, Inspect, Mutate, Unbalanced,
|
||||
};
|
||||
use pezsp_arithmetic::traits::Zero;
|
||||
use pezsp_core::Get;
|
||||
use pezsp_runtime::{traits::Convert, DispatchError};
|
||||
pub use regular::{
|
||||
Balanced, DecreaseIssuance, Dust, IncreaseIssuance, Inspect, Mutate, Unbalanced,
|
||||
};
|
||||
pub use union_of::{NativeFromLeft, NativeOrWithId, UnionOf};
|
||||
|
||||
#[cfg(feature = "experimental")]
|
||||
|
||||
@@ -30,13 +30,13 @@ use pezframe_support::traits::{
|
||||
},
|
||||
AccountTouch,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
traits::Convert,
|
||||
DispatchError, DispatchResult, Either,
|
||||
Either::{Left, Right},
|
||||
RuntimeDebug,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// The `NativeOrWithId` enum classifies an asset as either `Native` to the current chain or as an
|
||||
/// asset with a specific ID.
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
//! See the [`crate::traits::fungibles`] doc for more information about fungibles traits.
|
||||
|
||||
use crate::{ensure, traits::tokens::Fortitude};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_arithmetic::{
|
||||
traits::{CheckedAdd, CheckedSub},
|
||||
ArithmeticError,
|
||||
};
|
||||
use pezsp_runtime::{DispatchResult, TokenError};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// Trait for inspecting a fungible asset which can be frozen. Freezing is essentially setting a
|
||||
/// minimum balance below which the total balance (inclusive of any funds placed on hold) may not
|
||||
|
||||
@@ -30,12 +30,12 @@ use crate::{
|
||||
Restriction::{self, Free, OnHold},
|
||||
},
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_arithmetic::{
|
||||
traits::{CheckedAdd, CheckedSub, Zero},
|
||||
ArithmeticError,
|
||||
};
|
||||
use pezsp_runtime::{DispatchError, DispatchResult, Saturating, TokenError};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -195,7 +195,8 @@ impl<
|
||||
/// a specified `asset`.
|
||||
///
|
||||
/// This function facilitates imbalance conversions within the implementations of
|
||||
/// [`pezframe_support::traits::fungibles::UnionOf`], [`pezframe_support::traits::fungible::UnionOf`], and
|
||||
/// [`pezframe_support::traits::fungibles::UnionOf`],
|
||||
/// [`pezframe_support::traits::fungible::UnionOf`], and
|
||||
/// [`pezframe_support::traits::fungible::ItemOf`] adapters. It is intended only for internal use
|
||||
/// within the current crate.
|
||||
pub(crate) fn from_fungible<
|
||||
@@ -217,7 +218,8 @@ pub(crate) fn from_fungible<
|
||||
/// Converts a `fungibles` `imbalance` instance of one type to another using a specified `asset`.
|
||||
///
|
||||
/// This function facilitates imbalance conversions within the implementations of
|
||||
/// [`pezframe_support::traits::fungibles::UnionOf`], [`pezframe_support::traits::fungible::UnionOf`], and
|
||||
/// [`pezframe_support::traits::fungibles::UnionOf`],
|
||||
/// [`pezframe_support::traits::fungible::UnionOf`], and
|
||||
/// [`pezframe_support::traits::fungible::ItemOf`] adapters. It is intended only for internal use
|
||||
/// within the current crate.
|
||||
pub(crate) fn from_fungibles<
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
use codec::{FullCodec, MaxEncodedLen};
|
||||
use core::fmt::Debug;
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_core::TypedGet;
|
||||
use pezsp_runtime::DispatchError;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
use super::{fungible, fungibles, Balance, Preservation::Expendable};
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
use crate::pezpallet_prelude::{Decode, Encode};
|
||||
use core::fmt::Debug;
|
||||
use pezframe_support::traits::tokens::PaymentStatus;
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_debug_derive::RuntimeDebug;
|
||||
use pezsp_runtime::codec::{FullCodec, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// Is intended to be implemented using a `fungible` impl, but can also be implemented with
|
||||
/// XCM/Asset and made generic over assets.
|
||||
|
||||
@@ -49,8 +49,8 @@ pub trait VoteTally<Votes, Class> {
|
||||
/// A function that should be called before any use of the `runtime-benchmarks` gated functions
|
||||
/// of the `VoteTally` trait.
|
||||
///
|
||||
/// Should be used to set up any needed state in a Pezpallet which implements `VoteTally` so that
|
||||
/// benchmarks that execute will complete successfully. `class` can be used to set up a
|
||||
/// Should be used to set up any needed state in a Pezpallet which implements `VoteTally` so
|
||||
/// that benchmarks that execute will complete successfully. `class` can be used to set up a
|
||||
/// particular class of voters, and `granularity` is used to determine the weight of one vote
|
||||
/// relative to total unanimity.
|
||||
///
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Decode, DecodeAll, Encode, Output};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::RuntimeDebug;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// The unique identifier for a view function.
|
||||
#[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
|
||||
@@ -28,7 +28,8 @@ pub struct ViewFunctionId {
|
||||
/// The part of the id for dispatching view functions from the top level of the runtime.
|
||||
///
|
||||
/// Specifies which view function grouping this view function belongs to. This could be a group
|
||||
/// of view functions associated with a pezpallet, or a pezpallet agnostic group of view functions.
|
||||
/// of view functions associated with a pezpallet, or a pezpallet agnostic group of view
|
||||
/// functions.
|
||||
pub prefix: [u8; 16],
|
||||
/// The part of the id for dispatching to a view function within a group.
|
||||
pub suffix: [u8; 16],
|
||||
@@ -61,8 +62,8 @@ impl From<codec::Error> for ViewFunctionDispatchError {
|
||||
}
|
||||
|
||||
/// Implemented by both pallets and the runtime. The runtime is dispatching by prefix using the
|
||||
/// pezpallet implementation of `ViewFunctionIdPrefix` then the pezpallet is dispatching by suffix using
|
||||
/// the methods implementation of `ViewFunctionIdSuffix`.
|
||||
/// pezpallet implementation of `ViewFunctionIdPrefix` then the pezpallet is dispatching by suffix
|
||||
/// using the methods implementation of `ViewFunctionIdSuffix`.
|
||||
///
|
||||
/// In more details, `ViewFunctionId` = `ViewFunctionIdPrefix` ++ `ViewFunctionIdSuffix`, where
|
||||
/// `ViewFunctionIdPrefix=twox_128(pezpallet_name)` and
|
||||
|
||||
Reference in New Issue
Block a user