Skip to content

Commit

Permalink
fix: allow unknown fields in ParseTypedEvent (backport #14995) (#15005)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2023
1 parent 6d2087c commit 9774855
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 @@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* [#14995](https://github.com/cosmos/cosmos-sdk/pull/14995) Allow unknown fields in `ParseTypedEvent`.
* (store) [#14931](https://github.com/cosmos/cosmos-sdk/pull/14931) Exclude in-memory KVStores, i.e. `StoreTypeMemory`, from CommitInfo commitments.
* (cli) [#14919](https://github.com/cosmos/cosmos-sdk/pull/14919) Fix never assigned error when write validators.
* (x/group) [#14923](https://github.com/cosmos/cosmos-sdk/pull/14923) Fix error while using pagination in `x/group` from CLI
Expand Down
6 changes: 3 additions & 3 deletions types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,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 @@ -137,8 +137,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 9774855

Please sign in to comment.