Skip to content

Commit

Permalink
Fix PFM to not fail packets that aren't FungibleTokenPacketData (#105) (
Browse files Browse the repository at this point in the history
#108)

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

(cherry picked from commit 39de938)

Co-authored-by: Assaf Morami <[email protected]>
  • Loading branch information
mergify[bot] and assafmo authored Sep 28, 2023
1 parent e32ed1f commit 232c0f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions middleware/packet-forward-middleware/router/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: %s", err.Error()))
return im.app.OnRecvPacket(ctx, packet, relayer)
}

logger.Debug("packetForwardMiddleware OnRecvPacket",
Expand Down

0 comments on commit 232c0f1

Please sign in to comment.