Skip to content

Commit

Permalink
fix _eq_ compare for opcodes and macros
Browse files Browse the repository at this point in the history
  • Loading branch information
winsvega committed Mar 26, 2024
1 parent 84e3072 commit 3785564
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ethereum_test_tools/vm/opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ def __str__(self) -> str:
def __eq__(self, other):
"""
Required to differentiate between SELFDESTRUCT and SENDALL type of cases
And to register the Macro opcodes which are defined from same bytes
And to compare with the Macro opcodes
"""
if isinstance(other, OpcodeMacroBase):
return self._name_ == other._name_
return False
if isinstance(other, bytes):
return bytes(self) == other
return NotImplementedError(f"Unsupported type for comparison f{type(other)}")


class Opcode(OpcodeMacroBase):
Expand Down

0 comments on commit 3785564

Please sign in to comment.