Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Mar 22, 2024
1 parent ce95382 commit 448f9c4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
12 changes: 7 additions & 5 deletions integration_tests/ibc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
)

RATIO = 10**10
RELAYER_CALLER = "0x6F1805D56bF05b7be10857F376A5b1c160C8f72C"


class Status(IntEnum):
Expand Down Expand Up @@ -191,7 +192,7 @@ def prepare_network(
send_transaction(w3, tx)
assert w3.eth.get_balance(sender, "latest") == fund
caller = deploy_contract(w3, CONTRACTS["TestRelayer"], key=acc.key).address
assert caller == "0x6F1805D56bF05b7be10857F376A5b1c160C8f72C", caller
assert caller == RELAYER_CALLER, caller
call_rly_cmd(path, connection_only, version)

if incentivized:
Expand Down Expand Up @@ -428,6 +429,7 @@ def ibc_incentivized_transfer(ibc):
amount = 1000
fee_denom = "ibcfee"
base_denom = "basetcro"
caller = eth_to_bech32(RELAYER_CALLER)

Check failure on line 432 in integration_tests/ibc_utils.py

View workflow job for this annotation

GitHub Actions / Lint python

./integration_tests/ibc_utils.py:432:5: F841 local variable 'caller' is assigned to but never used
old_amt_fee = chains[0].balance(relayer, fee_denom)
old_amt_sender_fee = chains[0].balance(sender, fee_denom)
old_amt_sender_base = chains[0].balance(sender, base_denom)
Expand Down Expand Up @@ -456,19 +458,19 @@ def ibc_incentivized_transfer(ibc):
src_channel,
packet_seq,
recv_fee=fee,
ack_fee=fee,
# ack_fee=fee,
timeout_fee=fee,
from_=sender,
)
assert rsp["code"] == 0, rsp["raw_log"]
# fee is locked
assert chains[0].balance(sender, fee_denom) == old_amt_sender_fee - 30
assert chains[0].balance(sender, fee_denom) == old_amt_sender_fee - 20

# wait for relayer receive the fee
def check_fee():
amount = chains[0].balance(relayer, fee_denom)
if amount > old_amt_fee:
assert amount == old_amt_fee + 20, amount
assert amount == old_amt_fee + 10, amount
return True
else:
return False
Expand All @@ -479,7 +481,7 @@ def check_fee():
actual = get_balances(ibc.cronos, sender)
assert actual == [
{"denom": base_denom, "amount": f"{old_amt_sender_base - amount}"},
{"denom": fee_denom, "amount": f"{old_amt_sender_fee - 20}"},
{"denom": fee_denom, "amount": f"{old_amt_sender_fee - 10}"},
], actual
path = f"transfer/{dst_channel}/{base_denom}"
denom_hash = hashlib.sha256(path.encode()).hexdigest().upper()
Expand Down
7 changes: 5 additions & 2 deletions integration_tests/test_ibc_rly.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from .ibc_utils import (
RATIO,
RELAYER_CALLER,
assert_duplicate,
cronos_transfer_source_tokens,
cronos_transfer_source_tokens_with_proxy,
Expand Down Expand Up @@ -59,6 +60,8 @@ def ibc(request, tmp_path_factory):


def amount_dict(amt, denom):
if amt == 0:
return []
return [
AttributeDict(
{
Expand Down Expand Up @@ -298,8 +301,8 @@ def test_ibc_incentivized_transfer(ibc):
acknowledge_packet(seq0),
distribute_fee(src_relayer, fee),
*send_coins(feeibc_addr, src_relayer, src_amount, fee_denom),
distribute_fee(src_relayer, fee),
*send_coins(feeibc_addr, src_relayer, src_amount, fee_denom),
distribute_fee(RELAYER_CALLER, ""),
*send_coins(feeibc_addr, RELAYER_CALLER, 0, ""),
distribute_fee(cronos_signer2, fee),
*send_coins(feeibc_addr, cronos_signer2, src_amount, fee_denom),
fungible(checksum_dst_adr, cronos_signer2, amount, dst_denom),
Expand Down
8 changes: 4 additions & 4 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@
"relayer": {
"branch": "main",
"description": "An IBC relayer for ibc-go",
"homepage": "https://github.com/crypto-org-chain/relayer",
"homepage": "https://github.com/mmsqe/relayer",
"owner": "crypto-org-chain",
"repo": "relayer",
"rev": "bd88a2cba9154450924837ecda915688ff8f9e04",
"sha256": "106mf4mc2ag4a5d21lcqpsq7ixvq70097jglw862jz4g9lbxyv8f",
"rev": "baa9a467d7d533eb65acbd91ca9e2cdfd22be15d",
"sha256": "0rzvr3px3adq6q9v4v4676jvlkz9zngxmzikpkli4p6sc62lxph3",
"type": "tarball",
"url": "https://github.com/crypto-org-chain/relayer/archive/bd88a2cba9154450924837ecda915688ff8f9e04.tar.gz",
"url": "https://github.com/mmsqe/relayer/archive/baa9a467d7d533eb65acbd91ca9e2cdfd22be15d.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

0 comments on commit 448f9c4

Please sign in to comment.