diff options
author | subtly <subtly@users.noreply.github.com> | 2015-04-06 04:42:51 +0800 |
---|---|---|
committer | subtly <subtly@users.noreply.github.com> | 2015-04-06 04:42:51 +0800 |
commit | 052fa7d877a589dd32921e4ac8aadb45d94f1185 (patch) | |
tree | e21a5bea1944d9606599fe09a4ed4e647073d0de | |
parent | 4597ae7260752ac4bddfe7eb0737088d4fcb3ed7 (diff) | |
parent | a2507495052d39ef4ddfc6fc256b29e063a81eb6 (diff) | |
download | dexon-solidity-052fa7d877a589dd32921e4ac8aadb45d94f1185.tar dexon-solidity-052fa7d877a589dd32921e4ac8aadb45d94f1185.tar.gz dexon-solidity-052fa7d877a589dd32921e4ac8aadb45d94f1185.tar.bz2 dexon-solidity-052fa7d877a589dd32921e4ac8aadb45d94f1185.tar.lz dexon-solidity-052fa7d877a589dd32921e4ac8aadb45d94f1185.tar.xz dexon-solidity-052fa7d877a589dd32921e4ac8aadb45d94f1185.tar.zst dexon-solidity-052fa7d877a589dd32921e4ac8aadb45d94f1185.zip |
Merge branch 'develop' into whisper
-rw-r--r-- | Assembly.cpp | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | ClientBase.cpp | 18 | ||||
-rw-r--r-- | SolidityABIJSON.cpp | 3 | ||||
-rw-r--r-- | SolidityCompiler.cpp | 3 | ||||
-rw-r--r-- | SolidityEndToEndTest.cpp | 4 | ||||
-rw-r--r-- | SolidityExpressionCompiler.cpp | 4 | ||||
-rw-r--r-- | SolidityInterface.cpp | 4 | ||||
-rw-r--r-- | SolidityNameAndTypeResolution.cpp | 3 | ||||
-rw-r--r-- | SolidityNatspecJSON.cpp | 4 | ||||
-rw-r--r-- | SolidityOptimizer.cpp | 5 | ||||
-rw-r--r-- | SolidityParser.cpp | 3 | ||||
-rw-r--r-- | SolidityScanner.cpp | 4 | ||||
-rw-r--r-- | SolidityTypes.cpp | 4 | ||||
-rw-r--r-- | TestHelper.cpp | 7 | ||||
-rw-r--r-- | TestHelper.h | 2 | ||||
-rw-r--r-- | blockchain.cpp | 8 | ||||
-rw-r--r-- | dagger.cpp | 2 | ||||
-rw-r--r-- | solidityExecutionFramework.h | 1 | ||||
-rw-r--r-- | stateOriginal.cpp | 2 | ||||
-rw-r--r-- | vm.cpp | 4 |
21 files changed, 71 insertions, 21 deletions
diff --git a/Assembly.cpp b/Assembly.cpp index fbc8e47b..fab260a9 100644 --- a/Assembly.cpp +++ b/Assembly.cpp @@ -20,6 +20,8 @@ * Unit tests for Assembly Items from evmcore/Assembly.h */ +#if ETH_SOLIDITY + #include <string> #include <iostream> #include <boost/test/unit_test.hpp> @@ -119,3 +121,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/CMakeLists.txt b/CMakeLists.txt index 01681dbe..5bd44091 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/ClientBase.cpp b/ClientBase.cpp index 304182cf..7597b661 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/SolidityABIJSON.cpp b/SolidityABIJSON.cpp index f7f968ea..bbe5fd8c 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 <libsolidity/CompilerStack.h> @@ -500,3 +501,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } + +#endif diff --git a/SolidityCompiler.cpp b/SolidityCompiler.cpp index 1369b038..bb16c88c 100644 --- a/SolidityCompiler.cpp +++ b/SolidityCompiler.cpp @@ -20,6 +20,8 @@ * Unit tests for the solidity compiler. */ +#if ETH_SOLIDITY + #include <string> #include <iostream> #include <boost/test/unit_test.hpp> @@ -192,3 +194,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index ea6ada60..b4da0789 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 <string> #include <tuple> #include <boost/test/unit_test.hpp> @@ -3627,3 +3628,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/SolidityExpressionCompiler.cpp b/SolidityExpressionCompiler.cpp index 7034085e..b748d887 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 <string> #include <libdevcore/Log.h> @@ -491,3 +492,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/SolidityInterface.cpp b/SolidityInterface.cpp index 48e2fd7a..c836f0fa 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 <libsolidity/CompilerStack.h> #include <libsolidity/AST.h> @@ -147,3 +149,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } + +#endif diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp index 531f3bc1..74a48888 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 <string> #include <libdevcore/Log.h> @@ -1627,3 +1629,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/SolidityNatspecJSON.cpp b/SolidityNatspecJSON.cpp index aeaad196..28d65735 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 <json/json.h> #include <libsolidity/CompilerStack.h> @@ -537,3 +539,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } + +#endif diff --git a/SolidityOptimizer.cpp b/SolidityOptimizer.cpp index e69d5120..4fedd642 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 <string> #include <tuple> #include <boost/test/unit_test.hpp> @@ -573,3 +574,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces + +#endif diff --git a/SolidityParser.cpp b/SolidityParser.cpp index 7640f91a..b76f0065 100644 --- a/SolidityParser.cpp +++ b/SolidityParser.cpp @@ -20,6 +20,8 @@ * Unit tests for the solidity parser. */ +#if ETH_SOLIDITY + #include <string> #include <memory> #include <libdevcore/Log.h> @@ -845,3 +847,4 @@ BOOST_AUTO_TEST_SUITE_END() } } // end namespaces +#endif diff --git a/SolidityScanner.cpp b/SolidityScanner.cpp index 8d3e5392..20b946ee 100644 --- a/SolidityScanner.cpp +++ b/SolidityScanner.cpp @@ -20,6 +20,8 @@ * Unit tests for the solidity scanner. */ +#if ETH_SOLIDITY + #include <libsolidity/Scanner.h> #include <boost/test/unit_test.hpp> @@ -286,3 +288,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } // end namespaces + +#endif diff --git a/SolidityTypes.cpp b/SolidityTypes.cpp index 6b630647..da8b4830 100644 --- a/SolidityTypes.cpp +++ b/SolidityTypes.cpp @@ -20,6 +20,8 @@ * Unit tests for the type system of Solidity. */ +#if ETH_SOLIDITY + #include <libsolidity/Types.h> #include <boost/test/unit_test.hpp> @@ -91,3 +93,5 @@ BOOST_AUTO_TEST_SUITE_END() } } } + +#endif diff --git a/TestHelper.cpp b/TestHelper.cpp index 295b759f..dd7c09ea 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["previousHash"].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 e5f96f51..7f6d7336 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 ffb55da3..50c17bde 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(); @@ -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"; } @@ -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) @@ -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()); diff --git a/solidityExecutionFramework.h b/solidityExecutionFramework.h index 2451aa38..2134d424 100644 --- a/solidityExecutionFramework.h +++ b/solidityExecutionFramework.h @@ -1,4 +1,3 @@ - /* This file is part of cpp-ethereum. diff --git a/stateOriginal.cpp b/stateOriginal.cpp index 384d8534..572e84dc 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. @@ -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"]); |