|
1 |
| -from eth.vm.forks.london.headers import ( |
2 |
| - create_header_from_parent, |
| 1 | +from typing import Any, Callable, Optional |
| 2 | + |
| 3 | +from toolz import curry |
| 4 | + |
| 5 | +from .blocks import ( |
| 6 | + GrayGlacierBlockHeader, |
| 7 | +) |
| 8 | +from eth.abc import ( |
| 9 | + BlockHeaderAPI, |
3 | 10 | )
|
4 |
| -from eth.vm.forks.petersburg.headers import ( |
| 11 | +from eth.vm.forks.arrow_glacier.headers import ( |
| 12 | + create_arrow_glacier_header_from_parent, |
| 13 | +) |
| 14 | +from eth.vm.forks.byzantium.headers import ( |
5 | 15 | compute_difficulty,
|
6 | 16 | )
|
7 |
| -from eth.vm.forks.istanbul.headers import ( |
| 17 | +from eth.vm.forks.byzantium.headers import ( |
8 | 18 | configure_header,
|
9 | 19 | )
|
10 | 20 |
|
11 |
| - |
12 | 21 | compute_gray_glacier_difficulty = compute_difficulty(11_400_000)
|
| 22 | +configure_gray_glacier_header = configure_header(compute_gray_glacier_difficulty) |
13 | 23 |
|
14 |
| -create_gray_glacier_header_from_parent = create_header_from_parent( |
15 |
| - compute_gray_glacier_difficulty |
16 |
| -) |
17 | 24 |
|
18 |
| -configure_gray_glacier_header = configure_header(compute_gray_glacier_difficulty) |
| 25 | +@curry |
| 26 | +def create_gray_glacier_header_from_parent( |
| 27 | + difficulty_fn: Callable[[BlockHeaderAPI, int], int], |
| 28 | + parent_header: Optional[BlockHeaderAPI], |
| 29 | + **header_params: Any |
| 30 | +) -> BlockHeaderAPI: |
| 31 | + arrow_glacier_validated_header = create_arrow_glacier_header_from_parent( |
| 32 | + difficulty_fn, parent_header, **header_params |
| 33 | + ) |
| 34 | + |
| 35 | + # extract header params validated up to arrow glacier (previous VM) and plug |
| 36 | + # into `GrayGlacierBlockHeader` class |
| 37 | + all_fields = arrow_glacier_validated_header.as_dict() |
| 38 | + return GrayGlacierBlockHeader(**all_fields) |
0 commit comments