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

Make JSONMarshaler methods require proto.Message #7054

Merged
merged 27 commits into from
Aug 26, 2020

Conversation

blushi
Copy link
Contributor

@blushi blushi commented Aug 14, 2020

Description

closes: #6982


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 Aug 14, 2020

Codecov Report

Merging #7054 into master will decrease coverage by 0.02%.
The diff coverage is 57.14%.

@@            Coverage Diff             @@
##           master    #7054      +/-   ##
==========================================
- Coverage   54.53%   54.50%   -0.03%     
==========================================
  Files         566      566              
  Lines       38727    38752      +25     
==========================================
+ Hits        21119    21122       +3     
- Misses      15884    15900      +16     
- Partials     1724     1730       +6     

@blushi blushi requested a review from anilcse August 17, 2020 15:27
@lgtm-com
Copy link

lgtm-com bot commented Aug 17, 2020

This pull request introduces 2 alerts when merging fa96cfe into c25b3b9 - view on LGTM.com

new alerts:

  • 2 for Useless assignment to local variable

client/tx/tx.go Outdated Show resolved Hide resolved
@blushi blushi marked this pull request as ready for review August 19, 2020 08:55
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.

this is a big PR, I didn't review everything yet, will continue after lunch.

client/context.go Show resolved Hide resolved
x/genutil/client/cli/validate_genesis.go Outdated Show resolved Hide resolved
x/genutil/client/cli/migrate.go Outdated Show resolved Hide resolved
x/genutil/client/cli/migrate.go Outdated Show resolved Hide resolved
aaronc
aaronc previously requested changes Aug 19, 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.

Thanks for getting to all of this @blushi ! This is a massive and complex PR. And much needed IMHO.

I also didn't make it all the through in this review, but I think I get the general gist of what's needed next.

REST and legacy querier changes look correct.

We don't want to use legacy amino at all with simulation I believe.

Also, we don't want to use amino in CLI tests except when PrintOutputLegacy is used. In all other cases we want to use JSONMarshaler

client/tx/tx.go Outdated Show resolved Hide resolved
simapp/app.go Outdated Show resolved Hide resolved
simapp/state.go Outdated Show resolved Hide resolved
simapp/state.go Outdated Show resolved Hide resolved
simapp/state.go Outdated Show resolved Hide resolved
x/bank/client/cli/cli_test.go Outdated Show resolved Hide resolved
x/bank/client/cli/cli_test.go Outdated Show resolved Hide resolved
x/bank/simulation/genesis.go Outdated Show resolved Hide resolved
x/bank/simulation/genesis_test.go Outdated Show resolved Hide resolved
x/bank/simulation/params.go Outdated 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.

Nice! Here are the last couple of pieces that didn't make sense to me.

The biggest one is why are we using encoding/json for GenesisStates? Is it because they simple enough that JSONMarshaler.Marshal() == json.Marshal() in those cases?

server/util.go Outdated Show resolved Hide resolved
simapp/state.go Outdated Show resolved Hide resolved
x/gov/simulation/genesis.go Show resolved Hide resolved
x/params/client/cli/tx.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.

This lgtm! I'm happy to merge this (one last small nit)

server/util.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

utACK

codec/amino_codec.go Show resolved Hide resolved
codec/proto_codec.go Show resolved Hide resolved
types/module/module_test.go Outdated Show resolved Hide resolved
types/module/simulation.go Outdated Show resolved Hide resolved
blushi and others added 2 commits August 25, 2020 16:58
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
server/util.go Outdated Show resolved Hide resolved
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

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.

@blushi Feel free to put automerge on when you're happy with this PR

server/util_test.go Outdated Show resolved Hide resolved
@blushi
Copy link
Contributor Author

blushi commented Aug 26, 2020

@blushi Feel free to put automerge on when you're happy with this PR

I still need to fix some issues after merging master(cf. CI failing).

@blushi blushi added the A:automerge Automatically merge PR once all prerequisites pass. label Aug 26, 2020
@mergify mergify bot merged commit 7f59723 into master Aug 26, 2020
@mergify mergify bot deleted the marie/6982-json-marshaler-proto branch August 26, 2020 09:39
zmanian pushed a commit that referenced this pull request Aug 28, 2020
* Make JSONMarshaler require proto.Message

* Use &msg with MarshalJSON

* Use *LegacyAmino in queriers instead of JSONMarshaler

* Revert ABCIMessageLogs String() and coins tests

* Use LegacyAmino in client/debug and fix subspace tests

* Use LegacyAmino in all legacy queriers and adapt simulation

* Make AminoCodec implement Marshaler and some godoc fixes

* Test fixes

* Remove unrelevant comment

* Use TxConfig.TxJSONEncoder

* Use encoding/json in genutil cli migrate/validate genesis cmds

* Address simulation related comments

* Use JSONMarshaler in cli tests

* Use proto.Message as respType in cli tests

* Use tmjson for tm GenesisDoc

* Update types/module/simulation.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update types/module/module_test.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Add godoc comments

* Remove unused InsertKeyJSON

* Fix tests

Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
* Make JSONMarshaler require proto.Message

* Use &msg with MarshalJSON

* Use *LegacyAmino in queriers instead of JSONMarshaler

* Revert ABCIMessageLogs String() and coins tests

* Use LegacyAmino in client/debug and fix subspace tests

* Use LegacyAmino in all legacy queriers and adapt simulation

* Make AminoCodec implement Marshaler and some godoc fixes

* Test fixes

* Remove unrelevant comment

* Use TxConfig.TxJSONEncoder

* Use encoding/json in genutil cli migrate/validate genesis cmds

* Address simulation related comments

* Use JSONMarshaler in cli tests

* Use proto.Message as respType in cli tests

* Use tmjson for tm GenesisDoc

* Update types/module/simulation.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update types/module/module_test.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Add godoc comments

* Remove unused InsertKeyJSON

* Fix tests

Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make JSONMarshaler methods require proto.Message
8 participants