ethereum / ethereum/execution-specs
Refactor post-frontier gas constant's init to use non-zero value as sentinel
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 505
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 116
Description
Using zero as a sentinel for "not present" could cause issues, because zero is also (obviously) a valid integer. I can foresee a scenario where we accidentally assume `OPCODE_SHL` is present where it was set to zero, mypy wouldn't be able to detect it, and we end up with a zero cost operation. Using `int | None` would force developers to assert at the time of use.
That said, if this is already how the code works, changing it would be out of scope for this PR and this should be addressed in a separate issue.
_Originally posted by @SamWilsn in https://github.com/ethereum/execution-specs/pull/2396#discussion_r3023410536_
Contributor guide
Assessment
This issue has not been assessed yet.