From a464a850d3507b714251827679a1d94a61a49f8f Mon Sep 17 00:00:00 2001 From: Dimitry Kh Date: Tue, 26 Mar 2024 11:49:02 +0100 Subject: [PATCH] fix _eq_ compare for opcodes and macros --- src/ethereum_test_tools/vm/opcode.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ethereum_test_tools/vm/opcode.py b/src/ethereum_test_tools/vm/opcode.py index 4edd4d7c21..fea67d5156 100644 --- a/src/ethereum_test_tools/vm/opcode.py +++ b/src/ethereum_test_tools/vm/opcode.py @@ -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 + raise NotImplementedError(f"Unsupported type for comparison f{type(other)}") class Opcode(OpcodeMacroBase):