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 7
7
from eth .vm .computation import BaseComputation
8
8
from eth .vm .opcode_values import (
9
9
JUMPDEST ,
10
+ BEGINSUB ,
10
11
)
11
12
12
13
@@ -57,3 +58,40 @@ def gas(computation: BaseComputation) -> None:
57
58
gas_remaining = computation .get_gas_remaining ()
58
59
59
60
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