From 3822aef60811594193ec261972984abbcae17484 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 6 Jul 2014 13:13:37 +0200 Subject: [PATCH] Build fixes. --- CMakeLists.txt | 4 ++-- alethzero/CMakeLists.txt | 22 +++++++++++----------- eth/CMakeLists.txt | 2 +- exp/CMakeLists.txt | 2 +- libethcore/CMakeLists.txt | 2 +- libethential/CMakeLists.txt | 2 +- libethereum/CMakeLists.txt | 2 +- libethereum/State.cpp | 21 +++++++++++---------- libethereum/State.h | 2 +- libevm/CMakeLists.txt | 2 +- libevmface/CMakeLists.txt | 2 +- liblll/CMakeLists.txt | 2 +- libpyserpent/CMakeLists.txt | 2 +- libqethereum/CMakeLists.txt | 6 +++--- libserpent/CMakeLists.txt | 2 +- lllc/CMakeLists.txt | 2 +- neth/CMakeLists.txt | 2 +- sc/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- walleth/CMakeLists.txt | 6 +++--- 20 files changed, 45 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cbe2e447a..36cf74ed2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,7 @@ else () message(FATAL_ERROR "Your C++ compiler does not support C++11.") endif () -if(${TARGET_PLATFORM} STREQUAL "w64") +if("${TARGET_PLATFORM}" STREQUAL "w64") # set(MINIUPNPC_LS /usr/x86_64-w64-mingw32/lib/libminiupnpc.a) set(LEVELDB_LS leveldb) set(CRYPTOPP_LS cryptopp) @@ -124,7 +124,7 @@ else() find_path(CRYPTOPP_ID cryptlib.h ../cryptopp/src ../../cryptopp/src) - if(NOT ${CRYPTOPP_ID} STREQUAL "CRYPTOPP_ID-NOTFOUND") + if(NOT "${CRYPTOPP_ID}" STREQUAL "CRYPTOPP_ID-NOTFOUND") message("Local cryptopp OK.") set(CRYPTOPP_LS ${CRYPTOPP_ID}/../target/build/release/libcryptopp.so) else() diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index 620f443bd..85346bccd 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -17,7 +17,7 @@ if (APPLE) set(CMAKE_PREFIX_PATH /usr/local/opt/qt5) include_directories(/usr/local/opt/qt5/include /usr/local/include) -elseif (${TARGET_PLATFORM} STREQUAL "w64") +elseif ("${TARGET_PLATFORM}" STREQUAL "w64") set(SRC_LIST ${SRC_LIST} ../windows/qt_plugin_import.cpp) include_directories(/usr/x86_64-w64-mingw32/include /usr/x86_64-w64-mingw32/include/QtCore /usr/x86_64-w64-mingw32/include/QtGui /usr/x86_64-w64-mingw32/include/QtQuick /usr/x86_64-w64-mingw32/include/QtQml /usr/x86_64-w64-mingw32/include/QtNetwork /usr/x86_64-w64-mingw32/include/QtWidgets /usr/x86_64-w64-mingw32/include/QtWebKit /usr/x86_64-w64-mingw32/include/QtWebKitWidgets) elseif (UNIX) @@ -25,14 +25,14 @@ elseif (UNIX) endif () -#find_package(Qt5Core REQUIRED) -#find_package(Qt5Gui REQUIRED) -#find_package(Qt5Quick REQUIRED) -#find_package(Qt5Qml REQUIRED) -#find_package(Qt5Network REQUIRED) +find_package(Qt5Core REQUIRED) +find_package(Qt5Gui REQUIRED) +find_package(Qt5Quick REQUIRED) +find_package(Qt5Qml REQUIRED) +find_package(Qt5Network REQUIRED) find_package(Qt5Widgets REQUIRED) -#find_package(Qt5WebKit REQUIRED) -#find_package(Qt5WebKitWidgets REQUIRED) +find_package(Qt5WebKit REQUIRED) +find_package(Qt5WebKitWidgets REQUIRED) qt5_wrap_ui(ui_Main.h Main.ui) # Set name of binary and add_executable() @@ -58,7 +58,7 @@ else () add_executable(${EXECUTEABLE} Main.ui ${SRC_LIST}) endif () -#qt5_use_modules(${EXECUTEABLE} Core)# Gui Widgets Network WebKit WebKitWidgets) +qt5_use_modules(${EXECUTEABLE} Core)# Gui Widgets Network WebKit WebKitWidgets) target_link_libraries(${EXECUTEABLE} qethereum ethereum evm ethcore secp256k1 gmp ${CRYPTOPP_LS} serpent lll evmface ethential) if (APPLE) @@ -70,7 +70,7 @@ if (APPLE) # will not be set but defaults to release. set(generator_lowercase "${CMAKE_GENERATOR}") string(TOLOWER "${CMAKE_GENERATOR}" generator_lowercase) - if (generator_lowercase STREQUAL "xcode") + if ("${generator_lowercase}" STREQUAL "xcode") # TODO: Not sure how to resolve this. Possibly \${TARGET_BUILD_DIR} set(binary_build_dir "${CMAKE_CURRENT_BINARY_DIR}/Debug") else () @@ -92,7 +92,7 @@ if (APPLE) DEPENDS ${PROJECT_NAME} ) -elseif (${TARGET_PLATFORM} STREQUAL "w64") +elseif ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-keep-inline-dllexport -static-libgcc -static-libstdc++ -static") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-s -Wl,-subsystem,windows -mthreads -L/usr/x86_64-w64-mingw32/plugins/platforms") target_link_libraries(${EXECUTEABLE} gcc) diff --git a/eth/CMakeLists.txt b/eth/CMakeLists.txt index 350c22f80..93946aa8f 100644 --- a/eth/CMakeLists.txt +++ b/eth/CMakeLists.txt @@ -25,7 +25,7 @@ if(READLINE_LS) target_link_libraries(${EXECUTABLE} ${READLINE_LS}) endif() -if (${TARGET_PLATFORM} STREQUAL "w64") +if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") target_link_libraries(${EXECUTABLE} boost_system-mt-s) target_link_libraries(${EXECUTABLE} boost_filesystem-mt-s) diff --git a/exp/CMakeLists.txt b/exp/CMakeLists.txt index 45a30adbc..5b76b4c7a 100644 --- a/exp/CMakeLists.txt +++ b/exp/CMakeLists.txt @@ -16,7 +16,7 @@ target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LS}) endif() target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) -if (${TARGET_PLATFORM} STREQUAL "w64") +if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") target_link_libraries(${EXECUTABLE} gcc) target_link_libraries(${EXECUTABLE} gdi32) diff --git a/libethcore/CMakeLists.txt b/libethcore/CMakeLists.txt index 414201614..01171a613 100644 --- a/libethcore/CMakeLists.txt +++ b/libethcore/CMakeLists.txt @@ -24,7 +24,7 @@ endif() target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS}) -if(${TARGET_PLATFORM} STREQUAL "w64") +if("${TARGET_PLATFORM}" STREQUAL "w64") target_link_libraries(${EXECUTABLE} boost_system-mt-s) target_link_libraries(${EXECUTABLE} boost_filesystem-mt-s) target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) diff --git a/libethential/CMakeLists.txt b/libethential/CMakeLists.txt index 11d7ab4a0..08db75f3e 100644 --- a/libethential/CMakeLists.txt +++ b/libethential/CMakeLists.txt @@ -22,7 +22,7 @@ include_directories(..) target_link_libraries(${EXECUTABLE} ethential) -if(${TARGET_PLATFORM} STREQUAL "w64") +if("${TARGET_PLATFORM}" STREQUAL "w64") include_directories(/usr/x86_64-w64-mingw32/include/cryptopp) target_link_libraries(${EXECUTABLE} boost_system-mt-s) target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) diff --git a/libethereum/CMakeLists.txt b/libethereum/CMakeLists.txt index 9b0a507aa..abdd44b46 100644 --- a/libethereum/CMakeLists.txt +++ b/libethereum/CMakeLists.txt @@ -28,7 +28,7 @@ target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS}) target_link_libraries(${EXECUTABLE} gmp) -if(${TARGET_PLATFORM} STREQUAL "w64") +if("${TARGET_PLATFORM}" STREQUAL "w64") target_link_libraries(${EXECUTABLE} boost_system-mt-s) target_link_libraries(${EXECUTABLE} boost_filesystem-mt-s) target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) diff --git a/libethereum/State.cpp b/libethereum/State.cpp index 301319c6d..90c9cd7d6 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -362,9 +362,7 @@ bool State::sync(BlockChain const& _bc, h256 _block, BlockInfo const& _bi) for (auto it = chain.rbegin(); it != chain.rend(); ++it) { auto b = _bc.block(*it); - m_currentBlock.populate(b); - m_currentBlock.verifyInternals(b); - enact(b, BlockInfo()); + enact(b); cleanup(true); } } @@ -391,7 +389,6 @@ u256 State::enactOn(bytesConstRef _block, BlockInfo const& _bi, BlockChain const biGrandParent.populate(_bc.block(biParent.parentHash)); sync(_bc, _bi.parentHash); resetCurrent(); - m_currentBlock = _bi; m_previousBlock = biParent; return enact(_block, biGrandParent); } @@ -507,11 +504,11 @@ bool State::sync(TransactionQueue& _tq, bool* _changed) return ret; } -u256 State::enact(bytesConstRef _block, BlockInfo const& _grandParent) +u256 State::enact(bytesConstRef _block, BlockInfo const& _grandParent, bool _checkNonce) { // m_currentBlock is assumed to be prepopulated and reset. -#if !RELEASE +#if !ETH_RELEASE BlockInfo bi(_block); assert(m_previousBlock.hash == bi.parentHash); assert(m_currentBlock.parentHash == bi.parentHash); @@ -521,6 +518,10 @@ u256 State::enact(bytesConstRef _block, BlockInfo const& _grandParent) if (m_currentBlock.parentHash != m_previousBlock.hash) throw InvalidParentHash(); + // Populate m_currentBlock with the correct values. + m_currentBlock.populate(_block, _checkNonce); + m_currentBlock.verifyInternals(_block); + // cnote << "playback begins:" << m_state.root(); // cnote << m_state; @@ -540,7 +541,7 @@ u256 State::enact(bytesConstRef _block, BlockInfo const& _grandParent) // Invalid state root cnote << m_state.root() << "\n" << m_state; cnote << *this; - cnote << "INVALID: " << hex << tr[1].toInt(); + cnote << "INVALID: " << tr[1].toHash(); throw InvalidTransactionStateRoot(); } if (tr[2].toInt() != gasUsed()) @@ -653,9 +654,9 @@ bool State::amIJustParanoid(BlockChain const& _bc) try { cnote << "PARANOIA root:" << s.rootHash(); - s.m_currentBlock.populate(&block.out(), false); // don't check nonce for this since we haven't mined it yet. - s.m_currentBlock.verifyInternals(&block.out()); - s.enact(&block.out(), BlockInfo()); +// s.m_currentBlock.populate(&block.out(), false); +// s.m_currentBlock.verifyInternals(&block.out()); + s.enact(&block.out(), BlockInfo(), false); // don't check nonce for this since we haven't mined it yet. s.cleanup(false); return true; } diff --git a/libethereum/State.h b/libethereum/State.h index 0aff4d879..50edb46e2 100644 --- a/libethereum/State.h +++ b/libethereum/State.h @@ -283,7 +283,7 @@ private: /// Execute the given block, assuming it corresponds to m_currentBlock. If _grandParent is passed, it will be used to check the uncles. /// Throws on failure. - u256 enact(bytesConstRef _block, BlockInfo const& _grandParent = BlockInfo()); + u256 enact(bytesConstRef _block, BlockInfo const& _grandParent = BlockInfo(), bool _checkNonce = true); // Two priviledged entry points for transaction processing used by the VM (these don't get added to the Transaction lists): // We assume all instrinsic fees are paid up before this point. diff --git a/libevm/CMakeLists.txt b/libevm/CMakeLists.txt index b994204b1..6b0f64f90 100644 --- a/libevm/CMakeLists.txt +++ b/libevm/CMakeLists.txt @@ -28,7 +28,7 @@ endif() target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS}) -if(${TARGET_PLATFORM} STREQUAL "w64") +if("${TARGET_PLATFORM}" STREQUAL "w64") target_link_libraries(${EXECUTABLE} boost_system-mt-s) target_link_libraries(${EXECUTABLE} boost_filesystem-mt-s) target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) diff --git a/libevmface/CMakeLists.txt b/libevmface/CMakeLists.txt index c4442a64f..00e9a4ee0 100644 --- a/libevmface/CMakeLists.txt +++ b/libevmface/CMakeLists.txt @@ -19,7 +19,7 @@ include_directories(..) target_link_libraries(${EXECUTABLE} ethential) -if(${TARGET_PLATFORM} STREQUAL "w64") +if("${TARGET_PLATFORM}" STREQUAL "w64") target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) target_link_libraries(${EXECUTABLE} iphlpapi) target_link_libraries(${EXECUTABLE} ws2_32) diff --git a/liblll/CMakeLists.txt b/liblll/CMakeLists.txt index 99d6d980f..b220d8e91 100644 --- a/liblll/CMakeLists.txt +++ b/liblll/CMakeLists.txt @@ -21,7 +21,7 @@ target_link_libraries(${EXECUTABLE} evmface) target_link_libraries(${EXECUTABLE} ethential) -if(${TARGET_PLATFORM} STREQUAL "w64") +if("${TARGET_PLATFORM}" STREQUAL "w64") target_link_libraries(${EXECUTABLE} boost_system-mt-s) target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) target_link_libraries(${EXECUTABLE} iphlpapi) diff --git a/libpyserpent/CMakeLists.txt b/libpyserpent/CMakeLists.txt index 6b1681dc5..98c2650fb 100644 --- a/libpyserpent/CMakeLists.txt +++ b/libpyserpent/CMakeLists.txt @@ -20,7 +20,7 @@ target_link_libraries(${EXECUTABLE} evmface) target_link_libraries(${EXECUTABLE} ethential) target_link_libraries(${EXECUTABLE} ${PYTHON_LS}) -if(${TARGET_PLATFORM} STREQUAL "w64") +if("${TARGET_PLATFORM}" STREQUAL "w64") target_link_libraries(${EXECUTABLE} boost_python_win32-mt-s) target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) target_link_libraries(${EXECUTABLE} iphlpapi) diff --git a/libqethereum/CMakeLists.txt b/libqethereum/CMakeLists.txt index ecd63258e..51d602f94 100644 --- a/libqethereum/CMakeLists.txt +++ b/libqethereum/CMakeLists.txt @@ -18,7 +18,7 @@ if (APPLE) set(CMAKE_PREFIX_PATH /usr/local/opt/qt5) include_directories(/usr/local/opt/qt5/include /usr/local/include) -elseif (${TARGET_PLATFORM} STREQUAL "w64") +elseif ("${TARGET_PLATFORM}" STREQUAL "w64") set(SRC_LIST ${SRC_LIST} ../windows/qt_plugin_import.cpp) elseif (UNIX) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ";$ENV{QTDIR}/lib/cmake") @@ -72,7 +72,7 @@ if (APPLE) # will not be set but defaults to release. set(generator_lowercase "${CMAKE_GENERATOR}") string(TOLOWER "${CMAKE_GENERATOR}" generator_lowercase) - if (generator_lowercase STREQUAL "xcode") + if ("${generator_lowercase}" STREQUAL "xcode") # TODO: Not sure how to resolve this. Possibly \${TARGET_BUILD_DIR} set(binary_build_dir "${CMAKE_CURRENT_BINARY_DIR}/Debug") else () @@ -96,7 +96,7 @@ if (APPLE) ) endif () -elseif (${TARGET_PLATFORM} STREQUAL "w64") +elseif ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-keep-inline-dllexport -static-libgcc -static-libstdc++ -static") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-s -Wl,-subsystem,windows -mthreads -L/usr/x86_64-w64-mingw32/plugins/platforms") target_link_libraries(${EXECUTABLE} gcc) diff --git a/libserpent/CMakeLists.txt b/libserpent/CMakeLists.txt index 17b54ab09..3f8aea172 100644 --- a/libserpent/CMakeLists.txt +++ b/libserpent/CMakeLists.txt @@ -21,7 +21,7 @@ target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmface) target_link_libraries(${EXECUTABLE} ethential) -if(${TARGET_PLATFORM} STREQUAL "w64") +if("${TARGET_PLATFORM}" STREQUAL "w64") target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) target_link_libraries(${EXECUTABLE} iphlpapi) target_link_libraries(${EXECUTABLE} ws2_32) diff --git a/lllc/CMakeLists.txt b/lllc/CMakeLists.txt index 49e717072..97eaea7ac 100644 --- a/lllc/CMakeLists.txt +++ b/lllc/CMakeLists.txt @@ -12,7 +12,7 @@ target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmface) target_link_libraries(${EXECUTABLE} ethential) -if (${TARGET_PLATFORM} STREQUAL "w64") +if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") target_link_libraries(${EXECUTABLE} gcc) target_link_libraries(${EXECUTABLE} gdi32) diff --git a/neth/CMakeLists.txt b/neth/CMakeLists.txt index c28620a36..3e8dab70d 100644 --- a/neth/CMakeLists.txt +++ b/neth/CMakeLists.txt @@ -23,7 +23,7 @@ if(JSONRPC_LS) target_link_libraries(${EXECUTABLE} ${JSONRPC_LS}) endif() -if (${TARGET_PLATFORM} STREQUAL "w64") +if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") target_link_libraries(${EXECUTABLE} gcc) target_link_libraries(${EXECUTABLE} gdi32) diff --git a/sc/CMakeLists.txt b/sc/CMakeLists.txt index e379a1936..20a8c23f3 100644 --- a/sc/CMakeLists.txt +++ b/sc/CMakeLists.txt @@ -13,7 +13,7 @@ target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmface) target_link_libraries(${EXECUTABLE} ethential) -if (${TARGET_PLATFORM} STREQUAL "w64") +if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") target_link_libraries(${EXECUTABLE} gcc) target_link_libraries(${EXECUTABLE} gdi32) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9d45db8c9..6936addb3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,7 +14,7 @@ target_link_libraries(testeth secp256k1) target_link_libraries(testeth gmp) target_link_libraries(testeth ${CRYPTOPP_LS}) -if (${TARGET_PLATFORM} STREQUAL "w64") +if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") target_link_libraries(testeth boost_system-mt-s) target_link_libraries(testeth boost_filesystem-mt-s) diff --git a/walleth/CMakeLists.txt b/walleth/CMakeLists.txt index 3b393587b..cac73a726 100644 --- a/walleth/CMakeLists.txt +++ b/walleth/CMakeLists.txt @@ -20,7 +20,7 @@ if (APPLE) set(CMAKE_PREFIX_PATH /usr/local/opt/qt5) include_directories(/usr/local/opt/qt5/include /usr/local/include) -elseif (${TARGET_PLATFORM} STREQUAL "w64") +elseif ("${TARGET_PLATFORM}" STREQUAL "w64") set(SRC_LIST ${SRC_LIST} ../windows/qt_plugin_import.cpp) elseif (UNIX) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ";$ENV{QTDIR}/lib/cmake") @@ -72,7 +72,7 @@ if (APPLE) # will not be set but defaults to release. set(generator_lowercase "${CMAKE_GENERATOR}") string(TOLOWER "${CMAKE_GENERATOR}" generator_lowercase) - if (generator_lowercase STREQUAL "xcode") + if ("${generator_lowercase}" STREQUAL "xcode") # TODO: Not sure how to resolve this. Possibly \${TARGET_BUILD_DIR} set(binary_build_dir "${CMAKE_CURRENT_BINARY_DIR}/Debug") else () @@ -96,7 +96,7 @@ if (APPLE) ) endif () -elseif (${TARGET_PLATFORM} STREQUAL "w64") +elseif ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-keep-inline-dllexport -static-libgcc -static-libstdc++ -static") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-s -Wl,-subsystem,windows -mthreads -L/usr/x86_64-w64-mingw32/plugins/platforms") target_link_libraries(${EXECUTEABLE} gcc)