aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCJentzsch <jentzsch.software@gmail.com>2015-03-12 21:35:05 +0800
committerCJentzsch <jentzsch.software@gmail.com>2015-03-12 21:35:05 +0800
commit24754c4693314cb9375ad549c8b8731559041793 (patch)
tree1afc2bf7e954bdea7662b08139d122904ee57a4b
parent08bc97766032b95e630095a6efe0c76997bc062f (diff)
parent8371e8934e0b55400db0dce5e28c3e3ae5a676f7 (diff)
downloaddexon-solidity-24754c4693314cb9375ad549c8b8731559041793.tar
dexon-solidity-24754c4693314cb9375ad549c8b8731559041793.tar.gz
dexon-solidity-24754c4693314cb9375ad549c8b8731559041793.tar.bz2
dexon-solidity-24754c4693314cb9375ad549c8b8731559041793.tar.lz
dexon-solidity-24754c4693314cb9375ad549c8b8731559041793.tar.xz
dexon-solidity-24754c4693314cb9375ad549c8b8731559041793.tar.zst
dexon-solidity-24754c4693314cb9375ad549c8b8731559041793.zip
Merge remote-tracking branch 'upstream/develop' into randomStateTests
-rw-r--r--TestHelper.cpp80
-rw-r--r--TestHelper.h27
-rw-r--r--state.cpp60
-rw-r--r--transaction.cpp17
-rw-r--r--vm.cpp69
-rw-r--r--webthreestubclient.h283
6 files changed, 246 insertions, 290 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index 4d556341..60f526d7 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -439,8 +439,6 @@ void userDefinedTest(string testTypeFlag, std::function<void(json_spirit::mValue
}
g_logVerbosity = currentVerbosity;
}
- else
- continue;
}
}
@@ -449,32 +447,27 @@ void executeTests(const string& _name, const string& _testPathAppendix, std::fun
string testPath = getTestPath();
testPath += _testPathAppendix;
- for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
+ if (Options::get().fillTests)
{
- string arg = boost::unit_test::framework::master_test_suite().argv[i];
- if (arg == "--filltests")
+ try
{
- try
- {
- cnote << "Populating tests...";
- json_spirit::mValue v;
- boost::filesystem::path p(__FILE__);
- boost::filesystem::path dir = p.parent_path();
- string s = asString(dev::contents(dir.string() + "/" + _name + "Filler.json"));
- BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + dir.string() + "/" + _name + "Filler.json is empty.");
- json_spirit::read_string(s, v);
- doTests(v, true);
- writeFile(testPath + "/" + _name + ".json", asBytes(json_spirit::write_string(v, true)));
- }
- catch (Exception const& _e)
- {
- BOOST_ERROR("Failed filling test with Exception: " << diagnostic_information(_e));
- }
- catch (std::exception const& _e)
- {
- BOOST_ERROR("Failed filling test with Exception: " << _e.what());
- }
- break;
+ cnote << "Populating tests...";
+ json_spirit::mValue v;
+ boost::filesystem::path p(__FILE__);
+ boost::filesystem::path dir = p.parent_path();
+ string s = asString(dev::contents(dir.string() + "/" + _name + "Filler.json"));
+ BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + dir.string() + "/" + _name + "Filler.json is empty.");
+ json_spirit::read_string(s, v);
+ doTests(v, true);
+ writeFile(testPath + "/" + _name + ".json", asBytes(json_spirit::write_string(v, true)));
+ }
+ catch (Exception const& _e)
+ {
+ BOOST_ERROR("Failed filling test with Exception: " << diagnostic_information(_e));
+ }
+ catch (std::exception const& _e)
+ {
+ BOOST_ERROR("Failed filling test with Exception: " << _e.what());
}
}
@@ -541,21 +534,48 @@ RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj)
return rlpStream;
}
-void processCommandLineOptions()
+Options::Options()
{
auto argc = boost::unit_test::framework::master_test_suite().argc;
auto argv = boost::unit_test::framework::master_test_suite().argv;
- for (auto i = 0; i < argc; ++i)
+ for (auto i = 0; i < argc; ++i)
{
- if (std::string(argv[i]) == "--jit")
+ auto arg = std::string{argv[i]};
+ if (arg == "--jit")
{
+ jit = true;
eth::VMFactory::setKind(eth::VMKind::JIT);
- break;
+ }
+ else if (arg == "--vmtrace")
+ vmtrace = true;
+ else if (arg == "--performance")
+ performance = true;
+ else if (arg == "--quadratic")
+ quadratic = true;
+ else if (arg == "--memory")
+ memory = true;
+ else if (arg == "--inputlimits")
+ inputLimits = true;
+ else if (arg == "--bigdata")
+ bigData = true;
+ else if (arg == "--all")
+ {
+ performance = true;
+ quadratic = true;
+ memory = true;
+ inputLimits = true;
+ bigData = true;
}
}
}
+Options const& Options::get()
+{
+ static Options instance;
+ return instance;
+}
+
LastHashes lastHashes(u256 _currentBlockNumber)
{
LastHashes ret;
diff --git a/TestHelper.h b/TestHelper.h
index d378848a..9efed0fa 100644
--- a/TestHelper.h
+++ b/TestHelper.h
@@ -141,7 +141,6 @@ void executeTests(const std::string& _name, const std::string& _testPathAppendix
std::string getTestPath();
void userDefinedTest(std::string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests);
RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj);
-void processCommandLineOptions();
eth::LastHashes lastHashes(u256 _currentBlockNumber);
json_spirit::mObject fillJsonWithState(eth::State _state);
@@ -158,5 +157,31 @@ void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs)
BOOST_CHECK(_expectedAddrs == _resultAddrs);
}
+class Options
+{
+public:
+ bool jit = false; ///< Use JIT
+ bool vmtrace = false; ///< Create EVM execution tracer // TODO: Link with log verbosity?
+ bool showTimes = false; ///< Print test groups execution times
+ bool fillTests = false; ///< Create JSON test files from execution results
+
+ /// Test selection
+ /// @{
+ bool performance = false;
+ bool quadratic = false;
+ bool memory = false;
+ bool inputLimits = false;
+ bool bigData = false;
+ /// @}
+
+ /// Get reference to options
+ /// The first time used, options are parsed
+ static Options const& get();
+
+private:
+ Options();
+ Options(Options const&) = delete;
+};
+
}
}
diff --git a/state.cpp b/state.cpp
index 1c8f4301..ba1eb8c0 100644
--- a/state.cpp
+++ b/state.cpp
@@ -41,7 +41,7 @@ namespace dev { namespace test {
void doStateTests(json_spirit::mValue& v, bool _fillin)
{
- processCommandLineOptions();
+ Options::get(); // process command line options
for (auto& i: v.get_obj())
{
@@ -172,48 +172,40 @@ BOOST_AUTO_TEST_CASE(stBlockHashTest)
BOOST_AUTO_TEST_CASE(stQuadraticComplexityTest)
{
- for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
- {
- string arg = boost::unit_test::framework::master_test_suite().argv[i];
- if (arg == "--quadratic" || arg == "--all")
- {
- auto start = chrono::steady_clock::now();
-
- dev::test::executeTests("stQuadraticComplexityTest", "/StateTests", dev::test::doStateTests);
-
- auto end = chrono::steady_clock::now();
- auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
- cnote << "test duration: " << duration.count() << " milliseconds.\n";
- }
- }
+ if (test::Options::get().quadratic)
+ {
+ auto start = chrono::steady_clock::now();
+
+ dev::test::executeTests("stQuadraticComplexityTest", "/StateTests", dev::test::doStateTests);
+
+ auto end = chrono::steady_clock::now();
+ auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
+ cnote << "test duration: " << duration.count() << " milliseconds.\n";
+ }
}
BOOST_AUTO_TEST_CASE(stMemoryStressTest)
{
- for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
- {
- string arg = boost::unit_test::framework::master_test_suite().argv[i];
- if (arg == "--memory" || arg == "--all")
- {
- auto start = chrono::steady_clock::now();
-
- dev::test::executeTests("stMemoryStressTest", "/StateTests", dev::test::doStateTests);
-
- auto end = chrono::steady_clock::now();
- auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
- cnote << "test duration: " << duration.count() << " milliseconds.\n";
- }
- }
+ if (test::Options::get().memory)
+ {
+ auto start = chrono::steady_clock::now();
+
+ dev::test::executeTests("stMemoryStressTest", "/StateTests", dev::test::doStateTests);
+
+ auto end = chrono::steady_clock::now();
+ auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
+ cnote << "test duration: " << duration.count() << " milliseconds.\n";
+ }
}
- BOOST_AUTO_TEST_CASE(stSolidityTest)
- {
- dev::test::executeTests("stSolidityTest", "/StateTests", dev::test::doStateTests);
- }
+BOOST_AUTO_TEST_CASE(stSolidityTest)
+{
+ dev::test::executeTests("stSolidityTest", "/StateTests", dev::test::doStateTests);
+}
BOOST_AUTO_TEST_CASE(stMemoryTest)
{
- dev::test::executeTests("stMemoryTest", "/StateTests", dev::test::doStateTests);
+ dev::test::executeTests("stMemoryTest", "/StateTests", dev::test::doStateTests);
}
diff --git a/transaction.cpp b/transaction.cpp
index 83fd8da4..77f6ecda 100644
--- a/transaction.cpp
+++ b/transaction.cpp
@@ -116,21 +116,16 @@ BOOST_AUTO_TEST_CASE(ttWrongRLPTransaction)
BOOST_AUTO_TEST_CASE(tt10mbDataField)
{
- for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
+ if (test::Options::get().bigData)
{
- string arg = boost::unit_test::framework::master_test_suite().argv[i];
- if (arg == "--bigdata" || arg == "--all")
- {
- auto start = chrono::steady_clock::now();
+ auto start = chrono::steady_clock::now();
- dev::test::executeTests("tt10mbDataField", "/TransactionTests", dev::test::doTransactionTests);
+ dev::test::executeTests("tt10mbDataField", "/TransactionTests", dev::test::doTransactionTests);
- auto end = chrono::steady_clock::now();
- auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
- cnote << "test duration: " << duration.count() << " milliseconds.\n";
- }
+ auto end = chrono::steady_clock::now();
+ auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
+ cnote << "test duration: " << duration.count() << " milliseconds.\n";
}
-
}
BOOST_AUTO_TEST_CASE(ttCreateTest)
diff --git a/vm.cpp b/vm.cpp
index a39f0005..4433a60e 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -312,7 +312,7 @@ namespace dev { namespace test {
void doVMTests(json_spirit::mValue& v, bool _fillin)
{
- processCommandLineOptions();
+ Options::get(); // process command line options // TODO: We need to control the main() function
for (auto& i: v.get_obj())
{
@@ -344,7 +344,8 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
try
{
auto vm = eth::VMFactory::create(fev.gas);
- output = vm->go(fev, fev.simpleTrace()).toBytes();
+ auto vmtrace = Options::get().vmtrace ? fev.simpleTrace() : OnOpFunc{};
+ output = vm->go(fev, vmtrace).toBytes();
gas = vm->gas();
}
catch (VMException const&)
@@ -364,18 +365,12 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
}
auto endTime = std::chrono::high_resolution_clock::now();
- auto argc = boost::unit_test::framework::master_test_suite().argc;
- auto argv = boost::unit_test::framework::master_test_suite().argv;
- for (auto i = 0; i < argc; ++i)
+ if (Options::get().showTimes)
{
- if (std::string(argv[i]) == "--show-times")
- {
- auto testDuration = endTime - startTime;
- cnote << "Execution time: "
- << std::chrono::duration_cast<std::chrono::milliseconds>(testDuration).count()
- << " ms";
- break;
- }
+ auto testDuration = endTime - startTime;
+ cnote << "Execution time: "
+ << std::chrono::duration_cast<std::chrono::milliseconds>(testDuration).count()
+ << " ms";
}
// delete null entries in storage for the sake of comparison
@@ -517,58 +512,42 @@ BOOST_AUTO_TEST_CASE(vmSystemOperationsTest)
BOOST_AUTO_TEST_CASE(vmPerformanceTest)
{
- for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
+ if (test::Options::get().performance)
{
- string arg = boost::unit_test::framework::master_test_suite().argv[i];
- if (arg == "--performance" || arg == "--all")
- {
- auto start = chrono::steady_clock::now();
+ auto start = chrono::steady_clock::now();
- dev::test::executeTests("vmPerformanceTest", "/VMTests", dev::test::doVMTests);
+ dev::test::executeTests("vmPerformanceTest", "/VMTests", dev::test::doVMTests);
- auto end = chrono::steady_clock::now();
- auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
- cnote << "test duration: " << duration.count() << " milliseconds.\n";
- }
+ auto end = chrono::steady_clock::now();
+ auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
+ cnote << "test duration: " << duration.count() << " milliseconds.\n";
}
}
BOOST_AUTO_TEST_CASE(vmInputLimitsTest1)
{
- for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
+ if (test::Options::get().inputLimits)
{
- string arg = boost::unit_test::framework::master_test_suite().argv[i];
- if (arg == "--inputlimits" || arg == "--all")
- {
- auto start = chrono::steady_clock::now();
+ auto start = chrono::steady_clock::now();
- dev::test::executeTests("vmInputLimits1", "/VMTests", dev::test::doVMTests);
+ dev::test::executeTests("vmInputLimits1", "/VMTests", dev::test::doVMTests);
- auto end = chrono::steady_clock::now();
- auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
- cnote << "test duration: " << duration.count() << " milliseconds.\n";
- }
+ auto end = chrono::steady_clock::now();
+ auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
+ cnote << "test duration: " << duration.count() << " milliseconds.\n";
}
}
BOOST_AUTO_TEST_CASE(vmInputLimitsTest2)
{
- for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
- {
- string arg = boost::unit_test::framework::master_test_suite().argv[i];
- if (arg == "--inputlimits" || arg == "--all")
- dev::test::executeTests("vmInputLimits2", "/VMTests", dev::test::doVMTests);
- }
+ if (test::Options::get().inputLimits)
+ dev::test::executeTests("vmInputLimits2", "/VMTests", dev::test::doVMTests);
}
BOOST_AUTO_TEST_CASE(vmInputLimitsLightTest)
{
- for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
- {
- string arg = boost::unit_test::framework::master_test_suite().argv[i];
- if (arg == "--inputlimits" || arg == "--all")
- dev::test::executeTests("vmInputLimitsLight", "/VMTests", dev::test::doVMTests);
- }
+ if (test::Options::get().inputLimits)
+ dev::test::executeTests("vmInputLimitsLight", "/VMTests", dev::test::doVMTests);
}
BOOST_AUTO_TEST_CASE(vmRandom)
diff --git a/webthreestubclient.h b/webthreestubclient.h
index 6d97ea67..baa0798a 100644
--- a/webthreestubclient.h
+++ b/webthreestubclient.h
@@ -22,43 +22,33 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string eth_coinbase() throw (jsonrpc::JsonRpcException)
+ std::string net_peerCount() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
- Json::Value result = this->CallMethod("eth_coinbase",p);
+ Json::Value result = this->CallMethod("net_peerCount",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool eth_setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException)
- {
- Json::Value p;
- p.append(param1);
- Json::Value result = this->CallMethod("eth_setCoinbase",p);
- if (result.isBool())
- return result.asBool();
- else
- throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
- }
- bool eth_listening() throw (jsonrpc::JsonRpcException)
+ bool net_listening() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
- Json::Value result = this->CallMethod("eth_listening",p);
+ Json::Value result = this->CallMethod("net_listening",p);
if (result.isBool())
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool eth_setListening(bool param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_coinbase() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
- p.append(param1);
- Json::Value result = this->CallMethod("eth_setListening",p);
- if (result.isBool())
- return result.asBool();
+ p = Json::nullValue;
+ Json::Value result = this->CallMethod("eth_coinbase",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
@@ -72,16 +62,6 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool eth_setMining(bool param1) throw (jsonrpc::JsonRpcException)
- {
- Json::Value p;
- p.append(param1);
- Json::Value result = this->CallMethod("eth_setMining",p);
- if (result.isBool())
- return result.asBool();
- else
- throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
- }
std::string eth_gasPrice() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
@@ -102,151 +82,127 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- int eth_peerCount() throw (jsonrpc::JsonRpcException)
- {
- Json::Value p;
- p = Json::nullValue;
- Json::Value result = this->CallMethod("eth_peerCount",p);
- if (result.isInt())
- return result.asInt();
- else
- throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
- }
- int eth_defaultBlock() throw (jsonrpc::JsonRpcException)
+ std::string eth_blockNumber() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
- Json::Value result = this->CallMethod("eth_defaultBlock",p);
- if (result.isInt())
- return result.asInt();
+ Json::Value result = this->CallMethod("eth_blockNumber",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool eth_setDefaultBlock(int param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_getBalance(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_setDefaultBlock",p);
- if (result.isBool())
- return result.asBool();
+ p.append(param2);
+ Json::Value result = this->CallMethod("eth_getBalance",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- int eth_number() throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getStorage(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
- p = Json::nullValue;
- Json::Value result = this->CallMethod("eth_number",p);
- if (result.isInt())
- return result.asInt();
+ p.append(param1);
+ p.append(param2);
+ Json::Value result = this->CallMethod("eth_getStorage",p);
+ if (result.isObject())
+ return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string eth_balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_getStorageAt(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_balanceAt",p);
+ p.append(param2);
+ p.append(param3);
+ Json::Value result = this->CallMethod("eth_getStorageAt",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string eth_stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
+ std::string eth_getTransactionCount(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
- Json::Value result = this->CallMethod("eth_stateAt",p);
+ Json::Value result = this->CallMethod("eth_getTransactionCount",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_storageAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
- {
- Json::Value p;
- p.append(param1);
- Json::Value result = this->CallMethod("eth_storageAt",p);
- if (result.isObject())
- return result;
- else
- throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
- }
- double eth_countAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_getBlockTransactionCountByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_countAt",p);
- if (result.isDouble())
- return result.asDouble();
- else
- throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
- }
- double eth_transactionCountByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
- {
- Json::Value p;
- p.append(param1);
- Json::Value result = this->CallMethod("eth_transactionCountByHash",p);
- if (result.isDouble())
- return result.asDouble();
+ Json::Value result = this->CallMethod("eth_getBlockTransactionCountByHash",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- double eth_transactionCountByNumber(int param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_getBlockTransactionCountByNumber(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_transactionCountByNumber",p);
- if (result.isDouble())
- return result.asDouble();
+ Json::Value result = this->CallMethod("eth_getBlockTransactionCountByNumber",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- double eth_uncleCountByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_getUncleCountByBlockHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_uncleCountByHash",p);
- if (result.isDouble())
- return result.asDouble();
+ Json::Value result = this->CallMethod("eth_getUncleCountByBlockHash",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- double eth_uncleCountByNumber(int param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_getUncleCountByBlockNumber(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_uncleCountByNumber",p);
- if (result.isDouble())
- return result.asDouble();
+ Json::Value result = this->CallMethod("eth_getUncleCountByBlockNumber",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string eth_codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_getData(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_codeAt",p);
+ p.append(param2);
+ Json::Value result = this->CallMethod("eth_getData",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string eth_transact(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_sendTransaction(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_transact",p);
+ Json::Value result = this->CallMethod("eth_sendTransaction",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string eth_call(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_call(const Json::Value& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
+ p.append(param2);
Json::Value result = this->CallMethod("eth_call",p);
if (result.isString())
return result.asString();
@@ -263,131 +219,143 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_blockByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getBlockByHash(const std::string& param1, bool param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_blockByHash",p);
+ p.append(param2);
+ Json::Value result = this->CallMethod("eth_getBlockByHash",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_blockByNumber(int param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getBlockByNumber(const std::string& param1, bool param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_blockByNumber",p);
+ p.append(param2);
+ Json::Value result = this->CallMethod("eth_getBlockByNumber",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_transactionByHash(const std::string& param1, int param2) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getTransactionByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ {
+ Json::Value p;
+ p.append(param1);
+ Json::Value result = this->CallMethod("eth_getTransactionByHash",p);
+ if (result.isObject())
+ return result;
+ else
+ throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
+ }
+ Json::Value eth_getTransactionByBlockHashAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
- Json::Value result = this->CallMethod("eth_transactionByHash",p);
+ Json::Value result = this->CallMethod("eth_getTransactionByBlockHashAndIndex",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_transactionByNumber(int param1, int param2) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getTransactionByBlockNumberAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
- Json::Value result = this->CallMethod("eth_transactionByNumber",p);
+ Json::Value result = this->CallMethod("eth_getTransactionByBlockNumberAndIndex",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_uncleByHash(const std::string& param1, int param2) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getUncleByBlockHashAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
- Json::Value result = this->CallMethod("eth_uncleByHash",p);
+ Json::Value result = this->CallMethod("eth_getUncleByBlockHashAndIndex",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_uncleByNumber(int param1, int param2) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getUncleByBlockNumberAndIndex(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
- Json::Value result = this->CallMethod("eth_uncleByNumber",p);
+ Json::Value result = this->CallMethod("eth_getUncleByBlockNumberAndIndex",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_compilers() throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getCompilers() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
- Json::Value result = this->CallMethod("eth_compilers",p);
+ Json::Value result = this->CallMethod("eth_getCompilers",p);
if (result.isArray())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string eth_lll(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_compileLLL(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_lll",p);
+ Json::Value result = this->CallMethod("eth_compileLLL",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string eth_solidity(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_compileSerpent(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_solidity",p);
+ Json::Value result = this->CallMethod("eth_compileSerpent",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string eth_serpent(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_compileSolidity(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_serpent",p);
+ Json::Value result = this->CallMethod("eth_compileSolidity",p);
if (result.isString())
return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- int eth_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
Json::Value result = this->CallMethod("eth_newFilter",p);
- if (result.isInt())
- return result.asInt();
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- int eth_newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_newBlockFilter(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_newFilterString",p);
- if (result.isInt())
- return result.asInt();
+ Json::Value result = this->CallMethod("eth_newBlockFilter",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool eth_uninstallFilter(int param1) throw (jsonrpc::JsonRpcException)
+ bool eth_uninstallFilter(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
@@ -397,31 +365,31 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_changed(int param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getFilterChanges(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_changed",p);
+ Json::Value result = this->CallMethod("eth_getFilterChanges",p);
if (result.isArray())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_filterLogs(int param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getFilterLogs(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_filterLogs",p);
+ Json::Value result = this->CallMethod("eth_getFilterLogs",p);
if (result.isArray())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_logs(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getLogs(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_logs",p);
+ Json::Value result = this->CallMethod("eth_getLogs",p);
if (result.isArray())
return result;
else
@@ -448,17 +416,17 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- int eth_register(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_register(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
Json::Value result = this->CallMethod("eth_register",p);
- if (result.isInt())
- return result.asInt();
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool eth_unregister(int param1) throw (jsonrpc::JsonRpcException)
+ bool eth_unregister(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
@@ -468,11 +436,11 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value eth_queuedTransactions(int param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_fetchQueuedTransactions(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("eth_queuedTransactions",p);
+ Json::Value result = this->CallMethod("eth_fetchQueuedTransactions",p);
if (result.isArray())
return result;
else
@@ -501,29 +469,6 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool db_putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
- {
- Json::Value p;
- p.append(param1);
- p.append(param2);
- p.append(param3);
- Json::Value result = this->CallMethod("db_putString",p);
- if (result.isBool())
- return result.asBool();
- else
- throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
- }
- std::string db_getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
- {
- Json::Value p;
- p.append(param1);
- p.append(param2);
- Json::Value result = this->CallMethod("db_getString",p);
- if (result.isString())
- return result.asString();
- else
- throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
- }
bool shh_post(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
@@ -544,11 +489,11 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool shh_haveIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ bool shh_hasIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("shh_haveIdentity",p);
+ Json::Value result = this->CallMethod("shh_hasIdentity",p);
if (result.isBool())
return result.asBool();
else
@@ -576,17 +521,17 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- int shh_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
+ std::string shh_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
Json::Value result = this->CallMethod("shh_newFilter",p);
- if (result.isInt())
- return result.asInt();
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool shh_uninstallFilter(int param1) throw (jsonrpc::JsonRpcException)
+ bool shh_uninstallFilter(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
@@ -596,17 +541,17 @@ class WebThreeStubClient : public jsonrpc::Client
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value shh_changed(int param1) throw (jsonrpc::JsonRpcException)
+ Json::Value shh_getFilterChanges(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->CallMethod("shh_changed",p);
+ Json::Value result = this->CallMethod("shh_getFilterChanges",p);
if (result.isArray())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value shh_getMessages(int param1) throw (jsonrpc::JsonRpcException)
+ Json::Value shh_getMessages(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);