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 4 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
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 |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |
|
|
||
| // 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` | ||
| //! Autogenerated weights for `pallet_elections` | ||
| //! | ||
| //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev | ||
| //! DATE: 2022-11-16, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` | ||
|
|
@@ -27,7 +27,7 @@ | |
| // --chain=kusama-dev | ||
| // --steps=50 | ||
| // --repeat=20 | ||
| // --pallet=pallet_elections_phragmen | ||
| // --pallet=pallet_elections | ||
| // --extrinsic=* | ||
| // --execution=wasm | ||
| // --wasm-execution=compiled | ||
|
|
@@ -41,13 +41,13 @@ | |
| 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<T>(PhantomData<T>); | ||
| impl<T: frame_system::Config> pallet_elections_phragmen::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) | ||
| impl<T: frame_system::Config> pallet_elections::WeightInfo for WeightInfo<T> { | ||
| // Storage: Elections Candidates (r:1 w:0) | ||
| // Storage: Elections Members (r:1 w:0) | ||
| // Storage: Elections RunnersUp (r:1 w:0) | ||
| // Storage: Elections 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 { | ||
|
|
@@ -58,10 +58,10 @@ impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightIn | |
| .saturating_add(T::DbWeight::get().reads(5 as u64)) | ||
| .saturating_add(T::DbWeight::get().writes(2 as u64)) | ||
| } | ||
| // 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: Elections Candidates (r:1 w:0) | ||
| // Storage: Elections Members (r:1 w:0) | ||
| // Storage: Elections RunnersUp (r:1 w:0) | ||
| // Storage: Elections 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 { | ||
|
|
@@ -72,10 +72,10 @@ impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightIn | |
| .saturating_add(T::DbWeight::get().reads(5 as u64)) | ||
| .saturating_add(T::DbWeight::get().writes(2 as u64)) | ||
| } | ||
| // 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: Elections Candidates (r:1 w:0) | ||
| // Storage: Elections Members (r:1 w:0) | ||
| // Storage: Elections RunnersUp (r:1 w:0) | ||
| // Storage: Elections 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 { | ||
|
|
@@ -86,17 +86,17 @@ impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightIn | |
| .saturating_add(T::DbWeight::get().reads(5 as u64)) | ||
| .saturating_add(T::DbWeight::get().writes(2 as u64)) | ||
| } | ||
| // Storage: PhragmenElection Voting (r:1 w:1) | ||
| // Storage: Elections Voting (r:1 w:1) | ||
| // Storage: Balances Locks (r:1 w:1) | ||
| fn remove_voter() -> Weight { | ||
| // Minimum execution time: 40_370 nanoseconds. | ||
| Weight::from_ref_time(41_142_000 as u64) | ||
| .saturating_add(T::DbWeight::get().reads(2 as u64)) | ||
| .saturating_add(T::DbWeight::get().writes(2 as u64)) | ||
| } | ||
| // Storage: PhragmenElection Candidates (r:1 w:1) | ||
| // Storage: PhragmenElection Members (r:1 w:0) | ||
| // Storage: PhragmenElection RunnersUp (r:1 w:0) | ||
| // Storage: Elections Candidates (r:1 w:1) | ||
| // Storage: Elections Members (r:1 w:0) | ||
| // Storage: Elections RunnersUp (r:1 w:0) | ||
| /// The range of component `c` is `[1, 1000]`. | ||
| fn submit_candidacy(c: u32, ) -> Weight { | ||
| // Minimum execution time: 37_086 nanoseconds. | ||
|
|
@@ -106,7 +106,8 @@ impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightIn | |
| .saturating_add(T::DbWeight::get().reads(3 as u64)) | ||
| .saturating_add(T::DbWeight::get().writes(1 as u64)) | ||
| } | ||
| // Storage: PhragmenElection Candidates (r:1 w:1) | ||
| // Storage: Elections Candidates (r:1 w:1) | ||
|
|
||
| /// The range of component `c` is `[1, 1000]`. | ||
| fn renounce_candidacy_candidate(c: u32, ) -> Weight { | ||
| // Minimum execution time: 32_127 nanoseconds. | ||
|
|
@@ -116,8 +117,8 @@ impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightIn | |
| .saturating_add(T::DbWeight::get().reads(1 as u64)) | ||
| .saturating_add(T::DbWeight::get().writes(1 as u64)) | ||
| } | ||
| // Storage: PhragmenElection Members (r:1 w:1) | ||
| // Storage: PhragmenElection RunnersUp (r:1 w:1) | ||
| // Storage: Elections Members (r:1 w:1) | ||
| // Storage: Elections 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) | ||
|
|
@@ -127,7 +128,7 @@ impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightIn | |
| .saturating_add(T::DbWeight::get().reads(4 as u64)) | ||
| .saturating_add(T::DbWeight::get().writes(4 as u64)) | ||
| } | ||
| // Storage: PhragmenElection RunnersUp (r:1 w:1) | ||
| // Storage: Elections RunnersUp (r:1 w:1) | ||
| fn renounce_candidacy_runners_up() -> Weight { | ||
| // Minimum execution time: 34_904 nanoseconds. | ||
| Weight::from_ref_time(36_139_000 as u64) | ||
|
|
@@ -139,9 +140,9 @@ impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightIn | |
| // Minimum execution time: 2_000_000_000 nanoseconds. | ||
| Weight::from_ref_time(2_000_000_000_000 as u64) | ||
| } | ||
| // Storage: PhragmenElection Members (r:1 w:1) | ||
| // Storage: Elections Members (r:1 w:1) | ||
| // Storage: System Account (r:1 w:1) | ||
| // Storage: PhragmenElection RunnersUp (r:1 w:1) | ||
| // Storage: Elections 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) | ||
|
|
@@ -151,10 +152,10 @@ impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightIn | |
| .saturating_add(T::DbWeight::get().reads(5 as u64)) | ||
| .saturating_add(T::DbWeight::get().writes(5 as u64)) | ||
| } | ||
| // 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: Elections Voting (r:5001 w:5000) | ||
| // Storage: Elections Members (r:1 w:0) | ||
| // Storage: Elections RunnersUp (r:1 w:0) | ||
|
||
| // Storage: Elections 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]`. | ||
|
|
@@ -168,28 +169,45 @@ impl<T: frame_system::Config> pallet_elections_phragmen::WeightInfo for WeightIn | |
| .saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(v as u64))) | ||
| .saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(v as u64))) | ||
| } | ||
| // Storage: PhragmenElection Candidates (r:1 w:1) | ||
| // Storage: PhragmenElection Members (r:1 w:1) | ||
| // Storage: PhragmenElection RunnersUp (r:1 w:1) | ||
| // Storage: PhragmenElection Voting (r:10001 w:0) | ||
| // Storage: Elections Candidates (r:1 w:0) | ||
| // Storage: Elections Members (r:1 w:0) | ||
| // Storage: Elections RunnersUp (r:1 w:0) | ||
| // Storage: Elections 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: Elections Members (r:1 w:1) | ||
| // Storage: Elections RunnersUp (r:1 w:1) | ||
| // Storage: Council Proposals (r:1 w:0) | ||
| // Storage: PhragmenElection ElectionRounds (r:1 w:1) | ||
| // Storage: Elections ElectionRounds (r:1 w:1) | ||
| // Storage: Elections Candidates (r:0 w:1) | ||
| // Storage: Council Members (r:0 w:1) | ||
| // Storage: Council Prime (r:0 w:1) | ||
| // Storage: System Account (r:3 w:3) | ||
| // 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 election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { | ||
| // Minimum execution time: 29_009_063 nanoseconds. | ||
| Weight::from_ref_time(29_156_039_000 as u64) | ||
| // Standard Error: 553_255 | ||
| .saturating_add(Weight::from_ref_time(46_221_121 as u64).saturating_mul(v as u64)) | ||
| // Standard Error: 35_504 | ||
| .saturating_add(Weight::from_ref_time(2_367_682 as u64).saturating_mul(e as u64)) | ||
| .saturating_add(T::DbWeight::get().reads(265 as u64)) | ||
| 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().reads((1 as u64).saturating_mul(v 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))) | ||
| } | ||
|
|
||
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.