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

Move codec.MarshalAny functions to codec.Marshaler interface #8049

Closed
4 tasks
robert-zaremba opened this issue Nov 30, 2020 · 1 comment · Fixed by #8080
Closed
4 tasks

Move codec.MarshalAny functions to codec.Marshaler interface #8049

robert-zaremba opened this issue Nov 30, 2020 · 1 comment · Fixed by #8080
Assignees
Labels
C:Encoding C:Types T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine).

Comments

@robert-zaremba
Copy link
Collaborator

robert-zaremba commented Nov 30, 2020

Summary

In Remove bech32 PubKey support #7477 I added codec.MarshalIfcJSON and codec.UnmarshalIfcJSON as a helper methods for serializing interfaces (eg PubKey). The functions are completing the codec.MarshalAny and codec.UnmarshalAny to provide JSON support. They hide the complexity and low-level knowledge about wrapping interfaces into Any structure.

For better UX this functions should be moved to the Marshaler interface:

  • user should have a consistent way how to unpack and serialize data without thinking to use a helper function or an interface.
  • stabilize the API

Problem Definition

Currently we have many (Un)marshal functions: directly in codec, some local helper as well as in implementations of codec.Marshaler. It is confusing for the developer which function he should use.

Proposal

Add codec.[Un]marshalnterface[JSON] functions to codec.Marshaler interface and move that functions to implementations.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@robert-zaremba robert-zaremba added x/ibc T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). C:Types C:Encoding labels Nov 30, 2020
@robert-zaremba robert-zaremba self-assigned this Nov 30, 2020
@robert-zaremba robert-zaremba changed the title Move Un(marshal)Ifc functions to codec interface Move codec.MarshalIfc* functions to codec.Marshaler interface Nov 30, 2020
@robert-zaremba robert-zaremba added this to the v0.40.1 milestone Dec 2, 2020
@aaronc
Copy link
Member

aaronc commented Dec 2, 2020

Please let's use MarshalInterface instead of Ifc. The abbreviation is too cryptic IMHO.

@robert-zaremba robert-zaremba changed the title Move codec.MarshalIfc* functions to codec.Marshaler interface Move codec.MarshalAny functions to codec.Marshaler interface Dec 4, 2020
@mergify mergify bot closed this as completed in #8080 Dec 8, 2020
@aaronc aaronc removed the in progress label Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Encoding C:Types T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants