diff --git a/cmake/UseDev.cmake b/cmake/UseDev.cmake index 1f4c9a2dd..4461a8a0d 100644 --- a/cmake/UseDev.cmake +++ b/cmake/UseDev.cmake @@ -22,9 +22,9 @@ function(eth_apply TARGET REQUIRED SUBMODULE) endif() - if (${SUBMODULE} STREQUAL "devcore") + if (${SUBMODULE} STREQUAL "soldevcore") eth_use(${TARGET} ${REQUIRED} Dev::base) - target_link_libraries(${TARGET} devcore) + target_link_libraries(${TARGET} soldevcore) endif() endfunction() diff --git a/cmake/UseSolidity.cmake b/cmake/UseSolidity.cmake index 46e2cac99..8db2f8485 100644 --- a/cmake/UseSolidity.cmake +++ b/cmake/UseSolidity.cmake @@ -25,7 +25,7 @@ function(eth_apply TARGET REQUIRED SUBMODULE) endif() if (${SUBMODULE} STREQUAL "solidity" OR ${SUBMODULE} STREQUAL "") - eth_use(${TARGET} ${REQUIRED} Dev::devcore Solidity::evmasm) + eth_use(${TARGET} ${REQUIRED} Dev::soldevcore Solidity::evmasm) target_link_libraries(${TARGET} ${Solidity_SOLIDITY_LIBRARIES}) endif() diff --git a/libdevcore/Base64.cpp b/libdevcore/Base64.cpp deleted file mode 100644 index 8ee2b29f7..000000000 --- a/libdevcore/Base64.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - base64.cpp and base64.h - - Copyright (C) 2004-2008 René Nyffenegger - - This source code is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this source code must not be misrepresented; you must not - claim that you wrote the original source code. If you use this source code - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original source code. - - 3. This notice may not be removed or altered from any source distribution. - - René Nyffenegger rene.nyffenegger@adp-gmbh.ch -*/ -/// Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c -/// Originally by René Nyffenegger, modified by some other guy and then devified by Gav Wood. - -#include "Base64.h" - -using namespace std; -using namespace dev; - -static inline bool is_base64(byte c) -{ - return (isalnum(c) || (c == '+') || (c == '/')); -} - -static inline byte find_base64_char_index(byte c) -{ - if ('A' <= c && c <= 'Z') return c - 'A'; - else if ('a' <= c && c <= 'z') return c - 'a' + 1 + find_base64_char_index('Z'); - else if ('0' <= c && c <= '9') return c - '0' + 1 + find_base64_char_index('z'); - else if (c == '+') return 1 + find_base64_char_index('9'); - else if (c == '/') return 1 + find_base64_char_index('+'); - else return 1 + find_base64_char_index('/'); -} - -string dev::toBase64(bytesConstRef _in) -{ - static const char base64_chars[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - - string ret; - int i = 0; - int j = 0; - byte char_array_3[3]; - byte char_array_4[4]; - - auto buf = _in.data(); - auto bufLen = _in.size(); - - while (bufLen--) - { - char_array_3[i++] = *(buf++); - if (i == 3) - { - char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; - char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); - char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); - char_array_4[3] = char_array_3[2] & 0x3f; - - for (i = 0; i < 4; i++) - ret += base64_chars[char_array_4[i]]; - i = 0; - } - } - - if (i) - { - for (j = i; j < 3; j++) - char_array_3[j] = '\0'; - - char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; - char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); - char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); - char_array_4[3] = char_array_3[2] & 0x3f; - - for (j = 0; j < i + 1; j++) - ret += base64_chars[char_array_4[j]]; - - while (i++ < 3) - ret += '='; - } - - return ret; -} - -bytes dev::fromBase64(string const& encoded_string) -{ - auto in_len = encoded_string.size(); - int i = 0; - int j = 0; - int in_ = 0; - byte char_array_3[3]; - byte char_array_4[4]; - bytes ret; - - while (in_len-- && encoded_string[in_] != '=' && is_base64(encoded_string[in_])) - { - char_array_4[i++] = encoded_string[in_]; in_++; - if (i == 4) - { - for (i = 0; i < 4; i++) - char_array_4[i] = find_base64_char_index(char_array_4[i]); - - char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); - char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); - char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; - - for (i = 0; (i < 3); i++) - ret.push_back(char_array_3[i]); - i = 0; - } - } - - if (i) - { - for (j = i; j < 4; j++) - char_array_4[j] = 0; - - for (j = 0; j < 4; j++) - char_array_4[j] = find_base64_char_index(char_array_4[j]); - - char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); - char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); - char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; - - for (j = 0; j < i - 1; j++) - ret.push_back(char_array_3[j]); - } - - return ret; -} diff --git a/libdevcore/Base64.h b/libdevcore/Base64.h deleted file mode 100644 index d5481570c..000000000 --- a/libdevcore/Base64.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - base64.cpp and base64.h - - Copyright (C) 2004-2008 René Nyffenegger - - This source code is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this source code must not be misrepresented; you must not - claim that you wrote the original source code. If you use this source code - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original source code. - - 3. This notice may not be removed or altered from any source distribution. - - René Nyffenegger rene.nyffenegger@adp-gmbh.ch -*/ -/// Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c -/// Originally by René Nyffenegger. -/// DEVified by Gav Wood. -#pragma once - -#include -#include "Common.h" -#include "FixedHash.h" - -namespace dev -{ - -std::string toBase64(bytesConstRef _in); -bytes fromBase64(std::string const& _in); - - -} diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index 2af99dff1..c4f886a69 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -9,6 +9,6 @@ file(GLOB HEADERS "*.h") include_directories(..) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) -eth_use(${EXECUTABLE} REQUIRED Jsoncpp Dev::base) +eth_use(${EXECUTABLE} REQUIRED Dev::base) install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) diff --git a/libdevcore/Common.cpp b/libdevcore/Common.cpp deleted file mode 100644 index 579e0f62f..000000000 --- a/libdevcore/Common.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - 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 Common.cpp - * @author Gav Wood - * @date 2014 - */ - -#include "Common.h" - -namespace dev -{ -const u256 Invalid256 = ~(u256)0; -} diff --git a/libdevcore/Common.h b/libdevcore/Common.h index 7d301833e..8bc5f58f5 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -156,7 +156,6 @@ using string32 = std::array; // Null/Invalid values for convenience. static const bytes NullBytes; -extern const u256 Invalid256; /// Interprets @a _u as a two's complement signed number and returns the resulting s256. inline s256 u2s(u256 _u) diff --git a/libdevcore/FixedHash.cpp b/libdevcore/FixedHash.cpp deleted file mode 100644 index 420e2bb16..000000000 --- a/libdevcore/FixedHash.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - 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 FixedHash.cpp - * @author Gav Wood - * @date 2014 - */ - -#include "FixedHash.h" -#include -#include - -using namespace std; -using namespace dev; - -boost::random_device dev::s_fixedHashEngine; - -h128 dev::fromUUID(std::string const& _uuid) -{ - try - { - return h128(boost::replace_all_copy(_uuid, "-", "")); - } - catch (...) - { - return h128(); - } -} - -std::string dev::toUUID(h128 const& _uuid) -{ - std::string ret = toHex(_uuid.ref()); - for (unsigned i: {20, 16, 12, 8}) - ret.insert(ret.begin() + i, '-'); - return ret; -} - diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index cf79bab07..a23aecc60 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -26,8 +26,6 @@ #include #include #include -#include -#include #include #include "CommonData.h" @@ -38,8 +36,6 @@ namespace dev template struct StaticLog2 { enum { result = 1 + StaticLog2::result }; }; template <> struct StaticLog2<1> { enum { result = 0 }; }; -extern boost::random_device s_fixedHashEngine; - /// Fixed-size raw-byte array container type, with an API optimised for storing hashes. /// Transparently converts to/from the corresponding arithmetic type; this will /// assume the data contained in the hash is big-endian. @@ -150,17 +146,6 @@ public: /// @returns a constant reference to the object's data as an STL array. std::array const& asArray() const { return m_data; } - /// Populate with random data. - template - void randomize(Engine& _eng) - { - for (auto& i: m_data) - i = (uint8_t)boost::random::uniform_int_distribution(0, 255)(_eng); - } - - /// @returns a random valued object. - static FixedHash random() { FixedHash ret; ret.randomize(s_fixedHashEngine); return ret; } - struct hash { /// Make a hash of the object's data. @@ -279,10 +264,6 @@ inline h160 left160(h256 const& _t) return ret; } -h128 fromUUID(std::string const& _uuid); - -std::string toUUID(h128 const& _uuid); - inline std::string toString(h256s const& _bs) { std::ostringstream out; diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h index d48fa99cf..af28e2200 100644 --- a/libevmasm/Assembly.h +++ b/libevmasm/Assembly.h @@ -33,10 +33,6 @@ #include "Exceptions.h" #include -namespace Json -{ -class Value; -} namespace dev { namespace eth diff --git a/libevmasm/CMakeLists.txt b/libevmasm/CMakeLists.txt index e33301ea9..61162eeea 100644 --- a/libevmasm/CMakeLists.txt +++ b/libevmasm/CMakeLists.txt @@ -8,6 +8,6 @@ file(GLOB HEADERS "*.h") include_directories(BEFORE ..) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) -eth_use(${EXECUTABLE} REQUIRED Dev::devcore) +eth_use(${EXECUTABLE} REQUIRED Jsoncpp Dev::soldevcore) install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index dc06b0c82..56aea8295 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -15,7 +15,7 @@ file(GLOB HEADERS "*/*.h") include_directories(BEFORE ..) add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) -eth_use(${EXECUTABLE} REQUIRED Dev::devcore Solidity::evmasm) +eth_use(${EXECUTABLE} REQUIRED Dev::soldevcore Solidity::evmasm) install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) diff --git a/scripts/travis-emscripten/build_emscripten.sh b/scripts/travis-emscripten/build_emscripten.sh index 2b5e409fc..bb118ba6f 100755 --- a/scripts/travis-emscripten/build_emscripten.sh +++ b/scripts/travis-emscripten/build_emscripten.sh @@ -116,7 +116,7 @@ emcmake cmake \ -DJSONCPP_INCLUDE_DIR="$WORKSPACE"/jsoncpp/include/ \ -DCRYPTOPP_LIBRARY="$WORKSPACE"/cryptopp/src/libcryptlib.a \ -DCRYPTOPP_INCLUDE_DIR="$WORKSPACE"/cryptopp/src/ \ - -DDev_DEVCORE_LIBRARY="$WORKSPACE"/solidity/build/libdevcore/libdevcore.a \ + -DDev_DEVCORE_LIBRARY="$WORKSPACE"/solidity/build/libdevcore/libsoldevcore.a \ -DEth_EVMASM_LIBRARY="$WORKSPACE"/solidity/build/libevmasm/libevmasm.a \ -DETH_STATIC=1 -DTESTS=0 \ ..