aboutsummaryrefslogtreecommitdiff
path: root/src/test/data/script_invalid.json
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2012-05-24 17:32:09 -0400
committerGavin Andresen <gavinandresen@gmail.com>2012-05-24 17:32:09 -0400
commit6b8a17119e30ddc5dd5b92ed77da49740c495ed6 (patch)
tree79bc0e61537dc88662f73c8aa0254fb4ac5d7bcd /src/test/data/script_invalid.json
parentf04017f702e36563b9ba05b3fede216767de580a (diff)
downloadbitcoin-6b8a17119e30ddc5dd5b92ed77da49740c495ed6.tar.xz
Lots more Script unit test cases.
Diffstat (limited to 'src/test/data/script_invalid.json')
-rw-r--r--src/test/data/script_invalid.json117
1 files changed, 117 insertions, 0 deletions
diff --git a/src/test/data/script_invalid.json b/src/test/data/script_invalid.json
index f06c3beea3..f341a12dfd 100644
--- a/src/test/data/script_invalid.json
+++ b/src/test/data/script_invalid.json
@@ -3,6 +3,110 @@
["", "NOP"],
["NOP", ""],
["NOP","NOP"],
+
+["0x4c01","0x01 NOP", "PUSHDATA1 with not enough bytes"],
+["0x4d0200ff","0x01 NOP", "PUSHDATA2 with not enough bytes"],
+["0x4e03000000ffff","0x01 NOP", "PUSHDATA4 with not enough bytes"],
+
+["1", "IF 0x50 ENDIF 1", "0x50 is reserved"],
+["0x52", "0x5f ADD 0x60 EQUAL", "0x51 through 0x60 push 1 through 16 onto stack"],
+["0","NOP"],
+["1", "IF VER ELSE 1 ENDIF", "VER non-functional"],
+["0", "IF VERIF ELSE 1 ENDIF", "VERIF illegal everywhere"],
+["0", "IF VERNOTIF ELSE 1 ENDIF", "VERNOT illegal everywhere"],
+
+["1 IF", "1 ENDIF", "IF/ENDIF can't span scriptSig/scriptPubKey"],
+["1 IF 0 ENDIF", "1 ENDIF"],
+["1 ELSE 0 ENDIF", "1"],
+["0 NOTIF", "123"],
+
+["0", "DUP IF ENDIF"],
+["0", "IF 1 ENDIF"],
+["0", "DUP IF ELSE ENDIF"],
+["0", "IF 1 ELSE ENDIF"],
+["0", "NOTIF ELSE 1 ENDIF"],
+
+["0 1", "IF IF 1 ELSE 0 ENDIF ENDIF"],
+["0 0", "IF IF 1 ELSE 0 ENDIF ENDIF"],
+["1 0", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF"],
+["0 1", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF"],
+
+["0 0", "NOTIF IF 1 ELSE 0 ENDIF ENDIF"],
+["0 1", "NOTIF IF 1 ELSE 0 ENDIF ENDIF"],
+["1 1", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF"],
+["0 0", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF"],
+
+["1", "RETURN"],
+["1", "DUP IF RETURN ENDIF"],
+
+["0", "VERIFY 1"],
+["1", "VERIFY"],
+["1", "VERIFY 0"],
+
+["1 TOALTSTACK", "FROMALTSTACK 1", "alt stack not shared between sig/pubkey"],
+
+["IFDUP", "DEPTH 0 EQUAL"],
+["DROP", "DEPTH 0 EQUAL"],
+["DUP", "DEPTH 0 EQUAL"],
+["1", "DUP 1 ADD 2 EQUALVERIFY 0 EQUAL"],
+["NOP", "NIP"],
+["NOP", "1 NIP"],
+["NOP", "1 0 NIP"],
+["NOP", "OVER 1"],
+["1", "OVER"],
+["0 1", "OVER DEPTH 3 EQUALVERIFY"],
+["19 20 21", "PICK 19 EQUALVERIFY DEPTH 2 EQUAL"],
+["NOP", "0 PICK"],
+["1", "-1 PICK"],
+["19 20 21", "0 PICK 20 EQUALVERIFY DEPTH 3 EQUAL"],
+["19 20 21", "1 PICK 21 EQUALVERIFY DEPTH 3 EQUAL"],
+["19 20 21", "2 PICK 22 EQUALVERIFY DEPTH 3 EQUAL"],
+["NOP", "0 ROLL"],
+["1", "-1 ROLL"],
+["19 20 21", "0 ROLL 20 EQUALVERIFY DEPTH 2 EQUAL"],
+["19 20 21", "1 ROLL 21 EQUALVERIFY DEPTH 2 EQUAL"],
+["19 20 21", "2 ROLL 22 EQUALVERIFY DEPTH 2 EQUAL"],
+["NOP", "ROT 1"],
+["NOP", "1 ROT 1"],
+["NOP", "1 2 ROT 1"],
+["NOP", "0 1 2 ROT"],
+["NOP", "SWAP 1"],
+["1", "SWAP 1"],
+["0 1", "SWAP 1 EQUALVERIFY"],
+["NOP", "TUCK 1"],
+["1", "TUCK 1"],
+["1 0", "TUCK DEPTH 3 EQUALVERIFY SWAP 2DROP"],
+["NOP", "2DUP 1"],
+["1", "2DUP 1"],
+["NOP", "3DUP 1"],
+["1", "3DUP 1"],
+["1 2", "3DUP 1"],
+["NOP", "2OVER 1"],
+["1", "2 3 2OVER 1"],
+["NOP", "2SWAP 1"],
+["1", "2 3 2SWAP 1"],
+
+["'a' 'b'", "CAT", "CAT disabled"],
+["'a' 'b' 0", "IF CAT ELSE 1 ENDIF", "CAT disabled"],
+["'abc' 1 1", "SUBSTR", "SUBSTR disabled"],
+["'abc' 1 1 0", "IF SUBSTR ELSE 1 ENDIF", "SUBSTR disabled"],
+["'abc' 2 0", "IF LEFT ELSE 1 ENDIF", "LEFT disabled"],
+["'abc' 2 0", "IF RIGHT ELSE 1 ENDIF", "RIGHT disabled"],
+
+["NOP", "SIZE 1"],
+
+["'abc'", "IF INVERT ELSE 1 ENDIF", "INVERT disabled"],
+["1 2 0 IF AND ELSE 1 ENDIF", "NOP", "AND disabled"],
+["1 2 0 IF OR ELSE 1 ENDIF", "NOP", "OR disabled"],
+["1 2 0 IF XOR ELSE 1 ENDIF", "NOP", "XOR disabled"],
+["2 0 IF 2MUL ELSE 1 ENDIF", "NOP", "2MUL disabled"],
+["2 0 IF 2DIV ELSE 1 ENDIF", "NOP", "2DIV disabled"],
+["2 2 0 IF MUL ELSE 1 ENDIF", "NOP", "MUL disabled"],
+["2 2 0 IF DIV ELSE 1 ENDIF", "NOP", "DIV disabled"],
+["2 2 0 IF MOD ELSE 1 ENDIF", "NOP", "MOD disabled"],
+["2 2 0 IF LSHIFT ELSE 1 ENDIF", "NOP", "LSHIFT disabled"],
+["2 2 0 IF RSHIFT ELSE 1 ENDIF", "NOP", "RSHIFT disabled"],
+
["0 1","EQUAL"],
["1 1 ADD", "0 EQUAL"],
["11 1 ADD 12 SUB", "11 EQUAL"],
@@ -24,6 +128,19 @@
["'NOP_1_to_10' NOP1 NOP2 NOP3 NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10","'NOP_1_to_11' EQUAL"],
["0x50","1", "opcode 0x50 is reserved"],
+["1", "IF 0xba ELSE 1 ENDIF", "opcodes above NOP10 invalid"],
+["1", "IF 0xc0 ELSE 1 ENDIF"],
+["1", "IF 0xd1 ELSE 1 ENDIF"],
+["1", "IF 0xee ELSE 1 ENDIF"],
+["1", "IF 0xfd ELSE 1 ENDIF"],
+["1", "IF 0xff ELSE 1 ENDIF"],
+
+["NOP", "RIPEMD160"],
+["NOP", "SHA1"],
+["NOP", "SHA256"],
+["NOP", "HASH160"],
+["NOP", "HASH256"],
+
["NOP1","NOP10"]
]