Skip to content

Commit

Permalink
Problem: acknowledgement is not aligned with underlying_app_success (#…
Browse files Browse the repository at this point in the history
…1633)

* Problem: no easy way to detect error ack packet

check underlying_app_success

* test

* Update CHANGELOG.md

Signed-off-by: mmsqe <[email protected]>

* Update x/cronos/keeper/keeper.go

Co-authored-by: mmsqe <[email protected]>
Signed-off-by: yihuang <[email protected]>

---------

Signed-off-by: mmsqe <[email protected]>
Signed-off-by: yihuang <[email protected]>
Co-authored-by: yihuang <[email protected]>
  • Loading branch information
mmsqe and yihuang authored Oct 14, 2024
1 parent 18c337a commit 8425423
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* [#1617](https://github.com/crypto-org-chain/cronos/pull/1617) Fix unsuppored sign mode SIGN_MODE_TEXTUAL for bank transfer.
* [#1621](https://github.com/crypto-org-chain/cronos/pull/1621), [1630](https://github.com/crypto-org-chain/cronos/pull/1630) Update ethermint to the fix of broken opBlockhash and tx validation.
* [#1623](https://github.com/crypto-org-chain/cronos/pull/1623) Ensure expedited related gov params pass the basic validation.
* [#1633](https://github.com/crypto-org-chain/cronos/pull/1633) Align acknowledgement with underlying_app_success when ack packet does not succeed.

*Sep 13, 2024*

Expand Down
23 changes: 22 additions & 1 deletion integration_tests/test_ica_precompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ def test_sc_call(ibc, order):
signer=signer,
contract_addr=contract_addr,
)
balance = funds_ica(cli_host, ica_address, signer=signer)
assert tcontract.caller.getAccount() == addr
assert (
tcontract.functions.callQueryAccount(connid, contract_addr).call()
Expand Down Expand Up @@ -307,6 +306,7 @@ def submit_msgs_ro(func, str):
expected_seq,
contract.events.SubmitMsgsResult,
channel_id,
need_wait=False,
signer=signer,
)
submit_msgs_ro(tcontract.functions.delegateSubmitMsgs, str)
Expand All @@ -315,6 +315,27 @@ def submit_msgs_ro(func, str):
wait_for_status_change(tcontract, channel_id, last_seq)
status = tcontract.caller.getStatus(channel_id, last_seq)
assert expected_seq == last_seq
assert status == Status.FAIL
wait_for_packet_log(start, packet_event, channel_id, last_seq, status)

expected_seq += 1
balance = funds_ica(cli_host, ica_address, signer=signer)
start = w3.eth.get_block_number()
str, diff = submit_msgs(
ibc,
tcontract.functions.callSubmitMsgs,
data,
ica_address,
False,
expected_seq,
contract.events.SubmitMsgsResult,
channel_id,
signer=signer,
)
last_seq = tcontract.caller.getLastSeq()
wait_for_status_change(tcontract, channel_id, last_seq)
status = tcontract.caller.getStatus(channel_id, last_seq)
assert expected_seq == last_seq
assert status == Status.SUCCESS
wait_for_packet_log(start, packet_event, channel_id, last_seq, status)
balance -= diff
Expand Down
3 changes: 3 additions & 0 deletions x/cronos/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ func (k Keeper) IBCOnAcknowledgementPacketCallback(
if err := k.cdc.UnmarshalJSON(acknowledgement, &ack); err != nil {
return err
}
if !ack.Success() {
return k.onPacketResult(ctx, packet, false, relayer, contractAddress, packetSenderAddress)
}
var res channeltypes.Acknowledgement
if err := k.cdc.UnmarshalJSON(ack.AppAcknowledgement, &res); err != nil {
return err
Expand Down

0 comments on commit 8425423

Please sign in to comment.