Skip to content

Commit

Permalink
txscript: add/group control op code tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnldd committed Jul 22, 2018
1 parent 730420f commit 3da278c
Showing 1 changed file with 119 additions and 112 deletions.
231 changes: 119 additions & 112 deletions txscript/data/script_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,124 @@
["OP_15", "15 EQUAL", "NONE", "OK", "Push 15"],
["OP_16", "16 EQUAL", "NONE", "OK", "Push 16"],

["Control opcode tests"],

["NOP test coverage"],
["NOP", "NOP 1", "NONE", "OK"],
["0","NOP", "NONE", "ERR_EVAL_FALSE"],
["1","NOP", "NONE", "OK"],

["VER test coverage"],
["1","VER", "NONE", "ERR_RESERVED_OPCODE", "OP_VER is reserved"],
["1", "IF VER ELSE 1 ENDIF", "NONE", "ERR_RESERVED_OPCODE", "VER non-functional"],

["IF test coverage"],
["1", "DUP IF ENDIF", "NONE", "OK"],
["1", "IF 1 ENDIF", "NONE", "OK"],
["1", "DUP IF ELSE ENDIF", "NONE", "OK"],
["1", "IF 1 ELSE ENDIF", "NONE", "OK"],
["0", "IF ELSE 1 ENDIF", "NONE", "OK"],
["1 1", "IF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "OK"],
["1 0", "IF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "OK"],
["1 1", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "OK"],
["0 0", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "OK"],
["0", "IF 0 ELSE 1 ELSE 0 ENDIF", "NONE", "OK", "Multiple ELSE's are valid and executed inverts on each ELSE encountered"],
["1", "IF 1 ELSE 0 ELSE ENDIF", "NONE", "OK"],
["1", "IF ELSE 0 ELSE 1 ENDIF", "NONE", "OK"],
["1", "IF 1 ELSE 0 ELSE 1 ENDIF ADD 2 EQUAL", "NONE", "OK"],
["1 2 0 IF AND ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["1 2 0 IF OR ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["1 2 0 IF XOR ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 0 IF 2MUL ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 0 IF 2DIV ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 2 0 IF MUL ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 2 0 IF DIV ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 2 0 IF MOD ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 2 0 IF LSHIFT ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 2 0 IF RSHIFT ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["'' 1", "IF SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ENDIF 0x14 0x68ca4fec736264c13b859bac43d5173df6871682 EQUAL", "NONE", "OK"],
["0", "IF 1 IF RETURN ELSE RETURN ELSE RETURN ENDIF ELSE 1 IF 1 ELSE RETURN ELSE 1 ENDIF ELSE RETURN ENDIF ADD 2 EQUAL", "NONE", "OK", "Nested ELSE ELSE"],
["1 0x01 0x80", "IF 0 ENDIF", "NONE", "OK", "negative 0 is false"],
["1", "IF 0x50 ENDIF 1", "NONE", "ERR_RESERVED_OPCODE", "0x50 is reserved"],
["0", "DUP IF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0", "IF 1 ENDIF", "NONE", "ERR_EMPTY_STACK"],
["0", "DUP IF ELSE ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0", "IF 1 ELSE ENDIF", "NONE", "ERR_EMPTY_STACK"],
["1", "IF ELSE ENDIF ELSE", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "IF ELSE ENDIF ELSE ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "IF ENDIF ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "IF ELSE ELSE ENDIF ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["0 1", "IF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0 0", "IF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["1 0", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0 1", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["1 IF", "1 ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL", "IF/ENDIF can't span scriptSig/scriptPubKey"],
["1 IF 0 ENDIF", "1 ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["NOP", "IF 1 ENDIF", "NONE", "ERR_INVALID_STACK_OPERATION"],

["NOTIF test coverage"],
["1 0", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "OK"],
["1 1", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "OK"],
["1 0", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "OK"],
["0 1", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "OK"],
["1", "NOTIF 0 NOTIF RETURN ELSE RETURN ELSE RETURN ENDIF ELSE 0 NOTIF 1 ELSE RETURN ELSE 1 ENDIF ELSE RETURN ENDIF ADD 2 EQUAL", "NONE", "OK"],
["1", "NOTIF 0 ELSE 1 ELSE 0 ENDIF", "NONE", "OK", "Multiple ELSE's are valid and execution inverts on each ELSE encountered"],
["0", "NOTIF 1 ELSE 0 ELSE ENDIF", "NONE", "OK"],
["0", "NOTIF ELSE 0 ELSE 1 ENDIF", "NONE", "OK"],
["0", "NOTIF 1 ENDIF", "NONE", "OK"],
["0", "NOTIF 1 ELSE 0 ELSE 1 ENDIF ADD 2 EQUAL", "NONE", "OK"],
["'' 0", "NOTIF SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ENDIF 0x14 0x68ca4fec736264c13b859bac43d5173df6871682 EQUAL", "NONE", "OK"],
["0", "NOTIF ELSE 1 ENDIF", "NONE", "ERR_EMPTY_STACK"],
["0 0", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0 1", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["1 1", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0 0", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0 NOTIF", "123", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["NOP", "NOTIF 1 ENDIF", "NONE", "ERR_INVALID_STACK_OPERATION"],

["VERIF test coverage"],
["0", "IF ELSE 1 ELSE VERIF ENDIF", "NONE", "ERR_RESERVED_OPCODE", "VERIF illegal everywhere"],
["1","VERIF", "NONE", "ERR_RESERVED_OPCODE", "OP_VERIF is reserved"],
["0", "IF VERIF ELSE 1 ENDIF", "NONE", "ERR_RESERVED_OPCODE", "VERIF illegal everywhere"],

["VERNOTIF test coverage"],
["0", "IF ELSE 1 ELSE VERNOTIF ENDIF", "NONE", "ERR_RESERVED_OPCODE", "VERNOTIF illegal everywhere"],
["1","VERNOTIF", "NONE", "ERR_RESERVED_OPCODE", "OP_VERNOTIF is reserved"],
["0", "IF VERNOTIF ELSE 1 ENDIF", "NONE", "ERR_RESERVED_OPCODE", "VERNOTIF illegal everywhere"],

["ENDIF test coverage"],
["1 ELSE 0 ENDIF", "1", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "ELSE ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL", "Malformed IF/ELSE/ENDIF sequence"],
["1", "ENDIF ELSE", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "ENDIF ELSE IF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],

["VERIFY test coverage"],
["1 1", "VERIFY", "NONE", "OK"],
["1", "VERIFY 1", "NONE", "OK"],
["1 0x05 0x01 0x00 0x00 0x00 0x00", "VERIFY", "NONE", "OK", "values >4 bytes can be cast to boolean"],
["0", "VERIFY 1", "NONE", "ERR_VERIFY"],
["1", "VERIFY", "NONE", "ERR_EMPTY_STACK"],
["1", "VERIFY 0", "NONE", "ERR_EVAL_FALSE"],
["NOP", "VERIFY 1", "NONE", "ERR_INVALID_STACK_OPERATION"],

["RETURN test coverage"],
["0", "IF RETURN ENDIF 1", "NONE", "OK", "RETURN only works if executed"],
["1", "IF RETURN ELSE ELSE 1 ENDIF", "NONE", "ERR_EARLY_RETURN", "Multiple ELSEs"],
["1", "IF 1 ELSE ELSE RETURN ENDIF", "NONE", "ERR_EARLY_RETURN"],
["1", "RETURN", "NONE", "ERR_EARLY_RETURN"],
["1", "DUP IF RETURN ENDIF", "NONE", "ERR_EARLY_RETURN"],
["1", "RETURN 'data'", "NONE", "ERR_EARLY_RETURN", "canonical prunable txout format"],
["0 IF", "RETURN ENDIF 1", "NONE", "ERR_UNBALANCED_CONDITIONAL", "still prunable because IF/ENDIF can't span scriptSig/scriptPubKey"],

["CHECKLOCKTIMEVERIFY test coverage"],
["", "CHECKLOCKTIMEVERIFY", "NONE", "ERR_EMPTY_STACK"],
["1", "CHECKLOCKTIMEVERIFY", "NONE", "OK"],

["CHECKSEQUENCEVERIFY test coverage"],
["", "CHECKSEQUENCEVERIFY", "NONE", "ERR_EMPTY_STACK"],
["1", "CHECKSEQUENCEVERIFY", "NONE", "OK"],

["CAT related test coverage"],
["'a' 'b'", "CAT 'ab' EQUAL", "NONE", "OK", "CAT concatenates two input args"],
["'a' 2147483648", "CAT 0x06 0x610000008000 EQUAL", "NONE", "OK", "CAT must treat arguments as bytes as opposed to numeric"],
Expand Down Expand Up @@ -549,17 +667,6 @@
["2147483648 1", "ROTL 1 EQUAL", "NONE", "ERR_OUT_OF_RANGE", "ROTL must fail with input value >4 bytes"],
["1 2147483648", "ROTL TRUE", "NONE", "ERR_OUT_OF_RANGE", "ROTL must fail with rotation count >4 bytes"],

["1 2 0 IF AND ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["1 2 0 IF OR ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["1 2 0 IF XOR ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 0 IF 2MUL ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 0 IF 2DIV ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 2 0 IF MUL ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 2 0 IF DIV ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 2 0 IF MOD ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 2 0 IF LSHIFT ELSE 1 ENDIF", "NOP", "NONE", "OK"],
["2 2 0 IF RSHIFT ELSE 1 ENDIF", "NOP", "NONE", "OK"],

["2 DUP MUL", "4 EQUAL", "NONE", "OK"],

["Division related test coverage"],
Expand Down Expand Up @@ -694,42 +801,6 @@
["0", "IF VER ELSE 1 ENDIF", "NONE", "OK", "VER non-functional (ok if not executed)"],
["0", "IF RESERVED ELSE 1 ENDIF", "NONE", "OK", "RESERVED ok in un-executed IF"],

["1", "DUP IF ENDIF", "NONE", "OK"],
["1", "IF 1 ENDIF", "NONE", "OK"],
["1", "DUP IF ELSE ENDIF", "NONE", "OK"],
["1", "IF 1 ELSE ENDIF", "NONE", "OK"],
["0", "IF ELSE 1 ENDIF", "NONE", "OK"],

["1 1", "IF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "OK"],
["1 0", "IF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "OK"],
["1 1", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "OK"],
["0 0", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "OK"],

["1 0", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "OK"],
["1 1", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "OK"],
["1 0", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "OK"],
["0 1", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "OK"],

["0", "IF 0 ELSE 1 ELSE 0 ENDIF", "NONE", "OK", "Multiple ELSE's are valid and executed inverts on each ELSE encountered"],
["1", "IF 1 ELSE 0 ELSE ENDIF", "NONE", "OK"],
["1", "IF ELSE 0 ELSE 1 ENDIF", "NONE", "OK"],
["1", "IF 1 ELSE 0 ELSE 1 ENDIF ADD 2 EQUAL", "NONE", "OK"],
["'' 1", "IF SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ENDIF 0x14 0x68ca4fec736264c13b859bac43d5173df6871682 EQUAL", "NONE", "OK"],

["1", "NOTIF 0 ELSE 1 ELSE 0 ENDIF", "NONE", "OK", "Multiple ELSE's are valid and execution inverts on each ELSE encountered"],
["0", "NOTIF 1 ELSE 0 ELSE ENDIF", "NONE", "OK"],
["0", "NOTIF ELSE 0 ELSE 1 ENDIF", "NONE", "OK"],
["0", "NOTIF 1 ELSE 0 ELSE 1 ENDIF ADD 2 EQUAL", "NONE", "OK"],
["'' 0", "NOTIF SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ENDIF 0x14 0x68ca4fec736264c13b859bac43d5173df6871682 EQUAL", "NONE", "OK"],

["0", "IF 1 IF RETURN ELSE RETURN ELSE RETURN ENDIF ELSE 1 IF 1 ELSE RETURN ELSE 1 ENDIF ELSE RETURN ENDIF ADD 2 EQUAL", "NONE", "OK", "Nested ELSE ELSE"],
["1", "NOTIF 0 NOTIF RETURN ELSE RETURN ELSE RETURN ENDIF ELSE 0 NOTIF 1 ELSE RETURN ELSE 1 ENDIF ELSE RETURN ENDIF ADD 2 EQUAL", "NONE", "OK"],

["0", "IF RETURN ENDIF 1", "NONE", "OK", "RETURN only works if executed"],

["1 1", "VERIFY", "NONE", "OK"],
["1 0x05 0x01 0x00 0x00 0x00 0x00", "VERIFY", "NONE", "OK", "values >4 bytes can be cast to boolean"],
["1 0x01 0x80", "IF 0 ENDIF", "NONE", "OK", "negative 0 is false"],

["10 0 11 TOALTSTACK DROP FROMALTSTACK", "ADD 21 EQUAL", "NONE", "OK"],
["'gavin_was_here' TOALTSTACK 11 FROMALTSTACK", "'gavin_was_here' EQUALVERIFY 11 EQUAL", "NONE", "OK"],
Expand Down Expand Up @@ -1011,11 +1082,6 @@
["0x03 0x100080", "0x04 0x10000080 NUMEQUAL", "NONE", "ERR_MINIMAL_DATA"],
["0x03 0x100000", "0x04 0x10000000 NUMEQUAL", "NONE", "ERR_MINIMAL_DATA"],

["NOP", "NOP 1", "NONE", "OK", "The following tests check the if(stack.size() < N) tests in each opcode"],
["1", "IF 1 ENDIF", "NONE", "OK", "They are here to catch copy-and-paste errors"],
["0", "NOTIF 1 ENDIF", "NONE", "OK", "Most of them are duplicated elsewhere,"],
["1", "VERIFY 1", "NONE", "OK", "but, hey, more is always better, right?"],

["0", "TOALTSTACK 1", "NONE", "OK"],
["1", "TOALTSTACK FROMALTSTACK", "NONE", "OK"],
["0 0", "2DROP 1", "NONE", "OK"],
Expand Down Expand Up @@ -2005,57 +2071,6 @@
["", "0 <0>{19} 19 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "NONE", "OK", "CHECKMULTISIGVERIFY must allow 19 pubkeys"],
["", "0 <0>{20} 20 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "NONE", "OK", "CHECKMULTISIGVERIFY must allow 20 pubkeys"],

["1", "IF 0x50 ENDIF 1", "NONE", "ERR_RESERVED_OPCODE", "0x50 is reserved"],
["0x52", "0x5f ADD 0x60 EQUAL", "NONE", "ERR_EVAL_FALSE", "0x51 through 0x60 push 1 through 16 onto stack"],
["0","NOP", "NONE", "ERR_EVAL_FALSE"],
["1", "IF VER ELSE 1 ENDIF", "NONE", "ERR_RESERVED_OPCODE", "VER non-functional"],
["0", "IF VERIF ELSE 1 ENDIF", "NONE", "ERR_RESERVED_OPCODE", "VERIF illegal everywhere"],
["0", "IF ELSE 1 ELSE VERIF ENDIF", "NONE", "ERR_RESERVED_OPCODE", "VERIF illegal everywhere"],
["0", "IF VERNOTIF ELSE 1 ENDIF", "NONE", "ERR_RESERVED_OPCODE", "VERNOTIF illegal everywhere"],
["0", "IF ELSE 1 ELSE VERNOTIF ENDIF", "NONE", "ERR_RESERVED_OPCODE", "VERNOTIF illegal everywhere"],

["1 IF", "1 ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL", "IF/ENDIF can't span scriptSig/scriptPubKey"],
["1 IF 0 ENDIF", "1 ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1 ELSE 0 ENDIF", "1", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["0 NOTIF", "123", "NONE", "ERR_UNBALANCED_CONDITIONAL"],

["0", "DUP IF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0", "IF 1 ENDIF", "NONE", "ERR_EMPTY_STACK"],
["0", "DUP IF ELSE ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0", "IF 1 ELSE ENDIF", "NONE", "ERR_EMPTY_STACK"],
["0", "NOTIF ELSE 1 ENDIF", "NONE", "ERR_EMPTY_STACK"],

["0 1", "IF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0 0", "IF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["1 0", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0 1", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],

["0 0", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0 1", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["1 1", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],
["0 0", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "NONE", "ERR_EVAL_FALSE"],

["1", "IF RETURN ELSE ELSE 1 ENDIF", "NONE", "ERR_EARLY_RETURN", "Multiple ELSEs"],
["1", "IF 1 ELSE ELSE RETURN ENDIF", "NONE", "ERR_EARLY_RETURN"],

["1", "ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL", "Malformed IF/ELSE/ENDIF sequence"],
["1", "ELSE ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "ENDIF ELSE", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "ENDIF ELSE IF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "IF ELSE ENDIF ELSE", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "IF ELSE ENDIF ELSE ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "IF ENDIF ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],
["1", "IF ELSE ELSE ENDIF ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL"],

["1", "RETURN", "NONE", "ERR_EARLY_RETURN"],
["1", "DUP IF RETURN ENDIF", "NONE", "ERR_EARLY_RETURN"],

["1", "RETURN 'data'", "NONE", "ERR_EARLY_RETURN", "canonical prunable txout format"],
["0 IF", "RETURN ENDIF 1", "NONE", "ERR_UNBALANCED_CONDITIONAL", "still prunable because IF/ENDIF can't span scriptSig/scriptPubKey"],

["0", "VERIFY 1", "NONE", "ERR_VERIFY"],
["1", "VERIFY", "NONE", "ERR_EMPTY_STACK"],
["1", "VERIFY 0", "NONE", "ERR_EVAL_FALSE"],

["1 TOALTSTACK", "FROMALTSTACK 1", "NONE", "ERR_INVALID_ALTSTACK_OPERATION", "alt stack not shared between sig/pubkey"],

Expand Down Expand Up @@ -2227,11 +2242,6 @@

["NOP1","NOP10", "NONE", "ERR_EMPTY_STACK"],

["1","VER", "NONE", "ERR_RESERVED_OPCODE", "OP_VER is reserved"],
["1","VERIF", "NONE", "ERR_RESERVED_OPCODE", "OP_VERIF is reserved"],
["1","VERNOTIF", "NONE", "ERR_RESERVED_OPCODE", "OP_VERNOTIF is reserved"],
["1","RESERVED", "NONE", "ERR_RESERVED_OPCODE", "OP_RESERVED is reserved"],

["2147483648", "1ADD 1", "NONE", "ERR_OUT_OF_RANGE", "We cannot do math on 5-byte integers"],
["2147483648", "NEGATE 1", "NONE", "ERR_OUT_OF_RANGE", "We cannot do math on 5-byte integers"],
["-2147483648", "1ADD 1", "NONE", "ERR_OUT_OF_RANGE", "Because we use a sign bit, -2147483648 is also 5 bytes"],
Expand All @@ -2245,10 +2255,7 @@
["1", "IF 1", "NONE", "ERR_UNBALANCED_CONDITIONAL", "IF without ENDIF"],
["1 IF 1", "ENDIF", "NONE", "ERR_UNBALANCED_CONDITIONAL", "IFs don't carry over"],

["NOP", "IF 1 ENDIF", "NONE", "ERR_INVALID_STACK_OPERATION", "The following tests check the if(stack.size() < N) tests in each opcode"],
["NOP", "NOTIF 1 ENDIF", "NONE", "ERR_INVALID_STACK_OPERATION", "They are here to catch copy-and-paste errors"],
["NOP", "VERIFY 1", "NONE", "ERR_INVALID_STACK_OPERATION", "Most of them are duplicated elsewhere,"],
["NOP", "TOALTSTACK 1", "NONE", "ERR_INVALID_STACK_OPERATION", "but, hey, more is always better, right?"],
["NOP", "TOALTSTACK 1", "NONE", "ERR_INVALID_STACK_OPERATION"],

["1", "FROMALTSTACK", "NONE", "ERR_INVALID_STACK_OPERATION"],
["1", "2DROP 1", "NONE", "ERR_INVALID_STACK_OPERATION"],
Expand Down

0 comments on commit 3da278c

Please sign in to comment.