-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add MarshalBinary/UnmarshalBinary interface support #300
base: ismail/any_amino
Are you sure you want to change the base?
Add MarshalBinary/UnmarshalBinary interface support #300
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK -- pending approval by Jae & Zaki and CI fixing.
Relevant: #301 - "The binary and json were intentionally written to mirror the code structure, so this kind of translation is easy." Given the current impl, the divergence in JSON hints at divergence in function, whereby this optimization doesn't work for embedded structs (whereas such does work for json). In #301 what I want to convey is that we should continue to maintain code structure parity between binary and json, so that we solve common issues for both and reduce potential bugs. Once the implementations diverge, it will become difficult or impossible to keep in sync. Anyways, great case study; thank you for the PR. |
This PR provides a mechanism to completely override the Amino encoding of a type by implementing the
BinaryMarshaler
andBinaryUnmarshaler
interfaces.Amino prefix bytes will still be prepended. Implementing
MarshalAmino
/UnmarshalAmino
is not required. This should unblock tendermint/tendermint#4245