diff --git a/x/tx/CHANGELOG.md b/x/tx/CHANGELOG.md index 1ddbcc1631b1..eaa2e851e820 100644 --- a/x/tx/CHANGELOG.md +++ b/x/tx/CHANGELOG.md @@ -35,6 +35,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#276](https://github.com/crypto-org-chain/cosmos-sdk/pull/276) Support bytes in automatic signer getters. +### Bug Fixes + +* [#19955](https://github.com/cosmos/cosmos-sdk/pull/19955) Don't shadow Amino marshalling error messages + ## v0.13.1 ### Features diff --git a/x/tx/signing/aminojson/json_marshal.go b/x/tx/signing/aminojson/json_marshal.go index 800dfc7fd320..d4d1fc2b1151 100644 --- a/x/tx/signing/aminojson/json_marshal.go +++ b/x/tx/signing/aminojson/json_marshal.go @@ -162,6 +162,9 @@ func (enc Encoder) DefineTypeEncoding(typeURL string, encoder MessageEncoder) En func (enc Encoder) Marshal(message proto.Message) ([]byte, error) { buf := &bytes.Buffer{} err := enc.beginMarshal(message.ProtoReflect(), buf, false) + if err != nil { + return nil, err + } if enc.indent != "" { indentBuf := &bytes.Buffer{} @@ -169,10 +172,10 @@ func (enc Encoder) Marshal(message proto.Message) ([]byte, error) { return nil, err } - return indentBuf.Bytes(), err + return indentBuf.Bytes(), nil } - return buf.Bytes(), err + return buf.Bytes(), nil } func (enc Encoder) beginMarshal(msg protoreflect.Message, writer io.Writer, isAny bool) error {