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
#106)

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 <assaf.morami@gmail.com>
  • Loading branch information
mergify[bot] and assafmo authored Sep 28, 2023
1 parent 342500f commit c135aff
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 @@ -167,8 +167,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 c135aff

Please sign in to comment.