py-geth 5.2.1__py3-none-any.whl → 5.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
geth/chain.py CHANGED
@@ -26,7 +26,6 @@ from .utils.filesystem import (
26
26
  is_same_path,
27
27
  )
28
28
  from .utils.validation import (
29
- fill_default_genesis_data,
30
29
  validate_genesis_data,
31
30
  )
32
31
  from .wrapper import (
@@ -118,13 +117,9 @@ def write_genesis_file(
118
117
  )
119
118
 
120
119
  validate_genesis_data(genesis_data)
121
- # use GenesisData model to fill defaults
122
- filled_genesis_data_model = fill_default_genesis_data(genesis_data)
123
120
 
124
121
  with open(genesis_file_path, "w") as genesis_file:
125
- genesis_file.write(
126
- json.dumps(force_obj_to_text(filled_genesis_data_model.model_dump()))
127
- )
122
+ genesis_file.write(force_obj_to_text(json.dumps(genesis_data)))
128
123
 
129
124
 
130
125
  def initialize_chain(genesis_data: GenesisDataTypedDict, data_dir: str) -> None:
geth/genesis.json CHANGED
@@ -16,7 +16,20 @@
16
16
  "terminalTotalDifficulty": 0,
17
17
  "terminalTotalDifficultyPassed": true,
18
18
  "shanghaiTime": 0,
19
- "cancunTime": 0
19
+ "cancunTime": 0,
20
+ "blobSchedule": {
21
+ "cancun": {
22
+ "target": 3,
23
+ "max": 6,
24
+ "baseFeeUpdateFraction": 3338477
25
+ },
26
+ "prague": {
27
+ "target": 6,
28
+ "max": 9,
29
+ "baseFeeUpdateFraction": 5007716
30
+ }
31
+ }
32
+
20
33
  },
21
34
  "nonce": "0x0",
22
35
  "timestamp": "0x0",
geth/install.py CHANGED
@@ -47,6 +47,14 @@ V1_14_10 = "v1.14.10"
47
47
  V1_14_11 = "v1.14.11"
48
48
  V1_14_12 = "v1.14.12"
49
49
  V1_14_13 = "v1.14.13"
50
+ V1_15_0 = "v1.15.0"
51
+ V1_15_1 = "v1.15.1"
52
+ V1_15_2 = "v1.15.2"
53
+ V1_15_3 = "v1.15.3"
54
+ V1_15_4 = "v1.15.4"
55
+ V1_15_5 = "v1.15.5"
56
+ V1_15_6 = "v1.15.6"
57
+ V1_15_7 = "v1.15.7"
50
58
 
51
59
 
52
60
  LINUX = "linux"
@@ -343,6 +351,14 @@ install_v1_14_10 = functools.partial(install_from_source_code_release, V1_14_10)
343
351
  install_v1_14_11 = functools.partial(install_from_source_code_release, V1_14_11)
344
352
  install_v1_14_12 = functools.partial(install_from_source_code_release, V1_14_12)
345
353
  install_v1_14_13 = functools.partial(install_from_source_code_release, V1_14_13)
354
+ install_v1_15_0 = functools.partial(install_from_source_code_release, V1_15_0)
355
+ install_v1_15_1 = functools.partial(install_from_source_code_release, V1_15_1)
356
+ install_v1_15_2 = functools.partial(install_from_source_code_release, V1_15_2)
357
+ install_v1_15_3 = functools.partial(install_from_source_code_release, V1_15_3)
358
+ install_v1_15_4 = functools.partial(install_from_source_code_release, V1_15_4)
359
+ install_v1_15_5 = functools.partial(install_from_source_code_release, V1_15_5)
360
+ install_v1_15_6 = functools.partial(install_from_source_code_release, V1_15_6)
361
+ install_v1_15_7 = functools.partial(install_from_source_code_release, V1_15_7)
346
362
 
