Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

EIP-8013 proposes encoding EVM jump destinations as relative offsets within instructions so that control flow is easier to analyze before execution.

Existing JUMP and JUMPI instructions obtain their destinations from the stack. EIP-8013 instead introduces static relative jump instructions that carry signed offsets as immediate operands, allowing their destinations to be validated before execution.

This article explains the original proposal below.

Overview

EIP-8013 proposes five new EVM instructions.

Instruction Opcode Purpose
RJUMP 0xe0 Unconditionally jumps to a relative destination.
RJUMPI 0xe1 Jumps to a relative destination only when the condition is true.
RJUMPV 0xe2 Selects a destination from a jump table using a stack value.
RJUMPSUB 0xe3 Makes a relative jump to a subroutine.
RJUMPSUBV 0xe4 Selects a subroutine from a jump table.

Each instruction obtains its destination from immediate data embedded in the bytecode. The RJUMP, RJUMPI, and RJUMPSUB instructions carry a two-byte relative offset. The RJUMPV and RJUMPSUBV instructions use a jump table containing max_index and multiple relative offsets.

The following diagram compares conventional JUMP and JUMPI instructions with EIP-8013.

Overview of EIP-8013

On the left, the conventional instructions obtain a destination address from the stack. Analysis tools and implementations must account for runtime stack values when determining the destination. On the right, EIP-8013 derives the destination from a relative offset encoded in the instruction itself, making control flow easier to inspect before execution.

The proposal does not immediately remove the existing JUMP and JUMPI instructions. It introduces the RJUMP family for statically known control flow while retaining dynamic jumps where they are needed.

Motivation

EVM jumps are highly flexible. Both JUMP and JUMPI obtain their destinations from the stack, allowing the destination to be determined at runtime. That flexibility makes bytecode analysis and validation more difficult.

For example, if a JUMP destination depends on the result of a runtime computation, an analysis tool cannot necessarily determine it in advance. Valid dynamic jump destinations must also be marked with JUMPDEST. Although this is an important safety mechanism, requiring the same approach for statically known jumps adds bytecode size and execution costs.

Not all control flow needs to be dynamic. Compilers can determine destinations for many constructs, including if, while, switch, and function calls, during code generation. EIP-8013 allows such destinations to be represented as relative offsets.

The proposal has three main objectives.

  • Make jump destinations easier to validate before execution.
  • Reduce the need for JUMPDEST, saving bytecode space and gas.
  • Make control flow easier to handle in compilers, static analysis, ahead-of-time compilation, and circuit generation for zero-knowledge proofs.

The proposal builds on work to introduce static control flow to the EVM. In particular, EIP-7979 describes the subroutine instructions CALLSUB, ENTERSUB, and RETURNSUB, together with a validated-code model. EIP-8013 extends that validation approach to check that relative jump instructions target valid instruction boundaries.

Specification

The central concept in EIP-8013 is a relative offset measured from the position immediately after an instruction. The proposal calls this position PC_post_instruction: the program counter after the opcode and all of its immediate operands have been read.

The relative_offset is a signed 16-bit integer encoded in big-endian, two's-complement form. It therefore supports both forward and backward jumps. The largest positive offset is 32767 bytes.

The following diagram illustrates the offset calculation.

Base position for relative offsets

The base position is not the start of the RJUMP instruction. It is the position immediately after its immediate data. Adding the relative offset to this position gives the destination. A valid destination must be an instruction boundary; locations inside immediate data, such as the operand of a PUSH instruction, and locations outside the code are invalid.

The five instructions

The following diagram summarizes the new instructions.

The five instructions proposed by EIP-8013

RJUMP

RJUMP is an unconditional relative jump. It reads a two-byte relative_offset and sets the program counter to PC_post_instruction + relative_offset.

Instead of pushing an absolute destination onto the stack with PUSH and executing JUMP, the compiler can represent the operation using one opcode and its immediate operand. Since the destination is encoded directly in the instruction, validation can check its instruction boundary before execution.

RJUMPI

