Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Set accum of freshly added validator -(total voting power) #2785
Set accum of freshly added validator -(total voting power) #2785
Changes from all commits
de44ee9
182fc6c
47cefd9
fc7339a
a5a4953
77c05d8
3b2e79e
7cbcd19
fdf6ceb
51ae57d
c98841c
b95160d
c445aa4
f1ed7fd
ce8357e
f94d626
d852b39
7b9e883
edd0c9a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Does this take effect in the
vals
? In the old code we were updating the heap again after the subtractionThere 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.
The heap is only there to compute mostest (which will be returned at the end of this method). In the old code the heap was updated because only after
times
iterations, the proposer was set (and mostest was overwritten on each iter). Now the heap is not used after the subtraction (but rebuild on every call ofIncrementAccum
). And yes, this should take effect on the vals (mostest is a pointer to a val in vals).tendermint/types/validator_set.go
Lines 72 to 88 in 7213869
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.
In addition to doing this, I wonder if we should guard the input values (passed by the ABCI application) and require that the powers passed by the application sum to no more than
MaxTotalVotingPower
. Otherwise, if they ever did sum to more thanMaxTotalVotingPower
our proposer selection algorithm would no longer have the same properties (and the application might not immediately notice).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.
I added checks for updating and adding validators in c445aa4
These checks rejects single validators whose update would exceed
MaxTotalVotingPower
on the fly (even if another update, say removing another validator would make this a valid update). Not sure if we should instead look on the total updates first and reject the whole set of updates instead.Oh actually, the whole set will be rejected if
updateValidators
errs.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.
So this should be impossible now given updateValidators is supposed to prevent it, correct? Should we panic here instead to indicate this?
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.
Yes, makes sense. Thanks @ebuchman!
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.
Shouldn't we be able to get rid of all the safe clipping now because of this max?