Start removing HybridCodec (init + auth, bank, distribution) (#6838)

* Start to remove HybridCodec

* Rename

* Fixes

* Test fixes

* Cleanup
This commit is contained in:
Aaron Craelius
2020-07-24 19:04:29 +00:00
committed by GitHub
parent 1f8cc450c4
commit 80f7ff62f7
33 changed files with 147 additions and 184 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ import (
// MarshalAny is a convenience function for packing the provided value in an
// Any and then proto marshaling it to bytes
func MarshalAny(m Marshaler, x interface{}) ([]byte, error) {
func MarshalAny(m BinaryMarshaler, x interface{}) ([]byte, error) {
msg, ok := x.(proto.Message)
if !ok {
return nil, fmt.Errorf("can't proto marshal %T", x)
@@ -32,7 +32,7 @@ func MarshalAny(m Marshaler, x interface{}) ([]byte, error) {
// Ex:
// var x MyInterface
// err := UnmarshalAny(unpacker, &x, bz)
func UnmarshalAny(m Marshaler, iface interface{}, bz []byte) error {
func UnmarshalAny(m BinaryMarshaler, iface interface{}, bz []byte) error {
any := &types.Any{}
err := m.UnmarshalBinaryBare(bz, any)
+5 -3
View File
@@ -17,9 +17,12 @@ type (
//
// 1. AminoCodec: Provides full Amino serialization compatibility.
// 2. ProtoCodec: Provides full Protobuf serialization compatibility.
// 3. HybridCodec: Provides Protobuf serialization for binary encoding and Amino
// for JSON encoding.
Marshaler interface {
BinaryMarshaler
JSONMarshaler
}
BinaryMarshaler interface {
MarshalBinaryBare(o ProtoMarshaler) ([]byte, error)
MustMarshalBinaryBare(o ProtoMarshaler) []byte
@@ -32,7 +35,6 @@ type (
UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error
MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler)
JSONMarshaler
types.AnyUnpacker
}