This repository was archived by the owner on Sep 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-17
lines changed Expand file tree Collapse file tree 1 file changed +14
-17
lines changed Original file line number Diff line number Diff line change 11from eth .exceptions import (
22 InvalidJumpDestination ,
33 InvalidInstruction ,
4+ OutOfGas ,
45 Halt ,
56)
67
@@ -61,33 +62,29 @@ def gas(computation: BaseComputation) -> None:
6162
6263
6364def beginsub (computation : BaseComputation ) -> None :
64- #TODO: raise OOG exception
65- pass
65+ raise OutOfGas
6666
6767
6868def jumpsub (computation : BaseComputation ) -> None :
6969 sub_loc = computation .stack_pop1_int ()
7070
71- temp = computation .code .program_counter
72- computation .code .program_counter = sub_loc
73-
74- next_opcode = computation .code .peek ()
75-
76- if next_opcode != BEGINSUB :
77- #TODO: abort execution
78- pass
79-
80- else :
81- computation .code .program_counter += 1
71+ if computation .code .is_valid_opcode (sub_loc ):
8272
83- computation .rstack_push_int (temp + 1 )
73+ sub_op = computation .code (sub_loc )
74+
75+ if sub_op == BEGINSUB :
76+ temp = computation .code .program_counter
77+ computation .code .program_counter = sub_loc + 1
78+ computation .rstack_push_int (temp + 1 )
8479
8580
8681def returnsub (computation : BaseComputation ) -> None :
8782
88- if computation .rstack .length == 0 :
89- #TODO: abort execution
83+ try :
84+ ret_loc = computation .rstack_pop1_int ()
85+ except InsufficientStack :
9086 pass
87+
9188
92- computation .code .program_counter = computation . rstack_pop1_int ()
89+ computation .code .program_counter = ret_loc
9390
You can’t perform that action at this time.
0 commit comments