Browse Source

Split ethcore off into devcrypto ready for Whisper's crypto and repot namespace.

Rename ethential to devcore.
cl-refactor
Gav Wood 10 years ago
parent
commit
515a1c22a9
  1. 3
      CMakeLists.txt
  2. 2
      alethzero/CMakeLists.txt
  3. 12
      alethzero/MainWin.cpp
  4. 16
      alethzero/MainWin.h
  5. 8
      eth/CommonJS.h
  6. 7
      eth/EthStubServer.h
  7. 2
      eth/main.cpp
  8. 8
      exp/main.cpp
  9. 0
      libdevcore/All.h
  10. 4
      libdevcore/CMakeLists.txt
  11. 0
      libdevcore/Common.cpp
  12. 0
      libdevcore/Common.h
  13. 0
      libdevcore/CommonData.cpp
  14. 0
      libdevcore/CommonData.h
  15. 0
      libdevcore/CommonIO.cpp
  16. 0
      libdevcore/CommonIO.h
  17. 0
      libdevcore/Exceptions.h
  18. 0
      libdevcore/FixedHash.cpp
  19. 0
      libdevcore/FixedHash.h
  20. 0
      libdevcore/Guards.cpp
  21. 0
      libdevcore/Guards.h
  22. 0
      libdevcore/Log.cpp
  23. 0
      libdevcore/Log.h
  24. 0
      libdevcore/RLP.cpp
  25. 8
      libdevcore/RLP.h
  26. 0
      libdevcore/vector_ref.h
  27. 9
      libdevcrypto/All.h
  28. 56
      libdevcrypto/CMakeLists.txt
  29. 104
      libdevcrypto/Common.cpp
  30. 86
      libdevcrypto/Common.h
  31. 36
      libdevcrypto/CryptoHeaders.h
  32. 4
      libdevcrypto/FileSystem.cpp
  33. 0
      libdevcrypto/FileSystem.h
  34. 2
      libdevcrypto/MemoryDB.cpp
  35. 8
      libdevcrypto/MemoryDB.h
  36. 2
      libdevcrypto/OverlayDB.cpp
  37. 4
      libdevcrypto/OverlayDB.h
  38. 0
      libdevcrypto/SHA3.cpp
  39. 4
      libdevcrypto/SHA3.h
  40. 0
      libdevcrypto/TrieCommon.cpp
  41. 4
      libdevcrypto/TrieCommon.h
  42. 2
      libdevcrypto/TrieDB.cpp
  43. 6
      libdevcrypto/TrieDB.h
  44. 6
      libethcore/BlockInfo.cpp
  45. 4
      libethcore/BlockInfo.h
  46. 3
      libethcore/CMakeLists.txt
  47. 50
      libethcore/CommonEth.cpp
  48. 59
      libethcore/CommonEth.h
  49. 2
      libethcore/Dagger.cpp
  50. 2
      libethcore/Dagger.h
  51. 2
      libethcore/Exceptions.h
  52. 2
      libethereum/AccountDiff.cpp
  53. 2
      libethereum/AccountDiff.h
  54. 6
      libethereum/AddressState.h
  55. 6
      libethereum/BlockChain.cpp
  56. 4
      libethereum/BlockChain.h
  57. 2
      libethereum/BlockDetails.cpp
  58. 4
      libethereum/BlockDetails.h
  59. 2
      libethereum/BlockQueue.cpp
  60. 4
      libethereum/BlockQueue.h
  61. 1
      libethereum/CMakeLists.txt
  62. 2
      libethereum/Client.cpp
  63. 6
      libethereum/Client.h
  64. 4
      libethereum/CommonNet.h
  65. 2
      libethereum/Defaults.cpp
  66. 2
      libethereum/Defaults.h
  67. 2
      libethereum/EthereumHost.cpp
  68. 2
      libethereum/EthereumHost.h
  69. 2
      libethereum/EthereumPeer.cpp
  70. 2
      libethereum/EthereumPeer.h
  71. 2
      libethereum/Executive.h
  72. 2
      libethereum/Manifest.h
  73. 2
      libethereum/MessageFilter.cpp
  74. 4
      libethereum/MessageFilter.h
  75. 2
      libethereum/Miner.h
  76. 2
      libethereum/PastMessage.h
  77. 6
      libethereum/State.h
  78. 4
      libethereum/Transaction.cpp
  79. 4
      libethereum/Transaction.h
  80. 2
      libethereum/TransactionQueue.cpp
  81. 4
      libethereum/TransactionQueue.h
  82. 2
      libethereum/Utility.h
  83. 3
      libevm/CMakeLists.txt
  84. 2
      libevm/ExtVMFace.h
  85. 2
      libevm/FeeStructure.h
  86. 4
      libevm/VM.h
  87. 2
      libevmface/CMakeLists.txt
  88. 2
      libevmface/Instruction.cpp
  89. 4
      libevmface/Instruction.h
  90. 2
      liblll/Assembly.cpp
  91. 2
      liblll/Assembly.h
  92. 2
      liblll/CMakeLists.txt
  93. 2
      liblll/CodeFragment.cpp
  94. 2
      liblll/CodeFragment.h
  95. 2
      liblll/Compiler.h
  96. 2
      liblll/Exceptions.h
  97. 2
      liblll/Parser.h
  98. 2
      libp2p/CMakeLists.txt
  99. 6
      libp2p/Common.h
  100. 2
      libp2p/Host.cpp

3
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)

2
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

12
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<Executive>(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();

16
alethzero/MainWin.h

@ -27,7 +27,7 @@
#include <QtCore/QAbstractListModel>
#include <QtCore/QMutex>
#include <QtWidgets/QMainWindow>
#include <libethential/RLP.h>
#include <libdevcore/RLP.h>
#include <libethcore/CommonEth.h>
#include <libethereum/State.h>
#include <libqethereum/QEthereum.h>
@ -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<dev::eth::KeyPair> const& owned() const { return m_myKeys; }
QList<dev::KeyPair> 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<dev::eth::KeyPair> m_myKeys;
QList<dev::KeyPair> 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;

8
eth/CommonJS.h

@ -23,10 +23,10 @@
#pragma once
#include <string>
#include <libethential/Common.h>
#include <libethential/CommonIO.h>
#include <libethential/CommonData.h>
#include <libethential/FixedHash.h>
#include <libdevcore/Common.h>
#include <libdevcore/CommonIO.h>
#include <libdevcore/CommonData.h>
#include <libdevcore/FixedHash.h>
#include <libethcore/CommonEth.h>
namespace dev

7
eth/EthStubServer.h

@ -23,12 +23,13 @@
#include <iostream>
#include <jsonrpc/rpc.h>
#include <libdevcrypto/Common.h>
#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<dev::eth::KeyPair> _keys) { m_keys = _keys; }
void setKeys(std::vector<dev::KeyPair> _keys) { m_keys = _keys; }
private:
dev::eth::Client& m_client;
std::vector<dev::eth::KeyPair> m_keys;
std::vector<dev::KeyPair> m_keys;
Json::Value jsontypeToValue(int);
Json::Value blockJson(const std::string&);
};

2
eth/main.cpp

@ -29,7 +29,7 @@
#if ETH_JSONRPC
#include <jsonrpc/connectors/httpserver.h>
#endif
#include <libethcore/FileSystem.h>
#include <libdevcrypto/FileSystem.h>
#include <libevmface/Instruction.h>
#include <libevm/VM.h>
#include <libethereum/All.h>

8
exp/main.cpp

@ -26,10 +26,10 @@
#include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/support_utree.hpp>
#endif
#include <libethential/Log.h>
#include <libethential/Common.h>
#include <libethential/CommonData.h>
#include <libethential/RLP.h>
#include <libdevcore/Log.h>
#include <libdevcore/Common.h>
#include <libdevcore/CommonData.h>
#include <libdevcore/RLP.h>
#include <libp2p/All.h>
#include <libwhisper/WhisperPeer.h>
#if 0

0
libethential/All.h → libdevcore/All.h

4
libethential/CMakeLists.txt → 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)

0
libethential/Common.cpp → libdevcore/Common.cpp

0
libethential/Common.h → libdevcore/Common.h

0
libethential/CommonData.cpp → libdevcore/CommonData.cpp

0
libethential/CommonData.h → libdevcore/CommonData.h

0
libethential/CommonIO.cpp → libdevcore/CommonIO.cpp

0
libethential/CommonIO.h → libdevcore/CommonIO.h

0
libethential/Exceptions.h → libdevcore/Exceptions.h

0
libethential/FixedHash.cpp → libdevcore/FixedHash.cpp

0
libethential/FixedHash.h → libdevcore/FixedHash.h

0
libethential/Guards.cpp → libdevcore/Guards.cpp

0
libethential/Guards.h → libdevcore/Guards.h

0
libethential/Log.cpp → libdevcore/Log.cpp

0
libethential/Log.h → libdevcore/Log.h

0
libethential/RLP.cpp → libdevcore/RLP.cpp

8
libethential/RLP.h → libdevcore/RLP.h

@ -28,10 +28,10 @@
#include <exception>
#include <iostream>
#include <iomanip>
#include <libethential/vector_ref.h>
#include <libethential/Common.h>
#include <libethential/Exceptions.h>
#include <libethential/FixedHash.h>
#include <libdevcore/vector_ref.h>
#include <libdevcore/Common.h>
#include <libdevcore/Exceptions.h>
#include <libdevcore/FixedHash.h>
namespace dev
{

0
libethential/vector_ref.h → libdevcore/vector_ref.h

9
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"

56
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} )

104
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 <http://www.gnu.org/licenses/>.
*/
/** @file CommonEth.cpp
* @author Gav Wood <i@gavwood.com>
* @date 2014
*/
#include "Common.h"
#include <random>
#include <secp256k1/secp256k1.h>
#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<uint16_t> 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
}

86
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 <http://www.gnu.org/licenses/>.
*/
/** @file CommonEth.h
* @author Gav Wood <i@gavwood.com>
* @date 2014
*
* Ethereum-specific data structures & algorithms.
*/
#pragma once
#include <libdevcore/Common.h>
#include <libdevcore/FixedHash.h>
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;
};
}

36
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 <http://www.gnu.org/licenses/>.
*/
/** @file CryptoHeaders.h
* @author Tim Hughes <tim@twistedfury.com>
* @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 <sha.h>
#include <sha3.h>
#include <ripemd.h>
#include <secp256k1/secp256k1.h>
#pragma warning(pop)
#pragma GCC diagnostic pop

4
libethcore/FileSystem.cpp → libdevcrypto/FileSystem.cpp

@ -22,8 +22,8 @@
*/
#include "FileSystem.h"
#include <libethential/Common.h>
#include <libethential/Log.h>
#include <libdevcore/Common.h>
#include <libdevcore/Log.h>
#ifdef _WIN32
#include <shlobj.h>

0
libethcore/FileSystem.h → libdevcrypto/FileSystem.h

2
libethcore/MemoryDB.cpp → libdevcrypto/MemoryDB.cpp

@ -19,7 +19,7 @@
* @date 2014
*/
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include "MemoryDB.h"
using namespace std;
using namespace dev;

8
libethcore/MemoryDB.h → libdevcrypto/MemoryDB.h

