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

distribution/AllocateTokens - inefficient computation of rewards #13520

Closed
mpoke opened this issue Oct 12, 2022 · 0 comments · Fixed by #13524
Closed

distribution/AllocateTokens - inefficient computation of rewards #13520

mpoke opened this issue Oct 12, 2022 · 0 comments · Fixed by #13524
Assignees
Labels
C:x/distribution distribution module related T: Performance Performance improvements

Comments

@mpoke
Copy link

mpoke commented Oct 12, 2022

Summary of Bug

Not really a bug, more of an oversight that affects performance.

In the AllocateTokens method of the distribution module the voteMultiplier is applied to the reward of every validator, see

reward := feesCollected.MulDecTruncate(voteMultiplier).MulDecTruncate(powerFraction)

This could be done once outside of the iteration for the entire feesCollected.

Version

c308e1f

Steps to Reproduce

NA

@mpoke mpoke added C:x/distribution distribution module related T: Performance Performance improvements labels Oct 12, 2022
@alexanderbez alexanderbez self-assigned this Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/distribution distribution module related T: Performance Performance improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants