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
@@ -3,7 +3,7 @@
#![cfg(feature = "runtime-benchmarks")]
use super::*;
use crate::Pallet as PezTreasury;
use crate::Pezpallet as PezTreasury;
use pezframe_benchmarking::v2::*;
use pezframe_support::traits::{
fungibles::{Inspect, Mutate},
@@ -77,9 +77,9 @@ mod benchmarks {
initial_monthly_amount * 10u32.into(),
);
let current_block = pezframe_system::Pallet::<T>::block_number();
let current_block = pezframe_system::Pezpallet::<T>::block_number();
let target_block = current_block + crate::BLOCKS_PER_MONTH.into() + 1u32.into();
pezframe_system::Pallet::<T>::set_block_number(target_block);
pezframe_system::Pezpallet::<T>::set_block_number(target_block);
#[extrinsic_call]
release_monthly_funds(RawOrigin::Root);
@@ -1,12 +1,12 @@
#![cfg_attr(not(feature = "std"), no_std)]
//! # PEZ Treasury Pallet
//! # PEZ Treasury Pezpallet
//!
//! A pallet for managing the PEZ token distribution and treasury with automated halving mechanics.
//! A pezpallet for managing the PEZ token distribution and treasury with automated halving mechanics.
//!
//! ## Overview
//!
//! This pallet manages the complete lifecycle of PEZ token distribution including:
//! This pezpallet manages the complete lifecycle of PEZ token distribution including:
//!
//! - **Genesis Distribution**: One-time initial distribution to treasury, presale, and founder
//! accounts
@@ -68,7 +68,7 @@
//! }
//! ```
pub use pallet::*;
pub use pezpallet::*;
pub use weights::WeightInfo;
pub mod migrations;
@@ -95,8 +95,8 @@ use pezframe_system::pezpallet_prelude::BlockNumberFor;
use scale_info::TypeInfo;
use pezsp_runtime::traits::{AccountIdConversion, Saturating, Zero};
#[pezframe_support::pallet]
pub mod pallet {
#[pezframe_support::pezpallet]
pub mod pezpallet {
use super::*;
use pezframe_support::pezpallet_prelude::*;
use pezframe_system::pezpallet_prelude::*;
@@ -111,31 +111,31 @@ pub mod pallet {
pub const PRESALE_ALLOCATION: u128 = 93_750_000 * 1_000_000_000_000; // %1.875
pub const FOUNDER_ALLOCATION: u128 = 93_750_000 * 1_000_000_000_000; // %1.875
#[pallet::pallet]
#[pallet::storage_version(migrations::STORAGE_VERSION)]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
#[pezpallet::storage_version(migrations::STORAGE_VERSION)]
pub struct Pezpallet<T>(_);
#[pallet::config]
#[pezpallet::config]
pub trait Config: pezframe_system::Config + TypeInfo {
type Assets: Mutate<Self::AccountId>;
type WeightInfo: weights::WeightInfo;
#[pallet::constant]
#[pezpallet::constant]
type PezAssetId: Get<<Self::Assets as Inspect<Self::AccountId>>::AssetId>;
#[pallet::constant]
#[pezpallet::constant]
type TreasuryPalletId: Get<PalletId>;
#[pallet::constant]
#[pezpallet::constant]
type IncentivePotId: Get<PalletId>;
#[pallet::constant]
#[pezpallet::constant]
type GovernmentPotId: Get<PalletId>;
#[pallet::constant]
#[pezpallet::constant]
type PresaleAccount: Get<Self::AccountId>;
#[pallet::constant]
#[pezpallet::constant]
type FounderAccount: Get<Self::AccountId>;
type ForceOrigin: EnsureOrigin<Self::RuntimeOrigin>;
@@ -144,25 +144,25 @@ pub mod pallet {
pub type BalanceOf<T> =
<<T as Config>::Assets as Inspect<<T as pezframe_system::Config>::AccountId>>::Balance;
#[pallet::storage]
#[pallet::getter(fn halving_info)]
#[pezpallet::storage]
#[pezpallet::getter(fn halving_info)]
pub type HalvingInfo<T: Config> = StorageValue<_, HalvingData<T>, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn monthly_releases)]
#[pezpallet::storage]
#[pezpallet::getter(fn monthly_releases)]
pub type MonthlyReleases<T: Config> =
StorageMap<_, Blake2_128Concat, u32, MonthlyRelease<T>, OptionQuery>;
#[pallet::storage]
#[pallet::getter(fn next_release_month)]
#[pezpallet::storage]
#[pezpallet::getter(fn next_release_month)]
pub type NextReleaseMonth<T: Config> = StorageValue<_, u32, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn treasury_start_block)]
#[pezpallet::storage]
#[pezpallet::getter(fn treasury_start_block)]
pub type TreasuryStartBlock<T: Config> = StorageValue<_, BlockNumberFor<T>, OptionQuery>;
#[pallet::storage]
#[pallet::getter(fn genesis_distribution_done)]
#[pezpallet::storage]
#[pezpallet::getter(fn genesis_distribution_done)]
pub type GenesisDistributionDone<T: Config> = StorageValue<_, bool, ValueQuery>;
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
@@ -195,8 +195,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> {
TreasuryInitialized {
start_block: BlockNumberFor<T>,
@@ -219,7 +219,7 @@ pub mod pallet {
},
}
#[pallet::error]
#[pezpallet::error]
pub enum Error<T> {
TreasuryAlreadyInitialized,
TreasuryNotInitialized,
@@ -230,7 +230,7 @@ pub mod pallet {
GenesisDistributionAlreadyDone,
}
#[pallet::genesis_config]
#[pezpallet::genesis_config]
#[derive(pezframe_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub initialize_treasury: bool,
@@ -238,40 +238,40 @@ pub mod pallet {
pub _phantom: core::marker::PhantomData<T>,
}
#[pallet::genesis_build]
#[pezpallet::genesis_build]
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) {
if self.initialize_treasury {
let _ = Pallet::<T>::do_initialize_treasury();
let _ = Pezpallet::<T>::do_initialize_treasury();
}
}
}
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::initialize_treasury())]
#[pezpallet::call]
impl<T: Config> Pezpallet<T> {
#[pezpallet::call_index(0)]
#[pezpallet::weight(T::WeightInfo::initialize_treasury())]
pub fn initialize_treasury(origin: OriginFor<T>) -> DispatchResult {
T::ForceOrigin::ensure_origin(origin)?;
Self::do_initialize_treasury()
}
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::release_monthly_funds())]
#[pezpallet::call_index(1)]
#[pezpallet::weight(T::WeightInfo::release_monthly_funds())]
pub fn release_monthly_funds(origin: OriginFor<T>) -> DispatchResult {
T::ForceOrigin::ensure_origin(origin)?;
Self::do_monthly_release()
}
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::force_genesis_distribution())]
#[pezpallet::call_index(2)]
#[pezpallet::weight(T::WeightInfo::force_genesis_distribution())]
pub fn force_genesis_distribution(origin: OriginFor<T>) -> DispatchResult {
T::ForceOrigin::ensure_origin(origin)?;
Self::do_genesis_distribution()
}
}
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
pub fn treasury_account_id() -> T::AccountId {
T::TreasuryPalletId::get().into_account_truncating()
}
@@ -327,7 +327,7 @@ pub mod pallet {
Error::<T>::TreasuryAlreadyInitialized
);
let current_block = pezframe_system::Pallet::<T>::block_number();
let current_block = pezframe_system::Pezpallet::<T>::block_number();
let treasury_balance = TREASURY_ALLOCATION;
let first_period_total =
@@ -361,7 +361,7 @@ pub mod pallet {
pub fn do_monthly_release() -> DispatchResult {
ensure!(TreasuryStartBlock::<T>::get().is_some(), Error::<T>::TreasuryNotInitialized);
let current_block = pezframe_system::Pallet::<T>::block_number();
let current_block = pezframe_system::Pezpallet::<T>::block_number();
let start_block = TreasuryStartBlock::<T>::get().unwrap();
let next_month = NextReleaseMonth::<T>::get();
@@ -19,7 +19,7 @@ pub mod v1 {
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
fn on_runtime_upgrade() -> Weight {
let current = Pallet::<T>::on_chain_storage_version();
let current = Pezpallet::<T>::on_chain_storage_version();
log::info!(
"🔄 Running migration for pezpallet-pez-treasury from {:?} to {:?}",
@@ -47,7 +47,7 @@ pub mod v1 {
has_genesis_done;
// Update storage version
STORAGE_VERSION.put::<Pallet<T>>();
STORAGE_VERSION.put::<Pezpallet<T>>();
log::info!("✅ Migrated {} entries in pezpallet-pez-treasury", migrated);
log::info!(" MonthlyReleases: {}, HalvingInfo: {}, TreasuryStartBlock: {}, GenesisDistributionDone: {}",
@@ -70,7 +70,7 @@ pub mod v1 {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<pezsp_std::vec::Vec<u8>, pezsp_runtime::TryRuntimeError> {
let current = Pallet::<T>::on_chain_storage_version();
let current = Pezpallet::<T>::on_chain_storage_version();
log::info!("🔍 Pre-upgrade check for pezpallet-pez-treasury");
log::info!(" Current version: {:?}", current);
@@ -105,7 +105,7 @@ pub mod v1 {
log::info!("🔍 Post-upgrade check for pezpallet-pez-treasury");
// Verify storage version was updated
let current_version = Pallet::<T>::on_chain_storage_version();
let current_version = Pezpallet::<T>::on_chain_storage_version();
assert_eq!(current_version, STORAGE_VERSION, "Storage version not updated correctly");
log::info!("✅ Storage version updated to {:?}", current_version);
@@ -170,7 +170,7 @@ pub mod v2 {
impl<T: Config> OnRuntimeUpgrade for MigrateToV2<T> {
fn on_runtime_upgrade() -> Weight {
let current = Pallet::<T>::on_chain_storage_version();
let current = Pezpallet::<T>::on_chain_storage_version();
if current < StorageVersion::new(2) {
log::info!("🔄 Running migration for pezpallet-pez-treasury to v2");
@@ -181,7 +181,7 @@ pub mod v2 {
// 3. Update version
// For now, this is just a template
StorageVersion::new(2).put::<Pallet<T>>();
StorageVersion::new(2).put::<Pezpallet<T>>();
log::info!("✅ Completed migration to pezpallet-pez-treasury v2");
@@ -216,13 +216,13 @@ mod tests {
fn test_migration_v1() {
new_test_ext().execute_with(|| {
// Set initial storage version to 0
StorageVersion::new(0).put::<Pallet<Test>>();
StorageVersion::new(0).put::<Pezpallet<Test>>();
// Run migration
let weight = v1::MigrateToV1::<Test>::on_runtime_upgrade();
// Verify version was updated
assert_eq!(Pallet::<Test>::on_chain_storage_version(), STORAGE_VERSION);
assert_eq!(Pezpallet::<Test>::on_chain_storage_version(), STORAGE_VERSION);
// Verify weight is non-zero
assert!(weight != Weight::zero());
@@ -233,7 +233,7 @@ mod tests {
fn test_migration_idempotent() {
new_test_ext().execute_with(|| {
// Set current version
STORAGE_VERSION.put::<Pallet<Test>>();
STORAGE_VERSION.put::<Pezpallet<Test>>();
// Run migration again
let weight = v1::MigrateToV1::<Test>::on_runtime_upgrade();
@@ -544,7 +544,7 @@ fn pot_accounts_are_different() {
let incentive = PezTreasury::incentive_pot_account_id();
let government = PezTreasury::government_pot_account_id();
println!("\n=== Account IDs from Pallet ===");
println!("\n=== Account IDs from Pezpallet ===");
println!("Treasury: {:?}", treasury);
println!("Incentive: {:?}", incentive);
println!("Government: {:?}", government);
@@ -11,10 +11,10 @@
// ./target/release/frame-omni-bencher
// v1
// benchmark
// pallet
// pezpallet
// --runtime
// ./target/release/wbuild/asset-hub-pezkuwichain-runtime/asset_hub_pezkuwichain_runtime.wasm
// --pallet
// --pezpallet
// pezpallet_pez_treasury
// --extrinsic
// *