@@ -74,7 +74,7 @@ These changes do not affect the semantics of existing EVM code.
74
74
75
75
This should jump into a subroutine, back out and stop.
76
76
77
- Bytecode: ` 0x6004b300b2b7 `
77
+ Bytecode: ` 0x60045e005c5d ` ( ` PUSH1 0x04, JUMPSUB, STOP, BEGINSUB, RETURNSUB ` )
78
78
79
79
| Pc | Op | Cost | Stack | RStack |
80
80
| -------| -------------| ------| -----------| -----------|
@@ -90,7 +90,7 @@ Consumed gas: `18`
90
90
91
91
This should execute fine, going into one two depths of subroutines
92
92
93
- Bytecode: ` 0x6800000000000000000cb300b26011b3b7b2b7 `
93
+ Bytecode: ` 0x6800000000000000000c5e005c60115e5d5c5d ` ( ` PUSH9 0x00000000000000000c, JUMPSUB, STOP, BEGINSUB, PUSH1 0x11, JUMPSUB, RETURNSUB, BEGINSUB, RETURNSUB ` )
94
94
95
95
| Pc | Op | Cost | Stack | RStack |
96
96
| -------| -------------| ------| -----------| -----------|
@@ -109,7 +109,7 @@ Consumed gas: `36`
109
109
This should fail, since the given location is outside of the code-range. The code is the same as previous example,
110
110
except that the pushed location is ` 0x01000000000000000c ` instead of ` 0x0c ` .
111
111
112
- Bytecode: ` 0x6801000000000000000cb300b26011b3b7b2b7 `
112
+ Bytecode: ` 0x6801000000000000000c5e005c60115e5d5c5d ` ( ` PUSH9 0x01000000000000000c, JUMPSUB, STOP, BEGINSUB, PUSH1 0x11, JUMPSUB, RETURNSUB, BEGINSUB, RETURNSUB ` )
113
113
114
114
| Pc | Op | Cost | Stack | RStack |
115
115
| -------| -------------| ------| -----------| -----------|
@@ -124,7 +124,7 @@ Error: at pc=10, op=JUMPSUB: invalid jump destination
124
124
125
125
This should fail at first opcode, due to shallow ` return_stack `
126
126
127
- Bytecode: ` 0xb75858 ` (` RETURNSUB ` , ` PC ` , ` PC ` )
127
+ Bytecode: ` 0x5d5858 ` (` RETURNSUB, PC, PC ` )
128
128
129
129
| Pc | Op | Cost | Stack | RStack |
130
130
| -------| -------------| ------| -----------| -----------|
@@ -138,7 +138,7 @@ Error: at pc=0, op=RETURNSUB: invalid retsub
138
138
139
139
In this example. the JUMPSUB is on the last byte of code. When the subroutine returns, it should hit the 'virtual stop' _ after_ the bytecode, and not exit with error
140
140
141
- Bytecode: ` 0x600556b2b75b6003b3 `
141
+ Bytecode: ` 0x6005565c5d5b60035e ` ( ` PUSH1 0x05, JUMP, BEGINSUB, RETURNSUB, JUMPDEST, PUSH1 0x03, JUMPSUB ` )
142
142
143
143
| Pc | Op | Cost | Stack | RStack |
144
144
| -------| -------------| ------| -----------| -----------|
@@ -156,7 +156,7 @@ Consumed gas: `30`
156
156
157
157
In this example, the code 'walks' into a subroutine, which is not allowed, and causes an error
158
158
159
- Bytecode: ` 0xb2b700 `
159
+ Bytecode: ` 0x5c5d00 ` ( ` BEGINSUB, RETURNSUB, STOP ` )
160
160
161
161
162
162
| Pc | Op | Cost | Stack | RStack |
@@ -193,9 +193,9 @@ Benchmarking might be needed to tell if the costs are well-balanced.
193
193
We suggest the following opcodes:
194
194
195
195
```
196
- 0xb2 BEGINSUB
197
- 0xb3 JUMPSUB
198
- 0xb7 RETURNSUB
196
+ 0x5c BEGINSUB
197
+ 0x5d RETURNSUB
198
+ 0x5e JUMPSUB
199
199
```
200
200
201
201
## Security Considerations
0 commit comments