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

R4R: tallyResults added to state #1914

Merged
merged 3 commits into from
Aug 8, 2018
Merged

R4R: tallyResults added to state #1914

merged 3 commits into from
Aug 8, 2018

Conversation

sunnya97
Copy link
Member

@sunnya97 sunnya97 commented Aug 3, 2018

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
  • Updated all relevant documentation (docs/)
  • Updated all relevant code comments
  • Wrote tests
  • Added entries in PENDING.md that include links to the relevant issue or PR that most accurately describes the change.
  • Updated cmd/gaia and examples/

For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@codecov
Copy link

codecov bot commented Aug 3, 2018

Codecov Report

Merging #1914 into develop will increase coverage by 0.12%.
The diff coverage is 97.43%.

@@             Coverage Diff             @@
##           develop    #1914      +/-   ##
===========================================
+ Coverage    63.55%   63.67%   +0.12%     
===========================================
  Files          119      119              
  Lines         7062     7083      +21     
===========================================
+ Hits          4488     4510      +22     
  Misses        2314     2314              
+ Partials       260      259       -1

@sunnya97 sunnya97 changed the title WIP: tallyResults added to state R4R: tallyResults added to state Aug 3, 2018
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.

Mostly looks good; a few possible typos and one testcase request.

// checks if two proposals are equal
func TallyResultEqual(resultA TallyResult, resultB TallyResult) bool {
if resultA.Yes.Equal(resultB.Yes) &&
resultA.Abstain.Equal(resultB.Yes) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

resultA.Abstain.Equal(resultB.Abstain)?

Copy link
Member Author

Choose a reason for hiding this comment

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

😱

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed

if resultA.Yes.Equal(resultB.Yes) &&
resultA.Abstain.Equal(resultB.Yes) &&
resultA.No.Equal(resultB.No) &&
resultA.NoWithVeto.Equal(resultB.Yes) {
Copy link
Contributor

Choose a reason for hiding this comment

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

resultA.NoWithVeto.Equal(resultB.NoWithVeto)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed

@@ -166,6 +167,7 @@ func TestTickPassedVotingPeriod(t *testing.T) {
require.False(t, depositsIterator.Valid())
depositsIterator.Close()
require.Equal(t, StatusRejected, keeper.GetProposal(ctx, proposalID).GetStatus())
require.True(t, TallyResultEqual(keeper.GetProposal(ctx, proposalID).GetTallyResult(), EmptyTallyResult()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a quick testcase for a non-empty tally result?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added in following test, TestSlashing

@cwgoes
Copy link
Contributor

cwgoes commented Aug 6, 2018

Also, can we make sure the TallyResult, if present, is pretty-printed in the CLI when querying a proposal?

@sunnya97
Copy link
Member Author

sunnya97 commented Aug 6, 2018

@cwgoes At the moment, the query-proposal cli command just returns the MarshalJSONIndented proposal. The JSON marshal should already marshal VoteOptions to string form, rather than the enum.

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.

utACK

@cwgoes cwgoes merged commit 4582de4 into develop Aug 8, 2018
@cwgoes cwgoes deleted the sunny/gov_tallyresults branch August 8, 2018 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants