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:
@@ -2,12 +2,12 @@
|
||||
use super::*;
|
||||
|
||||
#[allow(unused)]
|
||||
use crate::Pallet as Tiki;
|
||||
use crate::Pezpallet as Tiki;
|
||||
use pezframe_benchmarking::v2::*;
|
||||
use pezframe_system::RawOrigin;
|
||||
// Gerekli trait'leri import ediyoruz
|
||||
use pezframe_support::traits::{Currency, Get};
|
||||
use pezpallet_balances::Pallet as Balances;
|
||||
use pezpallet_balances::Pezpallet as Balances;
|
||||
use pezsp_runtime::traits::StaticLookup;
|
||||
extern crate alloc;
|
||||
use alloc::vec;
|
||||
@@ -38,7 +38,7 @@ mod benchmarks {
|
||||
|
||||
// `while` döngüsü, 'Step' trait'ine olan ihtiyacı ortadan kaldırır.
|
||||
while pezpallet_nfts::NextCollectionId::<T>::get().unwrap_or_default() <= collection_id {
|
||||
let _ = pezpallet_nfts::Pallet::<T>::force_create(
|
||||
let _ = pezpallet_nfts::Pezpallet::<T>::force_create(
|
||||
RawOrigin::Root.into(),
|
||||
T::Lookup::unlookup(caller.clone()),
|
||||
pezpallet_nfts::CollectionConfig {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//!
|
||||
//! # Feature Unification Note
|
||||
//!
|
||||
//! Due to Cargo's feature unification behavior, this pallet must be excluded
|
||||
//! Due to Cargo's feature unification behavior, this pezpallet must be excluded
|
||||
//! from `cargo check --benches` operations when its `runtime-benchmarks` feature
|
||||
//! is not explicitly enabled. The CI workflow (tests-misc.yml) handles this
|
||||
//! by excluding pezpallet-tiki and all its dependents.
|
||||
@@ -15,10 +15,10 @@
|
||||
//! a required trait method. However, if `pezpallet-tiki/runtime-benchmarks` is not enabled,
|
||||
//! our cfg-gated method won't be compiled, causing E0046 errors.
|
||||
//!
|
||||
//! CI exclusion: .github/workflows/tests-misc.yml excludes this pallet with:
|
||||
//! CI exclusion: .github/workflows/tests-misc.yml excludes this pezpallet with:
|
||||
//! `--exclude pezpallet-tiki` in the `cargo check --benches` command.
|
||||
|
||||
use crate::{Config, Pallet as TikiPallet};
|
||||
use crate::{Config, Pezpallet as TikiPallet};
|
||||
use pezframe_support::traits::EnsureOrigin;
|
||||
use pezframe_system::ensure_signed;
|
||||
use pezsp_std::marker::PhantomData;
|
||||
@@ -96,9 +96,9 @@ impl GetTiki for ParlementerRole {
|
||||
/// // Require the caller to hold the Serok Tiki
|
||||
/// type SerokOrigin = EnsureTiki<Runtime, SerokRole>;
|
||||
///
|
||||
/// // Use in a pallet's dispatchable
|
||||
/// #[pallet::call]
|
||||
/// impl<T: Config> Pallet<T> {
|
||||
/// // Use in a pezpallet's dispatchable
|
||||
/// #[pezpallet::call]
|
||||
/// impl<T: Config> Pezpallet<T> {
|
||||
/// pub fn privileged_action(origin: OriginFor<T>) -> DispatchResult {
|
||||
/// let who = T::SerokOrigin::ensure_origin(origin)?;
|
||||
/// // ... action requiring Serok authority
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
//! # Tiki (Role) Pallet
|
||||
//! # Tiki (Role) Pezpallet
|
||||
//!
|
||||
//! A pallet for managing citizenship and role-based NFTs with automated and governance-driven
|
||||
//! A pezpallet for managing citizenship and role-based NFTs with automated and governance-driven
|
||||
//! assignment.
|
||||
//!
|
||||
//! ## Overview
|
||||
//!
|
||||
//! The Tiki pallet implements a comprehensive role management system using non-transferable NFTs
|
||||
//! The Tiki pezpallet implements a comprehensive role management system using non-transferable NFTs
|
||||
//! to represent citizenship status and various roles within the ecosystem. Each role grants
|
||||
//! specific permissions, rights, and social standing.
|
||||
//!
|
||||
@@ -81,7 +81,7 @@
|
||||
//!
|
||||
//! ## Dependencies
|
||||
//!
|
||||
//! This pallet requires integration with:
|
||||
//! This pezpallet requires integration with:
|
||||
//! - `pezpallet-identity-kyc` - KYC status and approval notifications
|
||||
//! - `pezpallet-nfts` - Underlying NFT infrastructure
|
||||
//! - `pezpallet-trust` - Trust score verification for role eligibility
|
||||
@@ -101,7 +101,7 @@
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
use alloc::{format, vec::Vec};
|
||||
use pezframe_support::pezpallet_prelude::{MaybeSerializeDeserialize, Parameter, RuntimeDebug};
|
||||
@@ -120,18 +120,18 @@ pub use weights::*;
|
||||
pub mod ensure;
|
||||
pub mod migrations; // Storage migrations // For origin validation
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
use super::*;
|
||||
use pezframe_support::pezpallet_prelude::*;
|
||||
use pezframe_system::pezpallet_prelude::*;
|
||||
use pezsp_runtime::traits::StaticLookup;
|
||||
|
||||
#[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 + pezpallet_nfts::Config<ItemId = u32> + pezpallet_identity_kyc::Config
|
||||
{
|
||||
@@ -140,14 +140,14 @@ pub mod pallet {
|
||||
type WeightInfo: weights::WeightInfo;
|
||||
|
||||
/// Collection ID holding Tiki (Role) NFTs.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type TikiCollectionId: Get<Self::CollectionId>;
|
||||
|
||||
/// Technical upper limit for maximum number of Tikis (roles) a user can hold.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type MaxTikisPerUser: Get<u32>;
|
||||
|
||||
/// Tiki enum type to be used within the pallet.
|
||||
/// Tiki enum type to be used within the pezpallet.
|
||||
type Tiki: Parameter
|
||||
+ From<Tiki>
|
||||
+ Into<u32>
|
||||
@@ -254,14 +254,14 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Holds citizenship NFT ID for each user
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn citizen_nft)]
|
||||
#[pezpallet::storage]
|
||||
#[pezpallet::getter(fn citizen_nft)]
|
||||
pub type CitizenNft<T: Config> =
|
||||
StorageMap<_, Blake2_128Concat, T::AccountId, u32, OptionQuery>;
|
||||
|
||||
/// List of Tikis (roles) owned by each user
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn user_tikis)]
|
||||
#[pezpallet::storage]
|
||||
#[pezpallet::getter(fn user_tikis)]
|
||||
pub type UserTikis<T: Config> = StorageMap<
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
@@ -271,17 +271,17 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
/// Shows which user a specific Tiki belongs to (for unique roles)
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn tiki_holder)]
|
||||
#[pezpallet::storage]
|
||||
#[pezpallet::getter(fn tiki_holder)]
|
||||
pub type TikiHolder<T: Config> =
|
||||
StorageMap<_, Blake2_128Concat, Tiki, T::AccountId, OptionQuery>;
|
||||
|
||||
/// Item ID to be used for next NFT
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn next_item_id)]
|
||||
#[pezpallet::storage]
|
||||
#[pezpallet::getter(fn next_item_id)]
|
||||
pub type NextItemId<T: Config> = StorageValue<_, u32, ValueQuery>;
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Role already belongs to someone else
|
||||
RoleAlreadyTaken,
|
||||
@@ -305,8 +305,8 @@ pub mod pallet {
|
||||
InvalidRoleAssignmentMethod,
|
||||
}
|
||||
|
||||
#[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> {
|
||||
/// New citizenship NFT minted
|
||||
CitizenNftMinted { who: T::AccountId, nft_id: u32 },
|
||||
@@ -323,8 +323,8 @@ pub mod pallet {
|
||||
},
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn on_initialize(_block_number: BlockNumberFor<T>) -> Weight {
|
||||
// Check newly KYC-approved users and mint citizenship NFT
|
||||
Self::check_and_mint_citizen_nfts();
|
||||
@@ -333,11 +333,11 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Admin tarafından belirli bir kullanıcıya Tiki (rol) verme
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::grant_tiki())]
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight(<T as crate::pezpallet::Config>::WeightInfo::grant_tiki())]
|
||||
pub fn grant_tiki(
|
||||
origin: OriginFor<T>,
|
||||
dest: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -357,8 +357,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Admin tarafından belirli bir kullanıcıdan Tiki (rol) alma
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::revoke_tiki())]
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight(<T as crate::pezpallet::Config>::WeightInfo::revoke_tiki())]
|
||||
pub fn revoke_tiki(
|
||||
origin: OriginFor<T>,
|
||||
target: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -372,8 +372,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Manually mint citizenship NFT (for testing/emergency)
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::grant_tiki())]
|
||||
#[pezpallet::call_index(2)]
|
||||
#[pezpallet::weight(<T as crate::pezpallet::Config>::WeightInfo::grant_tiki())]
|
||||
pub fn force_mint_citizen_nft(
|
||||
origin: OriginFor<T>,
|
||||
dest: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -386,8 +386,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Grant role through election system (called from pezpallet-voting)
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::grant_tiki())]
|
||||
#[pezpallet::call_index(3)]
|
||||
#[pezpallet::weight(<T as crate::pezpallet::Config>::WeightInfo::grant_tiki())]
|
||||
pub fn grant_elected_role(
|
||||
origin: OriginFor<T>,
|
||||
dest: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -407,14 +407,14 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Grant role through exam/test system
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::grant_tiki())]
|
||||
#[pezpallet::call_index(4)]
|
||||
#[pezpallet::weight(<T as crate::pezpallet::Config>::WeightInfo::grant_tiki())]
|
||||
pub fn grant_earned_role(
|
||||
origin: OriginFor<T>,
|
||||
dest: <T::Lookup as StaticLookup>::Source,
|
||||
tiki: Tiki,
|
||||
) -> DispatchResult {
|
||||
T::AdminOrigin::ensure_origin(origin)?; // For now admin, later exam pallet
|
||||
T::AdminOrigin::ensure_origin(origin)?; // For now admin, later exam pezpallet
|
||||
let dest_account = T::Lookup::lookup(dest)?;
|
||||
|
||||
// Check if the role can be earned
|
||||
@@ -428,13 +428,13 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Apply for citizenship after KYC completion
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::grant_tiki())]
|
||||
#[pezpallet::call_index(5)]
|
||||
#[pezpallet::weight(<T as crate::pezpallet::Config>::WeightInfo::grant_tiki())]
|
||||
pub fn apply_for_citizenship(origin: OriginFor<T>) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
// Check if user's KYC is approved
|
||||
let kyc_status = pezpallet_identity_kyc::Pallet::<T>::kyc_status_of(&who);
|
||||
let kyc_status = pezpallet_identity_kyc::Pezpallet::<T>::kyc_status_of(&who);
|
||||
ensure!(
|
||||
kyc_status == pezpallet_identity_kyc::types::KycLevel::Approved,
|
||||
Error::<T>::KycNotCompleted
|
||||
@@ -447,8 +447,8 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Check NFT transfer for transfer blocking system
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::grant_tiki())]
|
||||
#[pezpallet::call_index(6)]
|
||||
#[pezpallet::weight(<T as crate::pezpallet::Config>::WeightInfo::grant_tiki())]
|
||||
pub fn check_transfer_permission(
|
||||
_origin: OriginFor<T>,
|
||||
collection_id: T::CollectionId,
|
||||
@@ -465,11 +465,11 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
// Pallet's helper functions
|
||||
impl<T: Config> Pallet<T> {
|
||||
// Pezpallet's helper functions
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Checks newly KYC-completed users and mints citizenship NFT
|
||||
fn check_and_mint_citizen_nfts() {
|
||||
// Check all approved users in KYC pallet
|
||||
// Check all approved users in KYC pezpallet
|
||||
for (account, kyc_status) in pezpallet_identity_kyc::KycStatuses::<T>::iter() {
|
||||
// Check if KYC is approved
|
||||
if kyc_status == pezpallet_identity_kyc::types::KycLevel::Approved {
|
||||
@@ -494,7 +494,7 @@ pub mod pallet {
|
||||
|
||||
// Mint the NFT - use force_mint in benchmarks to bypass balance/origin requirements
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
pezpallet_nfts::Pallet::<T>::force_mint(
|
||||
pezpallet_nfts::Pezpallet::<T>::force_mint(
|
||||
T::RuntimeOrigin::from(pezframe_system::RawOrigin::Root),
|
||||
collection_id,
|
||||
next_id_u32,
|
||||
@@ -503,7 +503,7 @@ pub mod pallet {
|
||||
)?;
|
||||
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
pezpallet_nfts::Pallet::<T>::force_mint(
|
||||
pezpallet_nfts::Pezpallet::<T>::force_mint(
|
||||
T::RuntimeOrigin::from(pezframe_system::RawOrigin::Root),
|
||||
collection_id,
|
||||
next_id_u32,
|
||||
@@ -595,12 +595,12 @@ pub mod pallet {
|
||||
// Mark NFT with lock attribute - use force_set_attribute in benchmarks to bypass
|
||||
// deposits
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
let _ = pezpallet_nfts::Pallet::<T>::force_set_attribute(
|
||||
let _ = pezpallet_nfts::Pezpallet::<T>::force_set_attribute(
|
||||
T::RuntimeOrigin::from(pezframe_system::RawOrigin::Root),
|
||||
None,
|
||||
*collection_id,
|
||||
Some(*item_id),
|
||||
pezpallet_nfts::AttributeNamespace::Pallet,
|
||||
pezpallet_nfts::AttributeNamespace::Pezpallet,
|
||||
b"locked"
|
||||
.to_vec()
|
||||
.try_into()
|
||||
@@ -612,11 +612,11 @@ pub mod pallet {
|
||||
);
|
||||
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
let _ = pezpallet_nfts::Pallet::<T>::set_attribute(
|
||||
let _ = pezpallet_nfts::Pezpallet::<T>::set_attribute(
|
||||
T::RuntimeOrigin::from(pezframe_system::RawOrigin::Root),
|
||||
*collection_id,
|
||||
Some(*item_id),
|
||||
pezpallet_nfts::AttributeNamespace::Pallet,
|
||||
pezpallet_nfts::AttributeNamespace::Pezpallet,
|
||||
b"locked"
|
||||
.to_vec()
|
||||
.try_into()
|
||||
@@ -646,7 +646,7 @@ pub mod pallet {
|
||||
);
|
||||
|
||||
// Set metadata - log error but don't crash
|
||||
if pezpallet_nfts::Pallet::<T>::set_metadata(
|
||||
if pezpallet_nfts::Pezpallet::<T>::set_metadata(
|
||||
T::RuntimeOrigin::from(pezframe_system::RawOrigin::Root),
|
||||
collection_id,
|
||||
nft_id_u32,
|
||||
@@ -710,7 +710,7 @@ pub mod pallet {
|
||||
/// KYC sonrası otomatik Welati rolü verme
|
||||
pub fn auto_grant_citizenship(account: &T::AccountId) -> DispatchResult {
|
||||
// KYC kontrolü
|
||||
let kyc_status = pezpallet_identity_kyc::Pallet::<T>::kyc_status_of(account);
|
||||
let kyc_status = pezpallet_identity_kyc::Pezpallet::<T>::kyc_status_of(account);
|
||||
if kyc_status == pezpallet_identity_kyc::types::KycLevel::Approved {
|
||||
// Vatandaşlık NFT'si yoksa bas
|
||||
if Self::citizen_nft(account).is_none() {
|
||||
@@ -745,14 +745,14 @@ pub trait TikiProvider<AccountId> {
|
||||
}
|
||||
|
||||
/// Trait implementasyonları
|
||||
impl<T: Config> TikiScoreProvider<T::AccountId> for Pallet<T> {
|
||||
impl<T: Config> TikiScoreProvider<T::AccountId> for Pezpallet<T> {
|
||||
fn get_tiki_score(who: &T::AccountId) -> u32 {
|
||||
let tikis = Self::user_tikis(who);
|
||||
tikis.iter().map(Self::get_bonus_for_tiki).sum()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> TikiProvider<T::AccountId> for Pallet<T> {
|
||||
impl<T: Config> TikiProvider<T::AccountId> for Pezpallet<T> {
|
||||
fn has_tiki(who: &T::AccountId, tiki: &Tiki) -> bool {
|
||||
Self::has_tiki(who, tiki)
|
||||
}
|
||||
@@ -767,7 +767,7 @@ impl<T: Config> TikiProvider<T::AccountId> for Pallet<T> {
|
||||
}
|
||||
|
||||
// Puanlama mantığını ayrı bir impl bloğunda tutarak kodu daha düzenli hale getiriyoruz.
|
||||
impl<T: Config> Pallet<T> {
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Belirli bir Tiki'nin Trust Puanı'na olan katkısını döndürür.
|
||||
pub fn get_bonus_for_tiki(tiki: &Tiki) -> u32 {
|
||||
match tiki {
|
||||
@@ -833,7 +833,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
// CitizenNftProvider trait implementation for pezpallet-identity-kyc integration
|
||||
impl<T: Config> pezpallet_identity_kyc::types::CitizenNftProvider<T::AccountId> for Pallet<T> {
|
||||
impl<T: Config> pezpallet_identity_kyc::types::CitizenNftProvider<T::AccountId> for Pezpallet<T> {
|
||||
fn mint_citizen_nft(who: &T::AccountId) -> pezsp_runtime::DispatchResult {
|
||||
Self::mint_citizen_nft_for_user(who)
|
||||
}
|
||||
@@ -850,7 +850,7 @@ impl<T: Config> pezpallet_identity_kyc::types::CitizenNftProvider<T::AccountId>
|
||||
let collection_id = T::TikiCollectionId::get();
|
||||
|
||||
// Burn the NFT using pezpallet_nfts burn function
|
||||
pezpallet_nfts::Pallet::<T>::burn(
|
||||
pezpallet_nfts::Pezpallet::<T>::burn(
|
||||
T::RuntimeOrigin::from(pezframe_system::RawOrigin::Signed(who.clone())),
|
||||
collection_id,
|
||||
item_id,
|
||||
|
||||
@@ -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-tiki from {:?} to {:?}",
|
||||
@@ -41,7 +41,7 @@ pub mod v1 {
|
||||
// }
|
||||
|
||||
// Update storage version
|
||||
STORAGE_VERSION.put::<Pallet<T>>();
|
||||
STORAGE_VERSION.put::<Pezpallet<T>>();
|
||||
|
||||
log::info!("✅ Migrated {} entries in pezpallet-tiki", migrated);
|
||||
|
||||
@@ -62,7 +62,7 @@ pub mod v1 {
|
||||
fn pre_upgrade() -> Result<pezsp_std::vec::Vec<u8>, pezsp_runtime::TryRuntimeError> {
|
||||
use codec::Encode;
|
||||
|
||||
let current = Pallet::<T>::on_chain_storage_version();
|
||||
let current = Pezpallet::<T>::on_chain_storage_version();
|
||||
|
||||
log::info!("🔍 Pre-upgrade check for pezpallet-tiki");
|
||||
log::info!(" Current version: {:?}", current);
|
||||
@@ -89,7 +89,7 @@ pub mod v1 {
|
||||
log::info!("🔍 Post-upgrade check for pezpallet-tiki");
|
||||
|
||||
// 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);
|
||||
|
||||
@@ -139,7 +139,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-tiki to v2");
|
||||
@@ -151,7 +151,7 @@ pub mod v2 {
|
||||
// 4. Update version
|
||||
|
||||
// For now, this is just a template
|
||||
STORAGE_VERSION.put::<Pallet<T>>();
|
||||
STORAGE_VERSION.put::<Pezpallet<T>>();
|
||||
|
||||
log::info!("✅ Completed migration to pezpallet-tiki v2");
|
||||
|
||||
@@ -174,13 +174,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());
|
||||
@@ -191,7 +191,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();
|
||||
|
||||
@@ -14,16 +14,16 @@ type Block = pezframe_system::mocking::MockBlock<Test>;
|
||||
pub type AccountId = u64;
|
||||
pub type Balance = u128;
|
||||
|
||||
// Runtime'ı oluştur - Identity ve IdentityKyc pallet'lerini de ekle
|
||||
// Runtime'ı oluştur - Identity ve IdentityKyc pezpallet'lerini de ekle
|
||||
construct_runtime!(
|
||||
pub enum Test
|
||||
{
|
||||
System: pezframe_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pezpallet_balances::{Pallet, Call, Storage, Event<T>},
|
||||
Identity: pezpallet_identity::{Pallet, Call, Storage, Event<T>},
|
||||
IdentityKyc: pezpallet_identity_kyc::{Pallet, Call, Storage, Event<T>},
|
||||
Nfts: pezpallet_nfts::{Pallet, Call, Storage, Event<T>},
|
||||
Tiki: pezpallet_tiki::{Pallet, Call, Storage, Event<T>},
|
||||
System: pezframe_system::{Pezpallet, Call, Config<T>, Storage, Event<T>},
|
||||
Balances: pezpallet_balances::{Pezpallet, Call, Storage, Event<T>},
|
||||
Identity: pezpallet_identity::{Pezpallet, Call, Storage, Event<T>},
|
||||
IdentityKyc: pezpallet_identity_kyc::{Pezpallet, Call, Storage, Event<T>},
|
||||
Nfts: pezpallet_nfts::{Pezpallet, Call, Storage, Event<T>},
|
||||
Tiki: pezpallet_tiki::{Pezpallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -249,7 +249,7 @@ pub fn advance_blocks(blocks: u64) {
|
||||
let current_block = System::block_number();
|
||||
System::set_block_number(current_block + 1);
|
||||
// Trigger hooks for the new block
|
||||
<pezpallet_tiki::Pallet<Test> as pezframe_support::traits::Hooks<u64>>::on_initialize(
|
||||
<pezpallet_tiki::Pezpallet<Test> as pezframe_support::traits::Hooks<u64>>::on_initialize(
|
||||
current_block + 1,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::{
|
||||
use pezframe_support::{assert_noop, assert_ok};
|
||||
use pezsp_runtime::DispatchError;
|
||||
|
||||
type TikiPallet = crate::Pallet<Test>;
|
||||
type TikiPallet = crate::Pezpallet<Test>;
|
||||
|
||||
// === Temel NFT ve Rol Testleri ===
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// ./target/release/frame-omni-bencher
|
||||
// v1
|
||||
// benchmark
|
||||
// pallet
|
||||
// pezpallet
|
||||
// --runtime
|
||||
// target/release/wbuild/people-pezkuwichain-runtime/people_pezkuwichain_runtime.compact.compressed.wasm
|
||||
// --pallets
|
||||
|
||||
Reference in New Issue
Block a user