Browse Source

Merge branch 'develop' of github.com:ethereum/cpp-ethereum into develop

cl-refactor
Gav Wood 10 years ago
parent
commit
b4fb58053b
  1. 6
      CMakeLists.txt
  2. 8
      alethzero/MainWin.cpp
  3. 118
      eth/main.cpp
  4. 2
      ethkey/KeyAux.h
  5. 5
      libdevcore/Base64.h
  6. 10
      libdevcore/Common.h
  7. 7
      libdevcore/Worker.h
  8. 21
      libdevcrypto/Common.cpp
  9. 6
      libdevcrypto/Common.h
  10. 163
      libdevcrypto/WordList.cpp
  11. 21
      libethcore/CommonJS.cpp
  12. 5
      libethcore/CommonJS.h
  13. 17
      libethcore/ICAP.cpp
  14. 5
      libethcore/ICAP.h
  15. 2
      libethcore/KeyManager.h
  16. 3
      libethereum/Block.cpp
  17. 1
      libethereum/BlockChainSync.cpp
  18. 1
      libethereum/DownloadMan.cpp
  19. 3
      libethereum/DownloadMan.h
  20. 2
      libethereum/Executive.cpp
  21. 3
      libethereum/State.cpp
  22. 1
      libethereum/TransactionQueue.cpp
  23. 9
      libethereum/TransactionQueue.h
  24. 2
      libethereum/VerifiedBlock.h
  25. 17
      libevmasm/SourceLocation.h
  26. 6
      libjsconsole/JSConsole.h
  27. 14
      libp2p/Common.h
  28. 4
      libp2p/Host.cpp
  29. 3
      libp2p/RLPXSocket.h
  30. 1
      libsolidity/Token.h
  31. 4
      libsolidity/Types.cpp
  32. 4
      libsolidity/Types.h
  33. 1
      libweb3jsonrpc/JsonHelper.cpp
  34. 6
      libweb3jsonrpc/JsonHelper.h
  35. 3
      libweb3jsonrpc/WebThreeStubServer.cpp
  36. 21
      new.sh
  37. 41
      templates/dockplugin.cpp
  38. 56
      templates/dockplugin.h
  39. 36
      templates/dockplugin.ui
  40. 37
      templates/plugin.cpp
  41. 46
      templates/plugin.h
  42. 5
      test/TestUtils.cpp
  43. 8
      test/TestUtils.h
  44. 54
      test/libdevcore/Base36.cpp
  45. 2
      test/libdevcrypto/SecretStore.cpp
  46. 2
      test/libdevcrypto/crypto.cpp
  47. 80
      test/libethcore/icap.cpp
  48. 28
      test/libsolidity/SolidityNameAndTypeResolution.cpp

6
CMakeLists.txt

@ -527,8 +527,8 @@ endif ()
if (WIN32)
# packaging stuff
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_NAME "Ethereum (++)")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Ethereum (++) Toolset")
set(CPACK_PACKAGE_NAME "Ethereum")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Ethereum Toolset")
set(CPACK_PACKAGE_VENDOR "ethereum.org")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
@ -557,7 +557,7 @@ if (WIN32)
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
endif()
set(CPACK_NSIS_DISPLAY_NAME "Ethereum (++)")
set(CPACK_NSIS_DISPLAY_NAME "Ethereum")
set(CPACK_NSIS_HELP_LINK "https://github.com/ethereum/cpp-ethereum")
set(CPACK_NSIS_URL_INFO_ABOUT "https://github.com/ethereum/cpp-ethereum")
set(CPACK_NSIS_CONTACT "ethereum.org")

8
alethzero/MainWin.cpp

@ -159,7 +159,7 @@ Main::Main(QWidget* _parent):
QMessageBox::warning(nullptr, "Try again", "You entered two different passwords - please enter the same password twice.", QMessageBox::Ok);
}
m_keyManager.create(password.toStdString());
m_keyManager.import(Secret::random(), "Default identity");
m_keyManager.import(ICAP::createDirect(), "Default identity");
}
#if ETH_DEBUG
@ -317,9 +317,7 @@ void Main::install(AccountNamer* _adopt)
void Main::uninstall(AccountNamer* _kill)
{
auto it = m_namers.find(_kill);
if (it != m_namers.end())
m_namers.erase(it);
m_namers.erase(_kill);
refreshAll();
}
@ -411,7 +409,7 @@ NetworkPreferences Main::netPrefs() const
ret = NetworkPreferences(listenIP, ui->port->value(), ui->upnp->isChecked());
ret.discovery = m_privateChain.isEmpty() && !ui->hermitMode->isChecked();
ret.pin = m_privateChain.isEmpty() || ui->hermitMode->isChecked();
ret.pin = !ret.discovery;
return ret;
}

118
eth/main.cpp

