From 1c7da830c22a144fd176f18e4eaa0448bc55aa5b Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 17 Mar 2020 01:36:05 +0100 Subject: [PATCH] Revert changes for keybase encoding (#5814) --- CHANGELOG.md | 4 +++- crypto/keys/keybase_base.go | 2 +- crypto/keys/types.go | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a19fb7b3961..88549940f629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,8 @@ balances or a single balance by denom when the `denom` query parameter is presen * [\#5785](https://github.com/cosmos/cosmos-sdk/issues/5785) JSON strings coerced to valid UTF-8 bytes at JSON marshalling time are now replaced by human-readable expressions. This change can potentially break compatibility with all those client side tools that parse log messages. +* (client) [\#5799](https://github.com/cosmos/cosmos-sdk/pull/5799) The `tx encode/decode` commands, due to change on encoding break compatibility with +older clients. ### API Breaking Changes @@ -148,7 +150,7 @@ Buffers for state serialization instead of Amino. to define their own concrete `MsgSubmitProposal` types. * The module now accepts a `Codec` interface which extends the `codec.Marshaler` interface by requiring a concrete codec to know how to serialize `Proposal` types. -* (codec) [\#5799](https://github.com/cosmos/cosmos-sdk/pull/5799) Now we favor the use of MarshalBinaryBare instead of LengthPrefixed in all cases that is not needed. +* (codec) [\#5799](https://github.com/cosmos/cosmos-sdk/pull/5799) Now we favor the use of `(Un)MarshalBinaryBare` instead of `(Un)MarshalBinaryLengthPrefixed` in all cases that are not needed. ### Improvements diff --git a/crypto/keys/keybase_base.go b/crypto/keys/keybase_base.go index 86ed00677d25..47c7e60d729a 100644 --- a/crypto/keys/keybase_base.go +++ b/crypto/keys/keybase_base.go @@ -124,7 +124,7 @@ func (kb baseKeybase) DecodeSignature(info Info, msg []byte) (sig []byte, pub tm return nil, nil, err } - if err := CryptoCdc.UnmarshalBinaryBare([]byte(signed), sig); err != nil { + if err := CryptoCdc.UnmarshalBinaryLengthPrefixed([]byte(signed), sig); err != nil { return nil, nil, errors.Wrap(err, "failed to decode signature") } diff --git a/crypto/keys/types.go b/crypto/keys/types.go index c91f2905b24e..89f5cb2d539b 100644 --- a/crypto/keys/types.go +++ b/crypto/keys/types.go @@ -337,12 +337,12 @@ func (i multiInfo) GetPath() (*hd.BIP44Params, error) { // encoding info func marshalInfo(i Info) []byte { - return CryptoCdc.MustMarshalBinaryBare(i) + return CryptoCdc.MustMarshalBinaryLengthPrefixed(i) } // decoding info func unmarshalInfo(bz []byte) (info Info, err error) { - err = CryptoCdc.UnmarshalBinaryBare(bz, &info) + err = CryptoCdc.UnmarshalBinaryLengthPrefixed(bz, &info) return }