Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Spec for op jumpdest #58

Merged
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions specs/opcode/5BJUMPDEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# JUMPDEST op code
## Procedure
JUMPDEST is a special opcode which only marks an address that can be jumped to. in other words it is an metadata to annotate possible jump destinations.

For example, in the below op code sequences, JUMPDEST marks '004D' can be jumped to, if there is no JUMPDEST annotation, Jumping to '004D' will fail as jump op code will require JUMPDEST as valid destination.
DreamWuGit marked this conversation as resolved.
Show resolved Hide resolved

```
004D 5B JUMPDEST
004E 34 CALLVALUE
004F 80 DUP1
0050 15 ISZERO
0051 60 PUSH1 0x58
0053 57 *JUMPI
0054 60 PUSH1 0x00
0056 80 DUP1
0057 FD *REVERT
0058 5B JUMPDEST
0059 50 POP
005A 60 PUSH1 0x62
005C 60 PUSH1 0x04
005E 35 CALLDATALOAD
005F 60 PUSH1 0x86
0061 56 *JUMP"
```

## Constraints
1. opId = OpcodeId(0x5B)
2. state transition:
- gc
- stack_pointer
- pc + 1
- gas + 1
3. lookups:
none (since there is no operands required)

## Exceptions
1. gas out: remaining gas is not enough

## Code
none