Move Staking Weights to T::WeightInfo (#7007)

* Fix the benchmarks

* Migrate staking to weightInfo

* Fix global benchmarks

* re-calculate the submit solution weight.

* Fix some refund.

* Get rid of all the extra parameters.

* Fix staking tests.

* new values from the bench machine.

* Fix some grumbles

* better macro

* Some better doc

* Move to interpreted wasm

* Make it work temporarily

* Final fix of default ones.

* Fix payout benchmarks

* Fix payout stuff

* One last fix

* use benchmarking machine for numbers

* update weight docs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Kian Paimani
2020-09-16 14:25:31 +02:00
committed by GitHub
parent 7a075a990f
commit 83bde4c1e6
8 changed files with 660 additions and 378 deletions
@@ -35,7 +35,7 @@ use frame_system::RawOrigin;
use pallet_session::{historical::Module as Historical, Module as Session, *};
use pallet_staking::{
benchmarking::create_validator_with_nominators, testing_utils::create_validators,
MAX_NOMINATIONS,
MAX_NOMINATIONS, RewardDestination,
};
use sp_runtime::traits::{One, StaticLookup};
@@ -55,7 +55,12 @@ benchmarks! {
set_keys {
let n in 1 .. MAX_NOMINATIONS as u32;
let v_stash = create_validator_with_nominators::<T>(n, MAX_NOMINATIONS as u32, false)?;
let v_stash = create_validator_with_nominators::<T>(
n,
MAX_NOMINATIONS as u32,
false,
RewardDestination::Staked,
)?;
let v_controller = pallet_staking::Module::<T>::bonded(&v_stash).ok_or("not stash")?;
let keys = T::Keys::default();
let proof: Vec<u8> = vec![0,1,2,3];
@@ -63,7 +68,7 @@ benchmarks! {
purge_keys {
let n in 1 .. MAX_NOMINATIONS as u32;
let v_stash = create_validator_with_nominators::<T>(n, MAX_NOMINATIONS as u32, false)?;
let v_stash = create_validator_with_nominators::<T>(n, MAX_NOMINATIONS as u32, false, RewardDestination::Staked)?;
let v_controller = pallet_staking::Module::<T>::bonded(&v_stash).ok_or("not stash")?;
let keys = T::Keys::default();
let proof: Vec<u8> = vec![0,1,2,3];