From 3e2c8cc8788cb804661c22c7e4b8f645d8817864 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 22 Jul 2015 21:27:30 +0300 Subject: [PATCH 1/8] libethereum:Transaction coverage --- test/fuzzTesting/CMakeLists.txt | 2 +- test/libethereum/Transaction.cpp | 112 ++++++++++++++++++ .../{transaction.cpp => transactionTests.cpp} | 2 +- 3 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 test/libethereum/Transaction.cpp rename test/libethereum/{transaction.cpp => transactionTests.cpp} (99%) diff --git a/test/fuzzTesting/CMakeLists.txt b/test/fuzzTesting/CMakeLists.txt index ec56282bf..9cb310a52 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" "../libethereum/blockchain.cpp" "../libdevcore/rlp.cpp") +add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libethereum/transactionTests.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/libethereum/Transaction.cpp b/test/libethereum/Transaction.cpp new file mode 100644 index 000000000..14c723db4 --- /dev/null +++ b/test/libethereum/Transaction.cpp @@ -0,0 +1,112 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file Transaction.cpp + * @author Dmitrii Khokhlov + * @date 2015 + * Transaaction test functions. + */ + +#include "test/TestHelper.h" + + +/*std::ostream& dev::eth::operator<<(std::ostream& _out, ExecutionResult const& _er) +{ + _out << "{" << _er.gasUsed << ", " << _er.newAddress << ", " << toHex(_er.output) << "}"; + return _out; +} + +std::ostream& dev::eth::operator<<(std::ostream& _out, TransactionException const& _er) +{ + switch (_er) + { + case TransactionException::None: _out << "None"; break; + case TransactionException::BadRLP: _out << "BadRLP"; break; + case TransactionException::InvalidFormat: _out << "InvalidFormat"; break; + case TransactionException::OutOfGasIntrinsic: _out << "OutOfGasIntrinsic"; break; + case TransactionException::InvalidSignature: _out << "InvalidSignature"; break; + case TransactionException::InvalidNonce: _out << "InvalidNonce"; break; + case TransactionException::NotEnoughCash: _out << "NotEnoughCash"; break; + case TransactionException::OutOfGasBase: _out << "OutOfGasBase"; break; + case TransactionException::BlockGasLimitReached: _out << "BlockGasLimitReached"; break; + case TransactionException::BadInstruction: _out << "BadInstruction"; break; + case TransactionException::BadJumpDestination: _out << "BadJumpDestination"; break; + case TransactionException::OutOfGas: _out << "OutOfGas"; break; + case TransactionException::OutOfStack: _out << "OutOfStack"; break; + case TransactionException::StackUnderflow: _out << "StackUnderflow"; break; + default: _out << "Unknown"; break; + } + return _out; +} + +Transaction::Transaction(bytesConstRef _rlpData, CheckTransaction _checkSig): + TransactionBase(_rlpData, _checkSig) +{ + if (_checkSig >= CheckTransaction::Cheap && !checkPayment()) + BOOST_THROW_EXCEPTION(OutOfGasIntrinsic() << RequirementError(gasRequired(), (bigint)gas())); +} + +bigint Transaction::gasRequired() const +{ + if (!m_gasRequired) + m_gasRequired = Transaction::gasRequired(m_data); + return m_gasRequired; +} +*/ + +using namespace dev; +using namespace eth; + +BOOST_AUTO_TEST_SUITE(libethereum) + +BOOST_AUTO_TEST_CASE(toTransactionExceptionConvert) +{ + RLPException rlpEx("exception"); + BOOST_CHECK_MESSAGE(toTransactionException(*(dynamic_cast(&rlpEx))) == TransactionException::BadRLP, "RLPException !=> TransactionException"); + OutOfGasIntrinsic oogEx; + BOOST_CHECK_MESSAGE(toTransactionException(*(dynamic_cast(&oogEx))) == TransactionException::OutOfGasIntrinsic, "OutOfGasIntrinsic !=> TransactionException"); + InvalidSignature sigEx; + BOOST_CHECK_MESSAGE(toTransactionException(*(dynamic_cast(&sigEx))) == TransactionException::InvalidSignature, "InvalidSignature !=> TransactionException"); + OutOfGasBase oogbEx; + BOOST_CHECK_MESSAGE(toTransactionException(*(dynamic_cast(&oogbEx))) == TransactionException::OutOfGasBase, "OutOfGasBase !=> TransactionException"); + InvalidNonce nonceEx; + BOOST_CHECK_MESSAGE(toTransactionException(*(dynamic_cast(&nonceEx))) == TransactionException::InvalidNonce, "InvalidNonce !=> TransactionException"); + + /*TransactionException dev::eth::toTransactionException(Exception const& _e) + { + + if (!!dynamic_cast(&_e)) + return TransactionException::InvalidNonce; + if (!!dynamic_cast(&_e)) + return TransactionException::NotEnoughCash; + if (!!dynamic_cast(&_e)) + return TransactionException::BlockGasLimitReached; + // VM execution exceptions + if (!!dynamic_cast(&_e)) + return TransactionException::BadInstruction; + if (!!dynamic_cast(&_e)) + return TransactionException::BadJumpDestination; + if (!!dynamic_cast(&_e)) + return TransactionException::OutOfGas; + if (!!dynamic_cast(&_e)) + return TransactionException::OutOfStack; + if (!!dynamic_cast(&_e)) + return TransactionException::StackUnderflow; + return TransactionException::Unknown; + }*/ +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/test/libethereum/transaction.cpp b/test/libethereum/transactionTests.cpp similarity index 99% rename from test/libethereum/transaction.cpp rename to test/libethereum/transactionTests.cpp index f6ed3ffa3..fe620eac6 100644 --- a/test/libethereum/transaction.cpp +++ b/test/libethereum/transactionTests.cpp @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file transaction.cpp +/** @file transactionTests.cpp * @author Dmitrii Khokhlov * @date 2015 * Transaction test functions. From 7fc62815f98dc00d149b67cf114d74d125fb5708 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 22 Jul 2015 21:55:30 +0300 Subject: [PATCH 2/8] cover1: toTransactionExceptionConvert --- test/libethereum/Transaction.cpp | 54 ++++++++++++++------------------ 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/test/libethereum/Transaction.cpp b/test/libethereum/Transaction.cpp index 14c723db4..16ff3d823 100644 --- a/test/libethereum/Transaction.cpp +++ b/test/libethereum/Transaction.cpp @@ -21,7 +21,8 @@ */ #include "test/TestHelper.h" - +#include +#include /*std::ostream& dev::eth::operator<<(std::ostream& _out, ExecutionResult const& _er) { @@ -74,39 +75,32 @@ BOOST_AUTO_TEST_SUITE(libethereum) BOOST_AUTO_TEST_CASE(toTransactionExceptionConvert) { - RLPException rlpEx("exception"); - BOOST_CHECK_MESSAGE(toTransactionException(*(dynamic_cast(&rlpEx))) == TransactionException::BadRLP, "RLPException !=> TransactionException"); + RLPException rlpEx("exception");//toTransactionException(*(dynamic_cast + BOOST_CHECK_MESSAGE(toTransactionException(rlpEx) == TransactionException::BadRLP, "RLPException !=> TransactionException"); OutOfGasIntrinsic oogEx; - BOOST_CHECK_MESSAGE(toTransactionException(*(dynamic_cast(&oogEx))) == TransactionException::OutOfGasIntrinsic, "OutOfGasIntrinsic !=> TransactionException"); + BOOST_CHECK_MESSAGE(toTransactionException(oogEx) == TransactionException::OutOfGasIntrinsic, "OutOfGasIntrinsic !=> TransactionException"); InvalidSignature sigEx; - BOOST_CHECK_MESSAGE(toTransactionException(*(dynamic_cast(&sigEx))) == TransactionException::InvalidSignature, "InvalidSignature !=> TransactionException"); + BOOST_CHECK_MESSAGE(toTransactionException(sigEx) == TransactionException::InvalidSignature, "InvalidSignature !=> TransactionException"); OutOfGasBase oogbEx; - BOOST_CHECK_MESSAGE(toTransactionException(*(dynamic_cast(&oogbEx))) == TransactionException::OutOfGasBase, "OutOfGasBase !=> TransactionException"); + BOOST_CHECK_MESSAGE(toTransactionException(oogbEx) == TransactionException::OutOfGasBase, "OutOfGasBase !=> TransactionException"); InvalidNonce nonceEx; - BOOST_CHECK_MESSAGE(toTransactionException(*(dynamic_cast(&nonceEx))) == TransactionException::InvalidNonce, "InvalidNonce !=> TransactionException"); - - /*TransactionException dev::eth::toTransactionException(Exception const& _e) - { - - if (!!dynamic_cast(&_e)) - return TransactionException::InvalidNonce; - if (!!dynamic_cast(&_e)) - return TransactionException::NotEnoughCash; - if (!!dynamic_cast(&_e)) - return TransactionException::BlockGasLimitReached; - // VM execution exceptions - if (!!dynamic_cast(&_e)) - return TransactionException::BadInstruction; - if (!!dynamic_cast(&_e)) - return TransactionException::BadJumpDestination; - if (!!dynamic_cast(&_e)) - return TransactionException::OutOfGas; - if (!!dynamic_cast(&_e)) - return TransactionException::OutOfStack; - if (!!dynamic_cast(&_e)) - return TransactionException::StackUnderflow; - return TransactionException::Unknown; - }*/ + BOOST_CHECK_MESSAGE(toTransactionException(nonceEx) == TransactionException::InvalidNonce, "InvalidNonce !=> TransactionException"); + NotEnoughCash cashEx; + BOOST_CHECK_MESSAGE(toTransactionException(cashEx) == TransactionException::NotEnoughCash, "NotEnoughCash !=> TransactionException"); + BlockGasLimitReached blGasEx; + BOOST_CHECK_MESSAGE(toTransactionException(blGasEx) == TransactionException::BlockGasLimitReached, "BlockGasLimitReached !=> TransactionException"); + BadInstruction badInsEx; + BOOST_CHECK_MESSAGE(toTransactionException(badInsEx) == TransactionException::BadInstruction, "BadInstruction !=> TransactionException"); + BadJumpDestination badJumpEx; + BOOST_CHECK_MESSAGE(toTransactionException(badJumpEx) == TransactionException::BadJumpDestination, "BadJumpDestination !=> TransactionException"); + OutOfGas oogEx2; + BOOST_CHECK_MESSAGE(toTransactionException(oogEx2) == TransactionException::OutOfGas, "OutOfGas !=> TransactionException"); + OutOfStack oosEx; + BOOST_CHECK_MESSAGE(toTransactionException(oosEx) == TransactionException::OutOfStack, "OutOfStack !=> TransactionException"); + StackUnderflow stackEx; + BOOST_CHECK_MESSAGE(toTransactionException(stackEx) == TransactionException::StackUnderflow, "StackUnderflow !=> TransactionException"); + Exception notEx; + BOOST_CHECK_MESSAGE(toTransactionException(notEx) == TransactionException::Unknown, "Unexpected should be TransactionException::Unknown"); } BOOST_AUTO_TEST_SUITE_END() From fa68d87e6afd6529ae160221320e043161d478e9 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Thu, 23 Jul 2015 16:41:11 +0300 Subject: [PATCH 3/8] cover1: Transaction --- test/libethereum/Transaction.cpp | 126 ++++++++++++++++++++++++------- 1 file changed, 97 insertions(+), 29 deletions(-) diff --git a/test/libethereum/Transaction.cpp b/test/libethereum/Transaction.cpp index 16ff3d823..973d4c1ce 100644 --- a/test/libethereum/Transaction.cpp +++ b/test/libethereum/Transaction.cpp @@ -23,36 +23,9 @@ #include "test/TestHelper.h" #include #include +#include -/*std::ostream& dev::eth::operator<<(std::ostream& _out, ExecutionResult const& _er) -{ - _out << "{" << _er.gasUsed << ", " << _er.newAddress << ", " << toHex(_er.output) << "}"; - return _out; -} - -std::ostream& dev::eth::operator<<(std::ostream& _out, TransactionException const& _er) -{ - switch (_er) - { - case TransactionException::None: _out << "None"; break; - case TransactionException::BadRLP: _out << "BadRLP"; break; - case TransactionException::InvalidFormat: _out << "InvalidFormat"; break; - case TransactionException::OutOfGasIntrinsic: _out << "OutOfGasIntrinsic"; break; - case TransactionException::InvalidSignature: _out << "InvalidSignature"; break; - case TransactionException::InvalidNonce: _out << "InvalidNonce"; break; - case TransactionException::NotEnoughCash: _out << "NotEnoughCash"; break; - case TransactionException::OutOfGasBase: _out << "OutOfGasBase"; break; - case TransactionException::BlockGasLimitReached: _out << "BlockGasLimitReached"; break; - case TransactionException::BadInstruction: _out << "BadInstruction"; break; - case TransactionException::BadJumpDestination: _out << "BadJumpDestination"; break; - case TransactionException::OutOfGas: _out << "OutOfGas"; break; - case TransactionException::OutOfStack: _out << "OutOfStack"; break; - case TransactionException::StackUnderflow: _out << "StackUnderflow"; break; - default: _out << "Unknown"; break; - } - return _out; -} - +/* Transaction::Transaction(bytesConstRef _rlpData, CheckTransaction _checkSig): TransactionBase(_rlpData, _checkSig) { @@ -73,6 +46,101 @@ using namespace eth; BOOST_AUTO_TEST_SUITE(libethereum) +BOOST_AUTO_TEST_CASE(TransactionConstructor) +{ + try + { + Transaction(fromHex("0xf86d800182521c94095e7baea6a6c7c4c2dfeb977efac326af552d870a8e0358ac39584bc98a7c979f984b031ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"), CheckTransaction::Everything); + } + case(Exception::) + { + + } +} + +} + +BOOST_AUTO_TEST_CASE(ExecutionResultOutput) +{ + std::stringstream buffer; + ExecutionResult exRes; + + exRes.gasUsed = u256("12345"); + exRes.newAddress = Address("a94f5374fce5edbc8e2a8697c15331677e6ebf0b"); + exRes.output = fromHex("001122334455"); + + buffer << exRes; + BOOST_CHECK_MESSAGE(buffer.str() == "{12345, a94f5374fce5edbc8e2a8697c15331677e6ebf0b, 001122334455}", "Error ExecutionResultOutput"); +} + +BOOST_AUTO_TEST_CASE(transactionExceptionOutput) +{ + std::stringstream buffer; + buffer << TransactionException::BadInstruction; + BOOST_CHECK_MESSAGE(buffer.str() == "BadInstruction", "Error output TransactionException::BadInstruction"); + buffer.str(std::string()); + + buffer << TransactionException::None; + BOOST_CHECK_MESSAGE(buffer.str() == "None", "Error output TransactionException::None"); + buffer.str(std::string()); + + buffer << TransactionException::BadRLP; + BOOST_CHECK_MESSAGE(buffer.str() == "BadRLP", "Error output TransactionException::BadRLP"); + buffer.str(std::string()); + + buffer << TransactionException::InvalidFormat; + BOOST_CHECK_MESSAGE(buffer.str() == "InvalidFormat", "Error output TransactionException::InvalidFormat"); + buffer.str(std::string()); + + buffer << TransactionException::OutOfGasIntrinsic; + BOOST_CHECK_MESSAGE(buffer.str() == "OutOfGasIntrinsic", "Error output TransactionException::OutOfGasIntrinsic"); + buffer.str(std::string()); + + buffer << TransactionException::InvalidSignature; + BOOST_CHECK_MESSAGE(buffer.str() == "InvalidSignature", "Error output TransactionException::InvalidSignature"); + buffer.str(std::string()); + + buffer << TransactionException::InvalidNonce; + BOOST_CHECK_MESSAGE(buffer.str() == "InvalidNonce", "Error output TransactionException::InvalidNonce"); + buffer.str(std::string()); + + buffer << TransactionException::NotEnoughCash; + BOOST_CHECK_MESSAGE(buffer.str() == "NotEnoughCash", "Error output TransactionException::NotEnoughCash"); + buffer.str(std::string()); + + buffer << TransactionException::OutOfGasBase; + BOOST_CHECK_MESSAGE(buffer.str() == "OutOfGasBase", "Error output TransactionException::OutOfGasBase"); + buffer.str(std::string()); + + buffer << TransactionException::BlockGasLimitReached; + BOOST_CHECK_MESSAGE(buffer.str() == "BlockGasLimitReached", "Error output TransactionException::BlockGasLimitReached"); + buffer.str(std::string()); + + buffer << TransactionException::BadInstruction; + BOOST_CHECK_MESSAGE(buffer.str() == "BadInstruction", "Error output TransactionException::BadInstruction"); + buffer.str(std::string()); + + buffer << TransactionException::BadJumpDestination; + BOOST_CHECK_MESSAGE(buffer.str() == "BadJumpDestination", "Error output TransactionException::BadJumpDestination"); + buffer.str(std::string()); + + buffer << TransactionException::OutOfGas; + BOOST_CHECK_MESSAGE(buffer.str() == "OutOfGas", "Error output TransactionException::OutOfGas"); + buffer.str(std::string()); + + buffer << TransactionException::OutOfStack; + BOOST_CHECK_MESSAGE(buffer.str() == "OutOfStack", "Error output TransactionException::OutOfStack"); + buffer.str(std::string()); + + buffer << TransactionException::StackUnderflow; + BOOST_CHECK_MESSAGE(buffer.str() == "StackUnderflow", "Error output TransactionException::StackUnderflow"); + buffer.str(std::string()); + + buffer << TransactionException(-1); + BOOST_CHECK_MESSAGE(buffer.str() == "Unknown", "Error output TransactionException::StackUnderflow"); + buffer.str(std::string()); +} + BOOST_AUTO_TEST_CASE(toTransactionExceptionConvert) { RLPException rlpEx("exception");//toTransactionException(*(dynamic_cast From 2ddc7a5e1872d9b46c65dc62f5aee320ebabf36c Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 24 Jul 2015 19:02:13 +0300 Subject: [PATCH 4/8] Coverage: Transaction --- test/fuzzTesting/CMakeLists.txt | 2 +- test/libethereum/Transaction.cpp | 34 ++++++++++++++------------------ 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/test/fuzzTesting/CMakeLists.txt b/test/fuzzTesting/CMakeLists.txt index 9cb310a52..77f7432e6 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/transactionTests.cpp" "../libethereum/state.cpp" "../libevm/vm.cpp" "../libethereum/blockchain.cpp") +add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libdevcore/rlp.cpp" "../libethereum/transactionTests.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/libethereum/Transaction.cpp b/test/libethereum/Transaction.cpp index 973d4c1ce..c26d08a14 100644 --- a/test/libethereum/Transaction.cpp +++ b/test/libethereum/Transaction.cpp @@ -25,39 +25,35 @@ #include #include -/* -Transaction::Transaction(bytesConstRef _rlpData, CheckTransaction _checkSig): - TransactionBase(_rlpData, _checkSig) -{ - if (_checkSig >= CheckTransaction::Cheap && !checkPayment()) - BOOST_THROW_EXCEPTION(OutOfGasIntrinsic() << RequirementError(gasRequired(), (bigint)gas())); -} - -bigint Transaction::gasRequired() const -{ - if (!m_gasRequired) - m_gasRequired = Transaction::gasRequired(m_data); - return m_gasRequired; -} -*/ - using namespace dev; using namespace eth; BOOST_AUTO_TEST_SUITE(libethereum) +BOOST_AUTO_TEST_CASE(TransactionGasRequired) +{ + Transaction tr(fromHex("0xf86d800182521c94095e7baea6a6c7c4c2dfeb977efac326af552d870a8e0358ac39584bc98a7c979f984b031ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"), CheckTransaction::None); + BOOST_CHECK_MESSAGE(tr.gasRequired() == 21952, "Transaction::GasRequired() has changed!"); +} + BOOST_AUTO_TEST_CASE(TransactionConstructor) { + bool wasException = false; try { Transaction(fromHex("0xf86d800182521c94095e7baea6a6c7c4c2dfeb977efac326af552d870a8e0358ac39584bc98a7c979f984b031ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"), CheckTransaction::Everything); } - case(Exception::) + catch(OutOfGasIntrinsic) { - + wasException = true; + } + catch(Exception) + { + BOOST_ERROR("Exception thrown but expected OutOfGasIntrinsic instead"); } -} + if (!wasException) + BOOST_ERROR("Expected OutOfGasIntrinsic exception to be thrown at TransactionConstructor test"); } BOOST_AUTO_TEST_CASE(ExecutionResultOutput) From d664a7e1a93bee68d13bdfa55ad02ad04f5f7cfd Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 24 Jul 2015 20:57:12 +0300 Subject: [PATCH 5/8] Tests - ExtraData32 --- .../BlockchainTestsFiller/bcValidBlockTestFiller.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json b/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json index b6dd28be3..a1995ddbd 100644 --- a/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json +++ b/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json @@ -889,7 +889,7 @@ ] }, - "ExtraData1024" : { + "ExtraData32" : { "genesisBlockHeader" : { "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", @@ -929,7 +929,7 @@ "blocks" : [ { "blockHeader" : { - "extraData" : "0x01020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000" + "extraData" : "0x0102030405060708091011121314151617181920212223242526272829303132" }, "transactions" : [ { From 698fec3d9a25dc3b479ea94a94cb212980834086 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Sat, 1 Aug 2015 18:13:28 +0300 Subject: [PATCH 6/8] Cover: style --- test/libethereum/Transaction.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/libethereum/Transaction.cpp b/test/libethereum/Transaction.cpp index c26d08a14..9229c85d3 100644 --- a/test/libethereum/Transaction.cpp +++ b/test/libethereum/Transaction.cpp @@ -52,8 +52,7 @@ BOOST_AUTO_TEST_CASE(TransactionConstructor) BOOST_ERROR("Exception thrown but expected OutOfGasIntrinsic instead"); } - if (!wasException) - BOOST_ERROR("Expected OutOfGasIntrinsic exception to be thrown at TransactionConstructor test"); + BOOST_CHECK_MESSAGE(wasException, "Expected OutOfGasIntrinsic exception to be thrown at TransactionConstructor test"); } BOOST_AUTO_TEST_CASE(ExecutionResultOutput) From c69efdee5a6a310ce27b4814105acbbcb69a5000 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 3 Aug 2015 13:06:33 +0300 Subject: [PATCH 7/8] cover1: ExtraData1024 Test Filler --- .../bcInvalidHeaderTestFiller.json | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/test/libethereum/BlockchainTestsFiller/bcInvalidHeaderTestFiller.json b/test/libethereum/BlockchainTestsFiller/bcInvalidHeaderTestFiller.json index 3084db0d7..098521b28 100644 --- a/test/libethereum/BlockchainTestsFiller/bcInvalidHeaderTestFiller.json +++ b/test/libethereum/BlockchainTestsFiller/bcInvalidHeaderTestFiller.json @@ -1120,5 +1120,64 @@ ] } ] + }, + + "ExtraData1024" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "3141592", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "5000000100" + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "extraData" : "0x01020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] } } From f95c844ccde584e98b8bcff85ae80daaf061297b Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 3 Aug 2015 23:33:52 +0300 Subject: [PATCH 8/8] Style --- test/libethereum/Transaction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/libethereum/Transaction.cpp b/test/libethereum/Transaction.cpp index 9229c85d3..fe220cfaf 100644 --- a/test/libethereum/Transaction.cpp +++ b/test/libethereum/Transaction.cpp @@ -43,11 +43,11 @@ BOOST_AUTO_TEST_CASE(TransactionConstructor) { Transaction(fromHex("0xf86d800182521c94095e7baea6a6c7c4c2dfeb977efac326af552d870a8e0358ac39584bc98a7c979f984b031ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"), CheckTransaction::Everything); } - catch(OutOfGasIntrinsic) + catch (OutOfGasIntrinsic) { wasException = true; } - catch(Exception) + catch (Exception) { BOOST_ERROR("Exception thrown but expected OutOfGasIntrinsic instead"); }