Skip to content

Commit

Permalink
Improve protobuf vs json error msgs / types (#536).
Browse files Browse the repository at this point in the history
Smal follow-up / related to #459
  • Loading branch information
maurolacy authored Feb 19, 2025
1 parent 2e9e961 commit 579a7ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

### Improvements

- [#536](https://github.com/babylonlabs-io/babylon/pull/536) Improve protobuf vs. json error msgs / types
- [#527](https://github.com/babylonlabs-io/babylon/pull/527) Create BSL signer on start command with flags.
- [#513](https://github.com/babylonlabs-io/babylon/pull/513) Suport datagen BTC delegation creation from Consumers
- [#470](https://github.com/babylonlabs-io/babylon/pull/470) Return full consumer info and remove DB object
Expand Down
8 changes: 4 additions & 4 deletions x/zoneconcierge/module_ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,16 @@ func (im IBCModule) OnAcknowledgementPacket(
// - for acknowledgment message with errors defined in `x/wasm`, it uses json
// - for all other acknowledgement messages, it uses protobuf
if errProto := types.ModuleCdc.Unmarshal(acknowledgement, &ack); errProto != nil {
im.keeper.Logger(ctx).Error("cannot unmarshal packet acknowledgement with protobuf", "error", errProto)
im.keeper.Logger(ctx).Warn("cannot unmarshal packet acknowledgement with protobuf, trying json.")
if errJson := types.ModuleCdc.UnmarshalJSON(acknowledgement, &ack); errJson != nil {
im.keeper.Logger(ctx).Error("cannot unmarshal packet acknowledgement with json", "error", errJson)
im.keeper.Logger(ctx).Error("cannot unmarshal packet acknowledgement with json.", "error", errJson)
return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet acknowledgement with protobuf (error: %v) or json (error: %v)", errProto, errJson)
}
}

switch resp := ack.Response.(type) {
case *channeltypes.Acknowledgement_Result:
im.keeper.Logger(ctx).Info("received an Acknowledgement message", "result", string(resp.Result))
im.keeper.Logger(ctx).Info("received an Acknowledgement message.", "result", string(resp.Result))
// TODO: emit typed event
ctx.EventManager().EmitEvent(
sdk.NewEvent(
Expand All @@ -228,7 +228,7 @@ func (im IBCModule) OnAcknowledgementPacket(
),
)
case *channeltypes.Acknowledgement_Error:
im.keeper.Logger(ctx).Error("received an Acknowledgement error message", "error", resp.Error)
im.keeper.Logger(ctx).Error("received an Acknowledgement error message.", "error", resp.Error)
// TODO: emit typed event
ctx.EventManager().EmitEvent(
sdk.NewEvent(
Expand Down

0 comments on commit 579a7ad

Please sign in to comment.