Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: acknowledgement is not aligned with underlying_app_success #1633

Merged
merged 5 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -252,7 +252,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 @@ -306,6 +305,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 @@ -314,6 +314,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
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
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 @@
if err := k.cdc.UnmarshalJSON(acknowledgement, &ack); err != nil {
return err
}
if !ack.UnderlyingAppSuccess {
yihuang marked this conversation as resolved.
Show resolved Hide resolved
return k.onPacketResult(ctx, packet, false, relayer, contractAddress, packetSenderAddress)

Check warning on line 321 in x/cronos/keeper/keeper.go

View check run for this annotation

Codecov / codecov/patch

x/cronos/keeper/keeper.go#L320-L321

Added lines #L320 - L321 were not covered by tests
}
var res channeltypes.Acknowledgement
if err := k.cdc.UnmarshalJSON(ack.AppAcknowledgement, &res); err != nil {
return err
Expand Down
Loading