Skip to content

Commit

Permalink
check ack if only ack not async
Browse files Browse the repository at this point in the history
  • Loading branch information
gsk967 committed Jan 22, 2025
1 parent 9dfb6f1 commit 87007ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/e2e/e2e_ibc_memo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,11 @@ func (s *E2ETest) testIBCTokenTransferWithMemo(umeeAPIEndpoint string, atomQuota
updatedIBCAtomBalance = updatedIBCAtomBalance.Add(atomFromGaia.Amount)
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, updatedIBCAtomBalance)
s.checkLeverageAccountBalance(umeeAPIEndpoint, accs.Alice.String(), uatomIBCHash, atomFromGaia.Amount)

// ignore ibc forward memo msgs
invalidM := "{\"forward\":{\"channel\":\"channel-123\",\"port\":\"transfer\",\"receiver\":\"secret1xs0xv4h9d2y2fpagyt99vpm3d3f8jxh9kywh6x\",\"retries\":2,\"timeout\":1733978966221063114}}"
s.SendIBC(setup.GaiaChainID, s.Chain.ID, accs.Alice.String(), atomFromGaia, "", invalidM, "")
updatedIBCAtomBalance = updatedIBCAtomBalance.Add(atomFromGaia.Amount)
s.checkSupply(umeeAPIEndpoint, uatomIBCHash, updatedIBCAtomBalance)
s.checkLeverageAccountBalance(umeeAPIEndpoint, accs.Alice.String(), uatomIBCHash, atomFromGaia.Amount)
}
3 changes: 2 additions & 1 deletion x/uibc/uics20/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ func (im ICS20Module) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet,
execCtx, execCtxFlush := transferCtx.CacheContext()

// call transfer module app
// ack is nil if acknowledgement is asynchronous
ack := im.IBCModule.OnRecvPacket(transferCtx, packet, relayer)
if !ack.Success() {
if ack != nil && !ack.Success() {
goto end
}

Expand Down
4 changes: 4 additions & 0 deletions x/uibc/uics20/memo_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ func TestMsgMarshalling(t *testing.T) {
bz = []byte(`{"messages": ["any message"]}`)
memo2, err = deserializeMemo(cdc, bz)
assert.Error(err)

bz = []byte(`"{\"forward\":{\"channel\":\"channel-123\",\"port\":\"transfer\",\"receiver\":\"secret1xs0xv4h9d2y2fpagyt99vpm3d3f8jxh9kywh6x\",\"retries\":2,\"timeout\":1733978966221063114}}"`)
memo2, err = deserializeMemo(cdc, bz)
assert.Error(err)
}

func TestAdjustOperatedCoin(t *testing.T) {
Expand Down

0 comments on commit 87007ee

Please sign in to comment.