From 90a9ad359edb1490681d0ee23d4db932e4a78e12 Mon Sep 17 00:00:00 2001 From: fselmo Date: Thu, 23 Feb 2023 14:07:38 -0700 Subject: [PATCH] More tweaks for geth ``v1.11.2`` compatibility --- newsfragments/2841.internal.rst | 1 + tests/integration/go_ethereum/test_goethereum_ipc.py | 1 + tests/integration/go_ethereum/test_goethereum_ws.py | 4 ++-- web3/tools/benchmark/main.py | 7 ++++++- web3/tools/benchmark/node.py | 6 ++++++ 5 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 newsfragments/2841.internal.rst diff --git a/newsfragments/2841.internal.rst b/newsfragments/2841.internal.rst new file mode 100644 index 0000000000..6c557fb849 --- /dev/null +++ b/newsfragments/2841.internal.rst @@ -0,0 +1 @@ +Update ``py-geth`` version and re-generate integration test fixture with geth ``v1.11.2``. diff --git a/tests/integration/go_ethereum/test_goethereum_ipc.py b/tests/integration/go_ethereum/test_goethereum_ipc.py index 718762c919..9b5d114f6f 100644 --- a/tests/integration/go_ethereum/test_goethereum_ipc.py +++ b/tests/integration/go_ethereum/test_goethereum_ipc.py @@ -34,6 +34,7 @@ def _geth_command_arguments(geth_ipc_path, base_geth_command_arguments): geth_ipc_path, "--miner.etherbase", COINBASE[2:], + "--rpc.enabledeprecatedpersonal", ) diff --git a/tests/integration/go_ethereum/test_goethereum_ws.py b/tests/integration/go_ethereum/test_goethereum_ws.py index 1b8fee9d8f..22e2c66ad1 100644 --- a/tests/integration/go_ethereum/test_goethereum_ws.py +++ b/tests/integration/go_ethereum/test_goethereum_ws.py @@ -36,6 +36,8 @@ def _geth_command_arguments(ws_port, base_geth_command_arguments, geth_version): yield from base_geth_command_arguments if geth_version.major == 1: yield from ( + "--miner.etherbase", + COINBASE[2:], "--ws", "--ws.port", ws_port, @@ -45,8 +47,6 @@ def _geth_command_arguments(ws_port, base_geth_command_arguments, geth_version): "*", "--ipcdisable", "--allow-insecure-unlock", - "--miner.etherbase", - COINBASE[2:], ) if geth_version.minor not in [10, 11]: raise AssertionError("Unsupported Geth version") diff --git a/web3/tools/benchmark/main.py b/web3/tools/benchmark/main.py index 360c1f89f4..8c40e12cee 100644 --- a/web3/tools/benchmark/main.py +++ b/web3/tools/benchmark/main.py @@ -121,7 +121,12 @@ def main(logger: logging.Logger, num_calls: int) -> None: for built_fixture in fixture.build(): for _ in built_fixture: w3_http = build_web3_http(fixture.endpoint_uri) - loop = asyncio.get_event_loop() + try: + loop = asyncio.get_running_loop() + except RuntimeError: + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + async_w3_http = loop.run_until_complete( build_async_w3_http(fixture.endpoint_uri) ) diff --git a/web3/tools/benchmark/node.py b/web3/tools/benchmark/node.py index 1ee46eecae..1d2afd2e63 100644 --- a/web3/tools/benchmark/node.py +++ b/web3/tools/benchmark/node.py @@ -26,6 +26,9 @@ GETH_FIXTURE_ZIP = "geth-1.11.2-fixture.zip" +# use same coinbase value as in `web3.py/tests/integration/generate_fixtures/common.py` +COINBASE = "0xdc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd" + class GethBenchmarkFixture: def __init__(self) -> None: @@ -88,6 +91,9 @@ def _geth_command_arguments(self, datadir: str) -> Sequence[str]: "admin,eth,net,web3,personal,miner", "--ipcdisable", "--allow-insecure-unlock", + "--miner.etherbase", + COINBASE[2:], + "--rpc.enabledeprecatedpersonal", ) def _geth_process(