Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy CurrencyToVote in staking #4725

Open
gpestana opened this issue Jun 7, 2024 · 1 comment
Open

Remove legacy CurrencyToVote in staking #4725

gpestana opened this issue Jun 7, 2024 · 1 comment
Labels
D1-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. T2-pallets This PR/Issue is related to a particular pallet.

Comments

@gpestana
Copy link
Contributor

gpestana commented Jun 7, 2024

Remove the need for the CurrencyToVote converter type in the pallet-staking. This type converts coverts from BalanceOf<T> to a u64 "vote" type, and from a u128 (i.e. ExtendedBalance) back to BalanceOf<T>. In both conversion directions, the total issuance of the system must be provided.

The main reason for this conversion is that the current phragmen implementation does not correctly support types u128 as the main type. Thus, the conversion between balance (u128) and the supported "vote" u64 type.

Relying on the current issuance will be a problem with the staking parachain (let's assume that the staking runtime is not deployed in AH). In addition, it removing the need for this conversion will simplify and make it cheaper to run the stake-tracker and the associated list updates.

Solution should be getting rid of the need for CurrencyToVote adapter by ensuring all election algorithms can work with a Into<u128> score type.

@gpestana gpestana added T2-pallets This PR/Issue is related to a particular pallet. D1-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. labels Jun 7, 2024
@dharjeezy
Copy link
Contributor

I noticed in the description for CurrencyToVote, the to_vote function returns a u64 instead of a u128. How will this suffice in this case since we care about using a u128? @gpestana

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D1-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

No branches or pull requests

2 participants