RJUMPI is a conditional relative jump. It pops a condition from the stack and jumps only if the condition is nonzero. Otherwise, execution continues with the following instruction.

Conventional JUMPI takes both the condition and the destination from the stack. RJUMPI takes only the condition from the stack; its destination comes from the encoded relative offset.

RJUMPV

RJUMPV is a relative jump using a jump table. It pops a case value and uses that value as an index into the relative-offset table.

Its immediate data consists of max_index followed by max_index + 1 relative offsets. Because max_index is an unsigned eight-bit value, the table can contain up to 256 destinations. When case > max_index, execution falls through to the following instruction.

This behavior is useful for implementing constructs such as a switch statement. In particular, RJUMPV 0 relative_offset jumps only when case is zero and otherwise falls through. The proposal describes how this can replace ISZERO RJUMPI relative_offset in some cases.

RJUMPSUB

RJUMPSUB makes a relative jump to a subroutine. It pushes PC_post_instruction onto the return stack and sets the program counter to PC_post_instruction + relative_offset. Its destination must be an ENTERSUB instruction.

The ENTERSUB and RETURNSUB instructions are introduced by EIP-7979. Like CALLSUB, RJUMPSUB saves a return address before entering a subroutine, but it encodes the destination as a relative offset.

RJUMPSUBV

RJUMPSUBV selects a subroutine through a jump table. It pops a case value and uses the corresponding relative offset to jump to an ENTERSUB instruction. If case > max_index, execution falls through without making a call.

As with RJUMPV, the table can have up to 256 entries. The difference is that the destination must be an ENTERSUB instruction rather than an ordinary instruction boundary.

Validation rules

EIP-8013 extends the validation algorithm described in EIP-7979. Validation checks that every instruction in the RJUMP family points to a valid destination.

Invalid destinations include:

  • Positions outside the code.
  • Positions inside the immediate data of a PUSH instruction.
  • Positions inside the immediate data of RJUMP, RJUMPI, RJUMPV, or related instructions.
  • Destinations other than ENTERSUB for RJUMPSUB and RJUMPSUBV.

The destination of RJUMP, RJUMPI, or RJUMPV may be a JUMPDEST, but this is not required. These instructions may target other valid instruction boundaries, subject to the proposal's validation rules. The subroutine variants, by contrast, must target ENTERSUB.

This distinction allows ordinary control flow and subroutine calls to be validated separately.

Gas costs

The proposal argues that checking destinations in advance removes the need to repeat the same destination checks as dynamic jumps at runtime. It recommends the following gas costs.

Instruction Recommended gas cost
RJUMP 2
RJUMPI 4
RJUMPV 4
RJUMPSUB 5
RJUMPSUBV 5

Compared with conventional JUMP and JUMPI, static validation is the reason for the proposed reduction in execution costs. Where a destination no longer requires a JUMPDEST, the deployment cost of that byte and the runtime cost of executing JUMPDEST can also be avoided.

Design rationale

Relative addresses make blocks of code easier to relocate. Absolute destinations may need to be recalculated when instructions are inserted before them. Relative offsets can preserve the internal control-flow relationships of a block when that block is moved as a unit.

The choice of 16-bit immediates balances instruction size against the distance that can be represented. An eight-bit offset can be too short for backward branches or jumps between functions. A 16-bit offset covers many such jumps even in larger programs.

EIP-170 limits deployed contract code to 24,576 bytes, while EIP-3860 limits initcode to 49,152 bytes. The proposal discusses these limits in its rationale for using 16-bit offsets. A single signed 16-bit offset cannot span every possible position in maximum-size initcode, so longer distances may require other control-flow arrangements.

For background on EIP-170, see:

[EIP-170] Contract Code Size Limit

For background on EIP-3860, see:

[EIP-3860] Limiting and Metering Initcode

Another design decision is not to introduce a discounted gas price for the PUSHn JUMP instruction sequence. Special optimization rules for existing instruction sequences would complicate gas accounting and internal EVM representations. Instead, EIP-8013 defines new instructions for static jumps.

