diff --git a/integration_tests/configs/ibc.jsonnet b/integration_tests/configs/ibc.jsonnet index d63860e654..2501cf43d7 100644 --- a/integration_tests/configs/ibc.jsonnet +++ b/integration_tests/configs/ibc.jsonnet @@ -12,7 +12,7 @@ config { name: 'user' + i, coins: '30000000000000000000000basetcro', } - for i in std.range(1, 20) + for i in std.range(1, 2) ], 'app-config'+: { 'index-events': super['index-events'] + ['message.action'], @@ -87,7 +87,7 @@ config { name: 'user' + i, coins: '10000000000000cro', } - for i in std.range(1, 20) + for i in std.range(1, 2) ], genesis: { app_state: { diff --git a/integration_tests/configs/ibc_rly_evm.jsonnet b/integration_tests/configs/ibc_rly_evm.jsonnet index ac77fde468..6c835a91cc 100644 --- a/integration_tests/configs/ibc_rly_evm.jsonnet +++ b/integration_tests/configs/ibc_rly_evm.jsonnet @@ -3,7 +3,7 @@ local ibc = import 'ibc_rly.jsonnet'; ibc { relayer+: { chains: [super.chains[0] { - precompiled_contract_address: '0x0000000000000000000000000000000000000065', + precompiled_contract_address: '0x6F1805D56bF05b7be10857F376A5b1c160C8f72C', json_rpc_address: 'http://127.0.0.1:26701', }] + super.chains[1:], }, diff --git a/integration_tests/contracts/contracts/TestRelayer.sol b/integration_tests/contracts/contracts/TestRelayer.sol new file mode 100644 index 0000000000..663b02e65f --- /dev/null +++ b/integration_tests/contracts/contracts/TestRelayer.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +contract TestRelayer { + address constant relayer = 0x0000000000000000000000000000000000000065; + + function batchCall(bytes[] memory payloads) public { + for (uint256 i = 0; i < payloads.length; i++) { + (bool success,) = relayer.call(payloads[i]); + require(success); + } + } +} diff --git a/integration_tests/ibc_utils.py b/integration_tests/ibc_utils.py index ec04207396..a002132329 100644 --- a/integration_tests/ibc_utils.py +++ b/integration_tests/ibc_utils.py @@ -14,6 +14,7 @@ ADDRS, CONTRACTS, deploy_contract, + derive_new_account, eth_to_bech32, parse_events, parse_events_rpc, @@ -180,6 +181,17 @@ def prepare_network( version, ) else: + w3 = cronos.w3 + acc = derive_new_account(2) + sender = acc.address + # fund new sender to deploy contract with same address + if w3.eth.get_balance(sender, "latest") == 0: + fund = 3000000000000000000 + tx = {"to": sender, "value": fund, "gasPrice": w3.eth.gas_price} + 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 call_rly_cmd(path, connection_only, version) if incentivized: @@ -333,7 +345,7 @@ def get_balances(chain, addr): def ibc_multi_transfer(ibc): chains = [ibc.cronos.cosmos_cli(), ibc.chainmain.cosmos_cli()] - users = [f"user{i}" for i in range(1, 21)] + users = [f"user{i}" for i in range(1, 3)] addrs0 = [chains[0].address(user) for user in users] addrs1 = [chains[1].address(user) for user in users] denom0 = "basetcro" @@ -456,7 +468,7 @@ def ibc_incentivized_transfer(ibc): def check_fee(): amount = chains[0].balance(relayer, fee_denom) if amount > old_amt_fee: - assert amount == old_amt_fee + 20 + assert amount == old_amt_fee + 20, amount return True else: return False diff --git a/integration_tests/test_ibc_rly.py b/integration_tests/test_ibc_rly.py index 73b624d196..908455dccc 100644 --- a/integration_tests/test_ibc_rly.py +++ b/integration_tests/test_ibc_rly.py @@ -11,11 +11,11 @@ cronos_transfer_source_tokens, cronos_transfer_source_tokens_with_proxy, get_balance, - hermes_transfer, ibc_denom, ibc_incentivized_transfer, ibc_multi_transfer, prepare_network, + rly_transfer, ) from .utils import ( ADDRS, @@ -54,7 +54,7 @@ def ibc(request, tmp_path_factory): yield from prepare_network( path, name, - relayer=cluster.Relayer.HERMES.value, + relayer=cluster.Relayer.RLY.value, ) @@ -230,7 +230,7 @@ def test_ibc(ibc): w3 = ibc.cronos.w3 wait_for_new_blocks(ibc.cronos.cosmos_cli(), 1) start = w3.eth.get_block_number() - hermes_transfer(ibc) + rly_transfer(ibc) denom = ibc_denom(channel, src_denom) dst_addr = eth_to_bech32(cronos_signer2) old_dst_balance = get_balance(ibc.cronos, dst_addr, dst_denom) diff --git a/integration_tests/utils.py b/integration_tests/utils.py index 3dd6bf190b..f707bcee0e 100644 --- a/integration_tests/utils.py +++ b/integration_tests/utils.py @@ -59,6 +59,7 @@ "CosmosERC20": "CosmosToken.sol", "TestBank": "TestBank.sol", "TestICA": "TestICA.sol", + "TestRelayer": "TestRelayer.sol", } @@ -397,6 +398,13 @@ def cronos_address_from_mnemonics(mnemonics, prefix=CRONOS_ADDRESS_PREFIX): return eth_to_bech32(acct.address, prefix) +def derive_new_account(n=1): + # derive a new address + account_path = f"m/44'/60'/0'/0/{n}" + mnemonic = os.getenv("COMMUNITY_MNEMONIC") + return Account.from_mnemonic(mnemonic, account_path=account_path) + + def send_to_cosmos(gravity_contract, token_contract, w3, recipient, amount, key=None): """ do approve and sendToCronos on ethereum side