Migrate pallet-staking to pallet attribute macro (#9083)

* Migrate staking pallet to pallet attribute macro.

* HistoryDepth default value.

* Make all calls public.

* Update frame/staking/src/lib.rs

* remove externalities again

* Update lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Shaun Wang
2021-06-12 12:22:40 +12:00
committed by GitHub
parent 68833498c6
commit 0869fdf9aa
10 changed files with 731 additions and 552 deletions
+3 -3
View File
@@ -19,7 +19,7 @@
//! bonding validators, nominators, and generating different types of solutions.
use crate::*;
use crate::Module as Staking;
use crate::Pallet as Staking;
use frame_benchmarking::account;
use frame_system::RawOrigin;
use sp_io::hashing::blake2_256;
@@ -166,12 +166,12 @@ pub fn create_validators_with_nominators_for_era<T: Config>(
Staking::<T>::nominate(RawOrigin::Signed(n_controller.clone()).into(), selected_validators)?;
}
ValidatorCount::put(validators);
ValidatorCount::<T>::put(validators);
Ok(validator_chosen)
}
/// get the current era.
pub fn current_era<T: Config>() -> EraIndex {
<Module<T>>::current_era().unwrap_or(0)
<Pallet<T>>::current_era().unwrap_or(0)
}