@ -22,10 +22,10 @@
#pragma once
#include <map>
#include <libethential/Common.h>
#include <libethential/FixedHash.h>
#include <libethential/Log.h>
#include <libethential/RLP.h>
#include <libdevcore/Common.h>
#include <libdevcore/FixedHash.h>
#include <libdevcore/Log.h>
#include <libdevcore/RLP.h>
namespace dev
{

2
libethcore/OverlayDB.cpp → libdevcrypto/OverlayDB.cpp

@ -19,7 +19,7 @@
* @date 2014
*/
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include "OverlayDB.h"
using namespace std;
using namespace dev;

4
libethcore/OverlayDB.h → libdevcrypto/OverlayDB.h

@ -27,8 +27,8 @@
#pragma warning(pop)
#include <memory>
#include <libethential/Common.h>
#include <libethential/Log.h>
#include <libdevcore/Common.h>
#include <libdevcore/Log.h>
#include "MemoryDB.h"
namespace ldb = leveldb;

0
libethcore/SHA3.cpp → libdevcrypto/SHA3.cpp

4
libethcore/SHA3.h → libdevcrypto/SHA3.h

@ -24,8 +24,8 @@
#pragma once
#include <string>
#include <libethential/FixedHash.h>
#include <libethential/vector_ref.h>
#include <libdevcore/FixedHash.h>
#include <libdevcore/vector_ref.h>
namespace dev
{

0
libethcore/TrieCommon.cpp → libdevcrypto/TrieCommon.cpp

4
libethcore/TrieCommon.h → libdevcrypto/TrieCommon.h

@ -21,8 +21,8 @@
#pragma once
#include <libethential/Common.h>
#include <libethential/RLP.h>
#include <libdevcore/Common.h>
#include <libdevcore/RLP.h>
namespace dev
{

2
libethcore/TrieDB.cpp → libdevcrypto/TrieDB.cpp

@ -19,7 +19,7 @@
* @date 2014
*/
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include "TrieDB.h"
using namespace std;
using namespace dev;

6
libethcore/TrieDB.h → libdevcrypto/TrieDB.h

@ -28,9 +28,9 @@
#include <map>
#include <memory>
#include <libethential/Common.h>
#include <libethential/Log.h>
#include <libethcore/SHA3.h>
#include <libdevcore/Common.h>
#include <libdevcore/Log.h>
#include <libdevcrypto/SHA3.h>
#include "MemoryDB.h"
#include "OverlayDB.h"
#include "TrieCommon.h"

6
libethcore/BlockInfo.cpp

@ -21,9 +21,9 @@
#if !ETH_LANGUAGES
#include <libethential/Common.h>
#include <libethential/RLP.h>
#include <libethcore/TrieDB.h>
#include <libdevcore/Common.h>
#include <libdevcore/RLP.h>
#include <libdevcrypto/TrieDB.h>
#include "Dagger.h"
#include "Exceptions.h"
#include "BlockInfo.h"

4
libethcore/BlockInfo.h

@ -21,8 +21,8 @@
#pragma once
#include <libethential/Common.h>
#include <libethential/RLP.h>
#include <libdevcore/Common.h>
#include <libdevcore/RLP.h>
#include "CommonEth.h"
namespace dev

3
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})

50
libethcore/CommonEth.cpp

@ -22,7 +22,7 @@
#include "CommonEth.h"
#include <random>
#include <secp256k1/secp256k1.h>
#include <libethcore/SHA3.h>
#include <libdevcrypto/SHA3.h>
#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<uint16_t> 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
}

59
libethcore/CommonEth.h

@ -23,8 +23,9 @@
#pragma once
#include <libethential/Common.h>
#include <libethential/FixedHash.h>
#include <libdevcore/Common.h>
#include <libdevcore/FixedHash.h>
#include <libdevcrypto/Common.h>
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;
};
}
}

2
libethcore/Dagger.cpp

@ -27,7 +27,7 @@
#include <random>
#include <thread>
#include <libethcore/CryptoHeaders.h>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include "Dagger.h"
using namespace std;
using namespace std::chrono;

2
libethcore/Dagger.h

@ -23,7 +23,7 @@
#pragma once
#include <libethcore/SHA3.h>
#include <libdevcrypto/SHA3.h>
#include "CommonEth.h"
#define FAKE_DAGGER 1

2
libethcore/Exceptions.h

