From 90d022df50f845ea9024755f87484288348e62d5 Mon Sep 17 00:00:00 2001 From: John Adler Date: Fri, 24 Jun 2022 10:16:26 -0400 Subject: [PATCH] Get currently-verifying predicate. --- specs/vm/instruction_set.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/specs/vm/instruction_set.md b/specs/vm/instruction_set.md index dd3e1143..449f66ca 100644 --- a/specs/vm/instruction_set.md +++ b/specs/vm/instruction_set.md @@ -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`: @@ -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 | | |