Skip to content

Commit

Permalink
Merge pull request #74 from peaqnetwork/bug/1207996900912929_evm_adjust
Browse files Browse the repository at this point in the history
Bug/1207996900912929 evm adjust
  • Loading branch information
sfffaaa authored Oct 9, 2024
2 parents ab58141 + c0dd57d commit c5da549
Show file tree
Hide file tree
Showing 24 changed files with 146 additions and 69 deletions.
28 changes: 14 additions & 14 deletions tests/bridge_asset_factory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def _fund_users(self):
'transfer_keep_alive',
{
'dest': self._kp_creator['substrate'],
'value': 100 * 10 ** 18,
'value': 10000 * 10 ** 18,
}
)
batch.compose_call(
'Balances',
'transfer_keep_alive',
{
'dest': self._kp_admin['substrate'],
'value': 100 * 10 ** 18,
'value': 10000 * 10 ** 18,
}
)
batch.execute()
Expand All @@ -59,8 +59,8 @@ def evm_asset_create(self, contract, eth_kp_src, asset_id, eth_admin, min_balanc
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(250, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(10, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})

Expand Down Expand Up @@ -124,8 +124,8 @@ def evm_asset_start_destroy(self, contract, eth_kp_src, asset_id):
).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(10, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})

Expand All @@ -139,8 +139,8 @@ def evm_asset_finish_destroy(self, contract, eth_kp_src, asset_id):
).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'maxFeePerGas': w3.to_wei(50000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(10, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})

Expand All @@ -154,8 +154,8 @@ def evm_asset_destroy_accounts(self, contract, eth_kp_src, asset_id):
).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': 10633039,
'maxFeePerGas': w3.to_wei(300, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(10, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})

Expand All @@ -169,8 +169,8 @@ def evm_asset_destroy_approvals(self, contract, eth_kp_src, asset_id):
).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': 10633039,
'maxFeePerGas': w3.to_wei(300, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(1, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})

