File tree Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 22
22
opcode_values .JUMPSUB : as_opcode (
23
23
logic_fn = flow .jumpsub ,
24
24
mnemonic = mnemonics .JUMPSUB ,
25
- gas_cost = constants .GAS_MID ,
25
+ gas_cost = constants .GAS_HIGH ,
26
26
),
27
27
opcode_values .RETURNSUB : as_opcode (
28
28
logic_fn = flow .returnsub ,
29
29
mnemonic = mnemonics .RETURNSUB ,
30
- gas_cost = constants .GAS_VERYLOW ,
30
+ gas_cost = constants .GAS_LOW ,
31
31
),
32
32
}
33
33
Original file line number Diff line number Diff line change @@ -71,20 +71,19 @@ def jumpsub(computation: BaseComputation) -> None:
71
71
72
72
if computation .code .is_valid_opcode (sub_loc ):
73
73
74
- sub_op = computation .code . is_valid_opcode ( sub_loc )
74
+ sub_op = computation .code [ sub_loc ]
75
75
76
76
if sub_op == BEGINSUB :
77
77
temp = computation .code .program_counter
78
78
computation .code .program_counter = sub_loc + 1
79
- computation .rstack_push_int (temp + 1 )
79
+ computation .rstack_push_int (temp )
80
80
81
81
82
82
def returnsub (computation : BaseComputation ) -> None :
83
-
84
83
try :
85
84
ret_loc = computation .rstack_pop1_int ()
86
85
except InsufficientStack :
87
- pass
86
+ raise InsufficientStack ( "Error: at pc={}, op=RETURNSUB: invalid retsub" . format ( computation . code . program_counter ))
88
87
89
88
90
89
computation .code .program_counter = ret_loc
Original file line number Diff line number Diff line change 91
91
MSIZE = 0x59
92
92
GAS = 0x5a
93
93
JUMPDEST = 0x5b
94
+
95
+
94
96
#
95
97
# Subroutines
96
98
#
97
99
BEGINSUB = 0x5c
98
100
RETURNSUB = 0x5d
99
101
JUMPSUB = 0x5e
100
102
103
+
101
104
#
102
105
# Push Operations
103
106
#
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def __init__(self) -> None:
36
36
self ._pop_typed = values .pop
37
37
self .__len__ = values .__len__
38
38
39
- def push_int (self ) -> int :
39
+ def push_int (self , value ) -> int :
40
40
if len (self .values ) > 1023 :
41
41
raise FullStack ('Stack limit reached' )
42
42
You can’t perform that action at this time.
0 commit comments