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
@@ -15,13 +15,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Staking pallet benchmarking.
//! Staking pezpallet benchmarking.
use super::*;
use crate::{
asset,
session_rotation::{Eras, Rotator},
Pallet as Staking,
Pezpallet as Staking,
};
use alloc::collections::BTreeMap;
pub use pezframe_benchmarking::{
@@ -753,7 +753,7 @@ mod benchmarks {
// clean up any existing state.
clear_validators_and_nominators::<T>();
let origin_weight = Pallet::<T>::min_nominator_bond()
let origin_weight = Pezpallet::<T>::min_nominator_bond()
// we use 100 to play friendly with the list threshold values in the mock
.max(100u32.into());
@@ -1062,7 +1062,7 @@ mod benchmarks {
reporters: Default::default(),
slash_fraction: Perbill::from_percent(50),
}];
<crate::Pallet<T> as rc_client::AHStakingInterface>::on_new_offences(
<crate::Pezpallet<T> as rc_client::AHStakingInterface>::on_new_offences(
slash_session,
offences,
);
@@ -1136,7 +1136,7 @@ mod benchmarks {
#[block]
{
<crate::Pallet<T> as rc_client::AHStakingInterface>::on_new_offences(
<crate::Pezpallet<T> as rc_client::AHStakingInterface>::on_new_offences(
slash_session,
offences,
);
@@ -1183,7 +1183,7 @@ mod benchmarks {
#[block]
{
<crate::Pallet<T> as rc_client::AHStakingInterface>::on_relay_session_report(report);
<crate::Pezpallet<T> as rc_client::AHStakingInterface>::on_relay_session_report(report);
}
ensure!(Rotator::<T>::active_era() == initial_active_era + 1, "active era not bumped");
@@ -1310,7 +1310,7 @@ mod benchmarks {
let result;
#[block]
{
result = Pallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
result = Pezpallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
}
validate_pruning_weight::<T>(&result, "ErasStakersPaged", v);
@@ -1331,7 +1331,7 @@ mod benchmarks {
let result;
#[block]
{
result = Pallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
result = Pezpallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
}
validate_pruning_weight::<T>(&result, "ErasStakersOverview", v);
@@ -1352,7 +1352,7 @@ mod benchmarks {
let result;
#[block]
{
result = Pallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
result = Pezpallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
}
validate_pruning_weight::<T>(&result, "ErasValidatorPrefs", v);
@@ -1373,7 +1373,7 @@ mod benchmarks {
let result;
#[block]
{
result = Pallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
result = Pezpallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
}
validate_pruning_weight::<T>(&result, "ClaimedRewards", v);
@@ -1392,7 +1392,7 @@ mod benchmarks {
let result;
#[block]
{
result = Pallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
result = Pezpallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
}
validate_pruning_weight::<T>(&result, "ErasValidatorReward", 1);
@@ -1411,7 +1411,7 @@ mod benchmarks {
let result;
#[block]
{
result = Pallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
result = Pezpallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
}
validate_pruning_weight::<T>(&result, "ErasRewardPoints", 1);
@@ -1430,7 +1430,7 @@ mod benchmarks {
let result;
#[block]
{
result = Pallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
result = Pezpallet::<T>::prune_era_step(RawOrigin::Signed(caller).into(), era);
}
validate_pruning_weight::<T>(&result, "ErasTotalStake", 1);
@@ -62,7 +62,7 @@
//!
//! ### Implementation Details
//!
//! The current implementation of the static tracker is tightly coupled with the staking pallet
//! The current implementation of the static tracker is tightly coupled with the staking pezpallet
//! implementation, namely the representation of a voter ([`VoterOf`]). The SCALE encoded byte size
//! is calculated using [`Encode::size_hint`] of each type in the voter tuple. Each voter's byte
//! size is the sum of:
@@ -32,7 +32,7 @@
//! state consistency.
use crate::{
asset, log, BalanceOf, Bonded, Config, DecodeWithMemTracking, Error, Ledger, Pallet, Payee,
asset, log, BalanceOf, Bonded, Config, DecodeWithMemTracking, Error, Ledger, Pezpallet, Payee,
RewardDestination, Vec, VirtualStakers,
};
use alloc::{collections::BTreeMap, fmt::Debug};
@@ -248,7 +248,7 @@ impl<T: Config> StakingLedger<T> {
}
// We skip locking virtual stakers.
if !Pallet::<T>::is_virtual_staker(&self.stash) {
if !Pezpallet::<T>::is_virtual_staker(&self.stash) {
// for direct stakers, update lock on stash based on ledger.
asset::update_stake::<T>(&self.stash, self.total)
.map_err(|_| Error::<T>::NotEnoughFunds)?;
@@ -327,7 +327,7 @@ impl<T: Config> StakingLedger<T> {
// if not virtual staker, clear locks.
asset::kill_stake::<T>(&ledger.stash)?;
}
Pallet::<T>::deposit_event(crate::Event::<T>::StakerRemoved {
Pezpallet::<T>::deposit_event(crate::Event::<T>::StakerRemoved {
stash: ledger.stash.clone(),
});
Ok(())
+12 -12
View File
@@ -15,9 +15,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! # Staking Async Pallet
//! # Staking Async Pezpallet
//!
//! This pallet is a fork of the original `pezpallet-staking`, with a number of key differences:
//! This pezpallet is a fork of the original `pezpallet-staking`, with a number of key differences:
//!
//! * It no longer has access to a secure timestamp, previously used to calculate the duration of an
//! era.
@@ -26,10 +26,10 @@
//! * It is capable of working with a multi-page `ElectionProvider``, aka.
//! `pezpallet-election-provider-multi-block`.
//!
//! While `pezpallet-staking` was somewhat general-purpose, this pallet is absolutely NOT right from
//! While `pezpallet-staking` was somewhat general-purpose, this pezpallet is absolutely NOT right from
//! the get-go: It is designed to be used ONLY in Pezkuwi/Kusama AssetHub system teyrchains.
//!
//! The workings of this pallet can be divided into a number of subsystems, as follows.
//! The workings of this pezpallet can be divided into a number of subsystems, as follows.
//!
//! ## User Interactions
//!
@@ -45,7 +45,7 @@
//!
//! ## Slashing Pipeline and Withdrawal Restrictions
//!
//! This pallet implements a robust slashing mechanism that ensures the integrity of the staking
//! This pezpallet implements a robust slashing mechanism that ensures the integrity of the staking
//! system while preventing stakers from withdrawing funds that might still be subject to slashing.
//!
//! ### Overview of the Slashing Pipeline
@@ -190,7 +190,7 @@ mod tests;
pub mod asset;
pub mod election_size_tracker;
pub mod ledger;
mod pallet;
mod pezpallet;
pub mod session_rotation;
pub mod slashing;
pub mod weights;
@@ -220,7 +220,7 @@ pub use weights::WeightInfo;
// public exports
pub use ledger::{StakingLedger, UnlockChunk};
pub use pallet::{pallet::*, UseNominatorsAndValidatorsMap, UseValidatorsMap};
pub use pezpallet::{pezpallet::*, UseNominatorsAndValidatorsMap, UseValidatorsMap};
pub(crate) const STAKING_ID: LockIdentifier = *b"staking ";
pub(crate) const LOG_TARGET: &str = "runtime::staking-async";
@@ -231,12 +231,12 @@ macro_rules! log {
($level:tt, $patter:expr $(, $values:expr)* $(,)?) => {
log::$level!(
target: crate::LOG_TARGET,
concat!("[{:?}] 💸 ", $patter), <pezframe_system::Pallet<T>>::block_number() $(, $values)*
concat!("[{:?}] 💸 ", $patter), <pezframe_system::Pezpallet<T>>::block_number() $(, $values)*
)
};
}
/// Alias for a bounded set of exposures behind a validator, parameterized by this pallet's
/// Alias for a bounded set of exposures behind a validator, parameterized by this pezpallet's
/// election provider.
pub type BoundedExposuresOf<T> = BoundedVec<
(
@@ -246,7 +246,7 @@ pub type BoundedExposuresOf<T> = BoundedVec<
MaxWinnersPerPageOf<<T as Config>::ElectionProvider>,
>;
/// Alias for the maximum number of winners (aka. active validators), as defined in by this pallet's
/// Alias for the maximum number of winners (aka. active validators), as defined in by this pezpallet's
/// config.
pub type MaxWinnersOf<T> = <T as Config>::MaxValidatorSet;
@@ -260,7 +260,7 @@ pub type MaxNominationsOf<T> =
/// Counter for the number of "reward" points earned by a given validator.
pub type RewardPoint = u32;
/// The balance type of this pallet.
/// The balance type of this pezpallet.
pub type BalanceOf<T> = <T as Config>::CurrencyBalance;
type PositiveImbalanceOf<T> = Debt<<T as pezframe_system::Config>::AccountId, <T as Config>::Currency>;
@@ -566,7 +566,7 @@ impl<T: Config, RS: Get<BlockNumberFor<T>>, S: Get<BlockNumberFor<T>>> Get<Sessi
fn get() -> SessionIndex {
let election_duration = <T::ElectionProvider as ElectionProvider>::duration_with_export();
let sessions_needed = (election_duration + S::get()) / RS::get();
// add one, because we know the RC session pallet wants to buffer for one session, and
// add one, because we know the RC session pezpallet wants to buffer for one session, and
// another one cause we will receive activation report one session after that.
sessions_needed
.saturating_add(One::one())
@@ -240,7 +240,7 @@ impl Contains<AccountId> for MockedRestrictList {
}
}
/// A representation of the session pallet that lives on the relay chain.
/// A representation of the session pezpallet that lives on the relay chain.
pub mod session_mock {
use super::*;
use pezpallet_staking_async_rc_client::ValidatorSetReport;
@@ -417,7 +417,7 @@ impl EraPayout<Balance> for OneTokenPerMillisecond {
}
}
impl crate::pallet::pallet::Config for Test {
impl crate::pezpallet::pezpallet::Config for Test {
type RuntimeHoldReason = RuntimeHoldReason;
type OldCurrency = Balances;
type Currency = Balances;
@@ -788,7 +788,7 @@ pub(crate) fn time_per_era() -> u64 {
pub(crate) fn reward_all_elected() {
let rewards = session_mock::Session::validators().into_iter().map(|v| (v, 1));
<Pallet<Test>>::reward_by_ids(rewards)
<Pezpallet<Test>>::reward_by_ids(rewards)
}
pub(crate) fn era_exposures(era: u32) -> Vec<(AccountId, Exposure<AccountId, Balance>)> {
@@ -57,7 +57,7 @@ use pezsp_staking::{
StakingInterface,
};
use super::pallet::*;
use super::pezpallet::*;
#[cfg(feature = "try-runtime")]
use pezframe_support::ensure;
@@ -72,7 +72,7 @@ use pezsp_runtime::TryRuntimeError;
/// times and then give up.
const NPOS_MAX_ITERATIONS_COEFFICIENT: u32 = 2;
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
/// Returns the minimum required bond for participation, considering nominators,
/// and the chains existential deposit.
///
@@ -164,7 +164,7 @@ impl<T: Config> Pallet<T> {
/// This prevents call sites from repeatedly requesting `total_issuance` from backend. But it is
/// important to be only used while the total issuance is not changing.
pub fn weight_of_fn() -> Box<dyn Fn(&T::AccountId) -> VoteWeight> {
// NOTE: changing this to unboxed `impl Fn(..)` return type and the pallet will still
// NOTE: changing this to unboxed `impl Fn(..)` return type and the pezpallet will still
// compile, while some types in mock fail to resolve.
let issuance = asset::total_issuance::<T>();
Box::new(move |who: &T::AccountId| -> VoteWeight {
@@ -805,11 +805,11 @@ impl<T: Config> Pallet<T> {
outcome
}
/// Register some amount of weight directly with the system pallet.
/// Register some amount of weight directly with the system pezpallet.
///
/// This is always mandatory weight.
pub(crate) fn register_weight(weight: Weight) {
<pezframe_system::Pallet<T>>::register_extra_weight_unchecked(
<pezframe_system::Pezpallet<T>>::register_extra_weight_unchecked(
weight,
DispatchClass::Mandatory,
);
@@ -865,22 +865,22 @@ impl<T: Config> Pallet<T> {
};
// Get rid of the extra consumer we used to have with OldCurrency.
pezframe_system::Pallet::<T>::dec_consumers(&stash);
pezframe_system::Pezpallet::<T>::dec_consumers(&stash);
Self::deposit_event(Event::<T>::CurrencyMigrated { stash: stash.clone(), force_withdraw });
Ok(())
}
fn do_migrate_virtual_staker(stash: &T::AccountId) -> DispatchResult {
// Funds for virtual stakers not managed/held by this pallet. We only need to clear
// Funds for virtual stakers not managed/held by this pezpallet. We only need to clear
// the extra consumer we used to have with OldCurrency.
pezframe_system::Pallet::<T>::dec_consumers(&stash);
pezframe_system::Pezpallet::<T>::dec_consumers(&stash);
// The delegation system that manages the virtual staker needed to increment provider
// previously because of the consumer needed by this pallet. In reality, this stash
// previously because of the consumer needed by this pezpallet. In reality, this stash
// is just a key for managing the ledger and the account does not need to hold any
// balance or exist. We decrement this provider.
let actual_providers = pezframe_system::Pallet::<T>::providers(stash);
let actual_providers = pezframe_system::Pezpallet::<T>::providers(stash);
let expected_providers =
// provider is expected to be 1 but someone can always transfer some free funds to
@@ -898,13 +898,13 @@ impl<T: Config> Pallet<T> {
ensure!(actual_providers == expected_providers, Error::<T>::AlreadyMigrated);
// dec provider
let _ = pezframe_system::Pallet::<T>::dec_providers(&stash)?;
let _ = pezframe_system::Pezpallet::<T>::dec_providers(&stash)?;
return Ok(())
}
}
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
/// Returns the current nominations quota for nominators.
///
/// Used by the runtime API.
@@ -928,7 +928,7 @@ impl<T: Config> Pallet<T> {
}
}
impl<T: Config> ElectionDataProvider for Pallet<T> {
impl<T: Config> ElectionDataProvider for Pezpallet<T> {
type AccountId = T::AccountId;
type BlockNumber = BlockNumberFor<T>;
type MaxVotesPerVoter = MaxNominationsOf<T>;
@@ -1102,7 +1102,7 @@ impl<T: Config> ElectionDataProvider for Pallet<T> {
}
}
impl<T: Config> rc_client::AHStakingInterface for Pallet<T> {
impl<T: Config> rc_client::AHStakingInterface for Pezpallet<T> {
type AccountId = T::AccountId;
type MaxValidatorSet = T::MaxValidatorSet;
@@ -1338,7 +1338,7 @@ impl<T: Config> rc_client::AHStakingInterface for Pallet<T> {
}
}
impl<T: Config> ScoreProvider<T::AccountId> for Pallet<T> {
impl<T: Config> ScoreProvider<T::AccountId> for Pezpallet<T> {
type Score = VoteWeight;
fn score(who: &T::AccountId) -> Option<Self::Score> {
@@ -1421,7 +1421,7 @@ impl<T: Config> SortedListProvider<T::AccountId> for UseValidatorsMap<T> {
Ok(())
}
fn get_score(id: &T::AccountId) -> Result<Self::Score, Self::Error> {
Ok(Pallet::<T>::weight_of(id).into())
Ok(Pezpallet::<T>::weight_of(id).into())
}
fn on_update(_: &T::AccountId, _weight: Self::Score) -> Result<(), Self::Error> {
// nothing to do on update.
@@ -1499,7 +1499,7 @@ impl<T: Config> SortedListProvider<T::AccountId> for UseNominatorsAndValidatorsM
Ok(())
}
fn get_score(id: &T::AccountId) -> Result<Self::Score, Self::Error> {
Ok(Pallet::<T>::weight_of(id))
Ok(Pezpallet::<T>::weight_of(id))
}
fn on_update(_: &T::AccountId, _weight: Self::Score) -> Result<(), Self::Error> {
// nothing to do on update.
@@ -1537,7 +1537,7 @@ impl<T: Config> SortedListProvider<T::AccountId> for UseNominatorsAndValidatorsM
}
}
impl<T: Config> StakingInterface for Pallet<T> {
impl<T: Config> StakingInterface for Pezpallet<T> {
type AccountId = T::AccountId;
type Balance = BalanceOf<T>;
type CurrencyToVote = T::CurrencyToVote;
@@ -1582,7 +1582,7 @@ impl<T: Config> StakingInterface for Pallet<T> {
}
fn set_payee(stash: &Self::AccountId, reward_acc: &Self::AccountId) -> DispatchResult {
// Since virtual stakers are not allowed to compound their rewards as this pallet does not
// Since virtual stakers are not allowed to compound their rewards as this pezpallet does not
// manage their locks, we do not allow reward account to be set same as stash. For
// external pallets that manage the virtual bond, they can claim rewards and re-bond them.
ensure!(
@@ -1675,12 +1675,12 @@ impl<T: Config> StakingInterface for Pallet<T> {
}
}
/// Whether `who` is a virtual staker whose funds are managed by another pallet.
/// Whether `who` is a virtual staker whose funds are managed by another pezpallet.
///
/// There is an assumption that, this account is keyless and managed by another pallet in the
/// There is an assumption that, this account is keyless and managed by another pezpallet in the
/// runtime. Hence, it can never sign its own transactions.
fn is_virtual_staker(who: &T::AccountId) -> bool {
pezframe_system::Pallet::<T>::account_nonce(who).is_zero() &&
pezframe_system::Pezpallet::<T>::account_nonce(who).is_zero() &&
VirtualStakers::<T>::contains_key(who)
}
@@ -1716,7 +1716,7 @@ impl<T: Config> StakingInterface for Pallet<T> {
}
}
impl<T: Config> pezsp_staking::StakingUnchecked for Pallet<T> {
impl<T: Config> pezsp_staking::StakingUnchecked for Pezpallet<T> {
fn migrate_to_virtual_staker(who: &Self::AccountId) -> DispatchResult {
asset::kill_stake::<T>(who)?;
VirtualStakers::<T>::insert(who, ());
@@ -1761,9 +1761,9 @@ impl<T: Config> pezsp_staking::StakingUnchecked for Pallet<T> {
}
#[cfg(any(test, feature = "try-runtime"))]
impl<T: Config> Pallet<T> {
impl<T: Config> Pezpallet<T> {
pub(crate) fn do_try_state(_now: BlockNumberFor<T>) -> Result<(), TryRuntimeError> {
// If the pallet is not initialized (both ActiveEra and CurrentEra are None),
// If the pezpallet is not initialized (both ActiveEra and CurrentEra are None),
// there's nothing to check, so return early.
if ActiveEra::<T>::get().is_none() && CurrentEra::<T>::get().is_none() {
return Ok(());
@@ -1913,7 +1913,7 @@ impl<T: Config> Pallet<T> {
"ledger corrupted for virtual staker"
);
ensure!(
pezframe_system::Pallet::<T>::account_nonce(&stash).is_zero(),
pezframe_system::Pezpallet::<T>::account_nonce(&stash).is_zero(),
"virtual stakers are keyless and should not have any nonce"
);
let reward_destination = <Payee<T>>::get(stash.clone()).unwrap();
@@ -234,7 +234,7 @@ impl<T: Config> Eras<T> {
) {
let page_size = T::MaxExposurePageSize::get().defensive_max(1);
if cfg!(debug_assertions) && cfg!(not(feature = "runtime-benchmarks")) {
// sanitize the exposure in case some test data from this pallet is wrong.
// sanitize the exposure in case some test data from this pezpallet is wrong.
// ignore benchmarks as other pallets might do weird things.
let expected_total = exposure
.others
@@ -445,7 +445,7 @@ impl<T: Config> Eras<T> {
}
}
/// Ensure the given era has indeed been already pruned. This is called by the main pallet in
/// Ensure the given era has indeed been already pruned. This is called by the main pezpallet in
/// do_prune_era_step.
pub(crate) fn era_absent(era: EraIndex) -> Result<(), pezsp_runtime::TryRuntimeError> {
// check double+ maps
@@ -499,7 +499,7 @@ impl<T: Config> Eras<T> {
/// Manages session rotation logic.
///
/// This controls the following storage items in FULL, meaning that they should not be accessed
/// directly from anywhere else in this pallet:
/// directly from anywhere else in this pezpallet:
///
/// * `CurrentEra`: The current planning era
/// * `ActiveEra`: The current active era
@@ -637,7 +637,7 @@ impl<T: Config> Rotator<T> {
id,
current_planned_era
);
Pallet::<T>::deposit_event(Event::Unexpected(
Pezpallet::<T>::deposit_event(Event::Unexpected(
UnexpectedKind::UnknownValidatorActivation,
));
},
@@ -681,7 +681,7 @@ impl<T: Config> Rotator<T> {
},
}
Pallet::<T>::deposit_event(Event::SessionRotated {
Pezpallet::<T>::deposit_event(Event::SessionRotated {
starting_session: starting,
active_era: Self::active_era(),
planned_era: Self::planned_era(),
@@ -774,7 +774,7 @@ impl<T: Config> Rotator<T> {
// if the cap is zero (not set), we don't cap the era duration.
uncapped_era_duration
} else if uncapped_era_duration > cap {
Pallet::<T>::deposit_event(Event::Unexpected(UnexpectedKind::EraDurationBoundExceeded));
Pezpallet::<T>::deposit_event(Event::Unexpected(UnexpectedKind::EraDurationBoundExceeded));
// if the cap is set, and era duration exceeds the cap, we cap the era duration to the
// maximum allowed.
@@ -813,7 +813,7 @@ impl<T: Config> Rotator<T> {
let validator_payout = validator_payout.min(max_staked_rewards * total_payout);
let remainder = total_payout.saturating_sub(validator_payout);
Pallet::<T>::deposit_event(Event::<T>::EraPaid {
Pezpallet::<T>::deposit_event(Event::<T>::EraPaid {
era_index: ending_era.index,
validator_payout,
remainder,
@@ -871,7 +871,7 @@ impl<T: Config> Rotator<T> {
/// `Some(_)` something is ongoing, otherwise not.
/// * We fully trust [`Config::ElectionProvider`] to give us a full set of validators, with enough
/// backing after all calls to `maybe_fetch_election_results` are done. Note that older versions
/// of this pallet had a `MinimumValidatorCount` to double-check this, but we don't check it
/// of this pezpallet had a `MinimumValidatorCount` to double-check this, but we don't check it
/// anymore.
/// * `maybe_fetch_election_results` returns no weight. Its weight should be taken account in the
/// e2e benchmarking of the [`Config::ElectionProvider`].
@@ -887,7 +887,7 @@ impl<T: Config> EraElectionPlanner<T> {
VoterSnapshotStatus::<T>::kill();
NextElectionPage::<T>::kill();
ElectableStashes::<T>::kill();
Pallet::<T>::register_weight(T::DbWeight::get().writes(3));
Pezpallet::<T>::register_weight(T::DbWeight::get().writes(3));
}
/// Fetches the number of pages configured by the election provider.
@@ -902,7 +902,7 @@ impl<T: Config> EraElectionPlanner<T> {
.inspect_err(|e| log!(warn, "Election provider failed to start: {:?}", e))
}
/// Hook to be used in the pallet's on-initialize.
/// Hook to be used in the pezpallet's on-initialize.
pub(crate) fn maybe_fetch_election_results() {
if let Ok(true) = T::ElectionProvider::status() {
crate::log!(
@@ -947,7 +947,7 @@ impl<T: Config> EraElectionPlanner<T> {
}
/// Get the right value of the first session that needs to be pruned on the RC's historical
/// session pallet.
/// session pezpallet.
fn get_prune_up_to() -> Option<SessionIndex> {
let bonded_eras = BondedEras::<T>::get();
@@ -983,14 +983,14 @@ impl<T: Config> EraElectionPlanner<T> {
);
};
Pallet::<T>::deposit_event(Event::PagedElectionProceeded {
Pezpallet::<T>::deposit_event(Event::PagedElectionProceeded {
page,
result: inner_processing_results.map(|x| x as u32).map_err(|x| x as u32),
});
},
Err(e) => {
log!(warn, "election provider page failed due to {:?} (page: {})", e, page);
Pallet::<T>::deposit_event(Event::PagedElectionProceeded { page, result: Err(0) });
Pezpallet::<T>::deposit_event(Event::PagedElectionProceeded { page, result: Err(0) });
},
}
}
@@ -42,7 +42,7 @@
use crate::{
asset, log, session_rotation::Eras, BalanceOf, Config, NegativeImbalanceOf, OffenceQueue,
OffenceQueueEras, PagedExposure, Pallet, Perbill, ProcessingOffence, SlashRewardFraction,
OffenceQueueEras, PagedExposure, Pezpallet, Perbill, ProcessingOffence, SlashRewardFraction,
UnappliedSlash, UnappliedSlashes, ValidatorSlashInEra, WeightInfo,
};
use alloc::vec::Vec;
@@ -233,7 +233,7 @@ pub(crate) fn process_offence<T: Config>() -> Weight {
return incomplete_consumed_weight;
};
<Pallet<T>>::deposit_event(super::Event::<T>::SlashComputed {
<Pezpallet<T>>::deposit_event(super::Event::<T>::SlashComputed {
offence_era,
slash_era,
offender: offender.clone(),
@@ -354,7 +354,7 @@ fn slash_nominators<T: Config>(
let prior_slashed = params.prior_slash * nominator.value;
let new_slash = params.slash * nominator.value;
// this should always be positive since prior slash is always less than the new slash or
// filtered out when offence is reported (`Pallet::on_new_offences`).
// filtered out when offence is reported (`Pezpallet::on_new_offences`).
let slash_diff = new_slash.defensive_saturating_sub(prior_slashed);
if slash_diff == Zero::zero() {
@@ -398,7 +398,7 @@ pub fn do_slash<T: Config>(
slash_era: EraIndex,
) {
let mut ledger =
match Pallet::<T>::ledger(pezsp_staking::StakingAccount::Stash(stash.clone())).defensive() {
match Pezpallet::<T>::ledger(pezsp_staking::StakingAccount::Stash(stash.clone())).defensive() {
Ok(ledger) => ledger,
Err(_) => return, // nothing to do.
};
@@ -410,7 +410,7 @@ pub fn do_slash<T: Config>(
}
// Skip slashing for virtual stakers. The pallets managing them should handle the slashing.
if !Pallet::<T>::is_virtual_staker(stash) {
if !Pezpallet::<T>::is_virtual_staker(stash) {
let (imbalance, missing) = asset::slash::<T>(stash, value);
slashed_imbalance.subsume(imbalance);
@@ -425,7 +425,7 @@ pub fn do_slash<T: Config>(
.defensive_proof("ledger fetched from storage so it exists in storage; qed.");
// trigger the event
<Pallet<T>>::deposit_event(super::Event::<T>::Slashed { staker: stash.clone(), amount: value });
<Pezpallet<T>>::deposit_event(super::Event::<T>::Slashed { staker: stash.clone(), amount: value });
}
/// Apply a previously-unapplied slash.
@@ -18,7 +18,7 @@
//! Testing utils for staking. Provides some common functions to setup staking state, such as
//! bonding validators, nominators, and generating different types of solutions.
use crate::{Pallet as Staking, *};
use crate::{Pezpallet as Staking, *};
use pezframe_benchmarking::account;
use pezframe_system::RawOrigin;
use rand_chacha::{
@@ -257,7 +257,7 @@ pub fn migrate_to_old_currency<T: Config>(who: T::AccountId) {
asset::kill_stake::<T>(&who).expect("remove hold failed");
// replicate old behaviour of explicit increment of consumer.
pezframe_system::Pallet::<T>::inc_consumers(&who).expect("increment consumer failed");
pezframe_system::Pezpallet::<T>::inc_consumers(&who).expect("increment consumer failed");
}
/// Set active era to the given era index.
@@ -881,7 +881,7 @@ mod score_provider {
#[test]
fn no_score_for_non_stakers() {
ExtBuilder::default().build_and_execute(|| {
// given 777 being neither a nominator nor a validator in this pallet.
// given 777 being neither a nominator nor a validator in this pezpallet.
assert!(
!Ledger::<Test>::get(777).is_some() &&
!Validators::<Test>::contains_key(777) &&
@@ -941,7 +941,7 @@ mod paged_on_initialize_era_election_planner {
]
);
// era progressed and electable stashes have been served to session pallet.
// era progressed and electable stashes have been served to session pezpallet.
assert_eq_uvec!(Session::validators(), vec![11, 21, 31]);
// 4. in the next era, the validator set does not include 31 anymore which was
@@ -1135,9 +1135,9 @@ mod paged_on_initialize_era_election_planner {
// assert_eq!(Session::validators(), vec![21, 31, 71]);
// // distribute reward,
// Pallet::<Test>::reward_by_ids(vec![(21, 50)]);
// Pallet::<Test>::reward_by_ids(vec![(31, 50)]);
// Pallet::<Test>::reward_by_ids(vec![(71, 50)]);
// Pezpallet::<Test>::reward_by_ids(vec![(21, 50)]);
// Pezpallet::<Test>::reward_by_ids(vec![(31, 50)]);
// Pezpallet::<Test>::reward_by_ids(vec![(71, 50)]);
// let total_payout = validator_payout_for(time_per_era());
@@ -650,7 +650,7 @@ mod staking_unchecked {
assert_eq!(asset::staked::<Test>(&200), 0);
// and they are marked as virtual stakers
assert_eq!(Pallet::<Test>::is_virtual_staker(&200), true);
assert_eq!(Pezpallet::<Test>::is_virtual_staker(&200), true);
});
}
@@ -997,7 +997,7 @@ mod hold_migration {
bond_virtual_nominator(200, 201, 500, vec![11, 21]);
// previously the virtual nominator had a provider inc by the delegation system as
// well as a consumer by this pallet.
// well as a consumer by this pezpallet.
System::inc_providers(&200);
System::inc_consumers(&200).expect("has provider, can consume");
@@ -376,8 +376,8 @@ fn reward_to_stake_works() {
// Compute total payout now for whole duration as other parameter won't change
let validator_payout_0 = validator_payout_for(time_per_era());
Pallet::<T>::reward_by_ids(vec![(11, 1)]);
Pallet::<T>::reward_by_ids(vec![(21, 1)]);
Pezpallet::<T>::reward_by_ids(vec![(11, 1)]);
Pezpallet::<T>::reward_by_ids(vec![(21, 1)]);
// New era --> rewards are paid --> stakes are changed
Session::roll_until_active_era(2);
@@ -707,17 +707,17 @@ fn claim_reward_at_the_last_era_and_no_double_claim_and_invalid_claim() {
Payee::<T>::insert(101, RewardDestination::Account(101));
// reward for era 1
Pallet::<T>::reward_by_ids(vec![(11, 1)]);
Pezpallet::<T>::reward_by_ids(vec![(11, 1)]);
Session::roll_until_active_era(2);
// reward for era 2
Pallet::<T>::reward_by_ids(vec![(11, 1)]);
Pezpallet::<T>::reward_by_ids(vec![(11, 1)]);
Session::roll_until_active_era(3);
// reward for era 3
Pallet::<T>::reward_by_ids(vec![(11, 1)]);
Pezpallet::<T>::reward_by_ids(vec![(11, 1)]);
// go to the history depth era
Session::roll_until_active_era(HistoryDepth::get() + 1);
@@ -784,7 +784,7 @@ fn nominators_over_max_exposure_page_size_are_rewarded() {
Session::roll_until_active_era(2);
// reward for era 2
Pallet::<T>::reward_by_ids(vec![(11, 1)]);
Pezpallet::<T>::reward_by_ids(vec![(11, 1)]);
Session::roll_until_active_era(3);
mock::make_all_reward_payment(2);
@@ -826,7 +826,7 @@ fn test_nominators_are_rewarded_for_all_exposure_page() {
Session::roll_until_active_era(2);
// give rewards
Pallet::<T>::reward_by_ids(vec![(11, 1)]);
Pezpallet::<T>::reward_by_ids(vec![(11, 1)]);
Session::roll_until_active_era(3);
mock::make_all_reward_payment(2);
@@ -23,7 +23,7 @@ use pezframe_support::assert_ok;
#[test]
fn try_state_works_with_uninitialized_pallet() {
pezsp_io::TestExternalities::default().execute_with(|| {
// Verify the pallet is uninitialized
// Verify the pezpallet is uninitialized
assert!(ActiveEra::<Test>::get().is_none());
assert!(CurrentEra::<Test>::get().is_none());
assert_eq!(Bonded::<Test>::iter().count(), 0);
@@ -28,10 +28,10 @@
// ./target/release/frame-omni-bencher
// v1
// benchmark
// pallet
// pezpallet
// --runtime
// ./target/release/wbuild/pezpallet-staking-async-teyrchain-runtime/pezpallet_staking_async_teyrchain_runtime.compact.compressed.wasm
// --pallet
// --pezpallet
// pezpallet_staking_async
// --extrinsic
// *