From 7d0d0f8f2d8c29a1f64a271ff81b71f5fb888df4 Mon Sep 17 00:00:00 2001 From: Moray Grieve Date: Tue, 27 Jan 2026 17:27:12 +0000 Subject: [PATCH 1/6] Add weth l1 and l2 addresses --- .default.properties | 15 ++++++++++----- src/python/ten/test/contracts/weth.py | 6 +++--- src/python/ten/test/utils/bridge.py | 5 +++-- src/python/ten/test/utils/properties.py | 4 +++- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.default.properties b/.default.properties index 48ec2d04..6ec7b9a0 100644 --- a/.default.properties +++ b/.default.properties @@ -165,7 +165,8 @@ Validator2Address = 0xf3549165e6AE699B73349dd81a69d005d0add92a L1DeployerAddress = 0x5EE3113aA489A61c5E17cC17f09a10218498b9BC FaucetAddress = L2GasPaymentAddress = -WethContractAddress = 1000000000000000000000000000000000000042 +L2WethContractAddress = 1000000000000000000000000000000000000042 +L1WethContractAddress = 1000000000000000000000000000000000000042 L1Abstraction = TenL1Ethereum L1NodeHostHTTP = http://l1.mainnet.ten.xyz L1NodeHostWS = ws://l1.mainnet.ten.xyz @@ -202,7 +203,8 @@ Validator2Address = 0xF7E8fb5b78dA9e37F1Ed210196e5EddbB7f868Fd L1DeployerAddress = 0x5555E184dDC7de1A1fD0FF237CcA77338cE7162D FaucetAddress = 0xA58C60cc047592DE97BF1E8d2f225Fc5D959De77 L2GasPaymentAddress = -WethContractAddress = 1000000000000000000000000000000000000042 +L2WethContractAddress = 1000000000000000000000000000000000000042 +L1WethContractAddress = 1000000000000000000000000000000000000042 L1Abstraction = TenL1Sepolia L1NodeHostHTTP = https://eth-sepolia.g.alchemy.com/v2 L1NodeHostWS = wss://eth-sepolia.g.alchemy.com/v2 @@ -239,7 +241,8 @@ Validator1Address = 0x53D3015D0D8Fc5Ad68484866Bb9Ae60ebb5277cb Validator2Address = 0x274Ab98679e3fb2e05a1E22c6A6fBF8fbe6515B1 L1DeployerAddress = 0xD35CE8575dC1816e560E16534eB7ea5D368255B7 L2GasPaymentAddress = -WethContractAddress = 1000000000000000000000000000000000000042 +L2WethContractAddress = 1000000000000000000000000000000000000042 +L1WethContractAddress = 1000000000000000000000000000000000000042 # uncomment if using geth as the L1 #L1Abstraction = TenL1Geth #L1NodeHostHTTP = http://uat-testnet-eth2network.uksouth.cloudapp.azure.com @@ -281,7 +284,8 @@ SequencerAddress = Validator1Address = Validator2Address = L2GasPaymentAddress = -WethContractAddress = 1000000000000000000000000000000000000042 +L2WethContractAddress = 1000000000000000000000000000000000000042 +L1WethContractAddress = 1000000000000000000000000000000000000042 L1DeployerAddress = L1Abstraction = TenL1Geth L1NodeHostHTTP = http://dev-testnet-eth2network-522.uksouth.cloudapp.azure.com @@ -318,7 +322,8 @@ SequencerAddress = Validator1Address = Validator2Address = L2GasPaymentAddress = -WethContractAddress = 1000000000000000000000000000000000000042 +L2WethContractAddress = 1000000000000000000000000000000000000042 +L1WethContractAddress = 1000000000000000000000000000000000000042 L1DeployerAddress = L1Abstraction = TenL1Geth L1NodeHostHTTP = http://127.0.0.1 diff --git a/src/python/ten/test/contracts/weth.py b/src/python/ten/test/contracts/weth.py index 131b7a68..6f115855 100644 --- a/src/python/ten/test/contracts/weth.py +++ b/src/python/ten/test/contracts/weth.py @@ -1,19 +1,19 @@ import os.path, json from pysys.constants import * -from ten.test.utils.properties import Properties class WETH: GAS_LIMIT = 3_000_000 - def __init__(self, test, web3): + def __init__(self, test, web3, address): self.test = test self.web3 = web3 self.name = 'WETH' self.symbol = 'WETH' - self.address = web3.to_checksum_address(Properties().weth_contract_address(test.env)) + self.address = address self.abi_path = os.path.join(PROJECT.root, 'src', 'solidity', 'contracts', 'weth', 'weth.json') with open(self.abi_path, 'r') as fp: self.abi = json.load(fp) self.contract = self.web3.eth.contract(address=self.address, abi=self.abi) +#web3.to_checksum_address(Properties().l1_weth_contract_address(test.env)) \ No newline at end of file diff --git a/src/python/ten/test/utils/bridge.py b/src/python/ten/test/utils/bridge.py index df1b7e0c..65a8a839 100644 --- a/src/python/ten/test/utils/bridge.py +++ b/src/python/ten/test/utils/bridge.py @@ -1,5 +1,6 @@ import time, os, rlp from web3._utils.events import EventLogErrorFlags +from ten.test.utils.properties import Properties from ten.test.contracts.erc20 import ERC20Token from ten.test.contracts.weth import WETH from ten.test.contracts.bridge import WrappedERC20 @@ -85,7 +86,7 @@ def __init__(self, test, pk, name, check_funds=True): xchain = L1CrossChainMessenger(test, web3) self.management = CrossChainManagement(test, web3) super().__init__(test, web3, account, network, bridge, bus, xchain, name) - self.tokens = {'WETH': WETH(self.test, self.web3)} + self.tokens = {'WETH': WETH(self.test, self.web3, web3.to_checksum_address(Properties().l1_weth_contract_address(test.env)))} def add_token_contract(self, address, name, symbol): """Store a reference to the ERC20 token, keyed on its symbol. """ @@ -223,7 +224,7 @@ def __init__(self, test, pk, name, check_funds=True): bus = L2MessageBus(test, web3) xchain = L2CrossChainMessenger(test, web3) super().__init__(test, web3, account, network, bridge, bus, xchain, name) - self.tokens = {'WETH': WETH(self.test, self.web3)} + self.tokens = {'WETH': WETH(self.test, self.web3, web3.to_checksum_address(Properties().l2_weth_contract_address(test.env)))} def set_token_contract(self, address, name, symbol): """Store a reference to the ERC20 token, keyed on its symbol. """ diff --git a/src/python/ten/test/utils/properties.py b/src/python/ten/test/utils/properties.py index 7d8c1c84..4d8dd917 100644 --- a/src/python/ten/test/utils/properties.py +++ b/src/python/ten/test/utils/properties.py @@ -186,7 +186,9 @@ def validator1_address(self, key): return self.get('env.' + key, 'Validator1Addr def validator2_address(self, key): return self.get('env.' + key, 'Validator2Address') - def weth_contract_address(self, key): return self.get('env.' + key, 'WethContractAddress') + def l2_weth_contract_address(self, key): return self.get('env.' + key, 'L2WethContractAddress') + + def l1_weth_contract_address(self, key): return self.get('env.' + key, 'L1WethContractAddress') def l1_deployer_address(self, key): return self.get('env.'+key, 'L1DeployerAddress') From 99e5f2e39b8641a2cbf1aa12b266d35e7eb87053 Mon Sep 17 00:00:00 2001 From: Moray Grieve Date: Tue, 27 Jan 2026 17:29:24 +0000 Subject: [PATCH 2/6] Sepolia weth address --- .default.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.default.properties b/.default.properties index 6ec7b9a0..3333cab5 100644 --- a/.default.properties +++ b/.default.properties @@ -204,7 +204,7 @@ L1DeployerAddress = 0x5555E184dDC7de1A1fD0FF237CcA77338cE7162D FaucetAddress = 0xA58C60cc047592DE97BF1E8d2f225Fc5D959De77 L2GasPaymentAddress = L2WethContractAddress = 1000000000000000000000000000000000000042 -L1WethContractAddress = 1000000000000000000000000000000000000042 +L1WethContractAddress = 7b79995e5f793A07Bc00c21412e50Ecae098E7f9 L1Abstraction = TenL1Sepolia L1NodeHostHTTP = https://eth-sepolia.g.alchemy.com/v2 L1NodeHostWS = wss://eth-sepolia.g.alchemy.com/v2 @@ -242,7 +242,7 @@ Validator2Address = 0x274Ab98679e3fb2e05a1E22c6A6fBF8fbe6515B1 L1DeployerAddress = 0xD35CE8575dC1816e560E16534eB7ea5D368255B7 L2GasPaymentAddress = L2WethContractAddress = 1000000000000000000000000000000000000042 -L1WethContractAddress = 1000000000000000000000000000000000000042 +L1WethContractAddress = 7b79995e5f793A07Bc00c21412e50Ecae098E7f9 # uncomment if using geth as the L1 #L1Abstraction = TenL1Geth #L1NodeHostHTTP = http://uat-testnet-eth2network.uksouth.cloudapp.azure.com From 8a1237b190617bd559b4c439bbe3a942adc14132 Mon Sep 17 00:00:00 2001 From: Moray Grieve Date: Tue, 27 Jan 2026 17:39:00 +0000 Subject: [PATCH 3/6] Use address --- src/python/ten/test/contracts/weth.py | 2 -- tests/network/ten/ten_cor_047/run.py | 11 +++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/python/ten/test/contracts/weth.py b/src/python/ten/test/contracts/weth.py index 6f115855..8c7e7581 100644 --- a/src/python/ten/test/contracts/weth.py +++ b/src/python/ten/test/contracts/weth.py @@ -15,5 +15,3 @@ def __init__(self, test, web3, address): with open(self.abi_path, 'r') as fp: self.abi = json.load(fp) self.contract = self.web3.eth.contract(address=self.address, abi=self.abi) - -#web3.to_checksum_address(Properties().l1_weth_contract_address(test.env)) \ No newline at end of file diff --git a/tests/network/ten/ten_cor_047/run.py b/tests/network/ten/ten_cor_047/run.py index 3c136fbc..0d9aad90 100644 --- a/tests/network/ten/ten_cor_047/run.py +++ b/tests/network/ten/ten_cor_047/run.py @@ -1,5 +1,6 @@ from ten.test.basetest import TenNetworkTest from ten.test.contracts.weth import WETH +from ten.test.utils.properties import Properties class PySysTest(TenNetworkTest): @@ -9,16 +10,18 @@ def execute(self): if self.is_local_ten(): network = self.get_l1_network_connection() web3, account = network.connect_account1(self) - self.run_for_network(network, web3, account, persist_nonce=False) + address = web3.to_checksum_address(Properties().l1_weth_contract_address(self.env)) + self.run_for_network(network, web3, account, address, persist_nonce=False) # run on the l2 network = self.get_network_connection() web3, account = network.connect_account1(self) - self.run_for_network(network, web3, account, persist_nonce=True) + address = web3.to_checksum_address(Properties().l2_weth_contract_address(self.env)) + self.run_for_network(network, web3, account, address, persist_nonce=True) - def run_for_network(self, network, web3, account, persist_nonce): + def run_for_network(self, network, web3, account, address, persist_nonce): # create an instance of the weth contract wrapper and check it is deployed - weth = WETH(self, web3) + weth = WETH(self, web3, address) self.log.info('Contract address is %s' % weth.address) code = web3.eth.get_code(weth.address) From 47081c82924f960c2f8e319958765179c0238091 Mon Sep 17 00:00:00 2001 From: Moray Grieve Date: Thu, 29 Jan 2026 11:19:35 +0000 Subject: [PATCH 4/6] Updated to run on the L1 for all environments --- tests/network/ten/ten_cor_047/run.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/network/ten/ten_cor_047/run.py b/tests/network/ten/ten_cor_047/run.py index 0d9aad90..ccefd7f3 100644 --- a/tests/network/ten/ten_cor_047/run.py +++ b/tests/network/ten/ten_cor_047/run.py @@ -7,11 +7,10 @@ class PySysTest(TenNetworkTest): def execute(self): # run on the l1 - if self.is_local_ten(): - network = self.get_l1_network_connection() - web3, account = network.connect_account1(self) - address = web3.to_checksum_address(Properties().l1_weth_contract_address(self.env)) - self.run_for_network(network, web3, account, address, persist_nonce=False) + network = self.get_l1_network_connection() + web3, account = network.connect_account1(self) + address = web3.to_checksum_address(Properties().l1_weth_contract_address(self.env)) + self.run_for_network(network, web3, account, address, persist_nonce=False) # run on the l2 network = self.get_network_connection() From a00c3dd6bb535668acea2a45d57a9d4a85e9fed8 Mon Sep 17 00:00:00 2001 From: Moray Grieve Date: Thu, 29 Jan 2026 11:28:17 +0000 Subject: [PATCH 5/6] Add some waits --- tests/network/ten/ten_cor_047/run.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/network/ten/ten_cor_047/run.py b/tests/network/ten/ten_cor_047/run.py index ccefd7f3..074c0ecb 100644 --- a/tests/network/ten/ten_cor_047/run.py +++ b/tests/network/ten/ten_cor_047/run.py @@ -7,12 +7,16 @@ class PySysTest(TenNetworkTest): def execute(self): # run on the l1 + self.log.info('') + self.lo.info('Running for the L1') network = self.get_l1_network_connection() web3, account = network.connect_account1(self) address = web3.to_checksum_address(Properties().l1_weth_contract_address(self.env)) self.run_for_network(network, web3, account, address, persist_nonce=False) # run on the l2 + self.log.info('') + self.lo.info('Running for the L2') network = self.get_network_connection() web3, account = network.connect_account1(self) address = web3.to_checksum_address(Properties().l2_weth_contract_address(self.env)) @@ -35,12 +39,14 @@ def run_for_network(self, network, web3, account, address, persist_nonce): # deposit eth network.transact(self, web3, weth.contract.functions.deposit(), account, weth.GAS_LIMIT, persist_nonce=persist_nonce, value=100) + self.wait(2.0) deposit_balance = weth.contract.functions.balanceOf(account.address).call() self.log.info('After deposit balance is %d' % deposit_balance) self.assertTrue(deposit_balance-initial_balance == 100, assertMessage='Balance should increase by 100') # withdraw eth network.transact(self, web3, weth.contract.functions.withdraw(10), account, weth.GAS_LIMIT, persist_nonce=persist_nonce) + self.wait(2.0) withdraw_balance = weth.contract.functions.balanceOf(account.address).call() self.log.info('After withdrawal balance is %d' % withdraw_balance) self.assertTrue(withdraw_balance-deposit_balance == -10, assertMessage='Balance should decrease by 10') From ee28e07d44929c563c2edc063dc28250e01f9abd Mon Sep 17 00:00:00 2001 From: Moray Grieve Date: Thu, 29 Jan 2026 11:31:55 +0000 Subject: [PATCH 6/6] Add some waits --- tests/network/ten/ten_cor_047/run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/network/ten/ten_cor_047/run.py b/tests/network/ten/ten_cor_047/run.py index 074c0ecb..e3ad60b6 100644 --- a/tests/network/ten/ten_cor_047/run.py +++ b/tests/network/ten/ten_cor_047/run.py @@ -8,7 +8,7 @@ class PySysTest(TenNetworkTest): def execute(self): # run on the l1 self.log.info('') - self.lo.info('Running for the L1') + self.log.info('Running for the L1') network = self.get_l1_network_connection() web3, account = network.connect_account1(self) address = web3.to_checksum_address(Properties().l1_weth_contract_address(self.env)) @@ -16,7 +16,7 @@ def execute(self): # run on the l2 self.log.info('') - self.lo.info('Running for the L2') + self.log.info('Running for the L2') network = self.get_network_connection() web3, account = network.connect_account1(self) address = web3.to_checksum_address(Properties().l2_weth_contract_address(self.env))