feat(tools): use Hardfork for fork module loading#2778
Conversation
SamWilsn
left a comment
There was a problem hiding this comment.
Looks fine to me. Just the one potential improvement.
|
|
||
| def monkey_patch_optimized_state_db( | ||
| fork_name: str, state_path: Optional[str] | ||
| fork_name: Hardfork | str, state_path: Optional[str] |
There was a problem hiding this comment.
Is there anywhere that uses fork_name: str left? Would be nice to just avoid the Union here.
There was a problem hiding this comment.
Thanks, fixed in ee910c4. The optimized helpers now take Hardfork directly, and the internal str compatibility path is gone. I checked the callers and they already pass Hardfork instances.
I also moved the helper test so it does not get collected by the filler/docs jobs.
Remove the Hardfork | str union type from optimized monkey-patching functions, accepting only Hardfork directly per reviewer feedback. Move test_forks.py into tests/json_loader/ so fill/docs collection does not pick it up.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2778 +/- ##
===================================================
+ Coverage 88.17% 88.62% +0.45%
===================================================
Files 577 577
Lines 35659 35659
Branches 3490 3490
===================================================
+ Hits 31442 31604 +162
+ Misses 3654 3492 -162
Partials 563 563
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🗒️ Description
Adds
Hardfork.by_short_name()and usesHardfork.module()in tooling paths that previously loaded fork modules through hardcodedethereum.forks.<fork>paths.This centralizes short-name fork lookup and removes duplicated fork discovery logic from optimized patches, fixture loading, JSON VM loading, and t8n fork-specific helpers.
🔗 Related Issues or PRs
Fixes #1426.
✅ Checklist
just statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.Cute Animal Picture