cosmos / ibc-apps

IBC applications and middleware for Cosmos SDK chains.
Apache License 2.0
82 stars 62 forks source link

pfm(refactor): missing prefix for `RefundPacketKey` #217

Open jtieri opened 2 weeks ago

jtieri commented 2 weeks ago

The RefundPacketKey function does not include a prefix that disambiguates it from other possible store paths.

While there are currently no other slash-separated store paths in Packet Forward Middleware's Keeper than RefundPacketKey, if one is added in the future, values stored under RefundPacketKey may collide with it.

Proposed fix:

func RefundPacketKey(channelID, portID string, sequence uint64) []byte {
  - return []byte(fmt.Sprintf("%s/%s/%d", channelID, portID, sequence))
  + return []byte(fmt.Sprintf("refund_packet/%s/%s/%d", channelID, portID,
      sequence))
}

Since this is a breaking change we do not plan to introduce these changes now but it's probably a good idea to keep this issue open so we can be aware of this issue in the case where we need to persist some additional data to the store in the future.