This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Refactors elections-phragmen pallet (companion for substrate#13453) #6278
Open
gpestana
wants to merge
45
commits into
master
Choose a base branch
from
gpestana8250_npossolver_companion
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
90a1f90
Renamed pallet elections_phragmen to elections; Adds required new typ…
gpestana 5588c3e
updates runtime pallet elections weights
gpestana b6baf7d
adds comments explaining why elections pallet param type was renamed …
gpestana 3544937
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana eefc12b
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana 324d524
merge conflict fixes and brings branch back to master
gpestana e2bd3ef
Renames PhragmenElection -> Elections
gpestana 3cb93d5
do not rename pallet
gpestana 492277d
Fixes tests weights
gpestana 72c7a15
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana fbdb213
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana 683f2a1
updates benchmarks
gpestana 69534d8
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana ee01b5d
fixes runtime benchmarks
gpestana 2aff06b
".git/.scripts/commands/bench/bench.sh" runtime kusama-dev frame_elec…
8037a5f
".git/.scripts/commands/bench/bench.sh" runtime polkadot-dev frame_el…
9a5be7c
reverts changes on weights.rs done manually
gpestana e92db6f
Merge branch 'gpestana8250_npossolver_companion' of github.com:parity…
gpestana 2263446
".git/.scripts/commands/bench/bench.sh" runtime westend-dev frame_ele…
8ee028e
Merge branch 'master' of https://github.com/paritytech/polkadot into …
ee8b989
".git/.scripts/commands/bench/bench.sh" runtime polkadot-dev pallet_e…
ffd2221
Fixes weights.rs and adds comment
gpestana 4642b1d
Merge branch 'gpestana8250_npossolver_companion' of github.com:parity…
gpestana e4d1e79
Merge remote-tracking branch 'origin/master' into gpestana8250_nposso…
bc6edc9
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana ef26039
update lockfile for {"substrate"}
fe5bd63
Fixes election limits for tests
gpestana 77108f9
Merge branch 'gpestana8250_npossolver_companion' of github.com:parity…
gpestana 9e1e7a1
fix test bounds for election
gpestana 26827bd
Reverts runtime election bounds for testing
gpestana 7d914d5
resets cargo.lock with master
gpestana f64c6df
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana 973f9cb
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana 2751cbb
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana aee97dd
fixes weights pallet elections
gpestana ca3e2d5
".git/.scripts/commands/bench/bench.sh" runtime rococo-dev pallet_ele…
fd64eec
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana 14a571e
fixes from merge commit
gpestana 086b2b6
Merge branch 'gpestana8250_npossolver_companion' of github.com:parity…
gpestana a0f0fee
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana 4f100c6
Adds missing NposSolver
gpestana bd51835
Moves NposSolver import under tests
gpestana 5cd574a
".git/.scripts/commands/bench/bench.sh" runtime polkadot-dev pallet_e…
31b78a8
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana 6afac5f
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 <http://www.gnu.org/licenses/>. | ||
| //! 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<T>(PhantomData<T>); | ||
| impl<T: frame_system::Config> pallet_elections::WeightInfo for WeightInfo<T> { | ||
| // 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))) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.