fix: Complete snowbridge pezpallet rebrand and critical bug fixes

- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs)
- pallet/ directories → pezpallet/ (4 locations)
- Fixed pezpallet.rs self-include recursion bug
- Fixed sc-chain-spec hardcoded crate name in derive macro
- Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API)
- Added BizinikiwiConfig type alias for zombienet tests
- Deleted obsolete session state files

Verified: pezsnowbridge-pezpallet-*, pezpallet-staking,
pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
This commit is contained in:
2025-12-16 09:57:23 +03:00
parent eea003e14d
commit 3139ffa25e
3022 changed files with 42157 additions and 23579 deletions
@@ -6,7 +6,7 @@ edition.workspace = true
license = "MIT-0"
homepage.workspace = true
repository.workspace = true
description = "FRAME example pallet"
description = "FRAME example pezpallet"
readme = "README.md"
publish = false
documentation = "https://docs.rs/pezpallet-example-basic"
+31 -31
View File
@@ -1,13 +1,13 @@
<!-- markdown-link-check-disable -->
# Basic Example Pallet
# Basic Example Pezpallet
<!-- Original author of paragraph: @gavofyork -->
The Example: A simple example of a FRAME pallet demonstrating
The Example: A simple example of a FRAME pezpallet demonstrating
concepts, APIs and structures common to most FRAME runtimes.
Run `cargo doc --package pezpallet-example-basic --open` to view this pallet's documentation.
Run `cargo doc --package pezpallet-example-basic --open` to view this pezpallet's documentation.
**This pallet serves as an example and is not meant to be used in production.**
**This pezpallet serves as an example and is not meant to be used in production.**
## Documentation Guidelines
@@ -15,8 +15,8 @@ Run `cargo doc --package pezpallet-example-basic --open` to view this pallet's d
<!-- label 'S3-FRAME' -->
<ul>
<li>Documentation comments (i.e. <code>/// comment</code>) - should
accompany pallet functions and be restricted to the pallet interface,
not the internals of the pallet implementation. Only state inputs,
accompany pezpallet functions and be restricted to the pezpallet interface,
not the internals of the pezpallet implementation. Only state inputs,
outputs, and a brief description that mentions whether calling it
requires root, but without repeating the source code details.
Capitalize the first word of each documentation comment and end it with
@@ -37,15 +37,15 @@ Run `cargo doc --package pezpallet-example-basic --open` to view this pallet's d
### Documentation Template:<br>
Copy and paste this template from frame/examples/basic/src/lib.rs into file
`frame/<INSERT_CUSTOM_PALLET_NAME>/src/lib.rs` of your own custom pallet and complete it.
`frame/<INSERT_CUSTOM_PALLET_NAME>/src/lib.rs` of your own custom pezpallet and complete it.
<details><p><pre>
// Add heading with custom pallet name
// Add heading with custom pezpallet name
\# <INSERT_CUSTOM_PALLET_NAME> Pallet
\# <INSERT_CUSTOM_PALLET_NAME> Pezpallet
// Add simple description
// Include the following links that shows what trait needs to be implemented to use the pallet
// Include the following links that shows what trait needs to be implemented to use the pezpallet
// and the supported dispatchables that are documented in the Call enum.
- \[`<INSERT_CUSTOM_PALLET_NAME>::Config`](https://docs.rs/pezpallet-example-basic/latest/pallet_example_basic/trait.Config.html)
@@ -55,11 +55,11 @@ Copy and paste this template from frame/examples/basic/src/lib.rs into file
\## Overview
<!-- Original author of paragraph: Various. See https://github.com/pezkuwichain/kurdistan-sdk/issues/1 -->
// Short description of pallet's purpose.
// Short description of pezpallet's purpose.
// Links to Traits that should be implemented.
// What this pallet is for.
// What functionality the pallet provides.
// When to use the pallet (use case examples).
// What this pezpallet is for.
// What functionality the pezpallet provides.
// When to use the pezpallet (use case examples).
// How it is used.
// Inputs it uses and the source of each input.
// Outputs it produces.
@@ -69,18 +69,18 @@ Copy and paste this template from frame/examples/basic/src/lib.rs into file
\## Terminology
// Add terminology used in the custom pallet. Include concepts, storage items, or actions that you think
// deserve to be noted to give context to the rest of the documentation or pallet usage. The author needs to
// Add terminology used in the custom pezpallet. Include concepts, storage items, or actions that you think
// deserve to be noted to give context to the rest of the documentation or pezpallet usage. The author needs to
// use some judgment about what is included. We don't want a list of every storage item nor types - the user
// can go to the code for that. For example, "transfer fee" is obvious and should not be included, but
// "free balance" and "reserved balance" should be noted to give context to the pallet.
// "free balance" and "reserved balance" should be noted to give context to the pezpallet.
// Please do not link to outside resources. The reference docs should be the ultimate source of truth.
<!-- Original author of heading: @Kianenigma in PR https://github.com/pezkuwichain/kurdistan-sdk/issues/52 -->
\## Goals
// Add goals that the custom pallet is designed to achieve.
// Add goals that the custom pezpallet is designed to achieve.
<!-- Original author of heading: @Kianenigma in PR https://github.com/pezkuwichain/kurdistan-sdk/issues/52 -->
@@ -90,14 +90,14 @@ Copy and paste this template from frame/examples/basic/src/lib.rs into file
\#### <INSERT_SCENARIO_NAME>
// Describe requirements prior to interacting with the custom pallet.
// Describe the process of interacting with the custom pallet for this scenario and public API functions used.
// Describe requirements prior to interacting with the custom pezpallet.
// Describe the process of interacting with the custom pezpallet for this scenario and public API functions used.
\## Interface
\### Supported Origins
// What origins are used and supported in this pallet (root, signed, none)
// What origins are used and supported in this pezpallet (root, signed, none)
// i.e. root when <code>\`ensure_root\`</code> used
// i.e. none when <code>\`ensure_none\`</code> used
// i.e. signed when <code>\`ensure_signed\`</code> used
@@ -132,14 +132,14 @@ Copy and paste this template from frame/examples/basic/src/lib.rs into file
<!-- Original author of paragraph: @joepetrowski -->
// A link to the rustdoc and any notes about usage in the pallet, not for specific functions.
// For example, in the Balances Pallet: "Note that when using the publicly exposed functions,
// A link to the rustdoc and any notes about usage in the pezpallet, not for specific functions.
// For example, in the Balances Pezpallet: "Note that when using the publicly exposed functions,
// you (the runtime developer) are responsible for implementing any necessary checks
// (e.g. that the sender is the signer) before calling a function that will affect storage."
<!-- Original author of paragraph: @AmarRSingh -->
// It is up to the writer of the respective pallet (with respect to how much information to provide).
// It is up to the writer of the respective pezpallet (with respect to how much information to provide).
\#### Public Inspection functions - Immutable (getters)
@@ -166,19 +166,19 @@ Copy and paste this template from frame/examples/basic/src/lib.rs into file
\### Storage Items
// Explain any storage items included in this pallet
// Explain any storage items included in this pezpallet
\### Digest Items
// Explain any digest items included in this pallet
// Explain any digest items included in this pezpallet
\### Inherent Data
// Explain what inherent data (if any) is defined in the pallet and any other related types
// Explain what inherent data (if any) is defined in the pezpallet and any other related types
\### Events:
// Insert events for this pallet if any
// Insert events for this pezpallet if any
\### Errors:
@@ -187,12 +187,12 @@ Copy and paste this template from frame/examples/basic/src/lib.rs into file
\## Usage
// Insert 2-3 examples of usage and code snippets that show how to
// use <INSERT_CUSTOM_PALLET_NAME> Pallet in a custom pallet.
// use <INSERT_CUSTOM_PALLET_NAME> Pezpallet in a custom pezpallet.
\### Prerequisites
// Show how to include necessary imports for <INSERT_CUSTOM_PALLET_NAME> and derive
// your pallet configuration trait with the `INSERT_CUSTOM_PALLET_NAME` trait.
// your pezpallet configuration trait with the `INSERT_CUSTOM_PALLET_NAME` trait.
\```rust
use <INSERT_CUSTOM_PALLET_NAME>;
@@ -220,7 +220,7 @@ pub trait Config: <INSERT_CUSTOM_PALLET_NAME>::Config { }
// Dependencies on other FRAME pallets and the genesis config should be mentioned,
// but not the Rust Standard Library.
// Genesis configuration modifications that may be made to incorporate this pallet
// Genesis configuration modifications that may be made to incorporate this pezpallet
// Interaction with other pallets
<!-- Original author of heading: @AmarRSingh -->
@@ -30,12 +30,12 @@ use crate::*;
use pezframe_benchmarking::v2::*;
use pezframe_system::RawOrigin;
// To actually run this benchmark on pezpallet-example-basic, we need to put this pallet into the
// To actually run this benchmark on pezpallet-example-basic, 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/
//
// The auto-generated weight estimate of this pallet is copied over to the `weights.rs` file.
// The auto-generated weight estimate of this pezpallet is copied over to the `weights.rs` file.
// The exact command of how the estimate generated is printed at the top of the file.
// Details on using the benchmarks macro can be seen at:
@@ -120,5 +120,5 @@ mod benchmarks {
//
// The line generates three steps per benchmark, with repeat=1 and the three steps are
// [low, mid, high] of the range.
impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::tests::Test);
impl_benchmark_test_suite!(Pezpallet, crate::tests::new_test_ext(), crate::tests::Test);
}
+55 -55
View File
@@ -21,11 +21,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//! # Basic Example Pallet
//! # Basic Example Pezpallet
//!
//! A pallet demonstrating concepts, APIs and structures common to most FRAME runtimes.
//! A pezpallet demonstrating concepts, APIs and structures common to most FRAME runtimes.
//!
//! **This pallet serves as an example and is not meant to be used in production.**
//! **This pezpallet serves as an example and is not meant to be used in production.**
//!
//! > Made with *Bizinikiwi*, for *Pezkuwi*.
//!
@@ -35,20 +35,20 @@
//! [pezkuwi]: https://img.shields.io/badge/polkadot-E6007A?style=for-the-badge&logo=polkadot&logoColor=white
//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
//!
//! ## Pallet API
//! ## Pezpallet API
//!
//! See the [`pallet`] module for more information about the interfaces this pallet exposes,
//! See the [`pezpallet`] module for more information about the interfaces this pezpallet exposes,
//! including its configuration trait, dispatchables, storage items, events and errors.
//!
//! ## Overview
//!
//! This pallet provides basic examples of using:
//! This pezpallet provides basic examples of using:
//!
//! - A custom weight calculator able to classify a call's dispatch class (see:
//! [`pezframe_support::dispatch::DispatchClass`])
//! - Pallet hooks to implement some custom logic that's executed before and after a block is
//! - Pezpallet hooks to implement some custom logic that's executed before and after a block is
//! imported (see: [`pezframe_support::traits::Hooks`])
//! - Inherited weight annotation for pallet calls, used to create less repetition for calls that
//! - Inherited weight annotation for pezpallet calls, used to create less repetition for calls that
//! use the [`Config::WeightInfo`] trait to calculate call weights. This can also be overridden,
//! as demonstrated by [`Call::set_dummy`].
//! - A private function that performs a storage update.
@@ -83,8 +83,8 @@ use pezsp_runtime::{
transaction_validity::{InvalidTransaction, ValidTransaction},
};
// Re-export pallet items so that they can be accessed from the crate namespace.
pub use pallet::*;
// Re-export pezpallet items so that they can be accessed from the crate namespace.
pub use pezpallet::*;
#[cfg(test)]
mod tests;
@@ -93,7 +93,7 @@ mod benchmarking;
pub mod weights;
pub use weights::*;
/// A type alias for the balance type from this pallet's point of view.
/// A type alias for the balance type from this pezpallet's point of view.
type BalanceOf<T> = <T as pezpallet_balances::Config>::Balance;
const MILLICENTS: u32 = 1_000_000_000;
@@ -103,7 +103,7 @@ 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 `pallet::weight` expects whatever implements `WeighData<T>` to
// 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.
//
@@ -144,39 +144,39 @@ impl<T: pezpallet_balances::Config> PaysFee<(&BalanceOf<T>,)> for WeightForSetDu
}
}
// Definition of the pallet logic, to be aggregated at runtime definition through
// Definition of the pezpallet logic, to be aggregated at runtime definition through
// `construct_runtime`.
#[pezframe_support::pallet]
pub mod pallet {
// Import various types used to declare pallet in scope.
#[pezframe_support::pezpallet]
pub mod pezpallet {
// Import various types used to declare pezpallet in scope.
use super::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
/// Our pallet's configuration trait. All our types and constants go in here. If the
/// pallet is dependent on specific other pallets, then their configuration traits
/// Our pezpallet's configuration trait. All our types and constants go in here. If the
/// pezpallet is dependent on specific other pallets, then their configuration traits
/// should be added to our implied traits list.
///
/// `pezframe_system::Config` should always be included.
#[pallet::config]
#[pezpallet::config]
pub trait Config: pezpallet_balances::Config + pezframe_system::Config {
// Setting a constant config parameter from the runtime
#[pallet::constant]
#[pezpallet::constant]
type MagicNumber: Get<Self::Balance>;
/// Type representing the weight of this pallet
/// Type representing the weight of this pezpallet
type WeightInfo: WeightInfo;
}
// Simple declaration of the `Pallet` type. It is placeholder we use to implement traits and
// Simple declaration of the `Pezpallet` type. It is placeholder we use to implement traits and
// method.
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
pub struct Pezpallet<T>(_);
// This pallet implements the [`pezframe_support::traits::Hooks`] trait to define some logic to
// This pezpallet implements the [`pezframe_support::traits::Hooks`] trait to define some logic to
// execute in some context.
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
#[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
// dispatched.
//
@@ -199,7 +199,7 @@ pub mod pallet {
// We don't do anything here.
// but we could dispatch extrinsic (transaction/unsigned/inherent) using
// pezsp_io::submit_extrinsic.
// To see example on offchain worker, please refer to example-offchain-worker pallet
// To see example on offchain worker, please refer to example-offchain-worker pezpallet
// accompanied in this repository.
}
}
@@ -234,10 +234,10 @@ pub mod pallet {
// against them as the first thing you do in your function. There are three convenience calls
// in system that do the matching for you and return a convenient result: `ensure_signed`,
// `ensure_root` and `ensure_none`.
#[pallet::call(weight(<T as Config>::WeightInfo))]
impl<T: Config> Pallet<T> {
#[pezpallet::call(weight(<T as Config>::WeightInfo))]
impl<T: Config> Pezpallet<T> {
/// This is your public interface. Be extremely careful.
/// This is just a simple example of how to interact with the pallet from the external
/// This is just a simple example of how to interact with the pezpallet from the external
/// world.
// This just increases the value of `Dummy` by `increase_by`.
//
@@ -259,7 +259,7 @@ pub mod pallet {
// If you can't be certain that the operation will succeed without substantial computation
// then you have a classic blockchain attack scenario. The normal way of managing this is
// to attach a bond to the operation. As the first major alteration of storage, reserve
// some value from the sender's account (`Balances` Pallet has a `reserve` function for
// some value from the sender's account (`Balances` Pezpallet has a `reserve` function for
// exactly this scenario). This amount should be enough to cover any costs of the
// substantial execution in case it turns out that you can't proceed with the operation.
//
@@ -274,12 +274,12 @@ pub mod pallet {
//
// If you don't respect these rules, it is likely that your chain will be attackable.
//
// Each transaction must define a `#[pallet::weight(..)]` attribute to convey a set of
// static information about its dispatch. FRAME System and FRAME Executive pallet then use
// 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.
//
// The parenthesized value of the `#[pallet::weight(..)]` attribute can be any type that
// The parenthesized value of the `#[pezpallet::weight(..)]` attribute can be any type that
// implements a set of traits, namely [`WeighData`], [`ClassifyDispatch`], and
// [`PaysFee`]. The first conveys the weight (a numeric representation of pure
// execution time and difficulty) of the transaction and the second demonstrates the
@@ -289,7 +289,7 @@ pub mod pallet {
//
// The weight for this extrinsic we rely on the auto-generated `WeightInfo` from the
// benchmark toolchain.
#[pallet::call_index(0)]
#[pezpallet::call_index(0)]
pub fn accumulate_dummy(origin: OriginFor<T>, increase_by: T::Balance) -> DispatchResult {
// This is a public call, so we ensure that the origin is some signed account.
let _sender = ensure_signed(origin)?;
@@ -329,11 +329,11 @@ pub mod pallet {
//
// The weight for this extrinsic we use our own weight object `WeightForSetDummy` to
// determine its weight
#[pallet::call_index(1)]
#[pallet::weight(WeightForSetDummy::<T>(<BalanceOf<T>>::from(100u32)))]
#[pezpallet::call_index(1)]
#[pezpallet::weight(WeightForSetDummy::<T>(<BalanceOf<T>>::from(100u32)))]
pub fn set_dummy(
origin: OriginFor<T>,
#[pallet::compact] new_value: T::Balance,
#[pezpallet::compact] new_value: T::Balance,
) -> DispatchResult {
ensure_root(origin)?;
@@ -356,10 +356,10 @@ pub mod pallet {
/// Events are a simple means of reporting specific conditions and
/// circumstances that have happened that users, Dapps and/or chain explorers would find
/// interesting and otherwise difficult to detect.
#[pallet::event]
/// This attribute generate the function `deposit_event` to deposit one of this pallet event,
#[pezpallet::event]
/// This attribute generate the function `deposit_event` to deposit one of this pezpallet event,
/// it is optional, it is also possible to provide a custom implementation.
#[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
// Just a normal `enum`, here's a dummy event to ensure it compiles.
/// Dummy event, just here so there's a generic type that's used.
@@ -375,7 +375,7 @@ pub mod pallet {
},
}
// pallet::storage attributes allow for type-safe usage of the Bizinikiwi storage database,
// pezpallet::storage attributes allow for type-safe usage of the Bizinikiwi storage database,
// so you can keep things around between blocks.
//
// Any storage must be one of `StorageValue`, `StorageMap` or `StorageDoubleMap`.
@@ -387,22 +387,22 @@ pub mod pallet {
// - for `type Foo<T> = StorageValue<_, u32, ValueQuery>`:
// - `Foo::put(1); Foo::get()` returns `1`;
// - `Foo::kill(); Foo::get()` returns `0` (u32::default()).
#[pallet::storage]
#[pezpallet::storage]
pub(super) type Dummy<T: Config> = StorageValue<_, T::Balance>;
// A map that has enumerable entries.
#[pallet::storage]
#[pezpallet::storage]
pub(super) type Bar<T: Config> = StorageMap<_, Blake2_128Concat, T::AccountId, T::Balance>;
// this one uses the query kind: `ValueQuery`, we'll demonstrate the usage of 'mutate' API.
#[pallet::storage]
#[pezpallet::storage]
pub(super) type Foo<T: Config> = StorageValue<_, T::Balance, ValueQuery>;
#[pallet::storage]
#[pezpallet::storage]
pub type CountedMap<T> = CountedStorageMap<_, Blake2_128Concat, u8, u16>;
// The genesis config type.
#[pallet::genesis_config]
#[pezpallet::genesis_config]
#[derive(pezframe_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub dummy: T::Balance,
@@ -410,8 +410,8 @@ pub mod pallet {
pub foo: T::Balance,
}
// The build of genesis for the pallet.
#[pallet::genesis_build]
// The build of genesis for the pezpallet.
#[pezpallet::genesis_build]
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) {
<Dummy<T>>::put(&self.dummy);
@@ -423,12 +423,12 @@ pub mod pallet {
}
}
// The main implementation block for the pallet. Functions here fall into three broad
// The main implementation block for the pezpallet. Functions here fall into three broad
// categories:
// - Public interface. These are functions that are `pub` and generally fall into inspector
// functions that do not write to storage and operation functions that do.
// - Private functions. These are your usual private utilities unavailable to other pallets.
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
// Add public immutables and private mutables.
#[allow(dead_code)]
fn accumulate_foo(origin: T::RuntimeOrigin, increase_by: T::Balance) -> DispatchResult {
@@ -447,11 +447,11 @@ impl<T: Config> Pallet<T> {
}
}
// Similar to other FRAME pallets, your pallet can also define a transaction extension and perform
// 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 pallet:
// 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
@@ -466,7 +466,7 @@ impl<T: Config> Pallet<T> {
// Using the extension, you can add some hooks to the life cycle of each transaction. Note that by
// default, an extension is applied to all `Call` functions (i.e. all transactions). the `Call` enum
// variant is given to each function of `TransactionExtension`. Hence, you can filter based on
// pallet or a particular call if needed.
// pezpallet or a particular call if needed.
//
// Some extra information, such as encoded length, some static dispatch info like weight and the
// sender of the transaction (if signed) are also provided.
@@ -37,12 +37,12 @@ use pezsp_runtime::{
transaction_validity::TransactionSource::External,
BuildStorage,
};
// Reexport crate as its pallet name for construct_runtime.
// Reexport crate as its pezpallet name for construct_runtime.
use crate as pezpallet_example_basic;
type Block = pezframe_system::mocking::MockBlock<Test>;
// For testing the pallet, we construct a mock runtime.
// For testing the pezpallet, we construct a mock runtime.
pezframe_support::construct_runtime!(
pub enum Test
{
@@ -30,11 +30,11 @@
// Executed Command:
// ./target/release/bizinikiwi
// benchmark
// pallet
// pezpallet
// --chain=dev
// --execution=wasm
// --wasm-execution=compiled
// --pallet=pezpallet_example_basic
// --pezpallet=pezpallet_example_basic
// --extrinsic=*
// --steps=50
// --repeat=20