fix(x/tx): don't shadow Amino marshalling error messages (#19955)

This commit is contained in:
Antonio Pitasi 2024-04-04 17:15:24 +02:00 committed by GitHub
parent 649dfaa8c5
commit 15ad85d4e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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 {