diff --git a/x/tx/CHANGELOG.md b/x/tx/CHANGELOG.md index 5df0a95715e5..040681ddb96c 100644 --- a/x/tx/CHANGELOG.md +++ b/x/tx/CHANGELOG.md @@ -39,6 +39,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#19845](https://github.com/cosmos/cosmos-sdk/pull/19845) Use hybrid resolver instead of only protov2 registry +### 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 efa53882c26b..cdbb9aa2ac21 100644 --- a/x/tx/signing/aminojson/json_marshal.go +++ b/x/tx/signing/aminojson/json_marshal.go @@ -164,6 +164,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{} @@ -171,10 +174,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 {