check that OP_CHECK_MULTISIG also triggers on too many ops

This commit is contained in:
Owain G. Ainsworth 2013-06-20 01:21:12 +01:00
parent bac455cdd2
commit 25624bc6a7
2 changed files with 216 additions and 2 deletions

View file

@ -2819,6 +2819,220 @@ var detailedTests = []detailedTest{
expectedReturn: btcscript.StackErrTooManyOperations, expectedReturn: btcscript.StackErrTooManyOperations,
disassembly: "OP_1 OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP", disassembly: "OP_1 OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP",
}, },
{
// 202 operations + one push
name: "too many operations multisig",
script: []byte{btcscript.OP_1,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_DUP,
btcscript.OP_DROP,
btcscript.OP_1,
btcscript.OP_1,
btcscript.OP_1,
btcscript.OP_1,
btcscript.OP_2,
btcscript.OP_CHECK_MULTISIG,
},
expectedReturn: btcscript.StackErrTooManyOperations,
disassembly: "OP_1 OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_DUP OP_DROP OP_1 OP_1 OP_1 OP_1 OP_2 OP_CHECK_MULTISIG",
},
{ {
name: "OP_CAT disabled", name: "OP_CAT disabled",
script: []byte{btcscript.OP_CAT}, script: []byte{btcscript.OP_CAT},

View file

@ -118,7 +118,7 @@ github.com/conformal/btcscript/script.go isPubkey 100.00% (1/1)
github.com/conformal/btcscript/stack.go Stack.PushBool 100.00% (1/1) github.com/conformal/btcscript/stack.go Stack.PushBool 100.00% (1/1)
github.com/conformal/btcscript/script.go Script.subScript 100.00% (1/1) github.com/conformal/btcscript/script.go Script.subScript 100.00% (1/1)
github.com/conformal/btcscript/log.go UseLogger 100.00% (1/1) github.com/conformal/btcscript/log.go UseLogger 100.00% (1/1)
github.com/conformal/btcscript/opcode.go opcodeCheckMultiSig 96.43% (54/56) github.com/conformal/btcscript/opcode.go opcodeCheckMultiSig 98.21% (55/56)
github.com/conformal/btcscript/opcode.go opcodeCheckSig 96.15% (25/26) github.com/conformal/btcscript/opcode.go opcodeCheckSig 96.15% (25/26)
github.com/conformal/btcscript/script.go NewScript 95.24% (20/21) github.com/conformal/btcscript/script.go NewScript 95.24% (20/21)
github.com/conformal/btcscript/address.go ScriptToAddress 94.92% (56/59) github.com/conformal/btcscript/address.go ScriptToAddress 94.92% (56/59)
@ -135,5 +135,5 @@ github.com/conformal/btcscript/opcode.go opcodeSha1 60.00% (3/5)
github.com/conformal/btcscript/script.go Script.Execute 44.44% (8/18) github.com/conformal/btcscript/script.go Script.Execute 44.44% (8/18)
github.com/conformal/btcscript/log.go SetLogWriter 0.00% (0/7) github.com/conformal/btcscript/log.go SetLogWriter 0.00% (0/7)
github.com/conformal/btcscript/log.go logClosure.String 0.00% (0/1) github.com/conformal/btcscript/log.go logClosure.String 0.00% (0/1)
github.com/conformal/btcscript -------------------------- 93.87% (842/897) github.com/conformal/btcscript -------------------------- 93.98% (843/897)