Skip to content

Commit

Permalink
fix(vm): Bytecode comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Nov 5, 2024
1 parent b78eb77 commit b8496fc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ethereum_test_vm/bytecode.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ def __eq__(self, other):
- NotImplementedError: if the comparison is not between an Bytecode
or a bytes object.
"""
if isinstance(other, Bytecode):
return (
bytes(self) == bytes(other)
and self.popped_stack_items == other.popped_stack_items
and self.pushed_stack_items == other.pushed_stack_items
and self.max_stack_height == other.max_stack_height
and self.min_stack_height == other.min_stack_height
)
if isinstance(other, SupportsBytes):
return bytes(self) == bytes(other)
raise NotImplementedError(f"Unsupported type for comparison f{type(other)}")
Expand Down

0 comments on commit b8496fc

Please sign in to comment.