style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -1230,8 +1230,8 @@ mod benchmarks {
|
||||
.for_each(|validator| {
|
||||
let exposure = pezsp_staking::Exposure::<T::AccountId, BalanceOf<T>> {
|
||||
own: T::Currency::minimum_balance(),
|
||||
total: T::Currency::minimum_balance() *
|
||||
(exposed_nominators_per_validator + 1).into(),
|
||||
total: T::Currency::minimum_balance()
|
||||
* (exposed_nominators_per_validator + 1).into(),
|
||||
others: (0..exposed_nominators_per_validator)
|
||||
.map(|n| {
|
||||
let nominator = account::<T::AccountId>("nominator", n, SEED);
|
||||
|
||||
@@ -148,8 +148,9 @@ impl<T: Config> StakingLedger<T> {
|
||||
pub(crate) fn paired_account(account: StakingAccount<T::AccountId>) -> Option<T::AccountId> {
|
||||
match account {
|
||||
StakingAccount::Stash(stash) => <Bonded<T>>::get(stash),
|
||||
StakingAccount::Controller(controller) =>
|
||||
<Ledger<T>>::get(&controller).map(|ledger| ledger.stash),
|
||||
StakingAccount::Controller(controller) => {
|
||||
<Ledger<T>>::get(&controller).map(|ledger| ledger.stash)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +172,9 @@ impl<T: Config> StakingLedger<T> {
|
||||
/// stash has a controller which is bonding a ledger associated with another stash.
|
||||
pub(crate) fn get(account: StakingAccount<T::AccountId>) -> Result<StakingLedger<T>, Error<T>> {
|
||||
let (stash, controller) = match account {
|
||||
StakingAccount::Stash(stash) =>
|
||||
(stash.clone(), <Bonded<T>>::get(&stash).ok_or(Error::<T>::NotStash)?),
|
||||
StakingAccount::Stash(stash) => {
|
||||
(stash.clone(), <Bonded<T>>::get(&stash).ok_or(Error::<T>::NotStash)?)
|
||||
},
|
||||
StakingAccount::Controller(controller) => (
|
||||
Ledger::<T>::get(&controller)
|
||||
.map(|l| l.stash)
|
||||
@@ -210,8 +212,9 @@ impl<T: Config> StakingLedger<T> {
|
||||
) -> Option<RewardDestination<T::AccountId>> {
|
||||
let stash = match account {
|
||||
StakingAccount::Stash(stash) => Some(stash),
|
||||
StakingAccount::Controller(controller) =>
|
||||
Self::paired_account(StakingAccount::Controller(controller)),
|
||||
StakingAccount::Controller(controller) => {
|
||||
Self::paired_account(StakingAccount::Controller(controller))
|
||||
},
|
||||
};
|
||||
|
||||
if let Some(stash) = stash {
|
||||
@@ -579,10 +582,10 @@ pub struct StakingLedgerInspect<T: Config> {
|
||||
#[cfg(test)]
|
||||
impl<T: Config> PartialEq<StakingLedgerInspect<T>> for StakingLedger<T> {
|
||||
fn eq(&self, other: &StakingLedgerInspect<T>) -> bool {
|
||||
self.stash == other.stash &&
|
||||
self.total == other.total &&
|
||||
self.active == other.active &&
|
||||
self.unlocking == other.unlocking
|
||||
self.stash == other.stash
|
||||
&& self.total == other.total
|
||||
&& self.active == other.active
|
||||
&& self.unlocking == other.unlocking
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ impl<T: Config> Pezpallet<T> {
|
||||
})?;
|
||||
|
||||
match Ledger::<T>::get(controller) {
|
||||
Some(ledger) =>
|
||||
Some(ledger) => {
|
||||
if ledger.stash != *stash {
|
||||
Ok(LedgerIntegrityState::Corrupted)
|
||||
} else {
|
||||
@@ -140,7 +140,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
} else {
|
||||
Ok(LedgerIntegrityState::Ok)
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
None => Ok(LedgerIntegrityState::CorruptedKilled),
|
||||
}
|
||||
}
|
||||
@@ -275,8 +276,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
"consolidate_unlocked should never increase the total balance of the ledger"
|
||||
);
|
||||
|
||||
let used_weight = if ledger.unlocking.is_empty() &&
|
||||
(ledger.active < Self::min_chilled_bond() || ledger.active.is_zero())
|
||||
let used_weight = if ledger.unlocking.is_empty()
|
||||
&& (ledger.active < Self::min_chilled_bond() || ledger.active.is_zero())
|
||||
{
|
||||
// This account must have called `unbond()` with some value that caused the active
|
||||
// portion to fall below existential deposit + will have no more unlocking chunks
|
||||
@@ -370,7 +371,7 @@ impl<T: Config> Pezpallet<T> {
|
||||
|
||||
if Eras::<T>::is_rewards_claimed(era, &stash, page) {
|
||||
return Err(Error::<T>::AlreadyClaimed
|
||||
.with_weight(T::WeightInfo::payout_stakers_alive_staked(0)))
|
||||
.with_weight(T::WeightInfo::payout_stakers_alive_staked(0)));
|
||||
}
|
||||
|
||||
Eras::<T>::set_rewards_as_claimed(era, &stash, page);
|
||||
@@ -396,7 +397,7 @@ impl<T: Config> Pezpallet<T> {
|
||||
|
||||
// Nothing to do if they have no reward points.
|
||||
if validator_reward_points.is_zero() {
|
||||
return Ok(Some(T::WeightInfo::payout_stakers_alive_staked(0)).into())
|
||||
return Ok(Some(T::WeightInfo::payout_stakers_alive_staked(0)).into());
|
||||
}
|
||||
|
||||
// This is the fraction of the total reward that the validator and the
|
||||
@@ -485,7 +486,7 @@ impl<T: Config> Pezpallet<T> {
|
||||
) -> Option<(PositiveImbalanceOf<T>, RewardDestination<T::AccountId>)> {
|
||||
// noop if amount is zero
|
||||
if amount.is_zero() {
|
||||
return None
|
||||
return None;
|
||||
}
|
||||
let dest = Self::payee(StakingAccount::Stash(stash.clone()))?;
|
||||
|
||||
@@ -603,8 +604,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
SnapshotStatus::Consumed => Box::new(vec![].into_iter()),
|
||||
};
|
||||
|
||||
while all_voters.len() < page_len_prediction as usize &&
|
||||
voters_seen < (NPOS_MAX_ITERATIONS_COEFFICIENT * page_len_prediction as u32)
|
||||
while all_voters.len() < page_len_prediction as usize
|
||||
&& voters_seen < (NPOS_MAX_ITERATIONS_COEFFICIENT * page_len_prediction as u32)
|
||||
{
|
||||
let voter = match sorted_voters.next() {
|
||||
Some(voter) => {
|
||||
@@ -618,7 +619,7 @@ impl<T: Config> Pezpallet<T> {
|
||||
// if voter weight is zero, do not consider this voter for the snapshot.
|
||||
if voter_weight.is_zero() {
|
||||
log!(debug, "voter's active balance is 0. skip this voter.");
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Some(Nominations { targets, .. }) = <Nominators<T>>::get(&voter) {
|
||||
@@ -633,7 +634,7 @@ impl<T: Config> Pezpallet<T> {
|
||||
Self::deposit_event(Event::<T>::SnapshotVotersSizeExceeded {
|
||||
size: voters_size_tracker.size as u32,
|
||||
});
|
||||
break
|
||||
break;
|
||||
}
|
||||
|
||||
all_voters.push(voter);
|
||||
@@ -659,7 +660,7 @@ impl<T: Config> Pezpallet<T> {
|
||||
Self::deposit_event(Event::<T>::SnapshotVotersSizeExceeded {
|
||||
size: voters_size_tracker.size as u32,
|
||||
});
|
||||
break
|
||||
break;
|
||||
}
|
||||
all_voters.push(self_vote);
|
||||
validators_taken.saturating_inc();
|
||||
@@ -704,8 +705,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
let mut targets_seen = 0;
|
||||
|
||||
let mut targets_iter = T::TargetList::iter();
|
||||
while all_targets.len() < final_predicted_len as usize &&
|
||||
targets_seen < (NPOS_MAX_ITERATIONS_COEFFICIENT * final_predicted_len as u32)
|
||||
while all_targets.len() < final_predicted_len as usize
|
||||
&& targets_seen < (NPOS_MAX_ITERATIONS_COEFFICIENT * final_predicted_len as u32)
|
||||
{
|
||||
let target = match targets_iter.next() {
|
||||
Some(target) => {
|
||||
@@ -721,7 +722,7 @@ impl<T: Config> Pezpallet<T> {
|
||||
Self::deposit_event(Event::<T>::SnapshotTargetsSizeExceeded {
|
||||
size: targets_size_tracker.size as u32,
|
||||
});
|
||||
break
|
||||
break;
|
||||
}
|
||||
|
||||
if Validators::<T>::contains_key(&target) {
|
||||
@@ -900,7 +901,7 @@ impl<T: Config> Pezpallet<T> {
|
||||
// dec provider
|
||||
let _ = pezframe_system::Pezpallet::<T>::dec_providers(&stash)?;
|
||||
|
||||
return Ok(())
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1007,7 +1008,7 @@ impl<T: Config> ElectionDataProvider for Pezpallet<T> {
|
||||
|
||||
let targets = Self::get_npos_targets(bounds);
|
||||
if bounds.exhausted(None, CountBound(targets.len() as u32).into()) {
|
||||
return Err("Target snapshot too big")
|
||||
return Err("Target snapshot too big");
|
||||
}
|
||||
|
||||
debug_assert!(!bounds.slice_exhausted(&targets));
|
||||
@@ -1201,7 +1202,7 @@ impl<T: Config> rc_client::AHStakingInterface for Pezpallet<T> {
|
||||
// Skip if the validator is invulnerable.
|
||||
if invulnerables.contains(&validator) {
|
||||
log!(debug, "🦹 on_offence: {:?} is invulnerable; ignoring offence", validator);
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
|
||||
// ignore offence if too old to report.
|
||||
@@ -1345,8 +1346,8 @@ impl<T: Config> ScoreProvider<T::AccountId> for Pezpallet<T> {
|
||||
Self::ledger(Stash(who.clone()))
|
||||
.ok()
|
||||
.and_then(|l| {
|
||||
if Nominators::<T>::contains_key(&l.stash) ||
|
||||
Validators::<T>::contains_key(&l.stash)
|
||||
if Nominators::<T>::contains_key(&l.stash)
|
||||
|| Validators::<T>::contains_key(&l.stash)
|
||||
{
|
||||
Some(l.active)
|
||||
} else {
|
||||
@@ -1655,7 +1656,7 @@ impl<T: Config> StakingInterface for Pezpallet<T> {
|
||||
who: &Self::AccountId,
|
||||
) -> Result<pezsp_staking::StakerStatus<Self::AccountId>, DispatchError> {
|
||||
if !StakingLedger::<T>::is_bonded(StakingAccount::Stash(who.clone())) {
|
||||
return Err(Error::<T>::NotStash.into())
|
||||
return Err(Error::<T>::NotStash.into());
|
||||
}
|
||||
|
||||
let is_validator = Validators::<T>::contains_key(&who);
|
||||
@@ -1680,8 +1681,8 @@ impl<T: Config> StakingInterface for Pezpallet<T> {
|
||||
/// 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::Pezpallet::<T>::account_nonce(who).is_zero() &&
|
||||
VirtualStakers::<T>::contains_key(who)
|
||||
pezframe_system::Pezpallet::<T>::account_nonce(who).is_zero()
|
||||
&& VirtualStakers::<T>::contains_key(who)
|
||||
}
|
||||
|
||||
fn slash_reward_fraction() -> Perbill {
|
||||
@@ -1732,7 +1733,7 @@ impl<T: Config> pezsp_staking::StakingUnchecked for Pezpallet<T> {
|
||||
payee: &Self::AccountId,
|
||||
) -> DispatchResult {
|
||||
if StakingLedger::<T>::is_bonded(StakingAccount::Stash(keyless_who.clone())) {
|
||||
return Err(Error::<T>::AlreadyBonded.into())
|
||||
return Err(Error::<T>::AlreadyBonded.into());
|
||||
}
|
||||
|
||||
// check if payee not same as who.
|
||||
@@ -1816,9 +1817,11 @@ impl<T: Config> Pezpallet<T> {
|
||||
// if stash == controller, it means that the ledger has migrated to
|
||||
// post-controller. If no migration happened, we expect that the (stash,
|
||||
// controller) pair has only one associated ledger.
|
||||
{
|
||||
if stash != controller {
|
||||
count_double += 1;
|
||||
},
|
||||
}
|
||||
},
|
||||
(None, None) => {
|
||||
count_none += 1;
|
||||
},
|
||||
@@ -1855,8 +1858,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
}
|
||||
|
||||
ensure!(
|
||||
(Ledger::<T>::iter().count() == Payee::<T>::iter().count()) &&
|
||||
(Ledger::<T>::iter().count() == Bonded::<T>::iter().count()),
|
||||
(Ledger::<T>::iter().count() == Payee::<T>::iter().count())
|
||||
&& (Ledger::<T>::iter().count() == Bonded::<T>::iter().count()),
|
||||
"number of entries in payee storage items does not match the number of bonded ledgers",
|
||||
);
|
||||
|
||||
@@ -1870,8 +1873,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
/// * Current validator count is bounded by the election provider's max winners.
|
||||
fn check_count() -> Result<(), TryRuntimeError> {
|
||||
ensure!(
|
||||
<T as Config>::VoterList::count() ==
|
||||
Nominators::<T>::count() + Validators::<T>::count(),
|
||||
<T as Config>::VoterList::count()
|
||||
== Nominators::<T>::count() + Validators::<T>::count(),
|
||||
"wrong external count"
|
||||
);
|
||||
ensure!(
|
||||
@@ -1982,11 +1985,11 @@ impl<T: Config> Pezpallet<T> {
|
||||
ensure!(
|
||||
overview_and_pages.iter().all(|(metadata, pages)| {
|
||||
let page_count_good = metadata.page_count == pages.len() as u32;
|
||||
let nominator_count_good = metadata.nominator_count ==
|
||||
pages.iter().map(|p| p.others.len() as u32).fold(0u32, |acc, x| acc + x);
|
||||
let total_good = metadata.total ==
|
||||
metadata.own +
|
||||
pages
|
||||
let nominator_count_good = metadata.nominator_count
|
||||
== pages.iter().map(|p| p.others.len() as u32).fold(0u32, |acc, x| acc + x);
|
||||
let total_good = metadata.total
|
||||
== metadata.own
|
||||
+ pages
|
||||
.iter()
|
||||
.fold(BalanceOf::<T>::zero(), |acc, page| acc + page.page_total);
|
||||
|
||||
@@ -1999,8 +2002,8 @@ impl<T: Config> Pezpallet<T> {
|
||||
overview_and_pages
|
||||
.iter()
|
||||
.map(|(metadata, _pages)| metadata.total)
|
||||
.fold(BalanceOf::<T>::zero(), |acc, x| acc + x) ==
|
||||
ErasTotalStake::<T>::get(era),
|
||||
.fold(BalanceOf::<T>::zero(), |acc, x| acc + x)
|
||||
== ErasTotalStake::<T>::get(era),
|
||||
"found bad eras total stake"
|
||||
);
|
||||
|
||||
|
||||
@@ -901,9 +901,9 @@ pub mod pezpallet {
|
||||
fn build(&self) {
|
||||
crate::log!(trace, "initializing with {:?}", self);
|
||||
assert!(
|
||||
self.validator_count <=
|
||||
<T::ElectionProvider as ElectionProvider>::MaxWinnersPerPage::get() *
|
||||
<T::ElectionProvider as ElectionProvider>::Pages::get(),
|
||||
self.validator_count
|
||||
<= <T::ElectionProvider as ElectionProvider>::MaxWinnersPerPage::get()
|
||||
* <T::ElectionProvider as ElectionProvider>::Pages::get(),
|
||||
"validator count is too high, `ElectionProvider` can never fulfill this"
|
||||
);
|
||||
ValidatorCount::<T>::put(self.validator_count);
|
||||
@@ -1776,8 +1776,8 @@ pub mod pezpallet {
|
||||
let targets: BoundedVec<_, _> = targets
|
||||
.into_iter()
|
||||
.map(|n| {
|
||||
if old.contains(&n) ||
|
||||
(Validators::<T>::contains_key(&n) && !Validators::<T>::get(&n).blocked)
|
||||
if old.contains(&n)
|
||||
|| (Validators::<T>::contains_key(&n) && !Validators::<T>::get(&n).blocked)
|
||||
{
|
||||
Ok(n)
|
||||
} else {
|
||||
@@ -2171,10 +2171,10 @@ pub mod pezpallet {
|
||||
let origin_balance = asset::total_balance::<T>(&stash);
|
||||
let ledger_total =
|
||||
Self::ledger(Stash(stash.clone())).map(|l| l.total).unwrap_or_default();
|
||||
let reapable = origin_balance < min_chilled_bond ||
|
||||
origin_balance.is_zero() ||
|
||||
ledger_total < min_chilled_bond ||
|
||||
ledger_total.is_zero();
|
||||
let reapable = origin_balance < min_chilled_bond
|
||||
|| origin_balance.is_zero()
|
||||
|| ledger_total < min_chilled_bond
|
||||
|| ledger_total.is_zero();
|
||||
ensure!(reapable, Error::<T>::FundedTarget);
|
||||
|
||||
// Remove all staking-related information and lock.
|
||||
|
||||
@@ -410,8 +410,8 @@ impl<T: Config> Eras<T> {
|
||||
let e2 = ErasTotalStake::<T>::contains_key(era);
|
||||
|
||||
let active_era = Rotator::<T>::active_era();
|
||||
let e4 = if era.saturating_sub(1) > 0 &&
|
||||
era.saturating_sub(1) > active_era.saturating_sub(T::HistoryDepth::get() + 1)
|
||||
let e4 = if era.saturating_sub(1) > 0
|
||||
&& era.saturating_sub(1) > active_era.saturating_sub(T::HistoryDepth::get() + 1)
|
||||
{
|
||||
// `ErasValidatorReward` is set at active era n for era n-1, and is not set for era 0 in
|
||||
// our tests. Moreover, it cannot be checked for presence in the oldest present era
|
||||
@@ -549,8 +549,8 @@ impl<T: Config> Rotator<T> {
|
||||
// If we have an active era, bonded eras must always be the range
|
||||
// [active - bonding_duration .. active_era]
|
||||
ensure!(
|
||||
bonded.into_iter().map(|(era, _sess)| era).collect::<Vec<_>>() ==
|
||||
(active.index.saturating_sub(T::BondingDuration::get())..=active.index)
|
||||
bonded.into_iter().map(|(era, _sess)| era).collect::<Vec<_>>()
|
||||
== (active.index.saturating_sub(T::BondingDuration::get())..=active.index)
|
||||
.collect::<Vec<_>>(),
|
||||
"BondedEras range incorrect"
|
||||
);
|
||||
@@ -916,8 +916,8 @@ impl<T: Config> EraElectionPlanner<T> {
|
||||
);
|
||||
|
||||
debug_assert!(
|
||||
CurrentEra::<T>::get().unwrap_or(0) ==
|
||||
ActiveEra::<T>::get().map_or(0, |a| a.index) + 1,
|
||||
CurrentEra::<T>::get().unwrap_or(0)
|
||||
== ActiveEra::<T>::get().map_or(0, |a| a.index) + 1,
|
||||
"Next era must be already planned."
|
||||
);
|
||||
|
||||
|
||||
@@ -635,10 +635,10 @@ mod paged_snapshot {
|
||||
// requested.
|
||||
let snapshot = Staking::electable_targets(bounds, 0).unwrap();
|
||||
assert!(
|
||||
snapshot == all_targets &&
|
||||
snapshot == Staking::electable_targets(bounds, 1).unwrap() &&
|
||||
snapshot == Staking::electable_targets(bounds, 2).unwrap() &&
|
||||
snapshot == Staking::electable_targets(bounds, u32::MAX).unwrap(),
|
||||
snapshot == all_targets
|
||||
&& snapshot == Staking::electable_targets(bounds, 1).unwrap()
|
||||
&& snapshot == Staking::electable_targets(bounds, 2).unwrap()
|
||||
&& snapshot == Staking::electable_targets(bounds, u32::MAX).unwrap(),
|
||||
);
|
||||
})
|
||||
}
|
||||
@@ -868,9 +868,9 @@ mod score_provider {
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
// given 41 being a chilled staker
|
||||
assert!(
|
||||
Ledger::<Test>::get(41).is_some() &&
|
||||
!Validators::<Test>::contains_key(41) &&
|
||||
!Nominators::<Test>::contains_key(41)
|
||||
Ledger::<Test>::get(41).is_some()
|
||||
&& !Validators::<Test>::contains_key(41)
|
||||
&& !Nominators::<Test>::contains_key(41)
|
||||
);
|
||||
|
||||
// then they will not have a score when bags-list wants to update it.
|
||||
@@ -883,9 +883,9 @@ mod score_provider {
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
// given 777 being neither a nominator nor a validator in this pezpallet.
|
||||
assert!(
|
||||
!Ledger::<Test>::get(777).is_some() &&
|
||||
!Validators::<Test>::contains_key(777) &&
|
||||
!Nominators::<Test>::contains_key(777)
|
||||
!Ledger::<Test>::get(777).is_some()
|
||||
&& !Validators::<Test>::contains_key(777)
|
||||
&& !Nominators::<Test>::contains_key(777)
|
||||
);
|
||||
|
||||
// then it will not have a score when bags-list wants to update it.
|
||||
@@ -898,9 +898,9 @@ mod score_provider {
|
||||
ExtBuilder::default().nominate(true).build_and_execute(|| {
|
||||
// Given 101 being a nominator
|
||||
assert!(
|
||||
Ledger::<Test>::get(101).unwrap().active == 500 &&
|
||||
!Validators::<Test>::contains_key(101) &&
|
||||
Nominators::<Test>::contains_key(101)
|
||||
Ledger::<Test>::get(101).unwrap().active == 500
|
||||
&& !Validators::<Test>::contains_key(101)
|
||||
&& Nominators::<Test>::contains_key(101)
|
||||
);
|
||||
|
||||
// then it will have a score.
|
||||
@@ -908,9 +908,9 @@ mod score_provider {
|
||||
|
||||
// given 11 being a validator
|
||||
assert!(
|
||||
Ledger::<Test>::get(11).unwrap().active == 1000 &&
|
||||
Validators::<Test>::contains_key(11) &&
|
||||
!Nominators::<Test>::contains_key(11)
|
||||
Ledger::<Test>::get(11).unwrap().active == 1000
|
||||
&& Validators::<Test>::contains_key(11)
|
||||
&& !Nominators::<Test>::contains_key(11)
|
||||
);
|
||||
|
||||
// then it will have a score.
|
||||
|
||||
@@ -105,9 +105,9 @@ fn rewards_with_nominator_should_work() {
|
||||
);
|
||||
assert_eq_error_rate!(
|
||||
asset::total_balance::<T>(&101),
|
||||
init_balance_101 +
|
||||
part_for_101_from_11 * validator_payout_0 * 2 / 3 +
|
||||
part_for_101_from_21 * validator_payout_0 * 1 / 3,
|
||||
init_balance_101
|
||||
+ part_for_101_from_11 * validator_payout_0 * 2 / 3
|
||||
+ part_for_101_from_21 * validator_payout_0 * 1 / 3,
|
||||
2
|
||||
);
|
||||
|
||||
@@ -149,9 +149,9 @@ fn rewards_with_nominator_should_work() {
|
||||
);
|
||||
assert_eq_error_rate!(
|
||||
asset::total_balance::<T>(&101),
|
||||
init_balance_101 +
|
||||
part_for_101_from_11 * (validator_payout_0 * 2 / 3 + total_payout_1) +
|
||||
part_for_101_from_21 * validator_payout_0 * 1 / 3,
|
||||
init_balance_101
|
||||
+ part_for_101_from_11 * (validator_payout_0 * 2 / 3 + total_payout_1)
|
||||
+ part_for_101_from_21 * validator_payout_0 * 1 / 3,
|
||||
2
|
||||
);
|
||||
});
|
||||
|
||||
@@ -848,9 +848,9 @@ fn nominator_is_slashed_by_max_for_validator_in_era() {
|
||||
);
|
||||
assert_eq!(
|
||||
asset::stakeable_balance::<T>(&nominator),
|
||||
500 - first_slash_nominator_amount -
|
||||
second_slash_nominator_amount -
|
||||
third_slash_nominator_amount
|
||||
500 - first_slash_nominator_amount
|
||||
- second_slash_nominator_amount
|
||||
- third_slash_nominator_amount
|
||||
);
|
||||
assert_eq!(asset::stakeable_balance::<T>(&21), v2_stakeable);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user