Phragmen solution should submit for current era and be checked… (#5583)

* submit solution for current era

* add test

* address comment

* fix tests
This commit is contained in:
thiolliere
2020-04-14 16:04:25 +02:00
committed by GitHub
parent 1e1b0e2767
commit 57659b8cf4
4 changed files with 47 additions and 39 deletions
+8
View File
@@ -506,6 +506,10 @@ pub type Session = pallet_session::Module<Test>;
pub type Timestamp = pallet_timestamp::Module<Test>;
pub type Staking = Module<Test>;
pub(crate) fn current_era() -> EraIndex {
Staking::current_era().unwrap()
}
fn post_conditions() {
check_nominators();
check_exposures();
@@ -649,9 +653,13 @@ pub(crate) fn start_session(session_index: SessionIndex) {
assert_eq!(Session::current_index(), session_index);
}
// This start and activate the era given.
// Because the mock use pallet-session which delays session by one, this will be one session after
// the election happened, not the first session after the election has happened.
pub(crate) fn start_era(era_index: EraIndex) {
start_session((era_index * <SessionsPerEra as Get<u32>>::get()).into());
assert_eq!(Staking::current_era().unwrap(), era_index);
assert_eq!(Staking::active_era().unwrap().index, era_index);
}
pub(crate) fn current_total_payout_for_duration(duration: u64) -> Balance {