diff --git a/runtime/kusama/Cargo.toml b/runtime/kusama/Cargo.toml index 4e082eb5acd7..683a97ee7f97 100644 --- a/runtime/kusama/Cargo.toml +++ b/runtime/kusama/Cargo.toml @@ -49,7 +49,7 @@ pallet-nomination-pools-runtime-api = { git = "/~https://github.com/paritytech/sub pallet-collective = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-conviction-voting = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-democracy = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-elections-phragmen = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-elections = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-election-provider-multi-phase = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-fast-unstake = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-executive = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -91,7 +91,6 @@ pallet-offences-benchmarking = { git = "/~https://github.com/paritytech/substrate" pallet-session-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } pallet-nomination-pools-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-system-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -pallet-election-provider-support-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } hex-literal = { version = "0.4.1", optional = true } runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false } @@ -148,7 +147,7 @@ std = [ "pallet-transaction-payment-rpc-runtime-api/std", "pallet-collective/std", "pallet-conviction-voting/std", - "pallet-elections-phragmen/std", + "pallet-elections/std", "pallet-election-provider-multi-phase/std", "pallet-fast-unstake/std", "pallet-democracy/std", @@ -215,9 +214,8 @@ runtime-benchmarks = [ "pallet-collective/runtime-benchmarks", "pallet-conviction-voting/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", - "pallet-elections-phragmen/runtime-benchmarks", + "pallet-elections/runtime-benchmarks", "pallet-election-provider-multi-phase/runtime-benchmarks", - "pallet-election-provider-support-benchmarking/runtime-benchmarks", "pallet-fast-unstake/runtime-benchmarks", "pallet-nis/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", @@ -266,7 +264,7 @@ try-runtime = [ "pallet-transaction-payment/try-runtime", "pallet-collective/try-runtime", "pallet-conviction-voting/try-runtime", - "pallet-elections-phragmen/try-runtime", + "pallet-elections/try-runtime", "pallet-election-provider-multi-phase/try-runtime", "pallet-fast-unstake/try-runtime", "pallet-democracy/try-runtime", diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index 5dd7819ea587..7b9ef25c0cd9 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -1987,7 +1987,7 @@ sp_api::impl_runtime_apis! { use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; - use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; + use frame_election_provider_support::benchmarking::Pallet as ElectionProviderBench; use frame_system_benchmarking::Pallet as SystemBench; use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; use frame_benchmarking::baseline::Pallet as Baseline; @@ -2010,7 +2010,7 @@ sp_api::impl_runtime_apis! { // To get around that, we separated the benchmarks into its own crate. use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; - use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; + use frame_election_provider_support::benchmarking::Pallet as ElectionProviderBench; use frame_system_benchmarking::Pallet as SystemBench; use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; use frame_benchmarking::baseline::Pallet as Baseline; @@ -2021,7 +2021,7 @@ sp_api::impl_runtime_apis! { impl pallet_session_benchmarking::Config for Runtime {} impl pallet_offences_benchmarking::Config for Runtime {} - impl pallet_election_provider_support_benchmarking::Config for Runtime {} + impl frame_election_provider_support::benchmarking::Config for Runtime {} impl frame_system_benchmarking::Config for Runtime {} impl frame_benchmarking::baseline::Config for Runtime {} impl pallet_nomination_pools_benchmarking::Config for Runtime {} diff --git a/runtime/kusama/src/weights/frame_election_provider_support.rs b/runtime/kusama/src/weights/frame_election_provider_support.rs index 990fe2de459e..2eb85a7028a9 100644 --- a/runtime/kusama/src/weights/frame_election_provider_support.rs +++ b/runtime/kusama/src/weights/frame_election_provider_support.rs @@ -18,20 +18,22 @@ //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev //! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `runner-ehxwxxsd-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// target/production/polkadot // benchmark // pallet -// --chain=kusama-dev // --steps=50 // --repeat=20 -// --pallet=frame_election_provider_support // --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/polkadot/.git/.artifacts/bench.json +// --pallet=frame_election_provider_support +// --chain=kusama-dev // --header=./file_header.txt // --output=./runtime/kusama/src/weights/ @@ -67,7 +69,7 @@ impl frame_election_provider_support::WeightInfo for We // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_994_312_000 picoseconds. + // Minimum execution time: 5_043_278_000 nanoseconds. Weight::from_parts(5_043_278_000, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 153_800 @@ -75,4 +77,19 @@ impl frame_election_provider_support::WeightInfo for We // Standard Error: 15_724_043 .saturating_add(Weight::from_parts(1_841_670_903, 0).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_825_003 nanoseconds. + Weight::from_parts(1_846_540_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 31_136 + .saturating_add(Weight::from_parts(1_435_390, 0).saturating_mul(v.into())) + // Standard Error: 3_183_288 + .saturating_add(Weight::from_parts(237_013_414, 0).saturating_mul(d.into())) + } } diff --git a/runtime/kusama/src/weights/mod.rs b/runtime/kusama/src/weights/mod.rs index 49c4486c178a..be79619972c5 100644 --- a/runtime/kusama/src/weights/mod.rs +++ b/runtime/kusama/src/weights/mod.rs @@ -27,7 +27,7 @@ pub mod pallet_collective_technical_committee; pub mod pallet_conviction_voting; pub mod pallet_democracy; pub mod pallet_election_provider_multi_phase; -pub mod pallet_elections_phragmen; +pub mod pallet_elections; pub mod pallet_fast_unstake; pub mod pallet_identity; pub mod pallet_im_online; diff --git a/runtime/kusama/src/weights/pallet_elections.rs b/runtime/kusama/src/weights/pallet_elections.rs new file mode 100644 index 000000000000..fed8fff87a82 --- /dev/null +++ b/runtime/kusama/src/weights/pallet_elections.rs @@ -0,0 +1,214 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_elections_phragmen` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `runner-b3zmxxc-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/polkadot +// benchmark +// pallet +// --chain=kusama-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_elections_phragmen +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/kusama/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_elections_phragmen`. +pub struct WeightInfo(PhantomData); +impl pallet_elections::WeightInfo for WeightInfo { + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[1, 16]`. + fn vote_equal(v: u32, ) -> Weight { + // Minimum execution time: 33_181 nanoseconds. + Weight::from_ref_time(34_284_379) + // Standard Error: 4_703 + .saturating_add(Weight::from_ref_time(193_150).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_more(v: u32, ) -> Weight { + // Minimum execution time: 43_559 nanoseconds. + Weight::from_ref_time(45_014_304) + // Standard Error: 6_002 + .saturating_add(Weight::from_ref_time(232_544).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + /// The range of component `v` is `[2, 16]`. + fn vote_less(v: u32, ) -> Weight { + // Minimum execution time: 43_465 nanoseconds. + Weight::from_ref_time(45_027_590) + // Standard Error: 6_393 + .saturating_add(Weight::from_ref_time(218_368).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Voting (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + fn remove_voter() -> Weight { + // Minimum execution time: 42_363 nanoseconds. + Weight::from_ref_time(43_806_000) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + /// The range of component `c` is `[1, 1000]`. + fn submit_candidacy(c: u32, ) -> Weight { + // Minimum execution time: 43_408 nanoseconds. + Weight::from_ref_time(37_013_988) + // Standard Error: 1_189 + .saturating_add(Weight::from_ref_time(111_132).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PhragmenElection Candidates (r:1 w:1) + + /// The range of component `c` is `[1, 1000]`. + fn renounce_candidacy_candidate(c: u32, ) -> Weight { + // Minimum execution time: 40_256 nanoseconds. + Weight::from_ref_time(32_461_064) + // Standard Error: 1_225 + .saturating_add(Weight::from_ref_time(87_968).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn renounce_candidacy_members() -> Weight { + // Minimum execution time: 54_566 nanoseconds. + Weight::from_ref_time(56_705_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PhragmenElection RunnersUp (r:1 w:1) + fn renounce_candidacy_runners_up() -> Weight { + // Minimum execution time: 42_417 nanoseconds. + Weight::from_ref_time(43_317_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: Benchmark Override (r:0 w:0) + fn remove_member_without_replacement() -> Weight { + // Minimum execution time: 2_000_000_000 nanoseconds. + Weight::from_ref_time(2_000_000_000_000) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Prime (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: Council Members (r:0 w:1) + fn remove_member_with_replacement() -> Weight { + // Minimum execution time: 72_982 nanoseconds. + Weight::from_ref_time(74_640_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PhragmenElection Voting (r:5001 w:5000) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: Balances Locks (r:5000 w:5000) + // Storage: System Account (r:5000 w:5000) + /// The range of component `v` is `[5000, 10000]`. + /// The range of component `d` is `[0, 5000]`. + fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { + // Minimum execution time: 306_719_494 nanoseconds. + Weight::from_ref_time(307_744_759_000) + // Standard Error: 264_406 + .saturating_add(Weight::from_ref_time(37_950_413).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) + } + // Storage: PhragmenElection Candidates (r:1 w:0) + // Storage: PhragmenElection Members (r:1 w:0) + // Storage: PhragmenElection RunnersUp (r:1 w:0) + // Storage: PhragmenElection Voting (r:10001 w:0) + /// The range of component `c` is `[1, 1000]`. + /// The range of component `v` is `[1, 10000]`. + /// The range of component `e` is `[10000, 160000]`. + fn pre_solve_election(_c: u32, v: u32, e: u32, ) -> Weight { + // Minimum execution time: 6_399_000 nanoseconds. + Weight::from_ref_time(1_581_352_360 as u64) + // Standard Error: 55_251 + .saturating_add(Weight::from_ref_time(8_030_872 as u64).saturating_mul(v as u64)) + // Standard Error: 3_683 + .saturating_add(Weight::from_ref_time(13_203 as u64).saturating_mul(e as u64)) + .saturating_add(T::DbWeight::get().reads(296 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(v as u64))) + } + // Storage: PhragmenElection Members (r:1 w:1) + // Storage: PhragmenElection RunnersUp (r:1 w:1) + // Storage: Council Proposals (r:1 w:0) + // Storage: PhragmenElection ElectionRounds (r:1 w:1) + // Storage: PhragmenElection Candidates (r:0 w:1) + // Storage: Council Members (r:0 w:1) + // Storage: Council Prime (r:0 w:1) + // Storage: System Account (r:1 w:1) + /// The range of component `c` is `[1, 1000]`. + /// The range of component `v` is `[1, 10000]`. + /// The range of component `e` is `[10000, 160000]`. + fn post_solve_election(c: u32, v: u32, e: u32, ) -> Weight { + // Minimum execution time: 730_000 nanoseconds. + Weight::from_ref_time(747_000_000 as u64) + // Standard Error: 50_403 + .saturating_add(Weight::from_ref_time(12_670_099 as u64).saturating_mul(c as u64)) + // Standard Error: 5_039 + .saturating_add(Weight::from_ref_time(342_861 as u64).saturating_mul(v as u64)) + // Standard Error: 323 + .saturating_add(Weight::from_ref_time(127 as u64).saturating_mul(e as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(c as u64))) + .saturating_add(T::DbWeight::get().writes(6 as u64)) + .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(c as u64))) + } +} diff --git a/runtime/polkadot/Cargo.toml b/runtime/polkadot/Cargo.toml index 56f835ea5a47..3e55db3e5b0d 100644 --- a/runtime/polkadot/Cargo.toml +++ b/runtime/polkadot/Cargo.toml @@ -47,7 +47,7 @@ pallet-transaction-payment-rpc-runtime-api = { git = "/~https://github.com/parityt pallet-collective = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-conviction-voting = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-democracy = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-elections-phragmen = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-elections = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-election-provider-multi-phase = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-fast-unstake = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-executive = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -84,7 +84,6 @@ pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false } frame-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-try-runtime = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-system-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -pallet-election-provider-support-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } pallet-offences-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } pallet-session-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } pallet-nomination-pools-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } @@ -145,7 +144,7 @@ std = [ "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-collective/std", - "pallet-elections-phragmen/std", + "pallet-elections/std", "pallet-election-provider-multi-phase/std", "pallet-democracy/std", "pallet-fast-unstake/std", @@ -205,9 +204,8 @@ runtime-benchmarks = [ "pallet-collective/runtime-benchmarks", "pallet-conviction-voting/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", - "pallet-elections-phragmen/runtime-benchmarks", + "pallet-elections/runtime-benchmarks", "pallet-election-provider-multi-phase/runtime-benchmarks", - "pallet-election-provider-support-benchmarking/runtime-benchmarks", "pallet-fast-unstake/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-identity/runtime-benchmarks", @@ -253,7 +251,7 @@ try-runtime = [ "pallet-conviction-voting/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-collective/try-runtime", - "pallet-elections-phragmen/try-runtime", + "pallet-elections/try-runtime", "pallet-election-provider-multi-phase/try-runtime", "pallet-fast-unstake/try-runtime", "pallet-democracy/try-runtime", diff --git a/runtime/polkadot/src/governance/old.rs b/runtime/polkadot/src/governance/old.rs index 0f142f530dd2..ab673d4293e5 100644 --- a/runtime/polkadot/src/governance/old.rs +++ b/runtime/polkadot/src/governance/old.rs @@ -17,6 +17,7 @@ //! Old governance configurations for the Polkadot runtime. use crate::*; +use frame_election_provider_support::{weights::SubstrateWeight, SequentialPhragmen}; use frame_support::{parameter_types, traits::EitherOfDiverse}; parameter_types! { @@ -130,14 +131,17 @@ parameter_types! { pub const MaxVoters: u32 = 10 * 1000; pub const MaxVotesPerVoter: u32 = 16; pub const MaxCandidates: u32 = 1000; - pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; + // The ElectionsPalletId parameter name was changed along with the renaming of the elections + // pallet, but we keep the same lock ID to prevent runtime migrations. Related to + // /~https://github.com/paritytech/substrate/issues/8250 + pub const ElectionsPalletId: LockIdentifier = *b"phrelect"; } // Make sure that there are no more than `MaxMembers` members elected via phragmen. const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); -impl pallet_elections_phragmen::Config for Runtime { +impl pallet_elections::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type PalletId = PhragmenElectionPalletId; + type PalletId = ElectionsPalletId; type Currency = Balances; type ChangeMembers = Council; type InitializeMembers = Council; @@ -151,9 +155,11 @@ impl pallet_elections_phragmen::Config for Runtime { type DesiredRunnersUp = DesiredRunnersUp; type TermDuration = TermDuration; type MaxVoters = MaxVoters; - type MaxVotesPerVoter = MaxVotesPerVoter; type MaxCandidates = MaxCandidates; - type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; + type MaxVotesPerVoter = MaxVotesPerVoter; + type WeightInfo = weights::pallet_elections::WeightInfo; + type ElectionSolver = SequentialPhragmen; + type SolverWeightInfo = SubstrateWeight; } parameter_types! { diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index b94a882be420..d1c5a6a871fe 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -1310,10 +1310,12 @@ construct_runtime! { AuthorityDiscovery: pallet_authority_discovery::{Pallet, Config} = 13, // Old governance stuff. + // `PhragmenElection` uses the elections pallet configured to use the sequential phragmen + // election solver. Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 14, Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 16, - PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 17, + PhragmenElection: pallet_elections::{Pallet, Call, Storage, Event, Config} = 17, TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 18, Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 19, @@ -1478,7 +1480,7 @@ mod benches { [pallet_collective, Council] [pallet_collective, TechnicalCommittee] [pallet_democracy, Democracy] - [pallet_elections_phragmen, PhragmenElection] + [pallet_elections, PhragmenElection] [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] [frame_election_provider_support, ElectionProviderBench::] [pallet_fast_unstake, FastUnstake] @@ -1942,7 +1944,7 @@ sp_api::impl_runtime_apis! { use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; - use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; + use frame_election_provider_support::benchmarking::Pallet as ElectionProviderBench; use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; use frame_system_benchmarking::Pallet as SystemBench; use frame_benchmarking::baseline::Pallet as Baseline; @@ -1965,14 +1967,14 @@ sp_api::impl_runtime_apis! { // To get around that, we separated the benchmarks into its own crate. use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; - use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; + use frame_election_provider_support::benchmarking::Pallet as ElectionProviderBench; use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; use frame_system_benchmarking::Pallet as SystemBench; use frame_benchmarking::baseline::Pallet as Baseline; impl pallet_session_benchmarking::Config for Runtime {} impl pallet_offences_benchmarking::Config for Runtime {} - impl pallet_election_provider_support_benchmarking::Config for Runtime {} + impl frame_election_provider_support::benchmarking::Config for Runtime {} impl frame_system_benchmarking::Config for Runtime {} impl frame_benchmarking::baseline::Config for Runtime {} impl pallet_nomination_pools_benchmarking::Config for Runtime {} @@ -2006,6 +2008,7 @@ sp_api::impl_runtime_apis! { mod test_fees { use super::*; use crate::governance::old::*; + use frame_election_provider_support::NposSolver; use frame_support::{dispatch::GetDispatchInfo, weights::WeightToFee as WeightToFeeT}; use keyring::Sr25519Keyring::{Alice, Charlie}; use pallet_transaction_payment::Multiplier; @@ -2110,7 +2113,7 @@ mod test_fees { fn full_block_council_election_cost() { // the number of voters needed to consume almost a full block in council election, and how // much it is going to cost. - use pallet_elections_phragmen::WeightInfo; + use pallet_elections::WeightInfo; // Loser candidate lose a lot of money; sybil attack by candidates is even more expensive, // and we don't care about it here. For now, we assume no extra candidates, and only @@ -2118,11 +2121,18 @@ mod test_fees { let candidates = DesiredMembers::get() + DesiredRunnersUp::get(); let mut voters = 1u32; let weight_with = |v| { - ::WeightInfo::election_phragmen( + ::WeightInfo::pre_solve_election( candidates, v, v * 16, - ) + ) + ::ElectionSolver::weight::< + ::SolverWeightInfo, + >(candidates, v, v * 16) + + ::WeightInfo::post_solve_election( + candidates, + v, + v * 16, + ) }; while weight_with(voters).all_lte(BlockWeights::get().max_block) { diff --git a/runtime/polkadot/src/weights/frame_election_provider_support.rs b/runtime/polkadot/src/weights/frame_election_provider_support.rs index 85d2eb32d9d0..7568bb0b97ec 100644 --- a/runtime/polkadot/src/weights/frame_election_provider_support.rs +++ b/runtime/polkadot/src/weights/frame_election_provider_support.rs @@ -18,20 +18,22 @@ //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev //! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `runner-ehxwxxsd-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// target/production/polkadot // benchmark // pallet -// --chain=polkadot-dev // --steps=50 // --repeat=20 -// --pallet=frame_election_provider_support // --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/polkadot/.git/.artifacts/bench.json +// --pallet=frame_election_provider_support +// --chain=polkadot-dev // --header=./file_header.txt // --output=./runtime/polkadot/src/weights/ @@ -75,4 +77,19 @@ impl frame_election_provider_support::WeightInfo for We // Standard Error: 15_564_500 .saturating_add(Weight::from_parts(1_803_039_187, 0).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_866_533 nanoseconds. + Weight::from_parts(1_914_528_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 35_694 + .saturating_add(Weight::from_parts(1_599_519, 0).saturating_mul(v.into())) + // Standard Error: 3_649_300 + .saturating_add(Weight::from_parts(263_137_026, 0).saturating_mul(d.into())) + } } diff --git a/runtime/polkadot/src/weights/mod.rs b/runtime/polkadot/src/weights/mod.rs index d9471c6a3f24..55c690647408 100644 --- a/runtime/polkadot/src/weights/mod.rs +++ b/runtime/polkadot/src/weights/mod.rs @@ -26,7 +26,7 @@ pub mod pallet_collective_technical_committee; pub mod pallet_conviction_voting; pub mod pallet_democracy; pub mod pallet_election_provider_multi_phase; -pub mod pallet_elections_phragmen; +pub mod pallet_elections; pub mod pallet_fast_unstake; pub mod pallet_identity; pub mod pallet_im_online; diff --git a/runtime/polkadot/src/weights/pallet_elections_phragmen.rs b/runtime/polkadot/src/weights/pallet_elections.rs similarity index 68% rename from runtime/polkadot/src/weights/pallet_elections_phragmen.rs rename to runtime/polkadot/src/weights/pallet_elections.rs index 9acfa15d55ac..5b4658b54b4c 100644 --- a/runtime/polkadot/src/weights/pallet_elections_phragmen.rs +++ b/runtime/polkadot/src/weights/pallet_elections.rs @@ -13,25 +13,27 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -//! Autogenerated weights for `pallet_elections_phragmen` +//! Autogenerated weights for `pallet_elections` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-03-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// target/production/polkadot // benchmark // pallet -// --chain=polkadot-dev // --steps=50 // --repeat=20 -// --pallet=pallet_elections_phragmen // --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/polkadot/.git/.artifacts/bench.json +// --pallet=pallet_elections +// --chain=polkadot-dev // --header=./file_header.txt // --output=./runtime/polkadot/src/weights/ @@ -42,9 +44,9 @@ use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; -/// Weight functions for `pallet_elections_phragmen`. +/// Weight functions for `pallet_elections`. pub struct WeightInfo(PhantomData); -impl pallet_elections_phragmen::WeightInfo for WeightInfo { +impl pallet_elections::WeightInfo for WeightInfo { /// Storage: PhragmenElection Candidates (r:1 w:0) /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) /// Storage: PhragmenElection Members (r:1 w:0) @@ -55,17 +57,19 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `v` is `[1, 16]`. fn vote_equal(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `369 + v * (80 ±0)` - // Estimated: `14156 + v * (320 ±0)` - // Minimum execution time: 27_615_000 picoseconds. - Weight::from_parts(28_827_632, 0) - .saturating_add(Weight::from_parts(0, 14156)) - // Standard Error: 3_451 - .saturating_add(Weight::from_parts(107_080, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(5)) + // Estimated: `17670 + v * (320 ±0)` + // Minimum execution time: 31_083_000 picoseconds. + Weight::from_parts(32_337_960, 0) + .saturating_add(Weight::from_parts(0, 17670)) + // Standard Error: 4_880 + .saturating_add(Weight::from_parts(147_172, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) } @@ -79,17 +83,19 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `v` is `[2, 16]`. fn vote_more(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `337 + v * (80 ±0)` - // Estimated: `14028 + v * (320 ±0)` - // Minimum execution time: 37_710_000 picoseconds. - Weight::from_parts(38_651_629, 0) - .saturating_add(Weight::from_parts(0, 14028)) - // Standard Error: 4_935 - .saturating_add(Weight::from_parts(113_765, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(5)) + // Estimated: `17542 + v * (320 ±0)` + // Minimum execution time: 43_152_000 picoseconds. + Weight::from_parts(44_392_141, 0) + .saturating_add(Weight::from_parts(0, 17542)) + // Standard Error: 6_659 + .saturating_add(Weight::from_parts(102_623, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) } @@ -103,17 +109,19 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// The range of component `v` is `[2, 16]`. fn vote_less(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `369 + v * (80 ±0)` - // Estimated: `14156 + v * (320 ±0)` - // Minimum execution time: 37_662_000 picoseconds. - Weight::from_parts(38_662_833, 0) - .saturating_add(Weight::from_parts(0, 14156)) - // Standard Error: 8_944 - .saturating_add(Weight::from_parts(139_712, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(5)) + // Estimated: `17670 + v * (320 ±0)` + // Minimum execution time: 42_846_000 picoseconds. + Weight::from_parts(44_138_547, 0) + .saturating_add(Weight::from_parts(0, 17670)) + // Standard Error: 5_599 + .saturating_add(Weight::from_parts(137_337, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) } @@ -121,14 +129,16 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) /// Storage: Balances Locks (r:1 w:1) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) fn remove_voter() -> Weight { // Proof Size summary in bytes: // Measured: `891` - // Estimated: `9120` - // Minimum execution time: 33_356_000 picoseconds. - Weight::from_parts(33_639_000, 0) - .saturating_add(Weight::from_parts(0, 9120)) - .saturating_add(T::DbWeight::get().reads(2)) + // Estimated: `12634` + // Minimum execution time: 41_301_000 picoseconds. + Weight::from_parts(45_448_000, 0) + .saturating_add(Weight::from_parts(0, 12634)) + .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } /// Storage: PhragmenElection Candidates (r:1 w:1) @@ -142,11 +152,11 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `2358 + c * (48 ±0)` // Estimated: `11523 + c * (144 ±0)` - // Minimum execution time: 29_250_000 picoseconds. - Weight::from_parts(22_589_367, 0) + // Minimum execution time: 33_161_000 picoseconds. + Weight::from_parts(25_421_117, 0) .saturating_add(Weight::from_parts(0, 11523)) - // Standard Error: 847 - .saturating_add(Weight::from_parts(82_413, 0).saturating_mul(c.into())) + // Standard Error: 955 + .saturating_add(Weight::from_parts(87_141, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 144).saturating_mul(c.into())) @@ -158,11 +168,11 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `250 + c * (48 ±0)` // Estimated: `1722 + c * (48 ±0)` - // Minimum execution time: 25_177_000 picoseconds. - Weight::from_parts(18_210_201, 0) + // Minimum execution time: 29_244_000 picoseconds. + Weight::from_parts(21_012_035, 0) .saturating_add(Weight::from_parts(0, 1722)) - // Standard Error: 859 - .saturating_add(Weight::from_parts(58_205, 0).saturating_mul(c.into())) + // Standard Error: 997 + .saturating_add(Weight::from_parts(63_434, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 48).saturating_mul(c.into())) @@ -179,11 +189,11 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) fn renounce_candidacy_members() -> Weight { // Proof Size summary in bytes: - // Measured: `2565` - // Estimated: `18765` - // Minimum execution time: 42_428_000 picoseconds. - Weight::from_parts(42_849_000, 0) - .saturating_add(Weight::from_parts(0, 18765)) + // Measured: `2599` + // Estimated: `18935` + // Minimum execution time: 45_482_000 picoseconds. + Weight::from_parts(46_446_000, 0) + .saturating_add(Weight::from_parts(0, 18935)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) } @@ -193,8 +203,8 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `1711` // Estimated: `3196` - // Minimum execution time: 27_668_000 picoseconds. - Weight::from_parts(27_980_000, 0) + // Minimum execution time: 30_072_000 picoseconds. + Weight::from_parts(30_749_000, 0) .saturating_add(Weight::from_parts(0, 3196)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -223,11 +233,11 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) fn remove_member_with_replacement() -> Weight { // Proof Size summary in bytes: - // Measured: `2565` - // Estimated: `22358` - // Minimum execution time: 57_202_000 picoseconds. - Weight::from_parts(57_795_000, 0) - .saturating_add(Weight::from_parts(0, 22358)) + // Measured: `2599` + // Estimated: `22528` + // Minimum execution time: 62_095_000 picoseconds. + Weight::from_parts(62_831_000, 0) + .saturating_add(Weight::from_parts(0, 22528)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) } @@ -241,6 +251,8 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Balances Locks (r:10000 w:10000) /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:10000 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) /// Storage: System Account (r:10000 w:10000) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// The range of component `v` is `[5000, 10000]`. @@ -248,25 +260,46 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `36028 + v * (808 ±0)` - // Estimated: `155112 + v * (12084 ±0)` - // Minimum execution time: 319_698_615_000 picoseconds. - Weight::from_parts(320_299_987_000, 0) - .saturating_add(Weight::from_parts(0, 155112)) - // Standard Error: 274_596 - .saturating_add(Weight::from_parts(39_406_540, 0).saturating_mul(v.into())) + // Estimated: `156102 + v * (14608 ±0)` + // Minimum execution time: 358_390_607_000 picoseconds. + Weight::from_parts(360_218_670_000, 0) + .saturating_add(Weight::from_parts(0, 156102)) + // Standard Error: 302_192 + .saturating_add(Weight::from_parts(43_783_152, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(v.into()))) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) - .saturating_add(Weight::from_parts(0, 12084).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 14608).saturating_mul(v.into())) } - /// Storage: PhragmenElection Candidates (r:1 w:1) + /// Storage: PhragmenElection Candidates (r:1 w:0) /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PhragmenElection Members (r:1 w:1) + /// Storage: PhragmenElection Members (r:1 w:0) /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: PhragmenElection RunnersUp (r:1 w:1) + /// Storage: PhragmenElection RunnersUp (r:1 w:0) /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) /// Storage: PhragmenElection Voting (r:10001 w:0) /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) + /// The range of component `c` is `[1, 1000]`. + /// The range of component `v` is `[1, 10000]`. + /// The range of component `e` is `[10000, 160000]`. + fn pre_solve_election(_c: u32, v: u32, e: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + v * (592 ±0) + e * (28 ±0)` + // Estimated: `3129520 + v * (3893 ±4) + e * (62 ±0)` + // Minimum execution time: 3_789_611_000 picoseconds. + Weight::from_parts(3_833_347_000, 0) + .saturating_add(Weight::from_parts(0, 3129520)) + // Standard Error: 12_775 + .saturating_add(Weight::from_parts(4_259_276, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(296)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) + .saturating_add(Weight::from_parts(0, 3893).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 62).saturating_mul(e.into())) + } + /// Storage: PhragmenElection Members (r:1 w:1) + /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection RunnersUp (r:1 w:1) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Council Proposals (r:1 w:0) /// Proof Skipped: Council Proposals (max_values: Some(1), max_size: None, mode: Measured) /// Storage: System Account (r:967 w:967) @@ -277,27 +310,29 @@ impl pallet_elections_phragmen::WeightInfo for WeightIn /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) /// Storage: Council Prime (r:0 w:1) /// Proof Skipped: Council Prime (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Candidates (r:0 w:1) + /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) /// The range of component `c` is `[1, 1000]`. /// The range of component `v` is `[1, 10000]`. /// The range of component `e` is `[10000, 160000]`. - fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { + fn post_solve_election(c: u32, v: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + v * (607 ±0) + e * (28 ±0)` - // Estimated: `4855584 + c * (2560 ±0) + v * (5481 ±4) + e * (123 ±0)` - // Minimum execution time: 30_930_541_000 picoseconds. - Weight::from_parts(31_074_438_000, 0) - .saturating_add(Weight::from_parts(0, 4855584)) - // Standard Error: 416_181 - .saturating_add(Weight::from_parts(34_309_870, 0).saturating_mul(v.into())) - // Standard Error: 26_707 - .saturating_add(Weight::from_parts(1_798_568, 0).saturating_mul(e.into())) - .saturating_add(T::DbWeight::get().reads(269)) + // Measured: `0 + c * (254 ±0) + v * (16 ±0)` + // Estimated: `32696 + c * (3988 ±1) + v * (77 ±0)` + // Minimum execution time: 712_443_000 picoseconds. + Weight::from_parts(722_719_000, 0) + .saturating_add(Weight::from_parts(0, 32696)) + // Standard Error: 44_600 + .saturating_add(Weight::from_parts(26_159_277, 0).saturating_mul(c.into())) + // Standard Error: 4_459 + .saturating_add(Weight::from_parts(277_261, 0).saturating_mul(v.into())) + // Standard Error: 286 + .saturating_add(Weight::from_parts(5_031, 0).saturating_mul(e.into())) + .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) .saturating_add(T::DbWeight::get().writes(6)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 2560).saturating_mul(c.into())) - .saturating_add(Weight::from_parts(0, 5481).saturating_mul(v.into())) - .saturating_add(Weight::from_parts(0, 123).saturating_mul(e.into())) + .saturating_add(Weight::from_parts(0, 3988).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 77).saturating_mul(v.into())) } } diff --git a/runtime/rococo/Cargo.toml b/runtime/rococo/Cargo.toml index 3a10b27c4f35..80eea41e0a0a 100644 --- a/runtime/rococo/Cargo.toml +++ b/runtime/rococo/Cargo.toml @@ -46,7 +46,7 @@ pallet-transaction-payment = { git = "/~https://github.com/paritytech/substrate", pallet-transaction-payment-rpc-runtime-api = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-collective = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-democracy = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-elections-phragmen = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-elections = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-executive = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-grandpa = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-identity = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -75,6 +75,7 @@ pallet-utility = { git = "/~https://github.com/paritytech/substrate", branch = "ma pallet-vesting = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false } pallet-xcm-benchmarks = { path = "../../xcm/pallet-xcm-benchmarks", default-features = false, optional = true } +frame-election-provider-support = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-try-runtime = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } @@ -132,7 +133,7 @@ std = [ "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-collective/std", - "pallet-elections-phragmen/std", + "pallet-elections/std", "pallet-democracy/std", "pallet-nis/std", "pallet-grandpa/std", @@ -192,7 +193,7 @@ runtime-benchmarks = [ "pallet-child-bounties/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", - "pallet-elections-phragmen/runtime-benchmarks", + "pallet-elections/runtime-benchmarks", "pallet-nis/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-identity/runtime-benchmarks", @@ -231,7 +232,7 @@ try-runtime = [ "pallet-child-bounties/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-collective/try-runtime", - "pallet-elections-phragmen/try-runtime", + "pallet-elections/try-runtime", "pallet-democracy/try-runtime", "pallet-grandpa/try-runtime", "pallet-identity/try-runtime", diff --git a/runtime/rococo/src/lib.rs b/runtime/rococo/src/lib.rs index bc2e42d6ad3b..f65cfd43fb95 100644 --- a/runtime/rococo/src/lib.rs +++ b/runtime/rococo/src/lib.rs @@ -53,6 +53,7 @@ use beefy_primitives::{ mmr::{BeefyDataProvider, MmrLeafVersion}, }; +use frame_election_provider_support::{weights::SubstrateWeight, SequentialPhragmen}; use frame_support::{ construct_runtime, parameter_types, traits::{ @@ -468,13 +469,16 @@ parameter_types! { pub const MaxVoters: u32 = 10 * 1000; pub const MaxVotesPerVoter: u32 = 16; pub const MaxCandidates: u32 = 1000; - pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect"; + // The ElectionsPalletId parameter name was changed along with the renaming of the elections + // pallet, but we keep the same lock ID to prevent runtime migrations. Related to + // /~https://github.com/paritytech/substrate/issues/8250 + pub const ElectionsPalletId: LockIdentifier = *b"phrelect"; } // Make sure that there are no more than MaxMembers members elected via phragmen. const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); -impl pallet_elections_phragmen::Config for Runtime { +impl pallet_elections::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Currency = Balances; type ChangeMembers = Council; @@ -491,8 +495,10 @@ impl pallet_elections_phragmen::Config for Runtime { type MaxVoters = MaxVoters; type MaxVotesPerVoter = MaxVotesPerVoter; type MaxCandidates = MaxCandidates; - type PalletId = PhragmenElectionPalletId; - type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; + type PalletId = ElectionsPalletId; + type WeightInfo = weights::pallet_elections::WeightInfo; + type ElectionSolver = SequentialPhragmen; + type SolverWeightInfo = SubstrateWeight; } parameter_types! { @@ -1357,7 +1363,7 @@ construct_runtime! { Democracy: pallet_democracy::{Pallet, Call, Storage, Config, Event} = 13, Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 14, TechnicalCommittee: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 15, - PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 16, + PhragmenElection: pallet_elections::{Pallet, Call, Storage, Event, Config} = 16, TechnicalMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 17, Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 18, @@ -1552,7 +1558,7 @@ mod benches { [pallet_collective, Council] [pallet_collective, TechnicalCommittee] [pallet_democracy, Democracy] - [pallet_elections_phragmen, PhragmenElection] + [pallet_elections, PhragmenElection] [pallet_nis, Nis] [pallet_identity, Identity] [pallet_im_online, ImOnline] diff --git a/runtime/rococo/src/weights/mod.rs b/runtime/rococo/src/weights/mod.rs index 372d03722a22..57da4e340901 100644 --- a/runtime/rococo/src/weights/mod.rs +++ b/runtime/rococo/src/weights/mod.rs @@ -23,7 +23,7 @@ pub mod pallet_child_bounties; pub mod pallet_collective_council; pub mod pallet_collective_technical_committee; pub mod pallet_democracy; -pub mod pallet_elections_phragmen; +pub mod pallet_elections; pub mod pallet_identity; pub mod pallet_im_online; pub mod pallet_indices; diff --git a/runtime/rococo/src/weights/pallet_elections.rs b/runtime/rococo/src/weights/pallet_elections.rs new file mode 100644 index 000000000000..2a1a2df94f9e --- /dev/null +++ b/runtime/rococo/src/weights/pallet_elections.rs @@ -0,0 +1,338 @@ +// Copyright 2017-2022 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . +//! Autogenerated weights for `pallet_elections` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-03-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/polkadot/.git/.artifacts/bench.json +// --pallet=pallet_elections +// --chain=rococo-dev +// --header=./file_header.txt +// --output=./runtime/rococo/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_elections`. +pub struct WeightInfo(PhantomData); +impl pallet_elections::WeightInfo for WeightInfo { + /// Storage: PhragmenElection Candidates (r:1 w:0) + /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Members (r:1 w:0) + /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection RunnersUp (r:1 w:0) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Voting (r:1 w:1) + /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen) + /// The range of component `v` is `[1, 16]`. + fn vote_equal(v: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `331 + v * (80 ±0)` + // Estimated: `17534 + v * (320 ±0)` + // Minimum execution time: 31_113_000 picoseconds. + Weight::from_parts(32_676_612, 0) + .saturating_add(Weight::from_parts(0, 17534)) + // Standard Error: 4_222 + .saturating_add(Weight::from_parts(93_622, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) + } + /// Storage: PhragmenElection Candidates (r:1 w:0) + /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Members (r:1 w:0) + /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection RunnersUp (r:1 w:0) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Voting (r:1 w:1) + /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen) + /// The range of component `v` is `[2, 16]`. + fn vote_more(v: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `299 + v * (80 ±0)` + // Estimated: `17406 + v * (320 ±0)` + // Minimum execution time: 42_792_000 picoseconds. + Weight::from_parts(45_981_896, 0) + .saturating_add(Weight::from_parts(0, 17406)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) + } + /// Storage: PhragmenElection Candidates (r:1 w:0) + /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Members (r:1 w:0) + /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection RunnersUp (r:1 w:0) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Voting (r:1 w:1) + /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen) + /// The range of component `v` is `[2, 16]`. + fn vote_less(v: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `331 + v * (80 ±0)` + // Estimated: `17534 + v * (320 ±0)` + // Minimum execution time: 42_913_000 picoseconds. + Weight::from_parts(45_263_879, 0) + .saturating_add(Weight::from_parts(0, 17534)) + // Standard Error: 15_825 + .saturating_add(Weight::from_parts(38_938, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 320).saturating_mul(v.into())) + } + /// Storage: PhragmenElection Voting (r:1 w:1) + /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: Balances Locks (r:1 w:1) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:1 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen) + fn remove_voter() -> Weight { + // Proof Size summary in bytes: + // Measured: `853` + // Estimated: `12612` + // Minimum execution time: 39_933_000 picoseconds. + Weight::from_parts(40_716_000, 0) + .saturating_add(Weight::from_parts(0, 12612)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: PhragmenElection Candidates (r:1 w:1) + /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Members (r:1 w:0) + /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection RunnersUp (r:1 w:0) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) + /// The range of component `c` is `[1, 1000]`. + fn submit_candidacy(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2678 + c * (48 ±0)` + // Estimated: `12483 + c * (144 ±0)` + // Minimum execution time: 34_396_000 picoseconds. + Weight::from_parts(26_299_729, 0) + .saturating_add(Weight::from_parts(0, 12483)) + // Standard Error: 961 + .saturating_add(Weight::from_parts(87_195, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 144).saturating_mul(c.into())) + } + /// Storage: PhragmenElection Candidates (r:1 w:1) + /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) + /// The range of component `c` is `[1, 1000]`. + fn renounce_candidacy_candidate(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `250 + c * (48 ±0)` + // Estimated: `1722 + c * (48 ±0)` + // Minimum execution time: 29_170_000 picoseconds. + Weight::from_parts(21_453_975, 0) + .saturating_add(Weight::from_parts(0, 1722)) + // Standard Error: 992 + .saturating_add(Weight::from_parts(63_026, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 48).saturating_mul(c.into())) + } + /// Storage: PhragmenElection Members (r:1 w:1) + /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection RunnersUp (r:1 w:1) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Council Prime (r:1 w:1) + /// Proof Skipped: Council Prime (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Council Proposals (r:1 w:0) + /// Proof Skipped: Council Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Council Members (r:0 w:1) + /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) + fn renounce_candidacy_members() -> Weight { + // Proof Size summary in bytes: + // Measured: `2952` + // Estimated: `20700` + // Minimum execution time: 45_976_000 picoseconds. + Weight::from_parts(46_567_000, 0) + .saturating_add(Weight::from_parts(0, 20700)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: PhragmenElection RunnersUp (r:1 w:1) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) + fn renounce_candidacy_runners_up() -> Weight { + // Proof Size summary in bytes: + // Measured: `1647` + // Estimated: `3132` + // Minimum execution time: 30_565_000 picoseconds. + Weight::from_parts(30_825_000, 0) + .saturating_add(Weight::from_parts(0, 3132)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: Benchmark Override (r:0 w:0) + /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured) + fn remove_member_without_replacement() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_000_000_000_000 picoseconds. + Weight::from_parts(2_000_000_000_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// Storage: PhragmenElection Members (r:1 w:1) + /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: PhragmenElection RunnersUp (r:1 w:1) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Council Prime (r:1 w:1) + /// Proof Skipped: Council Prime (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Council Proposals (r:1 w:0) + /// Proof Skipped: Council Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Council Members (r:0 w:1) + /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) + fn remove_member_with_replacement() -> Weight { + // Proof Size summary in bytes: + // Measured: `2952` + // Estimated: `24293` + // Minimum execution time: 63_059_000 picoseconds. + Weight::from_parts(64_096_000, 0) + .saturating_add(Weight::from_parts(0, 24293)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: PhragmenElection Voting (r:10001 w:10000) + /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) + /// Storage: PhragmenElection Members (r:1 w:0) + /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection RunnersUp (r:1 w:0) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Candidates (r:1 w:0) + /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Balances Locks (r:10000 w:10000) + /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) + /// Storage: Balances Freezes (r:10000 w:0) + /// Proof: Balances Freezes (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen) + /// Storage: System Account (r:10000 w:10000) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `v` is `[5000, 10000]`. + /// The range of component `d` is `[0, 5000]`. + fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `35961 + v * (808 ±0)` + // Estimated: `155838 + v * (14624 ±0)` + // Minimum execution time: 358_048_367_000 picoseconds. + Weight::from_parts(359_250_617_000, 0) + .saturating_add(Weight::from_parts(0, 155838)) + // Standard Error: 302_601 + .saturating_add(Weight::from_parts(44_093_074, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) + .saturating_add(Weight::from_parts(0, 14624).saturating_mul(v.into())) + } + /// Storage: PhragmenElection Candidates (r:1 w:0) + /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Members (r:1 w:0) + /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection RunnersUp (r:1 w:0) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Voting (r:10001 w:0) + /// Proof Skipped: PhragmenElection Voting (max_values: None, max_size: None, mode: Measured) + /// The range of component `c` is `[1, 1000]`. + /// The range of component `v` is `[1, 10000]`. + /// The range of component `e` is `[10000, 160000]`. + fn pre_solve_election(_c: u32, v: u32, e: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + v * (592 ±0) + e * (28 ±0)` + // Estimated: `3129520 + v * (3893 ±4) + e * (62 ±0)` + // Minimum execution time: 3_847_424_000 picoseconds. + Weight::from_parts(3_917_180_000, 0) + .saturating_add(Weight::from_parts(0, 3129520)) + // Standard Error: 13_027 + .saturating_add(Weight::from_parts(4_348_756, 0).saturating_mul(v.into())) + // Standard Error: 836 + .saturating_add(Weight::from_parts(331, 0).saturating_mul(e.into())) + .saturating_add(T::DbWeight::get().reads(296)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) + .saturating_add(Weight::from_parts(0, 3893).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 62).saturating_mul(e.into())) + } + /// Storage: PhragmenElection Members (r:1 w:1) + /// Proof Skipped: PhragmenElection Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection RunnersUp (r:1 w:1) + /// Proof Skipped: PhragmenElection RunnersUp (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Council Proposals (r:1 w:0) + /// Proof Skipped: Council Proposals (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: System Account (r:962 w:962) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: PhragmenElection ElectionRounds (r:1 w:1) + /// Proof Skipped: PhragmenElection ElectionRounds (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Council Members (r:0 w:1) + /// Proof Skipped: Council Members (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Council Prime (r:0 w:1) + /// Proof Skipped: Council Prime (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PhragmenElection Candidates (r:0 w:1) + /// Proof Skipped: PhragmenElection Candidates (max_values: Some(1), max_size: None, mode: Measured) + /// The range of component `c` is `[1, 1000]`. + /// The range of component `v` is `[1, 10000]`. + /// The range of component `e` is `[10000, 160000]`. + fn post_solve_election(c: u32, v: u32, e: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + c * (255 ±0) + v * (16 ±0)` + // Estimated: `19912 + c * (3988 ±1) + v * (77 ±0)` + // Minimum execution time: 721_640_000 picoseconds. + Weight::from_parts(729_991_000, 0) + .saturating_add(Weight::from_parts(0, 19912)) + // Standard Error: 52_104 + .saturating_add(Weight::from_parts(25_678_617, 0).saturating_mul(c.into())) + // Standard Error: 5_209 + .saturating_add(Weight::from_parts(310_196, 0).saturating_mul(v.into())) + // Standard Error: 334 + .saturating_add(Weight::from_parts(7_668, 0).saturating_mul(e.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 3988).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 77).saturating_mul(v.into())) + } +} diff --git a/runtime/rococo/src/xcm_config.rs b/runtime/rococo/src/xcm_config.rs index de3bdfde4c0b..69c7366aa001 100644 --- a/runtime/rococo/src/xcm_config.rs +++ b/runtime/rococo/src/xcm_config.rs @@ -221,11 +221,11 @@ impl Contains for SafeCallFilter { pallet_collective::Call::close { .. }, ) | RuntimeCall::PhragmenElection( - pallet_elections_phragmen::Call::remove_voter { .. } | - pallet_elections_phragmen::Call::submit_candidacy { .. } | - pallet_elections_phragmen::Call::renounce_candidacy { .. } | - pallet_elections_phragmen::Call::remove_member { .. } | - pallet_elections_phragmen::Call::clean_defunct_voters { .. }, + pallet_elections::Call::remove_voter { .. } | + pallet_elections::Call::submit_candidacy { .. } | + pallet_elections::Call::renounce_candidacy { .. } | + pallet_elections::Call::remove_member { .. } | + pallet_elections::Call::clean_defunct_voters { .. }, ) | RuntimeCall::TechnicalMembership( pallet_membership::Call::add_member { .. } | diff --git a/runtime/westend/Cargo.toml b/runtime/westend/Cargo.toml index 4aa2f18067f6..4f00698183af 100644 --- a/runtime/westend/Cargo.toml +++ b/runtime/westend/Cargo.toml @@ -46,7 +46,7 @@ pallet-bags-list = { git = "/~https://github.com/paritytech/substrate", branch = " pallet-balances = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-collective = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-democracy = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } -pallet-elections-phragmen = { package = "pallet-elections-phragmen", git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } +pallet-elections = { package = "pallet-elections", git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-election-provider-multi-phase = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-fast-unstake = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-grandpa = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -81,7 +81,6 @@ pallet-xcm-benchmarks = { path = "../../xcm/pallet-xcm-benchmarks", default-feat frame-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-try-runtime = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-system-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -pallet-election-provider-support-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } pallet-nomination-pools-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } pallet-offences-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } pallet-session-benchmarking = { git = "/~https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } @@ -135,7 +134,7 @@ std = [ "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-collective/std", - "pallet-elections-phragmen/std", + "pallet-elections/std", "pallet-election-provider-multi-phase/std", "pallet-fast-unstake/std", "pallet-democracy/std", @@ -198,9 +197,8 @@ runtime-benchmarks = [ "pallet-balances/runtime-benchmarks", "pallet-collective/runtime-benchmarks", "pallet-democracy/runtime-benchmarks", - "pallet-elections-phragmen/runtime-benchmarks", + "pallet-elections/runtime-benchmarks", "pallet-election-provider-multi-phase/runtime-benchmarks", - "pallet-election-provider-support-benchmarking/runtime-benchmarks", "pallet-fast-unstake/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-identity/runtime-benchmarks", @@ -239,7 +237,7 @@ try-runtime = [ "pallet-balances/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-collective/try-runtime", - "pallet-elections-phragmen/try-runtime", + "pallet-elections/try-runtime", "pallet-election-provider-multi-phase/try-runtime", "pallet-fast-unstake/try-runtime", "pallet-democracy/try-runtime", diff --git a/runtime/westend/src/lib.rs b/runtime/westend/src/lib.rs index c4fcbc35e545..7f0ab5f014df 100644 --- a/runtime/westend/src/lib.rs +++ b/runtime/westend/src/lib.rs @@ -1730,7 +1730,7 @@ sp_api::impl_runtime_apis! { use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; - use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; + use frame_election_provider_support::benchmarking::Pallet as ElectionProviderBench; use frame_system_benchmarking::Pallet as SystemBench; use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; @@ -1755,13 +1755,13 @@ sp_api::impl_runtime_apis! { // To get around that, we separated the benchmarks into its own crate. use pallet_session_benchmarking::Pallet as SessionBench; use pallet_offences_benchmarking::Pallet as OffencesBench; - use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; + use frame_election_provider_support::benchmarking::Pallet as ElectionProviderBench; use frame_system_benchmarking::Pallet as SystemBench; use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; impl pallet_session_benchmarking::Config for Runtime {} impl pallet_offences_benchmarking::Config for Runtime {} - impl pallet_election_provider_support_benchmarking::Config for Runtime {} + impl frame_election_provider_support::benchmarking::Config for Runtime {} impl frame_system_benchmarking::Config for Runtime {} impl pallet_nomination_pools_benchmarking::Config for Runtime {} impl runtime_parachains::disputes::slashing::benchmarking::Config for Runtime {} diff --git a/runtime/westend/src/weights/frame_election_provider_support.rs b/runtime/westend/src/weights/frame_election_provider_support.rs index c7c78c2d2ec7..a9803ba9772a 100644 --- a/runtime/westend/src/weights/frame_election_provider_support.rs +++ b/runtime/westend/src/weights/frame_election_provider_support.rs @@ -22,16 +22,18 @@ //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// target/production/polkadot // benchmark // pallet -// --chain=westend-dev // --steps=50 // --repeat=20 -// --pallet=frame_election_provider_support // --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/polkadot/.git/.artifacts/bench.json +// --pallet=frame_election_provider_support +// --chain=westend-dev // --header=./file_header.txt // --output=./runtime/westend/src/weights/ @@ -75,4 +77,19 @@ impl frame_election_provider_support::WeightInfo for We // Standard Error: 15_177_501 .saturating_add(Weight::from_parts(1_768_408_399, 0).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_854_559 nanoseconds. + Weight::from_parts(1_899_414_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 34_895 + .saturating_add(Weight::from_parts(1_567_497, 0).saturating_mul(v.into())) + // Standard Error: 3_567_569 + .saturating_add(Weight::from_parts(231_049_436, 0).saturating_mul(d.into())) + } }