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

CS-V2Gov-051: Rounding Error on Offset Calculation #111

Open
danielattilasimon opened this issue Dec 25, 2024 · 0 comments · May be fixed by #112
Open

CS-V2Gov-051: Rounding Error on Offset Calculation #111

danielattilasimon opened this issue Dec 25, 2024 · 0 comments · May be fixed by #112

Comments

@danielattilasimon
Copy link
Contributor

Users can allocate their voting power to different initiatives. For each allocation two values are stored: allocated LQTY and the user's offset. Function allocateLQTY() rounds down when computing the offset that should be added to an initiative:

for (/* ... */) {
    absoluteOffsetVotes[x] =
        _absoluteLQTYVotes[x] * int256(userState.unallocatedOffset) / int256(userState.unallocatedLQTY);
    absoluteOffsetVetos[x] =
        _absoluteLQTYVetos[x] * int256(userState.unallocatedOffset) / int256(userState.unallocatedLQTY);
}

This means that, in particular, when the user allocates all of his LQTY to many initiatives, he could be left with 0 unallocatedLQTY and non-zero unallocatedOffset.

The rounding error is accounted in favor of an initiative if user allocates YES votes (against initiative if user allocates NO votes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant