-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: icaauth route is not registered correctly
- Loading branch information
Showing
4 changed files
with
190 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import pytest | ||
|
||
from .ibc_utils import ( | ||
funds_ica, | ||
generate_ica_packet, | ||
ibc_transfer_with_hermes, | ||
prepare_network, | ||
wait_for_check_channel_ready, | ||
wait_for_check_tx, | ||
) | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def ibc(request, tmp_path_factory): | ||
"prepare-network" | ||
name = "ibc" | ||
path = tmp_path_factory.mktemp(name) | ||
network = prepare_network(path, name, True) | ||
yield from network | ||
|
||
|
||
def test_ibc_transfer_with_hermes(ibc): | ||
ibc_transfer_with_hermes(ibc) | ||
|
||
|
||
def test_ica(ibc): | ||
connid = "connection-0" | ||
cli_host = ibc.chainmain.cosmos_cli() | ||
cli_controller = ibc.cronos.cosmos_cli() | ||
|
||
print("register ica account") | ||
rsp = cli_controller.ica_register_account( | ||
connid, from_="signer2", gas="400000", fees="100000000basetcro" | ||
) | ||
assert rsp["code"] == 0, rsp["raw_log"] | ||
port_id, channel_id = next( | ||
( | ||
evt["attributes"][0]["value"], | ||
evt["attributes"][1]["value"], | ||
) | ||
for evt in rsp["events"] | ||
if evt["type"] == "channel_open_init" | ||
) | ||
print("port-id", port_id, "channel-id", channel_id) | ||
|
||
wait_for_check_channel_ready(cli_controller, connid, channel_id) | ||
|
||
print("query ica account") | ||
ica_address = cli_controller.ica_query_account( | ||
connid, cli_controller.address("signer2") | ||
)["interchain_account_address"] | ||
print("ica address", ica_address) | ||
|
||
funds_ica(cli_host, ica_address) | ||
num_txs = len(cli_host.query_all_txs(ica_address)["txs"]) | ||
str = generate_ica_packet(cli_controller, ica_address, cli_host.address("signer2")) | ||
# submit transaction on host chain on behalf of interchain account | ||
rsp = cli_controller.ica_submit_tx( | ||
connid, | ||
str, | ||
from_="signer2", | ||
) | ||
assert rsp["code"] == 0, rsp["raw_log"] | ||
packet_seq = next( | ||
int(evt["attributes"][4]["value"]) | ||
for evt in rsp["events"] | ||
if evt["type"] == "send_packet" | ||
) | ||
print("packet sequence", packet_seq) | ||
wait_for_check_tx(cli_host, ica_address, num_txs) | ||
# check if the funds are reduced in interchain account | ||
assert cli_host.balance(ica_address, denom="basecro") == 50000000 |
Oops, something went wrong.