chore: regenerate umbrella crate, fix feature propagation

This commit is contained in:
2025-12-16 11:28:32 +03:00
parent dd6d48f528
commit 620b0e3aa0
1358 changed files with 9464 additions and 7656 deletions
@@ -32,7 +32,7 @@
//! state consistency.
use crate::{
asset, log, BalanceOf, Bonded, Config, DecodeWithMemTracking, Error, Ledger, Pezpallet, Payee,
asset, log, BalanceOf, Bonded, Config, DecodeWithMemTracking, Error, Ledger, Payee, Pezpallet,
RewardDestination, Vec, VirtualStakers,
};
use alloc::{collections::BTreeMap, fmt::Debug};
@@ -42,9 +42,9 @@ use pezframe_support::{
traits::{Defensive, DefensiveSaturating, Get},
BoundedVec, CloneNoBound, DebugNoBound, EqNoBound, PartialEqNoBound,
};
use scale_info::TypeInfo;
use pezsp_runtime::{traits::Zero, DispatchResult, Perquintill, Rounding, Saturating};
use pezsp_staking::{EraIndex, OnStakingUpdate, StakingAccount, StakingInterface};
use scale_info::TypeInfo;
/// Just a Balance/BlockNumber tuple to encode when a chunk of funds will be unlocked.
#[derive(
+8 -7
View File
@@ -26,8 +26,8 @@
//! * It is capable of working with a multi-page `ElectionProvider``, aka.
//! `pezpallet-election-provider-multi-block`.
//!
//! 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.
//! 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 pezpallet can be divided into a number of subsystems, as follows.
//!
@@ -198,6 +198,7 @@ pub mod weights;
extern crate alloc;
use alloc::{vec, vec::Vec};
use codec::{Decode, DecodeWithMemTracking, Encode, HasCompact, MaxEncodedLen};
use ledger::LedgerIntegrityState;
use pezframe_election_provider_support::ElectionProvider;
use pezframe_support::{
traits::{
@@ -208,14 +209,13 @@ use pezframe_support::{
WeakBoundedVec,
};
use pezframe_system::pezpallet_prelude::BlockNumberFor;
use ledger::LedgerIntegrityState;
use scale_info::TypeInfo;
use pezsp_runtime::{
traits::{AtLeast32BitUnsigned, One, StaticLookup, UniqueSaturatedInto},
BoundedBTreeMap, Perbill, RuntimeDebug, Saturating,
};
use pezsp_staking::{EraIndex, ExposurePage, PagedExposureMetadata, SessionIndex};
pub use pezsp_staking::{Exposure, IndividualExposure, StakerStatus};
use scale_info::TypeInfo;
pub use weights::WeightInfo;
// public exports
@@ -246,8 +246,8 @@ 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 pezpallet's
/// config.
/// 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;
/// Alias for the maximum number of winners per page, as expected by the election provider.
@@ -263,7 +263,8 @@ pub type RewardPoint = u32;
/// 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>;
type PositiveImbalanceOf<T> =
Debt<<T as pezframe_system::Config>::AccountId, <T as Config>::Currency>;
pub type NegativeImbalanceOf<T> =
Credit<<T as pezframe_system::Config>::AccountId, <T as Config>::Currency>;
@@ -624,7 +624,8 @@ impl ExtBuilder {
}
fn build(self) -> pezsp_io::TestExternalities {
pezsp_tracing::try_init_simple();
let mut storage = pezframe_system::GenesisConfig::<Test>::default().build_storage().unwrap();
let mut storage =
pezframe_system::GenesisConfig::<Test>::default().build_storage().unwrap();
let ed = ExistentialDeposit::get();
let mut maybe_stakers = vec![];
@@ -1582,8 +1582,8 @@ impl<T: Config> StakingInterface for Pezpallet<T> {
}
fn set_payee(stash: &Self::AccountId, reward_acc: &Self::AccountId) -> DispatchResult {
// 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
// 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!(
!Self::is_virtual_staker(stash) || stash != reward_acc,
@@ -25,6 +25,7 @@ use crate::{
};
use alloc::{format, vec::Vec};
use codec::Codec;
pub use impls::*;
use pezframe_election_provider_support::{ElectionProvider, SortedListProvider, VoteWeight};
use pezframe_support::{
assert_ok,
@@ -41,12 +42,6 @@ use pezframe_support::{
BoundedBTreeSet, BoundedVec,
};
use pezframe_system::{ensure_root, ensure_signed, pezpallet_prelude::*};
pub use impls::*;
use rand::seq::SliceRandom;
use rand_chacha::{
rand_core::{RngCore, SeedableRng},
ChaChaRng,
};
use pezsp_core::{sr25519::Pair as SrPair, Pair};
use pezsp_runtime::{
traits::{StaticLookup, Zero},
@@ -57,6 +52,11 @@ use pezsp_staking::{
StakingAccount::{self, Controller, Stash},
StakingInterface,
};
use rand::seq::SliceRandom;
use rand_chacha::{
rand_core::{RngCore, SeedableRng},
ChaChaRng,
};
mod impls;
@@ -148,8 +148,8 @@ pub mod pezpallet {
/// Convert a balance into a number used for election calculation. This must fit into a
/// `u64` but is allowed to be sensibly lossy. The `u64` is used to communicate with the
/// [`pezframe_election_provider_support`] crate which accepts u64 numbers and does operations
/// in 128.
/// [`pezframe_election_provider_support`] crate which accepts u64 numbers and does
/// operations in 128.
/// Consequently, the backward convert is used convert the u128s from sp-elections back to a
/// [`BalanceOf`].
#[pezpallet::no_default_bounds]
@@ -502,10 +502,10 @@ pub mod pezpallet {
/// Stakers whose funds are managed by other pallets.
///
/// This pezpallet does not apply any locks on them, therefore they are only virtually bonded. They
/// are expected to be keyless accounts and hence should not be allowed to mutate their ledger
/// directly via this pezpallet. Instead, these accounts are managed by other pallets and accessed
/// via low level apis. We keep track of them to do minimal integrity checks.
/// This pezpallet does not apply any locks on them, therefore they are only virtually bonded.
/// They are expected to be keyless accounts and hence should not be allowed to mutate their
/// ledger directly via this pezpallet. Instead, these accounts are managed by other pallets
/// and accessed via low level apis. We keep track of them to do minimal integrity checks.
#[pezpallet::storage]
pub type VirtualStakers<T: Config> = CountedStorageMap<_, Twox64Concat, T::AccountId, ()>;
@@ -575,8 +575,8 @@ pub mod pezpallet {
/// A bounded wrapper for [`pezsp_staking::ExposurePage`].
///
/// It has `Deref` and `DerefMut` impls that map it back [`pezsp_staking::ExposurePage`] for all
/// purposes. This is done in such a way because we prefer to keep the types in [`pezsp_staking`]
/// pure, and not polluted by pezpallet-specific bounding logic.
/// purposes. This is done in such a way because we prefer to keep the types in
/// [`pezsp_staking`] pure, and not polluted by pezpallet-specific bounding logic.
///
/// It encoded and decodes exactly the same as [`pezsp_staking::ExposurePage`], and provides a
/// manual `MaxEncodedLen` implementation, to be used in benchmarking
@@ -2084,7 +2084,9 @@ pub mod pezpallet {
///
/// If all pages are claimed, it returns an error `InvalidPage`.
#[pezpallet::call_index(18)]
#[pezpallet::weight(T::WeightInfo::payout_stakers_alive_staked(T::MaxExposurePageSize::get()))]
#[pezpallet::weight(T::WeightInfo::payout_stakers_alive_staked(
T::MaxExposurePageSize::get()
))]
pub fn payout_stakers(
origin: OriginFor<T>,
validator_stash: T::AccountId,
@@ -2420,7 +2422,9 @@ pub mod pezpallet {
/// and so it should not be assumed the highest staker would be on the topmost page and vice
/// versa. If rewards are not claimed in [`Config::HistoryDepth`] eras, they are lost.
#[pezpallet::call_index(26)]
#[pezpallet::weight(T::WeightInfo::payout_stakers_alive_staked(T::MaxExposurePageSize::get()))]
#[pezpallet::weight(T::WeightInfo::payout_stakers_alive_staked(
T::MaxExposurePageSize::get()
))]
pub fn payout_stakers_by_page(
origin: OriginFor<T>,
validator_stash: T::AccountId,
@@ -2626,8 +2630,8 @@ pub mod pezpallet {
/// Manually and permissionlessly applies a deferred slash for a given era.
///
/// Normally, slashes are automatically applied shortly after the start of the `slash_era`.
/// The automatic application of slashes is handled by the pezpallet's internal logic, and it
/// tries to apply one slash page per block of the era.
/// The automatic application of slashes is handled by the pezpallet's internal logic, and
/// it tries to apply one slash page per block of the era.
/// If for some reason, one era is not enough for applying all slash pages, the remaining
/// slashes need to be manually (permissionlessly) applied.
///
@@ -437,7 +437,9 @@ impl<T: Config> Eras<T> {
}
/// Ensure the given era is either absent or currently being pruned.
pub(crate) fn era_absent_or_pruning(era: EraIndex) -> Result<(), pezsp_runtime::TryRuntimeError> {
pub(crate) fn era_absent_or_pruning(
era: EraIndex,
) -> Result<(), pezsp_runtime::TryRuntimeError> {
if Self::era_pruning_in_progress(era) {
Ok(())
} else {
@@ -774,7 +776,9 @@ 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 {
Pezpallet::<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.
@@ -990,7 +994,10 @@ impl<T: Config> EraElectionPlanner<T> {
},
Err(e) => {
log!(warn, "election provider page failed due to {:?} (page: {})", e, page);
Pezpallet::<T>::deposit_event(Event::PagedElectionProceeded { page, result: Err(0) });
Pezpallet::<T>::deposit_event(Event::PagedElectionProceeded {
page,
result: Err(0),
});
},
}
}
@@ -42,18 +42,18 @@
use crate::{
asset, log, session_rotation::Eras, BalanceOf, Config, NegativeImbalanceOf, OffenceQueue,
OffenceQueueEras, PagedExposure, Pezpallet, Perbill, ProcessingOffence, SlashRewardFraction,
OffenceQueueEras, PagedExposure, Perbill, Pezpallet, ProcessingOffence, SlashRewardFraction,
UnappliedSlash, UnappliedSlashes, ValidatorSlashInEra, WeightInfo,
};
use alloc::vec::Vec;
use codec::{Decode, Encode, MaxEncodedLen};
use pezframe_support::traits::{Defensive, DefensiveSaturating, Get, Imbalance, OnUnbalanced};
use scale_info::TypeInfo;
use pezsp_runtime::{
traits::{Saturating, Zero},
RuntimeDebug, WeakBoundedVec, Weight,
};
use pezsp_staking::{EraIndex, StakingInterface};
use scale_info::TypeInfo;
/// Parameters for performing a slash.
#[derive(Clone)]
@@ -398,7 +398,9 @@ pub fn do_slash<T: Config>(
slash_era: EraIndex,
) {
let mut ledger =
match Pezpallet::<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.
};
@@ -425,7 +427,10 @@ pub fn do_slash<T: Config>(
.defensive_proof("ledger fetched from storage so it exists in storage; qed.");
// trigger the event
<Pezpallet<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.
@@ -21,11 +21,11 @@
use crate::{Pezpallet as Staking, *};
use pezframe_benchmarking::account;
use pezframe_system::RawOrigin;
use pezsp_io::hashing::blake2_256;
use rand_chacha::{
rand_core::{RngCore, SeedableRng},
ChaChaRng,
};
use pezsp_io::hashing::blake2_256;
use pezframe_election_provider_support::SortedListProvider;
use pezframe_support::pezpallet_prelude::*;
@@ -17,9 +17,9 @@
use super::*;
use crate::session_rotation::{EraElectionPlanner, Eras};
use bizinikiwi_test_utils::assert_eq_uvec;
use pezframe_support::assert_ok;
use pezsp_npos_elections::Support;
use bizinikiwi_test_utils::assert_eq_uvec;
use crate::tests::session_mock::ReceivedValidatorSets;
@@ -19,6 +19,8 @@
use super::*;
use crate::{asset, ledger::StakingLedgerInspect, mock::Session};
use bizinikiwi_test_utils::assert_eq_uvec;
use mock::*;
use pezframe_election_provider_support::{
bounds::{DataProviderBounds, ElectionBoundsBuilder},
SortedListProvider,
@@ -28,12 +30,10 @@ use pezframe_support::{
pezpallet_prelude::*,
traits::{InspectLockableCurrency, ReservableCurrency},
};
use mock::*;
use pezsp_runtime::{
assert_eq_error_rate, bounded_vec, traits::BadOrigin, Perbill, Percent, TokenError,
};
use pezsp_staking::{Stake, StakingAccount, StakingInterface};
use bizinikiwi_test_utils::assert_eq_uvec;
mod bonding;
mod configs;