diff --git a/Ethereum.sln b/Ethereum.sln deleted file mode 100644 index b8f8fce1d..000000000 --- a/Ethereum.sln +++ /dev/null @@ -1,68 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2013 for Windows Desktop -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibEthereum", "libethereum\LibEthereum.vcxproj", "{7050C7CF-7551-48BE-8E57-92235906C13A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestMining", "test\TestMining.vcxproj", "{02DC8A9B-DEF7-403B-8AE3-EF9680937D96}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "test\Test.vcxproj", "{3F3E389B-88DE-41D5-A73B-4F6036E18B36}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cryptlib", "..\cryptopp562\cryptlib.vcxproj", "{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ethereum", "eth\Ethereum.vcxproj", "{C60C065C-2135-4B2B-AFD4-35FD7AC56B40}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7050C7CF-7551-48BE-8E57-92235906C13A}.Debug|Win32.ActiveCfg = Debug|Win32 - {7050C7CF-7551-48BE-8E57-92235906C13A}.Debug|Win32.Build.0 = Debug|Win32 - {7050C7CF-7551-48BE-8E57-92235906C13A}.Debug|x64.ActiveCfg = Debug|x64 - {7050C7CF-7551-48BE-8E57-92235906C13A}.Debug|x64.Build.0 = Debug|x64 - {7050C7CF-7551-48BE-8E57-92235906C13A}.Release|Win32.ActiveCfg = Release|Win32 - {7050C7CF-7551-48BE-8E57-92235906C13A}.Release|Win32.Build.0 = Release|Win32 - {7050C7CF-7551-48BE-8E57-92235906C13A}.Release|x64.ActiveCfg = Release|x64 - {7050C7CF-7551-48BE-8E57-92235906C13A}.Release|x64.Build.0 = Release|x64 - {02DC8A9B-DEF7-403B-8AE3-EF9680937D96}.Debug|Win32.ActiveCfg = Debug|Win32 - {02DC8A9B-DEF7-403B-8AE3-EF9680937D96}.Debug|Win32.Build.0 = Debug|Win32 - {02DC8A9B-DEF7-403B-8AE3-EF9680937D96}.Debug|x64.ActiveCfg = Debug|x64 - {02DC8A9B-DEF7-403B-8AE3-EF9680937D96}.Debug|x64.Build.0 = Debug|x64 - {02DC8A9B-DEF7-403B-8AE3-EF9680937D96}.Release|Win32.ActiveCfg = Release|Win32 - {02DC8A9B-DEF7-403B-8AE3-EF9680937D96}.Release|Win32.Build.0 = Release|Win32 - {02DC8A9B-DEF7-403B-8AE3-EF9680937D96}.Release|x64.ActiveCfg = Release|x64 - {02DC8A9B-DEF7-403B-8AE3-EF9680937D96}.Release|x64.Build.0 = Release|x64 - {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Debug|Win32.ActiveCfg = Debug|Win32 - {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Debug|Win32.Build.0 = Debug|Win32 - {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Debug|x64.ActiveCfg = Debug|x64 - {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Debug|x64.Build.0 = Debug|x64 - {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Release|Win32.ActiveCfg = Release|Win32 - {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Release|Win32.Build.0 = Release|Win32 - {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Release|x64.ActiveCfg = Release|x64 - {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Release|x64.Build.0 = Release|x64 - {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.Build.0 = Debug|Win32 - {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|x64.ActiveCfg = Debug|x64 - {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|x64.Build.0 = Debug|x64 - {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|Win32.ActiveCfg = Release|Win32 - {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|Win32.Build.0 = Release|Win32 - {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|x64.ActiveCfg = Release|x64 - {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Release|x64.Build.0 = Release|x64 - {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Debug|Win32.ActiveCfg = Debug|Win32 - {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Debug|Win32.Build.0 = Debug|Win32 - {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Debug|x64.ActiveCfg = Debug|x64 - {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Debug|x64.Build.0 = Debug|x64 - {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Release|Win32.ActiveCfg = Release|Win32 - {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Release|Win32.Build.0 = Release|Win32 - {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Release|x64.ActiveCfg = Release|x64 - {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index deb6bf26c..cefa1b9e3 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -279,7 +279,7 @@ void Main::on_connect_triggered() if (ok && s.contains(":")) { string host = s.section(":", 0, 0).toStdString(); - ushort port = s.section(":", 1).toInt(); + unsigned short port = s.section(":", 1).toInt(); m_client->connect(host, port); } } diff --git a/eth/main.cpp b/eth/main.cpp index 87b799cbe..37d600cb1 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -42,7 +42,7 @@ bytes contents(std::string const& _file) return bytes(); // get length of file: is.seekg (0, is.end); - int length = is.tellg(); + streamoff length = is.tellg(); is.seekg (0, is.beg); bytes ret(length); is.read((char*)ret.data(), length); @@ -99,9 +99,9 @@ void version() int main(int argc, char** argv) { - ushort listenPort = 30303; + unsigned short listenPort = 30303; string remoteHost; - ushort remotePort = 30303; + unsigned short remotePort = 30303; bool interactive = false; string dbPath; eth::uint mining = ~(eth::uint)0; @@ -137,13 +137,13 @@ int main(int argc, char** argv) { string arg = argv[i]; if ((arg == "-l" || arg == "--listen" || arg == "--listen-port") && i + 1 < argc) - listenPort = atoi(argv[++i]); + listenPort = (short)atoi(argv[++i]); else if ((arg == "-u" || arg == "--public-ip" || arg == "--public") && i + 1 < argc) publicIP = argv[++i]; else if ((arg == "-r" || arg == "--remote") && i + 1 < argc) remoteHost = argv[++i]; else if ((arg == "-p" || arg == "--port") && i + 1 < argc) - remotePort = atoi(argv[++i]); + remotePort = (short)atoi(argv[++i]); else if ((arg == "-n" || arg == "--upnp") && i + 1 < argc) { string m = argv[++i]; @@ -226,14 +226,14 @@ int main(int argc, char** argv) { eth::uint port; cin >> port; - c.startNetwork(port); + c.startNetwork((short)port); } else if (cmd == "connect") { string addr; eth::uint port; cin >> addr >> port; - c.connect(addr, port); + c.connect(addr, (short)port); } else if (cmd == "netstop") { diff --git a/libethereum/BlockChain.h b/libethereum/BlockChain.h index 9576b3259..9b77de24d 100644 --- a/libethereum/BlockChain.h +++ b/libethereum/BlockChain.h @@ -56,8 +56,8 @@ class Overlay; class AlreadyHaveBlock: public std::exception {}; class UnknownParent: public std::exception {}; -struct BlockChainChat: public LogChannel { static const char constexpr* name = "-B-"; static const int verbosity = 7; }; -struct BlockChainNote: public LogChannel { static const char constexpr* name = "=B="; static const int verbosity = 4; }; +struct BlockChainChat: public LogChannel { static const char* name() { return "-B-"; } static const int verbosity = 7; }; +struct BlockChainNote: public LogChannel { static const char* name() { return "=B="; } static const int verbosity = 4; }; /** * @brief Implements the blockchain database. All data this gives is disk-backed. diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index fbd2c3e2f..99565a316 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -60,7 +60,7 @@ Client::~Client() this_thread::sleep_for(chrono::milliseconds(10)); } -void Client::startNetwork(ushort _listenPort, std::string const& _seedHost, ushort _port, NodeMode _mode, unsigned _peers, string const& _publicIP, bool _upnp) +void Client::startNetwork(unsigned short _listenPort, std::string const& _seedHost, unsigned short _port, NodeMode _mode, unsigned _peers, string const& _publicIP, bool _upnp) { if (m_net) return; @@ -70,7 +70,7 @@ void Client::startNetwork(ushort _listenPort, std::string const& _seedHost, usho connect(_seedHost, _port); } -void Client::connect(std::string const& _seedHost, ushort _port) +void Client::connect(std::string const& _seedHost, unsigned short _port) { if (!m_net) return; diff --git a/libethereum/Client.h b/libethereum/Client.h index 2ec04029c..c67b41e75 100644 --- a/libethereum/Client.h +++ b/libethereum/Client.h @@ -103,12 +103,12 @@ public: /// Get information on the current peer set. std::vector peers() { return m_net ? m_net->peers() : std::vector(); } /// Same as peers().size(), but more efficient. - unsigned peerCount() const { return m_net ? m_net->peerCount() : 0; } + size_t peerCount() const { return m_net ? m_net->peerCount() : 0; } /// Start the network subsystem. - void startNetwork(ushort _listenPort = 30303, std::string const& _seedHost = std::string(), ushort _port = 30303, NodeMode _mode = NodeMode::Full, unsigned _peers = 5, std::string const& _publicIP = std::string(), bool _upnp = true); + void startNetwork(unsigned short _listenPort = 30303, std::string const& _seedHost = std::string(), unsigned short _port = 30303, NodeMode _mode = NodeMode::Full, unsigned _peers = 5, std::string const& _publicIP = std::string(), bool _upnp = true); /// Connect to a particular peer. - void connect(std::string const& _seedHost, ushort _port = 30303); + void connect(std::string const& _seedHost, unsigned short _port = 30303); /// Stop the network subsystem. void stopNetwork(); /// Get access to the peer server object. This will be null if the network isn't online. diff --git a/libethereum/Common.cpp b/libethereum/Common.cpp index 639f14d47..f5e1f9354 100644 --- a/libethereum/Common.cpp +++ b/libethereum/Common.cpp @@ -36,7 +36,9 @@ #endif #include "Exceptions.h" using namespace std; -using namespace eth; + +namespace eth +{ //#define ETH_ADDRESS_DEBUG 1 @@ -191,13 +193,13 @@ KeyPair KeyPair::create() { secp256k1_start(); static std::mt19937_64 s_eng(time(0)); - std::uniform_int_distribution d(0, 255); + std::uniform_int_distribution d(0, 255); for (int i = 0; i < 100; ++i) { h256 sec; - for (uint i = 0; i < 32; ++i) - sec[i] = d(s_eng); + for (unsigned i = 0; i < 32; ++i) + sec[i] = (byte)d(s_eng); KeyPair ret(sec); if (ret.address()) @@ -281,3 +283,5 @@ std::string eth::formatBalance(u256 _b) ret << _b << " wei"; return ret.str(); } + +} diff --git a/libethereum/Common.h b/libethereum/Common.h index ebdbb5daf..d2fee7121 100644 --- a/libethereum/Common.h +++ b/libethereum/Common.h @@ -28,6 +28,11 @@ #pragma warning(disable:4244) #endif +#ifdef _MSC_VER +#define _ALLOW_KEYWORD_MACROS +#define noexcept throw() +#endif + #include #include #include @@ -183,12 +188,12 @@ struct ThreadLocalLogName extern ThreadLocalLogName t_logThreadName; inline void setThreadName(char const* _n) { t_logThreadName.m_name.reset(new std::string(_n)); } -struct LogChannel { static const char constexpr* name = " "; static const int verbosity = 1; }; -struct LeftChannel: public LogChannel { static const char constexpr* name = "<<<"; }; -struct RightChannel: public LogChannel { static const char constexpr* name = ">>>"; }; -struct WarnChannel: public LogChannel { static const char constexpr* name = "!!!"; static const int verbosity = 0; }; -struct NoteChannel: public LogChannel { static const char constexpr* name = "***"; }; -struct DebugChannel: public LogChannel { static const char constexpr* name = "---"; static const int verbosity = 7; }; +struct LogChannel { static const char* name() { return " "; } static const int verbosity = 1; }; +struct LeftChannel: public LogChannel { static const char* name() { return "<<<"; } }; +struct RightChannel: public LogChannel { static const char* name() { return ">>>"; } }; +struct WarnChannel: public LogChannel { static const char* name() { return "!!!"; } static const int verbosity = 0; }; +struct NoteChannel: public LogChannel { static const char* name() { return "***"; } }; +struct DebugChannel: public LogChannel { static const char* name() { return "---"; } static const int verbosity = 0; }; extern int g_logVerbosity; extern std::function g_logPost; @@ -212,7 +217,7 @@ public: sstr << Id::name << " [ " << buf << " | " << *(t_logThreadName.m_name.get()) << (_term ? " ] " : ""); } } - ~LogOutputStream() { if (Id::verbosity <= g_logVerbosity) g_logPost(sstr.str(), Id::name); } + ~LogOutputStream() { if (Id::verbosity <= g_logVerbosity) g_logPost(sstr.str(), Id::name()); } template LogOutputStream& operator<<(T const& _t) { if (Id::verbosity <= g_logVerbosity) { if (_AutoSpacing && sstr.str().size() && sstr.str().back() != ' ') sstr << " "; sstr << _t; } return *this; } std::stringstream sstr; }; diff --git a/libethereum/FileSystem.cpp b/libethereum/FileSystem.cpp index f345641e1..559a58997 100644 --- a/libethereum/FileSystem.cpp +++ b/libethereum/FileSystem.cpp @@ -39,7 +39,9 @@ std::string eth::getDataDir() return (boost::filesystem::path(path) / "Ethereum").string(); else { + #ifndef _MSC_VER // todo? cwarn << "getDataDir(): SHGetSpecialFolderPathA() failed."; + #endif throw std::runtime_error("getDataDir() - SHGetSpecialFolderPathA() failed."); } #else diff --git a/libethereum/LibEthereum.props b/libethereum/LibEthereum.props deleted file mode 100644 index be1925b9a..000000000 --- a/libethereum/LibEthereum.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - $(IncludePath);../../boost_1_55_0;../../leveldb-1.15.0/include;../../cryptopp562;../../secp256k1/include - ..\build\$(ProjectName)\$(Platform)_$(Configuration)\ - ..\build\$(ProjectName)\$(Platform)_$(Configuration)\ - - - - 4100;4127;4505;4512; - Level4 - true - false - - - - \ No newline at end of file diff --git a/libethereum/LibEthereum.vcxproj.filters b/libethereum/LibEthereum.vcxproj.filters deleted file mode 100644 index 17a7b35f1..000000000 --- a/libethereum/LibEthereum.vcxproj.filters +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libethereum/PeerNetwork.cpp b/libethereum/PeerNetwork.cpp index fc01231da..add5b6638 100644 --- a/libethereum/PeerNetwork.cpp +++ b/libethereum/PeerNetwork.cpp @@ -80,7 +80,7 @@ bool eth::isPrivateAddress(bi::address _addressToCheck) return false; } -PeerSession::PeerSession(PeerServer* _s, bi::tcp::socket _socket, uint _rNId, bi::address _peerAddress, ushort _peerPort): +PeerSession::PeerSession(PeerServer* _s, bi::tcp::socket _socket, uint _rNId, bi::address _peerAddress, unsigned short _peerPort): m_server(_s), m_socket(std::move(_socket)), m_reqNetworkId(_rNId), @@ -137,7 +137,7 @@ bool PeerSession::interpret(RLP const& _r) m_networkId = _r[2].toInt(); auto clientVersion = _r[3].toString(); m_caps = _r[4].toInt(); - m_listenPort = _r[5].toInt(); + m_listenPort = _r[5].toInt(); m_id = _r[6].toHash(); clogS(NetMessageSummary) << "Hello: " << clientVersion << "V[" << m_protocolVersion << "/" << m_networkId << "]" << m_id.abridged() << showbase << hex << m_caps << dec << m_listenPort; @@ -170,12 +170,12 @@ bool PeerSession::interpret(RLP const& _r) // Grab their block chain off them. { clogS(NetAllDetail) << "Want chain. Latest:" << m_server->m_latestBlockSent << ", number:" << m_server->m_chain->details(m_server->m_latestBlockSent).number; - unsigned count = std::min(c_maxHashes, m_server->m_chain->details(m_server->m_latestBlockSent).number + 1); + uint count = std::min(c_maxHashes, m_server->m_chain->details(m_server->m_latestBlockSent).number + 1); RLPStream s; prep(s).appendList(2 + count); s << GetChainPacket; auto h = m_server->m_latestBlockSent; - for (unsigned i = 0; i < count; ++i, h = m_server->m_chain->details(h).parent) + for (uint i = 0; i < count; ++i, h = m_server->m_chain->details(h).parent) { clogS(NetAllDetail) << " " << i << ":" << h; s << h; @@ -407,12 +407,12 @@ bool PeerSession::interpret(RLP const& _r) } else { - unsigned count = std::min(c_maxHashes, m_server->m_chain->details(noGood).number); + uint count = std::min(c_maxHashes, m_server->m_chain->details(noGood).number); RLPStream s; prep(s).appendList(2 + count); s << GetChainPacket; auto h = m_server->m_chain->details(noGood).parent; - for (unsigned i = 0; i < count; ++i, h = m_server->m_chain->details(h).parent) + for (uint i = 0; i < count; ++i, h = m_server->m_chain->details(h).parent) s << h; s << c_maxBlocksAsk; sealAndSend(s); @@ -450,7 +450,7 @@ void PeerServer::seal(bytes& _b) _b[1] = 0x40; _b[2] = 0x08; _b[3] = 0x91; - uint32_t len = _b.size() - 8; + uint32_t len = (uint32_t)_b.size() - 8; _b[4] = (len >> 24) & 0xff; _b[5] = (len >> 16) & 0xff; _b[6] = (len >> 8) & 0xff; @@ -635,7 +635,7 @@ void PeerSession::doRead() }); } -PeerServer::PeerServer(std::string const& _clientVersion, BlockChain const& _ch, uint _networkId, ushort _port, NodeMode _m, string const& _publicAddress, bool _upnp): +PeerServer::PeerServer(std::string const& _clientVersion, BlockChain const& _ch, uint _networkId, unsigned short _port, NodeMode _m, string const& _publicAddress, bool _upnp): m_clientVersion(_clientVersion), m_mode(_m), m_listenPort(_port), @@ -698,10 +698,10 @@ void PeerServer::determinePublic(string const& _publicAddress, bool _upnp) auto eip = m_upnp->externalIP(); if (eip == string("0.0.0.0") && _publicAddress.empty()) - m_public = bi::tcp::endpoint(bi::address(), p); + m_public = bi::tcp::endpoint(bi::address(), (unsigned short)p); else { - m_public = bi::tcp::endpoint(bi::address::from_string(_publicAddress.empty() ? eip : _publicAddress), p); + m_public = bi::tcp::endpoint(bi::address::from_string(_publicAddress.empty() ? eip : _publicAddress), (unsigned short)p); m_addresses.push_back(m_public.address().to_v4()); } } @@ -831,7 +831,7 @@ void PeerServer::ensureAccepting() } } -void PeerServer::connect(std::string const& _addr, ushort _port) noexcept +void PeerServer::connect(std::string const& _addr, unsigned short _port) noexcept { try { diff --git a/libethereum/PeerNetwork.h b/libethereum/PeerNetwork.h index 5d44e375e..80c6b054c 100644 --- a/libethereum/PeerNetwork.h +++ b/libethereum/PeerNetwork.h @@ -40,13 +40,13 @@ bool isPrivateAddress(bi::address _addressToCheck); class BlockChain; class TransactionQueue; -struct NetWarn: public LogChannel { static const char constexpr* name = "!N!"; static const int verbosity = 0; }; -struct NetNote: public LogChannel { static const char constexpr* name = "*N*"; static const int verbosity = 1; }; -struct NetMessageSummary: public LogChannel { static const char constexpr* name = "-N-"; static const int verbosity = 2; }; -struct NetMessageDetail: public LogChannel { static const char constexpr* name = "=N="; static const int verbosity = 3; }; -struct NetAllDetail: public LogChannel { static const char constexpr* name = "=N="; static const int verbosity = 6; }; -struct NetRight: public LogChannel { static const char constexpr* name = ">N>"; static const int verbosity = 8; }; -struct NetLeft: public LogChannel { static const char constexpr* name = "N>"; } static const int verbosity = 8; }; +struct NetLeft: public LogChannel { static const char* name() { return " friend class PeerServer; public: - PeerSession(PeerServer* _server, bi::tcp::socket _socket, uint _rNId, bi::address _peerAddress, ushort _peerPort = 0); + PeerSession(PeerServer* _server, bi::tcp::socket _socket, uint _rNId, bi::address _peerAddress, unsigned short _peerPort = 0); ~PeerSession(); void start(); @@ -127,14 +127,14 @@ private: uint m_protocolVersion; uint m_networkId; uint m_reqNetworkId; - ushort m_listenPort; ///< Port that the remote client is listening on for connections. Useful for giving to peers. + unsigned short m_listenPort; ///< Port that the remote client is listening on for connections. Useful for giving to peers. uint m_caps; std::chrono::steady_clock::time_point m_ping; std::chrono::steady_clock::time_point m_connect; std::chrono::steady_clock::time_point m_disconnect; - unsigned m_rating; + uint m_rating; bool m_requireTransactions; std::set m_knownBlocks; @@ -155,13 +155,13 @@ class PeerServer public: /// Start server, listening for connections on the given port. - PeerServer(std::string const& _clientVersion, BlockChain const& _ch, uint _networkId, ushort _port, NodeMode _m = NodeMode::Full, std::string const& _publicAddress = std::string(), bool _upnp = true); + PeerServer(std::string const& _clientVersion, BlockChain const& _ch, uint _networkId, unsigned short _port, NodeMode _m = NodeMode::Full, std::string const& _publicAddress = std::string(), bool _upnp = true); /// Start server, but don't listen. PeerServer(std::string const& _clientVersion, uint _networkId, NodeMode _m = NodeMode::Full); ~PeerServer(); /// Connect to a peer explicitly. - void connect(std::string const& _addr, ushort _port = 30303) noexcept; + void connect(std::string const& _addr, unsigned short _port = 30303) noexcept; void connect(bi::tcp::endpoint const& _ep); /// Sync with the BlockChain. It might contain one of our mined blocks, we might have new candidates from the network. @@ -182,13 +182,13 @@ public: std::vector peers() const; /// Get number of peers connected; equivalent to, but faster than, peers().size(). - unsigned peerCount() const { return m_peers.size(); } + size_t peerCount() const { return m_peers.size(); } /// Ping the peers, to update the latency information. void pingAll(); /// Get the port we're listening on currently. - ushort listenPort() const { return m_public.port(); } + unsigned short listenPort() const { return m_public.port(); } bytes savePeers() const; void restorePeers(bytesConstRef _b); @@ -209,7 +209,7 @@ private: std::string m_clientVersion; NodeMode m_mode = NodeMode::Full; - ushort m_listenPort; + unsigned short m_listenPort; BlockChain const* m_chain = nullptr; ba::io_service m_ioService; diff --git a/libethereum/RLP.cpp b/libethereum/RLP.cpp index 3cc0cb5eb..d9842b447 100644 --- a/libethereum/RLP.cpp +++ b/libethereum/RLP.cpp @@ -102,9 +102,9 @@ bool RLP::isInt() const else if (n == c_rlpDataImmLenStart) return true; else if (n <= c_rlpDataIndLenZero) - return m_data[1]; + return m_data[1] != 0; else if (n < c_rlpListStart) - return m_data[1 + n - c_rlpDataIndLenZero]; + return m_data[1 + n - c_rlpDataIndLenZero] != 0; else return false; return false; @@ -176,10 +176,10 @@ void RLPStream::noteAppended(uint _itemCount) m_out.resize(os + encodeSize); memmove(m_out.data() + p + encodeSize, m_out.data() + p, os - p); if (s < c_rlpListImmLenCount) - m_out[p] = c_rlpListStart + s; + m_out[p] = (byte)(c_rlpListStart + s); else { - m_out[p] = c_rlpListIndLenZero + brs; + m_out[p] = (byte)(c_rlpListIndLenZero + brs); byte* b = &(m_out[p + brs]); for (; s; s >>= 8) *(b--) = (byte)s; @@ -189,7 +189,7 @@ void RLPStream::noteAppended(uint _itemCount) } } -RLPStream& RLPStream::appendList(unsigned _items) +RLPStream& RLPStream::appendList(uint _items) { // cdebug << "appendList(" << _items << ")"; if (_items) diff --git a/libethereum/RLP.h b/libethereum/RLP.h index df047dfb4..8c0248f61 100644 --- a/libethereum/RLP.h +++ b/libethereum/RLP.h @@ -175,7 +175,7 @@ public: std::string toStringStrict() const { if (!isData()) throw BadCast(); return payload().cropped(0, length()).toString(); } template std::vector toVector() const { std::vector ret; if (isList()) { ret.reserve(itemCount()); for (auto const& i: *this) ret.push_back((T)i); } return ret; } - template std::array toArray() const { std::array ret; if (itemCount() != N) throw BadCast(); if (isList()) for (uint i = 0; i < N; ++i) ret[i] = (T)operator[](i); return ret; } + template std::array toArray() const { if (itemCount() != N || !isList()) throw BadCast(); std::array ret; for (uint i = 0; i < N; ++i) ret[i] = (T)operator[](i); return ret; } /// Int conversion flags enum @@ -288,7 +288,7 @@ public: template RLPStream& append(std::array<_T, S> const& _s) { appendList(_s.size()); for (auto const& i: _s) append(i); return *this; } /// Appends a list. - RLPStream& appendList(unsigned _items); + RLPStream& appendList(uint _items); RLPStream& appendList(bytesConstRef _rlp); RLPStream& appendList(bytes const& _rlp) { return appendList(&_rlp); } RLPStream& appendList(RLPStream const& _s) { return appendList(&_s.out()); } diff --git a/libethereum/State.cpp b/libethereum/State.cpp index 93d9fc4d6..4761a91d9 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -44,7 +44,8 @@ #include "Dagger.h" #include "Defaults.h" using namespace std; -using namespace eth; + +namespace eth { u256 const c_stepFee = 1; u256 const c_dataFee = 20; @@ -286,7 +287,9 @@ bool State::cull(TransactionQueue& _tq) const bool ret = false; auto ts = _tq.transactions(); for (auto const& i: ts) + { if (!m_transactions.count(i.first)) + { try { Transaction t(i.second); @@ -301,6 +304,8 @@ bool State::cull(TransactionQueue& _tq) const _tq.drop(i.first); ret = true; } + } + } return ret; } @@ -310,7 +315,9 @@ bool State::sync(TransactionQueue& _tq) bool ret = false; auto ts = _tq.transactions(); for (auto const& i: ts) + { if (!m_transactions.count(i.first)) + { // don't have it yet! Execute it now. try { @@ -332,6 +339,8 @@ bool State::sync(TransactionQueue& _tq) _tq.drop(i.first); ret = true; } + } + } return ret; } @@ -1233,3 +1242,5 @@ void State::execute(Address _myAddress, Address _txSender, u256 _txValue, u256s } } } + +} diff --git a/libethereum/TrieCommon.cpp b/libethereum/TrieCommon.cpp index 7fee4af45..fedf3b095 100644 --- a/libethereum/TrieCommon.cpp +++ b/libethereum/TrieCommon.cpp @@ -110,14 +110,14 @@ std::string hexPrefixEncode(bytesConstRef _d1, uint _o1, bytesConstRef _d2, uint return ret; } -byte uniqueInUse(RLP const& _orig, byte _except) +byte uniqueInUse(RLP const& _orig, byte except) { byte used = 255; for (unsigned i = 0; i < 17; ++i) - if (i != _except && !_orig[i].isEmpty()) + if (i != except && !_orig[i].isEmpty()) { if (used == 255) - used = i; + used = (byte)i; else return 255; } diff --git a/libethereum/TrieCommon.h b/libethereum/TrieCommon.h index 4fdef1aee..99176ef8d 100644 --- a/libethereum/TrieCommon.h +++ b/libethereum/TrieCommon.h @@ -66,7 +66,7 @@ inline bool isLeaf(RLP const& _twoItem) { assert(_twoItem.isList() && _twoItem.itemCount() == 2); auto pl = _twoItem[0].payload(); - return (pl[0] & 0x20); + return (pl[0] & 0x20) != 0; } inline NibbleSlice keyOf(bytesConstRef _hpe) @@ -84,7 +84,7 @@ inline NibbleSlice keyOf(RLP const& _twoItem) return keyOf(_twoItem[0].payload()); } -byte uniqueInUse(RLP const& _orig, byte _except); +byte uniqueInUse(RLP const& _orig, byte except); std::string hexPrefixEncode(bytes const& _hexVector, bool _leaf = false, int _begin = 0, int _end = -1); std::string hexPrefixEncode(bytesConstRef _data, bool _leaf, int _beginNibble, int _endNibble, uint _offset); std::string hexPrefixEncode(bytesConstRef _d1, uint _o1, bytesConstRef _d2, uint _o2, bool _leaf); diff --git a/libethereum/TrieDB.h b/libethereum/TrieDB.h index b9ffc69d8..e2543548c 100644 --- a/libethereum/TrieDB.h +++ b/libethereum/TrieDB.h @@ -131,7 +131,7 @@ public: iterator(GenericTrieDB const* _db) { m_that = _db; - m_trail.push_back(Node{_db->node(_db->m_root), std::string(1, '\0'), 255}); // one null byte is the HPE for the empty key. + m_trail.push_back({_db->node(_db->m_root), std::string(1, '\0'), 255}); // one null byte is the HPE for the empty key. next(); } @@ -242,10 +242,13 @@ public: else { // lead-on to another node - enter child. - m_trail.push_back(m_trail.back()); - m_trail.back().key = hexPrefixEncode(keyOf(m_trail.back().key), NibbleSlice(bytesConstRef(&m_trail.back().child, 1), 1), false); - m_trail.back().rlp = m_that->deref(rlp[m_trail.back().child]); - m_trail.back().child = 255; + // fixed so that Node passed into push_back is constructed *before* m_trail is potentially resized (which invalidates back and rlp) + Node const& back = m_trail.back(); + m_trail.push_back(Node{ + m_that->deref(rlp[back.child]), + hexPrefixEncode(keyOf(back.key), NibbleSlice(bytesConstRef(&back.child, 1), 1), false), + 255 + }); break; } } @@ -727,10 +730,10 @@ template bytes GenericTrieDB::cleve(RLP const& _orig, uint _s) assert(_s && _s <= k.size()); RLPStream bottom(2); - bottom << hexPrefixEncode(k, isLeaf(_orig), _s) << _orig[1]; + bottom << hexPrefixEncode(k, isLeaf(_orig), /*ugh*/(int)_s) << _orig[1]; RLPStream top(2); - top << hexPrefixEncode(k, false, 0, _s); + top << hexPrefixEncode(k, false, 0, /*ugh*/(int)_s); streamNode(top, bottom.out()); return top.out(); diff --git a/secp256k1/impl/num.h b/secp256k1/impl/num.h index fc6d05c3d..21e3390b5 100644 --- a/secp256k1/impl/num.h +++ b/secp256k1/impl/num.h @@ -11,6 +11,8 @@ #include "num_gmp.h" #elif defined(USE_NUM_OPENSSL) #include "num_openssl.h" +#elif defined(USE_NUM_BOOST) +#include "num_boost.h" #else #error "Please select num implementation" #endif diff --git a/secp256k1/impl/num_boost.h b/secp256k1/impl/num_boost.h new file mode 100644 index 000000000..b808e3214 --- /dev/null +++ b/secp256k1/impl/num_boost.h @@ -0,0 +1,212 @@ +// Copyright (c) 2014 Tim Hughes +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef _SECP256K1_NUM_REPR_IMPL_H_ +#define _SECP256K1_NUM_REPR_IMPL_H_ +#include +#include + +void static secp256k1_num_init(secp256k1_num_t *r) +{ + *r = 0; +} + +void static secp256k1_num_free(secp256k1_num_t*) +{ +} + +void static secp256k1_num_copy(secp256k1_num_t *r, const secp256k1_num_t *a) +{ + *r = *a; +} + +int static secp256k1_num_bits(const secp256k1_num_t *a) +{ + int numLimbs = a->backend().size(); + int ret = (numLimbs - 1) * a->backend().limb_bits; + for (auto x = a->backend().limbs()[numLimbs - 1]; x; x >>= 1, ++ret); + return ret; +} + +void static secp256k1_num_get_bin(unsigned char *r, unsigned int rlen, const secp256k1_num_t *a) +{ + for (auto n = abs(*a); n; n >>= 8) + { + assert(rlen > 0); // out of space? + r[--rlen] = n.convert_to(); + } + memset(r, 0, rlen); +} + +void static secp256k1_num_set_bin(secp256k1_num_t *r, const unsigned char *a, unsigned int alen) +{ + *r = 0; + for (unsigned int i = 0; i != alen; ++i) + { + *r <<= 8; + *r |= a[i]; + } +} + +void static secp256k1_num_set_int(secp256k1_num_t *r, int a) +{ + *r = a; +} + +void static secp256k1_num_mod(secp256k1_num_t *r, const secp256k1_num_t *m) +{ + *r %= *m; +} + +void static secp256k1_num_mod_inverse(secp256k1_num_t *r, const secp256k1_num_t *n, const secp256k1_num_t *m) +{ + // http://rosettacode.org/wiki/Modular_inverse + secp256k1_num_t a = *n; + secp256k1_num_t b = *m; + secp256k1_num_t x0 = 0; + secp256k1_num_t x1 = 1; + assert(*n > 0); + assert(*m > 0); + if (b != 1) + { + secp256k1_num_t q, t; + while (a > 1) + { + boost::multiprecision::divide_qr(a, b, q, t); + a = b; b = t; + + t = x1 - q * x0; + x1 = x0; x0 = t; + } + if (x1 < 0) + { + x1 += *m; + } + } + *r = x1; + + // check result + #ifdef _DEBUG + { + typedef boost::multiprecision::number> bignum; + bignum br = *r, bn = *n, bm = *m; + assert((((bn) * (br)) % bm) == 1); + } + #endif +} + +int static secp256k1_num_is_zero(const secp256k1_num_t *a) +{ + return a->is_zero(); +} + +int static secp256k1_num_is_odd(const secp256k1_num_t *a) +{ + return boost::multiprecision::bit_test(*a, 0); +} + +int static secp256k1_num_is_neg(const secp256k1_num_t *a) +{ + return a->backend().isneg(); +} + +int static secp256k1_num_cmp(const secp256k1_num_t *a, const secp256k1_num_t *b) +{ + return a->backend().compare_unsigned(b->backend()); +} + +void static secp256k1_num_add(secp256k1_num_t *r, const secp256k1_num_t *a, const secp256k1_num_t *b) +{ + *r = (*a) + (*b); +} + +void static secp256k1_num_sub(secp256k1_num_t *r, const secp256k1_num_t *a, const secp256k1_num_t *b) +{ + *r = (*a) - (*b); +} + +void static secp256k1_num_mul(secp256k1_num_t *r, const secp256k1_num_t *a, const secp256k1_num_t *b) +{ + *r = (*a) * (*b); +} + +void static secp256k1_num_div(secp256k1_num_t *r, const secp256k1_num_t *a, const secp256k1_num_t *b) +{ + *r = (*a) / (*b); +} + +void static secp256k1_num_mod_mul(secp256k1_num_t *r, const secp256k1_num_t *a, const secp256k1_num_t *b, const secp256k1_num_t *m) +{ + secp256k1_num_mul(r, a, b); + secp256k1_num_mod(r, m); +} + +int static secp256k1_num_shift(secp256k1_num_t *r, int bits) +{ + unsigned ret = r->convert_to() & ((1 << bits) - 1); + *r >>= bits; + return ret; +} + +int static secp256k1_num_get_bit(const secp256k1_num_t *a, int pos) +{ + return boost::multiprecision::bit_test(*a, pos); +} + +void static secp256k1_num_inc(secp256k1_num_t *r) +{ + ++*r; +} + +void static secp256k1_num_set_hex(secp256k1_num_t *r, const char *a, int alen) +{ + static const unsigned char cvt[256] = { + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 1, 2, 3, 4, 5, 6,7,8,9,0,0,0,0,0,0, + 0,10,11,12,13,14,15,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0,10,11,12,13,14,15,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0, + 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0,0,0 + }; + *r = 0; + for (int i = 0; i != alen; ++i) + { + *r <<= 4; + *r |= cvt[a[i]]; + } +} + +void static secp256k1_num_get_hex(char *r, int rlen, const secp256k1_num_t *a) +{ + static const unsigned char cvt[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + for (auto n = *a; n; n >>= 4) + { + assert(rlen > 0); // out of space? + r[--rlen] = cvt[n.convert_to() & 15]; + } + memset(r, '0', rlen); +} + +void static secp256k1_num_split(secp256k1_num_t *rl, secp256k1_num_t *rh, const secp256k1_num_t *a, int bits) +{ + *rl = *a & ((secp256k1_num_t(1) << bits) - 1); + *rh = *a >> bits; +} + +void static secp256k1_num_negate(secp256k1_num_t *r) +{ + r->backend().negate(); +} + +#endif diff --git a/secp256k1/num.h b/secp256k1/num.h index b2e7462bc..3fdd8f39d 100644 --- a/secp256k1/num.h +++ b/secp256k1/num.h @@ -9,6 +9,8 @@ #include "num_gmp.h" #elif defined(USE_NUM_OPENSSL) #include "num_openssl.h" +#elif defined(USE_NUM_BOOST) +#include "num_boost.h" #else #error "Please select num implementation" #endif diff --git a/secp256k1/num_boost.h b/secp256k1/num_boost.h new file mode 100644 index 000000000..2c9e49aee --- /dev/null +++ b/secp256k1/num_boost.h @@ -0,0 +1,12 @@ +// Copyright (c) 2013 Pieter Wuille +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef _SECP256K1_NUM_REPR_ +#define _SECP256K1_NUM_REPR_ + +#include + +typedef boost::multiprecision::number> secp256k1_num_t ; + +#endif diff --git a/secp256k1/secp256k1.c b/secp256k1/secp256k1.c index ed8bf2e95..b9b57d4a4 100644 --- a/secp256k1/secp256k1.c +++ b/secp256k1/secp256k1.c @@ -8,6 +8,10 @@ #include "impl/ecmult.h" #include "impl/ecdsa.h" +#ifdef __cplusplus +extern "C" { +#endif + void secp256k1_start(void) { secp256k1_fe_start(); secp256k1_ge_start(); @@ -267,3 +271,7 @@ int secp256k1_ecdsa_privkey_import(unsigned char *seckey, const unsigned char *p secp256k1_num_free(&key); return ret; } + +#ifdef __cplusplus +} +#endif diff --git a/secp256k1/tests.c b/secp256k1/tests.c new file mode 100644 index 000000000..26c894e2e --- /dev/null +++ b/secp256k1/tests.c @@ -0,0 +1,470 @@ +// Copyright (c) 2013 Pieter Wuille +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#if defined HAVE_CONFIG_H +#include "libsecp256k1-config.h" +#endif + +#include +#include + +#include "impl/num.h" +#include "impl/field.h" +#include "impl/group.h" +#include "impl/ecmult.h" +#include "impl/ecdsa.h" +#include "impl/util.h" + +#ifdef ENABLE_OPENSSL_TESTS +#include "openssl/bn.h" +#include "openssl/ec.h" +#include "openssl/ecdsa.h" +#include "openssl/obj_mac.h" +#endif + +static int count = 100; + +/***** NUM TESTS *****/ + +void random_num_negate(secp256k1_num_t *num) { + if (secp256k1_rand32() & 1) + secp256k1_num_negate(num); +} + +void random_num_order_test(secp256k1_num_t *num) { + do { + unsigned char b32[32]; + secp256k1_rand256_test(b32); + secp256k1_num_set_bin(num, b32, 32); + if (secp256k1_num_is_zero(num)) + continue; + if (secp256k1_num_cmp(num, &secp256k1_ge_consts->order) >= 0) + continue; + break; + } while(1); +} + +void random_num_order(secp256k1_num_t *num) { + do { + unsigned char b32[32]; + secp256k1_rand256(b32); + secp256k1_num_set_bin(num, b32, 32); + if (secp256k1_num_is_zero(num)) + continue; + if (secp256k1_num_cmp(num, &secp256k1_ge_consts->order) >= 0) + continue; + break; + } while(1); +} + +void test_num_copy_inc_cmp() { + secp256k1_num_t n1,n2; + secp256k1_num_init(&n1); + secp256k1_num_init(&n2); + random_num_order(&n1); + secp256k1_num_copy(&n2, &n1); + assert(secp256k1_num_cmp(&n1, &n2) == 0); + assert(secp256k1_num_cmp(&n2, &n1) == 0); + secp256k1_num_inc(&n2); + assert(secp256k1_num_cmp(&n1, &n2) != 0); + assert(secp256k1_num_cmp(&n2, &n1) != 0); + secp256k1_num_free(&n1); + secp256k1_num_free(&n2); +} + + +void test_num_get_set_hex() { + secp256k1_num_t n1,n2; + secp256k1_num_init(&n1); + secp256k1_num_init(&n2); + random_num_order_test(&n1); + char c[64]; + secp256k1_num_get_hex(c, 64, &n1); + secp256k1_num_set_hex(&n2, c, 64); + assert(secp256k1_num_cmp(&n1, &n2) == 0); + for (int i=0; i<64; i++) { + // check whether the lower 4 bits correspond to the last hex character + int low1 = secp256k1_num_shift(&n1, 4); + int lowh = c[63]; + int low2 = (lowh>>6)*9+(lowh-'0')&15; + assert(low1 == low2); + // shift bits off the hex representation, and compare + memmove(c+1, c, 63); + c[0] = '0'; + secp256k1_num_set_hex(&n2, c, 64); + assert(secp256k1_num_cmp(&n1, &n2) == 0); + } + secp256k1_num_free(&n2); + secp256k1_num_free(&n1); +} + +void test_num_get_set_bin() { + secp256k1_num_t n1,n2; + secp256k1_num_init(&n1); + secp256k1_num_init(&n2); + random_num_order_test(&n1); + unsigned char c[32]; + secp256k1_num_get_bin(c, 32, &n1); + secp256k1_num_set_bin(&n2, c, 32); + assert(secp256k1_num_cmp(&n1, &n2) == 0); + for (int i=0; i<32; i++) { + // check whether the lower 8 bits correspond to the last byte + int low1 = secp256k1_num_shift(&n1, 8); + int low2 = c[31]; + assert(low1 == low2); + // shift bits off the byte representation, and compare + memmove(c+1, c, 31); + c[0] = 0; + secp256k1_num_set_bin(&n2, c, 32); + assert(secp256k1_num_cmp(&n1, &n2) == 0); + } + secp256k1_num_free(&n2); + secp256k1_num_free(&n1); +} + +void run_num_int() { + secp256k1_num_t n1; + secp256k1_num_init(&n1); + for (int i=-255; i<256; i++) { + unsigned char c1[3] = {}; + c1[2] = abs(i); + unsigned char c2[3] = {0x11,0x22,0x33}; + secp256k1_num_set_int(&n1, i); + secp256k1_num_get_bin(c2, 3, &n1); + assert(memcmp(c1, c2, 3) == 0); + } + secp256k1_num_free(&n1); +} + +void test_num_negate() { + secp256k1_num_t n1; + secp256k1_num_t n2; + secp256k1_num_init(&n1); + secp256k1_num_init(&n2); + random_num_order_test(&n1); // n1 = R + random_num_negate(&n1); + secp256k1_num_copy(&n2, &n1); // n2 = R + secp256k1_num_sub(&n1, &n2, &n1); // n1 = n2-n1 = 0 + assert(secp256k1_num_is_zero(&n1)); + secp256k1_num_copy(&n1, &n2); // n1 = R + secp256k1_num_negate(&n1); // n1 = -R + assert(!secp256k1_num_is_zero(&n1)); + secp256k1_num_add(&n1, &n2, &n1); // n1 = n2+n1 = 0 + assert(secp256k1_num_is_zero(&n1)); + secp256k1_num_copy(&n1, &n2); // n1 = R + secp256k1_num_negate(&n1); // n1 = -R + assert(secp256k1_num_is_neg(&n1) != secp256k1_num_is_neg(&n2)); + secp256k1_num_negate(&n1); // n1 = R + assert(secp256k1_num_cmp(&n1, &n2) == 0); + assert(secp256k1_num_is_neg(&n1) == secp256k1_num_is_neg(&n2)); + secp256k1_num_free(&n2); + secp256k1_num_free(&n1); +} + +void test_num_add_sub() { + secp256k1_num_t n1; + secp256k1_num_t n2; + secp256k1_num_init(&n1); + secp256k1_num_init(&n2); + random_num_order_test(&n1); // n1 = R1 + random_num_negate(&n1); + random_num_order_test(&n2); // n2 = R2 + random_num_negate(&n2); + secp256k1_num_t n1p2, n2p1, n1m2, n2m1; + secp256k1_num_init(&n1p2); + secp256k1_num_init(&n2p1); + secp256k1_num_init(&n1m2); + secp256k1_num_init(&n2m1); + secp256k1_num_add(&n1p2, &n1, &n2); // n1p2 = R1 + R2 + secp256k1_num_add(&n2p1, &n2, &n1); // n2p1 = R2 + R1 + secp256k1_num_sub(&n1m2, &n1, &n2); // n1m2 = R1 - R2 + secp256k1_num_sub(&n2m1, &n2, &n1); // n2m1 = R2 - R1 + assert(secp256k1_num_cmp(&n1p2, &n2p1) == 0); + assert(secp256k1_num_cmp(&n1p2, &n1m2) != 0); + secp256k1_num_negate(&n2m1); // n2m1 = -R2 + R1 + assert(secp256k1_num_cmp(&n2m1, &n1m2) == 0); + assert(secp256k1_num_cmp(&n2m1, &n1) != 0); + secp256k1_num_add(&n2m1, &n2m1, &n2); // n2m1 = -R2 + R1 + R2 = R1 + assert(secp256k1_num_cmp(&n2m1, &n1) == 0); + assert(secp256k1_num_cmp(&n2p1, &n1) != 0); + secp256k1_num_sub(&n2p1, &n2p1, &n2); // n2p1 = R2 + R1 - R2 = R1 + assert(secp256k1_num_cmp(&n2p1, &n1) == 0); + secp256k1_num_free(&n2m1); + secp256k1_num_free(&n1m2); + secp256k1_num_free(&n2p1); + secp256k1_num_free(&n1p2); + secp256k1_num_free(&n2); + secp256k1_num_free(&n1); +} + +void run_num_smalltests() { + for (int i=0; i<100*count; i++) { + test_num_copy_inc_cmp(); + test_num_get_set_hex(); + test_num_get_set_bin(); + test_num_negate(); + test_num_add_sub(); + } + run_num_int(); +} + +void run_ecmult_chain() { + // random starting point A (on the curve) + secp256k1_fe_t ax; secp256k1_fe_set_hex(&ax, "8b30bbe9ae2a990696b22f670709dff3727fd8bc04d3362c6c7bf458e2846004", 64); + secp256k1_fe_t ay; secp256k1_fe_set_hex(&ay, "a357ae915c4a65281309edf20504740f0eb3343990216b4f81063cb65f2f7e0f", 64); + secp256k1_gej_t a; secp256k1_gej_set_xy(&a, &ax, &ay); + // two random initial factors xn and gn + secp256k1_num_t xn; + secp256k1_num_init(&xn); + secp256k1_num_set_hex(&xn, "84cc5452f7fde1edb4d38a8ce9b1b84ccef31f146e569be9705d357a42985407", 64); + secp256k1_num_t gn; + secp256k1_num_init(&gn); + secp256k1_num_set_hex(&gn, "a1e58d22553dcd42b23980625d4c57a96e9323d42b3152e5ca2c3990edc7c9de", 64); + // two small multipliers to be applied to xn and gn in every iteration: + secp256k1_num_t xf; + secp256k1_num_init(&xf); + secp256k1_num_set_hex(&xf, "1337", 4); + secp256k1_num_t gf; + secp256k1_num_init(&gf); + secp256k1_num_set_hex(&gf, "7113", 4); + // accumulators with the resulting coefficients to A and G + secp256k1_num_t ae; + secp256k1_num_init(&ae); + secp256k1_num_set_int(&ae, 1); + secp256k1_num_t ge; + secp256k1_num_init(&ge); + secp256k1_num_set_int(&ge, 0); + // the point being computed + secp256k1_gej_t x = a; + const secp256k1_num_t *order = &secp256k1_ge_consts->order; + for (int i=0; i<200*count; i++) { + // in each iteration, compute X = xn*X + gn*G; + secp256k1_ecmult(&x, &x, &xn, &gn); + // also compute ae and ge: the actual accumulated factors for A and G + // if X was (ae*A+ge*G), xn*X + gn*G results in (xn*ae*A + (xn*ge+gn)*G) + secp256k1_num_mod_mul(&ae, &ae, &xn, order); + secp256k1_num_mod_mul(&ge, &ge, &xn, order); + secp256k1_num_add(&ge, &ge, &gn); + secp256k1_num_mod(&ge, order); + // modify xn and gn + secp256k1_num_mod_mul(&xn, &xn, &xf, order); + secp256k1_num_mod_mul(&gn, &gn, &gf, order); + + // verify + if (i == 19999) { + char res[132]; int resl = 132; + secp256k1_gej_get_hex(res, &resl, &x); + assert(strcmp(res, "(D6E96687F9B10D092A6F35439D86CEBEA4535D0D409F53586440BD74B933E830,B95CBCA2C77DA786539BE8FD53354D2D3B4F566AE658045407ED6015EE1B2A88)") == 0); + } + } + // redo the computation, but directly with the resulting ae and ge coefficients: + secp256k1_gej_t x2; secp256k1_ecmult(&x2, &a, &ae, &ge); + char res[132]; int resl = 132; + char res2[132]; int resl2 = 132; + secp256k1_gej_get_hex(res, &resl, &x); + secp256k1_gej_get_hex(res2, &resl2, &x2); + assert(strcmp(res, res2) == 0); + assert(strlen(res) == 131); + secp256k1_num_free(&xn); + secp256k1_num_free(&gn); + secp256k1_num_free(&xf); + secp256k1_num_free(&gf); + secp256k1_num_free(&ae); + secp256k1_num_free(&ge); +} + +void test_point_times_order(const secp256k1_gej_t *point) { + // either the point is not on the curve, or multiplying it by the order results in O + if (!secp256k1_gej_is_valid(point)) + return; + + const secp256k1_num_t *order = &secp256k1_ge_consts->order; + secp256k1_num_t zero; + secp256k1_num_init(&zero); + secp256k1_num_set_int(&zero, 0); + secp256k1_gej_t res; + secp256k1_ecmult(&res, point, order, order); // calc res = order * point + order * G; + assert(secp256k1_gej_is_infinity(&res)); + secp256k1_num_free(&zero); +} + +void run_point_times_order() { + secp256k1_fe_t x; secp256k1_fe_set_hex(&x, "02", 2); + for (int i=0; i<500; i++) { + secp256k1_ge_t p; secp256k1_ge_set_xo(&p, &x, 1); + secp256k1_gej_t j; secp256k1_gej_set_ge(&j, &p); + test_point_times_order(&j); + secp256k1_fe_sqr(&x, &x); + } + char c[65]; int cl=65; + secp256k1_fe_get_hex(c, &cl, &x); + assert(strcmp(c, "7603CB59B0EF6C63FE6084792A0C378CDB3233A80F8A9A09A877DEAD31B38C45") == 0); +} + +void test_wnaf(const secp256k1_num_t *number, int w) { + secp256k1_num_t x, two, t; + secp256k1_num_init(&x); + secp256k1_num_init(&two); + secp256k1_num_init(&t); + secp256k1_num_set_int(&x, 0); + secp256k1_num_set_int(&two, 2); + int wnaf[257]; + int bits = secp256k1_ecmult_wnaf(wnaf, number, w); + int zeroes = -1; + for (int i=bits-1; i>=0; i--) { + secp256k1_num_mul(&x, &x, &two); + int v = wnaf[i]; + if (v) { + assert(zeroes == -1 || zeroes >= w-1); // check that distance between non-zero elements is at least w-1 + zeroes=0; + assert((v & 1) == 1); // check non-zero elements are odd + assert(v <= (1 << (w-1)) - 1); // check range below + assert(v >= -(1 << (w-1)) - 1); // check range above + } else { + assert(zeroes != -1); // check that no unnecessary zero padding exists + zeroes++; + } + secp256k1_num_set_int(&t, v); + secp256k1_num_add(&x, &x, &t); + } + assert(secp256k1_num_cmp(&x, number) == 0); // check that wnaf represents number + secp256k1_num_free(&x); + secp256k1_num_free(&two); + secp256k1_num_free(&t); +} + +void run_wnaf() { + secp256k1_num_t n; + secp256k1_num_init(&n); + for (int i=0; i 1) + count = strtol(argv[1], NULL, 0)*47; + + printf("test count = %i\n", count); + + // initialize + secp256k1_fe_start(); + secp256k1_ge_start(); + secp256k1_ecmult_start(); + + // num tests + run_num_smalltests(); + + // ecmult tests + run_wnaf(); + run_point_times_order(); + run_ecmult_chain(); + + // ecdsa tests + run_ecdsa_sign_verify(); +#ifdef ENABLE_OPENSSL_TESTS + run_ecdsa_openssl(); +#endif + + // shutdown + secp256k1_ecmult_stop(); + secp256k1_ge_stop(); + secp256k1_fe_stop(); + return 0; +} diff --git a/test/crypto.cpp b/test/crypto.cpp index d01ccee08..3d565dd73 100644 --- a/test/crypto.cpp +++ b/test/crypto.cpp @@ -87,7 +87,7 @@ int cryptoTest() ret = secp256k1_ecdsa_pubkey_create(pubkey.data(), &pubkeylen, privkey.data(), 1); pubkey.resize(pubkeylen); - int good = secp256k1_ecdsa_pubkey_verify(pubkey.data(), pubkey.size()); + int good = secp256k1_ecdsa_pubkey_verify(pubkey.data(), (int)pubkey.size()); cout << "PUB: " << dec << ret << " " << pubkeylen << " " << asHex(pubkey) << (good ? " GOOD" : " BAD") << endl; } @@ -99,12 +99,12 @@ int cryptoTest() cout << asHex(hmsg) << endl; cout << asHex(privkey) << endl; cout << hex << nonce << dec << endl; - int ret = secp256k1_ecdsa_sign_compact((byte const*)hmsg.data(), hmsg.size(), sig.data(), privkey.data(), (byte const*)&nonce, &v); + int ret = secp256k1_ecdsa_sign_compact((byte const*)hmsg.data(), (int)hmsg.size(), sig.data(), privkey.data(), (byte const*)&nonce, &v); cout << "MYSIG: " << dec << ret << " " << sig.size() << " " << asHex(sig) << " " << v << endl; bytes pubkey(65); int pubkeylen = 65; - ret = secp256k1_ecdsa_recover_compact((byte const*)hmsg.data(), hmsg.size(), (byte const*)sig.data(), pubkey.data(), &pubkeylen, 0, v); + ret = secp256k1_ecdsa_recover_compact((byte const*)hmsg.data(), (int)hmsg.size(), (byte const*)sig.data(), pubkey.data(), &pubkeylen, 0, v); pubkey.resize(pubkeylen); cout << "MYREC: " << dec << ret << " " << pubkeylen << " " << asHex(pubkey) << endl; } @@ -112,7 +112,7 @@ int cryptoTest() { bytes pubkey(65); int pubkeylen = 65; - int ret = secp256k1_ecdsa_recover_compact((byte const*)hmsg.data(), hmsg.size(), (byte const*)sig64.data(), pubkey.data(), &pubkeylen, 0, (int)t.vrs.v - 27); + int ret = secp256k1_ecdsa_recover_compact((byte const*)hmsg.data(), (int)hmsg.size(), (byte const*)sig64.data(), pubkey.data(), &pubkeylen, 0, (int)t.vrs.v - 27); pubkey.resize(pubkeylen); cout << "RECPUB: " << dec << ret << " " << pubkeylen << " " << asHex(pubkey) << endl; cout << "SENDER: " << hex << low160(eth::sha3(bytesConstRef(&pubkey).cropped(1))) << dec << endl; diff --git a/test/dagger.cpp b/test/dagger.cpp index ba2d143ac..1a31f8a36 100644 --- a/test/dagger.cpp +++ b/test/dagger.cpp @@ -30,19 +30,17 @@ int daggerTest() { // Test dagger { - Dagger d; auto s = steady_clock::now(); - cout << hex << d.eval((h256)1, (h256)0); + cout << hex << Dagger().eval((h256)1, (h256)0); cout << " " << dec << duration_cast(steady_clock::now() - s).count() << " ms" << endl; - cout << hex << d.eval((h256)1, (h256)1); + cout << hex << Dagger().eval((h256)1, (h256)1); cout << " " << dec << duration_cast(steady_clock::now() - s).count() << " ms" << endl; } { - Dagger d; auto s = steady_clock::now(); - cout << hex << d.eval((h256)1, (h256)0); + cout << hex << Dagger().eval((h256)1, (h256)0); cout << " " << dec << duration_cast(steady_clock::now() - s).count() << " ms" << endl; - cout << hex << d.eval((h256)1, (h256)1); + cout << hex << Dagger().eval((h256)1, (h256)1); cout << " " << dec << duration_cast(steady_clock::now() - s).count() << " ms" << endl; } return 0; diff --git a/test/main.cpp b/test/main.cpp index dc6faa2db..ed0ea76e7 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -34,7 +34,7 @@ int peerTest(int argc, char** argv); #include using namespace eth; -int main(int argc, char** argv) +int main(int, char**) { /* RLPStream s; BlockInfo::genesis().fillStream(s, false); diff --git a/test/peer.cpp b/test/peer.cpp index 3f97b69da..6dfe363fa 100644 --- a/test/peer.cpp +++ b/test/peer.cpp @@ -38,11 +38,11 @@ int peerTest(int argc, char** argv) { string arg = argv[i]; if (arg == "-l" && i + 1 < argc) - listenPort = atoi(argv[++i]); + listenPort = (short)atoi(argv[++i]); else if (arg == "-r" && i + 1 < argc) remoteHost = argv[++i]; else if (arg == "-p" && i + 1 < argc) - remotePort = atoi(argv[++i]); + remotePort = (short)atoi(argv[++i]); else remoteHost = argv[i]; } diff --git a/test/trie.cpp b/test/trie.cpp index 85416c2c1..5cce3d0f4 100644 --- a/test/trie.cpp +++ b/test/trie.cpp @@ -27,6 +27,11 @@ using namespace std; using namespace eth; +inline h256 stringMapHash256(StringMap const& _s) +{ + return hash256(_s); +} + int trieTest() { { @@ -42,13 +47,13 @@ int trieTest() cout << t; cout << m; cout << t.root() << endl; - cout << hash256({{"test", "test"}}) << endl; + cout << stringMapHash256({{"test", "test"}}) << endl; t.insert(string("tesa"), string("testy")); cout << t; cout << m; cout << t.root() << endl; - cout << hash256({{"test", "test"}, {"te", "testy"}}) << endl; + cout << stringMapHash256({{"test", "test"}, {"te", "testy"}}) << endl; cout << t.at(string("test")) << endl; cout << t.at(string("te")) << endl; cout << t.at(string("t")) << endl; @@ -56,7 +61,7 @@ int trieTest() t.remove(string("te")); cout << m; cout << t.root() << endl; - cout << hash256({{"test", "test"}}) << endl; + cout << stringMapHash256({{"test", "test"}}) << endl; t.remove(string("test")); cout << m; @@ -72,7 +77,7 @@ int trieTest() cout << t; cout << m; cout << t.root() << endl; - cout << hash256({{"b", "B"}, {"a", "A"}}) << endl; + cout << stringMapHash256({{"b", "B"}, {"a", "A"}}) << endl; cout << RLP(rlp256({{"b", "B"}, {"a", "A"}})) << endl; } { @@ -89,7 +94,7 @@ int trieTest() cout << RLP(t.rlp()) << endl; } { - cout << hex << hash256({{"dog", "puppy"}, {"doe", "reindeer"}}) << endl; + cout << hex << stringMapHash256({{"dog", "puppy"}, {"doe", "reindeer"}}) << endl; MemTrie t; t.insert("dog", "puppy"); t.insert("doe", "reindeer"); diff --git a/test/vm.cpp b/test/vm.cpp index 55b8d79a2..a6901afe6 100644 --- a/test/vm.cpp +++ b/test/vm.cpp @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -38,10 +39,11 @@ public: { c_genesisDifficulty = (u256)1; + string tmpDir = (boost::filesystem::temp_directory_path() / "vmTest").string(); KeyPair p = KeyPair::create(); - Overlay o(State::openDB("/tmp/vmTest", true)); + Overlay o(State::openDB(tmpDir, true)); State s(p.address(), o); - BlockChain bc("/tmp/vmTest", true); + BlockChain bc(tmpDir, true); cout << s; diff --git a/windows/Ethereum.sln b/windows/Ethereum.sln new file mode 100644 index 000000000..f489ede53 --- /dev/null +++ b/windows/Ethereum.sln @@ -0,0 +1,111 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libs", "Libs", "{988F2383-FA1D-408B-BCF6-C0EE7AB0A560}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{6838FA95-01BF-4FF7-914C-FC209B81406E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibEthereum", "LibEthereum.vcxproj", "{826E68CB-D3EE-4A8A-B540-59A8C3F38D4F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibLevelDB", "LibLevelDB.vcxproj", "{27014763-955D-486B-9BA7-69872192E6F4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibSecp256k1", "LibSecp256k1.vcxproj", "{1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ethereum", "Ethereum.vcxproj", "{C60C065C-2135-4B2B-AFD4-35FD7AC56B40}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSecp256k1", "TestSecp256k1.vcxproj", "{3BF049F8-AF7E-4E1C-9627-3E94C887AF24}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestEthereum", "TestEthereum.vcxproj", "{3F3E389B-88DE-41D5-A73B-4F6036E18B36}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibCryptoPP", "LibCryptoPP.vcxproj", "{1CC213A4-3482-4211-B47B-172E90DAC7DE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibMiniUPnPc", "LibMiniUPnPc.vcxproj", "{1B1CA20E-39C3-4D9B-AC37-3783048E6672}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {826E68CB-D3EE-4A8A-B540-59A8C3F38D4F}.Debug|Win32.ActiveCfg = Debug|Win32 + {826E68CB-D3EE-4A8A-B540-59A8C3F38D4F}.Debug|Win32.Build.0 = Debug|Win32 + {826E68CB-D3EE-4A8A-B540-59A8C3F38D4F}.Debug|x64.ActiveCfg = Debug|x64 + {826E68CB-D3EE-4A8A-B540-59A8C3F38D4F}.Debug|x64.Build.0 = Debug|x64 + {826E68CB-D3EE-4A8A-B540-59A8C3F38D4F}.Release|Win32.ActiveCfg = Release|Win32 + {826E68CB-D3EE-4A8A-B540-59A8C3F38D4F}.Release|Win32.Build.0 = Release|Win32 + {826E68CB-D3EE-4A8A-B540-59A8C3F38D4F}.Release|x64.ActiveCfg = Release|x64 + {826E68CB-D3EE-4A8A-B540-59A8C3F38D4F}.Release|x64.Build.0 = Release|x64 + {27014763-955D-486B-9BA7-69872192E6F4}.Debug|Win32.ActiveCfg = Debug|Win32 + {27014763-955D-486B-9BA7-69872192E6F4}.Debug|Win32.Build.0 = Debug|Win32 + {27014763-955D-486B-9BA7-69872192E6F4}.Debug|x64.ActiveCfg = Debug|x64 + {27014763-955D-486B-9BA7-69872192E6F4}.Debug|x64.Build.0 = Debug|x64 + {27014763-955D-486B-9BA7-69872192E6F4}.Release|Win32.ActiveCfg = Release|Win32 + {27014763-955D-486B-9BA7-69872192E6F4}.Release|Win32.Build.0 = Release|Win32 + {27014763-955D-486B-9BA7-69872192E6F4}.Release|x64.ActiveCfg = Release|x64 + {27014763-955D-486B-9BA7-69872192E6F4}.Release|x64.Build.0 = Release|x64 + {1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA}.Debug|Win32.ActiveCfg = Debug|Win32 + {1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA}.Debug|Win32.Build.0 = Debug|Win32 + {1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA}.Debug|x64.ActiveCfg = Debug|x64 + {1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA}.Debug|x64.Build.0 = Debug|x64 + {1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA}.Release|Win32.ActiveCfg = Release|Win32 + {1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA}.Release|Win32.Build.0 = Release|Win32 + {1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA}.Release|x64.ActiveCfg = Release|x64 + {1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA}.Release|x64.Build.0 = Release|x64 + {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Debug|Win32.ActiveCfg = Debug|Win32 + {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Debug|Win32.Build.0 = Debug|Win32 + {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Debug|x64.ActiveCfg = Debug|x64 + {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Debug|x64.Build.0 = Debug|x64 + {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Release|Win32.ActiveCfg = Release|Win32 + {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Release|Win32.Build.0 = Release|Win32 + {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Release|x64.ActiveCfg = Release|x64 + {C60C065C-2135-4B2B-AFD4-35FD7AC56B40}.Release|x64.Build.0 = Release|x64 + {3BF049F8-AF7E-4E1C-9627-3E94C887AF24}.Debug|Win32.ActiveCfg = Debug|Win32 + {3BF049F8-AF7E-4E1C-9627-3E94C887AF24}.Debug|Win32.Build.0 = Debug|Win32 + {3BF049F8-AF7E-4E1C-9627-3E94C887AF24}.Debug|x64.ActiveCfg = Debug|x64 + {3BF049F8-AF7E-4E1C-9627-3E94C887AF24}.Debug|x64.Build.0 = Debug|x64 + {3BF049F8-AF7E-4E1C-9627-3E94C887AF24}.Release|Win32.ActiveCfg = Release|Win32 + {3BF049F8-AF7E-4E1C-9627-3E94C887AF24}.Release|Win32.Build.0 = Release|Win32 + {3BF049F8-AF7E-4E1C-9627-3E94C887AF24}.Release|x64.ActiveCfg = Release|x64 + {3BF049F8-AF7E-4E1C-9627-3E94C887AF24}.Release|x64.Build.0 = Release|x64 + {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Debug|Win32.ActiveCfg = Debug|Win32 + {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Debug|Win32.Build.0 = Debug|Win32 + {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Debug|x64.ActiveCfg = Debug|x64 + {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Debug|x64.Build.0 = Debug|x64 + {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Release|Win32.ActiveCfg = Release|Win32 + {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Release|Win32.Build.0 = Release|Win32 + {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Release|x64.ActiveCfg = Release|x64 + {3F3E389B-88DE-41D5-A73B-4F6036E18B36}.Release|x64.Build.0 = Release|x64 + {1CC213A4-3482-4211-B47B-172E90DAC7DE}.Debug|Win32.ActiveCfg = Debug|Win32 + {1CC213A4-3482-4211-B47B-172E90DAC7DE}.Debug|Win32.Build.0 = Debug|Win32 + {1CC213A4-3482-4211-B47B-172E90DAC7DE}.Debug|x64.ActiveCfg = Debug|x64 + {1CC213A4-3482-4211-B47B-172E90DAC7DE}.Debug|x64.Build.0 = Debug|x64 + {1CC213A4-3482-4211-B47B-172E90DAC7DE}.Release|Win32.ActiveCfg = Release|Win32 + {1CC213A4-3482-4211-B47B-172E90DAC7DE}.Release|Win32.Build.0 = Release|Win32 + {1CC213A4-3482-4211-B47B-172E90DAC7DE}.Release|x64.ActiveCfg = Release|x64 + {1CC213A4-3482-4211-B47B-172E90DAC7DE}.Release|x64.Build.0 = Release|x64 + {1B1CA20E-39C3-4D9B-AC37-3783048E6672}.Debug|Win32.ActiveCfg = Debug|Win32 + {1B1CA20E-39C3-4D9B-AC37-3783048E6672}.Debug|Win32.Build.0 = Debug|Win32 + {1B1CA20E-39C3-4D9B-AC37-3783048E6672}.Debug|x64.ActiveCfg = Debug|x64 + {1B1CA20E-39C3-4D9B-AC37-3783048E6672}.Debug|x64.Build.0 = Debug|x64 + {1B1CA20E-39C3-4D9B-AC37-3783048E6672}.Release|Win32.ActiveCfg = Release|Win32 + {1B1CA20E-39C3-4D9B-AC37-3783048E6672}.Release|Win32.Build.0 = Release|Win32 + {1B1CA20E-39C3-4D9B-AC37-3783048E6672}.Release|x64.ActiveCfg = Release|x64 + {1B1CA20E-39C3-4D9B-AC37-3783048E6672}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {826E68CB-D3EE-4A8A-B540-59A8C3F38D4F} = {988F2383-FA1D-408B-BCF6-C0EE7AB0A560} + {27014763-955D-486B-9BA7-69872192E6F4} = {988F2383-FA1D-408B-BCF6-C0EE7AB0A560} + {1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA} = {988F2383-FA1D-408B-BCF6-C0EE7AB0A560} + {1CC213A4-3482-4211-B47B-172E90DAC7DE} = {988F2383-FA1D-408B-BCF6-C0EE7AB0A560} + {1B1CA20E-39C3-4D9B-AC37-3783048E6672} = {988F2383-FA1D-408B-BCF6-C0EE7AB0A560} + {3BF049F8-AF7E-4E1C-9627-3E94C887AF24} = {6838FA95-01BF-4FF7-914C-FC209B81406E} + {3F3E389B-88DE-41D5-A73B-4F6036E18B36} = {6838FA95-01BF-4FF7-914C-FC209B81406E} + EndGlobalSection +EndGlobal diff --git a/windows/Ethereum.vcxproj b/windows/Ethereum.vcxproj new file mode 100644 index 000000000..c7e52133c --- /dev/null +++ b/windows/Ethereum.vcxproj @@ -0,0 +1,159 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + Win32Proj + Ethereum + Ethereum + {C60C065C-2135-4B2B-AFD4-35FD7AC56B40} + + + + Application + true + v120 + + + Application + true + v120 + + + Application + false + true + v120 + + + Application + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + true + + + + false + + + false + + + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDebug + true + + + Console + true + true + + + + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDebug + true + + + Console + true + + + + + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + true + AnySuitable + + + Console + true + true + true + true + + + + + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + true + AnySuitable + + + Console + true + true + true + + + + + {826e68cb-d3ee-4a8a-b540-59a8c3f38d4f} + + + + + + + + + \ No newline at end of file diff --git a/windows/LibCryptoPP.vcxproj b/windows/LibCryptoPP.vcxproj new file mode 100644 index 000000000..90751d5d0 --- /dev/null +++ b/windows/LibCryptoPP.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Document + ml64.exe /c /nologo /Fo"$(IntDir)x64dll.obj" /Zi "%(FullPath)" + ml64.exe /c /nologo /Fo"$(IntDir)x64dll.obj" /Zi "%(FullPath)" + $(IntDir)x64dll.obj + $(IntDir)x64dll.obj + + + + Win32Proj + LibCryptoPP + {1CC213A4-3482-4211-B47B-172E90DAC7DE} + + + + StaticLibrary + true + v120 + + + StaticLibrary + true + v120 + + + StaticLibrary + false + true + v120 + + + StaticLibrary + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + MultiThreadedDebug + 4189;4244;%(DisableSpecificWarnings) + + + Windows + true + + + + + + + Disabled + MultiThreadedDebug + 4189;4244;%(DisableSpecificWarnings) + + + Windows + true + + + + + + + MaxSpeed + true + true + MultiThreaded + 4189;4244;%(DisableSpecificWarnings) + + + Windows + true + true + true + + + + + + + MaxSpeed + true + true + MultiThreaded + 4189;4244;%(DisableSpecificWarnings) + + + Windows + true + true + true + + + + + + \ No newline at end of file diff --git a/windows/LibEthereum.props b/windows/LibEthereum.props new file mode 100644 index 000000000..8af87a44d --- /dev/null +++ b/windows/LibEthereum.props @@ -0,0 +1,24 @@ + + + + + + ..\..\build\$(ProjectName)\$(Platform)_$(Configuration)\ + ..\..\build\$(ProjectName)\$(Platform)_$(Configuration)\ + + + + 4100;4127;4505;4512;4706 + Level4 + true + false + include/$(ProjectName);../libethereum;../../boost;../../leveldb/include;../../cryptopp;../secp256k1;../../miniupnp + STATICLIB;LEVELDB_PLATFORM_WINDOWS;USE_NUM_BOOST;USE_FIELD_10X26;USE_FIELD_INV_BUILTIN;_WIN32_WINNT=0x0501;WIN32;%(PreprocessorDefinitions) + true + + + ../../boost/stage/$(Platform) + + + + \ No newline at end of file diff --git a/windows/LibEthereum.vcxproj b/windows/LibEthereum.vcxproj new file mode 100644 index 000000000..e3432b328 --- /dev/null +++ b/windows/LibEthereum.vcxproj @@ -0,0 +1,197 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {1cc213a4-3482-4211-b47b-172e90dac7de} + + + {27014763-955d-486b-9ba7-69872192e6f4} + + + {1b1ca20e-39c3-4d9b-ac37-3783048e6672} + + + {1e1175bb-c4a9-41d8-b2d1-9022f71d3cea} + + + + {826E68CB-D3EE-4A8A-B540-59A8C3F38D4F} + Win32Proj + LibEthereum + + + + StaticLibrary + true + v120 + + + StaticLibrary + true + v120 + + + StaticLibrary + false + true + v120 + + + StaticLibrary + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + false + MultiThreadedDebug + + + Windows + true + + + + + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + false + MultiThreadedDebug + + + Windows + true + + + + + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreaded + + + Windows + true + true + true + + + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreaded + + + Windows + true + true + true + + + + + + \ No newline at end of file diff --git a/windows/LibEthereum.vcxproj.filters b/windows/LibEthereum.vcxproj.filters new file mode 100644 index 000000000..29b24ad66 --- /dev/null +++ b/windows/LibEthereum.vcxproj.filters @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/LibLevelDB.vcxproj b/windows/LibLevelDB.vcxproj new file mode 100644 index 000000000..ed04f569a --- /dev/null +++ b/windows/LibLevelDB.vcxproj @@ -0,0 +1,223 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {27014763-955D-486B-9BA7-69872192E6F4} + Win32Proj + LibLevelDB + + + + StaticLibrary + true + v120 + + + StaticLibrary + true + v120 + + + StaticLibrary + false + true + v120 + + + StaticLibrary + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../leveldb + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + 4018;4244;4267;4389;4702;4722;4800;4996;%(DisableSpecificWarnings) + + + Windows + true + + + + + + + Disabled + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../leveldb + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + 4018;4244;4267;4389;4702;4722;4800;4996;%(DisableSpecificWarnings) + + + Windows + true + + + + + + + MaxSpeed + true + true + MultiThreaded + %(AdditionalIncludeDirectories);../../leveldb + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + 4018;4244;4267;4389;4702;4722;4800;4996;%(DisableSpecificWarnings) + + + Windows + true + true + true + + + + + + + MaxSpeed + true + true + MultiThreaded + %(AdditionalIncludeDirectories);../../leveldb + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + 4018;4244;4267;4389;4702;4722;4800;4996;%(DisableSpecificWarnings) + + + Windows + true + true + true + + + + + + \ No newline at end of file diff --git a/windows/LibLevelDB.vcxproj.filters b/windows/LibLevelDB.vcxproj.filters new file mode 100644 index 000000000..bc3306f56 --- /dev/null +++ b/windows/LibLevelDB.vcxproj.filters @@ -0,0 +1,246 @@ + + + + + {d83904b1-b5d1-4c5b-b476-96f08300d103} + + + {72573022-b7fd-4b7a-a92e-a68c06bd6366} + + + {7f821e9e-4ebf-4d18-8fb4-898bd3d81376} + + + {f285a595-6c39-4350-8d30-6f696a3a7c4c} + + + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + table + + + table + + + table + + + table + + + table + + + table + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + port + + + port + + + port + + + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + db + + + table + + + table + + + table + + + table + + + table + + + table + + + table + + + table + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + util + + + port + + + \ No newline at end of file diff --git a/windows/LibMiniUPnPc.vcxproj b/windows/LibMiniUPnPc.vcxproj new file mode 100644 index 000000000..7f3e59131 --- /dev/null +++ b/windows/LibMiniUPnPc.vcxproj @@ -0,0 +1,184 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Win32Proj + LibMiniUPnPc + {1B1CA20E-39C3-4D9B-AC37-3783048E6672} + LibMiniUPnPc + + + + StaticLibrary + true + v120 + + + StaticLibrary + true + v120 + + + StaticLibrary + false + true + v120 + + + StaticLibrary + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + MultiThreadedDebug + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + 4244;4245;4267;4389;%(DisableSpecificWarnings) + + + Windows + true + + + Iphlpapi.lib + + + + + + + Disabled + MultiThreadedDebug + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + 4244;4245;4267;4389;%(DisableSpecificWarnings) + + + Windows + true + + + Iphlpapi.lib + + + + + + + MaxSpeed + true + true + MultiThreaded + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + 4244;4245;4267;4389;%(DisableSpecificWarnings) + + + Windows + true + true + true + + + Iphlpapi.lib + + + + + + + MaxSpeed + true + true + MultiThreaded + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + 4244;4245;4267;4389;%(DisableSpecificWarnings) + + + Windows + true + true + true + + + Iphlpapi.lib + + + + + + \ No newline at end of file diff --git a/libethereum/LibEthereum.vcxproj b/windows/LibSecp256k1.vcxproj similarity index 68% rename from libethereum/LibEthereum.vcxproj rename to windows/LibSecp256k1.vcxproj index 30b4d8380..cccf0e014 100644 --- a/libethereum/LibEthereum.vcxproj +++ b/windows/LibSecp256k1.vcxproj @@ -19,65 +19,73 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + + + + - {7050C7CF-7551-48BE-8E57-92235906C13A} Win32Proj - LibEthereum + LibSecp256k1 + {1E1175BB-C4A9-41D8-B2D1-9022F71D3CEA} + LibSecp256k1 StaticLibrary true v120 - Unicode StaticLibrary true v120 - Unicode StaticLibrary false - v120 true - Unicode + v120 StaticLibrary false - v120 true - Unicode + v120 @@ -99,25 +107,19 @@ - - ..\build\$(ProjectName)\$(Platform)_$(Configuration)\ - ..\build\$(ProjectName)\$(Platform)_$(Configuration)\ - + - - ..\build\$(ProjectName)\$(Platform)_$(Configuration)\ - ..\build\$(ProjectName)\$(Platform)_$(Configuration)\ - - - ..\build\$(ProjectName)\$(Platform)_$(Configuration)\ - ..\build\$(ProjectName)\$(Platform)_$(Configuration)\ - + + + + + Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - false MultiThreadedDebug + 4189;4244;4267;%(DisableSpecificWarnings) Windows @@ -126,11 +128,13 @@ + + + Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - false MultiThreadedDebug + 4189;4244;4267;%(DisableSpecificWarnings) Windows @@ -139,12 +143,15 @@ + Level3 + + MaxSpeed true true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true MultiThreaded + 4189;4244;4267;%(DisableSpecificWarnings) Windows @@ -155,12 +162,15 @@ + Level3 + + MaxSpeed true true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true MultiThreaded + 4189;4244;4267;%(DisableSpecificWarnings) Windows diff --git a/windows/LibSecp256k1.vcxproj.filters b/windows/LibSecp256k1.vcxproj.filters new file mode 100644 index 000000000..aa4e5b9cb --- /dev/null +++ b/windows/LibSecp256k1.vcxproj.filters @@ -0,0 +1,71 @@ + + + + + {7d4db365-bce7-45c1-861c-f5f86beca992} + + + + + impl + + + impl + + + impl + + + impl + + + impl + + + impl + + + impl + + + impl + + + impl + + + impl + + + impl + + + impl + + + impl + + + impl + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Test.vcxproj b/windows/TestEthereum.vcxproj similarity index 82% rename from test/Test.vcxproj rename to windows/TestEthereum.vcxproj index 8b08adad2..e275ce267 100644 --- a/test/Test.vcxproj +++ b/windows/TestEthereum.vcxproj @@ -20,8 +20,8 @@ Win32Proj - Test - Test + TestEthereum + TestEthereum {3F3E389B-88DE-41D5-A73B-4F6036E18B36} @@ -29,46 +29,42 @@ Application true v120 - Unicode Application true v120 - Unicode Application false - v120 true - Unicode + v120 Application false - v120 true - Unicode + v120 - + - + - + - + @@ -89,12 +85,9 @@ Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../libethereum MultiThreadedDebug true - false true - 4351 Console @@ -108,12 +101,8 @@ Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../libethereum MultiThreadedDebug true - false - true - 4351 Console @@ -128,13 +117,10 @@ true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../libethereum MultiThreaded true AnySuitable - false true - 4351 Console @@ -152,13 +138,10 @@ true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../libethereum MultiThreaded true AnySuitable - false true - 4351 Console @@ -168,15 +151,20 @@ - - {3423ec9a-52e4-4a4d-9753-edebc38785ef} - - - {7050c7cf-7551-48be-8e57-92235906c13a} + + {826e68cb-d3ee-4a8a-b540-59a8c3f38d4f} - + + + + + + + + + diff --git a/eth/Ethereum.vcxproj b/windows/TestSecp256k1.vcxproj similarity index 81% rename from eth/Ethereum.vcxproj rename to windows/TestSecp256k1.vcxproj index 68ce0364c..f363f4706 100644 --- a/eth/Ethereum.vcxproj +++ b/windows/TestSecp256k1.vcxproj @@ -18,57 +18,66 @@ x64 + + + CompileAsCpp + CompileAsCpp + CompileAsCpp + CompileAsCpp + + + + + {1e1175bb-c4a9-41d8-b2d1-9022f71d3cea} + + Win32Proj - Ethereum - Ethereum - {C60C065C-2135-4B2B-AFD4-35FD7AC56B40} + TestSecp256k1 + TestSecp256k1 + {3BF049F8-AF7E-4E1C-9627-3E94C887AF24} Application true v120 - Unicode Application true v120 - Unicode Application false - v120 true - Unicode + v120 Application false - v120 true - Unicode + v120 - + - + - + - + @@ -89,12 +98,10 @@ Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../libethereum MultiThreadedDebug true - false true - 4351 + 4189;4244;4267;%(DisableSpecificWarnings) Console @@ -108,12 +115,9 @@ Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../libethereum MultiThreadedDebug true - false - true - 4351 + 4189;4244;4267;%(DisableSpecificWarnings) Console @@ -128,13 +132,11 @@ true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../libethereum MultiThreaded true AnySuitable - false true - 4351 + 4189;4244;4267;%(DisableSpecificWarnings) Console @@ -152,13 +154,11 @@ true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - ../libethereum MultiThreaded true AnySuitable - false true - 4351 + 4189;4244;4267;%(DisableSpecificWarnings) Console @@ -167,17 +167,6 @@ true - - - {3423ec9a-52e4-4a4d-9753-edebc38785ef} - - - {7050c7cf-7551-48be-8e57-92235906c13a} - - - - - diff --git a/windows/bootstrap.sh b/windows/bootstrap.sh new file mode 100644 index 000000000..397b4ce12 --- /dev/null +++ b/windows/bootstrap.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Setup script for building Ethereum using Visual Studio Express 2013. +# Execute once in directory only containing cpp-ethereum +# Prerequisites: +# - Visual Studio Express 2013 for Desktop +# - On PATH: git, git-svn, wget, 7z + +# stop on errors +set -e + +# fetch CryptoPP-5.6.2 +git svn clone -r 541:541 svn://svn.code.sf.net/p/cryptopp/code/trunk/c5 cryptopp + +# fetch MiniUPnP-1.8 +git clone git@github.com:miniupnp/miniupnp.git +cd miniupnp +git checkout tags/miniupnpd_1_8 +cd .. + +# fetch LevelDB (windows branch) +git clone https://code.google.com/p/leveldb/ +cd leveldb +git checkout origin/windows +cd .. + +# fetch and unpack boost-1.55 +wget -O boost_1_55_0.7z http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.7z/download +7z x boost_1_55_0.7z +mv boost_1_55_0 boost + +# compile boost for x86 and x64 +cd boost +cmd /c bootstrap.bat +./b2 --build-type=complete link=static runtime-link=static variant=debug,release threading=multi stage +mv stage/lib stage/Win32 +./b2 --build-type=complete link=static runtime-link=static variant=debug,release threading=multi address-model=64 stage +mv stage/lib stage/x64 +cd .. diff --git a/windows/include/LibLevelDB/port/port.h b/windows/include/LibLevelDB/port/port.h new file mode 100644 index 000000000..ce7ae19c4 --- /dev/null +++ b/windows/include/LibLevelDB/port/port.h @@ -0,0 +1,23 @@ +// Copyright (c) 2011 The LevelDB Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. See the AUTHORS file for names of contributors. + +#ifndef STORAGE_LEVELDB_PORT_PORT_H_ +#define STORAGE_LEVELDB_PORT_PORT_H_ + +#include + +// Include the appropriate platform specific file below. If you are +// porting to a new platform, see "port_example.h" for documentation +// of what the new port_.h file must provide. +#if defined(LEVELDB_PLATFORM_POSIX) +# include "port/port_posix.h" +#elif defined(LEVELDB_PLATFORM_CHROMIUM) +# include "port/port_chromium.h" +#elif defined(LEVELDB_PLATFORM_ANDROID) +# include "port/port_android.h" +#elif defined(LEVELDB_PLATFORM_WINDOWS) +# include "port/port_win.h" +#endif + +#endif // STORAGE_LEVELDB_PORT_PORT_H_ diff --git a/windows/include/LibLevelDB/unistd.h b/windows/include/LibLevelDB/unistd.h new file mode 100644 index 000000000..e69de29bb diff --git a/windows/include/LibMiniUPnPc/miniupnpcstrings.h b/windows/include/LibMiniUPnPc/miniupnpcstrings.h new file mode 100644 index 000000000..364342ecf --- /dev/null +++ b/windows/include/LibMiniUPnPc/miniupnpcstrings.h @@ -0,0 +1,14 @@ +/* $Id: miniupnpcstrings.h.in,v 1.4 2011/01/04 11:41:53 nanard Exp $ */ +/* Project: miniupnp + * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ + * Author: Thomas Bernard + * Copyright (c) 2005-2011 Thomas Bernard + * This software is subjects to the conditions detailed + * in the LICENCE file provided within this distribution */ +#ifndef MINIUPNPCSTRINGS_H_INCLUDED +#define MINIUPNPCSTRINGS_H_INCLUDED + +#define OS_STRING "Windows" +#define MINIUPNPC_VERSION_STRING "1.9" + +#endif