Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
danceratopz opened this issue Jan 19, 2024 · 1 comment
Open

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

danceratopz opened this issue Jan 19, 2024 · 1 comment
Labels
scope:forks Scope: ethereum_test_forks package type:feat type: Feature

Comments

@danceratopz
Copy link
Member

danceratopz commented Jan 19, 2024

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):

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.

@danceratopz danceratopz added scope:forks Scope: ethereum_test_forks package type:feat type: Feature labels Jan 19, 2024
@marioevz
Copy link
Member

marioevz commented Apr 2, 2024

Another option could be to import the entire library:

import ethereum_test_forks as forks
...
forks.Frontier
forks.Homestead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:forks Scope: ethereum_test_forks package type:feat type: Feature
Projects
None yet
Development

No branches or pull requests

2 participants