Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-nguy committed Jun 2, 2022
1 parent 13492b2 commit bcea008
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
37 changes: 19 additions & 18 deletions integration_tests/test_gravity.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ def get_id_from_receipt(receipt):
"check the id after sendToEthereum call"
for _, log in enumerate(receipt.logs):
if log.topics[0] == HexBytes(
abi.event_signature_to_log_topic(
"__CronosSendToEthereumResponse(uint256)"
)
abi.event_signature_to_log_topic(
"__CronosSendToEthereumResponse(uint256)"
)
):
return log.data
return "0x0000000000000000000000000000000000000000000000000000000000000000"
Expand All @@ -254,8 +254,8 @@ def get_id_from_receipt(receipt):
# __CronosSendToEthereumResponse
assert len(txreceipt.logs) == 3
assert (
get_id_from_receipt(txreceipt)
== "0x0000000000000000000000000000000000000000000000000000000000000001"
get_id_from_receipt(txreceipt)
== "0x0000000000000000000000000000000000000000000000000000000000000001"
), "should be able to get id"
assert txreceipt.status == 1, "should success"
else:
Expand Down Expand Up @@ -323,7 +323,7 @@ def test_gov_token_mapping(gravity):
assert rsp["code"] == 0, rsp["raw_log"]
wait_for_new_blocks(cli, 1)
assert (
int(cli.query_tally(proposal_id)["yes"]) == cli.staking_pool()
int(cli.query_tally(proposal_id)["yes"]) == cli.staking_pool()
), "all validators should have voted yes"
print("wait for proposal to be activated")
wait_for_block_time(cli, isoparse(proposal["voting_end_time"]))
Expand Down Expand Up @@ -427,9 +427,7 @@ def test_gravity_cancel_transfer(gravity):

print("send to cronos crc20")
recipient = HexBytes(ADDRS["community"])
send_to_cosmos(
gravity.contract, erc20, recipient, amount, KEYS["validator"]
)
send_to_cosmos(gravity.contract, erc20, recipient, amount, KEYS["validator"])
assert erc20.caller.balanceOf(ADDRS["validator"]) == balance - amount

denom = f"gravity{erc20.address}"
Expand All @@ -454,19 +452,20 @@ def get_id_from_receipt(receipt):
"check the id after sendToEthereum call"
for _, log in enumerate(receipt.logs):
if log.topics[0] == HexBytes(
abi.event_signature_to_log_topic(
"__CronosSendToEthereumResponse(uint256)"
)
abi.event_signature_to_log_topic(
"__CronosSendToEthereumResponse(uint256)"
)
):
return log.data
return "0x0000000000000000000000000000000000000000000000000000000000000000"

wait_for_fn("send-to-crc20", check_auto_deployment)

def checkFund():
def check_fund():
v = crc20_contract.caller.balanceOf(ADDRS["community"])
return v == amount
wait_for_fn("send-to-ethereum", checkFund)

wait_for_fn("send-to-ethereum", check_fund)

# send it back to erc20
tx = crc20_contract.functions.send_to_ethereum(
Expand All @@ -481,10 +480,11 @@ def checkFund():
tx_id = get_id_from_receipt(txreceipt)
assert txreceipt.status == 1, "should success"

def checkDeduction():
def check_deduction():
v = crc20_contract.caller.balanceOf(ADDRS["community"])
return v == 0
wait_for_fn("check deduction", checkDeduction)

wait_for_fn("check deduction", check_deduction)

# Cancel the send_to_ethereum
canceltx = cancel_contract.functions.cancelTransaction(
Expand All @@ -494,7 +494,8 @@ def checkDeduction():
print("canceltxreceipt", canceltxreceipt)
assert canceltxreceipt.status == 1, "should success"

def checkRefund():
def check_refund():
v = crc20_contract.caller.balanceOf(ADDRS["community"])
return v == amount
wait_for_fn("cancel-send-to-ethereum", checkRefund)

wait_for_fn("cancel-send-to-ethereum", check_refund)
2 changes: 1 addition & 1 deletion x/cronos/keeper/evm_log_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,4 +495,4 @@ func (suite *KeeperTestSuite) TestCancelSendToEthereumHandler() {
}
})
}
}
}

0 comments on commit bcea008

Please sign in to comment.