Eliminating unnecessary JUMPDEST instructions is another motivation. Conventional dynamic jumps require JUMPDEST to identify legal destinations. Static relative jumps encode their destinations directly, allowing analysis to verify valid instruction boundaries without requiring an explicit marker at every destination.

Compatibility

EIP-8013 introduces new opcodes rather than directly changing the behavior of JUMP, JUMPI, or JUMPDEST. The proposal therefore does not expect compatibility risks for existing valid bytecode that does not use the new instructions.

However, adding instructions to the consensus rules requires a hard fork. Client implementations must agree on the execution rules, immediate decoding, jump-table layout, validation, and gas costs for all five instructions.

EIP-8013 also depends on EIP-7979. In particular, RJUMPSUB and RJUMPSUBV use the subroutine mechanism involving ENTERSUB and RETURNSUB. They are not designed as independent relative-call instructions that can be introduced without that mechanism.

Test cases

The proposal identifies cases to test during both validation and execution. The main concerns are whether relative offsets target valid instruction boundaries and whether conditions and jump-table indexes select the correct destinations.

Validation should cover the following cases.

Case Expected result
RJUMP / RJUMPI / RJUMPV targeting JUMPDEST Valid.
RJUMP / RJUMPI / RJUMPV targeting another valid instruction boundary Valid.
Positive, negative, and zero relative offsets Valid if the destination is valid.
RJUMPV / RJUMPSUBV table sizes from 1 to 256 Valid within the permitted range.
Truncated immediate data Invalid.
Destination outside the code Invalid.
Destination inside PUSH or RJUMP-family immediate data Invalid.
RJUMPSUB / RJUMPSUBV targeting something other than ENTERSUB Invalid.

Execution tests should cover the following behavior.

Instruction Behavior to test
RJUMP Forward, backward, and zero-offset jumps.
RJUMPI Fall through when the condition is zero; jump when it is nonzero.
RJUMPV Jump to the selected table entry for an in-range case; otherwise fall through.
RJUMPSUB Enter an ENTERSUB instruction and return using RETURNSUB.
RJUMPSUBV Enter the ENTERSUB selected by the table; otherwise fall through.

For RJUMPV and RJUMPSUBV, a case greater than max_index does not cause an exceptional halt. Execution simply continues with the following instruction. This makes it convenient to place the default branch immediately after the jump table.

Security considerations

Correct validation of instructions containing immediate operands is essential to EIP-8013. If a relative offset points inside PUSH data or outside the code, clients may interpret the instruction sequence differently. Validation must reject invalid destinations before execution.

Static relative jumps are designed to avoid repeated destination checks at runtime. While this reduces execution costs, an implementation error in the validation algorithm can directly cause a consensus divergence. Clients must agree on jump-table sizes, immediate-data boundaries, and the requirement that subroutine destinations be ENTERSUB instructions.

The proposal limits RJUMPV and RJUMPSUBV tables to 256 entries, bounding the work needed to read any one table and reducing the potential for denial of service through excessively large individual tables.

Citation

Greg Colvin (@gcolvin), Alex Beregszaszi (@axic), Andrei Maiboroda (@gumb0), Paweł Bylica (@chfast), "EIP-8013: Static relative jumps and calls for the EVM," Ethereum Improvement Proposals, no. 8013, August 2025. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-8013.

Conclusion

Dynamic EVM jumps offer flexibility but make bytecode analysis and validation more difficult. EIP-8013 proposes representing statically known control flow with relative jump instructions and moving destination validation to a stage before execution. The aim is to reduce code size and execution costs while improving analyzability.

An important distinction is that ordinary relative jumps do not need a JUMPDEST marker, while relative subroutine calls must enter an ENTERSUB instruction. By distinguishing ordinary branches, jump tables, and subroutine calls, the proposal gives compilers and validation tools a more explicit representation of control flow.

This article describes the proposal as covered in the original June 2026 article, rather than claiming that these opcodes are already available on Ethereum.