Apply local rebrand updates (compatible with pezkuwi-sdk)

This commit is contained in:
2026-01-11 19:33:32 +03:00
parent 2610f22b83
commit 1a81a0f2f7
23 changed files with 779 additions and 657 deletions
+29 -19
View File
@@ -1,46 +1,56 @@
[package]
name = "pallet-template"
description = "FRAME pallet template for defining custom runtime logic."
version = "0.1.0"
name = "pezpallet-template"
description = "FRAME pezpallet template for defining custom runtime logic."
version = "0.0.0"
license = "Unlicense"
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
publish = false
documentation = "https://docs.rs/pezpallet-template"
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[lints]
workspace = true
[dependencies]
codec = { features = ["derive"], workspace = true }
frame-benchmarking = { optional = true, workspace = true }
frame-support.workspace = true
frame-system.workspace = true
scale-info = { features = ["derive"], workspace = true }
# frame deps
pezframe-benchmarking = { optional = true, workspace = true }
pezframe-support = { workspace = true }
pezframe-system = { workspace = true }
[dev-dependencies]
sp-core = { default-features = true, workspace = true }
sp-io = { default-features = true, workspace = true }
sp-runtime = { default-features = true, workspace = true }
pezsp-core = { workspace = true, default-features = true }
pezsp-io = { workspace = true, default-features = true }
pezsp-runtime = { workspace = true, default-features = true }
[features]
default = ["std"]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"pezframe-benchmarking?/std",
"pezframe-support/std",
"pezframe-system/std",
"pezsp-core/std",
"pezsp-io/std",
"pezsp-runtime/std",
"scale-info/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pezframe-benchmarking/runtime-benchmarks",
"pezframe-support/runtime-benchmarks",
"pezframe-system/runtime-benchmarks",
"pezsp-io/runtime-benchmarks",
"pezsp-runtime/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
"pezframe-support/try-runtime",
"pezframe-system/try-runtime",
"pezsp-runtime/try-runtime",
]
+4 -4
View File
@@ -1,11 +1,11 @@
//! Benchmarking setup for pallet-template
//! Benchmarking setup for pezpallet-template
use super::*;
#[allow(unused)]
use crate::Pallet as Template;
use frame_benchmarking::v2::*;
use frame_system::RawOrigin;
use crate::Pezpallet as Template;
use pezframe_benchmarking::v2::*;
use pezframe_system::RawOrigin;
#[benchmarks]
mod benchmarks {
+74 -68
View File
@@ -1,12 +1,13 @@
//! # Template Pallet
//! # Template Pezpallet
//!
//! A pallet with minimal functionality to help developers understand the essential components of
//! writing a FRAME pallet. It is typically used in beginner tutorials or in Substrate template
//! nodes as a starting point for creating a new pallet and **not meant to be used in production**.
//! A pezpallet with minimal functionality to help developers understand the essential components of
//! writing a FRAME pezpallet. It is typically used in beginner tutorials or in Bizinikiwi template
//! nodes as a starting point for creating a new pezpallet and **not meant to be used in
//! production**.
//!
//! ## Overview
//!
//! This template pallet contains basic examples of:
//! This template pezpallet contains basic examples of:
//! - declaring a storage item that stores a single `u32` value
//! - declaring and using events
//! - declaring and using errors
@@ -14,97 +15,102 @@
//! upon success
//! - another dispatchable function that causes a custom error to be thrown
//!
//! Each pallet section is annotated with an attribute using the `#[pallet::...]` procedural macro.
//! This macro generates the necessary code for a pallet to be aggregated into a FRAME runtime.
//! Each pezpallet section is annotated with an attribute using the `#[pezpallet::...]` procedural
//! macro. This macro generates the necessary code for a pezpallet to be aggregated into a FRAME
//! runtime.
//!
//! Learn more about FRAME macros [here](https://docs.substrate.io/reference/frame-macros/).
//! Learn more about FRAME macros [here](https://docs.pezkuwichain.io/reference/frame-macros/).
//!
//! ### Pallet Sections
//! ### Pezpallet Sections
//!
//! The pallet sections in this template are:
//! The pezpallet sections in this template are:
//!
//! - A **configuration trait** that defines the types and parameters which the pallet depends on
//! (denoted by the `#[pallet::config]` attribute). See: [`Config`].
//! - A **means to store pallet-specific data** (denoted by the `#[pallet::storage]` attribute).
//! See: [`storage_types`].
//! - A **declaration of the events** this pallet emits (denoted by the `#[pallet::event]`
//! - A **configuration trait** that defines the types and parameters which the pezpallet depends on
//! (denoted by the `#[pezpallet::config]` attribute). See: [`Config`].
//! - A **means to store pezpallet-specific data** (denoted by the `#[pezpallet::storage]`
//! attribute). See: [`storage_types`].
//! - A **declaration of the events** this pezpallet emits (denoted by the `#[pezpallet::event]`
//! attribute). See: [`Event`].
//! - A **declaration of the errors** that this pallet can throw (denoted by the `#[pallet::error]`
//! attribute). See: [`Error`].
//! - A **set of dispatchable functions** that define the pallet's functionality (denoted by the
//! `#[pallet::call]` attribute). See: [`dispatchables`].
//! - A **declaration of the errors** that this pezpallet can throw (denoted by the
//! `#[pezpallet::error]` attribute). See: [`Error`].
//! - A **set of dispatchable functions** that define the pezpallet's functionality (denoted by the
//! `#[pezpallet::call]` attribute). See: [`dispatchables`].
//!
//! Run `cargo doc --package pallet-template --open` to view this pallet's documentation.
//! Run `cargo doc --package pezpallet-template --open` to view this pezpallet's documentation.
// We make sure this pallet uses `no_std` for compiling to Wasm.
// We make sure this pezpallet uses `no_std` for compiling to Wasm.
#![cfg_attr(not(feature = "std"), no_std)]
// 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::*;
// FRAME pallets require their own "mock runtimes" to be able to run unit tests. This module
// contains a mock runtime specific for testing this pallet's functionality.
// contains a mock runtime specific for testing this pezpallet's functionality.
#[cfg(test)]
mod mock;
// This module contains the unit tests for this pallet.
// Learn about pallet unit testing here: https://docs.substrate.io/test/unit-testing/
// This module contains the unit tests for this pezpallet.
// Learn about pezpallet unit testing here: https://docs.pezkuwichain.io/test/unit-testing/
#[cfg(test)]
mod tests;
// Every callable function or "dispatchable" a pallet exposes must have weight values that correctly
// estimate a dispatchable's execution time. The benchmarking module is used to calculate weights
// for each dispatchable and generates this pallet's weight.rs file. Learn more about benchmarking here: https://docs.substrate.io/test/benchmark/
// Every callable function or "dispatchable" a pezpallet exposes must have weight values that
// correctly estimate a dispatchable's execution time. The benchmarking module is used to calculate
// weights for each dispatchable and generates this pezpallet's weight.rs file. Learn more about benchmarking here: https://docs.pezkuwichain.io/test/benchmark/
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
pub mod weights;
pub use weights::*;
// All pallet logic is defined in its own module and must be annotated by the `pallet` attribute.
#[frame_support::pallet]
pub mod pallet {
// All pezpallet logic is defined in its own module and must be annotated by the `pezpallet`
// attribute.
#[pezframe_support::pezpallet]
pub mod pezpallet {
// Import various useful types required by all FRAME pallets.
use super::*;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
// The `Pallet` struct serves as a placeholder to implement traits, methods and dispatchables
// (`Call`s) in this pallet.
#[pallet::pallet]
pub struct Pallet<T>(_);
// The `Pezpallet` struct serves as a placeholder to implement traits, methods and dispatchables
// (`Call`s) in this pezpallet.
#[pezpallet::pezpallet]
pub struct Pezpallet<T>(_);
/// The pallet's configuration trait.
/// The pezpallet's configuration trait.
///
/// All our types and constants a pallet depends on must be declared here.
/// These types are defined generically and made concrete when the pallet is declared in the
/// All our types and constants a pezpallet depends on must be declared here.
/// These types are defined generically and made concrete when the pezpallet is declared in the
/// `runtime/src/lib.rs` file of your chain.
#[pallet::config]
pub trait Config: frame_system::Config {
#[pezpallet::config]
pub trait Config: pezframe_system::Config {
/// The overarching runtime event type.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// A type representing the weights required by the dispatchables of this pallet.
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// A type representing the weights required by the dispatchables of this pezpallet.
type WeightInfo: WeightInfo;
}
/// A storage item for this pallet.
/// A storage item for this pezpallet.
///
/// In this template, we are declaring a storage item called `Something` that stores a single
/// `u32` value. Learn more about runtime storage here: <https://docs.substrate.io/build/runtime-storage/>
#[pallet::storage]
/// `u32` value. Learn more about runtime storage here: <https://docs.pezkuwichain.io/build/runtime-storage/>
#[pezpallet::storage]
pub type Something<T> = StorageValue<_, u32>;
/// Events that functions in this pallet can emit.
/// Events that functions in this pezpallet can emit.
///
/// Events are a simple means of indicating to the outside world (such as dApps, chain explorers
/// or other users) that some notable update in the runtime has occurred. In a FRAME pallet, the
/// documentation for each event field and its parameters is added to a node's metadata so it
/// can be used by external interfaces or tools.
/// or other users) that some notable update in the runtime has occurred. In a FRAME pezpallet,
/// the documentation for each event field and its parameters is added to a node's metadata so
/// it can be used by external interfaces or tools.
///
/// The `generate_deposit` macro generates a function on `Pallet` called `deposit_event` which
/// will convert the event type of your pallet into `RuntimeEvent` (declared in the pallet's
/// [`Config`] trait) and deposit it using [`frame_system::Pallet::deposit_event`].
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
/// The `generate_deposit` macro generates a function on `Pezpallet` called `deposit_event`
/// which will convert the event type of your pezpallet into `RuntimeEvent` (declared in the
/// pezpallet's [`Config`] trait) and deposit it using
/// [`pezframe_system::Pezpallet::deposit_event`].
#[pezpallet::event]
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// A user has successfully set a new value.
SomethingStored {
@@ -115,7 +121,7 @@ pub mod pallet {
},
}
/// Errors that can be returned by this pallet.
/// Errors that can be returned by this pezpallet.
///
/// Errors tell users that something went wrong so it's important that their naming is
/// informative. Similar to events, error documentation is added to a node's metadata so it's
@@ -123,7 +129,7 @@ pub mod pallet {
///
/// This type of runtime error can be up to 4 bytes in size should you want to return additional
/// information.
#[pallet::error]
#[pezpallet::error]
pub enum Error<T> {
/// The value retrieved was `None` as no value was previously set.
NoneValue,
@@ -131,9 +137,9 @@ pub mod pallet {
StorageOverflow,
}
/// The pallet's dispatchable functions ([`Call`]s).
/// The pezpallet's dispatchable functions ([`Call`]s).
///
/// Dispatchable functions allows users to interact with the pallet and invoke state changes.
/// Dispatchable functions allows users to interact with the pezpallet and invoke state changes.
/// These functions materialize as "extrinsics", which are often compared to transactions.
/// They must always return a `DispatchResult` and be annotated with a weight and call index.
///
@@ -143,15 +149,15 @@ pub mod pallet {
/// will also change which will break backwards compatibility.
///
/// The [`weight`] macro is used to assign a weight to each call.
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pezpallet::call]
impl<T: Config> Pezpallet<T> {
/// An example dispatchable that takes a single u32 value as a parameter, writes the value
/// to storage and emits an event.
///
/// It checks that the _origin_ for this call is _Signed_ and returns a dispatch
/// error if it isn't. Learn more about origins here: <https://docs.substrate.io/build/origins/>
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::do_something())]
/// error if it isn't. Learn more about origins here: <https://docs.pezkuwichain.io/build/origins/>
#[pezpallet::call_index(0)]
#[pezpallet::weight(T::WeightInfo::do_something())]
pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResult {
// Check that the extrinsic was signed and get the signer.
let who = ensure_signed(origin)?;
@@ -179,8 +185,8 @@ pub mod pallet {
/// - If no value has been set ([`Error::NoneValue`])
/// - If incrementing the value in storage causes an arithmetic overflow
/// ([`Error::StorageOverflow`])
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::cause_error())]
#[pezpallet::call_index(1)]
#[pezpallet::weight(T::WeightInfo::cause_error())]
pub fn cause_error(origin: OriginFor<T>) -> DispatchResult {
let _who = ensure_signed(origin)?;
+17 -14
View File
@@ -1,10 +1,10 @@
use crate as pallet_template;
use frame_support::derive_impl;
use sp_runtime::BuildStorage;
use crate as pezpallet_template;
use pezframe_support::derive_impl;
use pezsp_runtime::BuildStorage;
type Block = frame_system::mocking::MockBlock<Test>;
type Block = pezframe_system::mocking::MockBlock<Test>;
#[frame_support::runtime]
#[pezframe_support::runtime]
mod runtime {
// The main runtime
#[runtime::runtime]
@@ -23,24 +23,27 @@ mod runtime {
)]
pub struct Test;
#[runtime::pallet_index(0)]
pub type System = frame_system::Pallet<Test>;
#[runtime::pezpallet_index(0)]
pub type System = pezframe_system::Pezpallet<Test>;
#[runtime::pallet_index(1)]
pub type Template = pallet_template::Pallet<Test>;
#[runtime::pezpallet_index(1)]
pub type Template = pezpallet_template::Pezpallet<Test>;
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
#[derive_impl(pezframe_system::config_preludes::TestDefaultConfig)]
impl pezframe_system::Config for Test {
type Block = Block;
}
impl pallet_template::Config for Test {
impl pezpallet_template::Config for Test {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
}
// Build genesis storage according to the mock runtime.
pub fn new_test_ext() -> sp_io::TestExternalities {
frame_system::GenesisConfig::<Test>::default().build_storage().unwrap().into()
pub fn new_test_ext() -> pezsp_io::TestExternalities {
pezframe_system::GenesisConfig::<Test>::default()
.build_storage()
.unwrap()
.into()
}
+2 -2
View File
@@ -1,5 +1,5 @@
use crate::{mock::*, Error, Event, Something};
use frame_support::{assert_noop, assert_ok};
use pezframe_support::{assert_noop, assert_ok};
#[test]
fn it_works_for_default_value() {
@@ -8,7 +8,7 @@ fn it_works_for_default_value() {
System::set_block_number(1);
// Dispatch a signed extrinsic.
assert_ok!(Template::do_something(RuntimeOrigin::signed(1), 42));
// Read pallet storage and assert an expected result.
// Read pezpallet storage and assert an expected result.
assert_eq!(Something::<Test>::get(), Some(42));
// Assert that the correct event was deposited
System::assert_last_event(Event::SomethingStored { something: 42, who: 1 }.into());
+10 -10
View File
@@ -1,7 +1,7 @@
//! Autogenerated weights for pallet_template
//! Autogenerated weights for pezpallet_template
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! THIS FILE WAS AUTO-GENERATED USING THE BIZINIKIWI BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `Alexs-MacBook-Pro-2.local`, CPU: `<UNKNOWN>`
@@ -10,11 +10,11 @@
// Executed Command:
// ../../target/release/node-template
// benchmark
// pallet
// pezpallet
// --chain
// dev
// --pallet
// pallet_template
// --pezpallet
// pezpallet_template
// --extrinsic
// *
// --steps=50
@@ -29,18 +29,18 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use pezframe_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use core::marker::PhantomData;
/// Weight functions needed for pallet_template.
/// Weight functions needed for pezpallet_template.
pub trait WeightInfo {
fn do_something() -> Weight;
fn cause_error() -> Weight;
}
/// Weights for pallet_template using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Weights for pezpallet_template using the Bizinikiwi node and recommended hardware.
pub struct BizinikiwiWeight<T>(PhantomData<T>);
impl<T: pezframe_system::Config> WeightInfo for BizinikiwiWeight<T> {
/// Storage: Template Something (r:0 w:1)
/// Proof: Template Something (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
fn do_something() -> Weight {