Skip to content

Commit

Permalink
Ensure min validator commission when election happens off-chain
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardo-xxnet committed Mar 9, 2022
1 parent 63b8a0b commit f2c37a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frame/staking/src/pallet/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,14 @@ impl<T: Config> Pallet<T> {
<ErasTotalStake<T>>::insert(&new_planned_era, total_stake);

// Collect the pref of all winners.
let min_comm = MinValidatorCommission::<T>::get();
for stash in &elected_stashes {
let pref = Self::validators(stash);
let mut pref = Self::validators(stash);
// Ensure minimum commission in case a validator chills
// after the election snapshot but before the election happens
if pref.commission < min_comm {
pref.commission = min_comm
}
<ErasValidatorPrefs<T>>::insert(&new_planned_era, stash, pref);
}

Expand Down

0 comments on commit f2c37a3

Please sign in to comment.