diff --git a/requirements.txt b/requirements.txt index f67c412..55755fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,4 @@ eth-account==0.9.0 web3==6.11.2 pytest==7.4.3 python-on-whales==0.66.0 +eth-typing==3.5.2 diff --git a/tests/bridge_asset_factory_test.py b/tests/bridge_asset_factory_test.py index 9c95238..242e03c 100644 --- a/tests/bridge_asset_factory_test.py +++ b/tests/bridge_asset_factory_test.py @@ -8,7 +8,7 @@ from tools.peaq_eth_utils import get_contract from tools.peaq_eth_utils import get_eth_chain_id from tools.peaq_eth_utils import calculate_asset_to_evm_address -from tools.peaq_eth_utils import GAS_LIMIT, get_eth_info +from tools.peaq_eth_utils import get_eth_info from tools.constants import KP_GLOBAL_SUDO from tools.peaq_eth_utils import sign_and_submit_evm_transaction from web3 import Web3 @@ -58,9 +58,6 @@ def evm_asset_create(self, contract, eth_kp_src, asset_id, eth_admin, min_balanc nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.create(asset_id, eth_admin.ss58_address, min_balance).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(10, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -123,9 +120,6 @@ def evm_asset_start_destroy(self, contract, eth_kp_src, asset_id): asset_id, ).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(10, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -138,9 +132,6 @@ def evm_asset_finish_destroy(self, contract, eth_kp_src, asset_id): asset_id, ).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(50000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(10, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -153,9 +144,6 @@ def evm_asset_destroy_accounts(self, contract, eth_kp_src, asset_id): asset_id, ).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': 10633039, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(10, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -168,9 +156,6 @@ def evm_asset_destroy_approvals(self, contract, eth_kp_src, asset_id): asset_id, ).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': 10633039, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(1, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -210,9 +195,6 @@ def batch_all_execute(self, eth_kp, addrs, values, calls): [0] * len(addrs) ).build_transaction({ 'from': self._kp_creator['kp'].ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': self._w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': self._w3.to_wei(10, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id }) diff --git a/tests/bridge_balance_erc20_test.py b/tests/bridge_balance_erc20_test.py index bd8090b..242d233 100644 --- a/tests/bridge_balance_erc20_test.py +++ b/tests/bridge_balance_erc20_test.py @@ -10,7 +10,7 @@ from tools.constants import KP_GLOBAL_SUDO from tools.peaq_eth_utils import get_contract from tools.peaq_eth_utils import get_eth_chain_id -from tools.peaq_eth_utils import GAS_LIMIT, get_eth_info +from tools.peaq_eth_utils import get_eth_info from peaq.utils import get_chain from tools.utils import batch_fund from web3 import Web3 @@ -68,9 +68,6 @@ def evm_erc20_transfer(self, contract, eth_kp_src, eth_dst, token_num): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.transfer(eth_dst, token_num).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -81,9 +78,6 @@ def evm_erc20_approval(self, contract, eth_kp_src, eth_approval, token_num): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.approve(eth_approval, token_num).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -94,9 +88,6 @@ def evm_balance_erc20_transfer_from(self, contract, eth_kp, eth_from, eth_to, to nonce = w3.eth.get_transaction_count(eth_kp.ss58_address) tx = contract.functions.transferFrom(eth_from, eth_to, token_num).build_transaction({ 'from': eth_kp.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) diff --git a/tests/bridge_batch_test.py b/tests/bridge_batch_test.py index 4cc9dc1..88525ac 100644 --- a/tests/bridge_batch_test.py +++ b/tests/bridge_batch_test.py @@ -52,9 +52,6 @@ def _fund_eth_account(self): def get_did_calldata(self, eth_kp, addr, contract, key, value): tx = contract.functions.add_attribute(eth_kp.ss58_address, key, value, 1000000).build_transaction({ 'from': eth_kp.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': self.w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': self.w3.to_wei(2, 'gwei'), 'nonce': 0, 'chainId': self.eth_chain_id}) return tx['data'] @@ -76,9 +73,6 @@ def test_batch_all(self): [0, 0], ).build_transaction({ 'from': kp_sign.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': self.w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': self.w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self.eth_chain_id }) @@ -101,6 +95,7 @@ def test_batch_some(self): kp_sign = self.kp_eth['kp'] contract = get_contract(self.w3, BATCH_ADDRESS, ABI_FILE) nonce = self.w3.eth.get_transaction_count(kp_sign.ss58_address) + # We have to setup the fee by ourselves to avoid the fee error tx = contract.functions.batchSome( [Web3.to_checksum_address(STORAGE_ADDRESS), Web3.to_checksum_address(STORAGE_ADDRESS), @@ -136,6 +131,7 @@ def test_batch_some_until_fail(self): kp_sign = self.kp_eth['kp'] contract = get_contract(self.w3, BATCH_ADDRESS, ABI_FILE) nonce = self.w3.eth.get_transaction_count(kp_sign.ss58_address) + # We have to setup the fee by ourselves to avoid the fee error tx = contract.functions.batchSomeUntilFailure( [Web3.to_checksum_address(STORAGE_ADDRESS), Web3.to_checksum_address(STORAGE_ADDRESS), diff --git a/tests/bridge_did_test.py b/tests/bridge_did_test.py index ac1a1f2..35680f0 100644 --- a/tests/bridge_did_test.py +++ b/tests/bridge_did_test.py @@ -13,7 +13,6 @@ import pprint pp = pprint.PrettyPrinter(indent=4) -GAS_LIMIT = 4294967 KEY = generate_random_hex() VALUE = generate_random_hex() @@ -33,9 +32,6 @@ def _eth_add_attribute(self, contract, eth_kp_src, evm_addr, key, value): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.addAttribute(evm_addr, key, value, VALIDITY).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self.eth_chain_id}) @@ -49,9 +45,6 @@ def _eth_update_attribute(self, contract, eth_kp_src, evm_addr, key, value): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.updateAttribute(evm_addr, key, value, VALIDITY).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self.eth_chain_id}) @@ -65,9 +58,6 @@ def _eth_remove_attribute(self, contract, eth_kp_src, evm_addr, key): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.removeAttribute(evm_addr, key).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self.eth_chain_id}) diff --git a/tests/bridge_erc20_test.py b/tests/bridge_erc20_test.py index 3fdccc0..2fada8a 100644 --- a/tests/bridge_erc20_test.py +++ b/tests/bridge_erc20_test.py @@ -8,7 +8,7 @@ from tools.peaq_eth_utils import get_contract from tools.peaq_eth_utils import get_eth_chain_id from tools.peaq_eth_utils import calculate_asset_to_evm_address -from tools.peaq_eth_utils import GAS_LIMIT, get_eth_info +from tools.peaq_eth_utils import get_eth_info from web3 import Web3 @@ -48,9 +48,6 @@ def evm_erc20_transfer(self, contract, eth_kp_src, eth_dst, token_num): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.transfer(eth_dst, token_num).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) diff --git a/tests/bridge_parachain_staking_test.py b/tests/bridge_parachain_staking_test.py index 61801c2..bd6ee50 100644 --- a/tests/bridge_parachain_staking_test.py +++ b/tests/bridge_parachain_staking_test.py @@ -9,7 +9,7 @@ from tools.peaq_eth_utils import get_contract from tools.peaq_eth_utils import get_eth_chain_id # , calculate_evm_default_addr -from tools.peaq_eth_utils import GAS_LIMIT, get_eth_info +from tools.peaq_eth_utils import get_eth_info from tools.evm_claim_sign import calculate_claim_signature, claim_account from tools.constants import KP_GLOBAL_SUDO, KP_COLLATOR from peaq.utils import get_block_hash @@ -66,9 +66,6 @@ def evm_join_delegators(self, contract, eth_kp_src, sub_collator_addr, stake): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.joinDelegators(sub_collator_addr, stake).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': 10633039, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -79,9 +76,6 @@ def evm_delegator_stake_more(self, contract, eth_kp_src, sub_collator_addr, stak nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.delegatorStakeMore(sub_collator_addr, stake).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -92,9 +86,6 @@ def evm_delegator_stake_less(self, contract, eth_kp_src, sub_collator_addr, stak nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.delegatorStakeLess(sub_collator_addr, stake).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -105,9 +96,6 @@ def evm_delegator_leave_delegators(self, contract, eth_kp_src): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.leaveDelegators().build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -118,9 +106,6 @@ def evm_delegator_revoke_delegation(self, contract, eth_kp_src, sub_collator_add nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.revokeDelegation(sub_collator_addr).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -131,9 +116,6 @@ def evm_delegator_unlock_unstaked(self, contract, eth_kp_src, eth_addr): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.unlockUnstaked(eth_addr).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) diff --git a/tests/bridge_rbac_test.py b/tests/bridge_rbac_test.py index f525eae..6f0798b 100644 --- a/tests/bridge_rbac_test.py +++ b/tests/bridge_rbac_test.py @@ -68,9 +68,6 @@ class RbacErrorType(enum.Enum): def _calcualte_evm_basic_req(substrate, w3, addr): return { 'from': addr, - 'gas': 10633039, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': w3.eth.get_transaction_count(addr), 'chainId': get_eth_chain_id(substrate) } diff --git a/tests/bridge_storage_test.py b/tests/bridge_storage_test.py index 33a7b94..fd998fa 100644 --- a/tests/bridge_storage_test.py +++ b/tests/bridge_storage_test.py @@ -31,9 +31,6 @@ def _calcualte_evm_basic_req(substrate, w3, addr): return { 'from': addr, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': w3.eth.get_transaction_count(addr), 'chainId': get_eth_chain_id(substrate) } diff --git a/tests/bridge_vest_test.py b/tests/bridge_vest_test.py index 3781bf1..1c7a39c 100644 --- a/tests/bridge_vest_test.py +++ b/tests/bridge_vest_test.py @@ -36,9 +36,6 @@ def evm_vest_transfer(self, contract, eth_kp_src, evm_dst, number, now): per_block = int(number / VEST_PERIOD) tx = contract.functions.vestedTransfer(evm_dst, int(number), per_block, now).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': 42940, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -49,9 +46,6 @@ def evm_vest(self, contract, eth_kp_src): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.vest().build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': 42940, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) @@ -62,9 +56,6 @@ def evm_vest_other(self, contract, eth_kp_src, evm_dst): nonce = w3.eth.get_transaction_count(eth_kp_src.ss58_address) tx = contract.functions.vestOther(evm_dst).build_transaction({ 'from': eth_kp_src.ss58_address, - 'gas': 42940, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self._eth_chain_id}) diff --git a/tests/bridge_xcmutils_test.py b/tests/bridge_xcmutils_test.py index a59c3dc..5c5f9bf 100644 --- a/tests/bridge_xcmutils_test.py +++ b/tests/bridge_xcmutils_test.py @@ -53,9 +53,9 @@ def setup_sibling_parachain_account(self): chain = get_modified_chain_spec(chain_spec) if chain == 'peaq-dev': self.sibling_parachain_addr = '5HYXs9665LtfnxvBz9FrXCrUGwNTWBrkotqtdFw1VAsYAiiJ' - elif chain == 'krest': + elif chain == 'krest-network': self.sibling_parachain_addr = '5Ex5h1ExXEX3DkLc3gPr7yhCgvUmovLV16A7NATbeJH6UScH' - elif chain == 'peaq': + elif chain == 'peaq-network': self.sibling_parachain_addr = '5HSpy8Hc4ciygtDTHTdj6FKpPvwXDjY8riWMaqDkCgbiHfAx' def _fund_eth_account(self): @@ -205,9 +205,6 @@ def test_xcm_execute(self): encoded_calldata, 20000000000, ).build_transaction({ 'from': kp_sign.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': self.w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': self.w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self.eth_chain_id }) @@ -241,9 +238,6 @@ def test_xcm_send(self): [1, ['0x00'+f'00000{hex(ACA_PD_CHAIN_ID)[2:]}']], encoded_calldata, ).build_transaction({ 'from': kp_sign.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': self.w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': self.w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': self.eth_chain_id }) diff --git a/tests/bridge_xtokens_test.py b/tests/bridge_xtokens_test.py index 717d558..ae970c8 100644 --- a/tests/bridge_xtokens_test.py +++ b/tests/bridge_xtokens_test.py @@ -23,7 +23,7 @@ from tools.peaq_eth_utils import calculate_asset_to_evm_address from web3 import Web3 from tools.peaq_eth_utils import get_contract -from tools.peaq_eth_utils import GAS_LIMIT, get_eth_info +from tools.peaq_eth_utils import get_eth_info from tools.peaq_eth_utils import get_eth_chain_id from tools.asset import wait_for_account_asset_change_wrap from tools.asset import get_tokens_account_from_pallet_assets @@ -143,9 +143,6 @@ def send_xtoken_transfer(w3, eth_chain_id, kp_sign, kp_dst, parachain_id, asset_ [1, ['0x00'+f'00000{hex(parachain_id)[2:]}', f'0x01{kp_dst.public_key.hex()}00']], 10 ** 12).build_transaction({ 'from': kp_sign.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': eth_chain_id }) @@ -163,9 +160,6 @@ def send_xtoken_transfer_multi_asset(w3, eth_chain_id, kp_sign, kp_dst, parachai [1, ['0x00'+f'00000{hex(parachain_id)[2:]}', f'0x01{kp_dst.public_key.hex()}00']], 10 ** 12).build_transaction({ 'from': kp_sign.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': eth_chain_id }) @@ -184,9 +178,6 @@ def send_xtoken_transfer_multi_currencies(w3, eth_chain_id, kp_sign, kp_dst, par [1, ['0x00'+f'00000{hex(parachain_id)[2:]}', f'0x01{kp_dst.public_key.hex()}00']], 10 ** 12).build_transaction({ 'from': kp_sign.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': eth_chain_id }) @@ -205,9 +196,6 @@ def send_xtoken_transfer_multi_assets(w3, eth_chain_id, kp_sign, kp_dst, paracha [1, ['0x00'+f'00000{hex(parachain_id)[2:]}', f'0x01{kp_dst.public_key.hex()}00']], 10 ** 12).build_transaction({ 'from': kp_sign.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': eth_chain_id }) diff --git a/tests/delegator_issue_test.py b/tests/delegator_issue_test.py index 278bbcc..86f4562 100644 --- a/tests/delegator_issue_test.py +++ b/tests/delegator_issue_test.py @@ -86,13 +86,14 @@ def tearDown(self): self.assertTrue(receipt.is_success, 'cannot reset the block reward configuration') def set_collator_delegator_precentage(self): + # If the collator/delegator reward distirbution is less than ED, the collator/delegator cannot receive rewards set_value = { 'treasury_percent': 20000000, 'depin_incentivization_percent': 10000000, - 'collators_delegators_percent': 20000000, + 'collators_delegators_percent': 220000000, 'depin_staking_percent': 50000000, 'coretime_percent': 40000000, - 'subsidization_pool_percent': 860000000, + 'subsidization_pool_percent': 660000000, } receipt = set_block_reward_configuration(self.substrate, set_value) self.assertTrue(receipt.is_success, diff --git a/tests/evm_eth_rpc_test.py b/tests/evm_eth_rpc_test.py index f125450..f0f44a8 100644 --- a/tests/evm_eth_rpc_test.py +++ b/tests/evm_eth_rpc_test.py @@ -39,17 +39,14 @@ def send_eth_token(w3, kp_src, kp_dst, token_num, eth_chain_id): nonce = w3.eth.get_transaction_count(kp_src.ss58_address) - # gas = web3.to_wei(Decimal('0.000000005'), 'ether') - gas = GAS_LIMIT tx = { 'from': kp_src.ss58_address, 'to': kp_dst.ss58_address, 'value': token_num, - 'gas': gas, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, - 'chainId': eth_chain_id + 'chainId': eth_chain_id, + 'gas': GAS_LIMIT, + 'gasPrice': w3.eth.gas_price, } return sign_and_submit_evm_transaction(tx, w3, kp_src) @@ -66,9 +63,6 @@ def call_copy(w3, address, kp_src, eth_chain_id, file_name, data): nonce = w3.eth.get_transaction_count(kp_src.ss58_address) tx = contract.functions.callDatacopy(bytes.fromhex(data)).build_transaction({ 'from': kp_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': eth_chain_id}) diff --git a/tests/pallet_address_unification.py b/tests/pallet_address_unification.py index c6c26ce..434f7c2 100644 --- a/tests/pallet_address_unification.py +++ b/tests/pallet_address_unification.py @@ -12,7 +12,7 @@ from tools.peaq_eth_utils import get_eth_chain_id, calculate_evm_default_addr from peaq.utils import ExtrinsicBatch from tools.peaq_eth_utils import calculate_asset_to_evm_address -from tools.peaq_eth_utils import GAS_LIMIT, get_contract +from tools.peaq_eth_utils import get_contract from peaq.utils import get_account_balance from web3 import Web3 from peaq.eth import calculate_evm_account, calculate_evm_addr @@ -56,9 +56,6 @@ def evm_erc20_trasfer(asset_id, kp_eth_src, kp_eth_dst, amount, eth_chain_id): nonce = w3.eth.get_transaction_count(kp_eth_src.ss58_address) tx = contract.functions.transfer(kp_eth_dst.ss58_address, amount).build_transaction({ 'from': kp_eth_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': eth_chain_id}) @@ -184,11 +181,13 @@ def test_claim_account_erc20(self): self.assertEqual(evm_receipt['status'], 1, f'Error: {evm_receipt}: {evm_receipt["status"]}') # Check - balance = get_asset_balance(self._substrate, kp_sub_src.ss58_address, asset_id)['balance'] + now_block_num = self._substrate.get_block_number(None) + block_hash = self._substrate.get_block_hash(now_block_num) + balance = get_asset_balance(self._substrate, kp_sub_src.ss58_address, asset_id, block_hash)['balance'] self.assertEqual( balance, FUND_NUMBER - transfer_number, f'Balance is not correct, {balance} != {FUND_NUMBER - transfer_number}') - balance = get_asset_balance(self._substrate, kp_sub_dst.ss58_address, asset_id)['balance'] + balance = get_asset_balance(self._substrate, kp_sub_dst.ss58_address, asset_id, block_hash)['balance'] self.assertEqual( balance, transfer_number, f'Balance is not correct, {balance} != {transfer_number}') diff --git a/tests/reward_distribution_test.py b/tests/reward_distribution_test.py index e8dc19b..ff3b93f 100644 --- a/tests/reward_distribution_test.py +++ b/tests/reward_distribution_test.py @@ -86,13 +86,14 @@ def setUp(self): self._collator_percentage = self._get_collator_delegator_precentage() def set_collator_delegator_precentage(self): + # If the collator/delegator reward distirbution is less than ED, the collator/delegator cannot receive rewards set_value = { 'treasury_percent': 20000000, 'depin_incentivization_percent': 10000000, - 'collators_delegators_percent': 20000000, + 'collators_delegators_percent': 220000000, 'depin_staking_percent': 50000000, 'coretime_percent': 40000000, - 'subsidization_pool_percent': 860000000, + 'subsidization_pool_percent': 660000000, } receipt = set_block_reward_configuration(self._substrate, set_value) self.assertTrue(receipt.is_success, diff --git a/tests/xcm_send_test.py b/tests/xcm_send_test.py index f7f8ce5..3364c5e 100644 --- a/tests/xcm_send_test.py +++ b/tests/xcm_send_test.py @@ -38,9 +38,9 @@ def setup_sibling_parachain_account(self): chain = get_modified_chain_spec(chain_spec) if chain == 'peaq-dev': self.sibling_parachain_addr = '5F7JyCFcjQFvSiA3F2Qc6GFiUG4bcTZzrw7qmk654jhEAcBG' - elif chain == 'krest': + elif chain == 'krest-network': self.sibling_parachain_addr = '5GUrLK65TVgmN9AKrGC3bB72QmftqYhp1MhwbXEWQkuSiPQT' - elif chain == 'peaq': + elif chain == 'peaq-network': self.sibling_parachain_addr = '5FKuGfGf4bCFBQkNpLhEStVQGkx8QfDRKEqBbmQmijDj2zTu' def _fund_eth_account(self): diff --git a/tools/evm_sample.py b/tools/evm_sample.py index 85cfced..5e5e95a 100644 --- a/tools/evm_sample.py +++ b/tools/evm_sample.py @@ -14,7 +14,6 @@ BYTECODE_FILE = 'ETH/event_sample/bytecode' ABI_FILE = 'ETH/event_sample/abi' ETH_CHAIN_ID = 9999 -GAS_LIMIT = 4294967 ETH_PRIVATE_KEY = '0xa2899b053679427c8c446dc990c8990c75052fd3009e563c6a613d982d6842fe' @@ -44,9 +43,6 @@ def setup(kp_eth_src): nonce = w3.eth.get_transaction_count(kp_eth_src.ss58_address) tx = contract.functions.test().build_transaction({ 'from': kp_eth_src.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': ETH_CHAIN_ID}) diff --git a/tools/peaq_eth_utils.py b/tools/peaq_eth_utils.py index c854be6..2d18c75 100644 --- a/tools/peaq_eth_utils.py +++ b/tools/peaq_eth_utils.py @@ -62,9 +62,6 @@ def deploy_contract(w3, kp_src, eth_chain_id, abi_file_name, bytecode): abi=abi, bytecode=bytecode).constructor().build_transaction({ 'from': kp_src.ss58_address, - 'gas': 429496, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': eth_chain_id}) diff --git a/tools/uniswap_test_setup.py b/tools/uniswap_test_setup.py index 712e2c3..f8a227f 100644 --- a/tools/uniswap_test_setup.py +++ b/tools/uniswap_test_setup.py @@ -7,7 +7,6 @@ from tools.peaq_eth_utils import get_contract from tools.peaq_eth_utils import calculate_asset_to_evm_address from tools.peaq_eth_utils import get_eth_chain_id -from tools.peaq_eth_utils import GAS_LIMIT from tools.peaq_eth_utils import sign_and_submit_evm_transaction from tools.constants import WS_URL, ETH_URL from substrateinterface import SubstrateInterface, Keypair, KeypairType @@ -43,9 +42,6 @@ def create_asset(substrate, w3, eth_chain_id, contract, owner_kp): nonce = w3.eth.get_transaction_count(owner_kp.ss58_address) tx = contract.functions.create(asset_id, owner_kp.ss58_address, 1000).build_transaction({ 'from': owner_kp.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': eth_chain_id}) @@ -81,9 +77,6 @@ def mint_asset(substrate, w3, eth_chain_id, asset_addr, owner_kp, dest_kp, amoun nonce = w3.eth.get_transaction_count(owner_kp.ss58_address) tx = contract.functions.mint(dest_kp.ss58_address, amount).build_transaction({ 'from': owner_kp.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': eth_chain_id}) @@ -98,9 +91,6 @@ def approval_asset(substrate, w3, eth_chain_id, asset_addr, owner_kp, addr, amou nonce = w3.eth.get_transaction_count(owner_kp.ss58_address) tx = contract.functions.approve(addr, amount).build_transaction({ 'from': owner_kp.ss58_address, - 'gas': GAS_LIMIT, - 'maxFeePerGas': w3.to_wei(21000, 'gwei'), - 'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'), 'nonce': nonce, 'chainId': eth_chain_id})