347
363
  INSTALL_FUNCTIONS = {
348
364
  LINUX: {
@@ -359,6 +375,14 @@ INSTALL_FUNCTIONS = {
359
375
  V1_14_11: install_v1_14_11,
360
376
  V1_14_12: install_v1_14_12,
361
377
  V1_14_13: install_v1_14_13,
378
+ V1_15_0: install_v1_15_0,
379
+ V1_15_1: install_v1_15_1,
380
+ V1_15_2: install_v1_15_2,
381
+ V1_15_3: install_v1_15_3,
382
+ V1_15_4: install_v1_15_4,
383
+ V1_15_5: install_v1_15_5,
384
+ V1_15_6: install_v1_15_6,
385
+ V1_15_7: install_v1_15_7,
362
386
  },
363
387
  OSX: {
364
388
  V1_14_0: install_v1_14_0,
@@ -374,6 +398,14 @@ INSTALL_FUNCTIONS = {
374
398
  V1_14_11: install_v1_14_11,
375
399
  V1_14_12: install_v1_14_12,
376
400
  V1_14_13: install_v1_14_13,
401
+ V1_15_0: install_v1_15_0,
402
+ V1_15_1: install_v1_15_1,
403
+ V1_15_2: install_v1_15_2,
404
+ V1_15_3: install_v1_15_3,
405
+ V1_15_4: install_v1_15_4,
406
+ V1_15_5: install_v1_15_5,
407
+ V1_15_6: install_v1_15_6,
408
+ V1_15_7: install_v1_15_7,
377
409
  },
378
410
  }
379
411
 
geth/process.py CHANGED
@@ -6,6 +6,7 @@ from abc import (
6
6
  ABC,
7
7
  abstractmethod,
8
8
  )
9
+ import copy
9
10
  import json
10
11
  import logging
11
12
  import os
@@ -216,6 +217,10 @@ class BaseGethProcess(ABC):
216
217
  time.sleep(0.1)
217
218
  _timeout.check()
218
219
 
220
+ @property
221
+ def version(self) -> str:
222
+ return str(get_geth_version(**self.geth_kwargs))
223
+
219
224
 
220
225
  class MainnetGethProcess(BaseGethProcess):
221
226
  def __init__(self, geth_kwargs: GethKwargsTypedDict | None = None):
@@ -282,7 +287,8 @@ class DevGethProcess(BaseGethProcess):
282
287
  overrides = {}
283
288
 
284
289
  if genesis_data is None:
285
- genesis_data = GenesisDataTypedDict(**GENESIS_JSON)
290
+ # deepcopy since we may modify the data on init below
291
+ genesis_data = GenesisDataTypedDict(**copy.deepcopy(GENESIS_JSON))
286
292
 
287
293
  validate_genesis_data(genesis_data)
288
294
 
geth/utils/validation.py CHANGED
@@ -11,6 +11,7 @@ from pydantic import (
11
11
  BaseModel,
12
12
  ConfigDict,
13
13
  ValidationError,
14
+ model_validator,
14
15
  )
15
16
 
16
17
  from geth.exceptions import (
@@ -72,52 +73,67 @@ def validate_geth_kwargs(geth_kwargs: GethKwargsTypedDict) -> None:
72
73
 
73
74
 
74
75
  class GenesisDataConfig(BaseModel):
75
- chainId: int = 0
76
- ethash: dict[str, Any] = {} # so that geth treats config as PoW -> PoS transition
77
- homesteadBlock: int = 0
78
- daoForkBlock: int = 0
79
- daoForkSupport: bool = True
80
- eip150Block: int = 0
81
- eip155Block: int = 0
82
- eip158Block: int = 0
83
- byzantiumBlock: int = 0
84
- constantinopleBlock: int = 0
85
- petersburgBlock: int = 0
86
- istanbulBlock: int = 0
87
- berlinBlock: int = 0
88
- londonBlock: int = 0
89
- arrowGlacierBlock: int = 0
90
- grayGlacierBlock: int = 0
76
+ """
77
+ Default values are pulled from the ``genesis.json`` file internal to the repository.
78
+ """
79
+
80
+ chainId: int | None = None
81
+ ethash: dict[str, Any] | None = None
82
+ homesteadBlock: int | None = None
83
+ daoForkBlock: int | None = None
84
+ daoForkSupport: bool | None = None
85
+ eip150Block: int | None = None
86
+ eip155Block: int | None = None
87
+ eip158Block: int | None = None
88
+ byzantiumBlock: int | None = None
89
+ constantinopleBlock: int | None = None
90
+ petersburgBlock: int | None = None
91
+ istanbulBlock: int | None = None
92
+ berlinBlock: int | None = None
93
+ londonBlock: int | None = None
94
+ arrowGlacierBlock: int | None = None
95
+ grayGlacierBlock: int | None = None
91
96
  # merge
92
- terminalTotalDifficulty: int = 0
93
- terminalTotalDifficultyPassed: bool = True
97
+ terminalTotalDifficulty: int | None = None
98
+ terminalTotalDifficultyPassed: bool | None = None
94
99
  # post-merge, timestamp is used for network transitions
95
- shanghaiTime: int = 0
96
- cancunTime: int = 0
97
-
98
- model_config = ConfigDict(extra="forbid")
100
+ shanghaiTime: int | None = None
101
+ cancunTime: int | None = None
102
+ pragueTime: int | None = None
103
+ # blobs
104
+ blobSchedule: dict[str, Any] = {}
105
+
106
+ @model_validator(mode="after")
107
+ def check_blob_schedule_required(
108
+ self,
109
+ ) -> GenesisDataConfig:
110
+ if self.cancunTime and not self.blobSchedule.get("cancun"):
111
+ raise PyGethValueError(
112
+ "blobSchedule 'cancun' value is required when cancunTime is set"
113
+ )
114
+ if self.pragueTime and not self.blobSchedule.get("prague"):
115
+ raise PyGethValueError(
116
+ "blobSchedule 'prague' value is required when pragueTime is set"
117
+ )
118
+ return self
99
119
 
100
120
 
101
121
  class GenesisData(BaseModel):
102
122
  alloc: dict[str, dict[str, Any]] = {}
103
- baseFeePerGas: str = "0x0"
104
- blobGasUsed: str = "0x0"
105
- coinbase: str = "0x3333333333333333333333333333333333333333"
123
+ baseFeePerGas: str | None = None
124
+ blobGasUsed: str | None = None
125
+ coinbase: str | None = None
106
126
  config: dict[str, Any] = GenesisDataConfig().model_dump()
107
- difficulty: str = "0x0"
108
- excessBlobGas: str = "0x0"
109
- extraData: str = (
110
- "0x0000000000000000000000000000000000000000000000000000000000000000"
111
- )
112
- gasLimit: str = "0x47e7c4"
113
- gasUsed: str = "0x0"
114
- mixHash: str = "0x0000000000000000000000000000000000000000000000000000000000000000"
115
- nonce: str = "0x0"
116
- number: str = "0x0"
117
- parentHash: str = (
118
- "0x0000000000000000000000000000000000000000000000000000000000000000"
119
- )
120
- timestamp: str = "0x0"
127
+ difficulty: str | None = None
128
+ excessBlobGas: str | None = None
129
+ extraData: str | None = None
130
+ gasLimit: str | None = None
131
+ gasUsed: str | None = None
132
+ mixHash: str | None = None
133
+ nonce: str | None = None
134
+ number: str | None = None
135
+ parentHash: str | None = None
136
+ timestamp: str | None = None
121
137
 
122
138
  model_config = ConfigDict(extra="forbid")
123
139
 
@@ -146,35 +162,3 @@ def validate_genesis_data(genesis_data: GenesisDataTypedDict) -> None:
146
162
  raise PyGethValueError(
147
163
  f"error while validating genesis_data config field: {e}"
148
164
  )
149
-
150
-
151
- def fill_default_genesis_data(
152
- genesis_data: GenesisDataTypedDict,
153
- ) -> GenesisData:
154
- """
155
- Fills in default values for the genesis data
156
- """
157
- try:
158
- genesis_data_filled = GenesisData(**genesis_data)
159
- except ValidationError as e:
160
- raise PyGethValueError(
161
- f"genesis_data validation failed while filling defaults: {e}"
162
- )
163
- except TypeError as e:
164
- raise PyGethValueError(f"error while filling default genesis_data: {e}")
165
-
166
- if genesis_data.get("config"):
167
- try:
168
- genesis_data_config_filled = GenesisDataConfig(**genesis_data["config"])
169
- except ValidationError as e:
170
- raise PyGethValueError(
171
- f"genesis_data validation failed while filling config defaults: {e}"
172
- )
173
- except TypeError as e:
174
- raise PyGethValueError(
175
- f"error while filling default genesis_data config: {e}"
176
- )
177
-
178
- genesis_data_filled.config = genesis_data_config_filled.model_dump()
179
-
180
- return genesis_data_filled
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: py-geth
3
- Version: 5.2.1
3
+ Version: 5.4.0
4
4
  Summary: py-geth: Run Go-Ethereum as a subprocess
5
5
  Home-page: https://github.com/ethereum/py-geth
6
6
  Author: The Ethereum Foundation
@@ -54,6 +54,7 @@ Dynamic: description-content-type
54
54
  Dynamic: home-page
55
55
  Dynamic: keywords
56
56
  Dynamic: license
57
+ Dynamic: license-file
57
58
  Dynamic: provides-extra
58
59
  Dynamic: requires-dist
59
60
  Dynamic: requires-python
@@ -138,6 +139,8 @@ False
138
139
  False
139
140
  >>> geth.is_stopped
140
141
  True
142
+ >>> geth.version
143
+ "1.15.7-stable"
141
144
  ```
142
145
 
143
146
  When testing it can be nice to see the logging output produced by the `geth`
@@ -177,19 +180,19 @@ the current list of supported versions.
177
180
  Installation can be done via the command line:
178
181
 
179
182
  ```bash
180
- $ python -m geth.install v1.14.13
183
+ $ python -m geth.install v1.15.7
181
184
  ```
182
185
 
183
186
  Or from python using the `install_geth` function.
184
187
 
185
188
  ```python
186
189
  >>> from geth import install_geth
187
- >>> install_geth('v1.14.13')
190
+ >>> install_geth('v1.15.7')
188
191
  ```
189
192
 
190
193
  The installed binary can be found in the `$HOME/.py-geth` directory, under your
191
- home directory. The `v1.14.13` binary would be located at
192
- `$HOME/.py-geth/geth-v1.14.13/bin/geth`.
194
+ home directory. The `v1.15.7` binary would be located at
195
+ `$HOME/.py-geth/geth-v1.15.7/bin/geth`.
193
196
 
194
197
  ## About `DevGethProcess`
195
198
 
@@ -1,13 +1,13 @@
1
1
  geth/__init__.py,sha256=vPIxujjhq68syWZuHJQy6vNxW6yqbi7M8hmEtYVoKWs,583
2
2
  geth/accounts.py,sha256=QxhjdyFT5JSgTswQiPsMMgCpTcV9-vaZiksDoWfePTI,5943
3
- geth/chain.py,sha256=VMbb1OMI8z-HRteYg7bDgDpf9-SyLYioy2OIYO7oW5s,3879
3
+ geth/chain.py,sha256=7ZTmzLgkIB6UKcB1NSvMfTuF6RqO4lW0FtHz9uSJQ5s,3683
4
4
  geth/default_blockchain_password,sha256=7ZYUjo1py5Wh_uA_WvoXQG8mPv2CiJ07tI2tOodTLi8,30
5
5
  geth/exceptions.py,sha256=yLGBkLabY_W-43kW9iYPM3FaoR08JWgTWYW1RHukaeU,2643
6
- geth/genesis.json,sha256=E6pcGhk0pz1ByhRvyqeVbNAteOB4U1jOj4KiHtR2tAM,901
7
- geth/install.py,sha256=tMKxYX1ILTquKvhr8M3BHicfCt2ChnDq_iJamtkTaB4,11634
6
+ geth/genesis.json,sha256=HPY88vd1cD0bXKB2Fd59EQ08oK6uVTOehHqSmckuYBY,1224
7
+ geth/install.py,sha256=wQpgfXEQ_ZX133rPFkA28k7wUX-hI7ctOU77cxBYkBc,12970
8
8
  geth/main.py,sha256=jgWIs3o9BfHcqWfuq6l4JBjcdQzDy13-EJDP1c2ouhQ,1463
9
9
  geth/mixins.py,sha256=cpls-_Z9WZdmYbjhOZL-y6F1xRYAvmfWRed2DODe6D8,5639
10
- geth/process.py,sha256=SumVj-2Q7PQ-HZBaCcpN_PY9WkIqlRuy9hRo0VCpb2A,8864
10
+ geth/process.py,sha256=MEEzmwxrIjNpTMINmm4OpraB8MR6ENht63zNultIOEc,9059
11
11
  geth/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  geth/reset.py,sha256=IlKfr5PyjVi0rHjoGUY5kbjtnR9ZAsfSb1Jgzh0dDo0,2639
13
13
  geth/types.py,sha256=9BesREN7IuJVM2BagzUfIZ0VjJTAcRFJgEF7NyLHugY,1481
@@ -19,9 +19,9 @@ geth/utils/networking.py,sha256=ntH6CZuGcTJJ0BIdT4rI-EMz703VDbJAJzGcxufDQMo,1488
19
19
  geth/utils/proc.py,sha256=0CcHzOTkSzikrli_2ooQT6iHpPaTRYsshcvrGYC7btA,1801
20
20
  geth/utils/thread.py,sha256=IL4C-AvzYbOwW2qOIMS63GVEqiWLe9TiMXX20qT1UaY,315
21
21
  geth/utils/timeout.py,sha256=Uiz90EKJJm7UmKmVx2FhBpIblnvg9dTqszsanvfOtFM,2259
22
- geth/utils/validation.py,sha256=YeSoqpVjGXRNZUcqiUof39uVUZnmbrf-XU0C4LEZ0NU,5430
23
- py_geth-5.2.1.dist-info/LICENSE,sha256=ENGC4gSn0kYaC_mlaXOEwCKmA6W7Z9MeSemc5O2k-h0,1095
24
- py_geth-5.2.1.dist-info/METADATA,sha256=nGJfBfMvJn78-4hcIM_9qpwWFDyXYSEV3MiO1iHiGp0,9214
25
- py_geth-5.2.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
26
- py_geth-5.2.1.dist-info/top_level.txt,sha256=o8Gvkxt3xBR7BNG2p9_G1J3GnGlTrBMEhYJBdAzBWDU,5
27
- py_geth-5.2.1.dist-info/RECORD,,
22
+ geth/utils/validation.py,sha256=rMwaB2DSKNG8-NXx269YwUrOAfzuckqTBwA4wqjgebY,5030
23
+ py_geth-5.4.0.dist-info/licenses/LICENSE,sha256=ENGC4gSn0kYaC_mlaXOEwCKmA6W7Z9MeSemc5O2k-h0,1095
24
+ py_geth-5.4.0.dist-info/METADATA,sha256=DC_LPUW0v9Yv4LI8I7y3Eryn8F2zwavyvILcYTxEGXM,9265
25
+ py_geth-5.4.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
26
+ py_geth-5.4.0.dist-info/top_level.txt,sha256=o8Gvkxt3xBR7BNG2p9_G1J3GnGlTrBMEhYJBdAzBWDU,5
27
+ py_geth-5.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5