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
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
//! Coretime pallet benchmarking.
//! Coretime pezpallet benchmarking.
#![cfg(feature = "runtime-benchmarks")]
@@ -32,7 +32,7 @@ mod benchmarks {
fn request_revenue_at() {
let root_origin = <T as pezframe_system::Config>::RuntimeOrigin::root();
let mhr = <T as on_demand::Config>::MaxHistoricalRevenue::get();
pezframe_system::Pallet::<T>::set_block_number((mhr + 2).into());
pezframe_system::Pezpallet::<T>::set_block_number((mhr + 2).into());
let minimum_balance = <T as on_demand::Config>::Currency::minimum_balance();
let rev: BoundedVec<
<<T as on_demand::Config>::Currency as pezframe_support::traits::Currency<
@@ -46,7 +46,7 @@ mod benchmarks {
crate::paras::Heads::<T>::insert(ParaId::from(T::BrokerId::get()), vec![1, 2, 3]);
<T as on_demand::Config>::Currency::make_free_balance_be(
&<on_demand::Pallet<T>>::account_id(),
&<on_demand::Pezpallet<T>>::account_id(),
minimum_balance * (mhr * (mhr + 1)).into(),
);
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Pezkuwi. If not, see <http://www.gnu.org/licenses/>.
//! Migrations for the Coretime pallet.
//! Migrations for the Coretime pezpallet.
pub use v_coretime::{GetLegacyLease, MigrateToCoretime};
@@ -70,11 +70,11 @@ mod v_coretime {
> MigrateToCoretime<T, XcmSender, LegacyLease, TIMESLICE_PERIOD>
{
fn already_migrated() -> bool {
// We are using the assigner coretime because the coretime pallet doesn't has any
// We are using the assigner coretime because the coretime pezpallet doesn't has any
// storage data. But both pallets are introduced at the same time, so this is fine.
let name_hash = assigner_coretime::Pallet::<T>::name_hash();
let name_hash = assigner_coretime::Pezpallet::<T>::name_hash();
let mut next_key = name_hash.to_vec();
let storage_version_key = StorageVersion::storage_key::<assigner_coretime::Pallet<T>>();
let storage_version_key = StorageVersion::storage_key::<assigner_coretime::Pezpallet<T>>();
loop {
match pezsp_io::storage::next_key(&next_key) {
@@ -82,7 +82,7 @@ mod v_coretime {
Some(key) if &key == &storage_version_key => {
next_key = key;
},
// If there is any other key with the prefix of the pallet,
// If there is any other key with the prefix of the pezpallet,
// we already have executed the migration.
Some(key) if key.starts_with(&name_hash) => {
log::info!("`MigrateToCoretime` already executed!");
@@ -122,7 +122,7 @@ mod v_coretime {
let total_core_count = config.scheduler_params.num_cores + legacy_paras.len() as u32;
let dmp_queue_size =
crate::dmp::Pallet::<T>::dmq_contents(T::BrokerId::get().into()).len() as u32;
crate::dmp::Pezpallet::<T>::dmq_contents(T::BrokerId::get().into()).len() as u32;
let total_core_count = total_core_count as u32;
@@ -141,7 +141,7 @@ mod v_coretime {
<(u32, u32)>::decode(&mut &state[..]).unwrap();
let dmp_queue_size =
crate::dmp::Pallet::<T>::dmq_contents(T::BrokerId::get().into()).len() as u32;
crate::dmp::Pezpallet::<T>::dmq_contents(T::BrokerId::get().into()).len() as u32;
let config = configuration::ActiveConfig::<T>::get();
let new_core_count = config.scheduler_params.num_cores;
ensure!(new_core_count == prev_core_count, "Total number of cores need to not change.");
@@ -165,9 +165,9 @@ mod v_coretime {
>() -> Weight {
let legacy_paras = LegacyLease::get_all_teyrchains_with_leases();
let legacy_count = legacy_paras.len() as u32;
let now = pezframe_system::Pallet::<T>::block_number();
let now = pezframe_system::Pezpallet::<T>::block_number();
for (core, para_id) in legacy_paras.into_iter().enumerate() {
let r = assigner_coretime::Pallet::<T>::assign_core(
let r = assigner_coretime::Pezpallet::<T>::assign_core(
CoreIndex(core as u32),
now,
vec![(CoreAssignment::Task(para_id.into()), PartsOf57600::FULL)],
@@ -185,7 +185,7 @@ mod v_coretime {
let config = configuration::ActiveConfig::<T>::get();
for on_demand in 0..config.scheduler_params.num_cores {
let core = CoreIndex(legacy_count.saturating_add(on_demand as _));
let r = assigner_coretime::Pallet::<T>::assign_core(
let r = assigner_coretime::Pezpallet::<T>::assign_core(
core,
now,
vec![(CoreAssignment::Pool, PartsOf57600::FULL)],
+36 -36
View File
@@ -25,7 +25,7 @@ use pezframe_support::{
traits::{defensive_prelude::*, Currency},
};
use pezframe_system::pezpallet_prelude::*;
pub use pallet::*;
pub use pezpallet::*;
use pezpallet_broker::{CoreAssignment, CoreIndex as BrokerCoreIndex};
use pezkuwi_primitives::{Balance, BlockNumber, CoreIndex, Id as ParaId};
use pezsp_arithmetic::traits::SaturatedConversion;
@@ -75,7 +75,7 @@ pub type BalanceOf<T> = <<T as on_demand::Config>::Currency as Currency<
<T as pezframe_system::Config>::AccountId,
>>::Balance;
/// Broker pallet index on the coretime chain. Used to
/// Broker pezpallet index on the coretime chain. Used to
///
/// construct remote calls. The codec index must correspond to the index of `Broker` in the
/// `construct_runtime` of the coretime chain.
@@ -85,7 +85,7 @@ enum BrokerRuntimePallets {
Broker(CoretimeCalls),
}
/// Call encoding for the calls needed from the Broker pallet.
/// Call encoding for the calls needed from the Broker pezpallet.
#[derive(Encode, Decode)]
enum CoretimeCalls {
#[codec(index = 1)]
@@ -100,8 +100,8 @@ enum CoretimeCalls {
SwapLeases(ParaId, ParaId),
}
#[pezframe_support::pallet]
pub mod pallet {
#[pezframe_support::pezpallet]
pub mod pezpallet {
use crate::configuration;
use pezsp_runtime::traits::TryConvert;
@@ -110,23 +110,23 @@ pub mod pallet {
use super::*;
#[pallet::pallet]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
#[pezpallet::without_storage_info]
pub struct Pezpallet<T>(_);
#[pallet::config]
#[pezpallet::config]
pub trait Config: pezframe_system::Config + assigner_coretime::Config + on_demand::Config {
type RuntimeOrigin: From<<Self as pezframe_system::Config>::RuntimeOrigin>
+ Into<result::Result<Origin, <Self as Config>::RuntimeOrigin>>;
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
/// The ParaId of the coretime chain.
#[pallet::constant]
#[pezpallet::constant]
type BrokerId: Get<u32>;
/// The coretime chain pot location.
#[pallet::constant]
#[pezpallet::constant]
type BrokerPotLocation: Get<InteriorLocation>;
/// Something that provides the weight of this pallet.
/// Something that provides the weight of this pezpallet.
type WeightInfo: WeightInfo;
/// The XCM sender.
type SendXcm: SendXcm;
@@ -141,8 +141,8 @@ pub mod pallet {
type MaxXcmTransactWeight: Get<Weight>;
}
#[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> {
/// The broker chain has asked for revenue information for a specific block.
RevenueInfoRequested { when: BlockNumberFor<T> },
@@ -150,7 +150,7 @@ pub mod pallet {
CoreAssigned { core: CoreIndex },
}
#[pallet::error]
#[pezpallet::error]
pub enum Error<T> {
/// The paraid making the call is not the coretime brokerage system teyrchain.
NotBroker,
@@ -161,40 +161,40 @@ pub mod pallet {
AssetTransferFailed,
}
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
#[pezpallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pezpallet<T> {}
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pezpallet::call]
impl<T: Config> Pezpallet<T> {
/// Request the configuration to be updated with the specified number of cores. Warning:
/// Since this only schedules a configuration update, it takes two sessions to come into
/// effect.
///
/// - `origin`: Root or the Coretime Chain
/// - `count`: total number of cores
#[pallet::weight(<T as Config>::WeightInfo::request_core_count())]
#[pallet::call_index(1)]
#[pezpallet::weight(<T as Config>::WeightInfo::request_core_count())]
#[pezpallet::call_index(1)]
pub fn request_core_count(origin: OriginFor<T>, count: u16) -> DispatchResult {
// Ignore requests not coming from the coretime chain or root.
Self::ensure_root_or_para(origin, <T as Config>::BrokerId::get().into())?;
configuration::Pallet::<T>::set_coretime_cores_unchecked(u32::from(count))
configuration::Pezpallet::<T>::set_coretime_cores_unchecked(u32::from(count))
}
/// Request to claim the instantaneous coretime sales revenue starting from the block it was
/// last claimed until and up to the block specified. The claimed amount value is sent back
/// to the Coretime chain in a `notify_revenue` message. At the same time, the amount is
/// teleported to the Coretime chain.
#[pallet::weight(<T as Config>::WeightInfo::request_revenue_at())]
#[pallet::call_index(2)]
#[pezpallet::weight(<T as Config>::WeightInfo::request_revenue_at())]
#[pezpallet::call_index(2)]
pub fn request_revenue_at(origin: OriginFor<T>, when: BlockNumber) -> DispatchResult {
// Ignore requests not coming from the Coretime Chain or Root.
Self::ensure_root_or_para(origin, <T as Config>::BrokerId::get().into())?;
Self::notify_revenue(when)
}
#[pallet::weight(<T as Config>::WeightInfo::credit_account())]
#[pallet::call_index(3)]
#[pezpallet::weight(<T as Config>::WeightInfo::credit_account())]
#[pezpallet::call_index(3)]
pub fn credit_account(
origin: OriginFor<T>,
who: T::AccountId,
@@ -203,7 +203,7 @@ pub mod pallet {
// Ignore requests not coming from the coretime chain or root.
Self::ensure_root_or_para(origin, <T as Config>::BrokerId::get().into())?;
on_demand::Pallet::<T>::credit_account(who, amount.saturated_into());
on_demand::Pezpallet::<T>::credit_account(who, amount.saturated_into());
Ok(())
}
@@ -216,10 +216,10 @@ pub mod pallet {
/// -`begin`: The starting blockheight of the instruction.
/// -`assignment`: How the blockspace should be utilised.
/// -`end_hint`: An optional hint as to when this particular set of instructions will end.
// The broker pallet's `CoreIndex` definition is `u16` but on the relay chain it's `struct
// The broker pezpallet's `CoreIndex` definition is `u16` but on the relay chain it's `struct
// CoreIndex(u32)`
#[pallet::call_index(4)]
#[pallet::weight(<T as Config>::WeightInfo::assign_core(assignment.len() as u32))]
#[pezpallet::call_index(4)]
#[pezpallet::weight(<T as Config>::WeightInfo::assign_core(assignment.len() as u32))]
pub fn assign_core(
origin: OriginFor<T>,
core: BrokerCoreIndex,
@@ -232,14 +232,14 @@ pub mod pallet {
let core = u32::from(core).into();
<assigner_coretime::Pallet<T>>::assign_core(core, begin, assignment, end_hint)?;
<assigner_coretime::Pezpallet<T>>::assign_core(core, begin, assignment, end_hint)?;
Self::deposit_event(Event::<T>::CoreAssigned { core });
Ok(())
}
}
}
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
/// Ensure the origin is one of Root or the `para` itself.
fn ensure_root_or_para(
origin: <T as pezframe_system::Config>::RuntimeOrigin,
@@ -287,13 +287,13 @@ impl<T: Config> Pallet<T> {
/// The Relay-chain must be configured to ensure that only a single revenue information
/// destination exists.
pub fn notify_revenue(until: BlockNumber) -> DispatchResult {
let now = <pezframe_system::Pallet<T>>::block_number();
let now = <pezframe_system::Pezpallet<T>>::block_number();
let until_bnf: BlockNumberFor<T> = until.into();
// When cannot be in the future.
ensure!(until_bnf <= now, Error::<T>::RequestedFutureRevenue);
let amount = <on_demand::Pallet<T>>::claim_revenue_until(until_bnf);
let amount = <on_demand::Pezpallet<T>>::claim_revenue_until(until_bnf);
log::debug!(target: LOG_TARGET, "Revenue info requested: {:?}", amount);
let raw_revenue: Balance = amount.try_into().map_err(|_| {
@@ -328,7 +328,7 @@ impl<T: Config> Pallet<T> {
}
}
impl<T: Config> OnNewSession<BlockNumberFor<T>> for Pallet<T> {
impl<T: Config> OnNewSession<BlockNumberFor<T>> for Pezpallet<T> {
fn on_new_session(notification: &SessionChangeNotification<BlockNumberFor<T>>) {
Self::initializer_on_new_session(notification);
}
@@ -353,7 +353,7 @@ fn do_notify_revenue<T: Config>(when: BlockNumber, raw_revenue: Balance) -> Resu
if raw_revenue > 0 {
let on_demand_pot =
T::AccountToLocation::try_convert(&<on_demand::Pallet<T>>::account_id()).map_err(
T::AccountToLocation::try_convert(&<on_demand::Pezpallet<T>>::account_id()).map_err(
|err| {
log::error!(
target: LOG_TARGET,