aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TestHelper.cpp43
-rw-r--r--TestHelper.h2
-rw-r--r--createRandomTest.cpp15
-rw-r--r--jsonrpc.cpp46
-rw-r--r--solidityCompiler.cpp8
-rw-r--r--solidityEndToEndTest.cpp305
-rw-r--r--solidityExpressionCompiler.cpp111
-rw-r--r--solidityNameAndTypeResolution.cpp16
-rw-r--r--solidityScanner.cpp26
-rw-r--r--stPreCompiledContractsFiller.json717
-rw-r--r--stSystemOperationsTestFiller.json1334
-rw-r--r--state.cpp19
-rw-r--r--tmpFiller.json44
-rw-r--r--vm.cpp59
-rw-r--r--vm.h2
-rw-r--r--vmArithmeticTestFiller.json14
-rw-r--r--webthreestubclient.h333
-rw-r--r--whisperTopic.cpp84
18 files changed, 2794 insertions, 384 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index ca46c2ca..c1a141ab 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -253,7 +253,7 @@ bytes importCode(json_spirit::mObject& _o)
code.clear();
for (auto const& j: _o["code"].get_array())
code.push_back(toByte(j));
- }
+ }
return code;
}
@@ -305,6 +305,47 @@ std::string getTestPath()
return testPath;
}
+void userDefinedTest(string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests)
+{
+ 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 == testTypeFlag)
+ {
+ if (i + 1 >= boost::unit_test::framework::master_test_suite().argc)
+ {
+ cnote << "Missing filename\nUsage: testeth " << testTypeFlag << " <filename>\n";
+ return;
+ }
+ string filename = boost::unit_test::framework::master_test_suite().argv[i + 1];
+ int currentVerbosity = g_logVerbosity;
+ g_logVerbosity = 12;
+ try
+ {
+ cnote << "Testing user defined test: " << filename;
+ json_spirit::mValue v;
+ string s = asString(contents(filename));
+ BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + filename + " is empty. ");
+ json_spirit::read_string(s, v);
+ doTests(v, false);
+ }
+ catch (Exception const& _e)
+ {
+ BOOST_ERROR("Failed Test with Exception: " << diagnostic_information(_e));
+ g_logVerbosity = currentVerbosity;
+ }
+ catch (std::exception const& _e)
+ {
+ BOOST_ERROR("Failed Test with Exception: " << _e.what());
+ g_logVerbosity = currentVerbosity;
+ }
+ g_logVerbosity = currentVerbosity;
+ }
+ else
+ continue;
+ }
+}
+
void executeTests(const string& _name, const string& _testPathAppendix, std::function<void(json_spirit::mValue&, bool)> doTests)
{
string testPath = getTestPath();
diff --git a/TestHelper.h b/TestHelper.h
index 622b83ac..ef67d52f 100644
--- a/TestHelper.h
+++ b/TestHelper.h
@@ -57,7 +57,6 @@ public:
eth::State m_statePost;
eth::ExtVMFace m_environment;
eth::Transaction m_transaction;
- bytes code;
private:
json_spirit::mObject& m_TestObject;
@@ -72,6 +71,7 @@ void checkOutput(bytes const& _output, json_spirit::mObject& _o);
void checkStorage(std::map<u256, u256> _expectedStore, std::map<u256, u256> _resultStore, Address _expectedAddr);
void executeTests(const std::string& _name, const std::string& _testPathAppendix, std::function<void(json_spirit::mValue&, bool)> doTests);
std::string getTestPath();
+void userDefinedTest(std::string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests);
template<typename mapType>
void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs)
diff --git a/createRandomTest.cpp b/createRandomTest.cpp
index 29e0b7f0..f22e5c0a 100644
--- a/createRandomTest.cpp
+++ b/createRandomTest.cpp
@@ -31,7 +31,8 @@
#include <json_spirit/json_spirit_writer_template.h>
#include <libdevcore/CommonIO.h>
#include <libdevcore/CommonData.h>
-#include <libevmface/Instruction.h>
+#include <libevmcore/Instruction.h>
+#include <libevm/VM.h>
#include "vm.h"
using namespace std;
@@ -136,18 +137,24 @@ void doMyTests(json_spirit::mValue& v)
o["pre"] = mValue(fev.exportState());
fev.importExec(o["exec"].get_obj());
- if (!fev.code)
+ if (fev.code.empty())
{
fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress));
- fev.code = &fev.thisTxCode;
+ fev.code = fev.thisTxCode;
}
vm.reset(fev.gas);
bytes output;
+ u256 gas;
try
{
output = vm.go(fev).toBytes();
}
+ catch (eth::VMException const& _e)
+ {
+ cnote << "VM did throw an exception: " << diagnostic_information(_e);
+ gas = 0;
+ }
catch (Exception const& _e)
{
cnote << "VM did throw an exception: " << diagnostic_information(_e);
@@ -178,6 +185,6 @@ void doMyTests(json_spirit::mValue& v)
o["post"] = mValue(fev.exportState());
o["callcreates"] = fev.exportCallCreates();
o["out"] = "0x" + toHex(output);
- fev.push(o, "gas", vm.gas());
+ fev.push(o, "gas", gas);
}
}
diff --git a/jsonrpc.cpp b/jsonrpc.cpp
index 68c30734..4c748a95 100644
--- a/jsonrpc.cpp
+++ b/jsonrpc.cpp
@@ -74,14 +74,14 @@ BOOST_FIXTURE_TEST_SUITE(environment, Setup)
BOOST_AUTO_TEST_CASE(jsonrpc_defaultBlock)
{
cnote << "Testing jsonrpc defaultBlock...";
- int defaultBlock = jsonrpcClient->defaultBlock();
+ int defaultBlock = jsonrpcClient->eth_defaultBlock();
BOOST_CHECK_EQUAL(defaultBlock, web3->ethereum()->getDefault());
}
BOOST_AUTO_TEST_CASE(jsonrpc_gasPrice)
{
cnote << "Testing jsonrpc gasPrice...";
- string gasPrice = jsonrpcClient->gasPrice();
+ string gasPrice = jsonrpcClient->eth_gasPrice();
BOOST_CHECK_EQUAL(gasPrice, toJS(10 * dev::eth::szabo));
}
@@ -90,11 +90,11 @@ BOOST_AUTO_TEST_CASE(jsonrpc_isListening)
cnote << "Testing jsonrpc isListening...";
web3->startNetwork();
- bool listeningOn = jsonrpcClient->listening();
+ bool listeningOn = jsonrpcClient->eth_listening();
BOOST_CHECK_EQUAL(listeningOn, web3->isNetworkStarted());
web3->stopNetwork();
- bool listeningOff = jsonrpcClient->listening();
+ bool listeningOff = jsonrpcClient->eth_listening();
BOOST_CHECK_EQUAL(listeningOff, web3->isNetworkStarted());
}
@@ -103,11 +103,11 @@ BOOST_AUTO_TEST_CASE(jsonrpc_isMining)
cnote << "Testing jsonrpc isMining...";
web3->ethereum()->startMining();
- bool miningOn = jsonrpcClient->mining();
+ bool miningOn = jsonrpcClient->eth_mining();
BOOST_CHECK_EQUAL(miningOn, web3->ethereum()->isMining());
web3->ethereum()->stopMining();
- bool miningOff = jsonrpcClient->mining();
+ bool miningOff = jsonrpcClient->eth_mining();
BOOST_CHECK_EQUAL(miningOff, web3->ethereum()->isMining());
}
@@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_accounts)
cnote << "Testing jsonrpc accounts...";
std::vector <dev::KeyPair> keys = {KeyPair::create(), KeyPair::create()};
jsonrpcServer->setAccounts(keys);
- Json::Value k = jsonrpcClient->accounts();
+ Json::Value k = jsonrpcClient->eth_accounts();
jsonrpcServer->setAccounts({});
BOOST_CHECK_EQUAL(k.isArray(), true);
BOOST_CHECK_EQUAL(k.size(), keys.size());
@@ -133,10 +133,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_accounts)
BOOST_AUTO_TEST_CASE(jsonrpc_number)
{
cnote << "Testing jsonrpc number2...";
- int number = jsonrpcClient->number();
+ int number = jsonrpcClient->eth_number();
BOOST_CHECK_EQUAL(number, web3->ethereum()->number() + 1);
dev::eth::mine(*(web3->ethereum()), 1);
- int numberAfter = jsonrpcClient->number();
+ int numberAfter = jsonrpcClient->eth_number();
BOOST_CHECK_EQUAL(number + 1, numberAfter);
BOOST_CHECK_EQUAL(numberAfter, web3->ethereum()->number() + 1);
}
@@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_number)
BOOST_AUTO_TEST_CASE(jsonrpc_peerCount)
{
cnote << "Testing jsonrpc peerCount...";
- int peerCount = jsonrpcClient->peerCount();
+ int peerCount = jsonrpcClient->eth_peerCount();
BOOST_CHECK_EQUAL(web3->peerCount(), peerCount);
}
@@ -152,10 +152,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_setListening)
{
cnote << "Testing jsonrpc setListening...";
- jsonrpcClient->setListening(true);
+ jsonrpcClient->eth_setListening(true);
BOOST_CHECK_EQUAL(web3->isNetworkStarted(), true);
- jsonrpcClient->setListening(false);
+ jsonrpcClient->eth_setListening(false);
BOOST_CHECK_EQUAL(web3->isNetworkStarted(), false);
}
@@ -163,10 +163,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_setMining)
{
cnote << "Testing jsonrpc setMining...";
- jsonrpcClient->setMining(true);
+ jsonrpcClient->eth_setMining(true);
BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), true);
- jsonrpcClient->setMining(false);
+ jsonrpcClient->eth_setMining(false);
BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), false);
}
@@ -175,14 +175,14 @@ BOOST_AUTO_TEST_CASE(jsonrpc_stateAt)
cnote << "Testing jsonrpc stateAt...";
dev::KeyPair key = KeyPair::create();
auto address = key.address();
- string stateAt = jsonrpcClient->stateAt(toJS(address), "0");
+ string stateAt = jsonrpcClient->eth_stateAt(toJS(address), "0");
BOOST_CHECK_EQUAL(toJS(web3->ethereum()->stateAt(address, jsToU256("0"), 0)), stateAt);
}
BOOST_AUTO_TEST_CASE(jsonrpc_transact)
{
cnote << "Testing jsonrpc transact...";
- string coinbase = jsonrpcClient->coinbase();
+ string coinbase = jsonrpcClient->eth_coinbase();
BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address());
dev::KeyPair key = KeyPair::create();
@@ -190,14 +190,14 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact)
auto receiver = KeyPair::create();
web3->ethereum()->setAddress(address);
- coinbase = jsonrpcClient->coinbase();
+ coinbase = jsonrpcClient->eth_coinbase();
BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address());
BOOST_CHECK_EQUAL(jsToAddress(coinbase), address);
jsonrpcServer->setAccounts({key});
auto balance = web3->ethereum()->balanceAt(address, 0);
- string balanceString = jsonrpcClient->balanceAt(toJS(address));
- double countAt = jsonrpcClient->countAt(toJS(address));
+ string balanceString = jsonrpcClient->eth_balanceAt(toJS(address));
+ double countAt = jsonrpcClient->eth_countAt(toJS(address));
BOOST_CHECK_EQUAL(countAt, (double)(uint64_t)web3->ethereum()->countAt(address));
BOOST_CHECK_EQUAL(countAt, 0);
@@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact)
dev::eth::mine(*(web3->ethereum()), 1);
balance = web3->ethereum()->balanceAt(address, 0);
- balanceString = jsonrpcClient->balanceAt(toJS(address));
+ balanceString = jsonrpcClient->eth_balanceAt(toJS(address));
BOOST_CHECK_EQUAL(toJS(balance), balanceString);
BOOST_CHECK_EQUAL(jsToDecimal(balanceString), "1500000000000000000");
@@ -223,13 +223,13 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact)
t["gas"] = toJS(gas);
t["gasPrice"] = toJS(gasPrice);
- jsonrpcClient->transact(t);
+ jsonrpcClient->eth_transact(t);
jsonrpcServer->setAccounts({});
dev::eth::mine(*(web3->ethereum()), 1);
- countAt = jsonrpcClient->countAt(toJS(address));
+ countAt = jsonrpcClient->eth_countAt(toJS(address));
auto balance2 = web3->ethereum()->balanceAt(receiver.address());
- string balanceString2 = jsonrpcClient->balanceAt(toJS(receiver.address()));
+ string balanceString2 = jsonrpcClient->eth_balanceAt(toJS(receiver.address()));
BOOST_CHECK_EQUAL(countAt, (double)(uint64_t)web3->ethereum()->countAt(address));
BOOST_CHECK_EQUAL(countAt, 1);
diff --git a/solidityCompiler.cpp b/solidityCompiler.cpp
index 69d33133..ba2db67e 100644
--- a/solidityCompiler.cpp
+++ b/solidityCompiler.cpp
@@ -119,10 +119,10 @@ BOOST_AUTO_TEST_CASE(different_argument_numbers)
byte(Instruction::JUMPDEST), // beginning of g
byte(Instruction::PUSH1), 0x0,
byte(Instruction::DUP1), // initialized e and h
- byte(Instruction::PUSH1), byte(0x20 + shift), // ret address
- byte(Instruction::PUSH1), 0x1,
- byte(Instruction::PUSH1), 0x2,
- byte(Instruction::PUSH1), 0x3,
+ byte(Instruction::PUSH1), byte(0x29 + shift), // ret address
+ byte(Instruction::PUSH1), 0x1, byte(Instruction::PUSH1), 0xff, byte(Instruction::AND),
+ byte(Instruction::PUSH1), 0x2, byte(Instruction::PUSH1), 0xff, byte(Instruction::AND),
+ byte(Instruction::PUSH1), 0x3, byte(Instruction::PUSH1), 0xff, byte(Instruction::AND),
byte(Instruction::PUSH1), byte(0x1 + shift),
// stack here: ret e h 0x20 1 2 3 0x1
byte(Instruction::JUMP),
diff --git a/solidityEndToEndTest.cpp b/solidityEndToEndTest.cpp
index 116310ae..796adcb1 100644
--- a/solidityEndToEndTest.cpp
+++ b/solidityEndToEndTest.cpp
@@ -41,31 +41,41 @@ class ExecutionFramework
public:
ExecutionFramework() { g_logVerbosity = 0; }
- bytes compileAndRun(std::string const& _sourceCode)
+ bytes const& compileAndRun(std::string const& _sourceCode)
{
bytes code = dev::solidity::CompilerStack::compile(_sourceCode);
sendMessage(code, true);
+ BOOST_REQUIRE(!m_output.empty());
return m_output;
}
- bytes callFunction(byte _index, bytes const& _data)
+ bytes const& callFunction(byte _index, bytes const& _data)
{
sendMessage(bytes(1, _index) + _data, false);
return m_output;
}
- bytes callFunction(byte _index, u256 const& _argument1)
+ bytes const& callFunction(byte _index, u256 const& _argument1)
{
- callFunction(_index, toBigEndian(_argument1));
- return m_output;
+ return callFunction(_index, toBigEndian(_argument1));
+ }
+
+ bool testSolidityAgainstCpp(byte _index, std::function<u256(u256)> const& _cppfun, u256 const& _argument1)
+ {
+ return toBigEndian(_cppfun(_argument1)) == callFunction(_index, toBigEndian(_argument1));
+ }
+
+ bool testSolidityAgainstCpp(byte _index, std::function<u256()> const& _cppfun)
+ {
+ return toBigEndian(_cppfun()) == callFunction(_index, bytes());
}
private:
void sendMessage(bytes const& _data, bool _isCreation)
{
eth::Executive executive(m_state);
- eth::Transaction t = _isCreation ? eth::Transaction(0, m_gasPrice, m_gas, _data)
- : eth::Transaction(0, m_gasPrice, m_gas, m_contractAddress, _data);
+ eth::Transaction t = _isCreation ? eth::Transaction(0, m_gasPrice, m_gas, _data, 0, KeyPair::create().sec())
+ : eth::Transaction(0, m_gasPrice, m_gas, m_contractAddress, _data, 0, KeyPair::create().sec());
bytes transactionRLP = t.rlp();
try
{
@@ -77,13 +87,14 @@ private:
{
BOOST_REQUIRE(!executive.create(Address(), 0, m_gasPrice, m_gas, &_data, Address()));
m_contractAddress = executive.newAddress();
+ BOOST_REQUIRE(m_contractAddress);
BOOST_REQUIRE(m_state.addressHasCode(m_contractAddress));
}
else
BOOST_REQUIRE(!executive.call(m_contractAddress, Address(), 0, m_gasPrice, &_data, m_gas, Address()));
BOOST_REQUIRE(executive.go());
executive.finalize();
- m_output = executive.out().toBytes();
+ m_output = executive.out().toVector();
}
Address m_contractAddress;
@@ -93,27 +104,24 @@ private:
bytes m_output;
};
-BOOST_AUTO_TEST_SUITE(SolidityCompilerEndToEndTest)
+BOOST_FIXTURE_TEST_SUITE(SolidityCompilerEndToEndTest, ExecutionFramework)
BOOST_AUTO_TEST_CASE(smoke_test)
{
char const* sourceCode = "contract test {\n"
" function f(uint a) returns(uint d) { return a * 7; }\n"
"}\n";
- ExecutionFramework framework;
- framework.compileAndRun(sourceCode);
+ compileAndRun(sourceCode);
u256 a = 0x200030004;
- bytes result = framework.callFunction(0, a);
- BOOST_CHECK(result == toBigEndian(a * 7));
+ BOOST_CHECK(callFunction(0, a) == toBigEndian(a * 7));
}
BOOST_AUTO_TEST_CASE(empty_contract)
{
char const* sourceCode = "contract test {\n"
"}\n";
- ExecutionFramework framework;
- framework.compileAndRun(sourceCode);
- BOOST_CHECK(framework.callFunction(0, bytes()).empty());
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callFunction(0, bytes()).empty());
}
BOOST_AUTO_TEST_CASE(recursive_calls)
@@ -124,13 +132,20 @@ BOOST_AUTO_TEST_CASE(recursive_calls)
" else return n * f(n - 1);\n"
" }\n"
"}\n";
- ExecutionFramework framework;
- framework.compileAndRun(sourceCode);
- BOOST_CHECK(framework.callFunction(0, u256(0)) == toBigEndian(u256(1)));
- BOOST_CHECK(framework.callFunction(0, u256(1)) == toBigEndian(u256(1)));
- BOOST_CHECK(framework.callFunction(0, u256(2)) == toBigEndian(u256(2)));
- BOOST_CHECK(framework.callFunction(0, u256(3)) == toBigEndian(u256(6)));
- BOOST_CHECK(framework.callFunction(0, u256(4)) == toBigEndian(u256(24)));
+ compileAndRun(sourceCode);
+ std::function<u256(u256)> recursive_calls_cpp = [&recursive_calls_cpp](u256 const& n) -> u256
+ {
+ if (n <= 1)
+ return 1;
+ else
+ return n * recursive_calls_cpp(n - 1);
+ };
+
+ BOOST_CHECK(testSolidityAgainstCpp(0, recursive_calls_cpp, u256(0)));
+ BOOST_CHECK(testSolidityAgainstCpp(0, recursive_calls_cpp, u256(1)));
+ BOOST_CHECK(testSolidityAgainstCpp(0, recursive_calls_cpp, u256(2)));
+ BOOST_CHECK(testSolidityAgainstCpp(0, recursive_calls_cpp, u256(3)));
+ BOOST_CHECK(testSolidityAgainstCpp(0, recursive_calls_cpp, u256(4)));
}
BOOST_AUTO_TEST_CASE(while_loop)
@@ -142,13 +157,23 @@ BOOST_AUTO_TEST_CASE(while_loop)
" while (i <= n) nfac *= i++;\n"
" }\n"
"}\n";
- ExecutionFramework framework;
- framework.compileAndRun(sourceCode);
- BOOST_CHECK(framework.callFunction(0, u256(0)) == toBigEndian(u256(1)));
- BOOST_CHECK(framework.callFunction(0, u256(1)) == toBigEndian(u256(1)));
- BOOST_CHECK(framework.callFunction(0, u256(2)) == toBigEndian(u256(2)));
- BOOST_CHECK(framework.callFunction(0, u256(3)) == toBigEndian(u256(6)));
- BOOST_CHECK(framework.callFunction(0, u256(4)) == toBigEndian(u256(24)));
+ compileAndRun(sourceCode);
+
+ auto while_loop_cpp = [](u256 const& n) -> u256
+ {
+ u256 nfac = 1;
+ u256 i = 2;
+ while (i <= n)
+ nfac *= i++;
+
+ return nfac;
+ };
+
+ BOOST_CHECK(testSolidityAgainstCpp(0, while_loop_cpp, u256(0)));
+ BOOST_CHECK(testSolidityAgainstCpp(0, while_loop_cpp, u256(1)));
+ BOOST_CHECK(testSolidityAgainstCpp(0, while_loop_cpp, u256(2)));
+ BOOST_CHECK(testSolidityAgainstCpp(0, while_loop_cpp, u256(3)));
+ BOOST_CHECK(testSolidityAgainstCpp(0, while_loop_cpp, u256(4)));
}
BOOST_AUTO_TEST_CASE(break_outside_loop)
@@ -186,18 +211,43 @@ BOOST_AUTO_TEST_CASE(nested_loops)
"}\n";
ExecutionFramework framework;
framework.compileAndRun(sourceCode);
- BOOST_CHECK(framework.callFunction(0, u256(0)) == toBigEndian(u256(0)));
- BOOST_CHECK(framework.callFunction(0, u256(1)) == toBigEndian(u256(1)));
- BOOST_CHECK(framework.callFunction(0, u256(2)) == toBigEndian(u256(1)));
- BOOST_CHECK(framework.callFunction(0, u256(3)) == toBigEndian(u256(2)));
- BOOST_CHECK(framework.callFunction(0, u256(4)) == toBigEndian(u256(2)));
- BOOST_CHECK(framework.callFunction(0, u256(5)) == toBigEndian(u256(4)));
- BOOST_CHECK(framework.callFunction(0, u256(6)) == toBigEndian(u256(5)));
- BOOST_CHECK(framework.callFunction(0, u256(7)) == toBigEndian(u256(5)));
- BOOST_CHECK(framework.callFunction(0, u256(8)) == toBigEndian(u256(7)));
- BOOST_CHECK(framework.callFunction(0, u256(9)) == toBigEndian(u256(8)));
- BOOST_CHECK(framework.callFunction(0, u256(10)) == toBigEndian(u256(10)));
- BOOST_CHECK(framework.callFunction(0, u256(11)) == toBigEndian(u256(10)));
+
+ auto nested_loops_cpp = [](u256 n) -> u256
+ {
+ while (n > 1)
+ {
+ if (n == 10)
+ break;
+ while (n > 5)
+ {
+ if (n == 8)
+ break;
+ n--;
+ if (n == 6)
+ continue;
+ return n;
+ }
+ n--;
+ if (n == 3)
+ continue;
+ break;
+ }
+
+ return n;
+ };
+
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(0)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(1)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(2)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(3)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(4)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(5)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(6)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(7)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(8)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(9)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(10)));
+ BOOST_CHECK(framework.testSolidityAgainstCpp(0, nested_loops_cpp, u256(11)));
}
BOOST_AUTO_TEST_CASE(calling_other_functions)
@@ -217,13 +267,35 @@ BOOST_AUTO_TEST_CASE(calling_other_functions)
" return 3 * x + 1;\n"
" }\n"
"}\n";
- ExecutionFramework framework;
- framework.compileAndRun(sourceCode);
- BOOST_CHECK(framework.callFunction(2, u256(0)) == toBigEndian(u256(0)));
- BOOST_CHECK(framework.callFunction(2, u256(1)) == toBigEndian(u256(1)));
- BOOST_CHECK(framework.callFunction(2, u256(2)) == toBigEndian(u256(1)));
- BOOST_CHECK(framework.callFunction(2, u256(8)) == toBigEndian(u256(1)));
- BOOST_CHECK(framework.callFunction(2, u256(127)) == toBigEndian(u256(1)));
+ compileAndRun(sourceCode);
+
+ auto evenStep_cpp = [](u256 const& n) -> u256
+ {
+ return n / 2;
+ };
+
+ auto oddStep_cpp = [](u256 const& n) -> u256
+ {
+ return 3 * n + 1;
+ };
+
+ auto collatz_cpp = [&evenStep_cpp, &oddStep_cpp] (u256 n) -> u256 {
+ u256 y;
+ while ((y = n) > 1)
+ {
+ if (n % 2 == 0)
+ n = evenStep_cpp(n);
+ else
+ n = oddStep_cpp(n);
+ }
+ return y;
+ };
+
+ BOOST_CHECK(testSolidityAgainstCpp(2, collatz_cpp, u256(0)));
+ BOOST_CHECK(testSolidityAgainstCpp(2, collatz_cpp, u256(1)));
+ BOOST_CHECK(testSolidityAgainstCpp(2, collatz_cpp, u256(2)));
+ BOOST_CHECK(testSolidityAgainstCpp(2, collatz_cpp, u256(8)));
+ BOOST_CHECK(testSolidityAgainstCpp(2, collatz_cpp, u256(127)));
}
BOOST_AUTO_TEST_CASE(many_local_variables)
@@ -235,12 +307,25 @@ BOOST_AUTO_TEST_CASE(many_local_variables)
" y += b + x2;\n"
" }\n"
"}\n";
- ExecutionFramework framework;
- framework.compileAndRun(sourceCode);
- BOOST_CHECK(framework.callFunction(0, toBigEndian(u256(0x1000)) + toBigEndian(u256(0x10000)) + toBigEndian(u256(0x100000)))
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callFunction(0, toBigEndian(u256(0x1000)) + toBigEndian(u256(0x10000)) + toBigEndian(u256(0x100000)))
== toBigEndian(u256(0x121121)));
}
+BOOST_AUTO_TEST_CASE(packing_unpacking_types)
+{
+ char const* sourceCode = "contract test {\n"
+ " function run(bool a, uint32 b, uint64 c) returns(uint256 y) {\n"
+ " if (a) y = 1;\n"
+ " y = y * 0x100000000 | ~b;\n"
+ " y = y * 0x10000000000000000 | ~c;\n"
+ " }\n"
+ "}\n";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callFunction(0, fromHex("01""0f0f0f0f""f0f0f0f0f0f0f0f0"))
+ == fromHex("00000000000000000000000000000000000000""01""f0f0f0f0""0f0f0f0f0f0f0f0f"));
+}
+
BOOST_AUTO_TEST_CASE(multiple_return_values)
{
char const* sourceCode = "contract test {\n"
@@ -248,9 +333,8 @@ BOOST_AUTO_TEST_CASE(multiple_return_values)
" y1 = x2; y2 = x1;\n"
" }\n"
"}\n";
- ExecutionFramework framework;
- framework.compileAndRun(sourceCode);
- BOOST_CHECK(framework.callFunction(0, bytes(1, 1) + toBigEndian(u256(0xcd)))
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callFunction(0, bytes(1, 1) + toBigEndian(u256(0xcd)))
== toBigEndian(u256(0xcd)) + bytes(1, 1) + toBigEndian(u256(0)));
}
@@ -262,13 +346,114 @@ BOOST_AUTO_TEST_CASE(short_circuiting)
" return x;"
" }\n"
"}\n";
- ExecutionFramework framework;
- framework.compileAndRun(sourceCode);
- BOOST_CHECK(framework.callFunction(0, u256(0)) == toBigEndian(u256(0)));
- BOOST_CHECK(framework.callFunction(0, u256(1)) == toBigEndian(u256(8)));
+ compileAndRun(sourceCode);
+
+ auto short_circuiting_cpp = [](u256 n) -> u256
+ {
+ n == 0 || (n = 8) > 0;
+ return n;
+ };
+
+ BOOST_CHECK(testSolidityAgainstCpp(0, short_circuiting_cpp, u256(0)));
+ BOOST_CHECK(testSolidityAgainstCpp(0, short_circuiting_cpp, u256(1)));
+}
+
+BOOST_AUTO_TEST_CASE(high_bits_cleaning)
+{
+ char const* sourceCode = "contract test {\n"
+ " function run() returns(uint256 y) {\n"
+ " uint32 x = uint32(0xffffffff) + 10;\n"
+ " if (x >= 0xffffffff) return 0;\n"
+ " return x;"
+ " }\n"
+ "}\n";
+ compileAndRun(sourceCode);
+ auto high_bits_cleaning_cpp = []() -> u256
+ {
+ uint32_t x = uint32_t(0xffffffff) + 10;
+ if (x >= 0xffffffff)
+ return 0;
+ return x;
+ };
+ BOOST_CHECK(testSolidityAgainstCpp(0, high_bits_cleaning_cpp));
+}
+
+BOOST_AUTO_TEST_CASE(sign_extension)
+{
+ char const* sourceCode = "contract test {\n"
+ " function run() returns(uint256 y) {\n"
+ " int64 x = -int32(0xff);\n"
+ " if (x >= 0xff) return 0;\n"
+ " return -uint256(x);"
+ " }\n"
+ "}\n";
+ compileAndRun(sourceCode);
+ auto sign_extension_cpp = []() -> u256
+ {
+ int64_t x = -int32_t(0xff);
+ if (x >= 0xff)
+ return 0;
+ return u256(x) * -1;
+ };
+ BOOST_CHECK(testSolidityAgainstCpp(0, sign_extension_cpp));
+}
+
+BOOST_AUTO_TEST_CASE(small_unsigned_types)
+{
+ char const* sourceCode = "contract test {\n"
+ " function run() returns(uint256 y) {\n"
+ " uint32 x = uint32(0xffffff) * 0xffffff;\n"
+ " return x / 0x100;"
+ " }\n"
+ "}\n";
+ compileAndRun(sourceCode);
+ auto small_unsigned_types_cpp = []() -> u256
+ {
+ uint32_t x = uint32_t(0xffffff) * 0xffffff;
+ return x / 0x100;
+ };
+ BOOST_CHECK(testSolidityAgainstCpp(0, small_unsigned_types_cpp));
+}
+
+BOOST_AUTO_TEST_CASE(small_signed_types)
+{
+ char const* sourceCode = "contract test {\n"
+ " function run() returns(int256 y) {\n"
+ " return -int32(10) * -int64(20);\n"
+ " }\n"
+ "}\n";
+ compileAndRun(sourceCode);
+ auto small_signed_types_cpp = []() -> u256
+ {
+ return -int32_t(10) * -int64_t(20);
+ };
+ BOOST_CHECK(testSolidityAgainstCpp(0, small_signed_types_cpp));
}
-//@todo test smaller types
+BOOST_AUTO_TEST_CASE(state_smoke_test)
+{
+ char const* sourceCode = "contract test {\n"
+ " uint256 value1;\n"
+ " uint256 value2;\n"
+ " function get(uint8 which) returns (uint256 value) {\n"
+ " if (which == 0) return value1;\n"
+ " else return value2;\n"
+ " }\n"
+ " function set(uint8 which, uint256 value) {\n"
+ " if (which == 0) value1 = value;\n"
+ " else value2 = value;\n"
+ " }\n"
+ "}\n";
+ compileAndRun(sourceCode);
+ BOOST_CHECK(callFunction(0, bytes(1, 0x00)) == toBigEndian(u256(0)));
+ BOOST_CHECK(callFunction(0, bytes(1, 0x01)) == toBigEndian(u256(0)));
+ BOOST_CHECK(callFunction(1, bytes(1, 0x00) + toBigEndian(u256(0x1234))) == bytes());
+ BOOST_CHECK(callFunction(1, bytes(1, 0x01) + toBigEndian(u256(0x8765))) == bytes());
+ BOOST_CHECK(callFunction(0, bytes(1, 0x00)) == toBigEndian(u256(0x1234)));
+ BOOST_CHECK(callFunction(0, bytes(1, 0x01)) == toBigEndian(u256(0x8765)));
+ BOOST_CHECK(callFunction(1, bytes(1, 0x00) + toBigEndian(u256(0x3))) == bytes());
+ BOOST_CHECK(callFunction(0, bytes(1, 0x00)) == toBigEndian(u256(0x3)));
+}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/solidityExpressionCompiler.cpp b/solidityExpressionCompiler.cpp
index 561cc3bd..59a9e933 100644
--- a/solidityExpressionCompiler.cpp
+++ b/solidityExpressionCompiler.cpp
@@ -154,10 +154,10 @@ BOOST_AUTO_TEST_CASE(comparison)
"}\n";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH2), 0x10, 0xaa,
- byte(eth::Instruction::PUSH2), 0x11, 0xaa,
- byte(eth::Instruction::GT),
- byte(eth::Instruction::PUSH1), 0x1,
+ bytes expectation({byte(eth::Instruction::PUSH1), 0x1,
+ byte(eth::Instruction::PUSH2), 0x11, 0xaa, byte(eth::Instruction::PUSH2), 0xff, 0xff, byte(eth::Instruction::AND),
+ byte(eth::Instruction::PUSH2), 0x10, 0xaa, byte(eth::Instruction::PUSH2), 0xff, 0xff, byte(eth::Instruction::AND),
+ byte(eth::Instruction::LT),
byte(eth::Instruction::EQ),
byte(eth::Instruction::ISZERO)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
@@ -166,22 +166,22 @@ BOOST_AUTO_TEST_CASE(comparison)
BOOST_AUTO_TEST_CASE(short_circuiting)
{
char const* sourceCode = "contract test {\n"
- " function f() { var x = (10 + 8 >= 4 || 2 != 9) != true; }"
+ " function f() { var x = true != (4 <= 8 + 10 || 9 != 2); }"
"}\n";
bytes code = compileFirstExpression(sourceCode);
bytes expectation({byte(eth::Instruction::PUSH1), 0xa,
byte(eth::Instruction::PUSH1), 0x8,
- byte(eth::Instruction::ADD),
- byte(eth::Instruction::PUSH1), 0x4,
+ byte(eth::Instruction::ADD), byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
+ byte(eth::Instruction::PUSH1), 0x4, byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
byte(eth::Instruction::GT),
byte(eth::Instruction::ISZERO), // after this we have 10 + 8 >= 4
byte(eth::Instruction::DUP1),
- byte(eth::Instruction::PUSH1), 0x14,
+ byte(eth::Instruction::PUSH1), 0x20,
byte(eth::Instruction::JUMPI), // short-circuit if it is true
byte(eth::Instruction::POP),
- byte(eth::Instruction::PUSH1), 0x2,
- byte(eth::Instruction::PUSH1), 0x9,
+ byte(eth::Instruction::PUSH1), 0x2, byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
+ byte(eth::Instruction::PUSH1), 0x9, byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
byte(eth::Instruction::EQ),
byte(eth::Instruction::ISZERO), // after this we have 2 != 9
byte(eth::Instruction::JUMPDEST),
@@ -194,13 +194,14 @@ BOOST_AUTO_TEST_CASE(short_circuiting)
BOOST_AUTO_TEST_CASE(arithmetics)
{
char const* sourceCode = "contract test {\n"
- " function f() { var x = (1 * (2 / (3 % (4 + (5 - (6 | (7 & (8 ^ 9)))))))); }"
+ " function f() { var x = ((((((((9 ^ 8) & 7) | 6) - 5) + 4) % 3) / 2) * 1); }"
"}\n";
bytes code = compileFirstExpression(sourceCode);
-
bytes expectation({byte(eth::Instruction::PUSH1), 0x1,
byte(eth::Instruction::PUSH1), 0x2,
+ byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
byte(eth::Instruction::PUSH1), 0x3,
+ byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
byte(eth::Instruction::PUSH1), 0x4,
byte(eth::Instruction::PUSH1), 0x5,
byte(eth::Instruction::PUSH1), 0x6,
@@ -210,12 +211,11 @@ BOOST_AUTO_TEST_CASE(arithmetics)
byte(eth::Instruction::XOR),
byte(eth::Instruction::AND),
byte(eth::Instruction::OR),
- byte(eth::Instruction::SWAP1),
byte(eth::Instruction::SUB),
byte(eth::Instruction::ADD),
- byte(eth::Instruction::SWAP1),
+ byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
byte(eth::Instruction::MOD),
- byte(eth::Instruction::SWAP1),
+ byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
byte(eth::Instruction::DIV),
byte(eth::Instruction::MUL)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
@@ -224,15 +224,15 @@ BOOST_AUTO_TEST_CASE(arithmetics)
BOOST_AUTO_TEST_CASE(unary_operators)
{
char const* sourceCode = "contract test {\n"
- " function f() { var x = !(~+-1 == 2); }"
+ " function f() { var x = !(~+- 1 == 2); }"
"}\n";
bytes code = compileFirstExpression(sourceCode);
- bytes expectation({byte(eth::Instruction::PUSH1), 0x1,
+ bytes expectation({byte(eth::Instruction::PUSH1), 0x2, byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
+ byte(eth::Instruction::PUSH1), 0x1,
byte(eth::Instruction::PUSH1), 0x0,
byte(eth::Instruction::SUB),
- byte(eth::Instruction::NOT),
- byte(eth::Instruction::PUSH1), 0x2,
+ byte(eth::Instruction::NOT), byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
byte(eth::Instruction::EQ),
byte(eth::Instruction::ISZERO)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
@@ -241,7 +241,7 @@ BOOST_AUTO_TEST_CASE(unary_operators)
BOOST_AUTO_TEST_CASE(unary_inc_dec)
{
char const* sourceCode = "contract test {\n"
- " function f(uint a) { var x = ((a++ ^ ++a) ^ a--) ^ --a; }"
+ " function f(uint a) { var x = --a ^ (a-- ^ (++a ^ a++)); }"
"}\n";
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "x"}});
@@ -296,16 +296,15 @@ BOOST_AUTO_TEST_CASE(assignment)
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "b"}});
// Stack: a, b
- bytes expectation({byte(eth::Instruction::DUP1),
- byte(eth::Instruction::DUP3),
- byte(eth::Instruction::SWAP1),
+ bytes expectation({byte(eth::Instruction::PUSH1), 0x2, byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
+ byte(eth::Instruction::DUP2),
+ byte(eth::Instruction::DUP4),
byte(eth::Instruction::ADD),
- // Stack here: a b a+b
- byte(eth::Instruction::SWAP2),
+ // Stack here: a b 2 a+b
+ byte(eth::Instruction::SWAP3),
byte(eth::Instruction::POP),
- byte(eth::Instruction::DUP2),
- // Stack here: a+b b a+b
- byte(eth::Instruction::PUSH1), 0x2,
+ byte(eth::Instruction::DUP3),
+ // Stack here: a+b b 2 a+b
byte(eth::Instruction::MUL)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
@@ -320,21 +319,20 @@ BOOST_AUTO_TEST_CASE(function_call)
{{"test", "f", "a"}, {"test", "f", "b"}});
// Stack: a, b
- bytes expectation({byte(eth::Instruction::PUSH1), 0x0a,
- byte(eth::Instruction::DUP3),
- byte(eth::Instruction::PUSH1), 0x01,
+ bytes expectation({byte(eth::Instruction::PUSH1), 0x02, byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
+ byte(eth::Instruction::PUSH1), 0x12,
+ byte(eth::Instruction::PUSH1), 0x01, byte(eth::Instruction::PUSH1), 0xff, byte(eth::Instruction::AND),
+ byte(eth::Instruction::DUP5),
byte(eth::Instruction::ADD),
- // Stack here: a b <ret label> (a+1)
- byte(eth::Instruction::DUP3),
- byte(eth::Instruction::PUSH1), 0x14,
+ // Stack here: a b 2 <ret label> (a+1)
+ byte(eth::Instruction::DUP4),
+ byte(eth::Instruction::PUSH1), 0x19,
byte(eth::Instruction::JUMP),
byte(eth::Instruction::JUMPDEST),
- // Stack here: a b g(a+1, b)
- byte(eth::Instruction::PUSH1), 0x02,
+ // Stack here: a b 2 g(a+1, b)
byte(eth::Instruction::MUL),
// Stack here: a b g(a+1, b)*2
byte(eth::Instruction::DUP3),
- byte(eth::Instruction::SWAP1),
byte(eth::Instruction::ADD),
// Stack here: a b a+g(a+1, b)*2
byte(eth::Instruction::SWAP2),
@@ -344,6 +342,45 @@ BOOST_AUTO_TEST_CASE(function_call)
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}
+BOOST_AUTO_TEST_CASE(negative_literals_8bits)
+{
+ // these all fit in 8 bits
+ char const* sourceCode = "contract test {\n"
+ " function f() { int8 x = -0 + -1 + -0x01 + -127 + -128; }\n"
+ "}\n";
+ bytes code = compileFirstExpression(sourceCode);
+
+ bytes expectation(bytes({byte(eth::Instruction::PUSH32)}) + bytes(31, 0xff) + bytes(1, 0x80) +
+ bytes({byte(eth::Instruction::PUSH32)}) + bytes(31, 0xff) + bytes(1, 0x81) +
+ bytes({byte(eth::Instruction::PUSH32)}) + bytes(32, 0xff) +
+ bytes({byte(eth::Instruction::PUSH32)}) + bytes(32, 0xff) +
+ bytes({byte(eth::Instruction::PUSH1), 0x00,
+ byte(eth::Instruction::ADD),
+ byte(eth::Instruction::ADD),
+ byte(eth::Instruction::ADD),
+ byte(eth::Instruction::ADD)}));
+ BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
+}
+
+BOOST_AUTO_TEST_CASE(negative_literals_16bits)
+{
+ // -1 should need 8 bits, -129 should need 16 bits, how many bits are used is visible
+ // from the SIGNEXTEND opcodes
+ char const* sourceCode = "contract test {\n"
+ " function f() { int64 x = int64(-1 + -129); }\n"
+ "}\n";
+ bytes code = compileFirstExpression(sourceCode);
+
+ bytes expectation(bytes({byte(eth::Instruction::PUSH32)}) + bytes(31, 0xff) + bytes(1, 0x7f) +
+ bytes({byte(eth::Instruction::PUSH32)}) + bytes(32, 0xff) +
+ bytes({byte(eth::Instruction::PUSH1), 0x00,
+ byte(eth::Instruction::SIGNEXTEND),
+ byte(eth::Instruction::ADD),
+ byte(eth::Instruction::PUSH1), 0x01,
+ byte(eth::Instruction::SIGNEXTEND)}));
+ BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
+}
+
BOOST_AUTO_TEST_SUITE_END()
}
diff --git a/solidityNameAndTypeResolution.cpp b/solidityNameAndTypeResolution.cpp
index 9e34e6d0..f46ad673 100644
--- a/solidityNameAndTypeResolution.cpp
+++ b/solidityNameAndTypeResolution.cpp
@@ -162,6 +162,22 @@ BOOST_AUTO_TEST_CASE(type_checking_function_call)
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
}
+BOOST_AUTO_TEST_CASE(type_conversion_for_comparison)
+{
+ char const* text = "contract test {\n"
+ " function f() { uint32(2) == int64(2); }"
+ "}\n";
+ BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
+}
+
+BOOST_AUTO_TEST_CASE(type_conversion_for_comparison_invalid)
+{
+ char const* text = "contract test {\n"
+ " function f() { int32(2) == uint64(2); }"
+ "}\n";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
+}
+
BOOST_AUTO_TEST_CASE(type_inference_explicit_conversion)
{
char const* text = "contract test {\n"
diff --git a/solidityScanner.cpp b/solidityScanner.cpp
index d2a960cf..d714699a 100644
--- a/solidityScanner.cpp
+++ b/solidityScanner.cpp
@@ -97,6 +97,27 @@ BOOST_AUTO_TEST_CASE(hex_numbers)
BOOST_CHECK_EQUAL(scanner.next(), Token::EOS);
}
+BOOST_AUTO_TEST_CASE(negative_numbers)
+{
+ Scanner scanner(CharStream("var x = -.2 + -0x78 + -7.3 + 8.9;"));
+ BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::VAR);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::IDENTIFIER);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::ASSIGN);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::NUMBER);
+ BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "-.2");
+ BOOST_CHECK_EQUAL(scanner.next(), Token::ADD);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::NUMBER);
+ BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "-0x78");
+ BOOST_CHECK_EQUAL(scanner.next(), Token::ADD);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::NUMBER);
+ BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "-7.3");
+ BOOST_CHECK_EQUAL(scanner.next(), Token::ADD);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::NUMBER);
+ BOOST_CHECK_EQUAL(scanner.getCurrentLiteral(), "8.9");
+ BOOST_CHECK_EQUAL(scanner.next(), Token::SEMICOLON);
+ BOOST_CHECK_EQUAL(scanner.next(), Token::EOS);
+}
+
BOOST_AUTO_TEST_CASE(locations)
{
Scanner scanner(CharStream("function_identifier has ; -0x743/*comment*/\n ident //comment"));
@@ -109,11 +130,8 @@ BOOST_AUTO_TEST_CASE(locations)
BOOST_CHECK_EQUAL(scanner.next(), Token::SEMICOLON);
BOOST_CHECK_EQUAL(scanner.getCurrentLocation().start, 24);
BOOST_CHECK_EQUAL(scanner.getCurrentLocation().end, 25);
- BOOST_CHECK_EQUAL(scanner.next(), Token::SUB);
- BOOST_CHECK_EQUAL(scanner.getCurrentLocation().start, 26);
- BOOST_CHECK_EQUAL(scanner.getCurrentLocation().end, 27);
BOOST_CHECK_EQUAL(scanner.next(), Token::NUMBER);
- BOOST_CHECK_EQUAL(scanner.getCurrentLocation().start, 27);
+ BOOST_CHECK_EQUAL(scanner.getCurrentLocation().start, 26);
BOOST_CHECK_EQUAL(scanner.getCurrentLocation().end, 32);
BOOST_CHECK_EQUAL(scanner.next(), Token::IDENTIFIER);
BOOST_CHECK_EQUAL(scanner.getCurrentLocation().start, 45);
diff --git a/stPreCompiledContractsFiller.json b/stPreCompiledContractsFiller.json
new file mode 100644
index 00000000..8975f1ae
--- /dev/null
+++ b/stPreCompiledContractsFiller.json
@@ -0,0 +1,717 @@
+{
+ "CallEcrecover0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code": "{ (MSTORE 0 0x18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c) (MSTORE 32 28) (MSTORE 64 0x73b1693892219d736caba55bdb67216e485557ea6b6af75f37096c9aa6a5a75f) (MSTORE 96 0xeeb940b1d03b21e36b0e47e79769f095fe2ab855bd91e3a38756b7d75a9c4549) (CALL 1000 1 0 0 128 128 32) [[ 0 ]] (MOD (MLOAD 128) (EXP 2 160)) [[ 1 ]] (EQ (ORIGIN) (SLOAD 0)) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallEcrecover0_gas500": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code": "{ (MSTORE 0 0x18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c) (MSTORE 32 28) (MSTORE 64 0x73b1693892219d736caba55bdb67216e485557ea6b6af75f37096c9aa6a5a75f) (MSTORE 96 0xeeb940b1d03b21e36b0e47e79769f095fe2ab855bd91e3a38756b7d75a9c4549) (CALL 500 1 0 0 128 128 32) [[ 0 ]] (MOD (MLOAD 128) (EXP 2 160)) [[ 1 ]] (EQ (ORIGIN) (SLOAD 0)) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallEcrecover0_Gas499": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code": "{ (MSTORE 0 0x18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c) (MSTORE 32 28) (MSTORE 64 0x73b1693892219d736caba55bdb67216e485557ea6b6af75f37096c9aa6a5a75f) (MSTORE 96 0xeeb940b1d03b21e36b0e47e79769f095fe2ab855bd91e3a38756b7d75a9c4549) (CALL 499 1 0 0 128 128 32) [[ 0 ]] (MOD (MLOAD 128) (EXP 2 160)) [[ 1 ]] (EQ (ORIGIN) (SLOAD 0)) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallEcrecover0_0input": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code": "{ (CALL 1000 1 0 0 128 128 32) [[ 0 ]] (MOD (MLOAD 128) (EXP 2 160)) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallEcrecover1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code": "{ (MSTORE 0 0x18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c) (MSTORE 32 1) (MSTORE 64 0x73b1693892219d736caba55bdb67216e485557ea6b6af75f37096c9aa6a5a75f) (MSTORE 96 0xeeb940b1d03b21e36b0e47e79769f095fe2ab855bd91e3a38756b7d75a9c4549) (CALL 1000 1 0 0 128 128 32) [[ 0 ]] (MOD (MLOAD 128) (EXP 2 160)) [[ 1 ]] (EQ (ORIGIN) (SLOAD 0)) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallEcrecover2": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code": "{ (MSTORE 0 0x18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c) (MSTORE 32 28) (MSTORE 33 0x73b1693892219d736caba55bdb67216e485557ea6b6af75f37096c9aa6a5a75f) (MSTORE 65 0xeeb940b1d03b21e36b0e47e79769f095fe2ab855bd91e3a38756b7d75a9c4549) (CALL 1000 1 0 0 97 97 32) [[ 0 ]] (MOD (MLOAD 97) (EXP 2 160)) [[ 1 ]] (EQ (ORIGIN) (SLOAD 0)) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallEcrecover3": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code": "{ (MSTORE 0 0x2f380a2dea7e778d81affc2443403b8fe4644db442ae4862ff5bb3732829cdb9) (MSTORE 32 27) (MSTORE 64 0x6b65ccb0558806e9b097f27a396d08f964e37b8b7af6ceeb516ff86739fbea0a) (MSTORE 96 0x37cbc8d883e129a4b1ef9d5f1df53c4f21a3ef147cf2a50a4ede0eb06ce092d4) (CALL 1000 1 0 0 128 128 32) [[ 0 ]] (MOD (MLOAD 128) (EXP 2 160)) [[ 1 ]] (EQ (ORIGIN) (SLOAD 0)) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallSha256_0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "0x600160005260206000602060006000600260fff1600051600055",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallSha256_1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (CALL 500 2 0 0 0 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallSha256_2": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 5 0xf34578907f) (CALL 500 2 0 0 37 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallSha256_3": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xf34578907f) (CALL 500 2 0 0 37 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallSha256_4": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (CALL 100 2 0 0 32 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallSha256_4_gas99": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (CALL 99 2 0 0 32 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallSha256_5": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (CALL 500 2 0 0 1000000 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRipemd160_0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "0x600160005260206000602060006000600360fff1600051600055",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRipemd160_1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (CALL 500 3 0 0 0 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRipemd160_2": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 5 0xf34578907f) (CALL 500 3 0 0 37 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRipemd160_3": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xf34578907f) (CALL 500 3 0 0 37 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRipemd160_4": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (CALL 100 3 0 0 32 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRipemd160_4_gas99": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (CALL 99 3 0 0 32 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRipemd160_5": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (CALL 500 3 0 0 1000000 0 32) [[ 0 ]] (MLOAD 0)}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+}
+
diff --git a/stSystemOperationsTestFiller.json b/stSystemOperationsTestFiller.json
new file mode 100644
index 00000000..e6275308
--- /dev/null
+++ b/stSystemOperationsTestFiller.json
@@ -0,0 +1,1334 @@
+{
+ "createNameRegistrator": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "1000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0x601080600c6000396000f20060003554156009570060203560003555) [[ 0 ]] (CREATE 23 4 28) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "createNameRegistratorValueTooHigh": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "1000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0x601080600c6000396000f20060003554156009570060203560003555) [[ 0 ]] (CREATE 1000 4 28) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "createNameRegistratorOutOfMemoryBonds0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "1000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0x601080600c6000396000f20060003554156009570060203560003555) [[ 0 ]] (CREATE 23 0xfffffffffff 28) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "createNameRegistratorOutOfMemoryBonds1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "1000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0x601080600c6000396000f20060003554156009570060203560003555) [[ 0 ]] (CREATE 23 4 0xfffffffffff) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallToNameRegistrator0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 64 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x60003554156009570060203560003555",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallToReturn1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 0 2) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x6001600155603760005360026000f2",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "PostToReturn1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) (POST 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 ) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x603760005360026000f2",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "callstatelessToReturn1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLSTATELESS 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 0 2 ) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x6001600155603760005360026000f2",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "callcodeToReturn1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 0 2 ) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x6001600155603760005360026000f2",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+
+ "CallToNameRegistratorOutOfGas": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 100 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 64 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x60003554156009570060203560003555",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallToNameRegistratorTooMuchMemory0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 987654321 64 64 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x60003554156009570060203560003555",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallToNameRegistratorTooMuchMemory1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 9865432 64 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x60003554156009570060203560003555",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallToNameRegistratorTooMuchMemory2": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 987654 1) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x60003554156009570060203560003555",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+
+ "CallToNameRegistratorNotMuchMemory0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 987654 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x60003554156009570060203560003555",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallToNameRegistratorNotMuchMemory1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 987654 0 64 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x60003554156009570060203560003555",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRecursiveBomb0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ (CALL 100000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 0 0 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ [[ 0 ]] (+ (SLOAD 0) 1) [[ 1 ]] (CALL (- (GAS) 224) (ADDRESS) 0 0 0 0 0) } ",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRecursiveBomb1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ [[ 0 ]] (+ (SLOAD 0) 1) [[ 1 ]] (CALL (- (GAS) 224) (ADDRESS) 0 0 0 0 0) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365223",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRecursiveBomb2": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ [[ 0 ]] (+ (SLOAD 0) 1) [[ 1 ]] (CALL (- (GAS) 224) (ADDRESS) 0 0 0 0 0) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "365224",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "CallRecursiveBomb3": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "20000000",
+ "nonce" : 0,
+ "code" : "{ [[ 0 ]] (+ (SLOAD 0) 1) [[ 1 ]] (CALL (- (GAS) 224) (ADDRESS) 0 0 0 0 0) }",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "suicideCaller": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ [[0]] (CALLER) (SUICIDE (CALLER))}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "suicideOrigin": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ [[0]] (ORIGIN) (SUICIDE (ORIGIN))}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "suicideAddress": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ [[0]] (ADDRESS) (SUICIDE (ADDRESS))}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "suicideNotExistingAccount": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (SUICIDE 0xaa1722f3947def4cf144679da39c4c32bdc35681 )}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "suicideSendEtherToMe": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (SUICIDE (ADDRESS) )}",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "return0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "23",
+ "code" : "{ (MSTORE8 0 55) (RETURN 0 1)}",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "return1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "23",
+ "code" : "{ (MSTORE8 0 55) (RETURN 0 2)}",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "return2": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "23",
+ "code" : "{ (MSTORE8 0 55) (RETURN 0 33)}",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "callcodeToNameRegistrator0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 64 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "0x60003554156009570060203560003555",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "TestNameRegistrator": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "1000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "0x60003554156009570060203560003555",
+ "storage": {}
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffafffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa"
+ }
+ },
+
+ "ABAcalls0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ [[ (PC) ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : " { [[ (PC) ]] (ADD 1 (CALL 500 0x095e7baea6a6c7c4c2dfeb977efac326af552d87 23 0 0 0 0)) } ",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "ABAcalls1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ [[ (PC) ]] (CALL (- (GAS) 1000) 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : " { [[ (PC) ]] (ADD 1 (CALL (- (GAS) 1000) 0x095e7baea6a6c7c4c2dfeb977efac326af552d87 23 0 0 0 0)) } ",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "1000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "ABAcalls2": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ [[ 0 ]] (ADD (SLOAD 0) 1) (CALL (- (GAS) 1000) 0x945304eb96065b2a98b57a48a06ae28d285a71b5 1 0 0 0 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "0",
+ "code" : " { [[ 0 ]] (ADD (SLOAD 0) 1) (CALL (- (GAS) 1000) 0x095e7baea6a6c7c4c2dfeb977efac326af552d87 0 0 0 0 0) } ",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "ABAcalls3": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1025000",
+ "nonce" : 0,
+ "code" : "{ [[ 0 ]] (ADD (SLOAD 0) 1) (CALL (- (GAS) 1000) 0x945304eb96065b2a98b57a48a06ae28d285a71b5 1 0 0 0 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "0",
+ "code" : " { [[ 0 ]] (ADD (SLOAD 0) 1) (CALL (- (GAS) 1000) 0x095e7baea6a6c7c4c2dfeb977efac326af552d87 0 0 0 0 0) } ",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "ABAcallsSuicide0": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ [[ (PC) ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) (SUICIDE 0x945304eb96065b2a98b57a48a06ae28d285a71b5) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "{ [[ (PC) ]] (ADD 1 (CALL 500 0x095e7baea6a6c7c4c2dfeb977efac326af552d87 23 0 0 0 0)) } ",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ },
+
+ "ABAcallsSuicide1": {
+ "env" : {
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
+ "currentNumber" : "0",
+ "currentGasLimit" : "10000000",
+ "currentDifficulty" : "256",
+ "currentTimestamp" : 1,
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
+ },
+ "pre" : {
+ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "{ [[ (PC) ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) }",
+ "storage": {}
+ },
+ "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
+ "balance" : "23",
+ "code" : "{ [[ (PC) ]] (ADD 1 (CALL 500 0x095e7baea6a6c7c4c2dfeb977efac326af552d87 23 0 0 0 0)) (SUICIDE 0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6) } ",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000000000000000",
+ "nonce" : 0,
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transaction" : {
+ "nonce" : "0",
+ "gasPrice" : "1",
+ "gasLimit" : "10000000",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "100000",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "data" : ""
+ }
+ }
+}
diff --git a/state.cpp b/state.cpp
index 9c0a7188..91d9f3e5 100644
--- a/state.cpp
+++ b/state.cpp
@@ -43,7 +43,6 @@ namespace dev { namespace test {
void doStateTests(json_spirit::mValue& v, bool _fillin)
{
- cout << "start state test\n";
for (auto& i: v.get_obj())
{
cnote << i.first;
@@ -55,12 +54,6 @@ void doStateTests(json_spirit::mValue& v, bool _fillin)
ImportTest importer(o, _fillin);
- if (_fillin)
- {
- importer.code = importer.m_statePre.code(importer.m_environment.myAddress);
- importer.m_environment.code = &importer.code;
- }
-
State theState = importer.m_statePre;
bytes tx = importer.m_transaction.rlp();
bytes output;
@@ -124,12 +117,14 @@ BOOST_AUTO_TEST_CASE(stSystemOperationsTest)
dev::test::executeTests("stSystemOperationsTest", "/StateTests", dev::test::doStateTests);
}
-BOOST_AUTO_TEST_CASE(tmp)
+BOOST_AUTO_TEST_CASE(stPreCompiledContracts)
+{
+ dev::test::executeTests("stPreCompiledContracts", "/StateTests", dev::test::doStateTests);
+}
+
+BOOST_AUTO_TEST_CASE(userDefinedFileState)
{
- int currentVerbosity = g_logVerbosity;
- g_logVerbosity = 12;
- dev::test::executeTests("tmp", "/StateTests", dev::test::doStateTests);
- g_logVerbosity = currentVerbosity;
+ dev::test::userDefinedTest("--statetest", dev::test::doStateTests);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tmpFiller.json b/tmpFiller.json
deleted file mode 100644
index bd27b890..00000000
--- a/tmpFiller.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "ABAcalls0": {
- "env" : {
- "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
- "currentNumber" : "0",
- "currentGasLimit" : "10000000",
- "currentDifficulty" : "256",
- "currentTimestamp" : 1,
- "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
- },
- "pre" : {
- "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
- "balance" : "1000000000000000000",
- "nonce" : 0,
- "code" : "{ [[ (PC) ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) }",
- "storage": {}
- },
- "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
- "balance" : "23",
- "code" : " { [[ (PC) ]] (ADD 1 (CALL 500 0x095e7baea6a6c7c4c2dfeb977efac326af552d87 23 0 0 0 0)) } ",
- "nonce" : "0",
- "storage" : {
- }
- },
- "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
- "balance" : "1000000000000000000",
- "nonce" : 0,
- "code" : "",
- "storage": {}
- }
-
- },
- "transaction" : {
- "nonce" : "0",
- "gasPrice" : "1",
- "gasLimit" : "10000",
- "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
- "value" : "100000",
- "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
- "data" : ""
- }
- }
-
-}
diff --git a/vm.cpp b/vm.cpp
index fe37d67c..1c6022f5 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -21,6 +21,7 @@
*/
#include <chrono>
+#include <boost/filesystem.hpp>
#include "vm.h"
using namespace std;
using namespace json_spirit;
@@ -29,7 +30,7 @@ using namespace dev::eth;
using namespace dev::test;
FakeExtVM::FakeExtVM(eth::BlockInfo const& _previousBlock, eth::BlockInfo const& _currentBlock, unsigned _depth): /// TODO: XXX: remove the default argument & fix.
- ExtVMFace(Address(), Address(), Address(), 0, 1, bytesConstRef(), bytesConstRef(), _previousBlock, _currentBlock, _depth) {}
+ ExtVMFace(Address(), Address(), Address(), 0, 1, bytesConstRef(), bytes(), _previousBlock, _currentBlock, _depth) {}
h160 FakeExtVM::create(u256 _endowment, u256* _gas, bytesConstRef _init, OnOpFunc const&)
{
@@ -195,11 +196,11 @@ void FakeExtVM::importExec(mObject& _o)
gas = toInt(_o["gas"]);
thisTxCode.clear();
- code = &thisTxCode;
+ code = thisTxCode;
thisTxCode = importCode(_o);
if (_o["code"].type() != str_type && _o["code"].type() != array_type)
- code.reset();
+ code.clear();
thisTxData.clear();
thisTxData = importData(_o);
@@ -297,10 +298,10 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
o["pre"] = mValue(fev.exportState());
fev.importExec(o["exec"].get_obj());
- if (!fev.code)
+ if (fev.code.empty())
{
fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress));
- fev.code = &fev.thisTxCode;
+ fev.code = fev.thisTxCode;
}
auto vm = VMFace::create(vmKind, fev.gas);
@@ -308,21 +309,31 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
auto outOfGas = false;
auto startTime = std::chrono::high_resolution_clock::now();
+ u256 gas;
try
{
output = vm->go(fev, fev.simpleTrace()).toVector();
+ gas = vm.gas();
}
catch (OutOfGas const&)
{
outOfGas = true;
+ gas = 0;
+ }
+ catch (VMException const& _e)
+ {
+ cnote << "VM did throw an exception: " << diagnostic_information(_e);
+ gas = 0;
}
catch (Exception const& _e)
{
cnote << "VM did throw an exception: " << diagnostic_information(_e);
+ BOOST_ERROR("Failed VM Test with Exception: " << _e.what());
}
catch (std::exception const& _e)
{
cnote << "VM did throw an exception: " << _e.what();
+ BOOST_ERROR("Failed VM Test with Exception: " << _e.what());
}
auto endTime = std::chrono::high_resolution_clock::now();
@@ -338,8 +349,6 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
}
}
- auto gas = vm->gas();
-
// delete null entries in storage for the sake of comparison
for (auto &a: fev.addresses)
@@ -380,7 +389,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
checkOutput(output, o);
BOOST_CHECK_EQUAL(toInt(o["gas"]), gas);
-
+
if (outOfGas)
BOOST_CHECK_MESSAGE(gas == 0, "Remaining gas not 0 in out-of-gas state");
@@ -454,32 +463,42 @@ BOOST_AUTO_TEST_CASE(vmPushDupSwapTest)
dev::test::executeTests("vmPushDupSwapTest", "/VMTests", dev::test::doVMTests);
}
-BOOST_AUTO_TEST_CASE(userDefinedFile)
+BOOST_AUTO_TEST_CASE(vmRandom)
{
- if (boost::unit_test::framework::master_test_suite().argc >= 2)
+ string testPath = getTestPath();
+ testPath += "/VMTests/RandomTests";
+
+ vector<boost::filesystem::path> testFiles;
+ boost::filesystem::directory_iterator iterator(testPath);
+ for(; iterator != boost::filesystem::directory_iterator(); ++iterator)
+ if (boost::filesystem::is_regular_file(iterator->path()) && iterator->path().extension() == ".json")
+ testFiles.push_back(iterator->path());
+
+ for (auto& path: testFiles)
{
- string filename = boost::unit_test::framework::master_test_suite().argv[1];
- int currentVerbosity = g_logVerbosity;
- g_logVerbosity = 12;
try
{
- cnote << "Testing VM..." << "user defined test";
+ cnote << "Testing ..." << path.filename();
json_spirit::mValue v;
- string s = asString(contents(filename));
- BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + filename + " is empty. ");
+ string s = asString(dev::contents(path.string()));
+ BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + path.string() + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?");
json_spirit::read_string(s, v);
- dev::test::doVMTests(v, false);
+ doVMTests(v, false);
}
catch (Exception const& _e)
{
- BOOST_ERROR("Failed VM Test with Exception: " << diagnostic_information(_e));
+ BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
}
catch (std::exception const& _e)
{
- BOOST_ERROR("Failed VM Test with Exception: " << _e.what());
+ BOOST_ERROR("Failed test with Exception: " << _e.what());
}
- g_logVerbosity = currentVerbosity;
}
}
+BOOST_AUTO_TEST_CASE(userDefinedFileVM)
+{
+ dev::test::userDefinedTest("--vmtest", dev::test::doVMTests);
+}
+
BOOST_AUTO_TEST_SUITE_END()
diff --git a/vm.h b/vm.h
index 1ed33e5f..a52a02e3 100644
--- a/vm.h
+++ b/vm.h
@@ -29,7 +29,7 @@ along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
#include "JsonSpiritHeaders.h"
#include <libdevcore/Log.h>
#include <libdevcore/CommonIO.h>
-#include <libevmface/Instruction.h>
+#include <libevmcore/Instruction.h>
#include <libevm/ExtVMFace.h>
#include <libevm/VM.h>
#include <liblll/Compiler.h>
diff --git a/vmArithmeticTestFiller.json b/vmArithmeticTestFiller.json
index 29d523a3..b9369457 100644
--- a/vmArithmeticTestFiller.json
+++ b/vmArithmeticTestFiller.json
@@ -1725,7 +1725,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : 0,
- "code" : "0x62122ff4600016600057",
+ "code" : "0x62122ff460000b600055",
"storage": {}
}
},
@@ -1753,7 +1753,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : 0,
- "code" : "0x62122f6a600016600057",
+ "code" : "0x62122f6a60000b600055",
"storage": {}
}
},
@@ -1781,7 +1781,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : 0,
- "code" : "0x6212faf4600116600057",
+ "code" : "0x6212faf460010b600055",
"storage": {}
}
},
@@ -1809,7 +1809,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : 0,
- "code" : "0x62126af4600116600057",
+ "code" : "0x62126af460010b600055",
"storage": {}
}
},
@@ -1837,7 +1837,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : 0,
- "code" : "0x62126af4605016600057",
+ "code" : "0x62126af460500b600055",
"storage": {}
}
},
@@ -2005,7 +2005,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : 0,
- "code" : "0x66f000000000000161ffff16600057",
+ "code" : "0x66f000000000000161ffff0b600055",
"storage": {}
}
},
@@ -2033,7 +2033,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : 0,
- "code" : "0x60ff68f0000000000000000116600057",
+ "code" : "0x60ff68f000000000000000010b600055",
"storage": {}
}
},
diff --git a/webthreestubclient.h b/webthreestubclient.h
index 6beee5bb..179c620a 100644
--- a/webthreestubclient.h
+++ b/webthreestubclient.h
@@ -19,11 +19,13 @@ class WebThreeStubClient
delete this->client;
}
- std::string account() throw (jsonrpc::JsonRpcException)
+ std::string db_get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
- p = Json::nullValue;
- Json::Value result = this->client->CallMethod("account",p);
+ p.append(param1);
+p.append(param2);
+
+ Json::Value result = this->client->CallMethod("db_get",p);
if (result.isString())
return result.asString();
else
@@ -31,38 +33,68 @@ class WebThreeStubClient
}
- Json::Value accounts() throw (jsonrpc::JsonRpcException)
+ std::string db_getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
- p = Json::nullValue;
- Json::Value result = this->client->CallMethod("accounts",p);
- if (result.isArray())
- return result;
+ p.append(param1);
+p.append(param2);
+
+ Json::Value result = this->client->CallMethod("db_getString",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
+ bool db_put(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->client->CallMethod("addToGroup",p);
- if (result.isString())
- return result.asString();
+ Json::Value result = this->client->CallMethod("db_put",p);
+ if (result.isBool())
+ return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- std::string balanceAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ 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->client->CallMethod("balanceAt",p);
+ Json::Value result = this->client->CallMethod("db_putString",p);
+ if (result.isBool())
+ return result.asBool();
+ else
+ throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
+
+ }
+
+ Json::Value eth_accounts() throw (jsonrpc::JsonRpcException)
+ {
+ Json::Value p;
+ p = Json::nullValue;
+ Json::Value result = this->client->CallMethod("eth_accounts",p);
+ if (result.isArray())
+ 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)
+ {
+ Json::Value p;
+ p.append(param1);
+
+ Json::Value result = this->client->CallMethod("eth_balanceAt",p);
if (result.isString())
return result.asString();
else
@@ -70,12 +102,12 @@ p.append(param2);
}
- Json::Value blockByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_blockByHash(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("blockByHash",p);
+ Json::Value result = this->client->CallMethod("eth_blockByHash",p);
if (result.isObject())
return result;
else
@@ -83,12 +115,12 @@ p.append(param2);
}
- Json::Value blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_blockByNumber(const int& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("blockByNumber",p);
+ Json::Value result = this->client->CallMethod("eth_blockByNumber",p);
if (result.isObject())
return result;
else
@@ -96,12 +128,12 @@ p.append(param2);
}
- std::string call(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_call(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("call",p);
+ Json::Value result = this->client->CallMethod("eth_call",p);
if (result.isString())
return result.asString();
else
@@ -109,12 +141,12 @@ p.append(param2);
}
- bool changed(const int& param1) throw (jsonrpc::JsonRpcException)
+ bool eth_changed(const int& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("changed",p);
+ Json::Value result = this->client->CallMethod("eth_changed",p);
if (result.isBool())
return result.asBool();
else
@@ -122,12 +154,12 @@ p.append(param2);
}
- std::string codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_codeAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("codeAt",p);
+ Json::Value result = this->client->CallMethod("eth_codeAt",p);
if (result.isString())
return result.asString();
else
@@ -135,11 +167,11 @@ p.append(param2);
}
- std::string coinbase() throw (jsonrpc::JsonRpcException)
+ std::string eth_coinbase() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
- Json::Value result = this->client->CallMethod("coinbase",p);
+ Json::Value result = this->client->CallMethod("eth_coinbase",p);
if (result.isString())
return result.asString();
else
@@ -147,12 +179,12 @@ p.append(param2);
}
- std::string compile(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_compile(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("compile",p);
+ Json::Value result = this->client->CallMethod("eth_compile",p);
if (result.isString())
return result.asString();
else
@@ -160,12 +192,12 @@ p.append(param2);
}
- double countAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ double eth_countAt(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("countAt",p);
+ Json::Value result = this->client->CallMethod("eth_countAt",p);
if (result.isDouble())
return result.asDouble();
else
@@ -173,11 +205,11 @@ p.append(param2);
}
- int defaultBlock() throw (jsonrpc::JsonRpcException)
+ int eth_defaultBlock() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
- Json::Value result = this->client->CallMethod("defaultBlock",p);
+ Json::Value result = this->client->CallMethod("eth_defaultBlock",p);
if (result.isInt())
return result.asInt();
else
@@ -185,11 +217,11 @@ p.append(param2);
}
- std::string gasPrice() throw (jsonrpc::JsonRpcException)
+ std::string eth_gasPrice() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
- Json::Value result = this->client->CallMethod("gasPrice",p);
+ Json::Value result = this->client->CallMethod("eth_gasPrice",p);
if (result.isString())
return result.asString();
else
@@ -197,26 +229,12 @@ p.append(param2);
}
- std::string get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_getMessages(const int& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
-p.append(param2);
- Json::Value result = this->client->CallMethod("get",p);
- if (result.isString())
- return result.asString();
- else
- throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
-
- }
-
- Json::Value getMessages(const int& param1) throw (jsonrpc::JsonRpcException)
- {
- Json::Value p;
- p.append(param1);
-
- Json::Value result = this->client->CallMethod("getMessages",p);
+ Json::Value result = this->client->CallMethod("eth_getMessages",p);
if (result.isArray())
return result;
else
@@ -224,26 +242,11 @@ p.append(param2);
}
- std::string 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->client->CallMethod("getString",p);
- if (result.isString())
- return result.asString();
- else
- throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
-
- }
-
- bool haveIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ bool eth_listening() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
- p.append(param1);
-
- Json::Value result = this->client->CallMethod("haveIdentity",p);
+ p = Json::nullValue;
+ Json::Value result = this->client->CallMethod("eth_listening",p);
if (result.isBool())
return result.asBool();
else
@@ -251,23 +254,24 @@ p.append(param2);
}
- bool listening() throw (jsonrpc::JsonRpcException)
+ std::string eth_lll(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
- p = Json::nullValue;
- Json::Value result = this->client->CallMethod("listening",p);
- if (result.isBool())
- return result.asBool();
+ p.append(param1);
+
+ Json::Value result = this->client->CallMethod("eth_lll",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool mining() throw (jsonrpc::JsonRpcException)
+ bool eth_mining() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
- Json::Value result = this->client->CallMethod("mining",p);
+ Json::Value result = this->client->CallMethod("eth_mining",p);
if (result.isBool())
return result.asBool();
else
@@ -275,12 +279,12 @@ p.append(param2);
}
- int newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
+ int eth_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("newFilter",p);
+ Json::Value result = this->client->CallMethod("eth_newFilter",p);
if (result.isInt())
return result.asInt();
else
@@ -288,12 +292,12 @@ p.append(param2);
}
- int newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ int eth_newFilterString(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("newFilterString",p);
+ Json::Value result = this->client->CallMethod("eth_newFilterString",p);
if (result.isInt())
return result.asInt();
else
@@ -301,37 +305,23 @@ p.append(param2);
}
- std::string newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
- {
- Json::Value p;
- p.append(param1);
-p.append(param2);
-
- Json::Value result = this->client->CallMethod("newGroup",p);
- if (result.isString())
- return result.asString();
- else
- throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
-
- }
-
- std::string newIdentity() throw (jsonrpc::JsonRpcException)
+ int eth_number() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
- Json::Value result = this->client->CallMethod("newIdentity",p);
- if (result.isString())
- return result.asString();
+ Json::Value result = this->client->CallMethod("eth_number",p);
+ if (result.isInt())
+ return result.asInt();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- int number() throw (jsonrpc::JsonRpcException)
+ int eth_peerCount() throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p = Json::nullValue;
- Json::Value result = this->client->CallMethod("number",p);
+ Json::Value result = this->client->CallMethod("eth_peerCount",p);
if (result.isInt())
return result.asInt();
else
@@ -339,24 +329,25 @@ p.append(param2);
}
- int peerCount() throw (jsonrpc::JsonRpcException)
+ bool eth_setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
- p = Json::nullValue;
- Json::Value result = this->client->CallMethod("peerCount",p);
- if (result.isInt())
- return result.asInt();
+ p.append(param1);
+
+ Json::Value result = this->client->CallMethod("eth_setCoinbase",p);
+ if (result.isBool())
+ return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool post(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
+ bool eth_setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("post",p);
+ Json::Value result = this->client->CallMethod("eth_setDefaultBlock",p);
if (result.isBool())
return result.asBool();
else
@@ -364,14 +355,12 @@ p.append(param2);
}
- bool put(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
+ bool eth_setListening(const bool& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
-p.append(param2);
-p.append(param3);
- Json::Value result = this->client->CallMethod("put",p);
+ Json::Value result = this->client->CallMethod("eth_setListening",p);
if (result.isBool())
return result.asBool();
else
@@ -379,14 +368,12 @@ p.append(param3);
}
- bool putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
+ bool eth_setMining(const bool& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
-p.append(param2);
-p.append(param3);
- Json::Value result = this->client->CallMethod("putString",p);
+ Json::Value result = this->client->CallMethod("eth_setMining",p);
if (result.isBool())
return result.asBool();
else
@@ -394,90 +381,95 @@ p.append(param3);
}
- bool setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
+p.append(param2);
- Json::Value result = this->client->CallMethod("setCoinbase",p);
- if (result.isBool())
- return result.asBool();
+ Json::Value result = this->client->CallMethod("eth_stateAt",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException)
+ std::string eth_transact(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("setDefaultBlock",p);
- if (result.isBool())
- return result.asBool();
+ Json::Value result = this->client->CallMethod("eth_transact",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool setListening(const bool& param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
+p.append(param2);
- Json::Value result = this->client->CallMethod("setListening",p);
- if (result.isBool())
- return result.asBool();
+ Json::Value result = this->client->CallMethod("eth_transactionByHash",p);
+ if (result.isObject())
+ return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool setMining(const bool& param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_transactionByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
+p.append(param2);
- Json::Value result = this->client->CallMethod("setMining",p);
- if (result.isBool())
- return result.asBool();
+ Json::Value result = this->client->CallMethod("eth_transactionByNumber",p);
+ if (result.isObject())
+ return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value shhChanged(const int& param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_uncleByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
+p.append(param2);
- Json::Value result = this->client->CallMethod("shhChanged",p);
- if (result.isArray())
+ Json::Value result = this->client->CallMethod("eth_uncleByHash",p);
+ if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- int shhNewFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
+ Json::Value eth_uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
+p.append(param2);
- Json::Value result = this->client->CallMethod("shhNewFilter",p);
- if (result.isInt())
- return result.asInt();
+ Json::Value result = this->client->CallMethod("eth_uncleByNumber",p);
+ if (result.isObject())
+ return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool shhUninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
+ bool eth_uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("shhUninstallFilter",p);
+ Json::Value result = this->client->CallMethod("eth_uninstallFilter",p);
if (result.isBool())
return result.asBool();
else
@@ -485,13 +477,13 @@ p.append(param3);
}
- std::string stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
+ std::string shh_addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
- Json::Value result = this->client->CallMethod("stateAt",p);
+ Json::Value result = this->client->CallMethod("shh_addToGroup",p);
if (result.isString())
return result.asString();
else
@@ -499,81 +491,90 @@ p.append(param2);
}
- std::string transact(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
+ Json::Value shh_changed(const int& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("transact",p);
- if (result.isString())
- return result.asString();
+ Json::Value result = this->client->CallMethod("shh_changed",p);
+ if (result.isArray())
+ return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
+ bool shh_haveIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
-p.append(param2);
- Json::Value result = this->client->CallMethod("transactionByHash",p);
- if (result.isObject())
- return result;
+ Json::Value result = this->client->CallMethod("shh_haveIdentity",p);
+ if (result.isBool())
+ return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value transactionByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
+ int shh_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
-p.append(param2);
- Json::Value result = this->client->CallMethod("transactionByNumber",p);
- if (result.isObject())
- return result;
+ Json::Value result = this->client->CallMethod("shh_newFilter",p);
+ if (result.isInt())
+ return result.asInt();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value uncleByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException)
+ std::string shh_newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
- Json::Value result = this->client->CallMethod("uncleByHash",p);
- if (result.isObject())
- return result;
+ Json::Value result = this->client->CallMethod("shh_newGroup",p);
+ if (result.isString())
+ return result.asString();
+ else
+ throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
+
+ }
+
+ std::string shh_newIdentity() throw (jsonrpc::JsonRpcException)
+ {
+ Json::Value p;
+ p = Json::nullValue;
+ Json::Value result = this->client->CallMethod("shh_newIdentity",p);
+ if (result.isString())
+ return result.asString();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- Json::Value uncleByNumber(const int& param1, const int& param2) throw (jsonrpc::JsonRpcException)
+ bool shh_post(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
-p.append(param2);
- Json::Value result = this->client->CallMethod("uncleByNumber",p);
- if (result.isObject())
- return result;
+ Json::Value result = this->client->CallMethod("shh_post",p);
+ if (result.isBool())
+ return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
- bool uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
+ bool shh_uninstallFilter(const int& param1) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
- Json::Value result = this->client->CallMethod("uninstallFilter",p);
+ Json::Value result = this->client->CallMethod("shh_uninstallFilter",p);
if (result.isBool())
return result.asBool();
else
diff --git a/whisperTopic.cpp b/whisperTopic.cpp
new file mode 100644
index 00000000..493b37bc
--- /dev/null
+++ b/whisperTopic.cpp
@@ -0,0 +1,84 @@
+/*
+ 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 whisperTopic.cpp
+ * @author Gav Wood <i@gavwood.com>
+ * @date 2014
+ */
+#include <functional>
+#include <boost/test/unit_test.hpp>
+#include <libp2p/Host.h>
+#include <libwhisper/WhisperPeer.h>
+#include <libwhisper/WhisperHost.h>
+using namespace std;
+using namespace dev;
+using namespace dev::p2p;
+using namespace dev::shh;
+
+BOOST_AUTO_TEST_SUITE(whisper)
+
+BOOST_AUTO_TEST_CASE(topic)
+{
+ g_logVerbosity = 0;
+
+ bool started = false;
+ unsigned result = 0;
+ std::thread listener([&]()
+ {
+ setThreadName("other");
+
+ Host ph("Test", NetworkPreferences(30303, "", false, true));
+ auto wh = ph.registerCapability(new WhisperHost());
+ ph.start();
+
+ started = true;
+
+ /// Only interested in odd packets
+ auto w = wh->installWatch(BuildTopicMask()("odd"));
+
+ for (int i = 0, last = 0; i < 100 && last < 81; ++i)
+ {
+ for (auto i: wh->checkWatch(w))
+ {
+ Message msg = wh->envelope(i).open();
+ last = RLP(msg.payload()).toInt<unsigned>();
+ cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
+ result += last;
+ }
+ this_thread::sleep_for(chrono::milliseconds(50));
+ }
+ });
+
+ while (!started)
+ this_thread::sleep_for(chrono::milliseconds(50));
+
+ Host ph("Test", NetworkPreferences(30300, "", false, true));
+ auto wh = ph.registerCapability(new WhisperHost());
+ ph.start();
+ ph.connect("127.0.0.1", 30303);
+
+ KeyPair us = KeyPair::create();
+ for (int i = 0; i < 10; ++i)
+ {
+ wh->post(us.sec(), RLPStream().append(i * i).out(), BuildTopic(i)(i % 2 ? "odd" : "even"));
+ this_thread::sleep_for(chrono::milliseconds(250));
+ }
+
+ listener.join();
+ BOOST_REQUIRE_EQUAL(result, 1 + 9 + 25 + 49 + 81);
+}
+
+BOOST_AUTO_TEST_SUITE_END()