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):
from ethereum_test_forks import Paris, Shanghai
If we define our enum cleverly, we could simply:
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.
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):
If we define our enum cleverly, we could simply:
and use
Forks.Paris
andForks.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 useForks.Paris.value
, which is not acceptable.Also we'd have a unified way of defining forks in regular code and in validity markers.