@ -1,6 +1,6 @@
#pragma once
#include <libethential/Exceptions.h>
#include <libdevcore/Exceptions.h>
namespace dev
{

2
libethereum/AccountDiff.cpp

@ -21,7 +21,7 @@
#include "AccountDiff.h"
#include <libethential/CommonIO.h>
#include <libdevcore/CommonIO.h>
using namespace std;
using namespace dev;
using namespace dev::eth;

2
libethereum/AccountDiff.h

@ -21,7 +21,7 @@
#pragma once
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include <libethcore/CommonEth.h>
namespace dev

6
libethereum/AddressState.h

@ -21,9 +21,9 @@
#pragma once
#include <libethential/Common.h>
#include <libethential/RLP.h>
#include <libethcore/SHA3.h>
#include <libdevcore/Common.h>
#include <libdevcore/RLP.h>
#include <libdevcrypto/SHA3.h>
namespace dev
{

6
libethereum/BlockChain.cpp

@ -22,9 +22,9 @@
#include "BlockChain.h"
#include <boost/filesystem.hpp>
#include <libethential/Common.h>
#include <libethential/RLP.h>
#include <libethcore/FileSystem.h>
#include <libdevcore/Common.h>
#include <libdevcore/RLP.h>
#include <libdevcrypto/FileSystem.h>
#include <libethcore/Exceptions.h>
#include <libethcore/Dagger.h>
#include <libethcore/BlockInfo.h>

4
libethereum/BlockChain.h

@ -27,10 +27,10 @@
#pragma warning(pop)
#include <mutex>
#include <libethential/Log.h>
#include <libdevcore/Log.h>
#include <libethcore/CommonEth.h>
#include <libethcore/BlockInfo.h>
#include <libethential/Guards.h>
#include <libdevcore/Guards.h>
#include "BlockDetails.h"
#include "AddressState.h"
#include "BlockQueue.h"

2
libethereum/BlockDetails.cpp

@ -21,7 +21,7 @@
#include "BlockDetails.h"
#include <libethential/Common.h>
#include <libdevcore/Common.h>
using namespace std;
using namespace dev;
using namespace dev::eth;

4
libethereum/BlockDetails.h

@ -26,8 +26,8 @@
#include <leveldb/db.h>
#pragma warning(pop)
#include <libethential/Log.h>
#include <libethential/RLP.h>
#include <libdevcore/Log.h>
#include <libdevcore/RLP.h>
#include "Manifest.h"
namespace ldb = leveldb;

2
libethereum/BlockQueue.cpp

@ -21,7 +21,7 @@
#include "BlockQueue.h"
#include <libethential/Log.h>
#include <libdevcore/Log.h>
#include <libethcore/Exceptions.h>
#include <libethcore/BlockInfo.h>
#include "BlockChain.h"

4
libethereum/BlockQueue.h

@ -22,9 +22,9 @@
#pragma once
#include <boost/thread.hpp>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include "libethcore/CommonEth.h"
#include <libethential/Guards.h>
#include <libdevcore/Guards.h>
namespace dev
{

1
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)

2
libethereum/Client.cpp

@ -24,7 +24,7 @@
#include <chrono>
#include <thread>
#include <boost/filesystem.hpp>
#include <libethential/Log.h>
#include <libdevcore/Log.h>
#include <libp2p/Host.h>
#include "Defaults.h"
#include "EthereumHost.h"

6
libethereum/Client.h

@ -26,9 +26,9 @@
#include <list>
#include <atomic>
#include <boost/utility.hpp>
#include <libethential/Common.h>
#include <libethential/CommonIO.h>
#include <libethential/Guards.h>
#include <libdevcore/Common.h>
#include <libdevcore/CommonIO.h>
#include <libdevcore/Guards.h>
#include <libevm/FeeStructure.h>
#include <libethcore/Dagger.h>
#include <libp2p/Common.h>

4
libethereum/CommonNet.h

@ -25,8 +25,8 @@
#include <string>
#include <chrono>
#include <libethential/Common.h>
#include <libethential/Log.h>
#include <libdevcore/Common.h>
#include <libdevcore/Log.h>
namespace dev
{

2
libethereum/Defaults.cpp

@ -21,7 +21,7 @@
#include "Defaults.h"
#include <libethcore/FileSystem.h>
#include <libdevcrypto/FileSystem.h>
using namespace std;
using namespace dev;
using namespace dev::eth;

2
libethereum/Defaults.h

@ -21,7 +21,7 @@
#pragma once
#include <libethential/Common.h>
#include <libdevcore/Common.h>
namespace dev
{

2
libethereum/EthereumHost.cpp

@ -26,7 +26,7 @@
#include <set>
#include <chrono>
#include <thread>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include <libp2p/Host.h>
#include <libp2p/Session.h>
#include <libethcore/Exceptions.h>

2
libethereum/EthereumHost.h

@ -28,7 +28,7 @@
#include <memory>
#include <utility>
#include <thread>
#include <libethential/Guards.h>
#include <libdevcore/Guards.h>
#include <libethcore/CommonEth.h>
#include <libp2p/Common.h>
#include "CommonNet.h"

2
libethereum/EthereumPeer.cpp

@ -22,7 +22,7 @@
#include "EthereumPeer.h"
#include <chrono>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include <libethcore/Exceptions.h>
#include <libp2p/Session.h>
#include "BlockChain.h"

2
libethereum/EthereumPeer.h

@ -26,7 +26,7 @@
#include <set>
#include <memory>
#include <utility>
#include <libethential/RLP.h>
#include <libdevcore/RLP.h>
#include <libethcore/CommonEth.h>
#include <libp2p/Capability.h>
#include "CommonNet.h"

2
libethereum/Executive.h

@ -22,7 +22,7 @@
#pragma once
#include <functional>
#include <libethential/Log.h>
#include <libdevcore/Log.h>
#include <libevmface/Instruction.h>
#include <libethcore/CommonEth.h>
#include <libevm/ExtVMFace.h>

2
libethereum/Manifest.h

@ -23,7 +23,7 @@
#include <iostream>
#include <sstream>
#include <libethential/RLP.h>
#include <libdevcore/RLP.h>
#include <libethcore/CommonEth.h>
namespace dev

2
libethereum/MessageFilter.cpp

@ -21,7 +21,7 @@
#include "MessageFilter.h"
#include <libethcore/SHA3.h>
#include <libdevcrypto/SHA3.h>
#include "State.h"
using namespace std;
using namespace dev;

4
libethereum/MessageFilter.h

@ -21,8 +21,8 @@
#pragma once
#include <libethential/Common.h>
#include <libethential/RLP.h>
#include <libdevcore/Common.h>
#include <libdevcore/RLP.h>
#include <libethcore/CommonEth.h>
#include "PastMessage.h"

2
libethereum/Miner.h

@ -25,7 +25,7 @@
#include <thread>
#include <list>
#include <atomic>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include <libethcore/CommonEth.h>
#include "State.h"

2
libethereum/PastMessage.h

@ -21,7 +21,7 @@
#pragma once
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include <libethcore/CommonEth.h>
#include "Manifest.h"

6
libethereum/State.h

@ -24,9 +24,9 @@
#include <array>
#include <map>
#include <unordered_map>
#include <libethential/Common.h>
#include <libethential/RLP.h>
#include <libethcore/TrieDB.h>
#include <libdevcore/Common.h>
#include <libdevcore/RLP.h>
#include <libdevcrypto/TrieDB.h>
#include <libethcore/Exceptions.h>
#include <libethcore/BlockInfo.h>
#include <libethcore/Dagger.h>

4
libethereum/Transaction.cpp

@ -20,8 +20,8 @@
*/
#include <secp256k1/secp256k1.h>
#include <libethential/vector_ref.h>
#include <libethential/Log.h>
#include <libdevcore/vector_ref.h>
#include <libdevcore/Log.h>
#include <libethcore/Exceptions.h>
#include "Transaction.h"
using namespace std;

4
libethereum/Transaction.h

@ -21,8 +21,8 @@
#pragma once
#include <libethential/RLP.h>
#include <libethcore/SHA3.h>
#include <libdevcore/RLP.h>
#include <libdevcrypto/SHA3.h>
#include <libethcore/CommonEth.h>
namespace dev

2
libethereum/TransactionQueue.cpp

@ -21,7 +21,7 @@
#include "TransactionQueue.h"
#include <libethential/Log.h>
#include <libdevcore/Log.h>
#include <libethcore/Exceptions.h>
#include "Transaction.h"
using namespace std;

4
libethereum/TransactionQueue.h

@ -22,9 +22,9 @@
#pragma once
#include <boost/thread.hpp>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include "libethcore/CommonEth.h"
#include <libethential/Guards.h>
#include <libdevcore/Guards.h>
namespace dev
{

2
libethereum/Utility.h

@ -22,7 +22,7 @@
#pragma once
#include <string>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
namespace dev
{

3
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)

2
libevm/ExtVMFace.h

@ -21,7 +21,7 @@
#pragma once
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include <libevmface/Instruction.h>
#include <libethcore/CommonEth.h>
#include <libethcore/BlockInfo.h>

2
libevm/FeeStructure.h

@ -21,7 +21,7 @@
#pragma once
#include <libethential/Common.h>
#include <libdevcore/Common.h>
namespace dev
{

4
libevm/VM.h

@ -22,10 +22,10 @@
#pragma once
#include <unordered_map>
#include <libethential/Exceptions.h>
#include <libdevcore/Exceptions.h>
#include <libethcore/CommonEth.h>
#include <libevmface/Instruction.h>
#include <libethcore/SHA3.h>
#include <libdevcrypto/SHA3.h>
#include <libethcore/BlockInfo.h>
#include "FeeStructure.h"
#include "ExtVMFace.h"

2
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)

2
libevmface/Instruction.cpp

@ -21,7 +21,7 @@
#include "Instruction.h"
#include <libethential/Common.h>
#include <libdevcore/Common.h>
using namespace std;
using namespace dev;
using namespace dev::eth;

4
libevmface/Instruction.h

@ -21,8 +21,8 @@
#pragma once
#include <libethential/Common.h>
#include <libethential/Exceptions.h>
#include <libdevcore/Common.h>
#include <libdevcore/Exceptions.h>
namespace boost { namespace spirit { class utree; } }
namespace sp = boost::spirit;

2
liblll/Assembly.cpp

@ -21,7 +21,7 @@
#include "Assembly.h"
#include <libethential/Log.h>
#include <libdevcore/Log.h>
using namespace std;
using namespace dev;

2
liblll/Assembly.h

@ -23,7 +23,7 @@
#include <iostream>
#include <sstream>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include <libevmface/Instruction.h>
#include "Exceptions.h"

2
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")

2
liblll/CodeFragment.cpp

@ -23,7 +23,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/spirit/include/support_utree.hpp>
#include <libethential/Log.h>
#include <libdevcore/Log.h>
#include <libevmface/Instruction.h>
#include "CompilerState.h"
#include "Parser.h"

2
liblll/CodeFragment.h

@ -21,7 +21,7 @@
#pragma once
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include <libevmface/Instruction.h>
#include "Assembly.h"
#include "Exceptions.h"

2
liblll/Compiler.h

@ -23,7 +23,7 @@
#include <string>
#include <vector>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
namespace dev
{

2
liblll/Exceptions.h

@ -21,7 +21,7 @@
#pragma once
#include <libethential/Exceptions.h>
#include <libdevcore/Exceptions.h>
namespace dev
{

2
liblll/Parser.h

@ -23,7 +23,7 @@
#include <string>
#include <vector>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
namespace boost { namespace spirit { class utree; } }
namespace sp = boost::spirit;

2
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})

6
libp2p/Common.h

@ -27,9 +27,9 @@
#include <boost/asio.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <chrono>
#include <libethential/Common.h>
#include <libethential/Log.h>
#include <libethential/FixedHash.h>
#include <libdevcore/Common.h>
#include <libdevcore/Log.h>
#include <libdevcore/FixedHash.h>
namespace ba = boost::asio;
namespace bi = boost::asio::ip;

2
libp2p/Host.cpp

@ -34,7 +34,7 @@
#include <set>
#include <chrono>
#include <thread>
#include <libethential/Common.h>
#include <libdevcore/Common.h>
#include <libethcore/Exceptions.h>
#include "Session.h"
#include "Capability.h"

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save