Skip to content

Commit

Permalink
add check for outbound cointype in cctx_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Jan 13, 2025
1 parent 2fb8d5d commit 2045d3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion x/crosschain/types/cctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ func (m *CrossChainTx) AddRevertOutbound(gasLimit uint64) error {
GasLimit: gasLimit,
},
TssPubkey: m.GetCurrentOutboundParam().TssPubkey,
CoinType: m.InboundParams.CoinType,
}

if m.InboundParams != nil {
revertTxParams.CoinType = m.InboundParams.CoinType
}
// The original outbound has been finalized, the new outbound is pending
m.GetCurrentOutboundParam().TxFinalizationStatus = TxFinalizationStatus_Executed
Expand Down
3 changes: 3 additions & 0 deletions x/crosschain/types/cctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func Test_SetRevertOutboundValues(t *testing.T) {
require.Equal(t, cctx.GetCurrentOutboundParam().CallOptions.GasLimit, uint64(100))
require.Equal(t, cctx.GetCurrentOutboundParam().TssPubkey, cctx.OutboundParams[0].TssPubkey)
require.Equal(t, types.TxFinalizationStatus_Executed, cctx.OutboundParams[0].TxFinalizationStatus)
require.Equal(t, cctx.GetCurrentOutboundParam().CoinType, cctx.InboundParams.CoinType)
})

t.Run("successfully set BTC revert address V1", func(t *testing.T) {
Expand All @@ -151,6 +152,7 @@ func Test_SetRevertOutboundValues(t *testing.T) {
require.Equal(t, cctx.GetCurrentOutboundParam().CallOptions.GasLimit, uint64(100))
require.Equal(t, cctx.GetCurrentOutboundParam().TssPubkey, cctx.OutboundParams[0].TssPubkey)
require.Equal(t, types.TxFinalizationStatus_Executed, cctx.OutboundParams[0].TxFinalizationStatus)
require.Equal(t, cctx.GetCurrentOutboundParam().CoinType, cctx.InboundParams.CoinType)
})

t.Run("successfully set EVM revert address V2", func(t *testing.T) {
Expand All @@ -167,6 +169,7 @@ func Test_SetRevertOutboundValues(t *testing.T) {
require.Equal(t, cctx.GetCurrentOutboundParam().CallOptions.GasLimit, uint64(100))
require.Equal(t, cctx.GetCurrentOutboundParam().TssPubkey, cctx.OutboundParams[0].TssPubkey)
require.Equal(t, types.TxFinalizationStatus_Executed, cctx.OutboundParams[0].TxFinalizationStatus)
require.Equal(t, cctx.GetCurrentOutboundParam().CoinType, cctx.InboundParams.CoinType)
})

t.Run("failed to set revert outbound values if revert outbound already exists", func(t *testing.T) {
Expand Down

0 comments on commit 2045d3d

Please sign in to comment.