Skip to content

Commit

Permalink
fix(x/tx): don't shadow Amino marshalling error messages (cosmos#19955)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pitasi authored and mmsqe committed Sep 26, 2024
1 parent 1675d17 commit 2a329c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions x/tx/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions x/tx/signing/aminojson/json_marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,20 @@ 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{}
if err := json.Indent(indentBuf, buf.Bytes(), "", enc.indent); err != nil {
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 {
Expand Down

0 comments on commit 2a329c0

Please sign in to comment.