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

Use free balance rather than total balance for elections phragmen #10646

Merged
merged 2 commits into from
Jan 14, 2022

Conversation

shawntabrizi
Copy link
Member

When looking at the maximum value a user can vote in Phragmen Elections, we should use the free_balance rather than the total_balance, else the pallet can create locks larger than the user has available balance, and will be in constant debt to the lock even when transferring more funds.

This update ensures we only allow voting up to the free_balance of the user, after any reserves have been placed for voting in the first place.

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Jan 12, 2022
@shawntabrizi shawntabrizi added B7-runtimenoteworthy C1-low PR touches the given topic and has a low impact on builders. D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Jan 13, 2022
@emostov
Copy link
Contributor

emostov commented Jan 13, 2022

#10649 targets this branch and adds a complementary migration. paritytech/polkadot#4710 applies the aforementioned migration to Polkadot and Kusama.

Copy link
Contributor

@emostov emostov left a comment

Choose a reason for hiding this comment

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

ty for doing this so fast

@shawntabrizi
Copy link
Member Author

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 961666a into master Jan 14, 2022
@paritytech-processbot paritytech-processbot bot deleted the shawntabrizi-phragmen-free-balance branch January 14, 2022 01:43
bernardo-xxnet pushed a commit to xx-labs/substrate that referenced this pull request Jan 15, 2022
…ritytech#10646)

* use free balance rather than total balance

* Docs

Co-authored-by: emostov <32168567+emostov@users.noreply.github.com>
@viniul viniul added D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited and removed D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Jan 25, 2022
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
…ritytech#10646)

* use free balance rather than total balance

* Docs

Co-authored-by: emostov <32168567+emostov@users.noreply.github.com>
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
…ritytech#10646)

* use free balance rather than total balance

* Docs

Co-authored-by: emostov <32168567+emostov@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders. D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants