Skip to main content

Try it Live

Run Opcode examples in the interactive playground

Opcode.jumpDests()

Find all valid JUMPDEST positions in bytecode.

Parameters

  • bytecode: Uint8Array - Contract bytecode

Returns

Set<number> - Set of valid JUMPDEST offsets

Behavior

  • Correctly skips PUSH data: JUMPDEST inside PUSH immediate bytes is NOT valid
  • Only JUMPDEST opcodes: Only returns positions where opcode is 0x5B
  • Empty if none found: Returns empty Set if no JUMPDESTs

Use Cases

Build Jump Table

Validate Jump Target

Count Jump Destinations