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
+4 -4
View File
@@ -15,10 +15,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Benchmarks for Sudo Pallet
//! Benchmarks for Sudo Pezpallet
use super::*;
use crate::Pallet;
use crate::Pezpallet;
use alloc::{boxed::Box, vec};
use pezframe_benchmarking::v2::*;
use pezframe_support::dispatch::{DispatchInfo, GetDispatchInfo};
@@ -29,7 +29,7 @@ use pezsp_runtime::traits::{
fn assert_last_event<T: Config>(generic_event: crate::Event<T>) {
let re: <T as Config>::RuntimeEvent = generic_event.into();
pezframe_system::Pallet::<T>::assert_last_event(re.into());
pezframe_system::Pezpallet::<T>::assert_last_event(re.into());
}
#[benchmarks(where
@@ -118,5 +118,5 @@ mod benchmarks {
}
}
impl_benchmark_test_suite!(Pallet, crate::mock::new_bench_ext(), crate::mock::Test);
impl_benchmark_test_suite!(Pezpallet, crate::mock::new_bench_ext(), crate::mock::Test);
}
+55 -55
View File
@@ -23,14 +23,14 @@
//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
//! [pezkuwi]: https://img.shields.io/badge/polkadot-E6007A?style=for-the-badge&logo=polkadot&logoColor=white
//!
//! # Sudo Pallet
//! # Sudo Pezpallet
//!
//! A pallet to provide a way to execute privileged runtime calls using a specified sudo ("superuser
//! A pezpallet to provide a way to execute privileged runtime calls using a specified sudo ("superuser
//! do") account.
//!
//! ## 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
@@ -40,24 +40,24 @@
//! Setting a privileged account, called the _sudo key_, allows you to make such calls as an
//! extrinsic.
//!
//! Here's an example of a privileged function in another pallet:
//! Here's an example of a privileged function in another pezpallet:
//!
//! ```
//! #[pezframe_support::pallet]
//! pub mod pallet {
//! #[pezframe_support::pezpallet]
//! pub mod pezpallet {
//! use super::*;
//! use pezframe_support::pezpallet_prelude::*;
//! use pezframe_system::pezpallet_prelude::*;
//!
//! #[pallet::pallet]
//! pub struct Pallet<T>(_);
//! #[pezpallet::pezpallet]
//! pub struct Pezpallet<T>(_);
//!
//! #[pallet::config]
//! #[pezpallet::config]
//! pub trait Config: pezframe_system::Config {}
//!
//! #[pallet::call]
//! impl<T: Config> Pallet<T> {
//! #[pallet::weight(0)]
//! #[pezpallet::call]
//! impl<T: Config> Pezpallet<T> {
//! #[pezpallet::weight(0)]
//! pub fn privileged_function(origin: OriginFor<T>) -> DispatchResult {
//! ensure_root(origin)?;
//!
@@ -69,23 +69,23 @@
//! }
//! ```
//!
//! With the Sudo pallet configured in your chain's runtime you can execute this privileged
//! function by constructing a call using the [`sudo`](Pallet::sudo) dispatchable.
//! With the Sudo pezpallet configured in your chain's runtime you can execute this privileged
//! function by constructing a call using the [`sudo`](Pezpallet::sudo) dispatchable.
//!
//! To use this pallet in your runtime, a sudo key must be specified in the [`GenesisConfig`] of
//! the pallet. You can change this key at anytime once your chain is live using the
//! [`set_key`](Pallet::set_key) dispatchable, however <strong>only one sudo key can be set at a
//! time</strong>. The pallet also allows you to make a call using
//! [`sudo_unchecked_weight`](Pallet::sudo_unchecked_weight), which allows the sudo account to
//! To use this pezpallet in your runtime, a sudo key must be specified in the [`GenesisConfig`] of
//! the pezpallet. You can change this key at anytime once your chain is live using the
//! [`set_key`](Pezpallet::set_key) dispatchable, however <strong>only one sudo key can be set at a
//! time</strong>. The pezpallet also allows you to make a call using
//! [`sudo_unchecked_weight`](Pezpallet::sudo_unchecked_weight), which allows the sudo account to
//! execute a call with a custom weight.
//!
//! <div class="example-wrap" style="display:inline-block"><pre class="compile_fail"
//! style="white-space:normal;font:inherit;">
//! <strong>Note:</strong> this pallet is not meant to be used inside other pallets. It is only
//! <strong>Note:</strong> this pezpallet is not meant to be used inside other pallets. It is only
//! meant to be used by constructing runtime calls from outside the runtime.
//! </pre></div>
//!
//! This pallet also defines a [`TransactionExtension`](pezsp_runtime::traits::TransactionExtension)
//! This pezpallet also defines a [`TransactionExtension`](pezsp_runtime::traits::TransactionExtension)
//! called [`CheckOnlySudoAccount`] to ensure that only signed transactions by the sudo account are
//! accepted by the transaction pool. The intended use of this signed extension is to prevent other
//! accounts from spamming the transaction pool for the initial phase of a chain, during which
@@ -108,10 +108,10 @@
//!
//! ## Low Level / Implementation Details
//!
//! This pallet checks that the caller of its dispatchables is a signed account and ensures that the
//! This pezpallet checks that the caller of its dispatchables is a signed account and ensures that the
//! caller matches the sudo key in storage.
//! A caller of this pallet's dispatchables does not pay any fees to dispatch a call. If the account
//! making one of these calls is not the sudo key, the pallet returns a [`Error::RequireSudo`]
//! A caller of this pezpallet's dispatchables does not pay any fees to dispatch a call. If the account
//! making one of these calls is not the sudo key, the pezpallet returns a [`Error::RequireSudo`]
//! error.
//!
//! Once an origin is verified, sudo calls use `dispatch_bypass_filter` from the
@@ -141,12 +141,12 @@ pub mod weights;
pub use weights::WeightInfo;
pub use extension::CheckOnlySudoAccount;
pub use pallet::*;
pub use pezpallet::*;
type AccountIdLookupOf<T> = <<T as pezframe_system::Config>::Lookup as StaticLookup>::Source;
#[pezframe_support::pallet]
pub mod pallet {
#[pezframe_support::pezpallet]
pub mod pezpallet {
use super::{DispatchResult, *};
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::{pezpallet_prelude::*, RawOrigin};
@@ -171,31 +171,31 @@ pub mod pallet {
type RuntimeCall = ();
}
}
#[pallet::config(with_default)]
#[pezpallet::config(with_default)]
pub trait Config: pezframe_system::Config {
/// The overarching event type.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// A sudo-able call.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type RuntimeCall: Parameter
+ UnfilteredDispatchable<RuntimeOrigin = Self::RuntimeOrigin>
+ GetDispatchInfo;
/// Type representing the weight of this pallet
/// Type representing the weight of this pezpallet
type WeightInfo: WeightInfo;
}
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
pub struct Pezpallet<T>(_);
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pezpallet::call]
impl<T: Config> Pezpallet<T> {
/// Authenticates the sudo key and dispatches a function call with `Root` origin.
#[pallet::call_index(0)]
#[pallet::weight({
#[pezpallet::call_index(0)]
#[pezpallet::weight({
let dispatch_info = call.get_dispatch_info();
(
T::WeightInfo::sudo().saturating_add(dispatch_info.call_weight),
@@ -220,8 +220,8 @@ pub mod pallet {
/// Sudo user to specify the weight of the call.
///
/// The dispatch origin for this call must be _Signed_.
#[pallet::call_index(1)]
#[pallet::weight((*weight, call.get_dispatch_info().class))]
#[pezpallet::call_index(1)]
#[pezpallet::weight((*weight, call.get_dispatch_info().class))]
pub fn sudo_unchecked_weight(
origin: OriginFor<T>,
call: Box<<T as Config>::RuntimeCall>,
@@ -239,8 +239,8 @@ pub mod pallet {
/// Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo
/// key.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::set_key())]
#[pezpallet::call_index(2)]
#[pezpallet::weight(T::WeightInfo::set_key())]
pub fn set_key(
origin: OriginFor<T>,
new: AccountIdLookupOf<T>,
@@ -259,8 +259,8 @@ pub mod pallet {
/// a given account.
///
/// The dispatch origin for this call must be _Signed_.
#[pallet::call_index(3)]
#[pallet::weight({
#[pezpallet::call_index(3)]
#[pezpallet::weight({
let dispatch_info = call.get_dispatch_info();
(
T::WeightInfo::sudo_as().saturating_add(dispatch_info.call_weight),
@@ -287,8 +287,8 @@ pub mod pallet {
/// Permanently removes the sudo key.
///
/// **This cannot be un-done.**
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::remove_key())]
#[pezpallet::call_index(4)]
#[pezpallet::weight(T::WeightInfo::remove_key())]
pub fn remove_key(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
Self::ensure_sudo(origin)?;
@@ -300,8 +300,8 @@ pub mod pallet {
}
}
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pezpallet::event]
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// A sudo call just took place.
Sudid {
@@ -317,39 +317,39 @@ pub mod pallet {
},
/// The key was permanently removed.
KeyRemoved,
/// A [sudo_as](Pallet::sudo_as) call just took place.
/// A [sudo_as](Pezpallet::sudo_as) call just took place.
SudoAsDone {
/// The result of the call made by the sudo user.
sudo_result: DispatchResult,
},
}
#[pallet::error]
/// Error for the Sudo pallet.
#[pezpallet::error]
/// Error for the Sudo pezpallet.
pub enum Error<T> {
/// Sender must be the Sudo account.
RequireSudo,
}
/// The `AccountId` of the sudo key.
#[pallet::storage]
#[pezpallet::storage]
pub type Key<T: Config> = StorageValue<_, T::AccountId, OptionQuery>;
#[pallet::genesis_config]
#[pezpallet::genesis_config]
#[derive(pezframe_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
/// The `AccountId` of the sudo key.
pub key: Option<T::AccountId>,
}
#[pallet::genesis_build]
#[pezpallet::genesis_build]
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) {
Key::<T>::set(self.key.clone());
}
}
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
/// Ensure that the caller is the sudo key.
pub(crate) fn ensure_sudo(origin: OriginFor<T>) -> DispatchResult {
let sender = ensure_signed_or_root(origin)?;
+16 -16
View File
@@ -24,24 +24,24 @@ use pezsp_io;
use pezsp_runtime::BuildStorage;
// Logger module to track execution.
#[pezframe_support::pallet]
#[pezframe_support::pezpallet]
pub mod logger {
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
#[pallet::config]
#[pezpallet::config]
pub trait Config: pezframe_system::Config {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
}
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
pub struct Pezpallet<T>(_);
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(*weight)]
#[pezpallet::call]
impl<T: Config> Pezpallet<T> {
#[pezpallet::call_index(0)]
#[pezpallet::weight(*weight)]
pub fn privileged_i32_log(
origin: OriginFor<T>,
i: i32,
@@ -54,8 +54,8 @@ pub mod logger {
Ok(().into())
}
#[pallet::call_index(1)]
#[pallet::weight(*weight)]
#[pezpallet::call_index(1)]
#[pezpallet::weight(*weight)]
pub fn non_privileged_log(
origin: OriginFor<T>,
i: i32,
@@ -70,20 +70,20 @@ pub mod logger {
}
}
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pezpallet::event]
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
AppendI32 { value: i32, weight: Weight },
AppendI32AndAccount { sender: T::AccountId, value: i32, weight: Weight },
}
#[pallet::storage]
#[pallet::getter(fn account_log)]
#[pezpallet::storage]
#[pezpallet::getter(fn account_log)]
pub(super) type AccountLog<T: Config> =
StorageValue<_, BoundedVec<T::AccountId, ConstU32<1_000>>, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn i32_log)]
#[pezpallet::storage]
#[pezpallet::getter(fn i32_log)]
pub(super) type I32Log<T> = StorageValue<_, BoundedVec<i32, ConstU32<1_000>>, ValueQuery>;
}
+2 -2
View File
@@ -44,10 +44,10 @@
// frame-omni-bencher
// v1
// benchmark
// pallet
// pezpallet
// --extrinsic=*
// --runtime=target/production/wbuild/pez-kitchensink-runtime/pez_kitchensink_runtime.wasm
// --pallet=pezpallet_sudo
// --pezpallet=pezpallet_sudo
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/sudo/src/weights.rs
// --wasm-execution=compiled