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

refactor(client): add client/Context.Codec and deprecate JSONCodec #9498

Merged
merged 8 commits into from
Jun 11, 2021

Conversation

robert-zaremba
Copy link
Collaborator

@robert-zaremba robert-zaremba commented Jun 10, 2021

Description

Closes: #9490

Going towards v0.44 release cycle, we need to use codec.Codec in the client/contex.Context object. This deprecates client/contex.JSONCodec. To assure smooth transition we add ``client/contex.Codec: codec.Codec` in v0.43 release and use it everywhere in the SDK instead of JSONCodec.

Moreover I added a note that encCfg.Marshaler should be renamed to encCfg.Codec.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@github-actions github-actions bot added C:CLI C:Keys Keybase, KMS and HSMs C:x/auth C:x/authz C:x/bank C:x/crisis C:x/distribution distribution module related C:x/evidence C:x/feegrant C:x/genutil genutil module issues C:x/gov C:x/mint C:x/params C:x/slashing C:x/staking C:x/upgrade T: ADR An issue or PR relating to an architectural decision record T:Docs Changes and features related to documentation. labels Jun 10, 2021
@robert-zaremba robert-zaremba changed the title Robert/sdk context codec chore(types): add sdk.Context.Codec and deprecate JSONCodec Jun 10, 2021
@robert-zaremba robert-zaremba added this to the v0.43 milestone Jun 10, 2021
@robert-zaremba robert-zaremba changed the title chore(types): add sdk.Context.Codec and deprecate JSONCodec refactore(types): add sdk.Context.Codec and deprecate JSONCodec Jun 10, 2021
@codecov
Copy link

codecov bot commented Jun 11, 2021

Codecov Report

Merging #9498 (7c54e03) into master (a15883f) will decrease coverage by 0.01%.
The diff coverage is 81.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9498      +/-   ##
==========================================
- Coverage   60.55%   60.54%   -0.02%     
==========================================
  Files         590      590              
  Lines       37288    37296       +8     
==========================================
+ Hits        22578    22579       +1     
- Misses      12763    12768       +5     
- Partials     1947     1949       +2     
Impacted Files Coverage Δ
client/keys/add.go 62.50% <0.00%> (ø)
x/distribution/client/cli/tx.go 3.88% <0.00%> (ø)
x/genutil/client/cli/collect.go 0.00% <0.00%> (ø)
x/genutil/client/cli/gentx.go 0.00% <0.00%> (ø)
x/genutil/client/cli/validate_genesis.go 0.00% <0.00%> (ø)
x/genutil/client/testutil/helpers.go 0.00% <0.00%> (ø)
x/gov/client/cli/query.go 0.00% <0.00%> (ø)
x/gov/client/utils/query.go 23.67% <0.00%> (ø)
x/staking/client/cli/tx.go 17.98% <0.00%> (ø)
x/staking/legacy/v043/store.go 92.10% <40.00%> (-7.90%) ⬇️
... and 17 more

@robert-zaremba robert-zaremba changed the title refactore(types): add sdk.Context.Codec and deprecate JSONCodec refactor(types): add sdk.Context.Codec and deprecate JSONCodec Jun 11, 2021
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

simapp/params/encoding.go Outdated Show resolved Hide resolved
@amaury1093
Copy link
Contributor

IMO this should be refactor(client)

@robert-zaremba robert-zaremba changed the title refactor(types): add sdk.Context.Codec and deprecate JSONCodec refactor(client): add sdk.Context.Codec and deprecate JSONCodec Jun 11, 2021
@robert-zaremba robert-zaremba changed the title refactor(client): add sdk.Context.Codec and deprecate JSONCodec refactor(client): add client/Context.Codec and deprecate JSONCodec Jun 11, 2021
Copy link
Contributor

@cyberbono3 cyberbono3 left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks for doing that, @robert-zaremba

@robert-zaremba robert-zaremba added the A:automerge Automatically merge PR once all prerequisites pass. label Jun 11, 2021
@robert-zaremba
Copy link
Collaborator Author

again some random errors in CI... rerunning ... rerunning

@mergify mergify bot merged commit 7bca49e into master Jun 11, 2021
@mergify mergify bot deleted the robert/sdk-context-codec branch June 11, 2021 11:49
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
…osmos#9498)

* chore(types): add sdk.Context.Codec and deprecate JSONCodec

* Use clientContext.Codec rather than JSONCodec everywhere

* update tests to use clientContext.Codec

* added a note that EncodingConfig.Marshaler will be renamed to Codec

* update changelog

* fix tests to use clientCtx.WithCodec instead of WithJSONCodec

* fix genutil build

* Update simapp/params/encoding.go

Co-authored-by: Amaury <[email protected]>

Co-authored-by: Amaury <[email protected]>
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:CLI C:Keys Keybase, KMS and HSMs C:Types C:x/auth C:x/authz C:x/bank C:x/crisis C:x/distribution distribution module related C:x/evidence C:x/feegrant C:x/genutil genutil module issues C:x/gov C:x/mint C:x/params C:x/slashing C:x/staking C:x/upgrade T: ADR An issue or PR relating to an architectural decision record T:Docs Changes and features related to documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Created sdk.Codec and deprecate clientContext.JSONCodec
3 participants