From 4165527c94ef332c9476b146bb3a945a4ed3a19d Mon Sep 17 00:00:00 2001 From: Assaf Morami Date: Thu, 28 Sep 2023 08:50:59 +0300 Subject: [PATCH] Fix PFM to not fail packets that aren't FungibleTokenPacketData Currently, PFM fails packets that are not FungibleTokenPacketData. This means that PFM cannot support IBC apps that don't exclusively use FungibleTokenPacketData as the payload format (i.e. ics20-* or the transfer app). Therefore, CosmWasm cannot have PFM in its IBC stack, even though CosmWasm contracts may implement ics20-* (e.g. cw20-ics20: https://github.com/CosmWasm/cw-plus/tree/HEAD/contracts/cw20-ics20). This commit fixes the issue by passing the packet forward in the stack rather than failing packets that are not FungibleTokenPacketData. This will allow PFM to support a wider range of IBC apps and will make it possible for CosmWasm to have PFM in its IBC stack, which will improve the interoperability and usability of PFM in the Cosmos ecosystem --- middleware/packet-forward-middleware/router/ibc_middleware.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/middleware/packet-forward-middleware/router/ibc_middleware.go b/middleware/packet-forward-middleware/router/ibc_middleware.go index 0a22fe4c..e89f32ec 100644 --- a/middleware/packet-forward-middleware/router/ibc_middleware.go +++ b/middleware/packet-forward-middleware/router/ibc_middleware.go @@ -170,8 +170,8 @@ func (im IBCMiddleware) OnRecvPacket( var data transfertypes.FungibleTokenPacketData if err := transfertypes.ModuleCdc.UnmarshalJSON(packet.GetData(), &data); err != nil { - logger.Error("packetForwardMiddleware OnRecvPacketfailed to unmarshal packet data as FungibleTokenPacketData", "error", err) - return newErrorAcknowledgement(fmt.Errorf("failed to unmarshal packet data as FungibleTokenPacketData: %w", err)) + logger.Debug(fmt.Sprintf("packetForwardMiddleware OnRecvPacket payload is not a FungibleTokenPacketData: %w", err)) + return im.app.OnRecvPacket(ctx, packet, relayer) } logger.Debug("packetForwardMiddleware OnRecvPacket",