Skip to content

Commit

Permalink
fix: allow unknown fields in ParseTypedEvent (#14995)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez authored Feb 10, 2023
1 parent 3c53870 commit effbdb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit effbdb2

Please sign in to comment.