Skip to content

Comments

Simplify build system for computed constants#4152

Merged
jtraglia merged 2 commits intoethereum:devfrom
etan-status:py-presetconstants
Mar 9, 2025
Merged

Simplify build system for computed constants#4152
jtraglia merged 2 commits intoethereum:devfrom
etan-status:py-presetconstants

Conversation

@etan-status
Copy link
Contributor

When type definitions depend on preset values, those preset values have to be manually specified in hardcoded_custom_type_dep_constants in a manual and error prone way. By using heuristics similar to other parts of the spec builder, that can be automated so that computed constants are automatically generated after preset values are emitted. This also makes it clearer which constants are pure, and which constants depend on specific preset values being used.

When type definitions depend on preset values, those preset values have
to be manually specified in `hardcoded_custom_type_dep_constants` in a
manual and error prone way. By using heuristics similar to other parts
of the spec builder, that can be automated so that computed constants
are automatically generated _after_ preset values are emitted. This also
makes it clearer which constants are pure, and which constants depend on
specific preset values being used.
@etan-status
Copy link
Contributor Author

The diff in mainnet.py / minimal.py is solely in the removal of the redundant hardcoded values section, and moving of definitions that depend on presets to a lower location in the code where presets are available.

Copy link
Member

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a great idea. Thanks @etan-status!

@jtraglia jtraglia merged commit b419ba8 into ethereum:dev Mar 9, 2025
23 checks passed
@etan-status etan-status deleted the py-presetconstants branch March 12, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants