> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# isValidJumpDest()

> Check if offset is valid JUMPDEST in EVM bytecode

<Card title="Try it Live" icon="play" href="https://playground.tevm.sh?example=primitives/opcode.ts">
  Run Opcode examples in the interactive playground
</Card>

## Opcode.isValidJumpDest()

Check if offset is a valid JUMPDEST in bytecode.

<Tabs>
  <Tab title="Functional API">
    ```typescript theme={null}
    import { isValidJumpDest } from 'tevm/Opcode'

    const valid = isValidJumpDest(bytecode, 3)  // true
    ```
  </Tab>
</Tabs>

## Parameters

* `bytecode: Uint8Array` - Contract bytecode
* `offset: number` - Program counter offset to check

## Returns

`boolean` - True if offset is valid JUMPDEST

## Validation Rules

Valid JUMPDEST must:

1. Be within bytecode bounds
2. Be JUMPDEST opcode (0x5B)
3. NOT be inside PUSH immediate data

## Use Cases

### Runtime Jump Validation

```typescript theme={null}
function executeJump(bytecode: Uint8Array, targetOffset: number): void {
  if (!Opcode.isValidJumpDest(bytecode, targetOffset)) {
    throw new Error(`Invalid jump destination: ${targetOffset}`)
  }
  // Proceed with jump
}
```

### Find Invalid Jumps

```typescript theme={null}
function findInvalidJumps(bytecode: Uint8Array): number[] {
  const instructions = Opcode.parse(bytecode)
  const invalid: number[] = []

  for (const inst of instructions) {
    if (Opcode.isJump(inst.opcode)) {
      // In real analysis, would need to trace stack for target
      // This is simplified example
    }
  }

  return invalid
}
```

## Related

* [jumpDests()](/primitives/opcode/jump-dests) - Find all JUMPDESTs
* [isJump()](/primitives/opcode/is-jump) - Check if JUMP/JUMPI
