From 515a1c22a9e85f616ae58aa05b45e6b613e4b777 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 5 Sep 2014 18:24:29 +0200 Subject: [PATCH] Split ethcore off into devcrypto ready for Whisper's crypto and repot namespace. Rename ethential to devcore. --- CMakeLists.txt | 3 +- alethzero/CMakeLists.txt | 2 +- alethzero/MainWin.cpp | 12 +-- alethzero/MainWin.h | 16 +-- eth/CommonJS.h | 8 +- eth/EthStubServer.h | 7 +- eth/main.cpp | 2 +- exp/main.cpp | 8 +- {libethential => libdevcore}/All.h | 0 {libethential => libdevcore}/CMakeLists.txt | 4 +- {libethential => libdevcore}/Common.cpp | 0 {libethential => libdevcore}/Common.h | 0 {libethential => libdevcore}/CommonData.cpp | 0 {libethential => libdevcore}/CommonData.h | 0 {libethential => libdevcore}/CommonIO.cpp | 0 {libethential => libdevcore}/CommonIO.h | 0 {libethential => libdevcore}/Exceptions.h | 0 {libethential => libdevcore}/FixedHash.cpp | 0 {libethential => libdevcore}/FixedHash.h | 0 {libethential => libdevcore}/Guards.cpp | 0 {libethential => libdevcore}/Guards.h | 0 {libethential => libdevcore}/Log.cpp | 0 {libethential => libdevcore}/Log.h | 0 {libethential => libdevcore}/RLP.cpp | 0 {libethential => libdevcore}/RLP.h | 8 +- {libethential => libdevcore}/vector_ref.h | 0 libdevcrypto/All.h | 9 ++ libdevcrypto/CMakeLists.txt | 56 +++++++++++ libdevcrypto/Common.cpp | 104 ++++++++++++++++++++ libdevcrypto/Common.h | 86 ++++++++++++++++ libdevcrypto/CryptoHeaders.h | 36 +++++++ {libethcore => libdevcrypto}/FileSystem.cpp | 4 +- {libethcore => libdevcrypto}/FileSystem.h | 0 {libethcore => libdevcrypto}/MemoryDB.cpp | 2 +- {libethcore => libdevcrypto}/MemoryDB.h | 8 +- {libethcore => libdevcrypto}/OverlayDB.cpp | 2 +- {libethcore => libdevcrypto}/OverlayDB.h | 4 +- {libethcore => libdevcrypto}/SHA3.cpp | 0 {libethcore => libdevcrypto}/SHA3.h | 4 +- {libethcore => libdevcrypto}/TrieCommon.cpp | 0 {libethcore => libdevcrypto}/TrieCommon.h | 4 +- {libethcore => libdevcrypto}/TrieDB.cpp | 2 +- {libethcore => libdevcrypto}/TrieDB.h | 6 +- libethcore/BlockInfo.cpp | 6 +- libethcore/BlockInfo.h | 4 +- libethcore/CMakeLists.txt | 3 +- libethcore/CommonEth.cpp | 50 +--------- libethcore/CommonEth.h | 59 +---------- libethcore/Dagger.cpp | 2 +- libethcore/Dagger.h | 2 +- libethcore/Exceptions.h | 2 +- libethereum/AccountDiff.cpp | 2 +- libethereum/AccountDiff.h | 2 +- libethereum/AddressState.h | 6 +- libethereum/BlockChain.cpp | 6 +- libethereum/BlockChain.h | 4 +- libethereum/BlockDetails.cpp | 2 +- libethereum/BlockDetails.h | 4 +- libethereum/BlockQueue.cpp | 2 +- libethereum/BlockQueue.h | 4 +- libethereum/CMakeLists.txt | 1 + libethereum/Client.cpp | 2 +- libethereum/Client.h | 6 +- libethereum/CommonNet.h | 4 +- libethereum/Defaults.cpp | 2 +- libethereum/Defaults.h | 2 +- libethereum/EthereumHost.cpp | 2 +- libethereum/EthereumHost.h | 2 +- libethereum/EthereumPeer.cpp | 2 +- libethereum/EthereumPeer.h | 2 +- libethereum/Executive.h | 2 +- libethereum/Manifest.h | 2 +- libethereum/MessageFilter.cpp | 2 +- libethereum/MessageFilter.h | 4 +- libethereum/Miner.h | 2 +- libethereum/PastMessage.h | 2 +- libethereum/State.h | 6 +- libethereum/Transaction.cpp | 4 +- libethereum/Transaction.h | 4 +- libethereum/TransactionQueue.cpp | 2 +- libethereum/TransactionQueue.h | 4 +- libethereum/Utility.h | 2 +- libevm/CMakeLists.txt | 3 +- libevm/ExtVMFace.h | 2 +- libevm/FeeStructure.h | 2 +- libevm/VM.h | 4 +- libevmface/CMakeLists.txt | 2 +- libevmface/Instruction.cpp | 2 +- libevmface/Instruction.h | 4 +- liblll/Assembly.cpp | 2 +- liblll/Assembly.h | 2 +- liblll/CMakeLists.txt | 2 +- liblll/CodeFragment.cpp | 2 +- liblll/CodeFragment.h | 2 +- liblll/Compiler.h | 2 +- liblll/Exceptions.h | 2 +- liblll/Parser.h | 2 +- libp2p/CMakeLists.txt | 2 +- libp2p/Common.h | 6 +- libp2p/Host.cpp | 2 +- libp2p/Host.h | 2 +- libp2p/Session.cpp | 2 +- libp2p/Session.h | 2 +- libp2p/UPnP.cpp | 6 +- libpyserpent/CMakeLists.txt | 2 +- libqethereum/QEthereum.cpp | 10 +- libqethereum/QEthereum.h | 16 +-- libqethereum/QmlEthereum.cpp | 8 +- libqethereum/QmlEthereum.h | 74 +++++++------- libserpent/CMakeLists.txt | 2 +- libwebthree/CMakeLists.txt | 1 + libwebthree/Client.cpp | 2 +- libwebthree/Client.h | 6 +- libwhisper/CMakeLists.txt | 3 +- libwhisper/Common.h | 4 +- libwhisper/WhisperPeer.cpp | 2 +- libwhisper/WhisperPeer.h | 6 +- lllc/CMakeLists.txt | 2 +- lllc/main.cpp | 4 +- neth/main.cpp | 2 +- sc/CMakeLists.txt | 2 +- test/MemTrie.cpp | 4 +- test/MemTrie.h | 4 +- test/TrieHash.cpp | 4 +- test/TrieHash.h | 4 +- test/crypto.cpp | 6 +- test/dagger.cpp | 2 +- test/genesis.cpp | 2 +- test/hexPrefix.cpp | 4 +- test/main.cpp | 4 +- test/rlp.cpp | 6 +- test/trie.cpp | 2 +- test/vm.cpp | 2 +- third/CMakeLists.txt | 2 +- third/MainWin.cpp | 10 +- third/MainWin.h | 12 +-- walleth/MainWin.cpp | 14 +-- walleth/MainWin.h | 8 +- 138 files changed, 554 insertions(+), 357 deletions(-) rename {libethential => libdevcore}/All.h (100%) rename {libethential => libdevcore}/CMakeLists.txt (95%) rename {libethential => libdevcore}/Common.cpp (100%) rename {libethential => libdevcore}/Common.h (100%) rename {libethential => libdevcore}/CommonData.cpp (100%) rename {libethential => libdevcore}/CommonData.h (100%) rename {libethential => libdevcore}/CommonIO.cpp (100%) rename {libethential => libdevcore}/CommonIO.h (100%) rename {libethential => libdevcore}/Exceptions.h (100%) rename {libethential => libdevcore}/FixedHash.cpp (100%) rename {libethential => libdevcore}/FixedHash.h (100%) rename {libethential => libdevcore}/Guards.cpp (100%) rename {libethential => libdevcore}/Guards.h (100%) rename {libethential => libdevcore}/Log.cpp (100%) rename {libethential => libdevcore}/Log.h (100%) rename {libethential => libdevcore}/RLP.cpp (100%) rename {libethential => libdevcore}/RLP.h (99%) rename {libethential => libdevcore}/vector_ref.h (100%) create mode 100644 libdevcrypto/All.h create mode 100644 libdevcrypto/CMakeLists.txt create mode 100644 libdevcrypto/Common.cpp create mode 100644 libdevcrypto/Common.h create mode 100644 libdevcrypto/CryptoHeaders.h rename {libethcore => libdevcrypto}/FileSystem.cpp (96%) rename {libethcore => libdevcrypto}/FileSystem.h (100%) rename {libethcore => libdevcrypto}/MemoryDB.cpp (98%) rename {libethcore => libdevcrypto}/MemoryDB.h (93%) rename {libethcore => libdevcrypto}/OverlayDB.cpp (98%) rename {libethcore => libdevcrypto}/OverlayDB.h (95%) rename {libethcore => libdevcrypto}/SHA3.cpp (100%) rename {libethcore => libdevcrypto}/SHA3.h (96%) rename {libethcore => libdevcrypto}/TrieCommon.cpp (100%) rename {libethcore => libdevcrypto}/TrieCommon.h (98%) rename {libethcore => libdevcrypto}/TrieDB.cpp (96%) rename {libethcore => libdevcrypto}/TrieDB.h (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92d2986e1..46cc0753f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,7 +324,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") include_directories(/usr/local/include) endif() -add_subdirectory(libethential) +add_subdirectory(libdevcore) add_subdirectory(libevmface) add_subdirectory(liblll) add_subdirectory(libserpent) @@ -338,6 +338,7 @@ add_subdirectory(sc) if (NOT LANGUAGES) add_subdirectory(secp256k1) add_subdirectory(libp2p) + add_subdirectory(libdevcrypto) add_subdirectory(libwhisper) add_subdirectory(libethcore) diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index 9551dd403..3eac0a0b6 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -52,7 +52,7 @@ else () endif () 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) +target_link_libraries(${EXECUTEABLE} qethereum ethereum evm ethcore devcrypto secp256k1 gmp ${CRYPTOPP_LS} serpent lll evmface devcore) if (APPLE) # First have qt5 install plugins and frameworks diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 374f8a209..e5ee1cd70 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -51,16 +51,16 @@ using dev::h160; using dev::h256; using dev::u160; using dev::u256; -using dev::eth::Address; +using dev::Address; using dev::eth::BlockInfo; using dev::eth::Client; using dev::eth::Instruction; -using dev::eth::KeyPair; +using dev::KeyPair; using dev::eth::NodeMode; using dev::eth::BlockChain; using dev::p2p::PeerInfo; using dev::RLP; -using dev::eth::Secret; +using dev::Secret; using dev::eth::Transaction; using dev::eth::Executive; @@ -417,7 +417,7 @@ void Main::eval(QString const& _js) ui->jsConsole->setHtml(s); } -QString Main::pretty(dev::eth::Address _a) const +QString Main::pretty(dev::Address _a) const { h256 n; @@ -430,7 +430,7 @@ QString Main::pretty(dev::eth::Address _a) const return fromRaw(n); } -QString Main::render(dev::eth::Address _a) const +QString Main::render(dev::Address _a) const { QString p = pretty(_a); if (!p.isNull()) @@ -1588,7 +1588,7 @@ void Main::on_debug_clicked() m_executiveState = m_client->postState(); m_currentExecution = unique_ptr(new Executive(m_executiveState)); Transaction t; - t.nonce = m_executiveState.transactionsFrom(dev::eth::toAddress(s)); + t.nonce = m_executiveState.transactionsFrom(dev::toAddress(s)); t.value = value(); t.gasPrice = gasPrice(); t.gas = ui->gas->value(); diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index e15f5ce2e..2902db3a2 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ class QQuickView; struct WorldState { uint64_t steps; - dev::eth::Address cur; + dev::Address cur; dev::u256 curPC; dev::eth::Instruction inst; dev::bigint newMemSize; @@ -71,7 +71,7 @@ public: dev::eth::Client* client() { return m_client.get(); } - QList const& owned() const { return m_myKeys; } + QList const& owned() const { return m_myKeys; } public slots: void load(QString _file); @@ -146,7 +146,7 @@ signals: void poll(); private: - QString pretty(dev::eth::Address _a) const; + QString pretty(dev::Address _a) const; QString prettyU256(dev::u256 _n) const; QString lookup(QString const& _n) const; @@ -155,8 +155,8 @@ private: void initDebugger(); void updateDebugger(); void debugFinished(); - QString render(dev::eth::Address _a) const; - dev::eth::Address fromString(QString const& _a) const; + QString render(dev::Address _a) const; + dev::Address fromString(QString const& _a) const; std::string renderDiff(dev::eth::StateDiff const& _d) const; void alterDebugStateGroup(bool _enable) const; @@ -208,11 +208,11 @@ private: QByteArray m_peers; QStringList m_servers; - QList m_myKeys; + QList m_myKeys; QString m_privateChain; bool m_keysChanged = false; dev::bytes m_data; - dev::eth::Address m_nameReg; + dev::Address m_nameReg; unsigned m_backupGas; diff --git a/eth/CommonJS.h b/eth/CommonJS.h index 71a0c46d8..caa7e6651 100644 --- a/eth/CommonJS.h +++ b/eth/CommonJS.h @@ -23,10 +23,10 @@ #pragma once #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace dev diff --git a/eth/EthStubServer.h b/eth/EthStubServer.h index 1805cb410..28af916a2 100644 --- a/eth/EthStubServer.h +++ b/eth/EthStubServer.h @@ -23,12 +23,13 @@ #include #include +#include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #include "abstractethstubserver.h" #pragma GCC diagnostic pop -namespace dev { namespace eth { class Client; class KeyPair; } } +namespace dev { namespace eth { class Client; } class KeyPair; } class EthStubServer: public AbstractEthStubServer { @@ -54,10 +55,10 @@ public: virtual Json::Value lastBlock(); virtual std::string lll(const std::string& s); virtual Json::Value block(const std::string&); - void setKeys(std::vector _keys) { m_keys = _keys; } + void setKeys(std::vector _keys) { m_keys = _keys; } private: dev::eth::Client& m_client; - std::vector m_keys; + std::vector m_keys; Json::Value jsontypeToValue(int); Json::Value blockJson(const std::string&); }; diff --git a/eth/main.cpp b/eth/main.cpp index 576423a5f..bd71f6677 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -29,7 +29,7 @@ #if ETH_JSONRPC #include #endif -#include +#include #include #include #include diff --git a/exp/main.cpp b/exp/main.cpp index 1de09e4ac..c49b13e44 100644 --- a/exp/main.cpp +++ b/exp/main.cpp @@ -26,10 +26,10 @@ #include #include #endif -#include -#include -#include -#include +#include +#include +#include +#include #include #include #if 0 diff --git a/libethential/All.h b/libdevcore/All.h similarity index 100% rename from libethential/All.h rename to libdevcore/All.h diff --git a/libethential/CMakeLists.txt b/libdevcore/CMakeLists.txt similarity index 95% rename from libethential/CMakeLists.txt rename to libdevcore/CMakeLists.txt index 139e80ce4..3f3ecb619 100644 --- a/libethential/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") aux_source_directory(. SRC_LIST) -set(EXECUTABLE ethential) +set(EXECUTABLE devcore) # set(CMAKE_INSTALL_PREFIX ../lib) if(ETH_STATIC) @@ -20,7 +20,7 @@ file(GLOB HEADERS "*.h") include_directories(..) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcore) if("${TARGET_PLATFORM}" STREQUAL "w64") include_directories(/usr/x86_64-w64-mingw32/include/cryptopp) diff --git a/libethential/Common.cpp b/libdevcore/Common.cpp similarity index 100% rename from libethential/Common.cpp rename to libdevcore/Common.cpp diff --git a/libethential/Common.h b/libdevcore/Common.h similarity index 100% rename from libethential/Common.h rename to libdevcore/Common.h diff --git a/libethential/CommonData.cpp b/libdevcore/CommonData.cpp similarity index 100% rename from libethential/CommonData.cpp rename to libdevcore/CommonData.cpp diff --git a/libethential/CommonData.h b/libdevcore/CommonData.h similarity index 100% rename from libethential/CommonData.h rename to libdevcore/CommonData.h diff --git a/libethential/CommonIO.cpp b/libdevcore/CommonIO.cpp similarity index 100% rename from libethential/CommonIO.cpp rename to libdevcore/CommonIO.cpp diff --git a/libethential/CommonIO.h b/libdevcore/CommonIO.h similarity index 100% rename from libethential/CommonIO.h rename to libdevcore/CommonIO.h diff --git a/libethential/Exceptions.h b/libdevcore/Exceptions.h similarity index 100% rename from libethential/Exceptions.h rename to libdevcore/Exceptions.h diff --git a/libethential/FixedHash.cpp b/libdevcore/FixedHash.cpp similarity index 100% rename from libethential/FixedHash.cpp rename to libdevcore/FixedHash.cpp diff --git a/libethential/FixedHash.h b/libdevcore/FixedHash.h similarity index 100% rename from libethential/FixedHash.h rename to libdevcore/FixedHash.h diff --git a/libethential/Guards.cpp b/libdevcore/Guards.cpp similarity index 100% rename from libethential/Guards.cpp rename to libdevcore/Guards.cpp diff --git a/libethential/Guards.h b/libdevcore/Guards.h similarity index 100% rename from libethential/Guards.h rename to libdevcore/Guards.h diff --git a/libethential/Log.cpp b/libdevcore/Log.cpp similarity index 100% rename from libethential/Log.cpp rename to libdevcore/Log.cpp diff --git a/libethential/Log.h b/libdevcore/Log.h similarity index 100% rename from libethential/Log.h rename to libdevcore/Log.h diff --git a/libethential/RLP.cpp b/libdevcore/RLP.cpp similarity index 100% rename from libethential/RLP.cpp rename to libdevcore/RLP.cpp diff --git a/libethential/RLP.h b/libdevcore/RLP.h similarity index 99% rename from libethential/RLP.h rename to libdevcore/RLP.h index 0398467e7..d3cb5eed1 100644 --- a/libethential/RLP.h +++ b/libdevcore/RLP.h @@ -28,10 +28,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace dev { diff --git a/libethential/vector_ref.h b/libdevcore/vector_ref.h similarity index 100% rename from libethential/vector_ref.h rename to libdevcore/vector_ref.h diff --git a/libdevcrypto/All.h b/libdevcrypto/All.h new file mode 100644 index 000000000..6d1844857 --- /dev/null +++ b/libdevcrypto/All.h @@ -0,0 +1,9 @@ +#pragma once + +#include "Common.h" +#include "FileSystem.h" +#include "MemoryDB.h" +#include "OverlayDB.h" +#include "SHA3.h" +#include "TrieCommon.h" +#include "TrieDB.h" diff --git a/libdevcrypto/CMakeLists.txt b/libdevcrypto/CMakeLists.txt new file mode 100644 index 000000000..e7f112f95 --- /dev/null +++ b/libdevcrypto/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_policy(SET CMP0015 NEW) + +aux_source_directory(. SRC_LIST) + +set(EXECUTABLE devcrypto) + +# set(CMAKE_INSTALL_PREFIX ../lib) +if(ETH_STATIC) + add_library(${EXECUTABLE} STATIC ${SRC_LIST}) +else() + add_library(${EXECUTABLE} SHARED ${SRC_LIST}) +endif() + +file(GLOB HEADERS "*.h") + +include_directories(..) + +target_link_libraries(${EXECUTABLE} devcore) +target_link_libraries(${EXECUTABLE} secp256k1) +target_link_libraries(${EXECUTABLE} gmp) +target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) +target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LS}) + +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) + target_link_libraries(${EXECUTABLE} iphlpapi) + target_link_libraries(${EXECUTABLE} ws2_32) + target_link_libraries(${EXECUTABLE} mswsock) + target_link_libraries(${EXECUTABLE} shlwapi) +elseif (APPLE) + # Latest mavericks boost libraries only come with -mt + target_link_libraries(${EXECUTABLE} boost_system-mt) + target_link_libraries(${EXECUTABLE} boost_filesystem-mt) + target_link_libraries(${EXECUTABLE} boost_thread-mt) + find_package(Threads REQUIRED) + target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) +elseif (UNIX) + find_package(Boost 1.53 REQUIRED COMPONENTS filesystem) + target_link_libraries(${EXECUTABLE} ${Boost_SYSTEM_LIBRARY}) + target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARY}) + target_link_libraries(${EXECUTABLE} ${Boost_THREAD_LIBRARY}) + target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARY}) + target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) +else () + target_link_libraries(${EXECUTABLE} boost_system) + target_link_libraries(${EXECUTABLE} boost_filesystem) + target_link_libraries(${EXECUTABLE} boost_thread) + find_package(Threads REQUIRED) + target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) +endif () + +install( TARGETS ${EXECUTABLE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} ) + diff --git a/libdevcrypto/Common.cpp b/libdevcrypto/Common.cpp new file mode 100644 index 000000000..ddc7b0b4b --- /dev/null +++ b/libdevcrypto/Common.cpp @@ -0,0 +1,104 @@ +/* + 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 CommonEth.cpp + * @author Gav Wood + * @date 2014 + */ + +#include "Common.h" +#include +#include +#include "SHA3.h" +using namespace std; +using namespace dev; +using namespace dev::eth; + +//#define ETH_ADDRESS_DEBUG 1 + +Address dev::toAddress(Secret _private) +{ + secp256k1_start(); + + byte pubkey[65]; + int pubkeylen = 65; + int ok = secp256k1_ecdsa_seckey_verify(_private.data()); + if (!ok) + return Address(); + ok = secp256k1_ecdsa_pubkey_create(pubkey, &pubkeylen, _private.data(), 0); + assert(pubkeylen == 65); + if (!ok) + return Address(); + ok = secp256k1_ecdsa_pubkey_verify(pubkey, 65); + if (!ok) + return Address(); + auto ret = right160(dev::eth::sha3(bytesConstRef(&(pubkey[1]), 64))); +#if ETH_ADDRESS_DEBUG + cout << "---- ADDRESS -------------------------------" << endl; + cout << "SEC: " << _private << endl; + cout << "PUB: " << toHex(bytesConstRef(&(pubkey[1]), 64)) << endl; + cout << "ADR: " << ret << endl; +#endif + return ret; +} + +KeyPair KeyPair::create() +{ + secp256k1_start(); + static std::mt19937_64 s_eng(time(0)); + std::uniform_int_distribution d(0, 255); + + for (int i = 0; i < 100; ++i) + { + h256 sec; + for (unsigned i = 0; i < 32; ++i) + sec[i] = (byte)d(s_eng); + + KeyPair ret(sec); + if (ret.address()) + return ret; + } + return KeyPair(); +} + +KeyPair::KeyPair(h256 _sec): + m_secret(_sec) +{ + int ok = secp256k1_ecdsa_seckey_verify(m_secret.data()); + if (!ok) + return; + + byte pubkey[65]; + int pubkeylen = 65; + ok = secp256k1_ecdsa_pubkey_create(pubkey, &pubkeylen, m_secret.data(), 0); + if (!ok || pubkeylen != 65) + return; + + ok = secp256k1_ecdsa_pubkey_verify(pubkey, 65); + if (!ok) + return; + + m_secret = m_secret; + memcpy(m_public.data(), &(pubkey[1]), 64); + m_address = right160(dev::eth::sha3(bytesConstRef(&(pubkey[1]), 64))); + +#if ETH_ADDRESS_DEBUG + cout << "---- ADDRESS -------------------------------" << endl; + cout << "SEC: " << m_secret << endl; + cout << "PUB: " << m_public << endl; + cout << "ADR: " << m_address << endl; +#endif +} diff --git a/libdevcrypto/Common.h b/libdevcrypto/Common.h new file mode 100644 index 000000000..2694d7f8d --- /dev/null +++ b/libdevcrypto/Common.h @@ -0,0 +1,86 @@ +/* + 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 CommonEth.h + * @author Gav Wood + * @date 2014 + * + * Ethereum-specific data structures & algorithms. + */ + +#pragma once + +#include +#include + +namespace dev +{ + +/// A secret key: 32 bytes. +/// @NOTE This is not endian-specific; it's just a bunch of bytes. +using Secret = h256; + +/// A public key: 64 bytes. +/// @NOTE This is not endian-specific; it's just a bunch of bytes. +using Public = h512; + +/// An Ethereum address: 20 bytes. +/// @NOTE This is not endian-specific; it's just a bunch of bytes. +using Address = h160; + +/// A vector of Ethereum addresses. +using Addresses = h160s; + +/// Convert a private key into the public key equivalent. +/// @returns 0 if it's not a valid private key. +Address toAddress(h256 _private); + +/// Simple class that represents a "key pair". +/// All of the data of the class can be regenerated from the secret key (m_secret) alone. +/// Actually stores a tuplet of secret, public and address (the right 160-bits of the public). +class KeyPair +{ +public: + /// Null constructor. + KeyPair() {} + + /// Normal constructor - populates object from the given secret key. + KeyPair(Secret _k); + + /// Create a new, randomly generated object. + static KeyPair create(); + + /// Retrieve the secret key. + Secret const& secret() const { return m_secret; } + /// Retrieve the secret key. + Secret const& sec() const { return m_secret; } + + /// Retrieve the public key. + Public const& pub() const { return m_public; } + + /// Retrieve the associated address of the public key. + Address const& address() const { return m_address; } + + bool operator==(KeyPair const& _c) const { return m_secret == _c.m_secret; } + bool operator!=(KeyPair const& _c) const { return m_secret != _c.m_secret; } + +private: + Secret m_secret; + Public m_public; + Address m_address; +}; + +} diff --git a/libdevcrypto/CryptoHeaders.h b/libdevcrypto/CryptoHeaders.h new file mode 100644 index 000000000..4ff63f1d7 --- /dev/null +++ b/libdevcrypto/CryptoHeaders.h @@ -0,0 +1,36 @@ +/* + 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 CryptoHeaders.h + * @author Tim Hughes + * @date 2014 + */ +#pragma once + +// need to leave this one disabled +#pragma GCC diagnostic ignored "-Wunused-function" + +#pragma warning(push) +#pragma warning(disable:4100 4244) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#include +#include +#include +#pragma warning(pop) +#pragma GCC diagnostic pop diff --git a/libethcore/FileSystem.cpp b/libdevcrypto/FileSystem.cpp similarity index 96% rename from libethcore/FileSystem.cpp rename to libdevcrypto/FileSystem.cpp index 953789d9b..1fb38b57f 100644 --- a/libethcore/FileSystem.cpp +++ b/libdevcrypto/FileSystem.cpp @@ -22,8 +22,8 @@ */ #include "FileSystem.h" -#include -#include +#include +#include #ifdef _WIN32 #include diff --git a/libethcore/FileSystem.h b/libdevcrypto/FileSystem.h similarity index 100% rename from libethcore/FileSystem.h rename to libdevcrypto/FileSystem.h diff --git a/libethcore/MemoryDB.cpp b/libdevcrypto/MemoryDB.cpp similarity index 98% rename from libethcore/MemoryDB.cpp rename to libdevcrypto/MemoryDB.cpp index 6fe8091d6..4480417fc 100644 --- a/libethcore/MemoryDB.cpp +++ b/libdevcrypto/MemoryDB.cpp @@ -19,7 +19,7 @@ * @date 2014 */ -#include +#include #include "MemoryDB.h" using namespace std; using namespace dev; diff --git a/libethcore/MemoryDB.h b/libdevcrypto/MemoryDB.h similarity index 93% rename from libethcore/MemoryDB.h rename to libdevcrypto/MemoryDB.h index 76c7e6c6b..59435d3bf 100644 --- a/libethcore/MemoryDB.h +++ b/libdevcrypto/MemoryDB.h @@ -22,10 +22,10 @@ #pragma once #include -#include -#include -#include -#include +#include +#include +#include +#include namespace dev { diff --git a/libethcore/OverlayDB.cpp b/libdevcrypto/OverlayDB.cpp similarity index 98% rename from libethcore/OverlayDB.cpp rename to libdevcrypto/OverlayDB.cpp index b009841cd..460609fb3 100644 --- a/libethcore/OverlayDB.cpp +++ b/libdevcrypto/OverlayDB.cpp @@ -19,7 +19,7 @@ * @date 2014 */ -#include +#include #include "OverlayDB.h" using namespace std; using namespace dev; diff --git a/libethcore/OverlayDB.h b/libdevcrypto/OverlayDB.h similarity index 95% rename from libethcore/OverlayDB.h rename to libdevcrypto/OverlayDB.h index c13b20e6b..9db4eaed6 100644 --- a/libethcore/OverlayDB.h +++ b/libdevcrypto/OverlayDB.h @@ -27,8 +27,8 @@ #pragma warning(pop) #include -#include -#include +#include +#include #include "MemoryDB.h" namespace ldb = leveldb; diff --git a/libethcore/SHA3.cpp b/libdevcrypto/SHA3.cpp similarity index 100% rename from libethcore/SHA3.cpp rename to libdevcrypto/SHA3.cpp diff --git a/libethcore/SHA3.h b/libdevcrypto/SHA3.h similarity index 96% rename from libethcore/SHA3.h rename to libdevcrypto/SHA3.h index 2a76ea56f..1b37846b3 100644 --- a/libethcore/SHA3.h +++ b/libdevcrypto/SHA3.h @@ -24,8 +24,8 @@ #pragma once #include -#include -#include +#include +#include namespace dev { diff --git a/libethcore/TrieCommon.cpp b/libdevcrypto/TrieCommon.cpp similarity index 100% rename from libethcore/TrieCommon.cpp rename to libdevcrypto/TrieCommon.cpp diff --git a/libethcore/TrieCommon.h b/libdevcrypto/TrieCommon.h similarity index 98% rename from libethcore/TrieCommon.h rename to libdevcrypto/TrieCommon.h index afe527e3b..ecfb4de67 100644 --- a/libethcore/TrieCommon.h +++ b/libdevcrypto/TrieCommon.h @@ -21,8 +21,8 @@ #pragma once -#include -#include +#include +#include namespace dev { diff --git a/libethcore/TrieDB.cpp b/libdevcrypto/TrieDB.cpp similarity index 96% rename from libethcore/TrieDB.cpp rename to libdevcrypto/TrieDB.cpp index c6c1262bc..3c551d2b4 100644 --- a/libethcore/TrieDB.cpp +++ b/libdevcrypto/TrieDB.cpp @@ -19,7 +19,7 @@ * @date 2014 */ -#include +#include #include "TrieDB.h" using namespace std; using namespace dev; diff --git a/libethcore/TrieDB.h b/libdevcrypto/TrieDB.h similarity index 99% rename from libethcore/TrieDB.h rename to libdevcrypto/TrieDB.h index ff87cc4f8..8ee6f3bca 100644 --- a/libethcore/TrieDB.h +++ b/libdevcrypto/TrieDB.h @@ -28,9 +28,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "MemoryDB.h" #include "OverlayDB.h" #include "TrieCommon.h" diff --git a/libethcore/BlockInfo.cpp b/libethcore/BlockInfo.cpp index d1028c21e..9ceb4c708 100644 --- a/libethcore/BlockInfo.cpp +++ b/libethcore/BlockInfo.cpp @@ -21,9 +21,9 @@ #if !ETH_LANGUAGES -#include -#include -#include +#include +#include +#include #include "Dagger.h" #include "Exceptions.h" #include "BlockInfo.h" diff --git a/libethcore/BlockInfo.h b/libethcore/BlockInfo.h index 54efd8c29..8186acaee 100644 --- a/libethcore/BlockInfo.h +++ b/libethcore/BlockInfo.h @@ -21,8 +21,8 @@ #pragma once -#include -#include +#include +#include #include "CommonEth.h" namespace dev diff --git a/libethcore/CMakeLists.txt b/libethcore/CMakeLists.txt index 0f9c2023a..6aba644f1 100644 --- a/libethcore/CMakeLists.txt +++ b/libethcore/CMakeLists.txt @@ -15,7 +15,8 @@ file(GLOB HEADERS "*.h") include_directories(..) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcrypto) +target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} secp256k1) target_link_libraries(${EXECUTABLE} gmp) target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) diff --git a/libethcore/CommonEth.cpp b/libethcore/CommonEth.cpp index c8632274c..f96fb5480 100644 --- a/libethcore/CommonEth.cpp +++ b/libethcore/CommonEth.cpp @@ -22,7 +22,7 @@ #include "CommonEth.h" #include #include -#include +#include #include "Exceptions.h" using namespace std; using namespace dev; @@ -111,51 +111,3 @@ Address toAddress(Secret _private) } }} - -KeyPair KeyPair::create() -{ - secp256k1_start(); - static std::mt19937_64 s_eng(time(0)); - std::uniform_int_distribution d(0, 255); - - for (int i = 0; i < 100; ++i) - { - h256 sec; - for (unsigned i = 0; i < 32; ++i) - sec[i] = (byte)d(s_eng); - - KeyPair ret(sec); - if (ret.address()) - return ret; - } - return KeyPair(); -} - -KeyPair::KeyPair(h256 _sec): - m_secret(_sec) -{ - int ok = secp256k1_ecdsa_seckey_verify(m_secret.data()); - if (!ok) - return; - - byte pubkey[65]; - int pubkeylen = 65; - ok = secp256k1_ecdsa_pubkey_create(pubkey, &pubkeylen, m_secret.data(), 0); - if (!ok || pubkeylen != 65) - return; - - ok = secp256k1_ecdsa_pubkey_verify(pubkey, 65); - if (!ok) - return; - - m_secret = m_secret; - memcpy(m_public.data(), &(pubkey[1]), 64); - m_address = right160(dev::eth::sha3(bytesConstRef(&(pubkey[1]), 64))); - -#if ETH_ADDRESS_DEBUG - cout << "---- ADDRESS -------------------------------" << endl; - cout << "SEC: " << m_secret << endl; - cout << "PUB: " << m_public << endl; - cout << "ADR: " << m_address << endl; -#endif -} diff --git a/libethcore/CommonEth.h b/libethcore/CommonEth.h index 49b8a0c4f..1965a881a 100644 --- a/libethcore/CommonEth.h +++ b/libethcore/CommonEth.h @@ -23,8 +23,9 @@ #pragma once -#include -#include +#include +#include +#include namespace dev { @@ -37,21 +38,6 @@ extern const unsigned c_protocolVersion; /// Current database version. extern const unsigned c_databaseVersion; -/// A secret key: 32 bytes. -/// @NOTE This is not endian-specific; it's just a bunch of bytes. -using Secret = h256; - -/// A public key: 64 bytes. -/// @NOTE This is not endian-specific; it's just a bunch of bytes. -using Public = h512; - -/// An Ethereum address: 20 bytes. -/// @NOTE This is not endian-specific; it's just a bunch of bytes. -using Address = h160; - -/// A vector of Ethereum addresses. -using Addresses = h160s; - /// User-friendly string representation of the amount _b in wei. std::string formatBalance(u256 _b); @@ -79,44 +65,5 @@ static const u256 Mwei = u256(1000000); static const u256 Kwei = u256(1000); static const u256 wei = u256(1); -/// Convert a private key into the public key equivalent. -/// @returns 0 if it's not a valid private key. -Address toAddress(h256 _private); - -/// Simple class that represents a "key pair". -/// All of the data of the class can be regenerated from the secret key (m_secret) alone. -/// Actually stores a tuplet of secret, public and address (the right 160-bits of the public). -class KeyPair -{ -public: - /// Null constructor. - KeyPair() {} - - /// Normal constructor - populates object from the given secret key. - KeyPair(Secret _k); - - /// Create a new, randomly generated object. - static KeyPair create(); - - /// Retrieve the secret key. - Secret const& secret() const { return m_secret; } - /// Retrieve the secret key. - Secret const& sec() const { return m_secret; } - - /// Retrieve the public key. - Public const& pub() const { return m_public; } - - /// Retrieve the associated address of the public key. - Address const& address() const { return m_address; } - - bool operator==(KeyPair const& _c) const { return m_secret == _c.m_secret; } - bool operator!=(KeyPair const& _c) const { return m_secret != _c.m_secret; } - -private: - Secret m_secret; - Public m_public; - Address m_address; -}; - } } diff --git a/libethcore/Dagger.cpp b/libethcore/Dagger.cpp index cc37fb98d..956557b64 100644 --- a/libethcore/Dagger.cpp +++ b/libethcore/Dagger.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "Dagger.h" using namespace std; using namespace std::chrono; diff --git a/libethcore/Dagger.h b/libethcore/Dagger.h index 58f6e3f80..c32ef38be 100644 --- a/libethcore/Dagger.h +++ b/libethcore/Dagger.h @@ -23,7 +23,7 @@ #pragma once -#include +#include #include "CommonEth.h" #define FAKE_DAGGER 1 diff --git a/libethcore/Exceptions.h b/libethcore/Exceptions.h index 175add708..c936b1f1b 100644 --- a/libethcore/Exceptions.h +++ b/libethcore/Exceptions.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace dev { diff --git a/libethereum/AccountDiff.cpp b/libethereum/AccountDiff.cpp index 08d6d8859..c434086fa 100644 --- a/libethereum/AccountDiff.cpp +++ b/libethereum/AccountDiff.cpp @@ -21,7 +21,7 @@ #include "AccountDiff.h" -#include +#include using namespace std; using namespace dev; using namespace dev::eth; diff --git a/libethereum/AccountDiff.h b/libethereum/AccountDiff.h index 4d8f63f0a..d4c30ead5 100644 --- a/libethereum/AccountDiff.h +++ b/libethereum/AccountDiff.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include namespace dev diff --git a/libethereum/AddressState.h b/libethereum/AddressState.h index c7df6523b..668e9225f 100644 --- a/libethereum/AddressState.h +++ b/libethereum/AddressState.h @@ -21,9 +21,9 @@ #pragma once -#include -#include -#include +#include +#include +#include namespace dev { diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index e9dfa0519..c23258f08 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -22,9 +22,9 @@ #include "BlockChain.h" #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/libethereum/BlockChain.h b/libethereum/BlockChain.h index 200740782..c0b3988a9 100644 --- a/libethereum/BlockChain.h +++ b/libethereum/BlockChain.h @@ -27,10 +27,10 @@ #pragma warning(pop) #include -#include +#include #include #include -#include +#include #include "BlockDetails.h" #include "AddressState.h" #include "BlockQueue.h" diff --git a/libethereum/BlockDetails.cpp b/libethereum/BlockDetails.cpp index eac40920e..5a61eb037 100644 --- a/libethereum/BlockDetails.cpp +++ b/libethereum/BlockDetails.cpp @@ -21,7 +21,7 @@ #include "BlockDetails.h" -#include +#include using namespace std; using namespace dev; using namespace dev::eth; diff --git a/libethereum/BlockDetails.h b/libethereum/BlockDetails.h index 21e5e7d13..9cb49a21c 100644 --- a/libethereum/BlockDetails.h +++ b/libethereum/BlockDetails.h @@ -26,8 +26,8 @@ #include #pragma warning(pop) -#include -#include +#include +#include #include "Manifest.h" namespace ldb = leveldb; diff --git a/libethereum/BlockQueue.cpp b/libethereum/BlockQueue.cpp index 00b64c8bc..f8bc7d64c 100644 --- a/libethereum/BlockQueue.cpp +++ b/libethereum/BlockQueue.cpp @@ -21,7 +21,7 @@ #include "BlockQueue.h" -#include +#include #include #include #include "BlockChain.h" diff --git a/libethereum/BlockQueue.h b/libethereum/BlockQueue.h index b8586a553..c68e1f1e4 100644 --- a/libethereum/BlockQueue.h +++ b/libethereum/BlockQueue.h @@ -22,9 +22,9 @@ #pragma once #include -#include +#include #include "libethcore/CommonEth.h" -#include +#include namespace dev { diff --git a/libethereum/CMakeLists.txt b/libethereum/CMakeLists.txt index 43812b7d3..128dd5999 100644 --- a/libethereum/CMakeLists.txt +++ b/libethereum/CMakeLists.txt @@ -21,6 +21,7 @@ target_link_libraries(${EXECUTABLE} evm) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} whisper) target_link_libraries(${EXECUTABLE} p2p) +target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} ethcore) target_link_libraries(${EXECUTABLE} secp256k1) if(MINIUPNPC_LS) diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index afefa1d4f..4c91c9aaf 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "Defaults.h" #include "EthereumHost.h" diff --git a/libethereum/Client.h b/libethereum/Client.h index 254fd1631..76e903b31 100644 --- a/libethereum/Client.h +++ b/libethereum/Client.h @@ -26,9 +26,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/libethereum/CommonNet.h b/libethereum/CommonNet.h index a4484ffb8..13f68a977 100644 --- a/libethereum/CommonNet.h +++ b/libethereum/CommonNet.h @@ -25,8 +25,8 @@ #include #include -#include -#include +#include +#include namespace dev { diff --git a/libethereum/Defaults.cpp b/libethereum/Defaults.cpp index 17d773427..febe53d84 100644 --- a/libethereum/Defaults.cpp +++ b/libethereum/Defaults.cpp @@ -21,7 +21,7 @@ #include "Defaults.h" -#include +#include using namespace std; using namespace dev; using namespace dev::eth; diff --git a/libethereum/Defaults.h b/libethereum/Defaults.h index e0478455d..91d5872f7 100644 --- a/libethereum/Defaults.h +++ b/libethereum/Defaults.h @@ -21,7 +21,7 @@ #pragma once -#include +#include namespace dev { diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index 0ba544248..069ab4291 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libethereum/EthereumHost.h b/libethereum/EthereumHost.h index e0cf5200b..bd0a5d0bc 100644 --- a/libethereum/EthereumHost.h +++ b/libethereum/EthereumHost.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include "CommonNet.h" diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 45165d348..1211ac03d 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -22,7 +22,7 @@ #include "EthereumPeer.h" #include -#include +#include #include #include #include "BlockChain.h" diff --git a/libethereum/EthereumPeer.h b/libethereum/EthereumPeer.h index c0c75f646..2e166b1d0 100644 --- a/libethereum/EthereumPeer.h +++ b/libethereum/EthereumPeer.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include "CommonNet.h" diff --git a/libethereum/Executive.h b/libethereum/Executive.h index 80e1035c9..82b7df7e9 100644 --- a/libethereum/Executive.h +++ b/libethereum/Executive.h @@ -22,7 +22,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/libethereum/Manifest.h b/libethereum/Manifest.h index 2f83d0cab..12c40b3a9 100644 --- a/libethereum/Manifest.h +++ b/libethereum/Manifest.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include namespace dev diff --git a/libethereum/MessageFilter.cpp b/libethereum/MessageFilter.cpp index 537bc4a9b..d88bc8a9b 100644 --- a/libethereum/MessageFilter.cpp +++ b/libethereum/MessageFilter.cpp @@ -21,7 +21,7 @@ #include "MessageFilter.h" -#include +#include #include "State.h" using namespace std; using namespace dev; diff --git a/libethereum/MessageFilter.h b/libethereum/MessageFilter.h index 8c44ce449..c9fb4e51c 100644 --- a/libethereum/MessageFilter.h +++ b/libethereum/MessageFilter.h @@ -21,8 +21,8 @@ #pragma once -#include -#include +#include +#include #include #include "PastMessage.h" diff --git a/libethereum/Miner.h b/libethereum/Miner.h index 46f59d0f5..d8ae20cc1 100644 --- a/libethereum/Miner.h +++ b/libethereum/Miner.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include "State.h" diff --git a/libethereum/PastMessage.h b/libethereum/PastMessage.h index 1b7f79527..6446eff5a 100644 --- a/libethereum/PastMessage.h +++ b/libethereum/PastMessage.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include "Manifest.h" diff --git a/libethereum/State.h b/libethereum/State.h index 1a45b89ba..335f27168 100644 --- a/libethereum/State.h +++ b/libethereum/State.h @@ -24,9 +24,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/libethereum/Transaction.cpp b/libethereum/Transaction.cpp index c464ead46..f607dc3b4 100644 --- a/libethereum/Transaction.cpp +++ b/libethereum/Transaction.cpp @@ -20,8 +20,8 @@ */ #include -#include -#include +#include +#include #include #include "Transaction.h" using namespace std; diff --git a/libethereum/Transaction.h b/libethereum/Transaction.h index 7aba44dcd..5b327d96b 100644 --- a/libethereum/Transaction.h +++ b/libethereum/Transaction.h @@ -21,8 +21,8 @@ #pragma once -#include -#include +#include +#include #include namespace dev diff --git a/libethereum/TransactionQueue.cpp b/libethereum/TransactionQueue.cpp index 4fb6c2299..5275732cb 100644 --- a/libethereum/TransactionQueue.cpp +++ b/libethereum/TransactionQueue.cpp @@ -21,7 +21,7 @@ #include "TransactionQueue.h" -#include +#include #include #include "Transaction.h" using namespace std; diff --git a/libethereum/TransactionQueue.h b/libethereum/TransactionQueue.h index 6cf3bc250..690dc658a 100644 --- a/libethereum/TransactionQueue.h +++ b/libethereum/TransactionQueue.h @@ -22,9 +22,9 @@ #pragma once #include -#include +#include #include "libethcore/CommonEth.h" -#include +#include namespace dev { diff --git a/libethereum/Utility.h b/libethereum/Utility.h index 0f9d178ff..93c3d54c8 100644 --- a/libethereum/Utility.h +++ b/libethereum/Utility.h @@ -22,7 +22,7 @@ #pragma once #include -#include +#include namespace dev { diff --git a/libevm/CMakeLists.txt b/libevm/CMakeLists.txt index 2365821b4..f19119f83 100644 --- a/libevm/CMakeLists.txt +++ b/libevm/CMakeLists.txt @@ -18,8 +18,9 @@ file(GLOB HEADERS "*.h") include_directories(..) target_link_libraries(${EXECUTABLE} ethcore) +target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} evmface) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} secp256k1) target_link_libraries(${EXECUTABLE} gmp) if(MINIUPNPC_LS) diff --git a/libevm/ExtVMFace.h b/libevm/ExtVMFace.h index e768519de..19cc944a4 100644 --- a/libevm/ExtVMFace.h +++ b/libevm/ExtVMFace.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include #include diff --git a/libevm/FeeStructure.h b/libevm/FeeStructure.h index 364a6de0d..76be9a398 100644 --- a/libevm/FeeStructure.h +++ b/libevm/FeeStructure.h @@ -21,7 +21,7 @@ #pragma once -#include +#include namespace dev { diff --git a/libevm/VM.h b/libevm/VM.h index e774a1787..e7d218ec6 100644 --- a/libevm/VM.h +++ b/libevm/VM.h @@ -22,10 +22,10 @@ #pragma once #include -#include +#include #include #include -#include +#include #include #include "FeeStructure.h" #include "ExtVMFace.h" diff --git a/libevmface/CMakeLists.txt b/libevmface/CMakeLists.txt index 93b33b66b..212ce825d 100644 --- a/libevmface/CMakeLists.txt +++ b/libevmface/CMakeLists.txt @@ -17,7 +17,7 @@ file(GLOB HEADERS "*.h") include_directories(..) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcore) if("${TARGET_PLATFORM}" STREQUAL "w64") target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) diff --git a/libevmface/Instruction.cpp b/libevmface/Instruction.cpp index 83dc22c42..7577c2aab 100644 --- a/libevmface/Instruction.cpp +++ b/libevmface/Instruction.cpp @@ -21,7 +21,7 @@ #include "Instruction.h" -#include +#include using namespace std; using namespace dev; using namespace dev::eth; diff --git a/libevmface/Instruction.h b/libevmface/Instruction.h index 01b4d6354..8d4ca989a 100644 --- a/libevmface/Instruction.h +++ b/libevmface/Instruction.h @@ -21,8 +21,8 @@ #pragma once -#include -#include +#include +#include namespace boost { namespace spirit { class utree; } } namespace sp = boost::spirit; diff --git a/liblll/Assembly.cpp b/liblll/Assembly.cpp index 475eaeabf..2250a71fe 100644 --- a/liblll/Assembly.cpp +++ b/liblll/Assembly.cpp @@ -21,7 +21,7 @@ #include "Assembly.h" -#include +#include using namespace std; using namespace dev; diff --git a/liblll/Assembly.h b/liblll/Assembly.h index cfeb6d1fb..b8152fe02 100644 --- a/liblll/Assembly.h +++ b/liblll/Assembly.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include "Exceptions.h" diff --git a/liblll/CMakeLists.txt b/liblll/CMakeLists.txt index 98bebdfed..7746613ec 100644 --- a/liblll/CMakeLists.txt +++ b/liblll/CMakeLists.txt @@ -18,7 +18,7 @@ file(GLOB HEADERS "*.h") include_directories(..) target_link_libraries(${EXECUTABLE} evmface) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcore) if("${TARGET_PLATFORM}" STREQUAL "w64") diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp index ecad3d364..533d00a96 100644 --- a/liblll/CodeFragment.cpp +++ b/liblll/CodeFragment.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include "CompilerState.h" #include "Parser.h" diff --git a/liblll/CodeFragment.h b/liblll/CodeFragment.h index a81d8ea22..60ab7c6de 100644 --- a/liblll/CodeFragment.h +++ b/liblll/CodeFragment.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include "Assembly.h" #include "Exceptions.h" diff --git a/liblll/Compiler.h b/liblll/Compiler.h index 5daec0a54..0fadd2785 100644 --- a/liblll/Compiler.h +++ b/liblll/Compiler.h @@ -23,7 +23,7 @@ #include #include -#include +#include namespace dev { diff --git a/liblll/Exceptions.h b/liblll/Exceptions.h index 1dcbbcc66..c45215f1a 100644 --- a/liblll/Exceptions.h +++ b/liblll/Exceptions.h @@ -21,7 +21,7 @@ #pragma once -#include +#include namespace dev { diff --git a/liblll/Parser.h b/liblll/Parser.h index f90c6b5df..b21989f06 100644 --- a/liblll/Parser.h +++ b/liblll/Parser.h @@ -23,7 +23,7 @@ #include #include -#include +#include namespace boost { namespace spirit { class utree; } } namespace sp = boost::spirit; diff --git a/libp2p/CMakeLists.txt b/libp2p/CMakeLists.txt index 118aecbe8..ab852fc57 100644 --- a/libp2p/CMakeLists.txt +++ b/libp2p/CMakeLists.txt @@ -17,7 +17,7 @@ file(GLOB HEADERS "*.h") include_directories(..) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} secp256k1) if(MINIUPNPC_LS) target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LS}) diff --git a/libp2p/Common.h b/libp2p/Common.h index 94be0b04b..8035f462f 100644 --- a/libp2p/Common.h +++ b/libp2p/Common.h @@ -27,9 +27,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include namespace ba = boost::asio; namespace bi = boost::asio::ip; diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index 1a375608d..fdf1338b3 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include "Session.h" #include "Capability.h" diff --git a/libp2p/Host.h b/libp2p/Host.h index c362bbe11..a4897602d 100644 --- a/libp2p/Host.h +++ b/libp2p/Host.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "HostCapability.h" namespace ba = boost::asio; namespace bi = boost::asio::ip; diff --git a/libp2p/Session.cpp b/libp2p/Session.cpp index cdd168db4..5ed987cff 100644 --- a/libp2p/Session.cpp +++ b/libp2p/Session.cpp @@ -22,7 +22,7 @@ #include "Session.h" #include -#include +#include #include #include "Host.h" #include "Capability.h" diff --git a/libp2p/Session.h b/libp2p/Session.h index a005e35ed..289ec1063 100644 --- a/libp2p/Session.h +++ b/libp2p/Session.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "Common.h" namespace dev diff --git a/libp2p/UPnP.cpp b/libp2p/UPnP.cpp index 6b3ef4cc5..4fe01159a 100644 --- a/libp2p/UPnP.cpp +++ b/libp2p/UPnP.cpp @@ -29,9 +29,9 @@ #include #include #endif -#include -#include -#include +#include +#include +#include using namespace std; using namespace dev; using namespace dev::p2p; diff --git a/libpyserpent/CMakeLists.txt b/libpyserpent/CMakeLists.txt index fb0c101e9..5108000f4 100644 --- a/libpyserpent/CMakeLists.txt +++ b/libpyserpent/CMakeLists.txt @@ -14,7 +14,7 @@ include_directories(..) target_link_libraries(${EXECUTABLE} serpent) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmface) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} ${PYTHON_LS}) if("${TARGET_PLATFORM}" STREQUAL "w64") diff --git a/libqethereum/QEthereum.cpp b/libqethereum/QEthereum.cpp index 2fd94b228..689daf8d7 100644 --- a/libqethereum/QEthereum.cpp +++ b/libqethereum/QEthereum.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include @@ -18,14 +18,14 @@ using dev::u160; using dev::u256; using dev::u256s; using dev::RLP; -using dev::eth::Address; +using dev::Address; using dev::eth::BlockInfo; using dev::eth::Client; using dev::eth::Instruction; -using dev::eth::KeyPair; +using dev::KeyPair; using dev::eth::NodeMode; using dev::p2p::PeerInfo; -using dev::eth::Secret; +using dev::Secret; using dev::eth::Transaction; // functions @@ -89,7 +89,7 @@ QString unpadded(QString _s) return _s; } -QEthereum::QEthereum(QObject* _p, Client* _c, QList _accounts): +QEthereum::QEthereum(QObject* _p, Client* _c, QList _accounts): QObject(_p), m_client(_c), m_accounts(_accounts) { // required to prevent crash on osx when performing addto/evaluatejavascript calls diff --git a/libqethereum/QEthereum.h b/libqethereum/QEthereum.h index 41451118e..cacf1cfc4 100644 --- a/libqethereum/QEthereum.h +++ b/libqethereum/QEthereum.h @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include namespace dev { namespace eth { @@ -55,8 +55,8 @@ template dev::FixedHash toFixed(QString const& _s) template inline boost::multiprecision::number> toInt(QString const& _s); -inline dev::eth::Address toAddress(QString const& _s) { return toFixed<20>(_s); } -inline dev::eth::Secret toSecret(QString const& _s) { return toFixed<32>(_s); } +inline dev::Address toAddress(QString const& _s) { return toFixed<20>(_s); } +inline dev::Secret toSecret(QString const& _s) { return toFixed<32>(_s); } inline dev::u256 toU256(QString const& _s) { return toInt<32>(_s); } template QString toQJS(dev::FixedHash const& _h) { return QString::fromStdString("0x" + toHex(_h.ref())); } @@ -99,7 +99,7 @@ class QEthereum: public QObject Q_OBJECT public: - QEthereum(QObject* _p, dev::eth::Client* _c, QList _accounts); + QEthereum(QObject* _p, dev::eth::Client* _c, QList _accounts); virtual ~QEthereum(); dev::eth::Client* client() const; @@ -108,7 +108,7 @@ public: /// Call when the client() is going to be deleted to make this object useless but safe. void clientDieing(); - void setAccounts(QList _l) { m_accounts = _l; keysChanged(); } + void setAccounts(QList _l) { m_accounts = _l; keysChanged(); } Q_INVOKABLE QString ethTest() const { return "Hello world!"; } Q_INVOKABLE QEthereum* self() { return this; } @@ -165,9 +165,9 @@ public: int getDefault() const; QString/*dev::KeyPair*/ key() const; - QStringList/*list of dev::eth::KeyPair*/ keys() const; + QStringList/*list of dev::KeyPair*/ keys() const; QString/*dev::Address*/ account() const; - QStringList/*list of dev::eth::Address*/ accounts() const; + QStringList/*list of dev::Address*/ accounts() const; unsigned peerCount() const; @@ -201,7 +201,7 @@ private: dev::eth::Client* m_client; std::vector m_watches; - QList m_accounts; + QList m_accounts; }; #define QETH_INSTALL_JS_NAMESPACE(frame, eth, env) [frame, eth, env]() \ diff --git a/libqethereum/QmlEthereum.cpp b/libqethereum/QmlEthereum.cpp index b718bfb7b..350427f3e 100644 --- a/libqethereum/QmlEthereum.cpp +++ b/libqethereum/QmlEthereum.cpp @@ -3,7 +3,7 @@ #endif #include #include -#include +#include #include #include #include @@ -21,13 +21,13 @@ using dev::u160; using dev::u256; using dev::u256s; using dev::RLP; -using dev::eth::Address; +using dev::Address; using dev::eth::BlockInfo; using dev::eth::Client; using dev::eth::Instruction; -using dev::eth::KeyPair; +using dev::KeyPair; using dev::eth::NodeMode; -using dev::eth::Secret; +using dev::Secret; using dev::eth::Transaction; using dev::p2p::PeerInfo; diff --git a/libqethereum/QmlEthereum.h b/libqethereum/QmlEthereum.h index 59dff6f5e..dcb636301 100644 --- a/libqethereum/QmlEthereum.h +++ b/libqethereum/QmlEthereum.h @@ -4,7 +4,7 @@ #if ETH_QTQML #include #endif -#include +#include #include namespace dev { namespace eth { @@ -20,9 +20,9 @@ extern dev::eth::Client* g_qmlClient; extern QObject* g_qmlMain; Q_DECLARE_METATYPE(dev::u256) -Q_DECLARE_METATYPE(dev::eth::Address) -Q_DECLARE_METATYPE(dev::eth::Secret) -Q_DECLARE_METATYPE(dev::eth::KeyPair) +Q_DECLARE_METATYPE(dev::Address) +Q_DECLARE_METATYPE(dev::Secret) +Q_DECLARE_METATYPE(dev::KeyPair) Q_DECLARE_METATYPE(QmlAccount*) Q_DECLARE_METATYPE(QmlEthereum*) @@ -64,16 +64,16 @@ class QmlKeyHelper: public QObject public: QmlKeyHelper(QObject* _p = nullptr): QObject(_p) {} - Q_INVOKABLE dev::eth::KeyPair create() const { return dev::eth::KeyPair::create(); } - Q_INVOKABLE dev::eth::Address address(dev::eth::KeyPair _p) const { return _p.address(); } - Q_INVOKABLE dev::eth::Secret secret(dev::eth::KeyPair _p) const { return _p.secret(); } - Q_INVOKABLE dev::eth::KeyPair keypair(dev::eth::Secret _k) const { return dev::eth::KeyPair(_k); } + Q_INVOKABLE dev::KeyPair create() const { return dev::KeyPair::create(); } + Q_INVOKABLE dev::Address address(dev::KeyPair _p) const { return _p.address(); } + Q_INVOKABLE dev::Secret secret(dev::KeyPair _p) const { return _p.secret(); } + Q_INVOKABLE dev::KeyPair keypair(dev::Secret _k) const { return dev::KeyPair(_k); } - Q_INVOKABLE bool isNull(dev::eth::Address _a) const { return !_a; } + Q_INVOKABLE bool isNull(dev::Address _a) const { return !_a; } - Q_INVOKABLE dev::eth::Address addressOf(QString _s) const { return dev::eth::Address(_s.toStdString()); } - Q_INVOKABLE QString stringOf(dev::eth::Address _a) const { return QString::fromStdString(dev::toHex(_a.asArray())); } - Q_INVOKABLE QString toAbridged(dev::eth::Address _a) const { return QString::fromStdString(_a.abridged()); } + Q_INVOKABLE dev::Address addressOf(QString _s) const { return dev::Address(_s.toStdString()); } + Q_INVOKABLE QString stringOf(dev::Address _a) const { return QString::fromStdString(dev::toHex(_a.asArray())); } + Q_INVOKABLE QString toAbridged(dev::Address _a) const { return QString::fromStdString(_a.abridged()); } }; class QmlAccount: public QObject @@ -88,13 +88,13 @@ public: Q_INVOKABLE dev::u256 balance() const; Q_INVOKABLE double txCount() const; Q_INVOKABLE bool isContract() const; - Q_INVOKABLE dev::eth::Address address() const { return m_address; } + Q_INVOKABLE dev::Address address() const { return m_address; } // TODO: past transactions models. public slots: void setEthereum(QmlEthereum* _eth); - void setAddress(dev::eth::Address _a) { m_address = _a; } + void setAddress(dev::Address _a) { m_address = _a; } signals: void changed(); @@ -102,12 +102,12 @@ signals: private: QmlEthereum* m_eth = nullptr; - dev::eth::Address m_address; + dev::Address m_address; Q_PROPERTY(dev::u256 balance READ balance NOTIFY changed STORED false) Q_PROPERTY(double txCount READ txCount NOTIFY changed STORED false) Q_PROPERTY(bool isContract READ isContract NOTIFY changed STORED false) - Q_PROPERTY(dev::eth::Address address READ address WRITE setAddress NOTIFY changed) + Q_PROPERTY(dev::Address address READ address WRITE setAddress NOTIFY changed) Q_PROPERTY(QmlEthereum* ethereum READ ethereum WRITE setEthereum NOTIFY ethChanged) }; @@ -124,23 +124,23 @@ public: static QObject* constructU256Helper(QQmlEngine*, QJSEngine*) { return new QmlU256Helper; } static QObject* constructKeyHelper(QQmlEngine*, QJSEngine*) { return new QmlKeyHelper; } - Q_INVOKABLE dev::eth::Address coinbase() const; + Q_INVOKABLE dev::Address coinbase() const; Q_INVOKABLE bool isListening() const; Q_INVOKABLE bool isMining() const; - Q_INVOKABLE dev::u256 balanceAt(dev::eth::Address _a) const; - Q_INVOKABLE double txCountAt(dev::eth::Address _a) const; - Q_INVOKABLE bool isContractAt(dev::eth::Address _a) const; + Q_INVOKABLE dev::u256 balanceAt(dev::Address _a) const; + Q_INVOKABLE double txCountAt(dev::Address _a) const; + Q_INVOKABLE bool isContractAt(dev::Address _a) const; Q_INVOKABLE unsigned peerCount() const; Q_INVOKABLE QmlEthereum* self() { return this; } public slots: - void transact(dev::eth::Secret _secret, dev::eth::Address _dest, dev::u256 _amount, dev::u256 _gasPrice, dev::u256 _gas, QByteArray _data); - void transact(dev::eth::Secret _secret, dev::u256 _amount, dev::u256 _gasPrice, dev::u256 _gas, QByteArray _init); - void setCoinbase(dev::eth::Address); + void transact(dev::Secret _secret, dev::Address _dest, dev::u256 _amount, dev::u256 _gasPrice, dev::u256 _gas, QByteArray _data); + void transact(dev::Secret _secret, dev::u256 _amount, dev::u256 _gasPrice, dev::u256 _gas, QByteArray _init); + void setCoinbase(dev::Address); void setMining(bool _l); void setListening(bool _l); @@ -151,7 +151,7 @@ signals: // void miningChanged(); private: - Q_PROPERTY(dev::eth::Address coinbase READ coinbase WRITE setCoinbase NOTIFY coinbaseChanged) + Q_PROPERTY(dev::Address coinbase READ coinbase WRITE setCoinbase NOTIFY coinbaseChanged) Q_PROPERTY(bool listening READ isListening WRITE setListening) Q_PROPERTY(bool mining READ isMining WRITE setMining) }; @@ -198,10 +198,10 @@ public: Q_INVOKABLE QByteArray bytesOf(QVariant _t) const { dev::h256 b = in(_t); return QByteArray((char const*)&b, sizeof(dev::h256)); } Q_INVOKABLE QVariant fromHex(QString _s) const { return out((dev::u256)dev::h256(_s.toStdString())); } - Q_INVOKABLE QVariant fromAddress(QVariant/*dev::eth::Address*/ _a) const { return out((dev::eth::u160)to(_a)); } - Q_INVOKABLE QVariant toAddress(QVariant/*dev::eth::Address*/ _a) const { return toQJS((dev::eth::u160)in(_a)); } + Q_INVOKABLE QVariant fromAddress(QVariant/*dev::Address*/ _a) const { return out((dev::eth::u160)to(_a)); } + Q_INVOKABLE QVariant toAddress(QVariant/*dev::Address*/ _a) const { return toQJS((dev::eth::u160)in(_a)); } - Q_INVOKABLE bool isNull(QVariant/*dev::eth::Address*/ _a) const { return !in(_a); } + Q_INVOKABLE bool isNull(QVariant/*dev::Address*/ _a) const { return !in(_a); } }; class KeyHelper: public QObject @@ -211,19 +211,19 @@ class KeyHelper: public QObject public: KeyHelper(QObject* _p = nullptr): QObject(_p) {} - static dev::eth::Address in(QVariant const& _s) { return to(_s); } - static QVariant out(dev::eth::Address const& _s) { return toQJS(_s); } + static dev::Address in(QVariant const& _s) { return to(_s); } + static QVariant out(dev::Address const& _s) { return toQJS(_s); } - Q_INVOKABLE QVariant/*dev::eth::KeyPair*/ create() const { return toQJS(dev::eth::KeyPair::create()); } - Q_INVOKABLE QVariant/*dev::eth::Address*/ address(QVariant/*dev::eth::KeyPair*/ _p) const { return out(to(_p).address()); } - Q_INVOKABLE QVariant/*dev::eth::Secret*/ secret(QVariant/*dev::eth::KeyPair*/ _p) const { return toQJS(to(_p).secret()); } - Q_INVOKABLE QVariant/*dev::eth::KeyPair*/ keypair(QVariant/*dev::eth::Secret*/ _k) const { return toQJS(dev::eth::KeyPair(to(_k))); } + Q_INVOKABLE QVariant/*dev::KeyPair*/ create() const { return toQJS(dev::KeyPair::create()); } + Q_INVOKABLE QVariant/*dev::Address*/ address(QVariant/*dev::KeyPair*/ _p) const { return out(to(_p).address()); } + Q_INVOKABLE QVariant/*dev::Secret*/ secret(QVariant/*dev::KeyPair*/ _p) const { return toQJS(to(_p).secret()); } + Q_INVOKABLE QVariant/*dev::KeyPair*/ keypair(QVariant/*dev::Secret*/ _k) const { return toQJS(dev::KeyPair(to(_k))); } - Q_INVOKABLE bool isNull(QVariant/*dev::eth::Address*/ _a) const { return !in(_a); } + Q_INVOKABLE bool isNull(QVariant/*dev::Address*/ _a) const { return !in(_a); } - Q_INVOKABLE QVariant/*dev::eth::Address*/ addressOf(QString _s) const { return out(dev::eth::Address(_s.toStdString())); } - Q_INVOKABLE QString stringOf(QVariant/*dev::eth::Address*/ _a) const { return QString::fromStdString(dev::eth::toHex(in(_a).asArray())); } - Q_INVOKABLE QString toAbridged(QVariant/*dev::eth::Address*/ _a) const { return QString::fromStdString(in(_a).abridged()); } + Q_INVOKABLE QVariant/*dev::Address*/ addressOf(QString _s) const { return out(dev::Address(_s.toStdString())); } + Q_INVOKABLE QString stringOf(QVariant/*dev::Address*/ _a) const { return QString::fromStdString(dev::eth::toHex(in(_a).asArray())); } + Q_INVOKABLE QString toAbridged(QVariant/*dev::Address*/ _a) const { return QString::fromStdString(in(_a).abridged()); } }; diff --git a/libserpent/CMakeLists.txt b/libserpent/CMakeLists.txt index 0d392bd49..0d66393b2 100644 --- a/libserpent/CMakeLists.txt +++ b/libserpent/CMakeLists.txt @@ -19,7 +19,7 @@ include_directories(..) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmface) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcore) if("${TARGET_PLATFORM}" STREQUAL "w64") target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) diff --git a/libwebthree/CMakeLists.txt b/libwebthree/CMakeLists.txt index 54bfd586d..d3332d8b0 100644 --- a/libwebthree/CMakeLists.txt +++ b/libwebthree/CMakeLists.txt @@ -23,6 +23,7 @@ target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} whisper) target_link_libraries(${EXECUTABLE} p2p) target_link_libraries(${EXECUTABLE} ethcore) +target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} secp256k1) if(MINIUPNPC_LS) target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LS}) diff --git a/libwebthree/Client.cpp b/libwebthree/Client.cpp index f8b3ad538..fc5d0511f 100644 --- a/libwebthree/Client.cpp +++ b/libwebthree/Client.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libwebthree/Client.h b/libwebthree/Client.h index 5c418d931..d0ca8fb5b 100644 --- a/libwebthree/Client.h +++ b/libwebthree/Client.h @@ -26,9 +26,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include namespace dev diff --git a/libwhisper/CMakeLists.txt b/libwhisper/CMakeLists.txt index c85853162..49857d16a 100644 --- a/libwhisper/CMakeLists.txt +++ b/libwhisper/CMakeLists.txt @@ -18,7 +18,8 @@ file(GLOB HEADERS "*.h") include_directories(..) target_link_libraries(${EXECUTABLE} ethcore) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcrypto) +target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} p2p) target_link_libraries(${EXECUTABLE} secp256k1) if(MINIUPNPC_LS) diff --git a/libwhisper/Common.h b/libwhisper/Common.h index 9ca727c1e..2324be024 100644 --- a/libwhisper/Common.h +++ b/libwhisper/Common.h @@ -23,8 +23,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/libwhisper/WhisperPeer.cpp b/libwhisper/WhisperPeer.cpp index 020170013..a1598010e 100644 --- a/libwhisper/WhisperPeer.cpp +++ b/libwhisper/WhisperPeer.cpp @@ -21,7 +21,7 @@ #include "WhisperPeer.h" -#include +#include #include using namespace std; using namespace dev; diff --git a/libwhisper/WhisperPeer.h b/libwhisper/WhisperPeer.h index dba3efed8..9163b544d 100644 --- a/libwhisper/WhisperPeer.h +++ b/libwhisper/WhisperPeer.h @@ -26,9 +26,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include "Common.h" namespace dev diff --git a/lllc/CMakeLists.txt b/lllc/CMakeLists.txt index 97eaea7ac..9d5e8c5ff 100644 --- a/lllc/CMakeLists.txt +++ b/lllc/CMakeLists.txt @@ -10,7 +10,7 @@ add_executable(${EXECUTABLE} ${SRC_LIST}) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmface) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcore) if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") diff --git a/lllc/main.cpp b/lllc/main.cpp index ccdf5a11b..a4c9df78c 100644 --- a/lllc/main.cpp +++ b/lllc/main.cpp @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include #include #include "BuildInfo.h" using namespace std; diff --git a/neth/main.cpp b/neth/main.cpp index 67afc2664..e492d1a3c 100644 --- a/neth/main.cpp +++ b/neth/main.cpp @@ -29,7 +29,7 @@ #if ETH_JSONRPC #include #endif -#include +#include #include #include #if ETH_JSONRPC diff --git a/sc/CMakeLists.txt b/sc/CMakeLists.txt index 20a8c23f3..3cacf78e6 100644 --- a/sc/CMakeLists.txt +++ b/sc/CMakeLists.txt @@ -11,7 +11,7 @@ add_executable(${EXECUTABLE} ${SRC_LIST}) target_link_libraries(${EXECUTABLE} serpent) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmface) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcore) if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") diff --git a/test/MemTrie.cpp b/test/MemTrie.cpp index b5d875acb..d654179f3 100644 --- a/test/MemTrie.cpp +++ b/test/MemTrie.cpp @@ -21,8 +21,8 @@ #include "MemTrie.h" -#include -#include +#include +#include #include using namespace std; using namespace dev; diff --git a/test/MemTrie.h b/test/MemTrie.h index 66669653c..86b09540f 100644 --- a/test/MemTrie.h +++ b/test/MemTrie.h @@ -21,8 +21,8 @@ #pragma once -#include -#include +#include +#include namespace dev { diff --git a/test/TrieHash.cpp b/test/TrieHash.cpp index b2ebce731..af32e870d 100644 --- a/test/TrieHash.cpp +++ b/test/TrieHash.cpp @@ -21,8 +21,8 @@ #include "TrieHash.h" -#include -#include +#include +#include #include using namespace std; using namespace dev; diff --git a/test/TrieHash.h b/test/TrieHash.h index 4d86c4dbf..be1d84480 100644 --- a/test/TrieHash.h +++ b/test/TrieHash.h @@ -21,8 +21,8 @@ #pragma once -#include -#include +#include +#include namespace dev { diff --git a/test/crypto.cpp b/test/crypto.cpp index 2e4ffa055..d2943984e 100644 --- a/test/crypto.cpp +++ b/test/crypto.cpp @@ -22,9 +22,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/test/dagger.cpp b/test/dagger.cpp index fd60a8efa..555c5d776 100644 --- a/test/dagger.cpp +++ b/test/dagger.cpp @@ -21,7 +21,7 @@ */ #include -#include +#include #include using namespace std; using namespace std::chrono; diff --git a/test/genesis.cpp b/test/genesis.cpp index be6655aba..5f17d2762 100644 --- a/test/genesis.cpp +++ b/test/genesis.cpp @@ -23,7 +23,7 @@ #include #include #include "JsonSpiritHeaders.h" -#include +#include #include #include diff --git a/test/hexPrefix.cpp b/test/hexPrefix.cpp index 7dbe80a57..9b65db0e4 100644 --- a/test/hexPrefix.cpp +++ b/test/hexPrefix.cpp @@ -22,8 +22,8 @@ #include #include "JsonSpiritHeaders.h" -#include -#include +#include +#include #include using namespace std; diff --git a/test/main.cpp b/test/main.cpp index 08142095c..ef009e299 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -20,7 +20,7 @@ * Main test functions. */ -#include +#include #include "TrieHash.h" #include "MemTrie.h" @@ -35,7 +35,7 @@ int vmTest(); int hexPrefixTest(); int peerTest(int argc, char** argv); -#include +#include #include using namespace std; using namespace dev; diff --git a/test/rlp.cpp b/test/rlp.cpp index 963d61091..b51f3a225 100644 --- a/test/rlp.cpp +++ b/test/rlp.cpp @@ -23,9 +23,9 @@ #include #include #include "JsonSpiritHeaders.h" -#include -#include -#include +#include +#include +#include #include #include diff --git a/test/trie.cpp b/test/trie.cpp index 4ddf30a61..cdebd09fc 100644 --- a/test/trie.cpp +++ b/test/trie.cpp @@ -23,7 +23,7 @@ #include #include #include "JsonSpiritHeaders.h" -#include +#include #include "TrieHash.h" #include "MemTrie.h" #include diff --git a/test/vm.cpp b/test/vm.cpp index 2b75f0b3d..e177855cb 100644 --- a/test/vm.cpp +++ b/test/vm.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/third/CMakeLists.txt b/third/CMakeLists.txt index 3385fc265..a68b90813 100644 --- a/third/CMakeLists.txt +++ b/third/CMakeLists.txt @@ -52,7 +52,7 @@ else () endif () 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) +target_link_libraries(${EXECUTEABLE} qethereum ethereum evm ethcore secp256k1 gmp ${CRYPTOPP_LS} serpent lll evmface devcore) if (APPLE) # First have qt5 install plugins and frameworks diff --git a/third/MainWin.cpp b/third/MainWin.cpp index b8722f2d7..7bbdd721b 100644 --- a/third/MainWin.cpp +++ b/third/MainWin.cpp @@ -50,16 +50,16 @@ using dev::h160; using dev::h256; using dev::u160; using dev::u256; -using dev::eth::Address; +using dev::Address; using dev::eth::BlockInfo; using dev::eth::Client; using dev::eth::Instruction; -using dev::eth::KeyPair; +using dev::KeyPair; using dev::eth::NodeMode; using dev::eth::BlockChain; using dev::p2p::PeerInfo; using dev::RLP; -using dev::eth::Secret; +using dev::Secret; using dev::eth::Transaction; using dev::eth::Executive; @@ -291,7 +291,7 @@ void Main::eval(QString const& _js) ui->webView->page()->currentFrame()->evaluateJavaScript("___RET=(" + _js + ")"); } -QString Main::pretty(dev::eth::Address _a) const +QString Main::pretty(dev::Address _a) const { h256 n; @@ -301,7 +301,7 @@ QString Main::pretty(dev::eth::Address _a) const return fromRaw(n); } -QString Main::render(dev::eth::Address _a) const +QString Main::render(dev::Address _a) const { QString p = pretty(_a); if (!p.isNull()) diff --git a/third/MainWin.h b/third/MainWin.h index 6fc7a6a5d..76505d603 100644 --- a/third/MainWin.h +++ b/third/MainWin.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -54,7 +54,7 @@ public: dev::eth::Client* client() { return m_client.get(); } - QList const& owned() const { return m_myKeys; } + QList const& owned() const { return m_myKeys; } public slots: void note(QString _entry); @@ -79,9 +79,9 @@ signals: void poll(); private: - QString pretty(dev::eth::Address _a) const; - QString render(dev::eth::Address _a) const; - dev::eth::Address fromString(QString const& _a) const; + QString pretty(dev::Address _a) const; + QString render(dev::Address _a) const; + dev::Address fromString(QString const& _a) const; QString lookup(QString const& _n) const; void readSettings(bool _skipGeometry = false); @@ -113,7 +113,7 @@ private: std::unique_ptr m_client; - QList m_myKeys; + QList m_myKeys; std::map> m_handlers; unsigned m_nameRegFilter = (unsigned)-1; diff --git a/walleth/MainWin.cpp b/walleth/MainWin.cpp index a07230885..ade04c4fa 100644 --- a/walleth/MainWin.cpp +++ b/walleth/MainWin.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -25,15 +25,15 @@ using dev::h256; using dev::u160; using dev::u256; using dev::u256s; -using dev::eth::Address; +using dev::Address; using dev::eth::BlockInfo; using dev::eth::Client; using dev::eth::Instruction; -using dev::eth::KeyPair; +using dev::KeyPair; using dev::eth::NodeMode; using dev::p2p::PeerInfo; using dev::RLP; -using dev::eth::Secret; +using dev::Secret; using dev::eth::Transaction; // functions @@ -66,9 +66,9 @@ Main::Main(QWidget *parent) : g_qmlClient = m_client.get(); qRegisterMetaType("dev::u256"); - qRegisterMetaType("dev::eth::KeyPair"); - qRegisterMetaType("dev::eth::Secret"); - qRegisterMetaType("dev::eth::Address"); + qRegisterMetaType("dev::KeyPair"); + qRegisterMetaType("dev::Secret"); + qRegisterMetaType("dev::Address"); qRegisterMetaType("QmlAccount*"); qRegisterMetaType("QmlEthereum*"); diff --git a/walleth/MainWin.h b/walleth/MainWin.h index 0edbff226..860db8bc9 100644 --- a/walleth/MainWin.h +++ b/walleth/MainWin.h @@ -47,9 +47,9 @@ protected: virtual void timerEvent(QTimerEvent *); private: -/* QString pretty(dev::eth::Address _a) const; - QString render(dev::eth::Address _a) const; - dev::eth::Address fromString(QString const& _a) const; +/* QString pretty(dev::Address _a) const; + QString render(dev::Address _a) const; + dev::Address fromString(QString const& _a) const; */ dev::eth::State const& state() const; @@ -67,7 +67,7 @@ private: QMutex m_guiLock; QTimer* m_refresh; QTimer* m_refreshNetwork; - QVector m_myKeys; + QVector m_myKeys; bool m_keysChanged = false; int m_port; int m_idealPeers;