From f07089ffa390c02a81c1dd057329cd34797d5eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 25 Mar 2015 12:13:44 +0100 Subject: [PATCH 1/8] Test execution stats improvements --stats can have optional values: --stats=out prints all test timings to standard output, --stats= prints all test timings to a file in tab-separated format. Stats are now kept in vector to allow duplicated values. --- TestHelper.cpp | 19 ++++++++++++++++--- TestHelper.h | 4 +++- state.cpp | 5 +---- vm.cpp | 5 +---- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index b29c5dc3a..b3e64f47b 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -29,6 +29,7 @@ #include #include #include +#include "Stats.h" using namespace std; using namespace dev::eth; @@ -447,6 +448,9 @@ void executeTests(const string& _name, const string& _testPathAppendix, std::fun string testPath = getTestPath(); testPath += _testPathAppendix; + if (Options::get().stats) + Listener::registerListener(Stats::get()); + if (Options::get().fillTests) { try @@ -478,6 +482,7 @@ void executeTests(const string& _name, const string& _testPathAppendix, std::fun string s = asString(dev::contents(testPath + "/" + _name + ".json")); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + testPath + "/" + _name + ".json is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?"); json_spirit::read_string(s, v); + Listener::notifySuiteStarted(_name); doTests(v, false); } catch (Exception const& _e) @@ -551,10 +556,12 @@ Options::Options() vmtrace = true; else if (arg == "--filltests") fillTests = true; - else if (arg == "--stats") + else if (arg.compare(0, 7, "--stats") == 0) + { stats = true; - else if (arg == "--stats=full") - stats = statsFull = true; + if (arg.size() > 7) + statsOutFile = arg.substr(8); // skip '=' char + } else if (arg == "--performance") performance = true; else if (arg == "--quadratic") @@ -602,6 +609,12 @@ void Listener::registerListener(Listener& _listener) g_listener = &_listener; } +void Listener::notifySuiteStarted(std::string const& _name) +{ + if (g_listener) + g_listener->suiteStarted(_name); +} + void Listener::notifyTestStarted(std::string const& _name) { if (g_listener) diff --git a/TestHelper.h b/TestHelper.h index ade20f5e4..05e01792d 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -164,7 +164,7 @@ public: bool vmtrace = false; ///< Create EVM execution tracer // TODO: Link with log verbosity? bool fillTests = false; ///< Create JSON test files from execution results bool stats = false; ///< Execution time stats - bool statsFull = false; ///< Output full stats - execution times for every test + std::string statsOutFile; ///< Stats output file. "out" for standard output /// Test selection /// @{ @@ -191,10 +191,12 @@ class Listener public: virtual ~Listener() = default; + virtual void suiteStarted(std::string const&) {} virtual void testStarted(std::string const& _name) = 0; virtual void testFinished() = 0; static void registerListener(Listener& _listener); + static void notifySuiteStarted(std::string const& _name); static void notifyTestStarted(std::string const& _name); static void notifyTestFinished(); diff --git a/state.cpp b/state.cpp index 4ab59f7a1..8168693b1 100644 --- a/state.cpp +++ b/state.cpp @@ -31,7 +31,6 @@ #include #include #include "TestHelper.h" -#include "Stats.h" using namespace std; using namespace json_spirit; @@ -42,9 +41,6 @@ namespace dev { namespace test { void doStateTests(json_spirit::mValue& v, bool _fillin) { - if (Options::get().stats) - Listener::registerListener(Stats::get()); - for (auto& i: v.get_obj()) { std::cout << " " << i.first << "\n"; @@ -255,6 +251,7 @@ BOOST_AUTO_TEST_CASE(stRandom) string s = asString(dev::contents(path.string())); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + path.string() + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?"); json_spirit::read_string(s, v); + test::Listener::notifySuiteStarted(path.filename().string()); dev::test::doStateTests(v, false); } catch (Exception const& _e) diff --git a/vm.cpp b/vm.cpp index 2bdafb270..cffbaa64d 100644 --- a/vm.cpp +++ b/vm.cpp @@ -25,7 +25,6 @@ #include #include #include "vm.h" -#include "Stats.h" using namespace std; using namespace json_spirit; @@ -311,9 +310,6 @@ namespace dev { namespace test { void doVMTests(json_spirit::mValue& v, bool _fillin) { - if (Options::get().stats) - Listener::registerListener(Stats::get()); - for (auto& i: v.get_obj()) { std::cout << " " << i.first << "\n"; @@ -549,6 +545,7 @@ BOOST_AUTO_TEST_CASE(vmRandom) string s = asString(dev::contents(path.string())); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + path.string() + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?"); json_spirit::read_string(s, v); + test::Listener::notifySuiteStarted(path.filename().string()); doVMTests(v, false); } catch (Exception const& _e) From dfda38ae1bcb5c09f25867af84c5f8831ae2abae Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 31 Mar 2015 15:14:49 +0200 Subject: [PATCH 2/8] eth_protocolVersion --- webthreestubclient.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/webthreestubclient.h b/webthreestubclient.h index 4754bbbef..a460ddda4 100644 --- a/webthreestubclient.h +++ b/webthreestubclient.h @@ -62,6 +62,16 @@ class WebThreeStubClient : public jsonrpc::Client else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } + std::string eth_protocolVersion() throw (jsonrpc::JsonRpcException) + { + Json::Value p; + p = Json::nullValue; + Json::Value result = this->CallMethod("eth_protocolVersion",p); + if (result.isString()) + return result.asString(); + else + throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); + } std::string eth_coinbase() throw (jsonrpc::JsonRpcException) { Json::Value p; From c077a523dbadd3e4e3c9029ed6a9a38dc4fdb3c3 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 5 Apr 2015 14:47:39 +0200 Subject: [PATCH 3/8] New DAG file scheme. --- dagger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dagger.cpp b/dagger.cpp index 4dda9c4fc..4abba5090 100644 --- a/dagger.cpp +++ b/dagger.cpp @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(basic_test) unsigned cacheSize(o["cache_size"].get_int()); h256 cacheHash(o["cache_hash"].get_str()); BOOST_REQUIRE_EQUAL(Ethasher::get()->params(header).cache_size, cacheSize); - BOOST_REQUIRE_EQUAL(sha3(bytesConstRef((byte const*)Ethasher::get()->cache(header), cacheSize)), cacheHash); + BOOST_REQUIRE_EQUAL(sha3(bytesConstRef((byte const*)Ethasher::get()->light(header), cacheSize)), cacheHash); #if TEST_FULL unsigned fullSize(o["full_size"].get_int()); From 8afc2ab1e11b1b2af4b9642c1075b91e2768bb48 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 5 Apr 2015 16:33:51 +0200 Subject: [PATCH 4/8] Decent transaction import result provision. Give network a hint about what's going on for peer backoffs. Avoid sleeping in main loop when there's still work on. --- blockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockchain.cpp b/blockchain.cpp index ffb55da30..21345abfd 100644 --- a/blockchain.cpp +++ b/blockchain.cpp @@ -98,7 +98,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) { mObject tx = txObj.get_obj(); importer.importTransaction(tx); - if (!txs.attemptImport(importer.m_transaction.rlp())) + if (txs.import(importer.m_transaction.rlp()) != ImportResult::Success) cnote << "failed importing transaction\n"; } From 966407f28555d46bddfd76287198615ac1f5cc9b Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 5 Apr 2015 17:46:12 +0200 Subject: [PATCH 5/8] Allow Solidity build to be disabled. --- Assembly.cpp | 3 +++ CMakeLists.txt | 4 +++- SolidityABIJSON.cpp | 3 +++ SolidityCompiler.cpp | 3 +++ SolidityEndToEndTest.cpp | 4 +++- SolidityExpressionCompiler.cpp | 4 +++- SolidityInterface.cpp | 4 ++++ SolidityNameAndTypeResolution.cpp | 3 +++ SolidityNatspecJSON.cpp | 4 ++++ SolidityOptimizer.cpp | 5 ++++- SolidityParser.cpp | 3 +++ SolidityScanner.cpp | 4 ++++ SolidityTypes.cpp | 4 ++++ solidityExecutionFramework.h | 1 - 14 files changed, 44 insertions(+), 5 deletions(-) diff --git a/Assembly.cpp b/Assembly.cpp index fbc8e47b5..fab260a9d 100644 --- a/Assembly.cpp +++ b/Assembly.cpp @@ -20,6 +20,8 @@ * Unit tests for Assembly Items from evmcore/Assembly.h */ +#if ETH_SOLIDITY + #include #include #include @@ -119,3 +121,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/CMakeLists.txt b/CMakeLists.txt index 01681dbef..5bd44091d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,9 @@ target_link_libraries(testeth ${CURL_LIBRARIES}) target_link_libraries(testeth ethereum) target_link_libraries(testeth ethcore) target_link_libraries(testeth secp256k1) -target_link_libraries(testeth solidity) +if (SOLIDITY) + target_link_libraries(testeth solidity) +endif () target_link_libraries(testeth testutils) if (NOT HEADLESS AND NOT JUSTTESTS) target_link_libraries(testeth webthree) diff --git a/SolidityABIJSON.cpp b/SolidityABIJSON.cpp index f7f968ea8..bbe5fd8c4 100644 --- a/SolidityABIJSON.cpp +++ b/SolidityABIJSON.cpp @@ -19,6 +19,7 @@ * @date 2014 * Unit tests for the solidity compiler JSON Interface output. */ +#if ETH_SOLIDITY #include "TestHelper.h" #include @@ -500,3 +501,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } + +#endif diff --git a/SolidityCompiler.cpp b/SolidityCompiler.cpp index 1369b038f..bb16c88cd 100644 --- a/SolidityCompiler.cpp +++ b/SolidityCompiler.cpp @@ -20,6 +20,8 @@ * Unit tests for the solidity compiler. */ +#if ETH_SOLIDITY + #include #include #include @@ -192,3 +194,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index ea6ada603..b4da07892 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -1,4 +1,3 @@ - /* This file is part of cpp-ethereum. @@ -22,6 +21,8 @@ * Unit tests for the solidity expression compiler, testing the behaviour of the code. */ +#if ETH_SOLIDITY + #include #include #include @@ -3627,3 +3628,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/SolidityExpressionCompiler.cpp b/SolidityExpressionCompiler.cpp index 7034085ef..b748d887d 100644 --- a/SolidityExpressionCompiler.cpp +++ b/SolidityExpressionCompiler.cpp @@ -1,4 +1,3 @@ - /* This file is part of cpp-ethereum. @@ -21,6 +20,8 @@ * Unit tests for the solidity expression compiler. */ +#if ETH_SOLIDITY + #include #include @@ -491,3 +492,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/SolidityInterface.cpp b/SolidityInterface.cpp index 48e2fd7aa..c836f0fa7 100644 --- a/SolidityInterface.cpp +++ b/SolidityInterface.cpp @@ -20,6 +20,8 @@ * Unit tests for generating source interfaces for Solidity contracts. */ +#if ETH_SOLIDITY + #include "TestHelper.h" #include #include @@ -147,3 +149,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } + +#endif diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp index 531f3bc13..74a488883 100644 --- a/SolidityNameAndTypeResolution.cpp +++ b/SolidityNameAndTypeResolution.cpp @@ -20,6 +20,8 @@ * Unit tests for the name and type resolution of the solidity parser. */ +#if ETH_SOLIDITY + #include #include @@ -1627,3 +1629,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/SolidityNatspecJSON.cpp b/SolidityNatspecJSON.cpp index aeaad1966..28d657357 100644 --- a/SolidityNatspecJSON.cpp +++ b/SolidityNatspecJSON.cpp @@ -20,6 +20,8 @@ * Unit tests for the solidity compiler JSON Interface output. */ +#if ETH_SOLIDITY + #include "TestHelper.h" #include #include @@ -537,3 +539,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } + +#endif diff --git a/SolidityOptimizer.cpp b/SolidityOptimizer.cpp index e69d5120e..4fedd642d 100644 --- a/SolidityOptimizer.cpp +++ b/SolidityOptimizer.cpp @@ -1,4 +1,3 @@ - /* This file is part of cpp-ethereum. @@ -21,6 +20,8 @@ * Tests for the Solidity optimizer. */ +#if ETH_SOLIDITY + #include #include #include @@ -573,3 +574,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces + +#endif diff --git a/SolidityParser.cpp b/SolidityParser.cpp index 7640f91ad..b76f00656 100644 --- a/SolidityParser.cpp +++ b/SolidityParser.cpp @@ -20,6 +20,8 @@ * Unit tests for the solidity parser. */ +#if ETH_SOLIDITY + #include #include #include @@ -845,3 +847,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/SolidityScanner.cpp b/SolidityScanner.cpp index 8d3e53929..20b946ee0 100644 --- a/SolidityScanner.cpp +++ b/SolidityScanner.cpp @@ -20,6 +20,8 @@ * Unit tests for the solidity scanner. */ +#if ETH_SOLIDITY + #include #include @@ -286,3 +288,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces + +#endif diff --git a/SolidityTypes.cpp b/SolidityTypes.cpp index 6b6306479..da8b48303 100644 --- a/SolidityTypes.cpp +++ b/SolidityTypes.cpp @@ -20,6 +20,8 @@ * Unit tests for the type system of Solidity. */ +#if ETH_SOLIDITY + #include #include @@ -91,3 +93,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } + +#endif diff --git a/solidityExecutionFramework.h b/solidityExecutionFramework.h index 2451aa381..2134d424d 100644 --- a/solidityExecutionFramework.h +++ b/solidityExecutionFramework.h @@ -1,4 +1,3 @@ - /* This file is part of cpp-ethereum. From 0dc70c63a9009aa5ccf2da99893a426a1d6db6d5 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 5 Apr 2015 21:08:22 +0200 Subject: [PATCH 6/8] Move hash to a hidden function, and provide a datapath to it so avoid unneeded SHA3s. --- ClientBase.cpp | 18 +++++++++++++----- TestHelper.cpp | 7 +++++-- TestHelper.h | 2 +- blockchain.cpp | 6 +++--- stateOriginal.cpp | 2 +- vm.cpp | 4 ++-- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/ClientBase.cpp b/ClientBase.cpp index 304182cfc..7597b6612 100644 --- a/ClientBase.cpp +++ b/ClientBase.cpp @@ -120,11 +120,15 @@ BOOST_AUTO_TEST_CASE(blocks) ETH_CHECK_EQUAL(expectedBlockInfoBloom, _blockInfo.logBloom); ETH_CHECK_EQUAL(expectedBlockInfoCoinbase, _blockInfo.coinbaseAddress); ETH_CHECK_EQUAL(expectedBlockInfoDifficulty, _blockInfo.difficulty); - ETH_CHECK_EQUAL_COLLECTIONS(expectedBlockInfoExtraData.begin(), expectedBlockInfoExtraData.end(), - _blockInfo.extraData.begin(), _blockInfo.extraData.end()); + ETH_CHECK_EQUAL_COLLECTIONS( + expectedBlockInfoExtraData.begin(), + expectedBlockInfoExtraData.end(), + _blockInfo.extraData.begin(), + _blockInfo.extraData.end() + ); ETH_CHECK_EQUAL(expectedBlockInfoGasLimit, _blockInfo.gasLimit); ETH_CHECK_EQUAL(expectedBlockInfoGasUsed, _blockInfo.gasUsed); - ETH_CHECK_EQUAL(expectedBlockInfoHash, _blockInfo.hash); + ETH_CHECK_EQUAL(expectedBlockInfoHash, _blockInfo.hash()); ETH_CHECK_EQUAL(expectedBlockInfoMixHash, _blockInfo.mixHash); ETH_CHECK_EQUAL(expectedBlockInfoNonce, _blockInfo.nonce); ETH_CHECK_EQUAL(expectedBlockInfoNumber, _blockInfo.number); @@ -155,8 +159,12 @@ BOOST_AUTO_TEST_CASE(blocks) u256 expectedTransactionSignatureS = h256(fromHex(_t["s"].asString())); // unsigned expectedTransactionSignatureV = jsToInt(t["v"].asString()); - ETH_CHECK_EQUAL_COLLECTIONS(expectedTransactionData.begin(), expectedTransactionData.end(), - _transaction.data().begin(), _transaction.data().end()); + ETH_CHECK_EQUAL_COLLECTIONS( + expectedTransactionData.begin(), + expectedTransactionData.end(), + _transaction.data().begin(), + _transaction.data().end() + ); ETH_CHECK_EQUAL(expectedTransactionGasLimit, _transaction.gas()); ETH_CHECK_EQUAL(expectedTransactionGasPrice, _transaction.gasPrice()); ETH_CHECK_EQUAL(expectedTransactionNonce, _transaction.nonce()); diff --git a/TestHelper.cpp b/TestHelper.cpp index 295b759f3..140efdb99 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -70,7 +70,10 @@ namespace test struct ValueTooLarge: virtual Exception {}; bigint const c_max256plus1 = bigint(1) << 256; -ImportTest::ImportTest(json_spirit::mObject& _o, bool isFiller) : m_statePre(Address(_o["env"].get_obj()["currentCoinbase"].get_str()), OverlayDB(), eth::BaseState::Empty), m_statePost(Address(_o["env"].get_obj()["currentCoinbase"].get_str()), OverlayDB(), eth::BaseState::Empty), m_TestObject(_o) +ImportTest::ImportTest(json_spirit::mObject& _o, bool isFiller): + m_statePre(OverlayDB(), eth::BaseState::Empty, Address(_o["env"].get_obj()["currentCoinbase"].get_str())), + m_statePost(OverlayDB(), eth::BaseState::Empty, Address(_o["env"].get_obj()["currentCoinbase"].get_str())), + m_TestObject(_o) { importEnv(_o["env"].get_obj()); importState(_o["pre"].get_obj(), m_statePre); @@ -92,7 +95,7 @@ void ImportTest::importEnv(json_spirit::mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - m_environment.previousBlock.hash = h256(_o["previousHash"].get_str()); + m_environment.currentBlock.parentHash = h256(_o["parentHash"].get_str()); m_environment.currentBlock.number = toInt(_o["currentNumber"]); m_environment.currentBlock.gasLimit = toInt(_o["currentGasLimit"]); m_environment.currentBlock.difficulty = toInt(_o["currentDifficulty"]); diff --git a/TestHelper.h b/TestHelper.h index e5f96f51d..7f6d73365 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -101,7 +101,7 @@ namespace test class ImportTest { public: - ImportTest(json_spirit::mObject& _o) : m_statePre(Address(), OverlayDB(), eth::BaseState::Empty), m_statePost(Address(), OverlayDB(), eth::BaseState::Empty), m_TestObject(_o) {} + ImportTest(json_spirit::mObject& _o): m_TestObject(_o) {} ImportTest(json_spirit::mObject& _o, bool isFiller); // imports void importEnv(json_spirit::mObject& _o); diff --git a/blockchain.cpp b/blockchain.cpp index 21345abfd..50c17bdee 100644 --- a/blockchain.cpp +++ b/blockchain.cpp @@ -52,7 +52,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) BOOST_REQUIRE(o.count("pre")); ImportTest importer(o["pre"].get_obj()); - State state(biGenesisBlock.coinbaseAddress, OverlayDB(), BaseState::Empty); + State state(OverlayDB(), BaseState::Empty, biGenesisBlock.coinbaseAddress); importer.importState(o["pre"].get_obj(), state); o["pre"] = fillJsonWithState(state); state.commit(); @@ -599,7 +599,7 @@ void updatePoW(BlockInfo& _bi) ret = pow.mine(_bi, 10000, true, true); Ethash::assignResult(ret.second, _bi); } - _bi.hash = _bi.headerHash(WithNonce); + _bi.noteDirty(); } void writeBlockHeaderToJson(mObject& _o, BlockInfo const& _bi) @@ -619,7 +619,7 @@ void writeBlockHeaderToJson(mObject& _o, BlockInfo const& _bi) _o["extraData"] ="0x" + toHex(_bi.extraData); _o["mixHash"] = toString(_bi.mixHash); _o["nonce"] = toString(_bi.nonce); - _o["hash"] = toString(_bi.hash); + _o["hash"] = toString(_bi.hash()); } RLPStream createFullBlockFromHeader(BlockInfo const& _bi, bytes const& _txs, bytes const& _uncles) diff --git a/stateOriginal.cpp b/stateOriginal.cpp index 384d85344..572e84dcf 100644 --- a/stateOriginal.cpp +++ b/stateOriginal.cpp @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(Complex) CanonBlockChain bc; cout << bc; - State s(myMiner.address(), stateDB); + State s(stateDB, BaseState::Empty, myMiner.address()); cout << s; // Sync up - this won't do much until we use the last state. diff --git a/vm.cpp b/vm.cpp index cffbaa64d..ff8903523 100644 --- a/vm.cpp +++ b/vm.cpp @@ -96,7 +96,7 @@ void FakeExtVM::push(mArray& a, u256 _v) mObject FakeExtVM::exportEnv() { mObject ret; - ret["previousHash"] = toString(previousBlock.hash); + ret["previousHash"] = toString(currentBlock.parentHash); push(ret, "currentDifficulty", currentBlock.difficulty); push(ret, "currentTimestamp", currentBlock.timestamp); ret["currentCoinbase"] = toString(currentBlock.coinbaseAddress); @@ -115,7 +115,7 @@ void FakeExtVM::importEnv(mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - previousBlock.hash = h256(_o["previousHash"].get_str()); + currentBlock.parentHash = h256(_o["previousHash"].get_str()); currentBlock.number = toInt(_o["currentNumber"]); lastHashes = test::lastHashes(currentBlock.number); currentBlock.gasLimit = toInt(_o["currentGasLimit"]); From a2507495052d39ef4ddfc6fc256b29e063a81eb6 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 5 Apr 2015 22:13:24 +0200 Subject: [PATCH 7/8] Typo "fix" fixed. --- TestHelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 140efdb99..dd7c09eab 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -95,7 +95,7 @@ void ImportTest::importEnv(json_spirit::mObject& _o) assert(_o.count("currentCoinbase") > 0); assert(_o.count("currentNumber") > 0); - m_environment.currentBlock.parentHash = h256(_o["parentHash"].get_str()); + m_environment.currentBlock.parentHash = h256(_o["previousHash"].get_str()); m_environment.currentBlock.number = toInt(_o["currentNumber"]); m_environment.currentBlock.gasLimit = toInt(_o["currentGasLimit"]); m_environment.currentBlock.difficulty = toInt(_o["currentDifficulty"]); From ac32ee3ec7f960f80442b00e55455661fa94572d Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 6 Apr 2015 02:30:50 +0200 Subject: [PATCH 8/8] Nicer build options. --- CMakeLists.txt | 2 +- natspec.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bd44091d..90af5122e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ if (SOLIDITY) target_link_libraries(testeth solidity) endif () target_link_libraries(testeth testutils) -if (NOT HEADLESS AND NOT JUSTTESTS) +if (GUI AND NOT JUSTTESTS) target_link_libraries(testeth webthree) target_link_libraries(testeth natspec) endif() diff --git a/natspec.cpp b/natspec.cpp index cdcedca46..56478f93e 100644 --- a/natspec.cpp +++ b/natspec.cpp @@ -19,7 +19,7 @@ * @date 2015 */ -#if !ETH_HEADLESS +#if ETH_GUI #include #include