Expand Down Expand Up @@ -211,8 +211,8 @@ def batch_all_execute(self, eth_kp, addrs, values, calls):
).build_transaction({
'from': self._kp_creator['kp'].ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': self._w3.to_wei(250, 'gwei'),
'maxPriorityFeePerGas': self._w3.to_wei(2, 'gwei'),
'maxFeePerGas': self._w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': self._w3.to_wei(10, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id
})
Expand Down
6 changes: 3 additions & 3 deletions tests/bridge_balance_erc20_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def evm_erc20_transfer(self, contract, eth_kp_src, eth_dst, token_num):
tx = contract.functions.transfer(eth_dst, token_num).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand All @@ -82,7 +82,7 @@ def evm_erc20_approval(self, contract, eth_kp_src, eth_approval, token_num):
tx = contract.functions.approve(eth_approval, token_num).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand All @@ -95,7 +95,7 @@ def evm_balance_erc20_transfer_from(self, contract, eth_kp, eth_from, eth_to, to
tx = contract.functions.transferFrom(eth_from, eth_to, token_num).build_transaction({
'from': eth_kp.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand Down
8 changes: 4 additions & 4 deletions tests/bridge_batch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ 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(250, 'gwei'),
'maxFeePerGas': self.w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': self.w3.to_wei(2, 'gwei'),
'nonce': 0,
'chainId': self.eth_chain_id})
Expand All @@ -77,7 +77,7 @@ def test_batch_all(self):
).build_transaction({
'from': kp_sign.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': self.w3.to_wei(250, 'gwei'),
'maxFeePerGas': self.w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': self.w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self.eth_chain_id
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_batch_some(self):
).build_transaction({
'from': kp_sign.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': self.w3.to_wei(250, 'gwei'),
'maxFeePerGas': self.w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': self.w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self.eth_chain_id
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_batch_some_until_fail(self):
).build_transaction({
'from': kp_sign.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': self.w3.to_wei(250, 'gwei'),
'maxFeePerGas': self.w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': self.w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self.eth_chain_id
Expand Down
6 changes: 3 additions & 3 deletions tests/bridge_did_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _eth_add_attribute(self, contract, eth_kp_src, evm_addr, key, value):
tx = contract.functions.addAttribute(evm_addr, key, value, VALIDITY).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self.eth_chain_id})
Expand All @@ -50,7 +50,7 @@ def _eth_update_attribute(self, contract, eth_kp_src, evm_addr, key, value):
tx = contract.functions.updateAttribute(evm_addr, key, value, VALIDITY).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self.eth_chain_id})
Expand All @@ -66,7 +66,7 @@ def _eth_remove_attribute(self, contract, eth_kp_src, evm_addr, key):
tx = contract.functions.removeAttribute(evm_addr, key).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self.eth_chain_id})
Expand Down
2 changes: 1 addition & 1 deletion tests/bridge_erc20_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def evm_erc20_transfer(self, contract, eth_kp_src, eth_dst, token_num):
tx = contract.functions.transfer(eth_dst, token_num).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand Down
12 changes: 6 additions & 6 deletions tests/bridge_parachain_staking_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def evm_join_delegators(self, contract, eth_kp_src, sub_collator_addr, stake):
tx = contract.functions.joinDelegators(sub_collator_addr, stake).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': 10633039,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand All @@ -80,7 +80,7 @@ def evm_delegator_stake_more(self, contract, eth_kp_src, sub_collator_addr, stak
tx = contract.functions.delegatorStakeMore(sub_collator_addr, stake).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand All @@ -93,7 +93,7 @@ def evm_delegator_stake_less(self, contract, eth_kp_src, sub_collator_addr, stak
tx = contract.functions.delegatorStakeLess(sub_collator_addr, stake).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand All @@ -106,7 +106,7 @@ def evm_delegator_leave_delegators(self, contract, eth_kp_src):
tx = contract.functions.leaveDelegators().build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand All @@ -119,7 +119,7 @@ def evm_delegator_revoke_delegation(self, contract, eth_kp_src, sub_collator_add
tx = contract.functions.revokeDelegation(sub_collator_addr).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand All @@ -132,7 +132,7 @@ def evm_delegator_unlock_unstaked(self, contract, eth_kp_src, eth_addr):
tx = contract.functions.unlockUnstaked(eth_addr).build_transaction({
'from': eth_kp_src.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand Down
4 changes: 2 additions & 2 deletions tests/bridge_rbac_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def _calcualte_evm_basic_req(substrate, w3, addr):
return {
'from': addr,
'gas': 10633039,
'maxFeePerGas': w3.to_wei(300, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(250, 'gwei'),
'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)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/bridge_storage_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _calcualte_evm_basic_req(substrate, w3, addr):
return {
'from': addr,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'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)
Expand Down
12 changes: 6 additions & 6 deletions tests/bridge_vest_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ 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': 10633039,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'gas': 42940,
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand All @@ -49,8 +49,8 @@ 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': 10633039,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'gas': 42940,
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand All @@ -62,8 +62,8 @@ 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': 10633039,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'gas': 42940,
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self._eth_chain_id})
Expand Down
9 changes: 5 additions & 4 deletions tests/bridge_xcmutils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from tools.constants import ACA_PD_CHAIN_ID
from tools.runtime_upgrade import wait_until_block_height
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 substrateinterface import SubstrateInterface, Keypair
from peaq.utils import ExtrinsicBatch
Expand All @@ -20,6 +20,7 @@
import pytest


GAS_LIMIT = 10633039
ABI_FILE = 'ETH/xcmutils/abi'
XCMUTILS_ADDRESS = '0x0000000000000000000000000000000000000804'

Expand Down Expand Up @@ -65,7 +66,7 @@ def _fund_eth_account(self):
'transfer_keep_alive',
{
'dest': self.kp_eth['substrate'],
'value': 100 * 10 ** 18,
'value': 1000 * 10 ** 18,
}
)
batch.execute()
Expand Down Expand Up @@ -205,7 +206,7 @@ def test_xcm_execute(self):
).build_transaction({
'from': kp_sign.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': self.w3.to_wei(250, 'gwei'),
'maxFeePerGas': self.w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': self.w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self.eth_chain_id
Expand Down Expand Up @@ -241,7 +242,7 @@ def test_xcm_send(self):
).build_transaction({
'from': kp_sign.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': self.w3.to_wei(250, 'gwei'),
'maxFeePerGas': self.w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': self.w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': self.eth_chain_id
Expand Down
8 changes: 4 additions & 4 deletions tests/bridge_xtokens_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def send_xtoken_transfer(w3, eth_chain_id, kp_sign, kp_dst, parachain_id, asset_
10 ** 12).build_transaction({
'from': kp_sign.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': eth_chain_id
Expand All @@ -164,7 +164,7 @@ def send_xtoken_transfer_multi_asset(w3, eth_chain_id, kp_sign, kp_dst, parachai
10 ** 12).build_transaction({
'from': kp_sign.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': eth_chain_id
Expand All @@ -185,7 +185,7 @@ def send_xtoken_transfer_multi_currencies(w3, eth_chain_id, kp_sign, kp_dst, par
10 ** 12).build_transaction({
'from': kp_sign.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': eth_chain_id
Expand All @@ -206,7 +206,7 @@ def send_xtoken_transfer_multi_assets(w3, eth_chain_id, kp_sign, kp_dst, paracha
10 ** 12).build_transaction({
'from': kp_sign.ss58_address,
'gas': GAS_LIMIT,
'maxFeePerGas': w3.to_wei(250, 'gwei'),
'maxFeePerGas': w3.to_wei(21000, 'gwei'),
'maxPriorityFeePerGas': w3.to_wei(2, 'gwei'),
'nonce': nonce,
'chainId': eth_chain_id
Expand Down
Loading

0 comments on commit c5da549

Please sign in to comment.