From 7fc7b3f6ff82eb5ede52881778114f6b38bd7dfa Mon Sep 17 00:00:00 2001 From: Rikard Hjort <8545447+hjorthjort@users.noreply.github.com> Date: Mon, 29 Mar 2021 18:57:50 +0200 Subject: [PATCH] Make clearer that the distribution iterates over all active validators (#8866) * Make clearer that the distribution iterates over all active validators, not just ones that voted * Update x/distribution/keeper/allocation.go Co-authored-by: Dev Ojha * Move comment to docstring * Change variable name * Fix: remove git conflict markers Co-authored-by: Dev Ojha Co-authored-by: Alessio Treglia Co-authored-by: Marko Co-authored-by: SaReN --- x/distribution/keeper/allocation.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 9436bada9d..ad9ef55ad0 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -11,9 +11,11 @@ import ( ) // AllocateTokens handles distribution of the collected fees +// bondedVotes is a list of (validator address, validator voted on last block flag) for all +// validators in the bonded set. func (k Keeper) AllocateTokens( ctx sdk.Context, sumPreviousPrecommitPower, totalPreviousPower int64, - previousProposer sdk.ConsAddress, previousVotes []abci.VoteInfo, + previousProposer sdk.ConsAddress, bondedVotes []abci.VoteInfo, ) { logger := k.Logger(ctx) @@ -83,7 +85,7 @@ func (k Keeper) AllocateTokens( // allocate tokens proportionally to voting power // TODO consider parallelizing later, ref https://github.com/cosmos/cosmos-sdk/pull/3099#discussion_r246276376 - for _, vote := range previousVotes { + for _, vote := range bondedVotes { validator := k.stakingKeeper.ValidatorByConsAddr(ctx, vote.Validator.Address) // TODO consider microslashing for missing votes.