Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rewriting command string arguments in ethvm and eth
  • Loading branch information
demon1999 committed Oct 4, 2017
commit eb4f786cb4bdb68753c4c8ab26f7bf0bdb49eb85
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,5 @@ endif()

# TODO: Split out json_spirit, libscrypt and sec256k1.
add_subdirectory(utils)

add_executable(main ethvm/main.cpp)
35 changes: 31 additions & 4 deletions eth/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void help()
<< " --only <n> Equivalent to --export-from n --export-to n.\n"
<< " --dont-check Prevent checking some block aspects. Faster importing, but to apply only when the data is known to be valid.\n\n"
<< " --import-snapshot <path> Import blockchain and state data from the Parity Warp Sync snapshot." << endl
<< "General Options:\n"
<< "General Options:\n"
<< " -d,--db-path,--datadir <path> Load database from path (default: " << getDataDir() << ").\n"
#if ETH_EVMJIT
<< " --vm <vm-kind> Select VM; options are: interpreter, jit or smart (default: interpreter).\n"
Expand Down Expand Up @@ -413,10 +413,10 @@ int main(int argc, char** argv)
clientDefaultMode.add_options()
("mainnet", "Use the main network protocol.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some lines are indented with spaces, please change to tabs everywhere

("ropsten", "Use the Ropsten testnet.")
("private", po::value<string>(), "<name> Use a private chain.")
("private", po::value<string>(), "<name> Use a private chain.")
("test", "Testing mode: Disable PoW and provide test rpc interface.")
("config", po::value<string>(), "<file> Configure specialised blockchain using given JSON information.")
("oppose-dao-fork", "Ignore DAO hard fork (default is to participate).")
("oppose-dao-fork", "Ignore DAO hard fork (default is to participate).\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and -f options are not supported anymore.
Probably there're more outdated options, I'll take a closer look later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

("mode,o", po::value<string>(), "<full/peer> Start a full node or a peer node (default: full).\n")
("json-rpc,j", "Enable JSON-RPC server (default: off).")
("ipc", "Enable IPC server (default: on).")
Expand Down Expand Up @@ -466,14 +466,41 @@ int main(int argc, char** argv)
("port", po::value<short>(), "<port> Connect to the given remote port (default: 30303).")
("network-id", po::value<long>(), "<n> Only connect to other hosts with this network id.")
("upnp", po::value<string>(), "<on/off> Use UPnP for NAT (default: on).")
("peerset", po::value<string>(), "<list> Space delimited list of peers; element format: type:publickey@ipAddress[:port].\n Types:\n default Attempt connection when no other peers are available and pinning is disabled.\n required Keep connected at all times.\n")
("peerset", po::value<string>(), "<list> Space delimited list of peers; element format: type:publickey@ipAddress[:port].\n Types:\n default Attempt connection when no other peers are available and pinning is disabled.\n required Keep connected at all times.\n")
// TODO:
// << " --trust-peers <filename> Space delimited list of publickeys." << endl
("no-discovery", "Disable node discovery, implies --no-bootstrap.")
("pin", "Only accept or connect to trusted peers.")
("hermit", "Equivalent to --no-discovery --pin.")
("sociable", "Force discovery and no pinning.\n")
;
po::options_description importExportMode("Import/export mode");
importExportMode.add_options()
("from", po::value<string>(), "<n> Export only from block n; n may be a decimal, a '0x' prefixed hash, or 'latest'.")
("to", po::value<string>(), "<n> Export only to block n (inclusive); n may be a decimal, a '0x' prefixed hash, or 'latest'.")
("only", po::value<string>(), "<n> Equivalent to --export-from n --export-to n.")
("dont-check", "Prevent checking some block aspects. Faster importing, but to apply only when the data is known to be valid.\n")
("import-snapshot", po::value<string>(), "<path> Import blockchain and state data from the Parity Warp Sync snapshot.")
;
po::options_description generalOptions("General Options");
generalOptions.add_options()
//TODO " -d,--db-path,--datadir <path> Load database from path (default: " << getDataDir() << ").\n"
//TODO #if ETH_EVMJIT
//TODO << " --vm <vm-kind> Select VM; options are: interpreter, jit or smart (default: interpreter).\n"
//TODO #endif // ETH_EVMJIT
("verbosity,v", po::value<int>(), "<0 - 9> Set the log verbosity from 0 to 9 (default: 8).")
("version,V", "Show the version and exit.")
("help,h", "Show this help message and exit.\n")
;
po::options_description experimentalProofOfConcept("Experimental / Proof of Concept");
experimentalProofOfConcept.add_options()
("shh", "Enable Whisper.\n")
;
po::options_description allowedOptions("Allowed options");
allowedOptions.add(clientDefaultMode).add(clientTransacting).add(clientMining).add(clientNetworking).add(importExportMode).add(generalOptions);
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, allowedOptions), vm);
po::notify(vm);
for (int i = 1; i < argc; ++i)
{
string arg = argv[i];
Expand Down
37 changes: 35 additions & 2 deletions ethvm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@
#include <libevm/VM.h>
#include <libevm/VMFactory.h>
#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp>
#include <fstream>
#include <iostream>
#include <ctime>
using namespace std;
using namespace dev;
using namespace eth;

namespace po = boost::program_options;
namespace
{
int64_t maxBlockGasLimit()
Expand Down Expand Up @@ -149,7 +150,39 @@ int main(int argc, char** argv)

Ethash::init();
NoProof::init();

po::options_description transactionOptions("Transaction options");
transactionOptions.add_options()
("value", po::value<string>(), "<n> Transaction should transfer the <n> wei (default: 0).")
("gas", po::value<string>(), "<n> Transaction should be given <n> gas (default: block gas limit).")
//TODO ("gas-limit", "<n> Block gas limit (default: " << maxBlockGasLimit() << ").")
("gas-price", po::value<string>(), "<n> Transaction's gas price' should be <n> (default: 0).")
("sender", po::value<string>(), "<a> Transaction sender should be <a> (default: 0000...0069).")
("origin", po::value<string>(), "<a> Transaction origin should be <a> (default: 0000...0069).")
("input", po::value<string>(), "<d> Transaction code should be <d>")
("code", po::value<string>(), "<d> Contract code <d>. Makes transaction a call to this contract")
;
po::options_description vmOptions("VM options");
#if ETH_EVMJIT
vmOptions.add_options()
("vm", "<vm-kind> Select VM. Options are: interpreter, jit, smart. (default: interpreter)")
;
#endif // ETH_EVMJIT
po::options_description networkOptions("Network options");
networkOptions.add_options()
("network", po::value<string>(), "Main|Ropsten|Homestead|Frontier|Byzantium|Constantinople\n");
;
po::options_description optionsForTrace("Options for trace");
optionsForTrace.add_options()
("flat", "Minimal whitespace in the JSON.")
("mnemonics", "Show instruction mnemonics in the trace (non-standard).\n")
;
po::options_description generalOptions("General options");
generalOptions.add_options()
("version,v", "Show the version and exit.")
("help,h", "Show this help message and exit.")
;
po::options_description allowedOptions("Usage ethvm <options> [trace|stats|output|test] (<file>|-)");
allowedOptions.add(transactionOptions).add(vmOptions).add(networkOptions).add(optionsForTrace).add(generalOptions);
for (int i = 1; i < argc; ++i)
{
string arg = argv[i];
Expand Down