diff --git a/src/Makefile.test.include b/src/Makefile.test.include --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -58,6 +58,7 @@ test/mempool_tests.cpp \ test/merkle_tests.cpp \ test/miner_tests.cpp \ + test/monolith_opcodes_type.cpp \ test/multisig_tests.cpp \ test/net_tests.cpp \ test/netbase_tests.cpp \ diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -304,10 +304,10 @@ return true; case OP_BIN2NUM: - return true; + return false; case OP_NUM2BIN: - return true; + return false; case OP_AND: return true; @@ -1238,6 +1238,82 @@ } } break; + // + // Conversion operations + // + case OP_BIN2NUM: { + // (in -- out) + if (stack.size() < 1) { + return set_error( + serror, SCRIPT_ERR_INVALID_STACK_OPERATION); + } + valtype bin = stacktop(-1); + valtype res = MinimalizeBigEndianArray(bin); + + if (res.size() > DEFAULT_MAX_NUM_BYTES) { + return set_error( + serror, SCRIPT_ERR_INVALID_BIN2NUM_OPERATION); + } + + // big endian to little endian conversion + std::reverse(res.begin(), res.end()); + + CScriptNum num(res, false); + if (num > (INT_MAX >> 1) || num < (INT_MIN >> 1)) { + return set_error( + serror, SCRIPT_ERR_INVALID_BIN2NUM_OPERATION); + } + popstack(stack); + stack.push_back(num.getvch()); + } break; + + case OP_NUM2BIN: { + // (in size -- out) + if (stack.size() < 2) { + return set_error( + serror, SCRIPT_ERR_INVALID_STACK_OPERATION); + } + CScriptNum num(stacktop(-2), fRequireMinimal); + int64_t size = + CScriptNum(stacktop(-1), fRequireMinimal).getint(); + if (size < 1 || + static_cast(size) > + DEFAULT_MAX_NUM_BYTES) { + return set_error( + serror, SCRIPT_ERR_INVALID_NUM2BIN_OPERATION); + } + // Produces a byte vector of num and check if input size + // is valid + valtype vchNum = num.getvch(); + if (size < static_cast(vchNum.size())) { + return set_error( + serror, SCRIPT_ERR_INVALID_NUM2BIN_OPERATION); + } + // Initialize byte vector for result + valtype result; + result.reserve(size); + uint8_t neg = 0; + + // Preserve sign, and also ignore zero + if (!vchNum.empty()) { + neg = *vchNum.rbegin() & 0x80; + *vchNum.rbegin() &= ~0x80; + } + // Pad result to declared input size + for (uint8_t i = vchNum.size(); i < size; ++i) { + result.push_back(0); + } + for (auto i = vchNum.rbegin(); i != vchNum.rend(); + ++i) { + result.push_back(*i); + } + *result.begin() |= neg; + + popstack(stack); + popstack(stack); + stack.push_back(result); + } break; + default: return set_error(serror, SCRIPT_ERR_BAD_OPCODE); } diff --git a/src/script/script_error.h b/src/script/script_error.h --- a/src/script/script_error.h +++ b/src/script/script_error.h @@ -20,6 +20,10 @@ SCRIPT_ERR_SIG_COUNT, SCRIPT_ERR_PUBKEY_COUNT, + /* Operands checks */ + SCRIPT_ERR_INVALID_BIN2NUM_OPERATION, + SCRIPT_ERR_INVALID_NUM2BIN_OPERATION, + /* Failed verify operations */ SCRIPT_ERR_VERIFY, SCRIPT_ERR_EQUALVERIFY, diff --git a/src/script/script_error.cpp b/src/script/script_error.cpp --- a/src/script/script_error.cpp +++ b/src/script/script_error.cpp @@ -34,6 +34,10 @@ return "Signature count negative or greater than pubkey count"; case SCRIPT_ERR_PUBKEY_COUNT: return "Pubkey count negative or limit exceeded"; + case SCRIPT_ERR_INVALID_BIN2NUM_OPERATION: + return "Invalid OP_BIN2NUM operation (check operand values)"; + case SCRIPT_ERR_INVALID_NUM2BIN_OPERATION: + return "Invalid OP_NUM2BIN operation (check operand values)"; case SCRIPT_ERR_BAD_OPCODE: return "Opcode missing or not understood"; case SCRIPT_ERR_DISABLED_OPCODE: diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -35,6 +35,7 @@ mempool_tests.cpp merkle_tests.cpp miner_tests.cpp + monolith_opcodes_type.cpp multisig_tests.cpp net_tests.cpp netbase_tests.cpp diff --git a/src/test/data/script_tests.json b/src/test/data/script_tests.json --- a/src/test/data/script_tests.json +++ b/src/test/data/script_tests.json @@ -825,10 +825,51 @@ ["'abc' 1 1", "SPLIT", "P2SH,STRICTENC,MONOLITH_OPCODES", "DISABLED_OPCODE", "SPLIT disabled"], ["'abc' 1 1 0", "IF SPLIT ELSE 1 ENDIF", "P2SH,STRICTENC", "DISABLED_OPCODE", "SPLIT disabled"], ["'abc' 1 1 0", "IF SPLIT ELSE 1 ENDIF", "P2SH,STRICTENC,MONOLITH_OPCODES", "DISABLED_OPCODE", "SPLIT disabled"], -["'abc' 2 0", "IF NUM2BIN ELSE 1 ENDIF", "P2SH,STRICTENC", "DISABLED_OPCODE", "NUM2BIN disabled"], -["'abc' 2 0", "IF NUM2BIN ELSE 1 ENDIF", "P2SH,STRICTENC,MONOLITH_OPCODES", "DISABLED_OPCODE", "NUM2BIN disabled"], +["'abc' 2 0", "BIN2NUM", "P2SH,STRICTENC", "DISABLED_OPCODE", "BIN2NUM disabled"], +["'abc' 2 0", "NUM2BIN", "P2SH,STRICTENC", "DISABLED_OPCODE", "NUM2BIN disabled"], + ["'abc' 2 0", "IF BIN2NUM ELSE 1 ENDIF", "P2SH,STRICTENC", "DISABLED_OPCODE", "BIN2NUM disabled"], -["'abc' 2 0", "IF BIN2NUM ELSE 1 ENDIF", "P2SH,STRICTENC,MONOLITH_OPCODES", "DISABLED_OPCODE", "BIN2NUM disabled"], +["'abc' 2 0", "IF NUM2BIN ELSE 1 ENDIF", "P2SH,STRICTENC", "DISABLED_OPCODE", "NUM2BIN disabled"], + +["0x01 0x00", "BIN2NUM 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["0x05 0x0000000000", "BIN2NUM 0 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["0x01 0x01", "BIN2NUM 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["0x05 0x0000000001", "BIN2NUM", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["0x05 0x00000000FE", "BIN2NUM 254 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["0x05 0x8000000005", "BIN2NUM 0x01 0x85 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["0x05 0xffffffffff", "BIN2NUM", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_BIN2NUM_OPERATION"], +["0x03 0x000080", "BIN2NUM 128 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Pad where MSB of number is set"], +["0x03 0x800080", "BIN2NUM -128 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Pad where MSB of number is set"], +["0x02 0x0080", "BIN2NUM 128 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Pad where MSB of number is set"], +["0x02 0x8080", "BIN2NUM -128 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Pad where MSB of number is set"], +["0x03 0x00000f", "BIN2NUM 15 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Don't pad where MSB of number is not set"], +["0x03 0x80000f", "BIN2NUM -15 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Don't pad where MSB of number is not set"], +["0x02 0x000f", "BIN2NUM 15 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Don't pad where MSB of number is not set"], +["0x02 0x800f", "BIN2NUM -15 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Don't pad where MSB of number is not set"], +["0x05 0x0000800001", "BIN2NUM 8388609 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Ensure significant zero bytes are retained"], +["0x05 0x8000800001", "BIN2NUM -8388609 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Ensure significant zero bytes are retained"], +["0x05 0x00000f0001", "BIN2NUM 983041 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Ensure significant zero bytes are retained"], +["0x05 0x80000f0001", "BIN2NUM -983041 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Ensure significant zero bytes are retained"], + +["0", "BIN2NUM DEPTH 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Stack depth correct"], +["", "BIN2NUM", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_STACK_OPERATION", "Not enough operands"], + +["0 1", "NUM2BIN 0x01 0x00 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["1 1", "NUM2BIN 0x01 0x01 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["0x01 0xFE 1", "NUM2BIN 0x01 0xFE EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["0x01 0x02 4", "NUM2BIN 0x04 0x00000002 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["0x01 0x85 4", "NUM2BIN 0x04 0x80000005 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], +["0x02 0xffff 1", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_NUM2BIN_OPERATION", "Number cannot be encoded in specified length"], +["0x02 0x00ff 1", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_NUM2BIN_OPERATION", "Number cannot be encoded in specified length"], +["0x02 0x00ff 0", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_NUM2BIN_OPERATION", "Specified length is zero"], +["0x02 0x00ff 0x01 0x81", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_NUM2BIN_OPERATION", "Specified length is negative"], +["0x01 0xff 521", "NUM2BIN 0x04 0x8000007f EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_NUM2BIN_OPERATION", "Specified length is > DEFAULT_MAX_NUM_BYTES"], +["0x01 0xff 4", "NUM2BIN 0x04 0x8000007f EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Move sign bit from significant byte"], +["1 0x01 0x04", "NUM2BIN DEPTH 1 EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK", "Stack depth correct"], +["1", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_STACK_OPERATION", "Not enough operands"], +["", "NUM2BIN", "P2SH,STRICTENC,MONOLITH_OPCODES", "INVALID_STACK_OPERATION", "Not enough operands"], + +["0x02 0x85ff DUP 4", "NUM2BIN BIN2NUM EQUAL", "P2SH,STRICTENC,MONOLITH_OPCODES", "OK"], ["NOP", "SIZE 1", "P2SH,STRICTENC", "INVALID_STACK_OPERATION"], diff --git a/src/test/monolith_opcodes_type.cpp b/src/test/monolith_opcodes_type.cpp new file mode 100644 --- /dev/null +++ b/src/test/monolith_opcodes_type.cpp @@ -0,0 +1,314 @@ +// Copyright (c) 2011-2018 The Bitcoin Cash developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "script/script.h" +#include "script/interpreter.h" +#include "policy/policy.h" +#include +#include + +using namespace std; + +namespace { + +typedef std::vector valtype; +typedef std::vector stacktype; + +std::array flagset{0, + STANDARD_SCRIPT_VERIFY_FLAGS, + MANDATORY_SCRIPT_VERIFY_FLAGS}; + +static void CheckOpError(uint32_t flags, const stacktype &original_stack, + const CScript& script, ScriptError expected_error) { + BaseSignatureChecker sigchecker; + + ScriptError err = SCRIPT_ERR_OK; + stacktype stack{original_stack}; + bool r = EvalScript(stack, script, + flags | SCRIPT_ENABLE_MONOLITH_OPCODES, sigchecker, + &err); + BOOST_CHECK(!r); + BOOST_CHECK_EQUAL(err, expected_error); +} + +static void CheckOpError(const stacktype &original_stack, + const CScript& script, ScriptError expected_error) { + for (uint32_t flags : flagset) { + CheckOpError(flags, original_stack, script, expected_error); + } +} + +static void CheckOpError(const valtype& a, const CScript& script, + ScriptError expected_error) { + CheckOpError(stacktype{a}, script, expected_error); +} + +////////////////////// methods which expect success. + +static void CheckOp(uint32_t flags, const stacktype original_stack, const CScript& script, + const stacktype &expected_stack) { + BaseSignatureChecker sigchecker; + + ScriptError err = SCRIPT_ERR_OK; + stacktype stack{original_stack}; + bool r = EvalScript(stack, script, + flags | SCRIPT_ENABLE_MONOLITH_OPCODES, sigchecker, + &err); + BOOST_CHECK(r); + BOOST_CHECK(stack == expected_stack); +} + +static void CheckOp(const stacktype &original_stack, const CScript& script, + const stacktype& expected_stack) { + for (uint32_t flags : flagset) { + CheckOp(flags, original_stack, script, expected_stack); + } +} + +static void CheckOp(const stacktype &original_stack, const CScript& script, + const valtype &expected) { + CheckOp(original_stack, script, stacktype{expected}); +} + +static void CheckOp(const valtype &a, const CScript& script, const valtype &expected) { + CheckOp(stacktype{a}, script, expected); +} + + /// OP_BIN2NUM tests + + /// mk_bin - helper function + /// input: + /// a (native) number - maybe LE or BE format. + /// output: + /// Bitcoin representation (up to 256 bytes, big-endian, 0x80 in + /// first byte used for sign) - removes the sign, constructs a BE + /// array of bytes with the positive number, the adds the sign. + /// + valtype mk_bin(int64_t v0) { + if (v0 == 0) + return valtype{0x00}; + bool neg = v0 < 0; + uint64_t v = htobe64(neg ? -v0 : v0); + valtype ans; + ans.reserve(8); + uint8_t* p = reinterpret_cast(&v); + for (size_t i = 0; i < 8; ++i, ++p) { + if (ans.empty()) { + if (!*p) continue; + if (*p & 0x80) ans.push_back(0x00); // first bit looks like a sign but it is not, add a leading 0 + } + ans.push_back(*p); + } + if (neg) + *ans.begin() |= 0x80; //add the sign + return move(ans); + } + + void test_bin2num_opcode() { + CScript script; + script << OP_BIN2NUM; + + // Test the mk_bin function + { valtype i{0x00, 0x80, 0x00, 0x05}; BOOST_CHECK_EQUAL(mk_bin(0x800005) == i, true); } + { valtype i{0x05}; BOOST_CHECK_EQUAL(mk_bin(0x000005) == i, true); } + { valtype i{0x01, 0x05}; BOOST_CHECK_EQUAL(mk_bin(0x000105) == i, true); } + { valtype i{0x81, 0x05}; BOOST_CHECK_EQUAL(mk_bin(-0x000105) == i, true); } + + CheckOpError(stacktype(), script, SCRIPT_ERR_INVALID_STACK_OPERATION); + CheckOp(mk_bin(0), script, valtype{}); + + CheckOp(mk_bin(std::numeric_limits::max() >> 1), script, + CScriptNum(std::numeric_limits::max() >> 1).getvch()); + + CheckOp(mk_bin(std::numeric_limits::min() >> 1), script, + CScriptNum(std::numeric_limits::min() >> 1).getvch()); + + CheckOpError(mk_bin((std::numeric_limits::max() >> 1) + 1), script, + SCRIPT_ERR_INVALID_BIN2NUM_OPERATION); + + CheckOpError(mk_bin((std::numeric_limits::min() >> 1) - 1), script, + SCRIPT_ERR_INVALID_BIN2NUM_OPERATION); + + CheckOp(mk_bin(106894), script, CScriptNum(106894).getvch()); + CheckOp(mk_bin(-106894), script, CScriptNum(-106894).getvch()); + CheckOp(mk_bin(0), script, CScriptNum(0).getvch()); + } + + /// OP_NUM2BIN tests + + /// make expected value - helper function + /// input: + /// number in LE byte order, desired output byte length + /// output: + /// Bitcoin representatio - removes the sign, constructs a BE array + //// of bytes with the positive number, then it adds the sign. + /// + valtype make_ev(valtype v, size_t sz) { //v contains a num in LE + if (v.empty()) + return vector(sz, 0); + valtype ans; + assert(sz >= v.size()); + ans.reserve(sz); + bool neg = *v.rbegin() & 0x80; + *v.rbegin() &= ~0x80; + size_t pad = sz - v.size(); + for (uint8_t i = 0; i < pad; ++i) { + ans.push_back(0); + } + for (auto i = v.rbegin(); i != v.rend(); ++i) { + ans.push_back(*i); + } + if (neg) + *ans.begin() |= 0x80; + return ans; + } + + void test_num2bin(const CScript& script, valtype v) { + if (v.empty()) + return; + for (uint8_t i = 0; i < v.size(); ++i) { + if (i == 0) + CheckOpError(stacktype{v, {}}, script, + SCRIPT_ERR_INVALID_NUM2BIN_OPERATION); + else + CheckOpError(stacktype{v, {i}}, script, + SCRIPT_ERR_INVALID_NUM2BIN_OPERATION); + } + for (uint8_t i = v.size(); i <= DEFAULT_MAX_NUM_BYTES; ++i) { + if (i == 0) + CheckOp(stacktype{v, {}}, script, make_ev(v,i)); + else + CheckOp(stacktype{v, {i}}, script, make_ev(v,i)); + } + } + + void test_num2bin_opcode() { + CScript script; + script << OP_NUM2BIN; + + CheckOpError(stacktype(), script, SCRIPT_ERR_INVALID_STACK_OPERATION); + CheckOpError(stacktype{{4}}, script, SCRIPT_ERR_INVALID_STACK_OPERATION); + + CheckOpError(stacktype{{0x02}, {DEFAULT_MAX_NUM_BYTES + 1}}, + script, SCRIPT_ERR_INVALID_NUM2BIN_OPERATION); + + CheckOpError(stacktype{{0x85}, {DEFAULT_MAX_NUM_BYTES + 1}}, + script, SCRIPT_ERR_INVALID_NUM2BIN_OPERATION); + + CheckOpError(stacktype{{0x02}, {}}, script, + SCRIPT_ERR_INVALID_NUM2BIN_OPERATION); + + CheckOpError(stacktype{{0x85}, {0x85}}, script, + SCRIPT_ERR_INVALID_NUM2BIN_OPERATION); + + CheckOpError(stacktype{{0x85}, {}}, script, + SCRIPT_ERR_INVALID_NUM2BIN_OPERATION); + + test_num2bin(script, {}); + test_num2bin(script, {0x7f}); + test_num2bin(script, {0xff, 0x7f}); //LE for 0x7FFF + test_num2bin(script, {0x02, 0x71}); + test_num2bin(script, {0xff, 0xff, 0x7f}); + test_num2bin(script, {0x03, 0x02, 0x71}); + test_num2bin(script, {0xff, 0xff, 0xff, 0x7f}); + test_num2bin(script, {0x04, 0x03, 0x02, 0x71}); + test_num2bin(script, {0x81}); + test_num2bin(script, {0xff, 0x80}); + test_num2bin(script, {0xaf, 0x81}); + test_num2bin(script, {0xed, 0x60, 0x83}); + test_num2bin(script, {0xb6, 0xe3, 0x81}); + test_num2bin(script, {0x81, 0x9a, 0x6e, 0x84}); + test_num2bin(script, {0xe4, 0xc3, 0x92, 0x91}); + } + + /// OP_BIN2NUM + OP_NUM2BIN tests + + void test_bin2num_num2bin(const CScript& script, int sz, int64_t v) { + auto x = mk_bin(v); + CheckOp(stacktype{x}, script, make_ev(CScriptNum(v).getvch(), sz)); + } + + void test_num2bin_bin2num(const CScript& script, int64_t v) { + CheckOp(stacktype{CScriptNum(v).getvch()}, script, CScriptNum(v).getvch()); + } + + void test_bin2num_num2bin(int sz) { + CScript script; + script << OP_BIN2NUM << sz << OP_NUM2BIN; + test_bin2num_num2bin(script, sz, 0); + test_bin2num_num2bin(script, sz, 1); + test_bin2num_num2bin(script, sz, -1); + if (sz >= 2) { + test_bin2num_num2bin(script,sz, 321); + test_bin2num_num2bin(script,sz, -321); + if (sz >= 3) { + test_bin2num_num2bin(script, sz, 106894); + test_bin2num_num2bin(script, sz, -106894); + if (sz >= 4) { + test_bin2num_num2bin(script, sz, std::numeric_limits::max() >> 1); + test_bin2num_num2bin(script, sz, std::numeric_limits::min() >> 1); + } + } + } + } + + void test_num2bin_bin2num(int sz) { + CScript script; + script << sz << OP_NUM2BIN << OP_BIN2NUM; + test_num2bin_bin2num(script, 0); + test_num2bin_bin2num(script, 1); + test_num2bin_bin2num(script, -1); + if (sz >= 2) { + test_num2bin_bin2num(script, 321); + test_num2bin_bin2num(script, -321); + if (sz >= 3) { + test_num2bin_bin2num(script, 106894); + test_num2bin_bin2num(script, -106894); + if (sz >= 4) { + test_num2bin_bin2num(script, std::numeric_limits::max() >> 1); + test_num2bin_bin2num(script, std::numeric_limits::min() >> 1); + } + } + } + } + + void test_bin2num_num2bin() { + test_bin2num_num2bin(4); //expect 4 byte output + test_bin2num_num2bin(3); //expect 3 byte output + test_bin2num_num2bin(2); //expect 2 byte output + test_bin2num_num2bin(1); //expect 1 byte output + } + + void test_num2bin_bin2num() { + test_num2bin_bin2num(4); //4 byte num2bin output + test_num2bin_bin2num(3); //3 byte num2bin output + test_num2bin_bin2num(2); //2 byte num2bin output + test_num2bin_bin2num(1); //1 byte num2bin output + } + +} + +/// Entry points + +BOOST_AUTO_TEST_SUITE(opcode_type) + +BOOST_AUTO_TEST_CASE(bin2num_opcode_tests) { + test_bin2num_opcode(); +} + +BOOST_AUTO_TEST_CASE(num2bin_opcode_tests) { + test_num2bin_opcode(); +} + +BOOST_AUTO_TEST_CASE(bin2num_num2bin_testsG) { + test_bin2num_num2bin(); +} + +BOOST_AUTO_TEST_CASE(num2bin_bin2num) { + test_num2bin_bin2num(); +} + +BOOST_AUTO_TEST_SUITE_END() + + diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -62,6 +62,8 @@ {SCRIPT_ERR_STACK_SIZE, "STACK_SIZE"}, {SCRIPT_ERR_SIG_COUNT, "SIG_COUNT"}, {SCRIPT_ERR_PUBKEY_COUNT, "PUBKEY_COUNT"}, + {SCRIPT_ERR_INVALID_BIN2NUM_OPERATION, "INVALID_BIN2NUM_OPERATION"}, + {SCRIPT_ERR_INVALID_NUM2BIN_OPERATION, "INVALID_NUM2BIN_OPERATION"}, {SCRIPT_ERR_VERIFY, "VERIFY"}, {SCRIPT_ERR_EQUALVERIFY, "EQUALVERIFY"}, {SCRIPT_ERR_CHECKMULTISIGVERIFY, "CHECKMULTISIGVERIFY"},