ethereum / ethereum/execution-specs

Align on `Opcode`and `Bytecode` `__hash__` and `__eq__` logic

Open
#2,190 1 comment 0 reactions 0 assignees View on GitHub
stale
Dominant language
Python
Stars
1.2k
Forks
505
Avg merge
2d 8h
Merged PRs (30d)
106

Description

Some optimizations involving caching calls that deal with `Opcode` and `Bytecode` revealed that, since adding metadata to these classes, we do not take these into account when generating a unique `__hash__()` for these classes, nor when comparing via `__eq__()`. Unfortunately, for the `Opcode` case, this is relied upon in the `opcode_gas_map` so we can't just account for these without refactoring how this map works.

For more context on how these issues bubbled up and a band-aid fix, without this larger refactor, see #2185. I think the actual fix is aligning these dunder methods to take metadata into account but more discussion is needed to align on the next steps here.

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.