Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Unlimited number of nominators eligible for Rewards payout #13059

Closed
wants to merge 177 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
acab2d1
paged exposure skeleton
Ank4n Jan 4, 2023
256ca4c
insignificant changes
Ank4n Jan 4, 2023
8e6db42
Merge branch 'master' into ankan/paged-rewards
Ank4n Jan 5, 2023
0cabf55
add note on usage of twox hash
Ank4n Jan 6, 2023
00bc992
Merge branch 'master' into ankan/paged-rewards
Ank4n Jan 6, 2023
f65d7b6
impl paged exposure
Ank4n Jan 6, 2023
e7f299c
paged as exposure function
Ank4n Jan 6, 2023
b3f58d6
add test for paging exposure
Ank4n Jan 6, 2023
661fab0
remove commented fn
Ank4n Jan 7, 2023
06d83fb
cargo fmt
Ank4n Jan 7, 2023
02e3ffc
more fmt
Ank4n Jan 7, 2023
c924bfc
remove unnecessary bound
Ank4n Jan 7, 2023
108cd16
add wrapper struct and refactor
Ank4n Jan 8, 2023
e14eab3
create temp fn that checks both ledger and new claimed_rewards
Ank4n Jan 8, 2023
70b8c7f
incomplete, paged extrinisic to pay stakers
Ank4n Jan 8, 2023
484dad8
Merge branch 'master' into ankan/paged-rewards
Ank4n Jan 9, 2023
eac23e0
fix names
Ank4n Jan 10, 2023
1cd79ff
add page as 0 for payout stakers, tests failing currently.
Ank4n Jan 14, 2023
4fdc2df
fix double claim
Ank4n Jan 14, 2023
c339ca5
don't store claimed rewards for previous eras in the ledger
Ank4n Jan 14, 2023
773d91c
mark claimed_rewards in Staking ledger as legacy
Ank4n Jan 14, 2023
f50ee11
test for not populating legacy claimed rewards anymore
Ank4n Jan 14, 2023
309c737
test is not accurate since for prebonded era, there cannot be any rew…
Ank4n Jan 14, 2023
4f4466c
fmt
Ank4n Jan 14, 2023
7f4aa5b
assert claimed rewards is populated
Ank4n Jan 14, 2023
d64d28e
introduce struct ExposurePage
Ank4n Jan 15, 2023
da53a27
fmt
Ank4n Jan 15, 2023
dd60ba7
some docs
Ank4n Jan 15, 2023
b19193a
rename to into_pages
Ank4n Jan 16, 2023
e3569bf
verify claimed rewards and era stakers is cleared
Ank4n Jan 16, 2023
99913b3
small comment
Ank4n Jan 16, 2023
cc6be46
reuse MaxNominatorRewardedPerValidator
Ank4n Jan 16, 2023
6623056
get to the same stage as 1st attempt
Ank4n Jan 18, 2023
90e7a9d
pay all pages
Ank4n Jan 21, 2023
cf6ee88
introduce invalid page error
Ank4n Jan 21, 2023
b86e3f8
docs
Ank4n Jan 21, 2023
1072147
test all nominators are paid
Ank4n Jan 21, 2023
9f4ea04
all test pass
Ank4n Jan 21, 2023
42429e9
cargo fmt
Ank4n Jan 21, 2023
4260bca
add more tests
Ank4n Jan 22, 2023
eb0709b
cargo fmt
Ank4n Jan 22, 2023
ec6ae58
fix benchmarks
Ank4n Jan 23, 2023
03c53a0
fix clippy suggestion
Ank4n Jan 23, 2023
f87a862
Merge branch 'master' into ankan/paged-rewards
Ank4n Jan 23, 2023
c94ce9c
Merge branch 'master' of https://github.com/paritytech/substrate into…
Jan 23, 2023
554bb7c
".git/.scripts/commands/bench/bench.sh" pallet dev pallet_staking
Jan 23, 2023
1aed1b5
doc for split into pages
Ank4n Jan 23, 2023
18d2d1d
remove unused from
Ank4n Jan 23, 2023
b14319e
fix doc
Ank4n Jan 23, 2023
0fa0195
rename MaxNominatorRewardedPerValidator
Ank4n Jan 23, 2023
2d5082d
add weight for pages other than 0
Ank4n Jan 23, 2023
ce67004
fmt
Ank4n Jan 23, 2023
c330866
use n to make the compiler happy
Ank4n Jan 23, 2023
99d19b7
fix minimum count
Ank4n Jan 23, 2023
fc2e091
correct number of nominators
Ank4n Jan 23, 2023
2adf060
fix benchmark and commission payout
Ank4n Jan 23, 2023
26efca4
refactor
Ank4n Jan 23, 2023
d7ab5b7
verify is paid only once per era for their own stake
Ank4n Jan 23, 2023
e77bd87
fmt
Ank4n Jan 23, 2023
6bc015f
fix rustdoc
Ank4n Jan 23, 2023
514a851
fmt
Ank4n Jan 23, 2023
076a0c1
".git/.scripts/commands/bench/bench.sh" pallet dev pallet_staking
Jan 23, 2023
cf0654b
fix rust doc
Ank4n Jan 23, 2023
94a6dd5
handles errors
Ank4n Jan 25, 2023
e49d721
commission test
Ank4n Jan 25, 2023
2f40eea
some things to discuss
Ank4n Jan 25, 2023
455294b
try state checks
Ank4n Jan 25, 2023
4e2b482
fmt
Ank4n Jan 25, 2023
416ee7e
Merge branch 'master' into ankan/paged-rewards
Ank4n Jan 25, 2023
478b473
Revert "try state checks"
Ank4n Jan 25, 2023
ddfcd18
cleanup era overview in history depth eras
Ank4n Jan 25, 2023
75fb102
Merge branch 'master' into ankan/paged-rewards
Ank4n Jan 28, 2023
fed66ce
todos
Ank4n Jan 28, 2023
aeec825
remove store
Ank4n Jan 31, 2023
a85e451
[Revert] keep the same name of page size
Ank4n Jan 31, 2023
b832130
consume exposure
Ank4n Jan 31, 2023
5d215c6
sc-finality-grandpa: Warp proof generation can not expect justificati…
bkchr Jan 28, 2023
d7e4a56
update criterion to v0.4.0 (#13142)
koushiro Jan 28, 2023
3ec6576
fix up template (#13205)
shawntabrizi Jan 29, 2023
dca583b
Remove `uncles` related code (#13216)
bkchr Jan 29, 2023
b0e04e7
Implement RIType traits for u8 array with an arbitrary size (#13256)
conr2d Jan 30, 2023
2d35736
grandpa: cleanup stale entries in set id session mapping (#13237)
andresilva Jan 30, 2023
599cd6e
Benchmark's successful origin api update (#13146)
muharem Feb 1, 2023
4ff092b
hooks default impl missing where clause (#13264)
kianenigma Feb 1, 2023
0d47b62
implemented `contains_prefix` for StorageDoubleMap and StorageNMap (#…
muraca Feb 1, 2023
f88a55e
Calling proxy doesn't remove announcement (#13267)
Szegoo Feb 1, 2023
da40ff1
Fee and tip represented as asset ID inside `AssetTxFeePaid` (#13083)
Szegoo Feb 2, 2023
c9310e1
Move beefy-merkle-tree to utils/binary-merkle-tree and make it generi…
DaviRain-Su Feb 2, 2023
4d02469
Metadata V15: Derive `TypeInfo` for describing runtime types (#13272)
lexnv Feb 2, 2023
369365e
benchmarks: EnsureRankedMember must add ranked members (#13297)
ggwpez Feb 2, 2023
c6c490d
Minor: Update output validity tests (#13190)
mrcnski Feb 2, 2023
6453a4a
BEEFY: define on-chain beefy-genesis and use it to coordinate voter i…
acatangiu Feb 3, 2023
ff8a71f
feat: add event SkepticsChosen event in society (#13291)
gitofdeepanshu Feb 3, 2023
ca58b7b
feat(client): significantly increase wasm instance limits (#13298)
hussein-aitlahcen Feb 3, 2023
8866597
Remove in-tree bounded types and use bounded-collections crate (#13243)
KiChjang Feb 3, 2023
f28e182
some new definitions
Ank4n Feb 5, 2023
ab79cd3
new call to payout staekers by page
Ank4n Feb 5, 2023
50690ff
fix benchmark
Ank4n Feb 5, 2023
664c374
keep payout_stakers backward compatible
Ank4n Feb 5, 2023
bf41253
split exposure by ExposurePageSize
Ank4n Feb 5, 2023
caeb781
return both overview and page
Ank4n Feb 5, 2023
3b9acbf
fmt
Ank4n Feb 5, 2023
9ab601a
Update frame/staking/README.md
Ank4n Feb 6, 2023
7f24aa1
introduce exposure extension
Ank4n Feb 6, 2023
1bf6161
doc
Ank4n Feb 6, 2023
21dff20
format
Ank4n Feb 6, 2023
171d43b
pay commission in parts; failing tests
Ank4n Feb 6, 2023
263894b
verify commission are paid across pages
Ank4n Feb 6, 2023
78f94bc
fmt
Ank4n Feb 6, 2023
806e656
docs
Ank4n Feb 6, 2023
e826056
fix test
Ank4n Feb 6, 2023
bd420b3
Merge branch 'master' into ankan/paged-rewards
Ank4n Feb 7, 2023
5ae9ee8
only use one constant
Ank4n Feb 7, 2023
641d112
payout_stakers still work nicely
Ank4n Feb 7, 2023
0f76c59
remove todo
Ank4n Feb 7, 2023
37d46b6
benchmark against implicit page payout stakers since thats worst case
Ank4n Feb 7, 2023
406d3b8
add a working draft of changelog
Ank4n Feb 8, 2023
bfdd143
small doc update
Ank4n Feb 8, 2023
f2fd8d4
Fix block pruning (#13323)
arkpar Feb 7, 2023
58eef2c
Referendum proposal's metadata (#12568)
muharem Feb 8, 2023
b107674
Improve test coverage of the `Notifications` protocol (#13033)
altonen Feb 8, 2023
4123495
Configurable voting-degree in council elections pallet (#13305)
kianenigma Feb 8, 2023
23fb86b
Rework generated API docs (#13178)
athei Feb 8, 2023
be6a11c
pallet-scheduler: Ensure we request a preimage (#13340)
bkchr Feb 9, 2023
4b23fdb
[Fix] Try-state feature-gated for BagsList (#13296)
ruseinov Feb 9, 2023
821ad7e
bump version of zombienet and update snaps links (#13359)
pepoviola Feb 10, 2023
826cfb2
Fix longest chain finalization target lookup (#13289)
davxy Feb 11, 2023
71432c2
SetMembers configurable origin (#13159)
girazoki Feb 12, 2023
bfe5a7d
have a way to disable pages
Ank4n Feb 12, 2023
02703c7
fmt
Ank4n Feb 12, 2023
b79e231
simple rename
Ank4n Feb 12, 2023
77ba7df
test for page size and count
Ank4n Feb 12, 2023
ff965e2
add the old test back
Ank4n Feb 12, 2023
8a608f9
update changelog
Ank4n Feb 12, 2023
fef9db6
Merge branch 'master' of github.com:paritytech/substrate into ankan/p…
kianenigma Feb 14, 2023
a7bb9ed
Merge remote-tracking branch 'origin/master' into ankan/paged-rewards
Feb 14, 2023
dd6989c
Merge branch 'ankan/paged-rewards' of github.com:paritytech/substrate…
kianenigma Feb 14, 2023
64aa36b
Merge branch 'master' into ankan/paged-rewards
Ank4n Feb 14, 2023
397e5d2
remove duplicate test
Ank4n Feb 14, 2023
73630b4
todo tags
Ank4n Feb 15, 2023
cb59ca7
some renames and config vals
Ank4n Feb 15, 2023
a82b0bd
do not iterate twice
Ank4n Feb 15, 2023
e8ebbbc
rename
Ank4n Feb 15, 2023
9a959e4
clean up
Ank4n Feb 15, 2023
f712e35
pr fixes
Ank4n Feb 15, 2023
dfe8a98
fmt
Ank4n Feb 15, 2023
e2bf7cf
make it compile
Ank4n Feb 15, 2023
d08ffd5
Merge branch 'master' into ankan/paged-rewards
Ank4n Feb 18, 2023
d79d897
keep only config item for MaxExposurePageSize
Ank4n Feb 19, 2023
5a1f446
safe maths
Ank4n Feb 19, 2023
08d60ff
pr comment
Ank4n Feb 19, 2023
b929439
simplify next claimable page
Ank4n Feb 19, 2023
7df30f6
fix build
Ank4n Feb 19, 2023
4a415e7
pr comments
Ank4n Feb 19, 2023
8544412
clippy suggestion
Ank4n Feb 20, 2023
04133ab
Merge branch 'ankan/paged-rewards' of github.com:paritytech/substrate…
kianenigma Feb 20, 2023
0ce2bbd
write a new eras stakers
Ank4n Feb 20, 2023
ed8c993
clean up page_count
Ank4n Feb 20, 2023
2634403
more readable validator exposure calculation
Ank4n Feb 20, 2023
5f5abad
fmt
Ank4n Feb 20, 2023
9ad77cb
do not use ErasStakers anymore
Ank4n Feb 20, 2023
7dfb3e8
defensive unwrap for appending nominator pages to eras stakers
Ank4n Feb 20, 2023
fd2f6fb
better fn naming
Ank4n Feb 20, 2023
45ad6e1
fmt
Ank4n Feb 20, 2023
d49de8b
move logic to combine all exposure into EraInfo
Ank4n Feb 20, 2023
c67e8bd
remove useless getters
Ank4n Feb 20, 2023
06627f0
bounded ExposureOverview
Ank4n Feb 20, 2023
89820f9
remove unused fn
Ank4n Feb 20, 2023
66c8fe1
ErasStakers backward compatible test
Ank4n Feb 22, 2023
b5fa46e
fmt
Ank4n Feb 22, 2023
12ed262
update changelog
Ank4n Feb 22, 2023
14bc8b3
Use NMap for ErasStakersPaged
Ank4n Feb 22, 2023
6ac7961
doc update
Ank4n Feb 22, 2023
af01a1f
Merge branch 'master' of https://github.com/paritytech/substrate into…
Feb 22, 2023
b5190b5
".git/.scripts/commands/bench/bench.sh" pallet dev pallet_staking
Feb 22, 2023
21c20f2
rename to consistent names
Ank4n Feb 22, 2023
2aa08d6
some docs
Ank4n Feb 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frame/fast-unstake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ pub mod pallet {
/// The map of all accounts wishing to be unstaked.
///
/// Keeps track of `AccountId` wishing to unstake and it's corresponding deposit.
///
/// TWOX-NOTE: SAFE since `AccountId` is a secure hash.
#[pallet::storage]
pub type Queue<T: Config> = CountedStorageMap<_, Twox64Concat, T::AccountId, BalanceOf<T>>;

Expand Down
2 changes: 2 additions & 0 deletions frame/nomination-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,8 @@ pub mod pallet {
pub type MaxPoolMembersPerPool<T: Config> = StorageValue<_, u32, OptionQuery>;

/// Active members.
///
/// TWOX-NOTE: SAFE since `AccountId` is a secure hash.
#[pallet::storage]
pub type PoolMembers<T: Config> =
CountedStorageMap<_, Twox64Concat, T::AccountId, PoolMember<T>>;
Expand Down
39 changes: 37 additions & 2 deletions frame/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ use sp_staking::{
use sp_std::{collections::btree_map::BTreeMap, prelude::*};
pub use weights::WeightInfo;

use frame_support::traits::ConstU32;
pub use pallet::{pallet::*, *};

pub(crate) const LOG_TARGET: &str = "runtime::staking";
Expand Down Expand Up @@ -732,6 +733,40 @@ impl<AccountId, Balance: Default + HasCompact> Default for Exposure<AccountId, B
}
}

impl<AccountId: Clone, Balance: HasCompact + AtLeast32BitUnsigned + Copy>
Exposure<AccountId, Balance>
{
fn in_chunks_of(&self, page_size: usize) -> Vec<Self> {
let individual_chunks = self.others.chunks(page_size);
let mut paged_exposure: Vec<Self> = Vec::with_capacity(individual_chunks.len());

// own balance that has not been accounted for in the paged exposure
let mut own_left = self.own;

for chunk in individual_chunks {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use into_iter() here, you will be owning each chunk and therefore able to assign it to ExposurePage.others without needing to copy anything (I hope).

let own = own_left;
let mut total = own;
for individual in chunk.iter() {
total = total.saturating_add(individual.value);
}

paged_exposure.push(Exposure {
total,
own,
others: chunk
.iter()
.map(|c| IndividualExposure { who: c.who.clone(), value: c.value })
.collect(),
});

// subtract own that has been accounted
own_left = own_left.saturating_sub(own);
}

paged_exposure
}
}

/// A pending slash record. The value of the slash has been computed but not applied yet,
/// rather deferred for several eras.
#[derive(Encode, Decode, RuntimeDebug, TypeInfo)]
Expand Down Expand Up @@ -955,6 +990,6 @@ pub struct TestBenchmarkingConfig;

#[cfg(feature = "std")]
impl BenchmarkingConfig for TestBenchmarkingConfig {
type MaxValidators = frame_support::traits::ConstU32<100>;
type MaxNominators = frame_support::traits::ConstU32<100>;
type MaxValidators = ConstU32<100>;
type MaxNominators = ConstU32<100>;
}
1 change: 1 addition & 0 deletions frame/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ impl crate::pallet::pallet::Config for Test {
type EraPayout = ConvertCurve<RewardCurve>;
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = ConstU32<64>;
type ExposurePageSize = ConstU32<10>;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type ElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
type GenesisElectionProvider = Self::ElectionProvider;
Expand Down
81 changes: 41 additions & 40 deletions frame/staking/src/pallet/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,18 @@ use frame_support::{
pallet_prelude::*,
traits::{
Currency, CurrencyToVote, Defensive, DefensiveResult, EstimateNextNewSession, Get,
Imbalance, LockableCurrency, OnUnbalanced, TryCollect, UnixTime, WithdrawReasons,
Imbalance, Len, LockableCurrency, OnUnbalanced, TryCollect, UnixTime, WithdrawReasons,
},
weights::Weight,
};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use pallet_session::historical;
use sp_runtime::{
generic::Era,
traits::{Bounded, Convert, One, SaturatedConversion, Saturating, StaticLookup, Zero},
Perbill,
};
use sp_staking::{
offence::{DisableStrategy, OffenceDetails, OnOffenceHandler},
EraIndex, SessionIndex, Stake, StakingInterface,
};
use sp_staking::{offence::{DisableStrategy, OffenceDetails, OnOffenceHandler}, EraIndex, SessionIndex, Stake, StakingInterface, PageIndex};
use sp_std::prelude::*;

use crate::{
Expand Down Expand Up @@ -134,6 +132,7 @@ impl<T: Config> Pallet<T> {
pub(super) fn do_payout_stakers(
validator_stash: T::AccountId,
era: EraIndex,
page: PageIndex,
) -> DispatchResultWithPostInfo {
// Validate input data
let current_era = CurrentEra::<T>::get().ok_or_else(|| {
Expand All @@ -159,36 +158,45 @@ impl<T: Config> Pallet<T> {
})?;
let mut ledger = <Ledger<T>>::get(&controller).ok_or(Error::<T>::NotController)?;

// clean up older claimed rewards
ledger
.claimed_rewards
.retain(|&x| x >= current_era.saturating_sub(history_depth));
<Ledger<T>>::insert(&controller, &ledger);

match ledger.claimed_rewards.binary_search(&era) {
Ok(_) =>
return Err(Error::<T>::AlreadyClaimed
.with_weight(T::WeightInfo::payout_stakers_alive_staked(0))),
Err(pos) => ledger
.claimed_rewards
.try_insert(pos, era)
// Since we retain era entries in `claimed_rewards` only upto
// `HistoryDepth`, following bound is always expected to be
// satisfied.
.defensive_map_err(|_| Error::<T>::BoundNotMet)?,
// todo(ank4n): remove
// match ledger.claimed_rewards.binary_search(&era) {
// Ok(_) =>
// return Err(Error::<T>::AlreadyClaimed
// .with_weight(T::WeightInfo::payout_stakers_alive_staked(0))),
// Err(pos) => ledger
// .claimed_rewards
// .try_insert(pos, era)
// // Since we retain era entries in `claimed_rewards` only upto
// // `HistoryDepth`, following bound is always expected to be
// // satisfied.
// .defensive_map_err(|_| Error::<T>::BoundNotMet)?,
// }

if EraInfo::<T>::temp_is_rewards_claimed(era, &ledger, &ledger.stash, page) {
return Err(Error::<T>::AlreadyClaimed
.with_weight(T::WeightInfo::payout_stakers_alive_staked(0)))
} else {
EraInfo::<T>::set_rewards_as_claimed(era, &ledger.stash, page);
}

let exposure = <ErasStakersClipped<T>>::get(&era, &ledger.stash);

// Input data seems good, no errors allowed after this point

<Ledger<T>>::insert(&controller, &ledger);

// Get Era reward points. It has TOTAL and INDIVIDUAL
// Find the fraction of the era reward that belongs to the validator
// Take that fraction of the eras rewards to split to nominator and validator
//
// Then look at the validator, figure out the proportion of their reward
// which goes to them and each of their nominators.

let exposure = EraInfo::<T>::get_validator_exposure(era, &ledger.stash, page);
// let exposure = EraInfo::<T>::get_validator_exposure(&era, &ledger.stash, page);

let era_reward_points = <ErasRewardPoints<T>>::get(&era);
let total_reward_points = era_reward_points.total;
let validator_reward_points = era_reward_points
Expand Down Expand Up @@ -561,31 +569,24 @@ impl<T: Config> Pallet<T> {
>,
new_planned_era: EraIndex,
) -> BoundedVec<T::AccountId, MaxWinnersOf<T>> {
let elected_stashes: BoundedVec<_, MaxWinnersOf<T>> = exposures
Ank4n marked this conversation as resolved.
Show resolved Hide resolved
.iter()
.cloned()
.map(|(x, _)| x)
.collect::<Vec<_>>()
.try_into()
.expect("since we only map through exposures, size of elected_stashes is always same as exposures; qed");

// Populate stakers, exposures, and the snapshot of validator prefs.
// Populate elected stash, stakers, exposures, and the snapshot of validator prefs.
let mut total_stake: BalanceOf<T> = Zero::zero();
let mut elected_stashes = Vec::with_capacity(exposures.len());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be curious to see in which benchmark we realize that the weight of the exposure collection (election finalization) is now less.


exposures.into_iter().for_each(|(stash, exposure)| {
// build elected stash
elected_stashes.push(stash.clone());
// accumulate total stake
total_stake = total_stake.saturating_add(exposure.total);
<ErasStakers<T>>::insert(new_planned_era, &stash, &exposure);

let mut exposure_clipped = exposure;
let clipped_max_len = T::MaxNominatorRewardedPerValidator::get() as usize;
if exposure_clipped.others.len() > clipped_max_len {
exposure_clipped.others.sort_by(|a, b| a.value.cmp(&b.value).reverse());
exposure_clipped.others.truncate(clipped_max_len);
}
<ErasStakersClipped<T>>::insert(&new_planned_era, &stash, exposure_clipped);
// store staker exposure for this era
EraInfo::<T>::set_validator_exposure(new_planned_era, &stash, exposure);
});

// Insert current era staking information
<ErasTotalStake<T>>::insert(&new_planned_era, total_stake);
let elected_stashes: BoundedVec<_, MaxWinnersOf<T>> = elected_stashes
.try_into()
.expect("elected_stashes.len() always equal to exposures.len(); qed");

EraInfo::<T>::set_total_stake(new_planned_era, total_stake);

// Collect the pref of all winners.
for stash in &elected_stashes {
Expand Down
Loading