|
16 | 16 | )
|
17 | 17 | from geth.utils.validation import (
|
18 | 18 | GenesisData,
|
19 |
| - fill_default_genesis_data, |
20 | 19 | validate_genesis_data,
|
21 | 20 | validate_geth_kwargs,
|
22 | 21 | )
|
@@ -101,176 +100,6 @@ def test_validate_genesis_data_bad(genesis_data):
|
101 | 100 | validate_genesis_data(genesis_data)
|
102 | 101 |
|
103 | 102 |
|
104 |
| -@pytest.mark.parametrize( |
105 |
| - "genesis_data,expected", |
106 |
| - [ |
107 |
| - ( |
108 |
| - { |
109 |
| - "difficulty": "0x00012131", |
110 |
| - "nonce": "abc", |
111 |
| - "timestamp": "1234", |
112 |
| - }, |
113 |
| - { |
114 |
| - "alloc": {}, |
115 |
| - "baseFeePerGas": "0x0", |
116 |
| - "blobGasUsed": "0x0", |
117 |
| - "coinbase": "0x3333333333333333333333333333333333333333", |
118 |
| - "config": { |
119 |
| - "chainId": 0, |
120 |
| - "ethash": {}, |
121 |
| - "homesteadBlock": 0, |
122 |
| - "daoForkBlock": 0, |
123 |
| - "daoForkSupport": True, |
124 |
| - "eip150Block": 0, |
125 |
| - "eip155Block": 0, |
126 |
| - "eip158Block": 0, |
127 |
| - "byzantiumBlock": 0, |
128 |
| - "constantinopleBlock": 0, |
129 |
| - "petersburgBlock": 0, |
130 |
| - "istanbulBlock": 0, |
131 |
| - "berlinBlock": 0, |
132 |
| - "londonBlock": 0, |
133 |
| - "arrowGlacierBlock": 0, |
134 |
| - "grayGlacierBlock": 0, |
135 |
| - "terminalTotalDifficulty": 0, |
136 |
| - "terminalTotalDifficultyPassed": True, |
137 |
| - "shanghaiTime": 0, |
138 |
| - "cancunTime": 0, |
139 |
| - "blobSchedule": { |
140 |
| - "cancun": { |
141 |
| - "target": 3, |
142 |
| - "max": 6, |
143 |
| - "baseFeeUpdateFraction": 3338477, |
144 |
| - } |
145 |
| - }, |
146 |
| - }, |
147 |
| - "difficulty": "0x00012131", |
148 |
| - "excessBlobGas": "0x0", |
149 |
| - "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000", # noqa: E501 |
150 |
| - "gasLimit": "0x47e7c4", |
151 |
| - "gasUsed": "0x0", |
152 |
| - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", # noqa: E501 |
153 |
| - "nonce": "abc", |
154 |
| - "number": "0x0", |
155 |
| - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", # noqa: E501 |
156 |
| - "timestamp": "1234", |
157 |
| - }, |
158 |
| - ), |
159 |
| - ( |
160 |
| - { |
161 |
| - "difficulty": "0x00012131", |
162 |
| - "nonce": "abc", |
163 |
| - "config": { |
164 |
| - "homesteadBlock": 5, |
165 |
| - "daoForkBlock": 1, |
166 |
| - "daoForkSupport": False, |
167 |
| - "eip150Block": 27777777, |
168 |
| - "eip155Block": 99, |
169 |
| - "eip158Block": 32, |
170 |
| - }, |
171 |
| - }, |
172 |
| - { |
173 |
| - "alloc": {}, |
174 |
| - "baseFeePerGas": "0x0", |
175 |
| - "blobGasUsed": "0x0", |
176 |
| - "coinbase": "0x3333333333333333333333333333333333333333", |
177 |
| - "config": { |
178 |
| - "chainId": 0, |
179 |
| - "ethash": {}, |
180 |
| - "homesteadBlock": 5, |
181 |
| - "daoForkBlock": 1, |
182 |
| - "daoForkSupport": False, |
183 |
| - "eip150Block": 27777777, |
184 |
| - "eip155Block": 99, |
185 |
| - "eip158Block": 32, |
186 |
| - "byzantiumBlock": 0, |
187 |
| - "constantinopleBlock": 0, |
188 |
| - "petersburgBlock": 0, |
189 |
| - "istanbulBlock": 0, |
190 |
| - "berlinBlock": 0, |
191 |
| - "londonBlock": 0, |
192 |
| - "arrowGlacierBlock": 0, |
193 |
| - "grayGlacierBlock": 0, |
194 |
| - "terminalTotalDifficulty": 0, |
195 |
| - "terminalTotalDifficultyPassed": True, |
196 |
| - "shanghaiTime": 0, |
197 |
| - "cancunTime": 0, |
198 |
| - "blobSchedule": { |
199 |
| - "cancun": { |
200 |
| - "target": 3, |
201 |
| - "max": 6, |
202 |
| - "baseFeeUpdateFraction": 3338477, |
203 |
| - } |
204 |
| - }, |
205 |
| - }, |
206 |
| - "difficulty": "0x00012131", |
207 |
| - "excessBlobGas": "0x0", |
208 |
| - "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000", # noqa: E501 |
209 |
| - "gasLimit": "0x47e7c4", |
210 |
| - "gasUsed": "0x0", |
211 |
| - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", # noqa: E501 |
212 |
| - "nonce": "abc", |
213 |
| - "number": "0x0", |
214 |
| - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", # noqa: E501 |
215 |
| - "timestamp": "0x0", |
216 |
| - }, |
217 |
| - ), |
218 |
| - ], |
219 |
| -) |
220 |
| -def test_fill_default_genesis_data_good(genesis_data, expected): |
221 |
| - genesis_data_td = GenesisDataTypedDict(**genesis_data) |
222 |
| - filled_genesis_data = fill_default_genesis_data(genesis_data_td).model_dump() |
223 |
| - assert filled_genesis_data == expected |
224 |
| - |
225 |
| - |
226 |
| -@pytest.mark.parametrize( |
227 |
| - "genesis_data,expected_exception,expected_message", |
228 |
| - [ |
229 |
| - ( |
230 |
| - { |
231 |
| - "difficulty": "0x00012131", |
232 |
| - "nonce": "abc", |
233 |
| - "timestamp": 1234, |
234 |
| - }, |
235 |
| - PyGethValueError, |
236 |
| - "genesis_data validation failed while filling defaults: ", |
237 |
| - ), |
238 |
| - ( |
239 |
| - { |
240 |
| - "difficulty": "0x00012131", |
241 |
| - "nonce": "abc", |
242 |
| - "config": { |
243 |
| - "homesteadBlock": 5, |
244 |
| - "daoForkBlock": "beep", |
245 |
| - "daoForkSupport": False, |
246 |
| - "eip150Block": 27777777, |
247 |
| - "eip155Block": 99, |
248 |
| - "eip158Block": 32, |
249 |
| - }, |
250 |
| - }, |
251 |
| - PyGethValueError, |
252 |
| - "genesis_data validation failed while filling config defaults: ", |
253 |
| - ), |
254 |
| - ( |
255 |
| - "abc123", |
256 |
| - PyGethValueError, |
257 |
| - "error while filling default genesis_data: ", |
258 |
| - ), |
259 |
| - ( |
260 |
| - {"difficulty": "0x00012131", "nonce": "abc", "config": ["beep"]}, |
261 |
| - PyGethValueError, |
262 |
| - "genesis_data validation failed while filling defaults: ", |
263 |
| - ), |
264 |
| - ], |
265 |
| -) |
266 |
| -def test_fill_default_genesis_data_bad( |
267 |
| - genesis_data, expected_exception, expected_message |
268 |
| -): |
269 |
| - with pytest.raises(expected_exception) as excinfo: |
270 |
| - fill_default_genesis_data(genesis_data) |
271 |
| - assert str(excinfo.value).startswith(expected_message) |
272 |
| - |
273 |
| - |
274 | 103 | @pytest.mark.skipif(sys.version_info < (3, 9), reason="get_type_hints requires >=py39")
|
275 | 104 | @pytest.mark.parametrize(
|
276 | 105 | "model, typed_dict",
|
|
0 commit comments