From da6a76ed9a951c72180bfb94e5d3a1fb4b58a962 Mon Sep 17 00:00:00 2001 From: Mario Vega Date: Tue, 23 Jul 2024 22:08:05 +0000 Subject: [PATCH] fix(execute): Use TransactionDefaults to modify the default chain_id for all txs --- src/pytest_plugins/execute/rpc/remote.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/pytest_plugins/execute/rpc/remote.py b/src/pytest_plugins/execute/rpc/remote.py index 1180b24e9b..eb6336cc79 100644 --- a/src/pytest_plugins/execute/rpc/remote.py +++ b/src/pytest_plugins/execute/rpc/remote.py @@ -4,9 +4,9 @@ import pytest -from ethereum_test_base_types import Number -from ethereum_test_tools import EOA, Hash +from ethereum_test_base_types import Hash, Number from ethereum_test_tools.rpc import EthRPC +from ethereum_test_types import EOA, TransactionDefaults def pytest_addoption(parser): @@ -31,6 +31,14 @@ def pytest_addoption(parser): "it's externally increased, the seed transactions might fail." ), ) + remote_rpc_group.addoption( + "--rpc-chain-id", + action="store", + dest="rpc_chain_id", + type=int, + default=None, + help="ID of the chain where the tests will be executed.", + ) remote_rpc_group.addoption( "--tx-wait-timeout", action="store", @@ -55,6 +63,9 @@ def eth_rpc(request, rpc_endpoint: str) -> EthRPC: Initialize ethereum RPC client for the execution client under test. """ tx_wait_timeout = request.config.getoption("tx_wait_timeout") + chain_id = request.config.getoption("rpc_chain_id") + if chain_id is not None: + TransactionDefaults.chain_id = chain_id return EthRPC(rpc_endpoint, transaction_wait_timeout=tx_wait_timeout)