From 30b2c4da458f34ea316d19633fe856905a9e26bd Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Tue, 27 Jun 2023 12:19:25 -0700 Subject: [PATCH] logging --- x/ccv/provider/ibc_module.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/x/ccv/provider/ibc_module.go b/x/ccv/provider/ibc_module.go index b543c8927e..a794723043 100644 --- a/x/ccv/provider/ibc_module.go +++ b/x/ccv/provider/ibc_module.go @@ -178,9 +178,12 @@ func (am AppModule) OnRecvPacket( ack ibcexported.Acknowledgement consumerPacket ccv.ConsumerPacketData ) - // unmarshall consumer packet + // unmarshal consumer packet if err := ccv.ModuleCdc.UnmarshalJSON(packet.GetData(), &consumerPacket); err != nil { - errAck := channeltypes.NewErrorAcknowledgement(fmt.Errorf("cannot unmarshal CCV packet data")) + errMsg := "cannot unmarshal CCV packet data from JSON" + // errMsg thrown out by IBC core, hence we log instead + ctx.Logger().Error(errMsg, "err", err) + errAck := channeltypes.NewErrorAcknowledgement(fmt.Errorf(errMsg)) ack = &errAck } else { // TODO: call ValidateBasic method on consumer packet data @@ -194,7 +197,11 @@ func (am AppModule) OnRecvPacket( // handle SlashPacket ack = am.keeper.OnRecvSlashPacket(ctx, packet, *consumerPacket.GetSlashPacketData()) default: - errAck := channeltypes.NewErrorAcknowledgement(fmt.Errorf("invalid consumer packet type: %q", consumerPacket.Type)) + errMsg := fmt.Sprintf("invalid consumer packet type: %q, valid types are: %q, %q", + consumerPacket.Type, ccv.VscMaturedPacket, ccv.SlashPacket) + // errMsg thrown out by IBC core, hence we log instead + ctx.Logger().Error(errMsg) + errAck := channeltypes.NewErrorAcknowledgement(fmt.Errorf(errMsg)) ack = &errAck } }