ethereum / ethereum/execution-specs

feat(forks): define an enum that contains all available forks

Open
#1,473 2 comments 2 reactions 0 assignees View on GitHub
A-test-forks C-feat P-low stale
Dominant language
Python
Stars
1.2k
Forks
505
Avg merge
2d 14h
Merged PRs (30d)
116

Description

Define an enum that contains all available forks.

The initial aim was to use these forks in validity markers (whose arguments are currently string, not fork types). This would allow auto-complete and static type checking.

However, it might be possible to use this enum everywhere instead of importing each fork individually. Currently, we have (which can be a bit cumbersome if importing many forks):
```python
from ethereum_test_forks import Paris, Shanghai
```

If we define our enum cleverly, we could simply:
```python
from ethereum_test_forks import Forks
```
and use `Forks.Paris` and `Forks.Shanghai`. This is perhaps not quite as compact, but definitely more useful when writing code. We'd need to see if it's possible to modify the enum class to return the fork class object directly, otherwise we'd have to use `Forks.Paris.value`, which is not acceptable.

Also we'd have a unified way of defining forks in regular code and in validity markers.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.