Unverified Commit 5b755428 authored by Kian Paimani's avatar Kian Paimani Committed by GitHub
Browse files

Companion for sub/8176 (#2622)



* Merge

* Fixes

* Fix build

* remove dep.

* undo dep.

* upadte substrate

* cargo run --release --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/

* Fix lock

* revert lock; cargo update -p sp-io

* from_rational_approx -> from_rational

* Silence more warnings
Co-authored-by: default avatarGav Wood <gavin@parity.io>
Co-authored-by: Shawn Tabrizi's avatarShawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: default avatarParity Benchmarking Bot <admin@parity.io>
parent 6b474a44
Pipeline #128803 canceled with stages
in 11 minutes and 11 seconds
This diff is collapsed.
......@@ -49,7 +49,6 @@ hex-literal = "0.3.1"
keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-election-providers = { git = "https://github.com/paritytech/substrate", branch = "master" }
frame-support-test = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "master" }
......
......@@ -809,7 +809,7 @@ mod tests {
alice(),
50,
50,
Permill::from_rational_approximation(77u32, 1000u32),
Permill::from_rational(77u32, 1000u32),
));
assert_eq!(
Accounts::<Test>::get(alice()),
......
......@@ -85,7 +85,7 @@ pub mod fee {
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational_approximation(p % q, q),
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
......
......@@ -316,7 +316,7 @@ parameter_types! {
pub const Fallback: pallet_election_provider_multi_phase::FallbackStrategy =
pallet_election_provider_multi_phase::FallbackStrategy::Nothing;
pub SolutionImprovementThreshold: Perbill = Perbill::from_rational_approximation(1u32, 10_000);
pub SolutionImprovementThreshold: Perbill = Perbill::from_rational(1u32, 10_000);
// miner configs
pub MultiPhaseUnsignedPriority: TransactionPriority = StakingUnsignedPriority::get() - 1u64;
......@@ -368,7 +368,7 @@ parameter_types! {
// quarter of the last session will be for election.
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const MaxIterations: u32 = 10;
pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000);
pub MinSolutionScoreBump: Perbill = Perbill::from_rational(5u32, 10_000);
}
type SlashCancelOrigin = EnsureOneOf<
......@@ -391,7 +391,7 @@ impl pallet_staking::Config for Runtime {
// A majority of the council or root can cancel the slash.
type SlashCancelOrigin = SlashCancelOrigin;
type SessionInterface = Self;
type RewardCurve = RewardCurve;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionLookahead = ElectionLookahead;
......
......@@ -62,6 +62,9 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn elect_queued() -> Weight {
0
}
fn submit_unsigned(v: u32, t: u32, a: u32, d: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 21_000
......
......@@ -214,4 +214,23 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 113_000
.saturating_add((26_614_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 113_000
.saturating_add((64_299_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 1_547_000
.saturating_add((20_092_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
}
fn get_npos_targets(v: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 29_000
.saturating_add((10_228_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
}
}
......@@ -77,7 +77,7 @@ pub mod fee {
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational_approximation(p % q, q),
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
......
......@@ -326,7 +326,7 @@ parameter_types! {
pub const Fallback: pallet_election_provider_multi_phase::FallbackStrategy =
pallet_election_provider_multi_phase::FallbackStrategy::Nothing;
pub SolutionImprovementThreshold: Perbill = Perbill::from_rational_approximation(1u32, 10_000);
pub SolutionImprovementThreshold: Perbill = Perbill::from_rational(1u32, 10_000);
// miner configs
pub MultiPhaseUnsignedPriority: TransactionPriority = StakingUnsignedPriority::get() - 1u64;
......@@ -377,7 +377,7 @@ parameter_types! {
// last 15 minutes of the last session will be for election.
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 16;
pub const MaxIterations: u32 = 10;
pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000);
pub MinSolutionScoreBump: Perbill = Perbill::from_rational(5u32, 10_000);
}
type SlashCancelOrigin = EnsureOneOf<
......@@ -400,7 +400,7 @@ impl pallet_staking::Config for Runtime {
// A super-majority of the council can cancel the slash.
type SlashCancelOrigin = SlashCancelOrigin;
type SessionInterface = Self;
type RewardCurve = RewardCurve;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionLookahead = ElectionLookahead;
......
......@@ -62,6 +62,9 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn elect_queued() -> Weight {
0
}
fn submit_unsigned(v: u32, t: u32, a: u32, d: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 22_000
......
......@@ -16,7 +16,7 @@
//! Autogenerated weights for pallet_staking
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
//! DATE: 2021-02-22, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: []
//! DATE: 2021-03-16, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 128
// Executed Command:
......@@ -44,174 +44,193 @@ use sp_std::marker::PhantomData;
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
fn bond() -> Weight {
(76_908_000 as Weight)
(75_596_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn bond_extra() -> Weight {
(62_164_000 as Weight)
(61_252_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn unbond() -> Weight {
(56_648_000 as Weight)
(56_294_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn withdraw_unbonded_update(s: u32, ) -> Weight {
(57_093_000 as Weight)
(56_564_000 as Weight)
// Standard Error: 0
.saturating_add((39_000 as Weight).saturating_mul(s as Weight))
.saturating_add((29_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
(91_385_000 as Weight)
// Standard Error: 2_000
.saturating_add((2_653_000 as Weight).saturating_mul(s as Weight))
(89_521_000 as Weight)
// Standard Error: 1_000
.saturating_add((2_624_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
fn validate() -> Weight {
(19_310_000 as Weight)
(18_843_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn kick(k: u32, ) -> Weight {
(16_186_000 as Weight)
// Standard Error: 7_000
.saturating_add((18_595_000 as Weight).saturating_mul(k as Weight))
(12_546_000 as Weight)
// Standard Error: 11_000
.saturating_add((18_588_000 as Weight).saturating_mul(k as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(k as Weight)))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(k as Weight)))
}
fn nominate(n: u32, ) -> Weight {
(28_442_000 as Weight)
// Standard Error: 11_000
.saturating_add((5_696_000 as Weight).saturating_mul(n as Weight))
(28_659_000 as Weight)
// Standard Error: 12_000
.saturating_add((5_608_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn chill() -> Weight {
(18_484_000 as Weight)
(18_137_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn set_payee() -> Weight {
(12_669_000 as Weight)
(12_265_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn set_controller() -> Weight {
(27_387_000 as Weight)
(26_666_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn set_validator_count() -> Weight {
(2_185_000 as Weight)
(2_105_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn force_no_eras() -> Weight {
(2_462_000 as Weight)
(2_371_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn force_new_era() -> Weight {
(2_457_000 as Weight)
(2_352_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn force_new_era_always() -> Weight {
(2_479_000 as Weight)
(2_348_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn set_invulnerables(v: u32, ) -> Weight {
(2_587_000 as Weight)
(2_547_000 as Weight)
// Standard Error: 0
.saturating_add((35_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn force_unstake(s: u32, ) -> Weight {
(60_870_000 as Weight)
// Standard Error: 2_000
.saturating_add((2_685_000 as Weight).saturating_mul(s as Weight))
(60_738_000 as Weight)
// Standard Error: 1_000
.saturating_add((2_618_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
fn cancel_deferred_slash(s: u32, ) -> Weight {
(5_926_565_000 as Weight)
// Standard Error: 389_000
.saturating_add((34_615_000 as Weight).saturating_mul(s as Weight))
(5_928_118_000 as Weight)
// Standard Error: 390_000
.saturating_add((34_769_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
(117_761_000 as Weight)
// Standard Error: 12_000
.saturating_add((50_840_000 as Weight).saturating_mul(n as Weight))
(118_119_000 as Weight)
// Standard Error: 18_000
.saturating_add((50_486_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(11 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight)))
}
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
(150_617_000 as Weight)
// Standard Error: 20_000
.saturating_add((65_847_000 as Weight).saturating_mul(n as Weight))
(146_232_000 as Weight)
// Standard Error: 28_000
.saturating_add((64_703_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(12 as Weight))
.saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight)))
}
fn rebond(l: u32, ) -> Weight {
(39_745_000 as Weight)
// Standard Error: 2_000
.saturating_add((78_000 as Weight).saturating_mul(l as Weight))
(39_223_000 as Weight)
// Standard Error: 1_000
.saturating_add((89_000 as Weight).saturating_mul(l as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn set_history_depth(e: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 64_000
.saturating_add((31_128_000 as Weight).saturating_mul(e as Weight))
// Standard Error: 65_000
.saturating_add((31_885_000 as Weight).saturating_mul(e as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
}
fn reap_stash(s: u32, ) -> Weight {
(64_170_000 as Weight)
// Standard Error: 1_000
.saturating_add((2_686_000 as Weight).saturating_mul(s as Weight))
(64_155_000 as Weight)
// Standard Error: 0
.saturating_add((2_609_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
fn new_era(v: u32, n: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 1_070_000
.saturating_add((590_545_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 53_000
.saturating_add((82_290_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(7 as Weight))
// Standard Error: 813_000
.saturating_add((579_234_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 40_000
.saturating_add((80_798_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
.saturating_add(T::DbWeight::get().writes(13 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
}
fn submit_solution_better(v: u32, n: u32, a: u32, w: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 53_000
.saturating_add((972_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 21_000
.saturating_add((547_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 53_000
.saturating_add((75_353_000 as Weight).saturating_mul(a as Weight))
// Standard Error: 111_000
.saturating_add((7_477_000 as Weight).saturating_mul(w as Weight))
// Standard Error: 47_000
.saturating_add((1_156_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 19_000
.saturating_add((537_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 47_000
.saturating_add((73_175_000 as Weight).saturating_mul(a as Weight))
// Standard Error: 99_000
.saturating_add((6_758_000 as Weight).saturating_mul(w as Weight))
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight)))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 113_000
.saturating_add((26_614_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 113_000
.saturating_add((64_299_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 1_547_000
.saturating_add((20_092_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
}
fn get_npos_targets(v: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 29_000
.saturating_add((10_228_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
}
}
......@@ -79,7 +79,7 @@ pub mod fee {
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational_approximation(p % q, q),
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
......
......@@ -26,7 +26,7 @@ sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-election-providers = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
tx-pool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
block-builder-api = { package = "sp-block-builder", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
......@@ -115,5 +115,5 @@ std = [
"pallet-randomness-collective-flip/std",
"runtime-common/std",
"log/std",
"sp-election-providers/std",
"frame-election-provider-support/std",
]
......@@ -74,7 +74,7 @@ pub mod fee {
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational_approximation(p % q, q),
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
......
......@@ -309,12 +309,13 @@ parameter_types! {
pub storage ElectionLookahead: BlockNumber = 0;
pub storage StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2;
pub storage MaxIterations: u32 = 10;
pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000);
pub MinSolutionScoreBump: Perbill = Perbill::from_rational(5u32, 10_000);
}
impl sp_election_providers::onchain::Config for Runtime {
impl frame_election_provider_support::onchain::Config for Runtime {
type AccountId = <Self as frame_system::Config>::AccountId;
type BlockNumber = <Self as frame_system::Config>::BlockNumber;
type BlockWeights = ();
type Accuracy = sp_runtime::Perbill;
type DataProvider = pallet_staking::Module<Self>;
}
......@@ -333,7 +334,7 @@ impl pallet_staking::Config for Runtime {
// A majority of the council can cancel the slash.
type SlashCancelOrigin = frame_system::EnsureNever<()>;
type SessionInterface = Self;
type RewardCurve = RewardCurve;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionLookahead = ElectionLookahead;
......@@ -342,7 +343,7 @@ impl pallet_staking::Config for Runtime {
type MaxIterations = MaxIterations;
type OffchainSolutionWeightLimit = ();
type MinSolutionScoreBump = MinSolutionScoreBump;
type ElectionProvider = sp_election_providers::onchain::OnChainSequentialPhragmen<Self>;
type ElectionProvider = frame_election_provider_support::onchain::OnChainSequentialPhragmen<Self>;
type WeightInfo = ();
}
......
......@@ -77,7 +77,7 @@ pub mod fee {
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational_approximation(p % q, q),
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
......
......@@ -320,7 +320,7 @@ parameter_types! {
pub const Fallback: pallet_election_provider_multi_phase::FallbackStrategy =
pallet_election_provider_multi_phase::FallbackStrategy::Nothing;
pub SolutionImprovementThreshold: Perbill = Perbill::from_rational_approximation(1u32, 10_000);
pub SolutionImprovementThreshold: Perbill = Perbill::from_rational(1u32, 10_000);
// miner configs
pub const MultiPhaseUnsignedPriority: TransactionPriority = StakingUnsignedPriority::get() - 1u64;
......@@ -367,7 +367,7 @@ parameter_types! {
// quarter of the last session will be for election.
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const MaxIterations: u32 = 10;
pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000);
pub MinSolutionScoreBump: Perbill = Perbill::from_rational(5u32, 10_000);
}
impl pallet_staking::Config for Runtime {
......@@ -384,7 +384,7 @@ impl pallet_staking::Config for Runtime {
// A majority of the council can cancel the slash.
type SlashCancelOrigin = EnsureRoot<AccountId>;
type SessionInterface = Self;
type RewardCurve = RewardCurve;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionLookahead = ElectionLookahead;
......
......@@ -62,6 +62,9 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn elect_queued() -> Weight {
0
}
fn submit_unsigned(v: u32, t: u32, a: u32, d: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 22_000
......
......@@ -214,4 +214,23 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn get_npos_voters(v: u32, n: u32, s: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 113_000
.saturating_add((26_614_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 113_000
.saturating_add((64_299_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 1_547_000
.saturating_add((20_092_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
}
fn get_npos_targets(v: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 29_000
.saturating_add((10_228_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment