py-geth 5.2.0__py3-none-any.whl → 5.3.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
@@ -46,6 +46,13 @@ V1_14_9 = "v1.14.9"
46
46
  V1_14_10 = "v1.14.10"
47
47
  V1_14_11 = "v1.14.11"
48
48
  V1_14_12 = "v1.14.12"
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"
49
56
 
50
57
 
51
58
  LINUX = "linux"
@@ -341,6 +348,13 @@ install_v1_14_9 = functools.partial(install_from_source_code_release, V1_14_9)
341
348
  install_v1_14_10 = functools.partial(install_from_source_code_release, V1_14_10)
342
349
  install_v1_14_11 = functools.partial(install_from_source_code_release, V1_14_11)
343
350
  install_v1_14_12 = functools.partial(install_from_source_code_release, V1_14_12)
351
+ install_v1_14_13 = functools.partial(install_from_source_code_release, V1_14_13)
352
+ install_v1_15_0 = functools.partial(install_from_source_code_release, V1_15_0)
353
+ install_v1_15_1 = functools.partial(install_from_source_code_release, V1_15_1)
354
+ install_v1_15_2 = functools.partial(install_from_source_code_release, V1_15_2)
355
+ install_v1_15_3 = functools.partial(install_from_source_code_release, V1_15_3)
356
+ install_v1_15_4 = functools.partial(install_from_source_code_release, V1_15_4)
357
+ install_v1_15_5 = functools.partial(install_from_source_code_release, V1_15_5)
344
358
 
