diff --git a/EIPS/eip-6206.md b/EIPS/eip-6206.md index 8f9a24ed13dec..8b1b76263bffb 100644 --- a/EIPS/eip-6206.md +++ b/EIPS/eip-6206.md @@ -26,9 +26,10 @@ A new instruction, `JUMPF (0xb2)`, is introduced. ### Execution Semantics 1. `JUMPF` has one immediate argument, `code_section_index`, encoded as a 16-bit unsigned big-endian value. -2. If the operand stack size exceeds `1024 - type[code_section_index].max_stack_height` (i.e. if the called function may exceed the global stack height limit), execution results in an exceptional halt. This guarantees that the stack height after the call is within the limits. -3. `JUMPF` costs 5 gas. -4. `JUMPF` neither pops nor pushes anything to the operand stack. +2. If the operand stack size exceeds `1024 - type[code_section_index].max_stack_height` (i.e. if the called function may exceed the global stack height limit), execution results in an exceptional halt. This guarantees that the target function does not exceed global stack height limit. +3. `JUMPF` sets `current_section_index` to `code_section_index` and `PC` to `0`, but does not change the return stack. Execution continues in the target section. +4. `JUMPF` costs 5 gas. +5. `JUMPF` neither pops nor pushes anything to the operand stack. ### Code Validation @@ -36,7 +37,8 @@ Let the definition of `type[i]` be inherited from [EIP-4750](./eip-4750.md) and * The immediate argument of `JUMPF` MUST be less than the total number of code sections. * For each `JUMPF` instruction `type[current_section_index].outputs` MUST be greater or equal `type[code_section_index].outputs`. -* The stack height at `JUMPF` MUST be equal to `type[current_section_index].outputs + type[code_section_index].inputs - type[code_section_index].outputs`. This means that `code_section_index` can output less stack elements than the original code section called by the top element on the return stack, if the `current_section_index` code section leaves the delta `type[current_section_index].outputs - type[code_section_index].outputs` element(s) on the stack. +* The stack height at `JUMPF` MUST be equal to `type[current_section_index].outputs + type[code_section_index].inputs - type[code_section_index].outputs`. This means that target section can output less stack elements than the original code section called by the top element on the return stack, if the current code section leaves the delta `type[current_section_index].outputs - type[code_section_index].outputs` element(s) on the stack. +* `JUMPF` is considered terminating instruction, i.e. does not have successor instructions in code validation and MAY be final instruction in the section. * The code validation defined in [EIP-4200](./eip-4200.md) also fails if any `RJUMP*` offset points to one of the two bytes directly following a `JUMPF` instruction. ## Rationale