diff --git a/.circleci/config.yml b/.circleci/config.yml index 9cf7c402..ba8b2058 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -144,7 +144,8 @@ workflows: geth_version: [ "1_14_0", "1_14_2", "1_14_3", "1_14_4", "1_14_5", "1_14_6", "1_14_7", "1_14_8", "1_14_9", "1_14_10", "1_14_11", "1_14_12", - "1_14_13" + "1_14_13", "1_15_0", "1_15_1", "1_15_2", "1_15_3", "1_15_4", + "1_15_5" ] name: "py3<< matrix.python_minor_version >>-install-geth-v<< matrix.geth_version >>" - windows-wheel: diff --git a/README.md b/README.md index f0ce030a..2b5f5473 100644 --- a/README.md +++ b/README.md @@ -116,19 +116,19 @@ the current list of supported versions. Installation can be done via the command line: ```bash -$ python -m geth.install v1.14.13 +$ python -m geth.install v1.15.5 ``` Or from python using the `install_geth` function. ```python >>> from geth import install_geth ->>> install_geth('v1.14.13') +>>> install_geth('v1.15.5') ``` The installed binary can be found in the `$HOME/.py-geth` directory, under your -home directory. The `v1.14.13` binary would be located at -`$HOME/.py-geth/geth-v1.14.13/bin/geth`. +home directory. The `v1.15.5` binary would be located at +`$HOME/.py-geth/geth-v1.15.5/bin/geth`. ## About `DevGethProcess` diff --git a/geth/genesis.json b/geth/genesis.json index e031182f..b4b995f5 100644 --- a/geth/genesis.json +++ b/geth/genesis.json @@ -16,7 +16,20 @@ "terminalTotalDifficulty": 0, "terminalTotalDifficultyPassed": true, "shanghaiTime": 0, - "cancunTime": 0 + "cancunTime": 0, + "blobSchedule": { + "cancun": { + "target": 3, + "max": 6, + "baseFeeUpdateFraction": 3338477 + }, + "prague": { + "target": 6, + "max": 9, + "baseFeeUpdateFraction": 5007716 + } + } + }, "nonce": "0x0", "timestamp": "0x0", diff --git a/geth/install.py b/geth/install.py index 9d71d350..a54bce16 100644 --- a/geth/install.py +++ b/geth/install.py @@ -47,6 +47,12 @@ V1_14_11 = "v1.14.11" V1_14_12 = "v1.14.12" V1_14_13 = "v1.14.13" +V1_15_0 = "v1.15.0" +V1_15_1 = "v1.15.1" +V1_15_2 = "v1.15.2" +V1_15_3 = "v1.15.3" +V1_15_4 = "v1.15.4" +V1_15_5 = "v1.15.5" LINUX = "linux" @@ -343,6 +349,12 @@ def install_from_source_code_release(identifier: str) -> None: install_v1_14_11 = functools.partial(install_from_source_code_release, V1_14_11) install_v1_14_12 = functools.partial(install_from_source_code_release, V1_14_12) install_v1_14_13 = functools.partial(install_from_source_code_release, V1_14_13) +install_v1_15_0 = functools.partial(install_from_source_code_release, V1_15_0) +install_v1_15_1 = functools.partial(install_from_source_code_release, V1_15_1) +install_v1_15_2 = functools.partial(install_from_source_code_release, V1_15_2) +install_v1_15_3 = functools.partial(install_from_source_code_release, V1_15_3) +install_v1_15_4 = functools.partial(install_from_source_code_release, V1_15_4) +install_v1_15_5 = functools.partial(install_from_source_code_release, V1_15_5) INSTALL_FUNCTIONS = { LINUX: { @@ -359,6 +371,12 @@ def install_from_source_code_release(identifier: str) -> None: V1_14_11: install_v1_14_11, V1_14_12: install_v1_14_12, V1_14_13: install_v1_14_13, + V1_15_0: install_v1_15_0, + V1_15_1: install_v1_15_1, + V1_15_2: install_v1_15_2, + V1_15_3: install_v1_15_3, + V1_15_4: install_v1_15_4, + V1_15_5: install_v1_15_5, }, OSX: { V1_14_0: install_v1_14_0, @@ -374,6 +392,12 @@ def install_from_source_code_release(identifier: str) -> None: V1_14_11: install_v1_14_11, V1_14_12: install_v1_14_12, V1_14_13: install_v1_14_13, + V1_15_0: install_v1_15_0, + V1_15_1: install_v1_15_1, + V1_15_2: install_v1_15_2, + V1_15_3: install_v1_15_3, + V1_15_4: install_v1_15_4, + V1_15_5: install_v1_15_5, }, } diff --git a/geth/utils/validation.py b/geth/utils/validation.py index 40fc8c16..f3c16bdd 100644 --- a/geth/utils/validation.py +++ b/geth/utils/validation.py @@ -11,6 +11,7 @@ BaseModel, ConfigDict, ValidationError, + model_validator, ) from geth.exceptions import ( @@ -94,8 +95,23 @@ class GenesisDataConfig(BaseModel): # post-merge, timestamp is used for network transitions shanghaiTime: int = 0 cancunTime: int = 0 - - model_config = ConfigDict(extra="forbid") + pragueTime: int = 0 + # blobs + blobSchedule: dict[str, Any] = {} + + @model_validator(mode="after") + def check_blob_schedule_required( + self, + ) -> GenesisDataConfig: + if self.cancunTime > 0 and self.blobSchedule.get("cancun") is None: + raise PyGethValueError( + "blobSchedule 'cancun' value is required when cancunTime is set" + ) + if self.pragueTime > 0 and self.blobSchedule.get("prague") is None: + raise PyGethValueError( + "blobSchedule 'prague' value is required when pragueTime is set" + ) + return self class GenesisData(BaseModel): diff --git a/newsfragments/251.feature.rst b/newsfragments/251.feature.rst new file mode 100644 index 00000000..d15364da --- /dev/null +++ b/newsfragments/251.feature.rst @@ -0,0 +1 @@ +Adds support for geth ``v1.15.0`` through ``v1.15.5``, add new fields ``blobSchedule`` and ``pragueTime`` to genesis data config. diff --git a/tests/core/utility/test_validation.py b/tests/core/utility/test_validation.py index 397971e8..d77034ea 100644 --- a/tests/core/utility/test_validation.py +++ b/tests/core/utility/test_validation.py @@ -85,6 +85,15 @@ def test_validate_genesis_data_good(genesis_data): "config": None, }, "kangaroo", + { + "difficulty": "0x00012131", + "nonce": "abc", + "timestamp": "1234", + "config": { + "cancunTime": 5, + "blobSchedule": {}, + }, + }, ], ) def test_validate_genesis_data_bad(genesis_data): @@ -127,6 +136,8 @@ def test_validate_genesis_data_bad(genesis_data): "terminalTotalDifficultyPassed": True, "shanghaiTime": 0, "cancunTime": 0, + "pragueTime": 0, + "blobSchedule": {}, }, "difficulty": "0x00012131", "excessBlobGas": "0x0", @@ -179,6 +190,8 @@ def test_validate_genesis_data_bad(genesis_data): "terminalTotalDifficultyPassed": True, "shanghaiTime": 0, "cancunTime": 0, + "pragueTime": 0, + "blobSchedule": {}, }, "difficulty": "0x00012131", "excessBlobGas": "0x0", diff --git a/tox.ini b/tox.ini index 65fc4cdc..c6bc6233 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,8 @@ envlist= py{38,39,310,311,312,313}-lint py{38,39,310,311,312,313}-install-geth-{\ v1_14_0, v1_14_2, v1_14_3, v1_14_4, v1_14_5, v1_14_6, v1_14_7, \ - v1_14_8, v1_14_9, v1_14_10, v1_14_11, v1_14_12, v1_14_13 \ + v1_14_8, v1_14_9, v1_14_10, v1_14_11, v1_14_12, v1_14_13, v1_15_0, \ + v1_15_1, v1_15_2, v1_15_3, v1_15_4, v1_15_5 \ } py{38,39,310,311,312,313}-wheel windows-wheel