345
359
  INSTALL_FUNCTIONS = {
346
360
  LINUX: {
@@ -356,6 +370,13 @@ INSTALL_FUNCTIONS = {
356
370
  V1_14_10: install_v1_14_10,
357
371
  V1_14_11: install_v1_14_11,
358
372
  V1_14_12: install_v1_14_12,
373
+ V1_14_13: install_v1_14_13,
374
+ V1_15_0: install_v1_15_0,
375
+ V1_15_1: install_v1_15_1,
376
+ V1_15_2: install_v1_15_2,
377
+ V1_15_3: install_v1_15_3,
378
+ V1_15_4: install_v1_15_4,
379
+ V1_15_5: install_v1_15_5,
359
380
  },
360
381
  OSX: {
361
382
  V1_14_0: install_v1_14_0,
@@ -370,6 +391,13 @@ INSTALL_FUNCTIONS = {
370
391
  V1_14_10: install_v1_14_10,
371
392
  V1_14_11: install_v1_14_11,
372
393
  V1_14_12: install_v1_14_12,
394
+ V1_14_13: install_v1_14_13,
395
+ V1_15_0: install_v1_15_0,
396
+ V1_15_1: install_v1_15_1,
397
+ V1_15_2: install_v1_15_2,
398
+ V1_15_3: install_v1_15_3,
399
+ V1_15_4: install_v1_15_4,
400
+ V1_15_5: install_v1_15_5,
373
401
  },
374
402
  }
375
403
 
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/types.py CHANGED
@@ -17,6 +17,7 @@ class GethKwargsTypedDict(TypedDict, total=False):
17
17
  cache: str | None
18
18
  data_dir: str | None
19
19
  dev_mode: bool | None
20
+ dev_period: str | None
20
21
  gcmode: Literal["full", "archive"] | None
21
22
  geth_executable: str | None
22
23
  ipc_disable: bool | None
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 (
@@ -26,6 +27,7 @@ class GethKwargs(BaseModel):
26
27
  cache: str | None = None
27
28
  data_dir: str | None = None
28
29
  dev_mode: bool | None = False
30
+ dev_period: str | None = None
29
31
  gcmode: Literal["full", "archive"] | None = None
30
32
  geth_executable: str | None = None
31
33
  ipc_disable: bool | None = None
@@ -71,52 +73,67 @@ def validate_geth_kwargs(geth_kwargs: GethKwargsTypedDict) -> None:
71
73
 
72
74
 
73
75
  class GenesisDataConfig(BaseModel):
74
- chainId: int = 0
75
- ethash: dict[str, Any] = {} # so that geth treats config as PoW -> PoS transition
76
- homesteadBlock: int = 0
77
- daoForkBlock: int = 0
78
- daoForkSupport: bool = True
79
- eip150Block: int = 0
80
- eip155Block: int = 0
81
- eip158Block: int = 0
82
- byzantiumBlock: int = 0
83
- constantinopleBlock: int = 0
84
- petersburgBlock: int = 0
85
- istanbulBlock: int = 0
86
- berlinBlock: int = 0
87
- londonBlock: int = 0
88
- arrowGlacierBlock: int = 0
89
- 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
90
96
  # merge
91
- terminalTotalDifficulty: int = 0
92
- terminalTotalDifficultyPassed: bool = True
97
+ terminalTotalDifficulty: int | None = None
98
+ terminalTotalDifficultyPassed: bool | None = None
93
99
  # post-merge, timestamp is used for network transitions
94
- shanghaiTime: int = 0
95
- cancunTime: int = 0
96
-
97
- 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
98
119
 
99
120
 
100
121
  class GenesisData(BaseModel):
101
122
  alloc: dict[str, dict[str, Any]] = {}
102
- baseFeePerGas: str = "0x0"
103
- blobGasUsed: str = "0x0"
104
- coinbase: str = "0x3333333333333333333333333333333333333333"
123
+ baseFeePerGas: str | None = None
124
+ blobGasUsed: str | None = None
125
+ coinbase: str | None = None
105
126
  config: dict[str, Any] = GenesisDataConfig().model_dump()
106
- difficulty: str = "0x0"
107
- excessBlobGas: str = "0x0"
108
- extraData: str = (
109
- "0x0000000000000000000000000000000000000000000000000000000000000000"
110
- )
111
- gasLimit: str = "0x47e7c4"
112
- gasUsed: str = "0x0"
113
- mixHash: str = "0x0000000000000000000000000000000000000000000000000000000000000000"
114
- nonce: str = "0x0"
115
- number: str = "0x0"
116
- parentHash: str = (
117
- "0x0000000000000000000000000000000000000000000000000000000000000000"
118
- )
119
- 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
120
137
 
121
138
  model_config = ConfigDict(extra="forbid")
122
139
 
@@ -145,35 +162,3 @@ def validate_genesis_data(genesis_data: GenesisDataTypedDict) -> None:
145
162
  raise PyGethValueError(
146
163
  f"error while validating genesis_data config field: {e}"
147
164
  )
148
-
149
-
150
- def fill_default_genesis_data(
151
- genesis_data: GenesisDataTypedDict,
152
- ) -> GenesisData:
153
- """
154
- Fills in default values for the genesis data
155
- """
156
- try:
157
- genesis_data_filled = GenesisData(**genesis_data)
158
- except ValidationError as e:
159
- raise PyGethValueError(
160
- f"genesis_data validation failed while filling defaults: {e}"
161
- )
162
- except TypeError as e:
163
- raise PyGethValueError(f"error while filling default genesis_data: {e}")
164
-
165
- if genesis_data.get("config"):
166
- try:
167
- genesis_data_config_filled = GenesisDataConfig(**genesis_data["config"])
168
- except ValidationError as e:
169
- raise PyGethValueError(
170
- f"genesis_data validation failed while filling config defaults: {e}"
171
- )
172
- except TypeError as e:
173
- raise PyGethValueError(
174
- f"error while filling default genesis_data config: {e}"
175
- )
176
-
177
- genesis_data_filled.config = genesis_data_config_filled.model_dump()
178
-
179
- return genesis_data_filled
geth/wrapper.py CHANGED
@@ -153,6 +153,9 @@ def construct_popen_command(**geth_kwargs: Unpack[GethKwargsTypedDict]) -> list[
153
153
  if gk.dev_mode:
154
154
  builder.append("--dev")
155
155
 
156
+ if gk.dev_period is not None:
157
+ builder.extend(("--dev.period", gk.dev_period))
158
+
156
159
  if gk.rpc_enabled:
157
160
  builder.append("--http")
158
161
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: py-geth
3
- Version: 5.2.0
3
+ Version: 5.3.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
@@ -138,6 +138,8 @@ False
138
138
  False
139
139
  >>> geth.is_stopped
140
140
  True
141
+ >>> geth.version
142
+ "1.15.5-stable"
141
143
  ```
142
144
 
143
145
  When testing it can be nice to see the logging output produced by the `geth`
@@ -177,19 +179,19 @@ the current list of supported versions.
177
179
  Installation can be done via the command line:
178
180
 
179
181
  ```bash
180
- $ python -m geth.install v1.14.12
182
+ $ python -m geth.install v1.15.5
181
183
  ```
182
184
 
183
185
  Or from python using the `install_geth` function.
184
186
 
185
187
  ```python
186
188
  >>> from geth import install_geth
187
- >>> install_geth('v1.14.12')
189
+ >>> install_geth('v1.15.5')
188
190
  ```
189
191
 
190
192
  The installed binary can be found in the `$HOME/.py-geth` directory, under your
191
- home directory. The `v1.14.12` binary would be located at
192
- `$HOME/.py-geth/geth-v1.14.12/bin/geth`.
193
+ home directory. The `v1.15.5` binary would be located at
194
+ `$HOME/.py-geth/geth-v1.15.5/bin/geth`.
193
195
 
194
196
  ## About `DevGethProcess`
195
197
 
@@ -1,17 +1,17 @@
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=slY0AvnYCXvxznUdvkCJ_pPAhmePgux8WlZ7QMQaoKk,11459
6
+ geth/genesis.json,sha256=HPY88vd1cD0bXKB2Fd59EQ08oK6uVTOehHqSmckuYBY,1224
7
+ geth/install.py,sha256=1U7i7eb9p9ywbdt2skOjZ_1zS7vX41RBSSBIXkbvbkc,12636
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
- geth/types.py,sha256=El5Q7ZnR7d_z7jliYhbH2df1FxaKOVHgxlyD8U-qzt0,1454
14
- geth/wrapper.py,sha256=yPr0wyczd7ngLRJekIPinXyTP7cLtwyiWDTYxMlo-oU,7882
13
+ geth/types.py,sha256=9BesREN7IuJVM2BagzUfIZ0VjJTAcRFJgEF7NyLHugY,1481
14
+ geth/wrapper.py,sha256=ah15HNG42sgMwSu6fYu0ouZ4QCE9jyoaPuOji69OEio,7973
15
15
  geth/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  geth/utils/encoding.py,sha256=YguGD7mEUN2eSMPkBREalKK1VQfOsLcj1WWJLR0HTxY,1618
17
17
  geth/utils/filesystem.py,sha256=yg8m8n99-N0FA4NcNtu9V8mett2WTQPKHGjThrbk974,1320
@@ -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=YG3l98_EaweqUjElRJRxtdEldRwOz9cYii00PR74RkI,5396
23
- py_geth-5.2.0.dist-info/LICENSE,sha256=ENGC4gSn0kYaC_mlaXOEwCKmA6W7Z9MeSemc5O2k-h0,1095
24
- py_geth-5.2.0.dist-info/METADATA,sha256=6npuEUtNiQVeddMOdsikaJdTD2o1ZdCJJUIz-QmGDGA,9214
25
- py_geth-5.2.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
26
- py_geth-5.2.0.dist-info/top_level.txt,sha256=o8Gvkxt3xBR7BNG2p9_G1J3GnGlTrBMEhYJBdAzBWDU,5
27
- py_geth-5.2.0.dist-info/RECORD,,
22
+ geth/utils/validation.py,sha256=rMwaB2DSKNG8-NXx269YwUrOAfzuckqTBwA4wqjgebY,5030
23
+ py_geth-5.3.0.dist-info/LICENSE,sha256=ENGC4gSn0kYaC_mlaXOEwCKmA6W7Z9MeSemc5O2k-h0,1095
24
+ py_geth-5.3.0.dist-info/METADATA,sha256=EACXhezVgzgQnpQ7gv6MVFHbB6_FIywJp6l7BItHl_w,9243
25
+ py_geth-5.3.0.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
26
+ py_geth-5.3.0.dist-info/top_level.txt,sha256=o8Gvkxt3xBR7BNG2p9_G1J3GnGlTrBMEhYJBdAzBWDU,5
27
+ py_geth-5.3.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5