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

Governance split vote #39

Conversation

antstalepresh
Copy link

Description

closes: #XXXX


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@codecov-io
Copy link

codecov-io commented Oct 28, 2020

Codecov Report

Merging #39 into master will increase coverage by 0.01%.
The diff coverage is 56.68%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
+ Coverage   54.12%   54.13%   +0.01%     
==========================================
  Files         613      613              
  Lines       38667    38895     +228     
==========================================
+ Hits        20927    21055     +128     
- Misses      15605    15698      +93     
- Partials     2135     2142       +7     
Impacted Files Coverage Δ
x/gov/client/rest/rest.go 100.00% <ø> (ø)
x/gov/client/utils/utils.go 0.00% <0.00%> (ø)
x/gov/handler.go 66.66% <0.00%> (-13.34%) ⬇️
x/gov/keeper/msg_server.go 1.02% <0.00%> (-0.30%) ⬇️
x/gov/legacy/v040/migrate.go 58.42% <0.00%> (ø)
x/gov/types/tally.go 0.00% <0.00%> (ø)
x/gov/client/rest/tx.go 7.14% <4.34%> (-1.06%) ⬇️
x/gov/types/vote.go 28.84% <36.36%> (+6.97%) ⬆️
x/gov/client/utils/query.go 27.86% <45.00%> (+2.86%) ⬆️
x/gov/types/codec.go 38.09% <50.00%> (+1.25%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82f15f3...381d1b0. Read the comment docs.

@sunnya97
Copy link

sunnya97 commented Oct 29, 2020

@antstalepresh You've designed the structs for a vote to be:

Vote {
    ProposalId  int64
    Voter           sdk.Address
    subvotes    []SubVotes
}

SubVote {
    Option  option
    Rate     sdk.Dec
}

What is the Pro/Con of that versus this:

Vote {
    ProposalId  int64
    Voter           sdk.Address
    options       []Option
    rates           []sdk.Dec
}

And ValidateBasic checks that len(options) == len(rates)

It's not a big deal, but the second one is how I personally would have created it, and so am wondering if there's a benefit to having a new SubVote struct?

@antstalepresh
Copy link
Author

antstalepresh commented Oct 29, 2020

@antstalepresh You've designed the structs for a vote to be:

Vote {
    ProposalId  int64
    Voter           sdk.Address
    subvotes    []SubVotes
}

SubVote {
    Option  option
    Rate     sdk.Dec
}

What is the Pro/Con of that versus this:

Vote {
    ProposalId  int64
    Voter           sdk.Address
    options       []Option
    rates           []sdk.Dec
}

And ValidateBasic checks that len(options) == len(rates)

It's not a big deal, but the second one is how I personally would have created it, and so am wondering if there's a benefit to having a new SubVote struct?

Adding SubVote struct could make options and rates are connected with struct. And also in the future we could add more fields in SubVote like Memo or something.

@antstalepresh antstalepresh changed the title Governance split vote - WIP Governance split vote Oct 30, 2020
@antstalepresh antstalepresh changed the base branch from master to gov_split_vote_weighted_vote November 4, 2020 00:31
@antstalepresh antstalepresh merged commit 2671482 into sikkatech:gov_split_vote_weighted_vote Nov 4, 2020
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.

3 participants