Skip to content

Commit 323e6e9

Browse files
authored
Update Geth to 1.14.12 (#3533)
* Update Geth to 1.14.12 * Update docs and conftest with new geth version * Refactor shared logic in geth version string updates * Update contributing docs
1 parent 6ef3a20 commit 323e6e9

File tree

10 files changed

+90
-30
lines changed

10 files changed

+90
-30
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ parameters:
44
# NOTE: Do not update the `geth_version` manually. It is updated during the
55
# integration test fixture generation.
66
geth_version:
7-
default: "1.14.5"
7+
default: "1.14.12"
88
type: string
99
go_version:
1010
default: "1.22.4"

docs/contributing.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -373,25 +373,26 @@ Geth Fixtures
373373

374374
.. code:: sh
375375

376-
$ python -m geth.install v1.14.5
376+
$ python -m geth.install v1.14.12
377377

378378
2. Specify the Geth binary and run the fixture creation script (from within the web3.py directory):
379379

380380
.. code:: sh
381381

382-
$ GETH_BINARY=~/.py-geth/geth-v1.14.5/bin/geth python ./tests/integration/generate_fixtures/go_ethereum.py
382+
$ GETH_BINARY=~/.py-geth/geth-v1.14.12/bin/geth python ./tests/integration/generate_fixtures/go_ethereum.py
383383

384384
3. The output of this script is your fixture, a zip file, which is now stored in ``/tests/integration/``.
385-
Update the ``/tests/integration/go_ethereum/conftest.py`` and
386-
``/web3/tools/benchmark/node.py`` files to point to this new fixture. Delete the old
387-
fixture.
385+
The ``/tests/integration/go_ethereum/conftest.py`` and
386+
``/web3/tools/benchmark/node.py`` files should be updated automatically to point to this new fixture.
387+
Delete the old fixture.
388388

389389
4. Run the tests. To ensure that the tests run with the correct Geth version locally,
390390
you may again include the ``GETH_BINARY`` environment variable.
391391

392-
5. Update the ``geth_version`` and ``pygeth_version`` parameter defaults in
393-
``/.circleci/config.yml`` to match the ``go-ethereum`` version used to generate the
394-
test fixture and the ``py-geth`` version that supports installing it.
392+
5. The ``geth_version`` and ``pygeth_version`` parameter defaults in
393+
``/.circleci/config.yml`` should be automatically updated to match the
394+
``go-ethereum`` version used to generate the test fixture and the ``py-geth``
395+
version that supports installing it.
395396

396397

397398
CI Testing With a Nightly Geth Build

docs/middleware.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ middleware is:
350350

351351
# confirm that the connection succeeded
352352
>>> w3.client_version
353-
'Geth/v1.14.5-stable-4bb3c89d/linux-amd64/go1.22.4'
353+
'Geth/v1.14.12-stable-4bb3c89d/linux-amd64/go1.22.4'
354354

355355
This example connects to a local ``geth --dev`` instance on Linux with a
356356
unique IPC location and loads the middleware:
@@ -369,7 +369,7 @@ unique IPC location and loads the middleware:
369369

370370
# confirm that the connection succeeded
371371
>>> w3.client_version
372-
'Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9'
372+
'Geth/v1.14.12-stable-4bb3c89d/linux-amd64/go1.22.4'
373373

374374
Why is ``ExtraDataToPOAMiddleware`` necessary?
375375
''''''''''''''''''''''''''''''''''''''''''''''

newsfragments/3533.internal.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade Geth Fixture to 1.14.12

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Note: ethereum-maintained libraries in this list should be added to the
1010
# `install_pre_releases.py` script.
1111
"eth-tester[py-evm]>=0.11.0b1,<0.13.0b1",
12-
"py-geth>=5.0.0",
12+
"py-geth>=5.1.0",
1313
],
1414
"dev": [
1515
"build>=0.9.0",

tests/integration/generate_fixtures/go_ethereum.py

Lines changed: 74 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -361,25 +361,81 @@ def setup_chain_state(w3):
361361
return geth_fixture
362362

363363

364-
def update_circleci_geth_version(new_version):
365-
file_path = "./.circleci/config.yml"
366-
with open(file_path) as file:
367-
lines = file.readlines()
368-
364+
def update_geth_version_string(what_to_replace, new_version, change_next_line=False):
369365
replaced = False
370-
for i, line in enumerate(lines):
371-
if "geth_version:" in line:
372-
if "default:" in lines[i + 1]:
373-
lines[i + 1] = f' default: "{new_version}"\n'
374-
replaced = True
375-
break
366+
for file_path, changes in what_to_replace.items():
367+
with open(file_path) as file:
368+
lines = file.readlines()
369+
370+
for i, line in enumerate(lines):
371+
for change in changes:
372+
if change["line_to_replace"] in line:
373+
if (
374+
change_next_line
375+
and change["next_line_contains"] in lines[i + 1]
376+
):
377+
lines[i + 1] = change["replace_with"]
378+
replaced = True
379+
break
380+
else:
381+
lines[i] = change["replace_with"]
382+
replaced = True
383+
break
384+
385+
if not replaced:
386+
raise ValueError("`geth_version` for {file_path} not found / replaced.")
387+
388+
with open(file_path, "w") as file:
389+
file.writelines(lines)
390+
print(f"Updated geth_version in {file_path} to {new_version}")
391+
392+
393+
def update_doc_version(new_version):
394+
changes = {
395+
"./docs/contributing.rst": [
396+
{
397+
"line_to_replace": "python -m geth.install ",
398+
"replace_with": f" $ python -m geth.install v{new_version}\n",
399+
},
400+
{
401+
"line_to_replace": "GETH_BINARY=~",
402+
"replace_with": f" $ GETH_BINARY=~/.py-geth/geth-v{new_version}/bin/geth python ./tests/integration/generate_fixtures/go_ethereum.py\n", # noqa: E501,
403+
},
404+
]
405+
}
376406

377-
if not replaced:
378-
raise ValueError("`geth_version` for circleci not found / replaced.")
407+
update_geth_version_string(changes, new_version)
408+
409+
410+
def update_fixture_generation_version(new_version):
411+
changes = {
412+
"./tests/integration/go_ethereum/conftest.py": [
413+
{
414+
"line_to_replace": "GETH_FIXTURE_ZIP = ",
415+
"replace_with": f'GETH_FIXTURE_ZIP = "geth-{new_version}-fixture.zip"\n', # noqa: E501
416+
},
417+
],
418+
"./web3/tools/benchmark/node.py": [
419+
{
420+
"line_to_replace": "GETH_FIXTURE_ZIP = ",
421+
"replace_with": f'GETH_FIXTURE_ZIP = "geth-{new_version}-fixture.zip"\n', # noqa: E501
422+
},
423+
],
424+
}
425+
update_geth_version_string(changes, new_version)
379426

380-
with open(file_path, "w") as file:
381-
file.writelines(lines)
382-
print(f"Updated geth_version to {new_version}")
427+
428+
def update_circleci_geth_version(new_version):
429+
changes = {
430+
"./.circleci/config.yml": [
431+
{
432+
"line_to_replace": "geth_version:\n",
433+
"replace_with": f' default: "{new_version}"\n',
434+
"next_line_contains": "default:",
435+
}
436+
]
437+
}
438+
update_geth_version_string(changes, new_version, change_next_line=True)
383439

384440

385441
if __name__ == "__main__":
@@ -390,3 +446,5 @@ def update_circleci_geth_version(new_version):
390446
geth_version = re.search(r"geth-v([\d.]+)/", geth_binary).group(1)
391447
generate_go_ethereum_fixture(f"./tests/integration/geth-{geth_version}-fixture")
392448
update_circleci_geth_version(geth_version)
449+
update_fixture_generation_version(geth_version)
450+
update_doc_version(geth_version)
47.4 KB
Binary file not shown.
-57.5 KB
Binary file not shown.

tests/integration/go_ethereum/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
)
3535

3636
KEYFILE_PW = "web3py-test"
37-
GETH_FIXTURE_ZIP = "geth-1.14.5-fixture.zip"
37+
GETH_FIXTURE_ZIP = "geth-1.14.12-fixture.zip"
3838

3939

4040
@pytest.fixture(scope="module")

web3/tools/benchmark/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
kill_proc_gracefully,
2525
)
2626

27-
GETH_FIXTURE_ZIP = "geth-1.14.5-fixture.zip"
27+
GETH_FIXTURE_ZIP = "geth-1.14.12-fixture.zip"
2828

2929

3030
class GethBenchmarkFixture:

0 commit comments

Comments
 (0)