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
@@ -31,10 +31,10 @@ use pezsp_runtime::{
use storage::StorageDoubleMap;
// Implements [`BalanceOnHold`] from [`pezpallet-assets`], so it can understand whether there's some
// balance on hold for an asset account, and is able to signal to this pallet when to clear the
// balance on hold for an asset account, and is able to signal to this pezpallet when to clear the
// state of an account.
impl<T: Config<I>, I: 'static> BalanceOnHold<T::AssetId, T::AccountId, T::Balance>
for Pallet<T, I>
for Pezpallet<T, I>
{
fn balance_on_hold(asset: T::AssetId, who: &T::AccountId) -> Option<T::Balance> {
BalancesOnHold::<T, I>::get(asset, who)
@@ -63,24 +63,24 @@ impl<T: Config<I>, I: 'static> BalanceOnHold<T::AssetId, T::AccountId, T::Balanc
// [`fungibles::InspectHold`](pezframe_support::traits::fungibles::InspectHold) and
// [`fungibles::MutateHold`](pezframe_support::traits::fungibles::MutateHold). To do so, we'll
// re-export all of `pezpallet-assets` implementation of the same trait.
impl<T: Config<I>, I: 'static> Inspect<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> Inspect<T::AccountId> for Pezpallet<T, I> {
type AssetId = T::AssetId;
type Balance = T::Balance;
fn total_issuance(asset: Self::AssetId) -> Self::Balance {
pezpallet_assets::Pallet::<T, I>::total_issuance(asset)
pezpallet_assets::Pezpallet::<T, I>::total_issuance(asset)
}
fn minimum_balance(asset: Self::AssetId) -> Self::Balance {
pezpallet_assets::Pallet::<T, I>::minimum_balance(asset)
pezpallet_assets::Pezpallet::<T, I>::minimum_balance(asset)
}
fn total_balance(asset: Self::AssetId, who: &T::AccountId) -> Self::Balance {
pezpallet_assets::Pallet::<T, I>::total_balance(asset, who)
pezpallet_assets::Pezpallet::<T, I>::total_balance(asset, who)
}
fn balance(asset: Self::AssetId, who: &T::AccountId) -> Self::Balance {
pezpallet_assets::Pallet::<T, I>::balance(asset, who)
pezpallet_assets::Pezpallet::<T, I>::balance(asset, who)
}
fn reducible_balance(
@@ -89,7 +89,7 @@ impl<T: Config<I>, I: 'static> Inspect<T::AccountId> for Pallet<T, I> {
preservation: Preservation,
force: Fortitude,
) -> Self::Balance {
pezpallet_assets::Pallet::<T, I>::reducible_balance(asset, who, preservation, force)
pezpallet_assets::Pezpallet::<T, I>::reducible_balance(asset, who, preservation, force)
}
fn can_deposit(
@@ -98,7 +98,7 @@ impl<T: Config<I>, I: 'static> Inspect<T::AccountId> for Pallet<T, I> {
amount: Self::Balance,
provenance: Provenance,
) -> DepositConsequence {
pezpallet_assets::Pallet::<T, I>::can_deposit(asset, who, amount, provenance)
pezpallet_assets::Pezpallet::<T, I>::can_deposit(asset, who, amount, provenance)
}
fn can_withdraw(
@@ -106,15 +106,15 @@ impl<T: Config<I>, I: 'static> Inspect<T::AccountId> for Pallet<T, I> {
who: &T::AccountId,
amount: Self::Balance,
) -> WithdrawConsequence<Self::Balance> {
pezpallet_assets::Pallet::<T, I>::can_withdraw(asset, who, amount)
pezpallet_assets::Pezpallet::<T, I>::can_withdraw(asset, who, amount)
}
fn asset_exists(asset: Self::AssetId) -> bool {
pezpallet_assets::Pallet::<T, I>::asset_exists(asset)
pezpallet_assets::Pezpallet::<T, I>::asset_exists(asset)
}
}
impl<T: Config<I>, I: 'static> InspectHold<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> InspectHold<T::AccountId> for Pezpallet<T, I> {
type Reason = T::RuntimeHoldReason;
fn total_balance_on_hold(asset: Self::AssetId, who: &T::AccountId) -> Self::Balance {
@@ -134,10 +134,10 @@ impl<T: Config<I>, I: 'static> InspectHold<T::AccountId> for Pallet<T, I> {
}
}
impl<T: Config<I>, I: 'static> Unbalanced<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> Unbalanced<T::AccountId> for Pezpallet<T, I> {
fn handle_dust(dust: Dust<T::AccountId, Self>) {
let Dust(id, balance) = dust;
pezpallet_assets::Pallet::<T, I>::handle_dust(Dust(id, balance));
pezpallet_assets::Pezpallet::<T, I>::handle_dust(Dust(id, balance));
}
fn write_balance(
@@ -145,11 +145,11 @@ impl<T: Config<I>, I: 'static> Unbalanced<T::AccountId> for Pallet<T, I> {
who: &T::AccountId,
amount: Self::Balance,
) -> Result<Option<Self::Balance>, DispatchError> {
pezpallet_assets::Pallet::<T, I>::write_balance(asset, who, amount)
pezpallet_assets::Pezpallet::<T, I>::write_balance(asset, who, amount)
}
fn set_total_issuance(asset: Self::AssetId, amount: Self::Balance) {
pezpallet_assets::Pallet::<T, I>::set_total_issuance(asset, amount)
pezpallet_assets::Pezpallet::<T, I>::set_total_issuance(asset, amount)
}
fn decrease_balance(
@@ -160,7 +160,7 @@ impl<T: Config<I>, I: 'static> Unbalanced<T::AccountId> for Pallet<T, I> {
preservation: Preservation,
force: Fortitude,
) -> Result<Self::Balance, DispatchError> {
pezpallet_assets::Pallet::<T, I>::decrease_balance(
pezpallet_assets::Pezpallet::<T, I>::decrease_balance(
asset,
who,
amount,
@@ -176,11 +176,11 @@ impl<T: Config<I>, I: 'static> Unbalanced<T::AccountId> for Pallet<T, I> {
amount: Self::Balance,
precision: Precision,
) -> Result<Self::Balance, DispatchError> {
pezpallet_assets::Pallet::<T, I>::increase_balance(asset, who, amount, precision)
pezpallet_assets::Pezpallet::<T, I>::increase_balance(asset, who, amount, precision)
}
}
impl<T: Config<I>, I: 'static> UnbalancedHold<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> UnbalancedHold<T::AccountId> for Pezpallet<T, I> {
fn set_balance_on_hold(
asset: Self::AssetId,
reason: &Self::Reason,
@@ -245,7 +245,7 @@ impl<T: Config<I>, I: 'static> UnbalancedHold<T::AccountId> for Pallet<T, I> {
}
}
impl<T: Config<I>, I: 'static> MutateHold<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> MutateHold<T::AccountId> for Pezpallet<T, I> {
fn done_hold(
asset_id: Self::AssetId,
reason: &Self::Reason,
+23 -23
View File
@@ -15,9 +15,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! # Assets Holder Pallet
//! # Assets Holder Pezpallet
//!
//! A pallet capable of holding fungibles from `pezpallet-assets`. This is an extension of
//! A pezpallet capable of holding fungibles from `pezpallet-assets`. This is an extension of
//! `pezpallet-assets`, wrapping [`fungibles::Inspect`](`pezframe_support::traits::fungibles::Inspect`).
//! It implements both
//! [`fungibles::hold::Inspect`](pezframe_support::traits::fungibles::hold::Inspect),
@@ -25,16 +25,16 @@
//! [`fungibles::hold::Unbalanced`](pezframe_support::traits::fungibles::hold::Unbalanced). The
//! complexity of the operations is `O(1)`.
//!
//! ## 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 the following functionality:
//! This pezpallet provides the following functionality:
//!
//! - Pallet hooks allowing [`pezpallet-assets`] to know the balance on hold for an account on a given
//! - Pezpallet hooks allowing [`pezpallet-assets`] to know the balance on hold for an account on a given
//! asset (see [`pezpallet_assets::BalanceOnHold`]).
//! - An implementation of
//! [`fungibles::hold::Inspect`](pezframe_support::traits::fungibles::hold::Inspect),
@@ -51,7 +51,7 @@ use pezframe_support::{
};
use pezframe_system::pezpallet_prelude::BlockNumberFor;
pub use pallet::*;
pub use pezpallet::*;
#[cfg(test)]
mod mock;
@@ -60,36 +60,36 @@ mod tests;
mod impl_fungibles;
#[pezframe_support::pallet]
pub mod pallet {
#[pezframe_support::pezpallet]
pub mod pezpallet {
use super::*;
#[pallet::config(with_default)]
#[pezpallet::config(with_default)]
pub trait Config<I: 'static = ()>:
pezframe_system::Config + pezpallet_assets::Config<I, Holder = Pallet<Self, I>>
pezframe_system::Config + pezpallet_assets::Config<I, Holder = Pezpallet<Self, I>>
{
/// The overarching freeze reason.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
type RuntimeHoldReason: Parameter + Member + MaxEncodedLen + Copy + VariantCount;
/// The overarching event type.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
}
#[pallet::error]
#[pezpallet::error]
pub enum Error<T, I = ()> {
/// Number of holds on an account would exceed the count of `RuntimeHoldReason`.
TooManyHolds,
}
#[pallet::pallet]
pub struct Pallet<T, I = ()>(_);
#[pezpallet::pezpallet]
pub struct Pezpallet<T, I = ()>(_);
#[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<I>, I: 'static = ()> {
/// `who`s balance on hold was increased by `amount`.
Held {
@@ -115,7 +115,7 @@ pub mod pallet {
}
/// A map that stores holds applied on an account for a given AssetId.
#[pallet::storage]
#[pezpallet::storage]
pub(super) type Holds<T: Config<I>, I: 'static = ()> = StorageDoubleMap<
_,
Blake2_128Concat,
@@ -130,7 +130,7 @@ pub mod pallet {
>;
/// A map that stores the current total balance on hold for every account on a given AssetId.
#[pallet::storage]
#[pezpallet::storage]
pub(super) type BalancesOnHold<T: Config<I>, I: 'static = ()> = StorageDoubleMap<
_,
Blake2_128Concat,
@@ -140,8 +140,8 @@ pub mod pallet {
T::Balance,
>;
#[pallet::hooks]
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> {
#[pezpallet::hooks]
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pezpallet<T, I> {
#[cfg(feature = "try-runtime")]
fn try_state(_: BlockNumberFor<T>) -> Result<(), pezsp_runtime::TryRuntimeError> {
Self::do_try_state()
@@ -149,7 +149,7 @@ pub mod pallet {
}
}
impl<T: Config<I>, I: 'static> Pallet<T, I> {
impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
#[cfg(any(test, feature = "try-runtime"))]
fn do_try_state() -> Result<(), pezsp_runtime::TryRuntimeError> {
use pezsp_runtime::{
@@ -188,7 +188,7 @@ mod impl_hold_unbalanced {
// and `increase_balance` are intentionally left out without testing, since:
// 1. It is expected these methods are tested within `pezpallet-assets`, and
// 2. There are no valid cases that can be directly asserted using those methods in
// the scope of this pallet.
// the scope of this pezpallet.
#[test]
fn set_balance_on_hold_works() {