-
Notifications
You must be signed in to change notification settings - Fork 2.6k
make MAX_VOTERS and MAX_CANDIDATES in elections-phragmen configurable. Fix: #11092 #11908
make MAX_VOTERS and MAX_CANDIDATES in elections-phragmen configurable. Fix: #11092 #11908
Conversation
User @sudipghimire533, please sign the CLA here. |
frame/elections-phragmen/src/lib.rs
Outdated
@@ -395,9 +392,10 @@ pub mod pallet { | |||
) -> DispatchResultWithPostInfo { | |||
let who = ensure_signed(origin)?; | |||
|
|||
let max_candidate = <T as Config>::MaxCandidates::get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let max_candidate = <T as Config>::MaxCandidates::get(); |
frame/elections-phragmen/src/lib.rs
Outdated
let actual_count = <Candidates<T>>::decode_len().unwrap_or(0) as u32; | ||
ensure!(actual_count <= candidate_count, Error::<T>::InvalidWitnessData); | ||
ensure!(actual_count <= MAX_CANDIDATES, Error::<T>::TooManyCandidates); | ||
ensure!(actual_count <= max_candidate, Error::<T>::TooManyCandidates); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure!(actual_count <= max_candidate, Error::<T>::TooManyCandidates); | |
ensure!(actual_count <= <T as Config>::MaxCandidates::get(), Error::<T>::TooManyCandidates); |
Looks mostly good, need to make companions. |
Polkadot companion: paritytech/polkadot#5815 |
@sudipghimire533 Note that you have to update the |
@Szegoo maybe you can help me here:
|
I think you need to wrap it in a parenthesis: substrate/frame/staking/src/benchmarking.rs Line 815 in 54d6f2c
|
Not working same error and neither can I assign it as variable and re-use. @kianenigma do you think you can help me with benchmarking.rs ? |
I have run into the same issue when working on this, the suggested solution from @kianenigma should work. Could you give me access to your branch, so maybe I manage to get it working? |
@Szegoo I have invited you to my fork. Also I tried adding |
Ahh you guys meant to only wrap the
|
frame/elections-phragmen/src/lib.rs
Outdated
@@ -397,7 +394,7 @@ pub mod pallet { | |||
|
|||
let actual_count = <Candidates<T>>::decode_len().unwrap_or(0) as u32; | |||
ensure!(actual_count <= candidate_count, Error::<T>::InvalidWitnessData); | |||
ensure!(actual_count <= MAX_CANDIDATES, Error::<T>::TooManyCandidates); | |||
ensure!(actual_count <= <T as Config>::MaxCandidates::get(), Error::<T>::TooManyCandidates); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure!(actual_count <= <T as Config>::MaxCandidates::get(), Error::<T>::TooManyCandidates); | |
ensure!(actual_count <= T::MaxCandidates::get(), Error::<T>::TooManyCandidates); |
/cmd queue -c bench-bot $ pallet dev pallet_elections_phragmen |
@ggwpez https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/1726285 was started for your command Comment |
@ggwpez Command |
bot rebase |
Rebased |
bot merge |
https://github.com/sudipghimire533 @Szegoo can you both paste your Polkadot address for a tip here? |
I can't edit the PR description, should I provide it somehow else? |
If it need to be in PR description you can put it here and I will put in the Description |
Mine is: 1FNfKQFHFLp2Fin8Xqz1KhtZ5nVr4RqCM4Z5SGtv6QctCA9 |
Polkadot address: 126X27SbhrV19mBFawys3ovkyBS87SGfYwtwa8J2FjHrtbmA |
/tip small |
@kianenigma A small tip was successfully submitted for sudipghimire533 (1FNfKQFHFLp2Fin8Xqz1KhtZ5nVr4RqCM4Z5SGtv6QctCA9 on polkadot). https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.polkadot.io#/treasury/tips |
/tip small |
@kianenigma A small tip was successfully submitted for sudipghimire533 (126X27SbhrV19mBFawys3ovkyBS87SGfYwtwa8J2FjHrtbmA on polkadot). https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.polkadot.io#/treasury/tips |
It doesn't seem like this worked, only the first tip was submitted if I am not mistaken. |
On my address as well there we no balance whatsoever. Maybe because mine was freshly created address and it didn't even had existential deposit |
Yours was submitted successfully, you can check it on https://www.dotreasury.com/dot/tips |
That is because no one has yet declared a tip value, you can check how this works in the |
Is that something I need to do or parity team? |
You don't have to do anything, you need to wait for the tippers to declare the tip value. |
…Fix: paritytech#11092 (paritytech#11908) * make MAX_VOTERS and MAX_CANDIDATES in elections-phragmen configurable * Configure election-phragmen in node bin configuring max candidates & voters * Add document comment for added Config parameter * Incorporate suggestion * fix benchmarks * Update frame/elections-phragmen/src/lib.rs * Update frame/elections-phragmen/src/lib.rs * fix wrong values * fix typo * docs * more detailed docs * fmt * ".git/.scripts/bench-bot.sh" pallet dev pallet_elections_phragmen Co-authored-by: Szegoo <sakacszergej@gmail.com> Co-authored-by: Sergej Sakac <73715684+Szegoo@users.noreply.github.com> Co-authored-by: command-bot <>
Closes: #11902
Polkadot companion: paritytech/polkadot#5815
Update
max_voters
&max_candidates
to be configurable fromConfig
trait ofpallet_elections_phragmen
1000
(formax_candidates
) &10_000
(formax_voters
) while creating runtime from/bin/node/runtime
. Value taken as was in PR prep council election pallet for being dissolved #11790Polkadot address: 126X27SbhrV19mBFawys3ovkyBS87SGfYwtwa8J2FjHrtbmA