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

ADR 037 Implementation: Governance Split Votes #7802

Merged
merged 47 commits into from
Feb 12, 2021

Conversation

antstalepresh
Copy link
Contributor

@antstalepresh antstalepresh commented Nov 4, 2020

Description

This PR implements the ADR proposed in #7733


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
Copy link

codecov bot commented Nov 4, 2020

Codecov Report

Merging #7802 (a417b51) into master (e4b2d75) will increase coverage by 0.03%.
The diff coverage is 64.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7802      +/-   ##
==========================================
+ Coverage   61.39%   61.43%   +0.03%     
==========================================
  Files         656      656              
  Lines       37320    37526     +206     
==========================================
+ Hits        22914    23055     +141     
- Misses      12005    12063      +58     
- Partials     2401     2408       +7     
Impacted Files Coverage Δ
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 67.25% <0.00%> (ø)
x/gov/types/tally.go 0.00% <0.00%> (ø)
x/gov/types/vote.go 26.92% <31.81%> (+5.04%) ⬆️
x/gov/client/utils/query.go 27.86% <45.00%> (+2.86%) ⬆️
x/gov/types/codec.go 38.09% <50.00%> (+1.25%) ⬆️
x/gov/types/msgs.go 47.11% <61.53%> (+4.80%) ⬆️
x/gov/client/cli/tx.go 70.27% <77.41%> (+1.89%) ⬆️
x/gov/simulation/operations.go 80.88% <89.61%> (+2.90%) ⬆️
... and 4 more

@sunnya97 sunnya97 changed the title Gov split vote weighted vote ADR 037 Implementation: Governance Split Vote Nov 16, 2020
@sunnya97 sunnya97 self-assigned this Nov 16, 2020
@sunnya97 sunnya97 added this to Review In Progress in Cosmos SDK Project Board Nov 27, 2020
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

Overall LGTM!

changelog entry needs to be added, since this is state breaking.

Also, a migration script too, but probably as a follow-up PR.

docs/architecture/adr-037-gov-split-vote.md Show resolved Hide resolved
x/gov/types/vote.go Show resolved Hide resolved
x/gov/types/msgs.go Show resolved Hide resolved
x/gov/keeper/tally_test.go Show resolved Hide resolved
x/gov/client/utils/utils.go Show resolved Hide resolved
x/gov/keeper/msg_server.go Show resolved Hide resolved
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

lgtm.

The proto-breaking change seems a bit worrying to me, but I don't really have an idea why it's showing as breaking (related: #7802 (comment))

@sunnya97
Copy link
Member

sunnya97 commented Feb 9, 2021

It seems to not like the fact that we tried to reserve the name "option" when it was already used in past for field 3.

But according to Protobuf docs, names and fields need to be reserved separately.
https://developers.google.com/protocol-buffers/docs/proto3#reserved

I think this is more a mistake on the proto-breaking check logic that should handle this better.

@sunnya97 sunnya97 requested a review from aaronc February 9, 2021 20:19
Copy link
Collaborator

@anilcse anilcse left a comment

Choose a reason for hiding this comment

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

lgtm, can we avoid adding new legacy REST endpoints?

proto/cosmos/gov/v1beta1/tx.proto Outdated Show resolved Hide resolved
x/gov/client/cli/tx.go Outdated Show resolved Hide resolved
@@ -22,6 +22,7 @@ func registerTxHandlers(clientCtx client.Context, r *mux.Router, phs []ProposalR
r.HandleFunc("/gov/proposals", newPostProposalHandlerFn(clientCtx)).Methods("POST")
r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/deposits", RestProposalID), newDepositHandlerFn(clientCtx)).Methods("POST")
r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/votes", RestProposalID), newVoteHandlerFn(clientCtx)).Methods("POST")
r.HandleFunc(fmt.Sprintf("/gov/proposals/{%s}/weightedvotes", RestProposalID), newWeightedVoteHandlerFn(clientCtx)).Methods("POST")
Copy link
Collaborator

Choose a reason for hiding this comment

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

legacy REST is being deprecated, let's not add new legacy REST endpoints

Copy link
Member

Choose a reason for hiding this comment

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

Ok

Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

LGTM

x/gov/types/vote.go Show resolved Hide resolved
sunnya97 and others added 2 commits February 12, 2021 12:19
Co-authored-by: Marko <markobaricevic3778@gmail.com>
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

@sunnya97 sunnya97 merged commit cb725e1 into cosmos:master Feb 12, 2021
Cosmos SDK Project Board automation moved this from Review In Progress to Done Feb 12, 2021
@amaury1093 amaury1093 mentioned this pull request Feb 24, 2021
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet