Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Refactors elections-phragmen pallet (companion for substrate#13453) #6278

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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 Nov 13, 2022
5588c3e
updates runtime pallet elections weights
gpestana Nov 17, 2022
b6baf7d
adds comments explaining why elections pallet param type was renamed …
gpestana Nov 20, 2022
3544937
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Dec 8, 2022
eefc12b
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Feb 17, 2023
324d524
merge conflict fixes and brings branch back to master
gpestana Feb 17, 2023
e2bd3ef
Renames PhragmenElection -> Elections
gpestana Feb 20, 2023
3cb93d5
do not rename pallet
gpestana Feb 20, 2023
492277d
Fixes tests weights
gpestana Feb 20, 2023
72c7a15
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Feb 20, 2023
fbdb213
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Feb 22, 2023
683f2a1
updates benchmarks
gpestana Feb 22, 2023
69534d8
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Feb 22, 2023
ee01b5d
fixes runtime benchmarks
gpestana Feb 22, 2023
2aff06b
".git/.scripts/commands/bench/bench.sh" runtime kusama-dev frame_elec…
Feb 22, 2023
8037a5f
".git/.scripts/commands/bench/bench.sh" runtime polkadot-dev frame_el…
Feb 22, 2023
9a5be7c
reverts changes on weights.rs done manually
gpestana Feb 22, 2023
e92db6f
Merge branch 'gpestana8250_npossolver_companion' of github.com:parity…
gpestana Feb 22, 2023
2263446
".git/.scripts/commands/bench/bench.sh" runtime westend-dev frame_ele…
Feb 22, 2023
8ee028e
Merge branch 'master' of https://github.com/paritytech/polkadot into …
Feb 23, 2023
ee8b989
".git/.scripts/commands/bench/bench.sh" runtime polkadot-dev pallet_e…
Feb 23, 2023
ffd2221
Fixes weights.rs and adds comment
gpestana Feb 23, 2023
4642b1d
Merge branch 'gpestana8250_npossolver_companion' of github.com:parity…
gpestana Feb 23, 2023
e4d1e79
Merge remote-tracking branch 'origin/master' into gpestana8250_nposso…
Feb 23, 2023
bc6edc9
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Feb 23, 2023
ef26039
update lockfile for {"substrate"}
Feb 23, 2023
fe5bd63
Fixes election limits for tests
gpestana Feb 23, 2023
77108f9
Merge branch 'gpestana8250_npossolver_companion' of github.com:parity…
gpestana Feb 23, 2023
9e1e7a1
fix test bounds for election
gpestana Feb 23, 2023
26827bd
Reverts runtime election bounds for testing
gpestana Feb 28, 2023
7d914d5
resets cargo.lock with master
gpestana Feb 28, 2023
f64c6df
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Feb 28, 2023
973f9cb
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Mar 20, 2023
2751cbb
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Mar 21, 2023
aee97dd
fixes weights pallet elections
gpestana Mar 21, 2023
ca3e2d5
".git/.scripts/commands/bench/bench.sh" runtime rococo-dev pallet_ele…
Mar 21, 2023
fd64eec
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Mar 22, 2023
14a571e
fixes from merge commit
gpestana Mar 22, 2023
086b2b6
Merge branch 'gpestana8250_npossolver_companion' of github.com:parity…
gpestana Mar 22, 2023
a0f0fee
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Mar 24, 2023
4f100c6
Adds missing NposSolver
gpestana Mar 24, 2023
bd51835
Moves NposSolver import under tests
gpestana Mar 24, 2023
5cd574a
".git/.scripts/commands/bench/bench.sh" runtime polkadot-dev pallet_e…
Mar 24, 2023
31b78a8
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana Mar 31, 2023
6afac5f
Merge branch 'master' into gpestana8250_npossolver_companion
gpestana May 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions node/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene
slash_reward_fraction: Perbill::from_percent(10),
..Default::default()
},
phragmen_election: Default::default(),
elections: Default::default(),
democracy: Default::default(),
council: polkadot::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: polkadot::TechnicalCommitteeConfig {
Expand Down Expand Up @@ -745,7 +745,7 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC
slash_reward_fraction: Perbill::from_percent(10),
..Default::default()
},
phragmen_election: Default::default(),
elections: Default::default(),
democracy: Default::default(),
council: kusama::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: kusama::TechnicalCommitteeConfig {
Expand Down Expand Up @@ -1049,7 +1049,7 @@ fn rococo_staging_testnet_config_genesis(wasm_binary: &[u8]) -> rococo_runtime::
})
.collect::<Vec<_>>(),
},
phragmen_election: Default::default(),
elections: Default::default(),
babe: rococo_runtime::BabeConfig {
authorities: Default::default(),
epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG),
Expand Down Expand Up @@ -1357,7 +1357,7 @@ pub fn polkadot_testnet_genesis(
slash_reward_fraction: Perbill::from_percent(10),
..Default::default()
},
phragmen_election: Default::default(),
elections: Default::default(),
democracy: polkadot::DemocracyConfig::default(),
council: polkadot::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: polkadot::TechnicalCommitteeConfig {
Expand Down Expand Up @@ -1444,7 +1444,7 @@ pub fn kusama_testnet_genesis(
slash_reward_fraction: Perbill::from_percent(10),
..Default::default()
},
phragmen_election: Default::default(),
elections: Default::default(),
democracy: kusama::DemocracyConfig::default(),
council: kusama::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: kusama::TechnicalCommitteeConfig {
Expand Down Expand Up @@ -1609,7 +1609,7 @@ pub fn rococo_testnet_genesis(
},
grandpa: Default::default(),
im_online: Default::default(),
phragmen_election: Default::default(),
elections: Default::default(),
democracy: rococo::DemocracyConfig::default(),
council: rococo::CouncilConfig { members: vec![], phantom: Default::default() },
technical_committee: rococo::TechnicalCommitteeConfig {
Expand Down
8 changes: 4 additions & 4 deletions runtime/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -146,7 +146,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",
Expand Down Expand Up @@ -212,7 +212,7 @@ 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",
Expand Down Expand Up @@ -263,7 +263,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",
Expand Down
14 changes: 10 additions & 4 deletions runtime/kusama/src/governance/old.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! Old governance configurations for the Kusama runtime.

use crate::*;
use frame_election_provider_support::{weights::SubstrateWeight, SequentialPhragmen};
use frame_support::{parameter_types, traits::EitherOfDiverse};

parameter_types! {
Expand Down Expand Up @@ -114,13 +115,16 @@ parameter_types! {
pub const DesiredRunnersUp: u32 = 19;
pub const MaxVoters: u32 = 10 * 1000;
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;
Expand All @@ -136,8 +140,10 @@ impl pallet_elections_phragmen::Config for Runtime {
type TermDuration = TermDuration;
type MaxVoters = MaxVoters;
type MaxCandidates = MaxCandidates;
type PalletId = PhragmenElectionPalletId;
type WeightInfo = weights::pallet_elections_phragmen::WeightInfo<Runtime>;
type PalletId = ElectionsPalletId;
type WeightInfo = weights::pallet_elections::WeightInfo<Runtime>;
type ElectionSolver = SequentialPhragmen<Self::AccountId, Perbill>;
type SolverWeightInfo = SubstrateWeight<Self>;
}

parameter_types! {
Expand Down
10 changes: 5 additions & 5 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ impl pallet_child_bounties::Config for Runtime {
impl pallet_tips::Config for Runtime {
type MaximumReasonLength = MaximumReasonLength;
type DataDepositPerByte = DataDepositPerByte;
type Tippers = PhragmenElection;
type Tippers = Elections;
type TipCountdown = TipCountdown;
type TipFindersFee = TipFindersFee;
type TipReportDepositBase = TipReportDepositBase;
Expand Down Expand Up @@ -1001,7 +1001,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
RuntimeCall::Democracy(..) |
RuntimeCall::Council(..) |
RuntimeCall::TechnicalCommittee(..) |
RuntimeCall::PhragmenElection(..) |
RuntimeCall::Elections(..) |
RuntimeCall::TechnicalMembership(..) |
RuntimeCall::Treasury(..) |
RuntimeCall::Bounties(..) |
Expand Down Expand Up @@ -1045,7 +1045,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
c,
RuntimeCall::Democracy(..) |
RuntimeCall::Council(..) | RuntimeCall::TechnicalCommittee(..) |
RuntimeCall::PhragmenElection(..) |
RuntimeCall::Elections(..) |
RuntimeCall::Treasury(..) |
RuntimeCall::Bounties(..) |
RuntimeCall::Tips(..) | RuntimeCall::Utility(..) |
Expand Down Expand Up @@ -1355,7 +1355,7 @@ construct_runtime! {
Democracy: pallet_democracy::{Pallet, Call, Storage, Config<T>, Event<T>} = 13,
Council: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 14,
TechnicalCommittee: pallet_collective::<Instance2>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 15,
PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event<T>, Config<T>} = 16,
Elections: pallet_elections::{Pallet, Call, Storage, Event<T>, Config<T>} = 16,
TechnicalMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 17,
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 18,

Expand Down Expand Up @@ -1539,7 +1539,7 @@ mod benches {
[pallet_collective, TechnicalCommittee]
[pallet_conviction_voting, ConvictionVoting]
[pallet_democracy, Democracy]
[pallet_elections_phragmen, PhragmenElection]
[pallet_elections, Elections]
[pallet_election_provider_multi_phase, ElectionProviderMultiPhase]
[frame_election_provider_support, ElectionProviderBench::<Runtime>]
[pallet_fast_unstake, FastUnstake]
Expand Down
2 changes: 1 addition & 1 deletion runtime/kusama/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

gpestana marked this conversation as resolved.
Show resolved Hide resolved
// 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: `[]`
Expand All @@ -27,7 +27,7 @@
// --chain=kusama-dev
// --steps=50
// --repeat=20
// --pallet=pallet_elections_phragmen
// --pallet=pallet_elections
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like a breaking change is happening with storage keys

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was edited manually, I am working on re-generating all the weights.rs with the ci bot. After that, the comments should be fixed Currently, the weights in this PR are not correct, everything else should be ready.

// 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]`.
Expand All @@ -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)))
}
Expand Down
Loading