Skip to content

Commit

Permalink
Handle verify opcodes based on context (#70)
Browse files Browse the repository at this point in the history
* Handle verify opcodes differently based on context.
  • Loading branch information
adlerjohn authored Feb 12, 2021
1 parent c129604 commit b778f63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion specs/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ A call frame consists of the following, word-aligned:
| | | | **Unwritable area begins.** |
| 8 | `uint32` | out offset | Offset from start of this call frame to out count, in bytes. |
| 32 | `byte[32]` | to | Contract ID for this call. |
| 8*64 | `byte[8][64]` | regs | Saved registers from previous context. |
| 8*64 | `byte[8][64]` | regs | Saved registers from previous context. |
| 8 | `uint8` | in count | Number of input values. |
| 8 | `uint8` | out count | Number of return values. |
| 8 | `uint16` | code size | Code size in bytes (not padded to word alignment). |
Expand Down
4 changes: 2 additions & 2 deletions specs/opcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ Otherwise, `$of` and `$err` are cleared.
| Encoding | `0x00 rd rs rt -` |
| Notes | |

If `$rt > tx.input[$rs].maturity`, halt, returning `false`. If the input `$rs` is not of type [`InputType.Coin`](./tx_format.md), halt, returning `false`.
If `$rt > tx.input[$rs].maturity` or if the input `$rs` is not of type [`InputType.Coin`](./tx_format.md), verification failed and operation depends on the context type. In a predicate context, [return](#return-return-from-context) `false`. In other contexts, [revert](#revert-revert).

Otherwise, advance the program counter `$pc` by `4`.

Expand All @@ -476,7 +476,7 @@ See also: [BIP-112](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawi
| Encoding | `0x00 rd rs - -` |
| Notes | |

If `$rs > tx.maturity`, halt, returning `false`.
If `$rs > tx.maturity`, verification failed and operation depends on the context type. In a predicate context, [return](#return-return-from-context) `false`. In other contexts, [revert](#revert-revert).

Otherwise, advance the program counter `$pc` by `4`.

Expand Down

0 comments on commit b778f63

Please sign in to comment.