Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get currently-verifying predicate. #373

Merged
merged 1 commit into from
Jun 24, 2022
Merged
Changes from all 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
17 changes: 13 additions & 4 deletions specs/vm/instruction_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -1813,10 +1813,11 @@ All these instructions advance the program counter `$pc` by `4` after performing

Read metadata from memory. A convenience instruction to avoid manually extracting metadata.

| name | value | description |
|-------------------------|-----------|----------------------------|
| `GM_IS_CALLER_EXTERNAL` | `0x00001` | Get if caller is external. |
| `GM_GET_CALLER` | `0x00002` | Get caller's contract ID. |
| name | value | description |
|------------------------------|-----------|---------------------------------|
| `GM_IS_CALLER_EXTERNAL` | `0x00001` | Get if caller is external. |
| `GM_GET_CALLER` | `0x00002` | Get caller's contract ID. |
| `GM_GET_VERIFYING_PREDICATE` | `0x00003` | Get index of current predicate. |

If `imm == GM_IS_CALLER_EXTERNAL`:

Expand All @@ -1835,6 +1836,14 @@ Panic if:

Set `$rA` to `$fp->$fp` (i.e. `$rA` will point to the previous call frame's contract ID).

If `imm == GM_GET_VERIFYING_PREDICATE`:

Panic if:

- not in a predicate context

Set `$rA` to the index of the currently-verifying predicate.

### GTF: Get transaction fields

| | |
Expand Down