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

x/gov - Proto Migration #5737

Merged
merged 39 commits into from
Mar 4, 2020
Merged

x/gov - Proto Migration #5737

merged 39 commits into from
Mar 4, 2020

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Mar 2, 2020

TODO:

  • Update tests to avoid import cycle
  • Migrate MsgSubmitProposal
  • Create issue to move simapp/codec to codec/std (should be done in a subsequent PR)

replaces: #5493
ref: #5444

/cc @aaronc


For contributor use:

  • 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

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@alexanderbez alexanderbez added C:x/gov WIP T: State Machine Breaking State machine breaking changes (impacts consensus). A:automerge Automatically merge PR once all prerequisites pass. labels Mar 2, 2020
@alexanderbez
Copy link
Contributor Author

Blocked on #5738.

@alexanderbez alexanderbez marked this pull request as ready for review March 3, 2020 15:33
@alexanderbez alexanderbez added R4R and removed WIP labels Mar 3, 2020
Copy link
Member

@aaronc aaronc 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. Just made a few small suggestions.

CHANGELOG.md Outdated Show resolved Hide resolved
return nil, err
}

return c.Marshaler.MarshalBinaryLengthPrefixed(proposal)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return c.Marshaler.MarshalBinaryLengthPrefixed(proposal)
return c.Marshaler.MarshalBinaryBare(proposal)

Why should we be length-prefixing everywhere? It would only be needed for streaming messages AFAIK.

Copy link
Contributor Author

@alexanderbez alexanderbez Mar 3, 2020

Choose a reason for hiding this comment

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

We don't, but it's consistent. We should probably do one fell swoop (of the entire SDK) instead of ad-hoc per PR.

Copy link
Member

Choose a reason for hiding this comment

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

So you mean that we do it for every custom marshaler in this codec in one fell-swoop? That's fine. But we should do it when or before this goes into codec/std because then at that point it becomes state machine breaking for zones.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean we do it for the entire SDK (where applicable). It doesn't matter if it's before or after the std move. This is all happening before the release (0.39) anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

// to deserialize.
func (c *Codec) UnmarshalProposal(bz []byte) (gov.Proposal, error) {
proposal := &Proposal{}
if err := c.Marshaler.UnmarshalBinaryLengthPrefixed(bz, proposal); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if err := c.Marshaler.UnmarshalBinaryLengthPrefixed(bz, proposal); err != nil {
if err := c.Marshaler.UnmarshalBinaryBare(bz, proposal); err != nil {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above.

simapp/codec/codec.proto Outdated Show resolved Hide resolved
x/gov/keeper/proposal.go Outdated Show resolved Hide resolved
x/upgrade/types/types.proto Outdated Show resolved Hide resolved
Co-Authored-By: Anil Kumar Kammari <anil@vitwit.com>
@codecov
Copy link

codecov bot commented Mar 4, 2020

Codecov Report

Merging #5737 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5737   +/-   ##
=======================================
  Coverage   34.88%   34.88%           
=======================================
  Files         337      337           
  Lines       34647    34647           
=======================================
  Hits        12087    12087           
  Misses      21323    21323           
  Partials     1237     1237
Impacted Files Coverage Δ
x/crisis/genesis.go 0% <ø> (ø) ⬆️
x/crisis/keeper/params.go 40% <ø> (ø)
x/crisis/keeper/keeper.go 79.41% <ø> (ø)
x/crisis/handler.go 100% <ø> (ø) ⬆️
x/crisis/module.go 39.02% <ø> (ø) ⬆️
x/gov/keeper/proposal.go 77.77% <100%> (ø) ⬆️

@alexanderbez alexanderbez merged commit b9ab834 into master Mar 4, 2020
@alexanderbez alexanderbez deleted the bez/5444-gov-proto-enc branch March 4, 2020 16:20
@clevinson clevinson added this to the v0.39 milestone May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:x/gov T: State Machine Breaking State machine breaking changes (impacts consensus).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants