fix: allow unknown fields in ParseTypedEvent (#14995)

This commit is contained in:
Aleksandr Bezobchuk 2023-02-10 11:04:35 -05:00 committed by GitHub
parent 3c5387048f
commit effbdb294f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -266,6 +266,7 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf
### Bug Fixes
* [#14995](https://github.com/cosmos/cosmos-sdk/pull/14995) Allow unknown fields in `ParseTypedEvent`.
* [#14952](https://github.com/cosmos/cosmos-sdk/pull/14952) Pin version of github.com/syndtr/goleveldb `v1.0.1-0.20210819022825-2ae1ddf74ef7` to avoid issues in the store.
* (store) [#14931](https://github.com/cosmos/cosmos-sdk/pull/14931) Exclude in-memory KVStores, i.e. `StoreTypeMemory`, from CommitInfo commitments.
* (types/coin) [#14715](https://github.com/cosmos/cosmos-sdk/pull/14715) `sdk.Coins.Add` now returns an empty set of coins `sdk.Coins{}` if both coins set are empty.

View File

@ -119,7 +119,7 @@ func TypedEventToEvent(tev proto.Message) (Event, error) {
}, nil
}
// ParseTypedEvent converts abci.Event back to typed event
// ParseTypedEvent converts abci.Event back to a typed event.
func ParseTypedEvent(event abci.Event) (proto.Message, error) {
concreteGoType := proto.MessageType(event.Type)
if concreteGoType == nil {
@ -148,8 +148,8 @@ func ParseTypedEvent(event abci.Event) (proto.Message, error) {
return nil, err
}
err = jsonpb.Unmarshal(strings.NewReader(string(attrBytes)), protoMsg)
if err != nil {
unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true}
if err := unmarshaler.Unmarshal(strings.NewReader(string(attrBytes)), protoMsg); err != nil {
return nil, err
}