You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_note: `,` is a concatenation operator, `+` should be interpreted as "one or more" of the preceding item, `*` should be interpreted as "zero or more" of the preceding item, and `[item]` should be interpeted as an optional item._
@@ -52,7 +52,7 @@ _note: `,` is a concatenation operator, `+` should be interpreted as "one or mor
@@ -210,7 +210,7 @@ The following instructions are introduced in EOF code:
210
210
-`CALLF (0xe3)` instruction
211
211
- deduct 5 gas
212
212
- read uint16 operand `idx`
213
-
- if `1024 < len(stack) + types[idx].max_stack_height - types[idx].inputs`, execution results in an exceptional halt
213
+
- if `1024 < len(stack) + types[idx].max_stack_increase`, execution results in an exceptional halt
214
214
- if `1024 <= len(return_stack)`, execution results in an exceptional halt
215
215
- push new element to `return_stack``(current_code_idx, pc+3)`
216
216
- update `current_code_idx` to `idx` and set `pc` to 0
@@ -220,7 +220,7 @@ The following instructions are introduced in EOF code:
220
220
-`JUMPF (0xe5)` instruction
221
221
- deduct 5 gas
222
222
- read uint16 operand `idx`
223
-
- if `1024 < len(stack) + types[idx].max_stack_height - types[idx].inputs`, execution results in an exceptional halt
223
+
- if `1024 < len(stack) + types[idx].max_stack_increase`, execution results in an exceptional halt
224
224
- set `current_code_idx` to `idx`
225
225
- set `pc = 0`
226
226
-`EOFCREATE (0xec)` instruction
@@ -335,7 +335,7 @@ The following instructions are introduced in EOF code:
335
335
- no section may have more than 127 inputs or outputs
336
336
- section type has `0x80` as outputs value, and is non-returning, if and only if this section contains neither `RETF` instructions nor `JUMPF` into returning (`outputs <= 0x7f`) sections.
337
337
- in particular, section having only `JUMPF`s to non-returning sections is non-returning itself.
338
-
- the first code section must have a type signature `(0, 0x80, max_stack_height)` (0 inputs non-returning function)
338
+
- the first code section must have a type signature `(0, 0x80, max_stack_increase)` (0 inputs non-returning function)
339
339
-`EOFCREATE``initcontainer_index` must be less than `num_container_sections`
340
340
-`EOFCREATE` the subcontainer pointed to by `initcontainer_index` must have its `len(data_section)` equal `data_size`, i.e. data section content is exactly as the size declared in the header (see [Data section lifecycle](#data-section-lifecycle))
341
341
-`EOFCREATE` the subcontainer pointed to by `initcontainer_index`*must not* contain either a `RETURN` or `STOP` instruction.
@@ -375,7 +375,7 @@ During scanning, for each instruction:
375
375
-`JUMPF` into non-returning section: `stack_height_min >= types[target_section_index].inputs`
376
376
- for any other instruction `stack_height_min` must be at least the number of inputs required by instruction,
377
377
- there is no additional check for terminating instructions other than `RETF` and `JUMPF`, this implies that extra items left on stack at instruction ending EVM execution are allowed.
378
-
2. For `CALLF` and `JUMPF` check for possible stack overflow: if `stack_height_max > 1024 - types[target_section_index].max_stack_height + types[target_section_index].inputs`, validation fails.
378
+
2. For `CALLF` and `JUMPF` check for possible stack overflow: if `stack_height_max > 1024 - types[target_section_index].max_stack_increase`, validation fails.
379
379
3. Compute new stack `stack_height_min` and `stack_height_max` after the instruction execution, both heights are updated by the same value:
- for any other non-terminating instruction: `stack_height_min += instruction_outputs - instruction_inputs`, `stack_height_max += instruction_outputs - instruction_inputs`,
@@ -391,8 +391,10 @@ During scanning, for each instruction:
391
391
2. Otherwise instruction was already visited (by previously seen forward jump). Update this instruction's recorded stack height bounds so that they contain the bounds computed in 2.3, i.e. `target_stack_min = min(target_stack_min, current_stack_min)` and `target_stack_max = max(target_stack_max, current_stack_max)`, where `(target_stack_min, target_stack_max)` are successor bounds and `(current_stack_min, current_stack_max)` are bounds computed in 2.3.
392
392
3. If the successor is reached via backwards jump, check if target bounds equal the value computed in 2.3, i.e. `target_stack_min == current_stack_min && target_stack_max == current_stack_max`. Validation fails if they are not equal, i.e. we see backwards jump to a different stack height.
393
393
394
-
- maximum data stack of a function must not exceed 1023
395
-
-`types[current_code_index].max_stack_height` must match the maximum stack height observed during validation
394
+
- Compute the maximum stack height `max_stack_height` as the maximum of all recorded stack height upper bounds.
395
+
-**Check** if the maximum stack height `max_stack_height` does not exceed the limit of 1024.
396
+
- Compute the maximum stack height increase `max_stack_increase` as `max_stack_height - type[current_section_index].inputs`.
397
+
-**Check** if the maximum stack height increase `max_stack_increase` matches the value corresponding code section's within the type section: `types[current_section_index].max_stack_increase`.
0 commit comments