ethereum / ethereum/execution-specs

Refactor post-frontier gas constant's init to use non-zero value as sentinel

Open
#2,659 2 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.