-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Make clearer that the distribution iterates over all active validators #8866
Make clearer that the distribution iterates over all active validators #8866
Conversation
…s, not just ones that voted
7dee93d
to
fb772ae
Compare
I don't think there is a bug at least, since req.LastCommitInfo.GetVotes() is all validators, see: I think this could be improved by changing the naming of this, and making it not be called |
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Thanks @ValarDragon for checking this. We suspected that there wasn't a bug, but it's nice to get that verified. Do you know if this is tested with a unit test somewhere? That |
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.
Please move the argument doc comment to the function doc comment. Also left a suggestion to use more concise name.
x/distribution/keeper/allocation.go
Outdated
@@ -13,7 +13,7 @@ import ( | |||
// AllocateTokens handles distribution of the collected fees | |||
func (k Keeper) AllocateTokens( | |||
ctx sdk.Context, sumPreviousPrecommitPower, totalPreviousPower int64, | |||
previousProposer sdk.ConsAddress, previousVotes []abci.VoteInfo, | |||
previousProposer sdk.ConsAddress, bondedValidatorsVoteInfo []abci.VoteInfo, |
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.
previousProposer sdk.ConsAddress, bondedValidatorsVoteInfo []abci.VoteInfo, | |
previousProposer sdk.ConsAddress, bondedVotes []abci.VoteInfo, |
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.
if we don't prefer concise names and we don't need to repeat a type name in the variable name.
Maybe it would be good to add a test? |
This pull request introduces 4 alerts when merging 41f7693 into deaee53 - view on LGTM.com new alerts:
|
Looks lite the function |
OK, could you check on Tendermint sit and create issue there if needed? |
Benchmark finished. See the result: https://github.orijtech.com/benchmark/result?id=ce9041e3f14e43ebaf8890b487970de4 |
Description
We found that the current distribution code for distributing to all bonded validators wasn't perfectly clear, and it confused both me and @sunnya97. Here's a suggestion on how to fix that.
This fact is already reflected in the docs, but the wording in the code made us suspect there was a mismatch. I think @sunnya97 can look into and double check that
req.LastCommitInfo.GetVotes()
actually returns all bonded validators.Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes