clean the interface of supports map (#9674)

* clean the interface of supports map, make it a bit cleaner and more efficients

* Fix stiff

* fix one test

* Fix warnings
This commit is contained in:
Kian Paimani
2021-09-10 19:39:48 +01:00
committed by GitHub
parent b3092ead23
commit be69e4d2b2
14 changed files with 67 additions and 189 deletions
+6 -5
View File
@@ -40,8 +40,8 @@ pub use impls::*;
use crate::{
migrations, slashing, weights::WeightInfo, ActiveEraInfo, BalanceOf, EraIndex, EraPayout,
EraRewardPoints, Exposure, Forcing, NegativeImbalanceOf, Nominations, PositiveImbalanceOf,
Releases, RewardDestination, SessionInterface, StakerStatus, StakingLedger, UnappliedSlash,
UnlockChunk, ValidatorPrefs,
Releases, RewardDestination, SessionInterface, StakingLedger, UnappliedSlash, UnlockChunk,
ValidatorPrefs,
};
pub const MAX_UNLOCKING_CHUNKS: usize = 32;
@@ -453,7 +453,8 @@ pub mod pallet {
pub force_era: Forcing,
pub slash_reward_fraction: Perbill,
pub canceled_payout: BalanceOf<T>,
pub stakers: Vec<(T::AccountId, T::AccountId, BalanceOf<T>, StakerStatus<T::AccountId>)>,
pub stakers:
Vec<(T::AccountId, T::AccountId, BalanceOf<T>, crate::StakerStatus<T::AccountId>)>,
pub min_nominator_bond: BalanceOf<T>,
pub min_validator_bond: BalanceOf<T>,
}
@@ -502,11 +503,11 @@ pub mod pallet {
RewardDestination::Staked,
));
frame_support::assert_ok!(match status {
StakerStatus::Validator => <Pallet<T>>::validate(
crate::StakerStatus::Validator => <Pallet<T>>::validate(
T::Origin::from(Some(controller.clone()).into()),
Default::default(),
),
StakerStatus::Nominator(votes) => <Pallet<T>>::nominate(
crate::StakerStatus::Nominator(votes) => <Pallet<T>>::nominate(
T::Origin::from(Some(controller.clone()).into()),
votes.iter().map(|l| T::Lookup::unlookup(l.clone())).collect(),
),