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 +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 77from eth .vm .computation import BaseComputation
88from eth .vm .opcode_values import (
99 JUMPDEST ,
10+ BEGINSUB ,
1011)
1112
1213
@@ -57,3 +58,40 @@ def gas(computation: BaseComputation) -> None:
5758 gas_remaining = computation .get_gas_remaining ()
5859
5960 computation .stack_push_int (gas_remaining )
61+
62+
63+ def beginsub (computation : BaseComputation ) -> None :
64+ #TODO: raise OOG exception
65+ pass
66+
67+
68+ def jumpsub (computation : BaseComputation ) -> None :
69+ sub_loc = computation .stack_pop1_int ()
70+
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
82+
83+ if computation .rstack .length >= 1023 :
84+ #TODO: abort execution
85+ pass
86+
87+ computation .rstack_push_int (temp + 1 )
88+
89+
90+ def returnsub (computation : BaseComputation ) -> None :
91+
92+ if computation .rstack .length == 0 :
93+ #TODO: abort execution
94+ pass
95+
96+ computation .code .program_counter = computation .rstack_pop1_int ()
97+
You can’t perform that action at this time.
0 commit comments