Skip to content

Commit b7bba43

Browse files
committed
Merge pull request #4560
d2d9dc0 script tests: add tests for CHECKMULTISIG limits (Otto Allmendinger) 89101c6 script test: test case for 5-byte bools (Otto Allmendinger) 4cac5db script tests: value with trailing 0x00 is true (Otto Allmendinger) 833ff16 script tests: values that overflow to 0 are true (Otto Allmendinger) 0072d98 script tests: BOOLAND, BOOLOR decode to integer (Otto Allmendinger) ed02282 additional test for OP_SIZE in script_valid.json (Otto Allmendinger)
2 parents 2870014 + d2d9dc0 commit b7bba43

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/test/data/script_invalid.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@
272272
["2147483647", "1ADD 1SUB 1", "We cannot do math on 5-byte integers, even if the result is 4-bytes"],
273273
["2147483648", "1SUB 1", "We cannot do math on 5-byte integers, even if the result is 4-bytes"],
274274

275+
["2147483648 1", "BOOLOR 1", "We cannot do BOOLOR on 5-byte integers (but we can still do IF etc)"],
276+
["2147483648 1", "BOOLAND 1", "We cannot do BOOLAND on 5-byte integers"],
277+
275278
["1", "1 ENDIF", "ENDIF without IF"],
276279
["1", "IF 1", "IF without ENDIF"],
277280
["1 IF 1", "ENDIF", "IFs don't carry over"],
@@ -349,6 +352,9 @@
349352
"NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY"],
350353

351354

355+
["0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21", "21 CHECKMULTISIG 1", "nPubKeys > 20"],
356+
["0 'sig' 1 0", "CHECKMULTISIG 1", "nSigs > nPubKeys"],
357+
352358

353359
["NOP 0x01 1", "HASH160 0x14 0xda1745e9b549bd0bfa1a569971c77eba30cd5a4b EQUAL", "Tests for Script.IsPushOnly()"],
354360
["NOP1 0x01 1", "HASH160 0x14 0xda1745e9b549bd0bfa1a569971c77eba30cd5a4b EQUAL"],

src/test/data/script_valid.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
[" 1 2 ", "2 EQUALVERIFY 1 EQUAL"],
1111

1212
["1", ""],
13+
["0x02 0x01 0x00", "", "all bytes are significant, not only the last one"],
14+
["0x09 0x00000000 0x00000000 0x10", "", "equals zero when cast to Int64"],
1315

1416
["0x01 0x0b", "11 EQUAL", "push 1 byte"],
1517
["0x02 0x417a", "'Az' EQUAL"],
@@ -64,6 +66,7 @@
6466
["0", "IF RETURN ENDIF 1", "RETURN only works if executed"],
6567

6668
["1 1", "VERIFY"],
69+
["1 0x05 0x01 0x00 0x00 0x00 0x00", "VERIFY", "values >4 bytes can be cast to boolean"],
6770

6871
["10 0 11 TOALTSTACK DROP FROMALTSTACK", "ADD 21 EQUAL"],
6972
["'gavin_was_here' TOALTSTACK 11 FROMALTSTACK", "'gavin_was_here' EQUALVERIFY 11 EQUAL"],
@@ -126,6 +129,7 @@
126129
["-9223372036854775807", "SIZE 8 EQUAL"],
127130
["'abcdefghijklmnopqrstuvwxyz'", "SIZE 26 EQUAL"],
128131

132+
["42", "SIZE 1 EQUALVERIFY 42 EQUAL", "SIZE does not consume argument"],
129133

130134
["2 -2 ADD", "0 EQUAL"],
131135
["2147483647 -2147483647 ADD", "0 EQUAL"],

0 commit comments

Comments
 (0)