@ -38,7 +38,7 @@
#include <libethereum/All.h>
#include <libethereum/BlockChainSync.h>
#include <libethcore/KeyManager.h>
#include <libethcore/ICAP.h>
#include <libwebthree/WebThree.h>
#if ETH_JSCONSOLE || !ETH_TRUE
#include <libjsconsole/JSLocalConsole.h>
@ -68,58 +68,17 @@ using dev::eth::Instruction;
static std::atomic<bool> g_silence = {false};
void interactiveHelp()
{
cout
<< "Commands:" << endl
<< " netstart <port> Starts the network subsystem on a specific port." << endl
<< " netstop Stops the network subsystem." << endl
<< " connect <addr> <port> Connects to a specific peer." << endl
<< " verbosity (<level>) Gets or sets verbosity level." << endl
<< " minestart Starts mining." << endl
<< " minestop Stops mining." << endl
<< " mineforce <enable> Forces mining, even when there are no transactions." << endl
<< " block Gives the current block height." << endl
<< " blockhashfromnumber <number> Gives the block hash with the givne number." << endl
<< " numberfromblockhash <hash> Gives the block number with the given hash." << endl
<< " blockqueue Gives the current block queue status." << endl
<< " findblock <hash> Searches for the block in the blockchain and blockqueue." << endl
<< " firstunknown Gives the first unknown block from the blockqueue." << endl
<< " retryunknown retries to import all unknown blocks from the blockqueue." << endl
<< " accounts Gives information on all owned accounts (balances, mining beneficiary and default signer)." << endl
<< " newaccount <name> Creates a new account with the given name." << endl
<< " transact Execute a given transaction." << endl
<< " transactnonce Execute a given transaction with a specified nonce." << endl
<< " txcreate Execute a given contract creation transaction." << endl
<< " send Execute a given transaction with current secret." << endl
<< " contract Create a new contract with current secret." << endl
<< " peers List the peers that are connected" << endl
#if ETH_FATDB || !ETH_TRUE
<< " listaccounts List the accounts on the network." << endl
<< " listcontracts List the contracts on the network." << endl
<< " balanceat <address> Gives the balance of the given account." << endl
<< " balanceatblock <address> <blocknumber> Gives the balance of the given account." << endl
<< " storageat <address> Gives the storage of the given account." << endl
<< " storageatblock <address> <blocknumber> Gives the storahe of the given account at a given blocknumber." << endl
<< " codeat <address> Gives the code of the given account." << endl
#endif
<< " setsigningkey <addr> Set the address with which to sign transactions." << endl
<< " setaddress <addr> Set the coinbase (mining payout) address." << endl
<< " exportconfig <path> Export the config (.RLP) to the path provided." << endl
<< " importconfig <path> Import the config (.RLP) from the path provided." << endl
<< " inspect <contract> Dumps a contract to <APPDATA>/<contract>.evm." << endl
<< " reprocess <block> Reprocess a given block." << endl
<< " dumptrace <block> <index> <filename> <format> Dumps a transaction trace" << endl << "to <filename>. <format> should be one of pretty, standard, standard+." << endl
<< " dumpreceipt <block> <index> Dumps a transation receipt." << endl
<< " hashrate Print the current hashrate in hashes per second if the client is mining." << endl
<< " exit Exits the application." << endl;
}
void help()
{
cout
<< "Usage eth [OPTIONS]" << endl
<< "Options:" << endl << endl
<< "Operating mode (default is non-interactive node):" << endl
#if ETH_JSCONSOLE || !ETH_TRUE
<< " console Enter interactive console mode (default: non-interactive)." << endl
<< " import <file> Import file as a concatenated series of blocks." << endl
<< " export <file> Export file as a concatenated series of blocks." << endl
#endif
<< "Client mode (default):" << endl
<< " --olympic Use the Olympic (0.9) protocol." << endl
<< " --frontier Use the Frontier (1.0) protocol." << endl
@ -127,9 +86,6 @@ void help()
<< " --genesis-json <file> Import the genesis block information from the given json file." << endl
<< endl
<< " -o,--mode <full/peer> Start a full node or a peer node (default: full)." << endl
#if ETH_JSCONSOLE || !ETH_TRUE
<< " -i,--interactive Enter interactive mode (default: non-interactive)." << endl
#endif
<< endl
#if ETH_JSONRPC || !ETH_TRUE
<< " -j,--json-rpc Enable JSON-RPC server (default: off)." << endl
@ -169,7 +125,8 @@ void help()
<< endl
<< "Client networking:" << endl
<< " --client-name <name> Add a name to your client's version string (default: blank)." << endl
<< " -b,--bootstrap Connect to the default Ethereum peerserver." << endl
<< " --bootstrap Connect to the default Ethereum peerservers (default unless --no-discovery used)." << endl
<< " --no-bootstrap Do not connect to the default Ethereum peerservers (default only when --no-discovery is used)." << endl
<< " -x,--peers <number> Attempt to connect to given number of peers (default: 11)." << endl
<< " --peer-stretch <number> Accepted connection multiplier (default: 7)." << endl
@ -187,7 +144,7 @@ void help()
// << " trusted Keep connected at all times." << endl
// << " --trust-peers <filename> Text list of publickeys." << endl
<< " --no-discovery Disable Node discovery." << endl
<< " --no-discovery Disable Node discovery, implies --no-bootstrap." << endl
<< " --pin Only accept or connect to trusted peers." << endl
<< " --hermit Equivalent to --no-discovery --pin." << endl
<< " --sociable Forces discovery and no pinning." << endl
@ -198,9 +155,8 @@ void help()
<< " --structured-logging Enable structured logging (default output to stdout)." << endl
<< " --structured-logging-format <format> Set the structured logging time format." << endl
<< " --structured-logging-url <URL> Set the structured logging destination (currently only file:// supported)." << endl
<< endl
<< "Import/export modes:" << endl
<< " -I,--import <file> Import file as a concatenated series of blocks and exit." << endl
<< " -E,--export <file> Export file as a concatenated series of blocks and exit." << endl
<< " --from <n> Export only from block n; n may be a decimal, a '0x' prefixed hash, or 'latest'." << endl
<< " --to <n> Export only to block n (inclusive); n may be a decimal, a '0x' prefixed hash, or 'latest'." << endl
<< " --only <n> Equivalent to --export-from n --export-to n." << endl
@ -310,13 +266,17 @@ void stopMiningAfterXBlocks(eth::Client* _c, unsigned _start, unsigned& io_minin
this_thread::sleep_for(chrono::milliseconds(100));
}
void interactiveMode(eth::Client*, std::shared_ptr<eth::TrivialGasPricer>, WebThreeDirect&, KeyManager&, string&, string&, function<string(string const&)>, function<string(Address const&)>, NetworkPreferences, Address, Address, TransactionPriority) {}
int main(int argc, char** argv)
{
// Init defaults
Defaults::get();
#if ETH_DEBUG
g_logVerbosity = 4;
#else
g_logVerbosity = 1;
#endif
/// Operating mode.
OperationMode mode = OperationMode::Node;
string dbPath;
@ -359,7 +319,7 @@ int main(int argc, char** argv)
HostPeerPreferences hprefs;
unsigned peers = hprefs.idealPeerCount;
unsigned peerStretch = hprefs.stretchPeerCount;
bool bootstrap = false;
bool bootstrap = true;
bool disableDiscovery = false;
bool pinning = false;
bool enableDiscovery = false;
@ -381,7 +341,7 @@ int main(int argc, char** argv)
string structuredLoggingURL;
/// Transaction params
TransactionPriority priority = TransactionPriority::Medium;
// TransactionPriority priority = TransactionPriority::Medium;
// double etherPrice = 30.679;
// double blockFees = 15.0;
u256 askPrice = c_defaultGasPrice;
@ -444,14 +404,14 @@ int main(int argc, char** argv)
passwordsToNote.push_back(argv[++i]);
else if (arg == "--master" && i + 1 < argc)
masterPassword = argv[++i];
else if ((arg == "-I" || arg == "--import") && i + 1 < argc)
else if ((arg == "-I" || arg == "--import" || arg == "import") && i + 1 < argc)
{
mode = OperationMode::Import;
filename = argv[++i];
}
else if (arg == "--dont-check")
safeImport = true;
else if ((arg == "-E" || arg == "--export") && i + 1 < argc)
else if ((arg == "-E" || arg == "--export" || arg == "export") && i + 1 < argc)
{
mode = OperationMode::Export;
filename = argv[++i];
@ -645,7 +605,7 @@ int main(int argc, char** argv)
return -1;
}
}
else if ((arg == "-P" || arg == "--priority") && i + 1 < argc)
/* else if ((arg == "-P" || arg == "--priority") && i + 1 < argc)
{
string m = boost::to_lower_copy(string(argv[++i]));
if (m == "lowest")
@ -666,7 +626,7 @@ int main(int argc, char** argv)
cerr << "Unknown " << arg << " option: " << m << endl;
return -1;
}
}
}*/
else if ((arg == "-m" || arg == "--mining") && i + 1 < argc)
{
string m = argv[++i];
@ -685,8 +645,13 @@ int main(int argc, char** argv)
}
else if (arg == "-b" || arg == "--bootstrap")
bootstrap = true;
else if (arg == "--no-bootstrap")
bootstrap = false;
else if (arg == "--no-discovery")
{
disableDiscovery = true;
bootstrap = false;
}
else if (arg == "--pin")
pinning = true;
else if (arg == "--hermit")
@ -708,7 +673,7 @@ int main(int argc, char** argv)
jsonAdmin = argv[++i];
#endif
#if ETH_JSCONSOLE || !ETH_TRUE
else if (arg == "-i" || arg == "--interactive" || arg == "--console")
else if (arg == "-i" || arg == "--interactive" || arg == "--console" || arg == "console")
useConsole = true;
#endif
else if ((arg == "-v" || arg == "--verbosity") && i + 1 < argc)
@ -780,7 +745,7 @@ int main(int argc, char** argv)
if (c_network == eth::Network::Olympic)
cout << "Welcome to Olympic!" << endl;
else if (c_network == eth::Network::Frontier)
cout << "Welcome to the " EthMaroonBold "Frontier" EthReset "!" << endl;
cout << "Beware. You're entering the " EthMaroonBold "Frontier" EthReset "!" << endl;
}
m.execute();
@ -996,7 +961,7 @@ int main(int argc, char** argv)
if (keyManager.accounts().empty())
{
h128 uuid = keyManager.import(Secret::random(), "Default key");
h128 uuid = keyManager.import(ICAP::createDirect(), "Default key");
if (!beneficiary)
beneficiary = keyManager.address(uuid);
if (!signingKey)
@ -1022,8 +987,14 @@ int main(int argc, char** argv)
c->setNetworkId(networkId);
}
cout << "Transaction Signer: " << signingKey << endl;
cout << "Mining Benefactor: " << beneficiary << endl;
auto renderFullAddress = [&](Address const& _a) -> std::string
{
return ICAP(_a).encoded() + " (" + toUUID(keyManager.uuid(_a)) + " - " + toHex(_a.ref().cropped(0, 4)) + ")";
};
cout << "Transaction Signer: " << renderFullAddress(signingKey) << endl;
cout << "Mining Beneficiary: " << renderFullAddress(beneficiary) << endl;
cout << "Foundation: " << renderFullAddress(Address("de0b295669a9fd93d5f28d9ec85e40f4cb697bae")) << endl;
if (bootstrap || !remoteHost.empty() || disableDiscovery)
{
@ -1031,7 +1002,7 @@ int main(int argc, char** argv)
cout << "Node ID: " << web3.enode() << endl;
}
else
cout << "Networking disabled. To start, use netstart or pass -b or a remote host." << endl;
cout << "Networking disabled. To start, use netstart or pass --bootstrap or a remote host." << endl;
if (useConsole && jsonRPCURL == -1)
jsonRPCURL = SensibleHttpPort;
@ -1064,9 +1035,7 @@ int main(int argc, char** argv)
signal(SIGTERM, &sighandler);
signal(SIGINT, &sighandler);
if (interactive)
interactiveMode(c, gasPricer, web3, keyManager, logbuf, additional, getPassword, getAccountPassword, netPrefs, beneficiary, signingKey, priority);
else if (c)
if (c)
{
unsigned n = c->blockChain().details().number;
if (mining)
@ -1078,11 +1047,8 @@ int main(int argc, char** argv)
shared_ptr<dev::WebThreeStubServer> rpcServer = make_shared<dev::WebThreeStubServer>(*console.connector(), web3, make_shared<SimpleAccountHolder>([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector<KeyPair>(), keyManager, *gasPricer);
string sessionKey = rpcServer->newSession(SessionPermissions{{Privilege::Admin}});
console.eval("web3.admin.setSessionKey('" + sessionKey + "')");
while (!g_exit)
{
console.readExpression();
while (console.readExpression())
stopMiningAfterXBlocks(c, n, mining);
}
rpcServer->StopListening();
#endif
}

2
ethkey/KeyAux.h

@ -505,7 +505,7 @@ public:
if (Address a = wallet.address(u))
{
cout << toUUID(u) << " " << a.abridged();
cout << " (Not ICAP) ";
cout << " " << ICAP(a).encoded();
cout << " " << wallet.accountName(a) << endl;
}
for (auto const& u: bare)

5
libdevcore/Base64.h

@ -44,7 +44,10 @@ template <size_t N> inline std::string toBase36(FixedHash<N> const& _h)
typename FixedHash<N>::Arith a = _h;
std::string ret;
for (; a > 0; a /= 36)
ret = c_alphabet[(unsigned)a % 36] + ret;
{
unsigned r = (unsigned)(a - a / 36 * 36); // boost's % is broken
ret = c_alphabet[r] + ret;
}
return ret;
}

10
libdevcore/Common.h

@ -92,7 +92,15 @@ public:
explicit secure_vector(vector_ref<const T> _c): m_data(_c.data(), _c.data() + _c.size()) {}
~secure_vector() { ref().cleanse(); }
secure_vector<T>& operator=(secure_vector<T> const& _c) { ref().cleanse(); m_data = _c.m_data; return *this; }
secure_vector<T>& operator=(secure_vector<T> const& _c)
{
if (&_c == this)
return *this;
ref().cleanse();
m_data = _c.m_data;
return *this;
}
std::vector<T>& writable() { clear(); return m_data; }
std::vector<T> const& makeInsecure() const { return m_data; }

7
libdevcore/Worker.h

@ -54,7 +54,12 @@ protected:
Worker(Worker&& _m) { std::swap(m_name, _m.m_name); }
/// Move-assignment.
Worker& operator=(Worker&& _m) { std::swap(m_name, _m.m_name); return *this; }
Worker& operator=(Worker&& _m)
{
assert(&_m != this);
std::swap(m_name, _m.m_name);
return *this;
}
virtual ~Worker() { terminate(); }

21
libdevcrypto/Common.cpp

@ -308,33 +308,14 @@ h256 crypto::kdf(Secret const& _priv, h256 const& _hash)
return s;
}
string const& Nonce::seedFilePath(string const& _filePath)
{
static mutex x_seedFile;
static string s_seedFile;
Guard l(x_seedFile);
if (s_seedFile.empty())
s_seedFile = _filePath.empty() ? getDataDir() + "/seed" : _filePath;
return s_seedFile;
}
Secret Nonce::next()
{
Guard l(x_value);
if (!m_value)
{
bytesSec b = contentsSec(seedFilePath());
if (b.size() == 32)
b.ref().populate(m_value.writable().ref());
else
m_value = Secret::random();
m_value = Secret::random();
if (!m_value)
BOOST_THROW_EXCEPTION(InvalidState());
// prevent seed reuse if process terminates abnormally
// this might throw
writeFile(seedFilePath(), bytes());
}
m_value = sha3Secure(m_value.ref());
return sha3(~m_value);

6
libdevcrypto/Common.h

@ -203,14 +203,8 @@ public:
/// Returns the next nonce (might be read from a file).
static Secret get() { static Nonce s; return s.next(); }
/// @returns path of the seed file. FOR TESTS ONLY: optionally set path to @_filePath.
static std::string const& seedFilePath(std::string const& _filePath = std::string());
private:
Nonce() = default;
/// Destructor. IO operation may throw.
~Nonce() { if (m_value && next()) dev::writeFile(seedFilePath(), m_value.ref()); }
/// @returns the next nonce.
Secret next();

163
libdevcrypto/WordList.cpp

@ -35,7 +35,7 @@ strings const WordList =
"have",
"to",
"it",
"I",
"i",
"that",
"for",
"you",
@ -198,7 +198,7 @@ strings const WordList =
"start",
"hand",
"might",
"American",
"american",
"show",
"part",
"about",
@ -233,7 +233,7 @@ strings const WordList =
"like",
"night",
"live",
"Mr",
"mr",
"point",
"believe",
"hold",
@ -567,7 +567,7 @@ strings const WordList =
"court",
"produce",
"eat",
"American",
"american",
"teach",
"oil",
"half",
@ -617,7 +617,7 @@ strings const WordList =
"attention",
"draw",
"film",
"Republican",
"republican",
"tree",
"source",
"red",
@ -661,7 +661,7 @@ strings const WordList =
"administration",
"south",
"husband",
"Congress",
"congress",
"floor",
"campaign",
"material",
@ -819,7 +819,7 @@ strings const WordList =
"region",
"television",
"box",
"TV",
"tv",
"training",
"pretty",
"trade",
@ -849,7 +849,7 @@ strings const WordList =
"answer",
"skill",
"sister",
"PM",
"pm",
"professor",
"operation",
"financial",
@ -928,7 +928,7 @@ strings const WordList =
"that",
"spring",
"firm",
"Democrat",
"democrat",
"radio",
"visit",
"management",
@ -1060,7 +1060,7 @@ strings const WordList =
"reality",
"coach",
"step",
"Mrs",
"mrs",
"yard",
"beat",
"violence",
@ -1137,7 +1137,7 @@ strings const WordList =
"forest",
"video",
"global",
"Senate",
"senate",
"reform",
"access",
"restaurant",
@ -1209,7 +1209,7 @@ strings const WordList =
"spirit",
"experience",
"replace",
"British",
"british",
"encourage",
"lot",
"lot",
@ -1222,7 +1222,7 @@ strings const WordList =
"brain",
"feature",
"afternoon",
"AM",
"am",
"weekend",
"dozen",
"possibility",
@ -1233,7 +1233,7 @@ strings const WordList =
"beginning",
"date",
"generally",
"African",
"african",
"very",
"sorry",
"crisis",
@ -1248,7 +1248,7 @@ strings const WordList =
"vision",
"status",
"normal",
"Chinese",
"chinese",
"ship",
"solution",
"stone",
@ -1278,7 +1278,7 @@ strings const WordList =
"tradition",
"winter",
"village",
"Soviet",
"soviet",
"refuse",
"sales",
"roll",
@ -1295,16 +1295,16 @@ strings const WordList =
"potential",
"increase",
"middle",
"European",
"european",
"presence",
"independent",
"district",
"shape",
"reader",
"Ms",
"ms",
"contract",
"crowd",
"Christian",
"christian",
"express",
"apartment",
"willing",
@ -1395,8 +1395,8 @@ strings const WordList =
"insist",
"failure",
"annual",
"French",
"Christmas",
"french",
"christmas",
"comment",
"responsible",
"affair",
@ -1467,7 +1467,7 @@ strings const WordList =
"smile",
"location",
"clothes",
"Indian",
"indian",
"quiet",
"dress",
"promise",
@ -1494,14 +1494,14 @@ strings const WordList =
"dangerous",
"remind",
"moral",
"United",
"united",
"category",
"relatively",
"victory",
"key",
"academic",
"visit",
"Internet",
"internet",
"healthy",
"fire",
"negative",
@ -1597,7 +1597,7 @@ strings const WordList =
"leaf",
"direct",
"dry",
"Russian",
"russian",
"instruction",
"fight",
"pool",
@ -1653,7 +1653,7 @@ strings const WordList =
"presidential",
"emotional",
"commitment",
"Supreme",
"supreme",
"bear",
"pocket",
"thin",
@ -1688,7 +1688,7 @@ strings const WordList =
"organize",
"jury",
"breast",
"Iraqi",
"iraqi",
"human",
"acknowledge",
"theme",
@ -1757,7 +1757,7 @@ strings const WordList =
"prefer",
"truly",
"earth",
"Japanese",
"japanese",
"chest",
"search",
"thick",
@ -1795,7 +1795,7 @@ strings const WordList =
"sheet",
"ought",
"ensure",
"Catholic",
"catholic",
"extremely",
"extent",
"component",
@ -1822,7 +1822,7 @@ strings const WordList =
"guide",
"circumstance",
"snow",
"English",
"english",
"politician",
"steal",
"pursue",
@ -1835,7 +1835,7 @@ strings const WordList =
"influence",
"surgery",
"correct",
"Jewish",
"jewish",
"blame",
"estimate",
"due",
@ -1863,7 +1863,7 @@ strings const WordList =
"rating",
"golden",
"motion",
"German",
"german",
"gender",
"solve",
"fee",
@ -1943,7 +1943,7 @@ strings const WordList =
"clean",
"except",
"beer",
"English",
"english",
"reference",
"tear",
"doubt",
@ -2047,8 +2047,8 @@ strings const WordList =
"towards",
"expose",
"rural",
"AIDS",
"Jew",
"aids",
"jew",
"narrow",
"cream",
"secretary",
@ -2128,7 +2128,7 @@ strings const WordList =
"forever",
"fun",
"regard",
"Israeli",
"israeli",
"association",
"twenty",
"knock",
@ -2247,11 +2247,11 @@ strings const WordList =
"error",
"release",
"cop",
"Arab",
"arab",
"double",
"walk",
"sand",
"Spanish",
"spanish",
"rule",
"hit",
"print",
@ -2294,7 +2294,7 @@ strings const WordList =
"present",
"joke",
"coat",
"Mexican",
"mexican",
"symptom",
"contact",
"manufacturer",
@ -2366,7 +2366,7 @@ strings const WordList =
"another",
"attach",
"for",
"Indian",
"indian",
"disaster",
"parking",
"prospect",
@ -2397,7 +2397,7 @@ strings const WordList =
"illustrate",
"boot",
"monitor",
"Asian",
"asian",
"entertainment",
"bean",
"evaluation",
@ -2536,7 +2536,7 @@ strings const WordList =
"occasionally",
"mayor",
"consideration",
"CEO",
"ceo",
"secure",
"pink",
"smoke",
@ -2575,13 +2575,13 @@ strings const WordList =
"quit",
"absence",
"roll",
"Latin",
"latin",
"rapidly",
"jail",
"comment",
"diversity",
"honest",
"Palestinian",
"palestinian",
"pace",
"employment",
"speaker",
@ -2641,11 +2641,11 @@ strings const WordList =
"phrase",
"ingredient",
"stake",
"Muslim",
"muslim",
"dream",
"fiber",
"activist",
"Islamic",
"islamic",
"snap",
"terrorism",
"refugee",
@ -2686,8 +2686,8 @@ strings const WordList =
"wonder",
"clock",
"chocolate",
"Italian",
"Canadian",
"italian",
"canadian",
"ceiling",
"sweep",
"advertising",
@ -2786,13 +2786,13 @@ strings const WordList =
"though",
"expansion",
"elite",
"Olympic",
"olympic",
"dirt",
"odd",
"rice",
"bullet",
"tight",
"Bible",
"bible",
"chart",
"solar",
"decline",
@ -2878,7 +2878,7 @@ strings const WordList =
"assistant",
"offense",
"counter",
"DNA",
"dna",
"smell",
"potentially",
"transfer",
@ -2981,7 +2981,7 @@ strings const WordList =
"radical",
"stress",
"adapt",
"Irish",
"irish",
"honey",
"correspondent",
"pale",
@ -3072,7 +3072,7 @@ strings const WordList =
"fund",
"ski",
"limitation",
"OK",
"ok",
"trace",
"appointment",
"preference",
@ -3105,7 +3105,7 @@ strings const WordList =
"mall",
"derive",
"scandal",
"PC",
"pc",
"helpful",
"impress",
"heel",
@ -3125,7 +3125,7 @@ strings const WordList =
"examination",
"publisher",
"strengthen",
"French",
"french",
"proposed",
"myth",
"sophisticated",
@ -3153,7 +3153,7 @@ strings const WordList =
"narrative",
"photographer",
"helicopter",
"Catholic",
"catholic",
"modest",
"provider",
"delay",
@ -3181,7 +3181,7 @@ strings const WordList =
"assignment",
"restriction",
"across",
"Palestinian",
"palestinian",
"laboratory",
"workshop",
"differently",
@ -3216,19 +3216,19 @@ strings const WordList =
"versus",
"manufacturing",
"risk",
"Christian",
"christian",
"complex",
"absolute",
"chef",
"discrimination",
"offensive",
"German",
"german",
"suit",
"boom",
"register",
"appoint",
"heritage",
"God",
"god",
"terrorist",
"dominant",
"successfully",
@ -3366,7 +3366,7 @@ strings const WordList =
"rope",
"concrete",
"prescription",
"African-American",
"african-american",
"chase",
"document",
"brick",
@ -3547,7 +3547,7 @@ strings const WordList =
"cold",
"classical",
"estimated",
"T-shirt",
"t-shirt",
"online",
"unemployment",
"civilization",
@ -3564,16 +3564,16 @@ strings const WordList =
"reliable",
"excitement",
"beef",
"Islam",
"Roman",
"islam",
"roman",
"stretch",
"architecture",
"occasional",
"administrative",
"elbow",
"deadly",
"Muslim",
"Hispanic",
"muslim",
"hispanic",
"allegation",
"tip",
"confuse",
@ -3581,7 +3581,7 @@ strings const WordList =
"monthly",
"duck",
"dose",
"Korean",
"korean",
"plead",
"initiate",
"lecture",
@ -3762,7 +3762,7 @@ strings const WordList =
"freshman",
"sweat",
"outer",
"European",
"european",
"drunk",
"survey",
"research",
@ -3837,7 +3837,7 @@ strings const WordList =
"shame",
"meaningful",
"sidewalk",
"Olympics",
"olympics",
"technological",
"signature",
"pleasant",
@ -3919,7 +3919,7 @@ strings const WordList =
"pastor",
"jazz",
"opera",
"Japanese",
"japanese",
"bite",
"frame",
"evil",
@ -3945,7 +3945,7 @@ strings const WordList =
"gym",
"oral",
"clerk",
"Israeli",
"israeli",
"envelope",
"reporting",
"destination",
@ -4027,7 +4027,7 @@ strings const WordList =
"enroll",
"diminish",
"prevention",
"Arab",
"arab",
"value",
"minimize",
"chop",
@ -4063,7 +4063,7 @@ strings const WordList =
"representative",
"content",
"realistic",
"Russian",
"russian",
"hidden",
"command",
"tender",
@ -4126,19 +4126,15 @@ strings const WordList =
"cart",
"oversee",
"stem",
"o'clock",
"elder",
"o'clock",
"o'clock",
"o'clock",
"pro",
"inspiration",
"Dutch",
"dutch",
"quantity",
"trailer",
"mate",
"o'clock",
"Greek",
"greek",
"genius",
"monument",
"bid",
@ -4264,7 +4260,7 @@ strings const WordList =
"rent",
"calm",
"jewelry",
"Cuban",
"cuban",
"haul",
"concede",
"trace",
@ -4366,7 +4362,7 @@ strings const WordList =
"breeze",
"costly",
"ambitious",
"Christianity",
"christianity",
"presumably",
"influential",
"translation",
@ -4547,7 +4543,7 @@ strings const WordList =
"ideal",
"constitution",
"trainer",
"Thanksgiving",
"thanksgiving",
"scent",
"stack",
"eyebrow",
@ -4614,7 +4610,7 @@ strings const WordList =
"dip",
"likewise",
"informal",
"Persian",
"persian",
"feather",
"sphere",
"tighten",
@ -4689,7 +4685,6 @@ strings const WordList =
"toll",
"rim",
"embarrassed",
"fucking",
"cling",
"isolated",
"blink",

21
libethcore/CommonJS.cpp

@ -22,16 +22,27 @@
*/
#include "CommonJS.h"
#include "ICAP.h"
namespace dev
{
Address toAddress(std::string const& _sn)
Address jsToAddress(std::string const& _s)
{
if (_sn.size() == 40)
return Address(fromHex(_sn));
else
return Address();
try
{
eth::ICAP i = eth::ICAP::decoded(_s);
return i.direct();
}
catch (eth::InvalidICAP&) {}
try
{
auto b = fromHex(_s.substr(0, 2) == "0x" ? _s.substr(2) : _s, WhenError::Throw);
if (b.size() == 20)
return Address(b);
}
catch (BadHexCharacter&) {}
BOOST_THROW_EXCEPTION(InvalidAddress());
}
std::string prettyU256(u256 _n, bool _abridged)

5
libethcore/CommonJS.h

@ -33,8 +33,7 @@
namespace dev
{
/// Strictly convert unprefixed hex string string to Address (h160). @returns empty address if (_a.size != 40).
Address toAddress(std::string const& _a);
DEV_SIMPLE_EXCEPTION(InvalidAddress);
/// Leniently convert string to Public (h512). Accepts integers, "0x" prefixing, non-exact length.
inline Public jsToPublic(std::string const& _s) { return jsToFixed<sizeof(dev::Public)>(_s); }
@ -43,7 +42,7 @@ inline Public jsToPublic(std::string const& _s) { return jsToFixed<sizeof(dev::P
inline Secret jsToSecret(std::string const& _s) { h256 d = jsToFixed<sizeof(dev::Secret)>(_s); Secret ret(d); d.ref().cleanse(); return ret; }
/// Leniently convert string to Address (h160). Accepts integers, "0x" prefixing, non-exact length.
inline Address jsToAddress(std::string const& _s) { return jsToFixed<sizeof(dev::Address)>(_s); }
Address jsToAddress(std::string const& _s);
/// Convert u256 into user-readable string. Returns int/hex value of 64 bits int, hex of 160 bits FixedHash. As a fallback try to handle input as h256.
std::string prettyU256(u256 _n, bool _abridged = true);

17
libethcore/ICAP.cpp

@ -64,6 +64,17 @@ std::pair<string, string> ICAP::fromIBAN(std::string _iban)
return make_pair(c, d);
}
Secret ICAP::createDirect()
{
Secret ret;
while (true)
{
ret = Secret::random();
if (!toAddress(ret)[0])
return ret;
}
}
ICAP ICAP::decoded(std::string const& _encoded)
{
ICAP ret;
@ -72,7 +83,7 @@ ICAP ICAP::decoded(std::string const& _encoded)
std::tie(country, data) = fromIBAN(_encoded);
if (country != "XE")
BOOST_THROW_EXCEPTION(InvalidICAP());
if (data.size() == 30)
if (data.size() == 30 || data.size() == 31)
{
ret.m_type = Direct;
// Direct ICAP
@ -100,10 +111,8 @@ std::string ICAP::encoded() const
{
if (m_type == Direct)
{
if (!!m_direct[0])
BOOST_THROW_EXCEPTION(InvalidICAP());
std::string d = toBase36<Address::size>(m_direct);
while (d.size() < 30)
while (d.size() < 30) // always 34, sometimes 35.
d = "0" + d;
return iban("XE", d);
}

5
libethcore/ICAP.h

@ -36,7 +36,7 @@ namespace dev
namespace eth
{
struct InvalidICAP: virtual public dev::Exception {};
DEV_SIMPLE_EXCEPTION(InvalidICAP);
/**
* @brief Encapsulation of an ICAP address.
@ -62,6 +62,9 @@ public:
Indirect
};
/// Create a direct address for ICAP.
static Secret createDirect();
/// @returns IBAN encoding of client and data.
static std::string iban(std::string _c, std::string _d);
/// @returns Client and data from given IBAN address.

2
libethcore/KeyManager.h

@ -36,7 +36,7 @@ class PasswordUnknown: public Exception {};
struct KeyInfo
{
KeyInfo() = default;
KeyInfo(h256 const& _passHash, std::string const& _accountName, std::string const& _passwordHint): passHash(_passHash), accountName(_accountName), passwordHint(_passwordHint) {}
KeyInfo(h256 const& _passHash, std::string const& _accountName, std::string const& _passwordHint = std::string()): passHash(_passHash), accountName(_accountName), passwordHint(_passwordHint) {}
/// Hash of the password or h256() / UnknownPassword if unknown.
h256 passHash;

3
libethereum/Block.cpp

@ -80,6 +80,9 @@ Block::Block(Block const& _s):
Block& Block::operator=(Block const& _s)
{
if (&_s == this)
return *this;
m_state = _s.m_state;
m_transactions = _s.m_transactions;
m_receipts = _s.m_receipts;

1
libethereum/BlockChainSync.cpp

@ -833,7 +833,6 @@ void PV60Sync::abortSync()
void PV60Sync::onPeerAborting()
{
RecursiveGuard l(x_sync);
DEV_INVARIANT_CHECK;
// Can't check invariants here since the peers is already removed from the list and the state is not updated yet.
if (m_syncer.expired() && m_state != SyncState::Idle)
{

1
libethereum/DownloadMan.cpp

@ -44,6 +44,7 @@ DownloadSub::DownloadSub(DownloadMan& _man): m_man(&_man)
DownloadSub::~DownloadSub()
{
Guard fl(m_fetch);
if (m_man)
{
WriteGuard l(m_man->x_subs);

3
libethereum/DownloadMan.h

@ -93,7 +93,10 @@ public:
~DownloadMan()
{
for (auto i: m_subs)
{
Guard l(i->m_fetch);
i->m_man = nullptr;
}
}
void appendToChain(h256s const& _hashes)

2
libethereum/Executive.cpp

@ -383,7 +383,7 @@ bool Executive::go(OnOpFunc const& _onOp)
}
catch (VMException const& _e)
{
cnote/*clog(StateSafeExceptions)*/ << "Safe VM Exception. " << diagnostic_information(_e);
clog(StateSafeExceptions) << "Safe VM Exception. " << diagnostic_information(_e);
m_gas = 0;
m_excepted = toTransactionException(_e);
m_ext->revert();

3
libethereum/State.cpp

@ -136,6 +136,9 @@ void State::paranoia(std::string const& _when, bool _enforceRefs) const
State& State::operator=(State const& _s)
{
if (&_s == this)
return *this;
m_db = _s.m_db;
m_state.open(&m_db, _s.m_state.root(), Verification::Skip);
m_cache = _s.m_cache;

1
libethereum/TransactionQueue.cpp

@ -402,4 +402,3 @@ void TransactionQueue::verifierBody()
}
}
}

9
libethereum/TransactionQueue.h

@ -140,7 +140,14 @@ private:
UnverifiedTransaction() {}
UnverifiedTransaction(bytesConstRef const& _t, h512 const& _nodeId): transaction(_t.toBytes()), nodeId(_nodeId) {}
UnverifiedTransaction(UnverifiedTransaction&& _t): transaction(std::move(_t.transaction)) {}
UnverifiedTransaction& operator=(UnverifiedTransaction&& _other) { transaction = std::move(_other.transaction); nodeId = std::move(_other.nodeId); return *this; }
UnverifiedTransaction& operator=(UnverifiedTransaction&& _other)
{
assert(&_other != this);
transaction = std::move(_other.transaction);
nodeId = std::move(_other.nodeId);
return *this;
}
UnverifiedTransaction(UnverifiedTransaction const&) = delete;
UnverifiedTransaction& operator=(UnverifiedTransaction const&) = delete;

2
libethereum/VerifiedBlock.h

@ -58,6 +58,8 @@ struct VerifiedBlock
VerifiedBlock& operator=(VerifiedBlock&& _other)
{
assert(&_other != this);
verified = (std::move(_other.verified));
blockData = (std::move(_other.blockData));
return *this;

17
libevmasm/SourceLocation.h

@ -41,8 +41,21 @@ struct SourceLocation
SourceLocation(): start(-1), end(-1) { }
SourceLocation(SourceLocation const& _other):
start(_other.start), end(_other.end), sourceName(_other.sourceName) {}
SourceLocation& operator=(SourceLocation const& _other) { start = _other.start; end = _other.end; sourceName = _other.sourceName; return *this;}
start(_other.start),
end(_other.end),
sourceName(_other.sourceName)
{}
SourceLocation& operator=(SourceLocation const& _other)
{
if (&_other == this)
return *this;
start = _other.start;
end = _other.end;
sourceName = _other.sourceName;
return *this;
}
bool operator==(SourceLocation const& _other) const { return start == _other.start && end == _other.end;}
bool operator!=(SourceLocation const& _other) const { return !operator==(_other); }

6
libjsconsole/JSConsole.h

@ -41,7 +41,7 @@ public:
JSConsole(): m_engine(Engine()), m_printer(Printer(m_engine)) {}
~JSConsole() {}
void readExpression() const
bool readExpression() const
{
std::string cmd = "";
g_logPost = [](std::string const& a, char const*)
@ -83,6 +83,9 @@ public:
}
} while (openBrackets > 0);
if (cmd == "quit")
return false;
if (!isEmpty)
{
#if ETH_READLINE
@ -92,6 +95,7 @@ public:
std::string result = m_printer.prettyPrint(value).cstr();
std::cout << result << std::endl;
}
return true;
}
void eval(std::string const& _expression) { m_engine.eval(_expression.c_str()); }

14
libp2p/Common.h

@ -78,9 +78,9 @@ struct InvalidPublicIPAddress: virtual dev::Exception {};
struct InvalidHostIPAddress: virtual dev::Exception {};
struct NetWarn: public LogChannel { static const char* name(); static const int verbosity = 0; };
struct NetNote: public LogChannel { static const char* name(); static const int verbosity = 1; };
struct NetImpolite: public LogChannel { static const char* name(); static const int verbosity = 2; };
struct NetMessageSummary: public LogChannel { static const char* name(); static const int verbosity = 3; };
struct NetNote: public LogChannel { static const char* name(); static const int verbosity = 2; };
struct NetImpolite: public LogChannel { static const char* name(); static const int verbosity = 3; };
struct NetMessageSummary: public LogChannel { static const char* name(); static const int verbosity = 4; };
struct NetConnect: public LogChannel { static const char* name(); static const int verbosity = 10; };
struct NetMessageDetail: public LogChannel { static const char* name(); static const int verbosity = 5; };
struct NetTriviaSummary: public LogChannel { static const char* name(); static const int verbosity = 10; };
@ -224,7 +224,13 @@ class DeadlineOps
~DeadlineOp() {}
DeadlineOp(DeadlineOp&& _s): m_timer(_s.m_timer.release()) {}
DeadlineOp& operator=(DeadlineOp&& _s) { m_timer.reset(_s.m_timer.release()); return *this; }
DeadlineOp& operator=(DeadlineOp&& _s)
{
assert(&_s != this);
m_timer.reset(_s.m_timer.release());
return *this;
}
bool expired() { Guard l(x_timer); return m_timer->expires_from_now().total_nanoseconds() <= 0; }
void wait() { Guard l(x_timer); m_timer->wait(); }

4
libp2p/Host.cpp

@ -396,7 +396,7 @@ void Host::runAcceptor()
clog(NetConnect) << "Listening on local port " << m_listenPort << " (public: " << m_tcpPublic << ")";
m_accepting = true;
auto socket = make_shared<RLPXSocket>(new bi::tcp::socket(m_ioService));
auto socket = make_shared<RLPXSocket>(m_ioService);
m_tcp4Acceptor.async_accept(socket->ref(), [=](boost::system::error_code ec)
{
m_accepting = false;
@ -552,7 +552,7 @@ void Host::connect(std::shared_ptr<Peer> const& _p)
bi::tcp::endpoint ep(_p->endpoint);
clog(NetConnect) << "Attempting connection to node" << _p->id << "@" << ep << "from" << id();
auto socket = make_shared<RLPXSocket>(new bi::tcp::socket(m_ioService));
auto socket = make_shared<RLPXSocket>(m_ioService);
socket->ref().async_connect(ep, [=](boost::system::error_code const& ec)
{
_p->m_lastAttempted = std::chrono::system_clock::now();

3
libp2p/RLPXSocket.h

@ -39,8 +39,7 @@ namespace p2p
class RLPXSocket: public std::enable_shared_from_this<RLPXSocket>
{
public:
/// Constructor. Dereferences and takes ownership of _socket.
RLPXSocket(bi::tcp::socket* _socket): m_socket(std::move(*_socket)) {}
RLPXSocket(ba::io_service& _ioService): m_socket(_ioService) {}
~RLPXSocket() { close(); }
bool isConnected() const { return m_socket.is_open(); }

1
libsolidity/Token.h

@ -366,6 +366,7 @@ public:
}
static bool isBitOp(Value op) { return (BitOr <= op && op <= SHR) || op == BitNot; }
static bool isBooleanOp(Value op) { return (Or <= op && op <= And) || op == Not; }
static bool isUnaryOp(Value op) { return (Not <= op && op <= Delete) || op == Add || op == Sub || op == After; }
static bool isCountOp(Value op) { return op == Inc || op == Dec; }
static bool isShiftOp(Value op) { return (SHL <= op) && (op <= SHR); }

4
libsolidity/Types.cpp

@ -79,6 +79,8 @@ pair<u256, unsigned> const* StorageOffsets::getOffset(size_t _index) const
MemberList& MemberList::operator=(MemberList&& _other)
{
assert(&_other != this);
m_memberTypes = std::move(_other.m_memberTypes);
m_storageOffsets = std::move(_other.m_storageOffsets);
return *this;
@ -311,6 +313,8 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe
// All integer types can be compared
if (Token::isCompareOp(_operator))
return commonType;
if (Token::isBooleanOp(_operator))
return TypePointer();
// Nothing else can be done with addresses
if (commonType->isAddress())
return TypePointer();

4
libsolidity/Types.h

@ -409,6 +409,10 @@ public:
DataLocation location() const { return m_location; }
virtual TypePointer unaryOperatorResult(Token::Value _operator) const override;
virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override
{
return TypePointer();
}
virtual unsigned memoryHeadSize() const override { return 32; }
/// @returns a copy of this type with location (recursively) changed to @a _location,

1
libweb3jsonrpc/JsonHelper.cpp

@ -27,6 +27,7 @@
#include <libethereum/Client.h>
#include <libwebthree/WebThree.h>
#include <libethcore/CommonJS.h>
#include <libethcore/ICAP.h>
#include <libwhisper/Message.h>
#include <libwhisper/WhisperHost.h>
using namespace std;

6
libweb3jsonrpc/JsonHelper.h

@ -69,6 +69,12 @@ TransactionSkeleton toTransactionSkeleton(Json::Value const& _json);
LogFilter toLogFilter(Json::Value const& _json);
LogFilter toLogFilter(Json::Value const& _json, Interface const& _client); // commented to avoid warning. Uncomment once in use @ PoC-7.
class AddressResolver
{
public:
static Address fromJS(std::string const& _address);
};
template <class BlockInfoSub>
Json::Value toJson(BlockHeaderPolished<BlockInfoSub> const& _bh)
{

3
libweb3jsonrpc/WebThreeStubServer.cpp

@ -28,6 +28,7 @@
#include <libdevcore/FileSystem.h>
#include <libdevcore/CommonJS.h>
#include <libethcore/KeyManager.h>
#include <libethcore/ICAP.h>
#include <libethereum/Executive.h>
#include <libethereum/Block.h>
#include <libwebthree/WebThree.h>
@ -189,7 +190,7 @@ Json::Value WebThreeStubServer::admin_eth_newAccount(Json::Value const& _info, s
if (!_info.isMember("name"))
throw jsonrpc::JsonRpcException("No member found: name");
string name = _info["name"].asString();
auto s = Secret::random();
auto s = ICAP::createDirect();
h128 uuid;
if (_info.isMember("password"))
{

21
new.sh

@ -0,0 +1,21 @@
#!/bin/bash
type="$1"
path="$2"
name="$3"
if ! [[ -n $type ]] || ! [[ -n $path ]] || ! [[ -n $name ]]; then
echo "Usage new.sh <type> <path> <name>"
echo "e.g. new.sh plugin alethzero MyPlugin"
exit
fi
cd templates
for i in $type.*; do
n="../$path/${i/$type/$name}"
cp "$i" "$n"
perl -i -p -e "s/\\\$NAME/$name/gc" "$n"
done

41
templates/dockplugin.cpp

@ -0,0 +1,41 @@
/*
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 $NAME.h
* @author Gav Wood <i@gavwood.com>
* @date 2015
*/
#include "$NAME.h"
#include <libdevcore/Log.h>
#include <libethereum/Client.h>
#include "ui_$NAME.h"
using namespace std;
using namespace dev;
using namespace az;
using namespace eth;
$NAME::$NAME(MainFace* _m):
Plugin(_m, "$NAME"),
m_ui(new Ui::$NAME)
{
dock(Qt::RightDockWidgetArea, "$NAME")->setWidget(new QWidget());
m_ui->setupUi(dock()->widget());
}
$NAME::~$NAME()
{
}

56
templates/dockplugin.h

@ -0,0 +1,56 @@
/*
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 $NAME.h
* @author Gav Wood <i@gavwood.com>
* @date 2015
*/
#pragma once
#include <QListWidget>
#include <QPlainTextEdit>
#include "MainFace.h"
namespace Ui
{
class $NAME;
}
namespace dev
{
namespace az
{
class $NAME: public QObject, public Plugin
{
Q_OBJECT
public:
AllAccounts(MainFace* _m);
~AllAccounts();
private:
void onAllChange() override {}
void readSettings(QSettings const&) override {}
void writeSettings(QSettings&) override {}
private:
Ui::$NAME* m_ui;
};
}
}

36
templates/dockplugin.ui

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>$NAME</class>
<widget class="QWidget" name="NAME">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>405</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<resources/>
<connections/>
</ui>

37
templates/plugin.cpp

@ -0,0 +1,37 @@
/*
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 $NAME.h
* @author Gav Wood <i@gavwood.com>
* @date 2015
*/
#include "$NAME.h"
#include <libdevcore/Log.h>
#include <libethereum/Client.h>
using namespace std;
using namespace dev;
using namespace az;
using namespace eth;
$NAME::$NAME(MainFace* _m):
Plugin(_m, "$NAME")
{
}
$NAME::~$NAME()
{
}

46
templates/plugin.h

@ -0,0 +1,46 @@
/*
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 $NAME.h
* @author Gav Wood <i@gavwood.com>
* @date 2015
*/
#pragma once
#include "MainFace.h"
namespace dev
{
namespace az
{
class $NAME: public QObject, public Plugin
{
Q_OBJECT
public:
$NAME(MainFace* _m);
~$NAME();
private:
void onAllChange() override {}
void readSettings(QSettings const&) override {}
void writeSettings(QSettings&) override {}
};
}
}

5
test/TestUtils.cpp

@ -120,8 +120,3 @@ void ParallelClientBaseFixture::enumerateClients(std::function<void(Json::Value
});
}
MoveNonceToTempDir::MoveNonceToTempDir()
{
crypto::Nonce::seedFilePath(m_dir.path() + "/seed");
}

8
test/TestUtils.h

@ -79,13 +79,5 @@ struct JsonRpcFixture: public ClientBaseFixture
};
struct MoveNonceToTempDir
{
MoveNonceToTempDir();
~MoveNonceToTempDir() {}
private:
TransientDirectory m_dir;
};
}
}

54
test/libdevcore/Base36.cpp

@ -0,0 +1,54 @@
/*
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 Base36.cpp
* @author Marek Kotewicz <marek@ethdev.com>
* @date 2015
*/
#include <boost/test/unit_test.hpp>
#include <libdevcore/Base64.h>
#include <libethcore/ICAP.h>
using namespace std;
using namespace dev;
using namespace dev::eth;
BOOST_AUTO_TEST_SUITE(Base36Tests)
BOOST_AUTO_TEST_CASE(basicEncoding)
{
FixedHash<2> value("0x0048");
string encoded = toBase36<2>(value);
BOOST_CHECK_EQUAL(encoded, "20");
}
BOOST_AUTO_TEST_CASE(basicEncoding2)
{
FixedHash<2> value("0x0072");
string encoded = toBase36<2>(value);
BOOST_CHECK_EQUAL(encoded, "36");
}
BOOST_AUTO_TEST_CASE(basicEncoding3)
{
FixedHash<2> value("0xffff");
string encoded = toBase36<2>(value);
BOOST_CHECK_EQUAL(encoded, "1EKF");
}
BOOST_AUTO_TEST_SUITE_END()

2
test/libdevcrypto/SecretStore.cpp

@ -37,8 +37,6 @@ using namespace dev::test;
namespace js = json_spirit;
namespace fs = boost::filesystem;
BOOST_GLOBAL_FIXTURE( MoveNonceToTempDir )
BOOST_AUTO_TEST_SUITE(KeyStore)
BOOST_AUTO_TEST_CASE(basic_tests)

2
test/libdevcrypto/crypto.cpp

@ -40,8 +40,6 @@ using namespace dev::test;
using namespace dev::crypto;
using namespace CryptoPP;
BOOST_GLOBAL_FIXTURE( MoveNonceToTempDir )
BOOST_AUTO_TEST_SUITE(devcrypto)
static Secp256k1PP s_secp256k1;

80
test/libethcore/icap.cpp

@ -0,0 +1,80 @@
/*
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 icap.cpp
* @author Marek Kotewicz <marek@ethdev.com>
* @date 2015
*/
#include <boost/test/unit_test.hpp>
#include <libethcore/ICAP.h>
using namespace std;
using namespace dev;
using namespace dev::eth;
BOOST_AUTO_TEST_SUITE(IcapTests)
BOOST_AUTO_TEST_CASE(addressEncoding)
{
Address address("0x52dc504a422f0e2a9e7632a34a50f1a82f8224c7");
ICAP icap(address);
BOOST_CHECK_EQUAL(icap.encoded(), "XE499OG1EH8ZZI0KXC6N83EKGT1BM97P2O7");
}
BOOST_AUTO_TEST_CASE(addressEncodingRandomString)
{
Address address("0x11c5496aee77c1ba1f0854206a26dda82a81d6d8");
ICAP icap(address);
BOOST_CHECK_EQUAL(icap.encoded(), "XE1222Q908LN1QBBU6XUQSO1OHWJIOS46OO");
}
BOOST_AUTO_TEST_CASE(addressEncodingWithZeroPrefix)
{
Address address("0x00c5496aee77c1ba1f0854206a26dda82a81d6d8");
ICAP icap(address);
BOOST_CHECK_EQUAL(icap.encoded(), "XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS");
}
BOOST_AUTO_TEST_CASE(addressDecoding)
{
Address address("0x52dc504a422f0e2a9e7632a34a50f1a82f8224c7");
ICAP icap = ICAP::decoded("XE499OG1EH8ZZI0KXC6N83EKGT1BM97P2O7");
BOOST_CHECK_EQUAL(icap.direct(), address);
}
BOOST_AUTO_TEST_CASE(addressDecodingRandomString)
{
Address address("0x11c5496aee77c1ba1f0854206a26dda82a81d6d8");
ICAP icap = ICAP::decoded("XE1222Q908LN1QBBU6XUQSO1OHWJIOS46OO");
BOOST_CHECK_EQUAL(icap.direct(), address);
}
BOOST_AUTO_TEST_CASE(addressDecodingWithZeroPrefix)
{
Address address("0x00c5496aee77c1ba1f0854206a26dda82a81d6d8");
ICAP icap = ICAP::decoded("XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS");
BOOST_CHECK_EQUAL(icap.direct(), address);
}
BOOST_AUTO_TEST_CASE(addressDecodingAndEncoding)
{
std::string encoded = "XE499OG1EH8ZZI0KXC6N83EKGT1BM97P2O7";
ICAP icap = ICAP::decoded(encoded);
BOOST_CHECK_EQUAL(icap.encoded(), encoded);
}
BOOST_AUTO_TEST_SUITE_END()

28
test/libsolidity/SolidityNameAndTypeResolution.cpp

@ -1883,6 +1883,34 @@ BOOST_AUTO_TEST_CASE(positive_integers_to_unsigned_out_of_bound)
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
}
BOOST_AUTO_TEST_CASE(integer_boolean_operators)
{
char const* sourceCode1 = R"(
contract test { function() { uint x = 1; uint y = 2; x || y; } }
)";
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode1), TypeError);
char const* sourceCode2 = R"(
contract test { function() { uint x = 1; uint y = 2; x && y; } }
)";
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode2), TypeError);
char const* sourceCode3 = R"(
contract test { function() { uint x = 1; !x; } }
)";
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode3), TypeError);
}
BOOST_AUTO_TEST_CASE(reference_compare_operators)
{
char const* sourceCode1 = R"(
contract test { bytes a; bytes b; function() { a == b; } }
)";
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode1), TypeError);
char const* sourceCode2 = R"(
contract test { struct s {uint a;}; s x; s y; function() { x == y; } }
)";
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode2), TypeError);
}
BOOST_AUTO_TEST_CASE(overwrite_memory_location_external)
{
char const* sourceCode = R"(

Loading…
Cancel
Save