Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/master' into gui-doublemap
  • Loading branch information
gui1117 committed Mar 25, 2020
commit d2404b0d697355c730f085df5720302ee95d83f6
5 changes: 3 additions & 2 deletions frame/elections-phragmen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ use sp_runtime::{
print, DispatchResult, DispatchError, Perbill, traits::{Zero, StaticLookup, Convert},
};
use frame_support::{
decl_storage, decl_event, ensure, decl_module, decl_error, weights::SimpleDispatchInfo,
storage::StorageMap, traits::{
decl_storage, decl_event, ensure, decl_module, decl_error,
weights::{SimpleDispatchInfo, Weight, WeighData}, storage::StorageMap,
traits::{
Currency, Get, LockableCurrency, LockIdentifier, ReservableCurrency, WithdrawReasons,
ChangeMembers, OnUnbalanced, WithdrawReason, Contains, BalanceStatus
}
Expand Down
6 changes: 3 additions & 3 deletions frame/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use sp_core::{H256, crypto::key_types};
use sp_io;
use frame_support::{
assert_ok, impl_outer_origin, parameter_types, StorageValue, StorageMap, StorageDoubleMap,
traits::{Currency, Get, FindAuthor}, weights::Weight,
traits::{Currency, Get, FindAuthor, OnFinalize, OnInitialize}, weights::Weight,
};
use crate::{
EraIndex, GenesisConfig, Module, Trait, StakerStatus, ValidatorPrefs, RewardDestination,
Expand Down Expand Up @@ -378,7 +378,7 @@ pub type Timestamp = pallet_timestamp::Module<Test>;
pub type Staking = Module<Test>;

pub fn check_exposure_all(era: EraIndex) {
ErasStakers::<Test>::iter_prefix(era).for_each(check_exposure)
ErasStakers::<Test>::iter_prefix_values(era).for_each(check_exposure)
}

pub fn check_nominator_all(era: EraIndex) {
Expand All @@ -399,7 +399,7 @@ pub fn check_exposure(expo: Exposure<AccountId, Balance>) {
pub fn check_nominator_exposure(era: EraIndex, stash: AccountId) {
assert_is_stash(stash);
let mut sum = 0;
ErasStakers::<Test>::iter_prefix(era)
ErasStakers::<Test>::iter_prefix_values(era)
.for_each(|exposure| {
exposure.others.iter()
.filter(|i| i.who == stash)
Expand Down
2 changes: 1 addition & 1 deletion frame/staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ fn less_than_needed_candidates_works() {
// But the exposure is updated in a simple way. No external votes exists.
// This is purely self-vote.
assert!(
ErasStakers::<Test>::iter_prefix(Staking::active_era().unwrap().index)
ErasStakers::<Test>::iter_prefix_values(Staking::active_era().unwrap().index)
.all(|exposure| exposure.others.is_empty())
);
check_exposure_all(Staking::active_era().unwrap().index);
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.