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
Enforce that validators use pubkey types from validator params #2714
Conversation
ValarDragon
commented
Oct 27, 2018
- Updated all relevant documentation in docs
- Updated all code comments where relevant
- Wrote tests
- Updated CHANGELOG_PENDING.md
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.
🍓🍌🥛 Awesome
Just one note regarding better separation of concerns
@@ -373,7 +391,7 @@ func updateState( | |||
// Update the validator set with the latest abciResponses. | |||
lastHeightValsChanged := state.LastHeightValidatorsChanged | |||
if len(abciResponses.EndBlock.ValidatorUpdates) > 0 { | |||
err := updateValidators(nValSet, abciResponses.EndBlock.ValidatorUpdates) | |||
err := updateValidators(nValSet, abciResponses.EndBlock.ValidatorUpdates, state.ConsensusParams.Validator) |
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.
can we not mix validation and update logic? maybe extract validation into a separate function
if err := validateUpdates(abciResponses.EndBlock.ValidatorUpdates, state.ConsensusParams.Validator.ValidatorPubkeyTypes); err != nil {
return state, fmt.Errorf("Error in validator updates: %v", err)
}
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.
Great point! I was originally trying to avoid an extra iteration over the validator updates, but I think your right, separating concerns is better for code clarity.
|
Sorry the commit history kinda became a mess, since this was forked off another branch which was then squash merged. |
Actually theres a weird protobuf change here as well, which idk where it came from. I'll just close this PR and open a new one. |