Skip to content

Commit

Permalink
Merge pull request #882 from crypto-com/fix/ibc-msg
Browse files Browse the repository at this point in the history
Fix: move IsPacketMsgTransfer after Tx status checking
  • Loading branch information
vincentysc authored Mar 18, 2024
2 parents afaba46 + 1cca51a commit 8992bcd
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions usecase/parser/ibc/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -787,11 +787,6 @@ func ParseMsgRecvPacket(
panic(fmt.Errorf("error decoding RawMsgRecvPacket: %v", err))
}

if !IsPacketMsgTransfer(rawMsg.Packet, &parserParams.TxsResult.Log[parserParams.MsgIndex]) {
// unsupported application
return []command.Command{}, []string{}
}

// Transfer application, MsgTransfer
var rawFungibleTokenPacketData ibc_model.FungibleTokenPacketData
rawPacketData, err := base64_internal.DecodeString(rawMsg.Packet.Data)
Expand Down Expand Up @@ -826,6 +821,11 @@ func ParseMsgRecvPacket(
)}, possibleSignerAddresses
}

if !IsPacketMsgTransfer(rawMsg.Packet, &parserParams.TxsResult.Log[parserParams.MsgIndex]) {
// unsupported application
return []command.Command{}, []string{}
}

log := utils.NewParsedTxsResultLog(&parserParams.TxsResult.Log[parserParams.MsgIndex])

recvPacketEvents := log.GetEventsByType("recv_packet")
Expand Down Expand Up @@ -924,11 +924,6 @@ func ParseMsgAcknowledgement(
panic(fmt.Errorf("error decoding RawMsgAcknowledgement: %v", err))
}

if !IsPacketMsgTransfer(rawMsg.Packet, &parserParams.TxsResult.Log[parserParams.MsgIndex]) {
// unsupported application
return []command.Command{}, []string{}
}

// Transfer application, MsgTransfer
var rawFungibleTokenPacketData ibc_model.FungibleTokenPacketData
rawPacketData, err := base64_internal.DecodeString(rawMsg.Packet.Data)
Expand Down Expand Up @@ -963,6 +958,11 @@ func ParseMsgAcknowledgement(
)}, possibleSignerAddresses
}

if !IsPacketMsgTransfer(rawMsg.Packet, &parserParams.TxsResult.Log[parserParams.MsgIndex]) {
// unsupported application
return []command.Command{}, []string{}
}

log := utils.NewParsedTxsResultLog(&parserParams.TxsResult.Log[parserParams.MsgIndex])

acknowledgePacketEvents := log.GetEventsByType("acknowledge_packet")
Expand Down Expand Up @@ -1146,11 +1146,6 @@ func ParseMsgTimeout(
panic(fmt.Errorf("error decoding RawMsgTimeout: %v", err))
}

if !IsPacketMsgTransfer(rawMsg.Packet, &parserParams.TxsResult.Log[parserParams.MsgIndex]) {
// unsupported application
return []command.Command{}, []string{}
}

if !parserParams.MsgCommonParams.TxSuccess {
msgTimeoutParams := ibc_model.MsgTimeoutParams{
RawMsgTimeout: rawMsg,
Expand All @@ -1170,6 +1165,11 @@ func ParseMsgTimeout(
)}, possibleSignerAddresses
}

if !IsPacketMsgTransfer(rawMsg.Packet, &parserParams.TxsResult.Log[parserParams.MsgIndex]) {
// unsupported application
return []command.Command{}, []string{}
}

log := utils.NewParsedTxsResultLog(&parserParams.TxsResult.Log[parserParams.MsgIndex])

// Transfer application, MsgTransfer
Expand Down Expand Up @@ -1267,11 +1267,6 @@ func ParseMsgTimeoutOnClose(
panic(fmt.Errorf("error decoding RawMsgTimeoutOnClose: %v", err))
}

if !IsPacketMsgTransfer(rawMsg.Packet, &parserParams.TxsResult.Log[parserParams.MsgIndex]) {
// unsupported application
return []command.Command{}, []string{}
}

if !parserParams.MsgCommonParams.TxSuccess {
msgTimeoutOnCloseParams := ibc_model.MsgTimeoutOnCloseParams{
RawMsgTimeoutOnClose: rawMsg,
Expand All @@ -1291,6 +1286,11 @@ func ParseMsgTimeoutOnClose(
)}, possibleSignerAddresses
}

if !IsPacketMsgTransfer(rawMsg.Packet, &parserParams.TxsResult.Log[parserParams.MsgIndex]) {
// unsupported application
return []command.Command{}, []string{}
}

log := utils.NewParsedTxsResultLog(&parserParams.TxsResult.Log[parserParams.MsgIndex])

// Transfer application, MsgTransfer
Expand Down

0 comments on commit 8992bcd

Please sign in to comment.