mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 23:01:01 +00:00
Abstracts elections-phragmen pallet to use NposSolver (#12588)
* Abstracts elections-phragmen pallet to use NposSolver * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/elections-phragmen/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * changes the name of the pallet; adds changelog * update changelog * Adds weight testing * Adds log macro_rules * renames elections-phragment dir to elections * weights rename * fixes typo in cargo toml * pre/post solve weight scafolding * refactor do_post_election * refactors into pre and post election solve for independent benchmarking * deconstructs PreElectionResults struct * updates benchmarking pre and post election solve; mock weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * addresses PR comments * adds pre_solve and post_sove weights * Adds comments on election pallet id param name change * ".git/.scripts/bench-bot.sh" pallet dev pallet_elections * Finishes pre-post solve weights * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/elections/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Addresses PR comments: no panic in on_init path; nits * Fixes node build * Implements approval voting to use as a `NposSolver` (#13367) * Implements the approval voting methods in sp_npos_elections * fmt * remove unecessary file * comment clarification * re-run weights * fix typo * updates MaxVoters in tests for integrity_tests to pass * Refactors election provider support benchmarks outside its own crate (#13431) * Refactors election provider support benchmarks outside its own crate --------- Co-authored-by: command-bot <> --------- Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: parity-processbot <> Co-authored-by: Ross Bulat <ross@parity.io>
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// Copyright (C) 2023 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -15,25 +15,29 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Autogenerated weights for pallet_election_provider_support_benchmarking
|
||||
//! Autogenerated weights for frame_election_provider_support
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-04-23, STEPS: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2023-02-22, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `runner-ehxwxxsd-project-145-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/substrate
|
||||
// target/production/substrate
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=dev
|
||||
// --steps=1
|
||||
// --repeat=1
|
||||
// --pallet=pallet_election_provider_support_benchmarking
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --output=frame/election-provider-support/src/weights.rs
|
||||
// --json-file=/builds/parity/mirrors/substrate/.git/.artifacts/bench.json
|
||||
// --pallet=frame_election_provider_support
|
||||
// --chain=dev
|
||||
// --header=./HEADER-APACHE2
|
||||
// --output=./frame/election-provider-support/src/weights.rs
|
||||
// --template=./.maintain/frame-weight-template.hbs
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
@@ -43,53 +47,108 @@
|
||||
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions needed for pallet_election_provider_support_benchmarking.
|
||||
/// Weight functions needed for frame_election_provider_support.
|
||||
pub trait WeightInfo {
|
||||
fn phragmen(v: u32, t: u32, d: u32, ) -> Weight;
|
||||
fn phragmms(v: u32, t: u32, d: u32, ) -> Weight;
|
||||
fn approval_voting(v: u32, t: u32, d: u32, ) -> Weight;
|
||||
}
|
||||
|
||||
/// Weights for pallet_election_provider_support_benchmarking using the Substrate node and recommended hardware.
|
||||
/// Weights for frame_election_provider_support using the Substrate node and recommended hardware.
|
||||
pub struct SubstrateWeight<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
fn phragmen(v: u32, t: u32, d: u32, ) -> Weight {
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 667_000
|
||||
.saturating_add(Weight::from_ref_time(32_973_000 as u64).saturating_mul(v as u64))
|
||||
// Standard Error: 1_334_000
|
||||
.saturating_add(Weight::from_ref_time(1_334_000 as u64).saturating_mul(t as u64))
|
||||
// Standard Error: 60_644_000
|
||||
.saturating_add(Weight::from_ref_time(2_636_364_000 as u64).saturating_mul(d as u64))
|
||||
/// The range of component `v` is `[1000, 2000]`.
|
||||
/// The range of component `t` is `[500, 1000]`.
|
||||
/// The range of component `d` is `[5, 16]`.
|
||||
fn phragmen(v: u32, _t: u32, d: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 5_789_174 nanoseconds.
|
||||
Weight::from_ref_time(5_826_449_000)
|
||||
.saturating_add(Weight::from_proof_size(0))
|
||||
// Standard Error: 130_342
|
||||
.saturating_add(Weight::from_ref_time(5_332_741).saturating_mul(v.into()))
|
||||
// Standard Error: 13_325_769
|
||||
.saturating_add(Weight::from_ref_time(1_416_874_101).saturating_mul(d.into()))
|
||||
}
|
||||
fn phragmms(v: u32, t: u32, d: u32, ) -> Weight {
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 73_000
|
||||
.saturating_add(Weight::from_ref_time(21_073_000 as u64).saturating_mul(v as u64))
|
||||
// Standard Error: 146_000
|
||||
.saturating_add(Weight::from_ref_time(65_000 as u64).saturating_mul(t as u64))
|
||||
// Standard Error: 6_649_000
|
||||
.saturating_add(Weight::from_ref_time(1_711_424_000 as u64).saturating_mul(d as u64))
|
||||
/// The range of component `v` is `[1000, 2000]`.
|
||||
/// The range of component `t` is `[500, 1000]`.
|
||||
/// The range of component `d` is `[5, 16]`.
|
||||
fn phragmms(v: u32, _t: u32, d: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 4_151_790 nanoseconds.
|
||||
Weight::from_ref_time(4_215_936_000)
|
||||
.saturating_add(Weight::from_proof_size(0))
|
||||
// Standard Error: 125_135
|
||||
.saturating_add(Weight::from_ref_time(4_730_609).saturating_mul(v.into()))
|
||||
// Standard Error: 12_793_390
|
||||
.saturating_add(Weight::from_ref_time(1_474_383_961).saturating_mul(d.into()))
|
||||
}
|
||||
/// The range of component `v` is `[1000, 2000]`.
|
||||
/// The range of component `t` is `[500, 1000]`.
|
||||
/// The range of component `d` is `[5, 16]`.
|
||||
fn approval_voting(v: u32, _t: u32, d: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 1_800_445 nanoseconds.
|
||||
Weight::from_ref_time(1_824_645_000)
|
||||
.saturating_add(Weight::from_proof_size(0))
|
||||
// Standard Error: 26_266
|
||||
.saturating_add(Weight::from_ref_time(1_229_576).saturating_mul(v.into()))
|
||||
// Standard Error: 2_685_343
|
||||
.saturating_add(Weight::from_ref_time(213_080_804).saturating_mul(d.into()))
|
||||
}
|
||||
}
|
||||
|
||||
// For backwards compatibility and tests
|
||||
impl WeightInfo for () {
|
||||
fn phragmen(v: u32, t: u32, d: u32, ) -> Weight {
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 667_000
|
||||
.saturating_add(Weight::from_ref_time(32_973_000 as u64).saturating_mul(v as u64))
|
||||
// Standard Error: 1_334_000
|
||||
.saturating_add(Weight::from_ref_time(1_334_000 as u64).saturating_mul(t as u64))
|
||||
// Standard Error: 60_644_000
|
||||
.saturating_add(Weight::from_ref_time(2_636_364_000 as u64).saturating_mul(d as u64))
|
||||
/// The range of component `v` is `[1000, 2000]`.
|
||||
/// The range of component `t` is `[500, 1000]`.
|
||||
/// The range of component `d` is `[5, 16]`.
|
||||
fn phragmen(v: u32, _t: u32, d: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 5_789_174 nanoseconds.
|
||||
Weight::from_ref_time(5_826_449_000)
|
||||
.saturating_add(Weight::from_proof_size(0))
|
||||
// Standard Error: 130_342
|
||||
.saturating_add(Weight::from_ref_time(5_332_741).saturating_mul(v.into()))
|
||||
// Standard Error: 13_325_769
|
||||
.saturating_add(Weight::from_ref_time(1_416_874_101).saturating_mul(d.into()))
|
||||
}
|
||||
fn phragmms(v: u32, t: u32, d: u32, ) -> Weight {
|
||||
Weight::from_ref_time(0 as u64)
|
||||
// Standard Error: 73_000
|
||||
.saturating_add(Weight::from_ref_time(21_073_000 as u64).saturating_mul(v as u64))
|
||||
// Standard Error: 146_000
|
||||
.saturating_add(Weight::from_ref_time(65_000 as u64).saturating_mul(t as u64))
|
||||
// Standard Error: 6_649_000
|
||||
.saturating_add(Weight::from_ref_time(1_711_424_000 as u64).saturating_mul(d as u64))
|
||||
/// The range of component `v` is `[1000, 2000]`.
|
||||
/// The range of component `t` is `[500, 1000]`.
|
||||
/// The range of component `d` is `[5, 16]`.
|
||||
fn phragmms(v: u32, _t: u32, d: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 4_151_790 nanoseconds.
|
||||
Weight::from_ref_time(4_215_936_000)
|
||||
.saturating_add(Weight::from_proof_size(0))
|
||||
// Standard Error: 125_135
|
||||
.saturating_add(Weight::from_ref_time(4_730_609).saturating_mul(v.into()))
|
||||
// Standard Error: 12_793_390
|
||||
.saturating_add(Weight::from_ref_time(1_474_383_961).saturating_mul(d.into()))
|
||||
}
|
||||
/// The range of component `v` is `[1000, 2000]`.
|
||||
/// The range of component `t` is `[500, 1000]`.
|
||||
/// The range of component `d` is `[5, 16]`.
|
||||
fn approval_voting(v: u32, _t: u32, d: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 1_800_445 nanoseconds.
|
||||
Weight::from_ref_time(1_824_645_000)
|
||||
.saturating_add(Weight::from_proof_size(0))
|
||||
// Standard Error: 26_266
|
||||
.saturating_add(Weight::from_ref_time(1_229_576).saturating_mul(v.into()))
|
||||
// Standard Error: 2_685_343
|
||||
.saturating_add(Weight::from_ref_time(213_080_804).saturating_mul(d.into()))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user