Try it Live
Run Opcode examples in the interactive playground
Opcode.jumpDests()
Find all valid JUMPDEST positions in bytecode.- Functional API
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
Related
- isValidJumpDest() - Check specific offset
- parse() - Parse bytecode
- isJump() - Check if JUMP/JUMPI

