Skip to content

Commit

Permalink
fix op.oog issues
Browse files Browse the repository at this point in the history
  • Loading branch information
winsvega committed Mar 12, 2024
1 parent c0a2985 commit a0eb5bd
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/ethereum_test_tools/vm/opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __new__(
"""
Creates a new opcode instance.
"""
if type(opcode_or_byte) is Opcode:
if type(opcode_or_byte) is Opcode or type(opcode_or_byte) is Macro:
# Required because Enum class calls the base class with the instantiated object as
# parameter.
return opcode_or_byte
Expand All @@ -73,7 +73,7 @@ def __new__(
obj.min_stack_height = min_stack_height
obj.data_portion_length = data_portion_length
return obj
assert False
raise TypeError("Opcode constructor '__new__' didn't return an instance!")

def __call__(self, *args_t: Union[int, bytes, str, "Opcode", FixedSizeBytes]) -> bytes:
"""
Expand Down Expand Up @@ -4582,8 +4582,8 @@ class Opcodes(Opcode, Enum):
Inputs
----
- value: value in wei to send to the new account
- offset: byte offset in the memory in bytes, the initialisation code for the new account
- size: byte size to copy (size of the initialisation code)
- offset: byte offset in the memory in bytes, the initialization code for the new account
- size: byte size to copy (size of the initialization code)
Outputs
----
Expand Down Expand Up @@ -4769,8 +4769,8 @@ class Opcodes(Opcode, Enum):
Inputs
----
- value: value in wei to send to the new account
- offset: byte offset in the memory in bytes, the initialisation code of the new account
- size: byte size to copy (size of the initialisation code)
- offset: byte offset in the memory in bytes, the initialization code of the new account
- size: byte size to copy (size of the initialization code)
- salt: 32-byte value used to create the new account at a deterministic address
Outputs
Expand Down Expand Up @@ -4913,7 +4913,7 @@ class Opcodes(Opcode, Enum):

OOG = Macro(SHA3(0, 100000000000))
"""
OOG(args)
OOG(args) [Macro]
----
Halt execution by consuming all available gas
Expand All @@ -4928,6 +4928,11 @@ class Opcodes(Opcode, Enum):
Gas
----
Source: SHA3(0, 100000000000)
This operation will result in gasprice = 19073514453125027
Add a little more and geth report gasprice = 30 with oog exception
Make it 0 - 1 and geth report gasprice > u64 error
Bytecode
----
SHA3(0, 100000000000)
"""

0 comments on commit a0eb5bd

Please sign in to comment.