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

staking endblock /tick upgrade #800

Merged
merged 10 commits into from
Apr 6, 2018
Merged

staking endblock /tick upgrade #800

merged 10 commits into from
Apr 6, 2018

Conversation

rigelrozanski
Copy link
Contributor

tick uses time
staking has an endblock

closes #290
closes #736
replaces #752

@codecov
Copy link

codecov bot commented Apr 5, 2018

Codecov Report

Merging #800 into develop will increase coverage by 2.18%.
The diff coverage is 77.77%.

@@             Coverage Diff             @@
##           develop     #800      +/-   ##
===========================================
+ Coverage       63%   65.18%   +2.18%     
===========================================
  Files           65       65              
  Lines         3538     3550      +12     
===========================================
+ Hits          2229     2314      +85     
+ Misses        1142     1049      -93     
- Partials       167      187      +20

if err != nil {
panic(err)
}
validators[i] = val
validators[i] = validator
Copy link
Contributor

@cwgoes cwgoes Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function claims to return most recent updated validator set, but this loop iterates over the validators in order of power descending, then the function returns the head of that array?

I presume you mean the current "top validator set", as opposed to the set of the most recently updated validators (which would be retrieved using GetRecentValidatorsKey?) - maybe worth clarifying comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I will expand the comments - the most recent updated validator set IS the "top" candidates... there are no other validators - the "Recent Validators" is just a duplicate of the results from the last time GetValidators was called - this way we can easily determine if a candidate is a validator without needing to iterate over the subspace as we do in GetValidators

x/stake/types.go Outdated
Address sdk.Address `json:"address"` // Address of validator
VotingPower sdk.Rat `json:"voting_power"` // Voting power if considered a validator
Address sdk.Address `json:"address"`
PubKey crypto.PubKey `json:"PubKey"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does "PubKey" not follow the case spec of the other fields?

Copy link
Contributor Author

@rigelrozanski rigelrozanski Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops this is a typo good catch (should be pub_key)

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rigelrozanski rigelrozanski merged commit 52f317a into develop Apr 6, 2018
@rigelrozanski rigelrozanski deleted the rigel/tick-endblock branch April 6, 2018 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

integrate tick functionality into endblock handler
3 participants