Skip to content

Commit 1e99293

Browse files
authored
chore(specs): Fix 1753 fork criteria (#1760)
* Refactor FORK_CRITERIA type annotation * Refactor FORK_CRITERIA to use ForkCriteria type * Refactor FORK_CRITERIA to use ForkCriteria type * Import ForkCriteria and update FORK_CRITERIA type * Refactor FORK_CRITERIA to use ForkCriteria type * Update __init__.py * Refactor FORK_CRITERIA to use ForkCriteria type * Refactor FORK_CRITERIA to use ForkCriteria type * Refactor FORK_CRITERIA to use ForkCriteria type * Refactor FORK_CRITERIA to use ForkCriteria type * Refactor FORK_CRITERIA to use ForkCriteria type * Update __init__.py * Refactor FORK_CRITERIA to use ForkCriteria type * Update __init__.py * Refactor FORK_CRITERIA to use ForkCriteria type * Refactor FORK_CRITERIA to use ForkCriteria type * Refactor FORK_CRITERIA to use ForkCriteria type * Add ForkCriteria type annotation to FORK_CRITERIA * fix(type): Mypy and style corrections for FORK_CRITERIA annotation (fixes #1753)
1 parent 6a01661 commit 1e99293

File tree

20 files changed

+42
-36
lines changed

20 files changed

+42
-36
lines changed

src/ethereum/forks/arrow_glacier/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
[nm]: https://github.com/NethermindEth/nethermind/releases/tag/1.11.7
2929
""" # noqa: E501
3030

31-
from ethereum.fork_criteria import ByBlockNumber
31+
from ethereum.fork_criteria import ByBlockNumber, ForkCriteria
3232

33-
FORK_CRITERIA = ByBlockNumber(13773000)
33+
FORK_CRITERIA: ForkCriteria = ByBlockNumber(13773000)

src/ethereum/forks/berlin/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
[oe]: https://github.com/openethereum/openethereum/releases/tag/v3.2.0
3939
""" # noqa: E501
4040

41-
from ethereum.fork_criteria import ByBlockNumber
41+
from ethereum.fork_criteria import ByBlockNumber, ForkCriteria
4242

43-
FORK_CRITERIA = ByBlockNumber(12244000)
43+
FORK_CRITERIA: ForkCriteria = ByBlockNumber(12244000)

src/ethereum/forks/byzantium/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@
4545
[p]: https://github.com/paritytech/parity/releases/tag/v1.7.6
4646
"""
4747

48-
from ethereum.fork_criteria import ByBlockNumber
48+
from ethereum.fork_criteria import ByBlockNumber, ForkCriteria
4949

50-
FORK_CRITERIA = ByBlockNumber(4370000)
50+
FORK_CRITERIA: ForkCriteria = ByBlockNumber(4370000)

src/ethereum/forks/cancun/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@
4444
[r]: https://github.com/paradigmxyz/reth/releases/tag/v0.1.0-alpha.19
4545
""" # noqa: E501
4646

47-
from ethereum.fork_criteria import ByTimestamp
47+
from ethereum.fork_criteria import ByTimestamp, ForkCriteria
4848

49-
FORK_CRITERIA = ByTimestamp(1710338135)
49+
FORK_CRITERIA: ForkCriteria = ByTimestamp(1710338135)

src/ethereum/forks/constantinople/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@
4646
[t]: https://github.com/ethereum/trinity/releases/tag/v0.1.0-alpha.23
4747
""" # noqa: E501
4848

49-
from ethereum.fork_criteria import ByBlockNumber
49+
from ethereum.fork_criteria import ByBlockNumber, ForkCriteria
5050

51-
FORK_CRITERIA = ByBlockNumber(7280000)
51+
FORK_CRITERIA: ForkCriteria = ByBlockNumber(7280000)

src/ethereum/forks/dao_fork/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
[Geth 1.4.10]: https://github.com/ethereum/go-ethereum/releases/tag/v1.4.10
2525
"""
2626

27-
from ethereum.fork_criteria import ByBlockNumber
27+
from ethereum.fork_criteria import ByBlockNumber, ForkCriteria
2828

29-
FORK_CRITERIA = ByBlockNumber(1920000)
29+
FORK_CRITERIA: ForkCriteria = ByBlockNumber(1920000)

src/ethereum/forks/dao_fork/fork.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
InvalidSenderError,
3030
NonceMismatchError,
3131
)
32+
from ethereum.fork_criteria import ByBlockNumber
3233

3334
from . import FORK_CRITERIA, vm
3435
from .blocks import Block, Header, Log, Receipt
@@ -271,6 +272,8 @@ def validate_header(chain: BlockChain, header: Header) -> None:
271272
if header.parent_hash != block_parent_hash:
272273
raise InvalidBlock
273274

275+
assert isinstance(FORK_CRITERIA, ByBlockNumber)
276+
274277
if (
275278
header.number >= FORK_CRITERIA.block_number
276279
and header.number < FORK_CRITERIA.block_number + Uint(10)

src/ethereum/forks/frontier/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
Frontier is the first production-ready iteration of the Ethereum protocol.
33
"""
44

5-
from ethereum.fork_criteria import ByBlockNumber
5+
from ethereum.fork_criteria import ByBlockNumber, ForkCriteria
66

7-
FORK_CRITERIA = ByBlockNumber(0)
7+
FORK_CRITERIA: ForkCriteria = ByBlockNumber(0)

src/ethereum/forks/gray_glacier/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
[n]: https://github.com/NethermindEth/nethermind/releases/tag/1.13.3
3030
""" # noqa: E501
3131

32-
from ethereum.fork_criteria import ByBlockNumber
32+
from ethereum.fork_criteria import ByBlockNumber, ForkCriteria
3333

34-
FORK_CRITERIA = ByBlockNumber(15050000)
34+
FORK_CRITERIA: ForkCriteria = ByBlockNumber(15050000)

src/ethereum/forks/homestead/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
[Geth 1.3.5]: https://github.com/ethereum/go-ethereum/releases/tag/v1.3.5
3030
"""
3131

32-
from ethereum.fork_criteria import ByBlockNumber
32+
from ethereum.fork_criteria import ByBlockNumber, ForkCriteria
3333

34-
FORK_CRITERIA = ByBlockNumber(1150000)
34+
FORK_CRITERIA: ForkCriteria = ByBlockNumber(1150000)

0 commit comments

Comments
 (0)