ethereum / ethereum/execution-specs
`Hardfork` doesn't respect `base` when importing sub-modules
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 505
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 116
Description
### What was wrong?
The `Hardfork` class allows specifying a base path to search for modules:
https://github.com/ethereum/execution-specs/blob/ea802a084b154a4b54a04dab73bf61e3493ccf31/src/ethereum_spec_tools/forks.py#L65
It also provides methods for importing submodules of discovered forks:
https://github.com/ethereum/execution-specs/blob/ea802a084b154a4b54a04dab73bf61e3493ccf31/src/ethereum_spec_tools/forks.py#L274-L303
Unfortunately, `Hardfork` doesn't consider `base` when importing those submodules. It just relies on the default import machinery.
### How can it be fixed?
Use [`spec_from_file_location`](https://docs.python.org/3/library/importlib.html#importlib.util.spec_from_file_location) and `module_from_spec` when loading submodules.
Contributor guide
Assessment
This issue has not been assessed yet.