From 7db380d341e3edfa6db009362659f9a10f0f51eb Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 17 Jun 2015 17:01:25 +0300 Subject: [PATCH] FuzzTests: blocktests (before merge) --- test/TestHelper.h | 1 + test/fuzzTesting/CMakeLists.txt | 2 +- test/fuzzTesting/createRandomTest.cpp | 93 +++++++++++++++---- test/fuzzTesting/fuzzHelper.cpp | 8 +- test/fuzzTesting/fuzzHelper.h | 2 +- test/libethereum/blockchain.cpp | 128 +++++++++++++------------- 6 files changed, 149 insertions(+), 85 deletions(-) diff --git a/test/TestHelper.h b/test/TestHelper.h index c97d4c017..42f85a82c 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -188,6 +188,7 @@ json_spirit::mObject fillJsonWithTransaction(eth::Transaction _txn); void doTransactionTests(json_spirit::mValue& _v, bool _fillin); void doStateTests(json_spirit::mValue& v, bool _fillin); void doVMTests(json_spirit::mValue& v, bool _fillin); +void doBlockchainTests(json_spirit::mValue& _v, bool _fillin); template void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) diff --git a/test/fuzzTesting/CMakeLists.txt b/test/fuzzTesting/CMakeLists.txt index 9cdc7eb60..9bd2b5540 100644 --- a/test/fuzzTesting/CMakeLists.txt +++ b/test/fuzzTesting/CMakeLists.txt @@ -8,7 +8,7 @@ include_directories(${Boost_INCLUDE_DIRS}) include_directories(${CRYPTOPP_INCLUDE_DIRS}) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) -add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libethereum/transaction.cpp" "../libethereum/state.cpp" "../libevm/vm.cpp") +add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libethereum/transaction.cpp" "../libethereum/state.cpp" "../libevm/vm.cpp" "../libethereum/blockchain.cpp") add_executable(createRandomVMTest "./createRandomVMTest.cpp" "../libevm/vm.cpp" "../TestHelper.cpp" "../Stats.cpp") add_executable(createRandomStateTest "./createRandomStateTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp") diff --git a/test/fuzzTesting/createRandomTest.cpp b/test/fuzzTesting/createRandomTest.cpp index a42ead3ef..34f90533f 100644 --- a/test/fuzzTesting/createRandomTest.cpp +++ b/test/fuzzTesting/createRandomTest.cpp @@ -27,11 +27,13 @@ #include #include #include +#include //String Variables extern std::string const c_testExampleStateTest; extern std::string const c_testExampleTransactionTest; extern std::string const c_testExampleVMTest; +extern std::string const c_testExampleBlockchainTest; //Main Test functinos void fillRandomTest(std::function doTests, std::string const& testString); @@ -44,7 +46,7 @@ void parseTestWithTypes(std::string& test); int main(int argc, char *argv[]) { std::string testSuite; - json_spirit::mValue testValue; + json_spirit::mValue testmValue; bool checktest = false; for (auto i = 0; i < argc; ++i) { @@ -70,7 +72,7 @@ int main(int argc, char *argv[]) std::cout << "Error! Content of argument is empty! (Usage -checktest textstream) \n"; return 1; } - read_string(s, testValue); + read_string(s, testmValue); checktest = true; } } @@ -84,15 +86,15 @@ int main(int argc, char *argv[]) if (testSuite == "BlockChainTests") { if (checktest) - return checkRandomTest(dev::test::doTransactionTests, testValue); + return checkRandomTest(dev::test::doBlockchainTests, testmValue); else - fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); + fillRandomTest(dev::test::doBlockchainTests, c_testExampleBlockchainTest); } else if (testSuite == "TransactionTests") { if (checktest) - return checkRandomTest(dev::test::doTransactionTests, testValue); + return checkRandomTest(dev::test::doTransactionTests, testmValue); else fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); } @@ -100,7 +102,7 @@ int main(int argc, char *argv[]) if (testSuite == "StateTests") { if (checktest) - return checkRandomTest(dev::test::doStateTests, testValue); + return checkRandomTest(dev::test::doStateTests, testmValue); else fillRandomTest(dev::test::doStateTests, c_testExampleStateTest); } @@ -110,7 +112,7 @@ int main(int argc, char *argv[]) if (checktest) { dev::eth::VMFactory::setKind(dev::eth::VMKind::JIT); - return checkRandomTest(dev::test::doVMTests, testValue); + return checkRandomTest(dev::test::doVMTests, testmValue); } else fillRandomTest(dev::test::doVMTests, c_testExampleVMTest); @@ -152,16 +154,17 @@ int checkRandomTest(std::function doTests, jso void fillRandomTest(std::function doTests, std::string const& testString) { //redirect all output to the stream - std::ostringstream strCout; - std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); - std::cout.rdbuf( strCout.rdbuf() ); - std::cerr.rdbuf( strCout.rdbuf() ); + //std::ostringstream strCout; + //std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); + //std::cout.rdbuf( strCout.rdbuf() ); + //std::cerr.rdbuf( strCout.rdbuf() ); json_spirit::mValue v; try { std::string newTest = testString; parseTestWithTypes(newTest); + std::cout << newTest; json_spirit::read_string(newTest, v); doTests(v, true); } @@ -171,8 +174,8 @@ void fillRandomTest(std::function doTests, std } //restroe output - std::cout.rdbuf(oldCoutStreamBuf); - std::cerr.rdbuf(oldCoutStreamBuf); + //std::cout.rdbuf(oldCoutStreamBuf); + //std::cerr.rdbuf(oldCoutStreamBuf); std::cout << json_spirit::write_string(v, true); } @@ -207,6 +210,9 @@ void parseTestWithTypes(std::string& _test) if (types.at(i) == "[HEX]") _test.replace(pos, 5, dev::test::RandomCode::randomUniIntHex()); else + if (types.at(i) == "[GASLIMIT]") + _test.replace(pos, 10, dev::test::RandomCode::randomUniIntHex(dev::u256("3000000000"))); + else if (types.at(i) == "[HASH20]") _test.replace(pos, 8, dev::test::RandomCode::rndByteSequence(20)); else @@ -235,7 +241,7 @@ void parseTestWithTypes(std::string& _test) std::vector getTypes() { - return {"[CODE]", "[HEX]", "[HASH20]", "[HASH32]", "[0xHASH32]", "[V]"}; + return {"[CODE]", "[HEX]", "[HASH20]", "[HASH32]", "[0xHASH32]", "[V]", "[GASLIMIT]"}; } std::string const c_testExampleTransactionTest = R"( @@ -263,7 +269,7 @@ std::string const c_testExampleStateTest = R"( "env" : { "currentCoinbase" : "[HASH20]", "currentDifficulty" : "[HEX]", - "currentGasLimit" : "[HEX]", + "currentGasLimit" : "[GASLIMIT]", "currentNumber" : "[HEX]", "currentTimestamp" : "[HEX]", "previousHash" : "[HASH32]" @@ -310,7 +316,7 @@ std::string const c_testExampleVMTest = R"( "env" : { "previousHash" : "[HASH32]", "currentNumber" : "[HEX]", - "currentGasLimit" : "[HEX]", + "currentGasLimit" : "[GASLIMIT]", "currentDifficulty" : "[HEX]", "currentTimestamp" : "[HEX]", "currentCoinbase" : "[HASH20]" @@ -335,3 +341,58 @@ std::string const c_testExampleVMTest = R"( } } )"; + +std::string const c_testExampleBlockchainTest = R"( +{ + "blockTest" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "[HASH20]", + "difficulty" : "131072", + "extraData" : "[CODE]", + "gasLimit" : "3141592", + "gasUsed" : "0", + "mixHash" : "[0xHASH32]", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "[0xHASH32]", + "stateRoot" : "[0xHASH32]", + "timestamp" : "[HEX]", + "transactionsTrie" : "[0xHASH32]", + "uncleHash" : "[0xHASH32]" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "[HEX]", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "[HEX]", + "nonce" : "[HEX]", + "code" : "[CODE]", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "[CODE]", + "gasLimit" : "[HEX]", + "gasPrice" : "[V]", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "[V]" + } + ], + "uncleHeaders" : [ + ] + } + ] + } +} +)"; diff --git a/test/fuzzTesting/fuzzHelper.cpp b/test/fuzzTesting/fuzzHelper.cpp index 60d93caf0..8e03bd767 100644 --- a/test/fuzzTesting/fuzzHelper.cpp +++ b/test/fuzzTesting/fuzzHelper.cpp @@ -91,13 +91,15 @@ std::string RandomCode::generate(int _maxOpNumber, RandomCodeOptions _options) return code; } -std::string RandomCode::randomUniIntHex() +std::string RandomCode::randomUniIntHex(u256 _maxVal) { + if (_maxVal == 0) + _maxVal = std::numeric_limits::max(); refreshSeed(); int rand = randUniIntGen() % 100; if (rand < 50) - return "0x" + toCompactHex((u256)randUniIntGen()); - return "0x" + toCompactHex((u256)randUInt64Gen()); + return "0x" + toCompactHex((u256)randUniIntGen() % _maxVal); + return "0x" + toCompactHex((u256)randUInt64Gen() % _maxVal); } int RandomCode::randomUniInt() diff --git a/test/fuzzTesting/fuzzHelper.h b/test/fuzzTesting/fuzzHelper.h index 6a46bbeaf..309037e3d 100644 --- a/test/fuzzTesting/fuzzHelper.h +++ b/test/fuzzTesting/fuzzHelper.h @@ -76,7 +76,7 @@ public: static std::string rndByteSequence(int _length = 1, SizeStrictness _sizeType = SizeStrictness::Strict); /// Generate random int64 - static std::string randomUniIntHex(); + static std::string randomUniIntHex(u256 _maxVal = 0); static int randomUniInt(); private: diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 2c4a0b498..88c39442b 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -59,10 +59,10 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } cerr << i.first << endl; - BOOST_REQUIRE(o.count("genesisBlockHeader")); + TBOOST_REQUIRE(o.count("genesisBlockHeader")); BlockInfo biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj()); - BOOST_REQUIRE(o.count("pre")); + TBOOST_REQUIRE(o.count("pre")); ImportTest importer(o["pre"].get_obj()); TransientDirectory td_stateDB_tmp; State trueState(OverlayDB(State::openDB(td_stateDB_tmp.path())), BaseState::Empty, biGenesisBlock.coinbaseAddress); @@ -77,7 +77,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) if (_fillin) biGenesisBlock.stateRoot = trueState.rootHash(); else - BOOST_CHECK_MESSAGE(biGenesisBlock.stateRoot == trueState.rootHash(), "root hash does not match"); + TBOOST_CHECK_MESSAGE((biGenesisBlock.stateRoot == trueState.rootHash()), "root hash does not match"); if (_fillin) { @@ -99,7 +99,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) if (_fillin) { - BOOST_REQUIRE(o.count("blocks")); + TBOOST_REQUIRE(o.count("blocks")); mArray blArray; blockSet genesis; @@ -145,7 +145,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) // get txs TransactionQueue txs; ZeroGasPricer gp; - BOOST_REQUIRE(blObj.count("transactions")); + TBOOST_REQUIRE(blObj.count("transactions")); for (auto const& txObj: blObj["transactions"].get_array()) { mObject tx = txObj.get_obj(); @@ -337,29 +337,29 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) catch (Exception const& _e) { cnote << "state sync or block import did throw an exception: " << diagnostic_information(_e); - BOOST_CHECK(blObj.count("blockHeader") == 0); - BOOST_CHECK(blObj.count("transactions") == 0); - BOOST_CHECK(blObj.count("uncleHeaders") == 0); + TBOOST_CHECK((blObj.count("blockHeader") == 0)); + TBOOST_CHECK((blObj.count("transactions") == 0)); + TBOOST_CHECK((blObj.count("uncleHeaders") == 0)); continue; } catch (std::exception const& _e) { cnote << "state sync or block import did throw an exception: " << _e.what(); - BOOST_CHECK(blObj.count("blockHeader") == 0); - BOOST_CHECK(blObj.count("transactions") == 0); - BOOST_CHECK(blObj.count("uncleHeaders") == 0); + TBOOST_CHECK((blObj.count("blockHeader") == 0)); + TBOOST_CHECK((blObj.count("transactions") == 0)); + TBOOST_CHECK((blObj.count("uncleHeaders") == 0)); continue; } catch (...) { cnote << "state sync or block import did throw an exception\n"; - BOOST_CHECK(blObj.count("blockHeader") == 0); - BOOST_CHECK(blObj.count("transactions") == 0); - BOOST_CHECK(blObj.count("uncleHeaders") == 0); + TBOOST_CHECK((blObj.count("blockHeader") == 0)); + TBOOST_CHECK((blObj.count("transactions") == 0)); + TBOOST_CHECK((blObj.count("uncleHeaders") == 0)); continue; } - BOOST_REQUIRE(blObj.count("blockHeader")); + TBOOST_REQUIRE(blObj.count("blockHeader")); mObject tObj = blObj["blockHeader"].get_obj(); BlockInfo blockHeaderFromFields; @@ -372,24 +372,24 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) if (importedAndBest) { //Check the fields restored from RLP to original fields - BOOST_CHECK_MESSAGE(blockHeaderFromFields.headerHash(WithNonce) == blockFromRlp.headerHash(WithNonce), "hash in given RLP not matching the block hash!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.parentHash == blockFromRlp.parentHash, "parentHash in given RLP not matching the block parentHash!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.sha3Uncles == blockFromRlp.sha3Uncles, "sha3Uncles in given RLP not matching the block sha3Uncles!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.coinbaseAddress == blockFromRlp.coinbaseAddress,"coinbaseAddress in given RLP not matching the block coinbaseAddress!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.stateRoot == blockFromRlp.stateRoot, "stateRoot in given RLP not matching the block stateRoot!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.transactionsRoot == blockFromRlp.transactionsRoot, "transactionsRoot in given RLP not matching the block transactionsRoot!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.receiptsRoot == blockFromRlp.receiptsRoot, "receiptsRoot in given RLP not matching the block receiptsRoot!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.logBloom == blockFromRlp.logBloom, "logBloom in given RLP not matching the block logBloom!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.difficulty == blockFromRlp.difficulty, "difficulty in given RLP not matching the block difficulty!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.number == blockFromRlp.number, "number in given RLP not matching the block number!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasLimit == blockFromRlp.gasLimit,"gasLimit in given RLP not matching the block gasLimit!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasUsed == blockFromRlp.gasUsed, "gasUsed in given RLP not matching the block gasUsed!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.timestamp == blockFromRlp.timestamp, "timestamp in given RLP not matching the block timestamp!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.extraData == blockFromRlp.extraData, "extraData in given RLP not matching the block extraData!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.mixHash == blockFromRlp.mixHash, "mixHash in given RLP not matching the block mixHash!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.nonce == blockFromRlp.nonce, "nonce in given RLP not matching the block nonce!"); - - BOOST_CHECK_MESSAGE(blockHeaderFromFields == blockFromRlp, "However, blockHeaderFromFields != blockFromRlp!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.headerHash(WithNonce) == blockFromRlp.headerHash(WithNonce)), "hash in given RLP not matching the block hash!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.parentHash == blockFromRlp.parentHash), "parentHash in given RLP not matching the block parentHash!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.sha3Uncles == blockFromRlp.sha3Uncles), "sha3Uncles in given RLP not matching the block sha3Uncles!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.coinbaseAddress == blockFromRlp.coinbaseAddress),"coinbaseAddress in given RLP not matching the block coinbaseAddress!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.stateRoot == blockFromRlp.stateRoot), "stateRoot in given RLP not matching the block stateRoot!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.transactionsRoot == blockFromRlp.transactionsRoot), "transactionsRoot in given RLP not matching the block transactionsRoot!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.receiptsRoot == blockFromRlp.receiptsRoot), "receiptsRoot in given RLP not matching the block receiptsRoot!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.logBloom == blockFromRlp.logBloom), "logBloom in given RLP not matching the block logBloom!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.difficulty == blockFromRlp.difficulty), "difficulty in given RLP not matching the block difficulty!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.number == blockFromRlp.number), "number in given RLP not matching the block number!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.gasLimit == blockFromRlp.gasLimit),"gasLimit in given RLP not matching the block gasLimit!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.gasUsed == blockFromRlp.gasUsed), "gasUsed in given RLP not matching the block gasUsed!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.timestamp == blockFromRlp.timestamp), "timestamp in given RLP not matching the block timestamp!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.extraData == blockFromRlp.extraData), "extraData in given RLP not matching the block extraData!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.mixHash == blockFromRlp.mixHash), "mixHash in given RLP not matching the block mixHash!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.nonce == blockFromRlp.nonce), "nonce in given RLP not matching the block nonce!"); + + TBOOST_CHECK_MESSAGE((blockHeaderFromFields == blockFromRlp), "However, blockHeaderFromFields != blockFromRlp!"); //Check transaction list @@ -399,15 +399,15 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) { mObject tx = txObj.get_obj(); - BOOST_REQUIRE(tx.count("nonce")); - BOOST_REQUIRE(tx.count("gasPrice")); - BOOST_REQUIRE(tx.count("gasLimit")); - BOOST_REQUIRE(tx.count("to")); - BOOST_REQUIRE(tx.count("value")); - BOOST_REQUIRE(tx.count("v")); - BOOST_REQUIRE(tx.count("r")); - BOOST_REQUIRE(tx.count("s")); - BOOST_REQUIRE(tx.count("data")); + TBOOST_REQUIRE(tx.count("nonce")); + TBOOST_REQUIRE(tx.count("gasPrice")); + TBOOST_REQUIRE(tx.count("gasLimit")); + TBOOST_REQUIRE(tx.count("to")); + TBOOST_REQUIRE(tx.count("value")); + TBOOST_REQUIRE(tx.count("v")); + TBOOST_REQUIRE(tx.count("r")); + TBOOST_REQUIRE(tx.count("s")); + TBOOST_REQUIRE(tx.count("data")); try { @@ -416,7 +416,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } catch (Exception const& _e) { - BOOST_ERROR("Failed transaction constructor with Exception: " << diagnostic_information(_e)); + TBOOST_ERROR("Failed transaction constructor with Exception: " << diagnostic_information(_e)); } catch (exception const& _e) { @@ -432,22 +432,22 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) txsFromRlp.push_back(tx); } - BOOST_CHECK_MESSAGE(txsFromRlp.size() == txsFromField.size(), "transaction list size does not match"); + TBOOST_CHECK_MESSAGE((txsFromRlp.size() == txsFromField.size()), "transaction list size does not match"); for (size_t i = 0; i < txsFromField.size(); ++i) { - BOOST_CHECK_MESSAGE(txsFromField[i].data() == txsFromRlp[i].data(), "transaction data in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].gas() == txsFromRlp[i].gas(), "transaction gasLimit in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].gasPrice() == txsFromRlp[i].gasPrice(), "transaction gasPrice in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].nonce() == txsFromRlp[i].nonce(), "transaction nonce in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].signature().r == txsFromRlp[i].signature().r, "transaction r in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].signature().s == txsFromRlp[i].signature().s, "transaction s in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].signature().v == txsFromRlp[i].signature().v, "transaction v in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].receiveAddress() == txsFromRlp[i].receiveAddress(), "transaction receiveAddress in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].value() == txsFromRlp[i].value(), "transaction receiveAddress in rlp and in field do not match"); - - BOOST_CHECK_MESSAGE(txsFromField[i] == txsFromRlp[i], "transactions from rlp and transaction from field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].rlp() == txsFromRlp[i].rlp(), "transactions rlp do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].data() == txsFromRlp[i].data()), "transaction data in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].gas() == txsFromRlp[i].gas()), "transaction gasLimit in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].gasPrice() == txsFromRlp[i].gasPrice()), "transaction gasPrice in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].nonce() == txsFromRlp[i].nonce()), "transaction nonce in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].signature().r == txsFromRlp[i].signature().r), "transaction r in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].signature().s == txsFromRlp[i].signature().s), "transaction s in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].signature().v == txsFromRlp[i].signature().v), "transaction v in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].receiveAddress() == txsFromRlp[i].receiveAddress()), "transaction receiveAddress in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].value() == txsFromRlp[i].value()), "transaction receiveAddress in rlp and in field do not match"); + + TBOOST_CHECK_MESSAGE((txsFromField[i] == txsFromRlp[i]), "transactions from rlp and transaction from field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].rlp() == txsFromRlp[i].rlp()), "transactions rlp do not match"); } // check uncle list @@ -458,7 +458,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) for (auto const& uBlHeaderObj: blObj["uncleHeaders"].get_array()) { mObject uBlH = uBlHeaderObj.get_obj(); - BOOST_REQUIRE(uBlH.size() == 16); + TBOOST_REQUIRE((uBlH.size() == 16)); bytes uncleRLP = createBlockRLPFromFields(uBlH); const RLP c_uRLP(uncleRLP); BlockInfo uncleBlockHeader; @@ -468,7 +468,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } catch(...) { - BOOST_ERROR("invalid uncle header"); + TBOOST_ERROR("invalid uncle header"); } uBlHsFromField.push_back(uncleBlockHeader); } @@ -482,15 +482,15 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) uBlHsFromRlp.push_back(uBl); } - BOOST_REQUIRE_EQUAL(uBlHsFromField.size(), uBlHsFromRlp.size()); + TBOOST_REQUIRE_EQUAL(uBlHsFromField.size(), uBlHsFromRlp.size()); for (size_t i = 0; i < uBlHsFromField.size(); ++i) - BOOST_CHECK_MESSAGE(uBlHsFromField[i] == uBlHsFromRlp[i], "block header in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((uBlHsFromField[i] == uBlHsFromRlp[i]), "block header in rlp and in field do not match"); }//importedAndBest }//all blocks - BOOST_REQUIRE(o.count("lastblockhash") > 0); - BOOST_CHECK_MESSAGE(toString(trueBc.info().hash()) == o["lastblockhash"].get_str(), + TBOOST_REQUIRE((o.count("lastblockhash") > 0)); + TBOOST_CHECK_MESSAGE((toString(trueBc.info().hash()) == o["lastblockhash"].get_str()), "Boost check: " + i.first + " lastblockhash does not match " + toString(trueBc.info().hash()) + " expected: " + o["lastblockhash"].get_str()); } } @@ -713,11 +713,11 @@ BlockInfo constructBlock(mObject& _o) } catch (std::exception const& _e) { - BOOST_ERROR("Failed block population with Exception: " << _e.what()); + TBOOST_ERROR("Failed block population with Exception: " << _e.what()); } catch(...) { - BOOST_ERROR("block population did throw an unknown exception\n"); + TBOOST_ERROR("block population did throw an unknown exception\n"); } return ret; }