Skip to content

Commit ec843e2

Browse files
committed
tests: test new and old port together
1 parent fa49bc2 commit ec843e2

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

integration_tests/test_framework/test_framework.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,17 @@ def setup_w3(self):
350350
log = self.log
351351
self._cw3 = CWeb3(CWeb3.HTTPProvider(f'http://{self.nodes[0].ip}:{self.nodes[0].rpcport}/'))
352352
self._ew3 = Web3(Web3.HTTPProvider(f'http://{self.nodes[0].ip}:{self.nodes[0].ethrpcportv2}/'))
353+
self._legacy_ew3 = Web3(Web3.HTTPProvider(f'http://{self.nodes[0].ip}:{self.nodes[0].ethrpcport}/'))
354+
353355
self.cw3.wallet.add_accounts(self.core_accounts)
354356
self.cw3.cfx.default_account = self.core_accounts[0].address
355357

356358
self.ew3.middleware_onion.add(SignAndSendRawMiddlewareBuilder.build(self.evm_secrets)) # type: ignore
357359
self.eth.default_account = self.evm_accounts[0].address
358360

361+
self._legacy_ew3.middleware_onion.add(SignAndSendRawMiddlewareBuilder.build(self.evm_secrets)) # type: ignore
362+
self._legacy_ew3.eth.default_account = self.evm_accounts[0].address
363+
359364
class TestNodeMiddleware(ConfluxWeb3Middleware):
360365
def request_processor(self, method: RPCEndpoint, params: Any) -> Any:
361366
if method == RPC.cfx_sendRawTransaction or method == RPC.cfx_sendTransaction or method == "eth_sendRawTransaction" or method == "eth_sendTransaction":
@@ -377,6 +382,7 @@ def response_processor(self, method: RPCEndpoint, response: Any):
377382

378383
self.cw3.middleware_onion.add(TestNodeMiddleware)
379384
self.ew3.middleware_onion.add(TestNodeMiddleware)
385+
self._legacy_ew3.middleware_onion.add(TestNodeMiddleware)
380386

381387
def add_nodes(self, num_nodes, genesis_nodes=None, rpchost=None, binary=None, auto_recovery=False,
382388
recovery_timeout=30, is_consortium=True):

integration_tests/tests/rpc/espace/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ def set_test_params(self):
1717
self.conf_parameters["next_hardfork_transition_height"] = 1
1818
self.conf_parameters["next_hardfork_transition_number"] = 1
1919
self.conf_parameters["public_evm_rpc_async_apis"] = "\"all\"" # open all async apis
20+
self.conf_parameters["public_evm_rpc_apis"] = (
21+
'"eth,ethdebug"'
22+
)
2023
# self.conf_parameters["evm_chain_id"] = str(10)
2124
self.conf_parameters["evm_transaction_block_ratio"] = str(1)
2225
self.conf_parameters["executive_trace"] = "true"
@@ -28,6 +31,13 @@ def setup_network(self):
2831
return DefaultFramework
2932

3033

34+
@pytest.fixture(scope="module", params=["ew3_port_v1", "ew3_port_v2"])
35+
def ew3(network: ConfluxTestFramework, request):
36+
if request.param == "ew3_port_v2":
37+
return network.ew3
38+
else:
39+
return network._legacy_ew3
40+
3141
@pytest.fixture(scope="module")
3242
def erc20_contract(ew3, evm_accounts):
3343
account = evm_accounts[0]

0 commit comments

Comments
 (0)