Browse Source

merge

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
6cc9e6952e
  1. 2
      alethzero/MainWin.cpp
  2. 2
      alethzero/OurWebThreeStubServer.cpp
  3. 2
      alethzero/OurWebThreeStubServer.h
  4. 4
      libethereum/Executive.cpp
  5. 81
      libevmcore/Assembly.cpp
  6. 2
      libevmcore/Assembly.h
  7. 260
      libevmcore/Instruction.cpp
  8. 1
      libevmcore/Instruction.h
  9. 80
      libjsqrc/main.js
  10. 2
      libjsqrc/setup.js
  11. 29
      libqethereum/QEthereum.cpp
  12. 9
      libsolidity/Compiler.cpp
  13. 4
      libsolidity/Compiler.h
  14. 2
      libsolidity/CompilerContext.h
  15. 5
      libsolidity/CompilerStack.cpp
  16. 2
      libsolidity/CompilerStack.h
  17. 94
      libweb3jsonrpc/WebThreeStubServer.cpp
  18. 96
      libweb3jsonrpc/WebThreeStubServer.h
  19. 368
      libweb3jsonrpc/abstractwebthreestubserver.h
  20. 106
      libweb3jsonrpc/spec.json
  21. 10
      solc/main.cpp
  22. 43
      test/TestHelper.cpp
  23. 1
      test/TestHelper.h
  24. 46
      test/jsonrpc.cpp
  25. 717
      test/stPreCompiledContractsFiller.json
  26. 1334
      test/stSystemOperationsTestFiller.json
  27. 11
      test/state.cpp
  28. 35
      test/vm.cpp
  29. 14
      test/vmArithmeticTestFiller.json
  30. 356
      test/webthreestubclient.h

2
alethzero/MainWin.cpp

@ -1605,7 +1605,7 @@ void Main::on_data_textChanged()
shared_ptr<solidity::Scanner> scanner = make_shared<solidity::Scanner>(); shared_ptr<solidity::Scanner> scanner = make_shared<solidity::Scanner>();
try try
{ {
m_data = dev::solidity::CompilerStack::compile(src, scanner); m_data = dev::solidity::CompilerStack::compile(src, scanner, m_enableOptimizer);
} }
catch (dev::Exception const& exception) catch (dev::Exception const& exception)
{ {

2
alethzero/OurWebThreeStubServer.cpp

@ -28,7 +28,7 @@ OurWebThreeStubServer::OurWebThreeStubServer(jsonrpc::AbstractServerConnector* _
WebThreeStubServer(_conn, _web3, _accounts) WebThreeStubServer(_conn, _web3, _accounts)
{} {}
std::string OurWebThreeStubServer::newIdentity() std::string OurWebThreeStubServer::shh_newIdentity()
{ {
dev::KeyPair kp = dev::KeyPair::create(); dev::KeyPair kp = dev::KeyPair::create();
emit onNewId(QString::fromStdString(toJS(kp.sec()))); emit onNewId(QString::fromStdString(toJS(kp.sec())));

2
alethzero/OurWebThreeStubServer.h

@ -31,7 +31,7 @@ class OurWebThreeStubServer: public QObject, public WebThreeStubServer
public: public:
OurWebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, dev::WebThreeDirect& _web3, std::vector<dev::KeyPair> const& _accounts); OurWebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, dev::WebThreeDirect& _web3, std::vector<dev::KeyPair> const& _accounts);
virtual std::string newIdentity() override; virtual std::string shh_newIdentity() override;
signals: signals:
void onNewId(QString _s); void onNewId(QString _s);

4
libethereum/Executive.cpp

@ -80,14 +80,14 @@ bool Executive::setup(bytesConstRef _rlp)
if (m_s.balance(m_sender) < cost) if (m_s.balance(m_sender) < cost)
{ {
clog(StateDetail) << "Not enough cash: Require >" << cost << " Got" << m_s.balance(m_sender); clog(StateDetail) << "Not enough cash: Require >" << cost << " Got" << m_s.balance(m_sender);
BOOST_THROW_EXCEPTION(NotEnoughCash()); BOOST_THROW_EXCEPTION(NotEnoughCash() << RequirementError((int)cost, (int)m_s.balance(m_sender)));
} }
u256 startGasUsed = m_s.gasUsed(); u256 startGasUsed = m_s.gasUsed();
if (startGasUsed + m_t.gas() > m_s.m_currentBlock.gasLimit) if (startGasUsed + m_t.gas() > m_s.m_currentBlock.gasLimit)
{ {
clog(StateDetail) << "Too much gas used in this block: Require <" << (m_s.m_currentBlock.gasLimit - startGasUsed) << " Got" << m_t.gas(); clog(StateDetail) << "Too much gas used in this block: Require <" << (m_s.m_currentBlock.gasLimit - startGasUsed) << " Got" << m_t.gas();
BOOST_THROW_EXCEPTION(BlockGasLimitReached()); BOOST_THROW_EXCEPTION(BlockGasLimitReached() << RequirementError((int)(m_s.m_currentBlock.gasLimit - startGasUsed), (int)m_t.gas()));
} }
// Increment associated nonce for sender. // Increment associated nonce for sender.

81
libevmcore/Assembly.cpp

@ -70,7 +70,12 @@ unsigned Assembly::bytesRequired() const
case PushData: case PushData:
case PushSub: case PushSub:
ret += 1 + br; ret += 1 + br;
default:; break;
case NoOptimizeBegin:
case NoOptimizeEnd:
break;
default:
BOOST_THROW_EXCEPTION(InvalidOpcode());
} }
if (dev::bytesRequired(ret) <= br) if (dev::bytesRequired(ret) <= br)
return ret; return ret;
@ -140,9 +145,17 @@ ostream& dev::eth::operator<<(ostream& _out, AssemblyItemsConstRef _i)
case PushSubSize: case PushSubSize:
_out << " PUSHss[" << hex << h256(i.data()).abridged() << "]"; _out << " PUSHss[" << hex << h256(i.data()).abridged() << "]";
break; break;
case NoOptimizeBegin:
_out << " DoNotOptimze{{";
break;
case NoOptimizeEnd:
_out << " DoNotOptimze}}";
break;
case UndefinedItem: case UndefinedItem:
_out << " ???"; _out << " ???";
default:; break;
default:
BOOST_THROW_EXCEPTION(InvalidOpcode());
} }
return _out; return _out;
} }
@ -177,7 +190,14 @@ ostream& Assembly::streamRLP(ostream& _out, string const& _prefix) const
case PushData: case PushData:
_out << _prefix << " PUSH [" << hex << (unsigned)i.m_data << "]" << endl; _out << _prefix << " PUSH [" << hex << (unsigned)i.m_data << "]" << endl;
break; break;
default:; case NoOptimizeBegin:
_out << _prefix << "DoNotOptimze{{" << endl;
break;
case NoOptimizeEnd:
_out << _prefix << "DoNotOptimze}}" << endl;
break;
default:
BOOST_THROW_EXCEPTION(InvalidOpcode());
} }
if (m_data.size() || m_subs.size()) if (m_data.size() || m_subs.size())
@ -217,6 +237,12 @@ inline bool matches(AssemblyItemsConstRef _a, AssemblyItemsConstRef _b)
return true; return true;
} }
inline bool popCountIncreased(AssemblyItemsConstRef _pre, AssemblyItems const& _post)
{
auto isPop = [](AssemblyItem const& _item) -> bool { return _item.match(AssemblyItem(Instruction::POP)); };
return count_if(begin(_post), end(_post), isPop) > count_if(begin(_pre), end(_pre), isPop);
}
struct OptimiserChannel: public LogChannel { static const char* name() { return "OPT"; } static const int verbosity = 12; }; struct OptimiserChannel: public LogChannel { static const char* name() { return "OPT"; } static const int verbosity = 12; };
#define copt dev::LogOutputStream<OptimiserChannel, true>() #define copt dev::LogOutputStream<OptimiserChannel, true>()
@ -224,6 +250,14 @@ Assembly& Assembly::optimise(bool _enable)
{ {
if (!_enable) if (!_enable)
return *this; return *this;
auto signextend = [](u256 a, u256 b) -> u256
{
if (a >= 31)
return b;
unsigned testBit = unsigned(a) * 8 + 7;
u256 mask = (u256(1) << testBit) - 1;
return boost::multiprecision::bit_test(b, testBit) ? b | ~mask : b & mask;
};
map<Instruction, function<u256(u256, u256)>> c_simple = map<Instruction, function<u256(u256, u256)>> c_simple =
{ {
{ Instruction::SUB, [](u256 a, u256 b)->u256{return a - b;} }, { Instruction::SUB, [](u256 a, u256 b)->u256{return a - b;} },
@ -232,6 +266,7 @@ Assembly& Assembly::optimise(bool _enable)
{ Instruction::MOD, [](u256 a, u256 b)->u256{return a % b;} }, { Instruction::MOD, [](u256 a, u256 b)->u256{return a % b;} },
{ Instruction::SMOD, [](u256 a, u256 b)->u256{return s2u(u2s(a) % u2s(b));} }, { Instruction::SMOD, [](u256 a, u256 b)->u256{return s2u(u2s(a) % u2s(b));} },
{ Instruction::EXP, [](u256 a, u256 b)->u256{return (u256)boost::multiprecision::powm((bigint)a, (bigint)b, bigint(2) << 256);} }, { Instruction::EXP, [](u256 a, u256 b)->u256{return (u256)boost::multiprecision::powm((bigint)a, (bigint)b, bigint(2) << 256);} },
{ Instruction::SIGNEXTEND, signextend },
{ Instruction::LT, [](u256 a, u256 b)->u256{return a < b ? 1 : 0;} }, { Instruction::LT, [](u256 a, u256 b)->u256{return a < b ? 1 : 0;} },
{ Instruction::GT, [](u256 a, u256 b)->u256{return a > b ? 1 : 0;} }, { Instruction::GT, [](u256 a, u256 b)->u256{return a > b ? 1 : 0;} },
{ Instruction::SLT, [](u256 a, u256 b)->u256{return u2s(a) < u2s(b) ? 1 : 0;} }, { Instruction::SLT, [](u256 a, u256 b)->u256{return u2s(a) < u2s(b) ? 1 : 0;} },
@ -242,6 +277,9 @@ Assembly& Assembly::optimise(bool _enable)
{ {
{ Instruction::ADD, [](u256 a, u256 b)->u256{return a + b;} }, { Instruction::ADD, [](u256 a, u256 b)->u256{return a + b;} },
{ Instruction::MUL, [](u256 a, u256 b)->u256{return a * b;} }, { Instruction::MUL, [](u256 a, u256 b)->u256{return a * b;} },
{ Instruction::AND, [](u256 a, u256 b)->u256{return a & b;} },
{ Instruction::OR, [](u256 a, u256 b)->u256{return a | b;} },
{ Instruction::XOR, [](u256 a, u256 b)->u256{return a ^ b;} },
}; };
std::vector<pair<AssemblyItems, function<AssemblyItems(AssemblyItemsConstRef)>>> rules = std::vector<pair<AssemblyItems, function<AssemblyItems(AssemblyItemsConstRef)>>> rules =
{ {
@ -260,8 +298,23 @@ Assembly& Assembly::optimise(bool _enable)
{ {
rules.push_back({ { Push, Push, i.first }, [&](AssemblyItemsConstRef m) -> AssemblyItems { return { i.second(m[1].data(), m[0].data()) }; } }); rules.push_back({ { Push, Push, i.first }, [&](AssemblyItemsConstRef m) -> AssemblyItems { return { i.second(m[1].data(), m[0].data()) }; } });
rules.push_back({ { Push, i.first, Push, i.first }, [&](AssemblyItemsConstRef m) -> AssemblyItems { return { i.second(m[2].data(), m[0].data()), i.first }; } }); rules.push_back({ { Push, i.first, Push, i.first }, [&](AssemblyItemsConstRef m) -> AssemblyItems { return { i.second(m[2].data(), m[0].data()), i.first }; } });
rules.push_back({ { PushTag, Instruction::JUMP, Tag }, [&](AssemblyItemsConstRef m) -> AssemblyItems { if (m[0].m_data == m[2].m_data) return {}; else return m.toVector(); }});
} }
// jump to next instruction
rules.push_back({ { PushTag, Instruction::JUMP, Tag }, [&](AssemblyItemsConstRef m) -> AssemblyItems { if (m[0].m_data == m[2].m_data) return {m[2]}; else return m.toVector(); }});
// pop optimization, do not compute values that are popped again anyway
rules.push_back({ { AssemblyItem(UndefinedItem), Instruction::POP }, [](AssemblyItemsConstRef m) -> AssemblyItems
{
if (m[0].type() != Operation)
return m.toVector();
Instruction instr = Instruction(byte(m[0].data()));
if (Instruction::DUP1 <= instr && instr <= Instruction::DUP16)
return {};
InstructionInfo info = instructionInfo(instr);
if (info.sideEffects || info.additional != 0 || info.ret != 1)
return m.toVector();
return AssemblyItems(info.args, Instruction::POP);
} });
copt << *this; copt << *this;
@ -269,16 +322,21 @@ Assembly& Assembly::optimise(bool _enable)
for (unsigned count = 1; count > 0; total += count) for (unsigned count = 1; count > 0; total += count)
{ {
count = 0; count = 0;
map<u256, unsigned> tags;
for (unsigned i = 0; i < m_items.size(); ++i) for (unsigned i = 0; i < m_items.size(); ++i)
{ {
if (m_items[i].type() == NoOptimizeBegin)
{
while (i < m_items.size() && m_items[i].type() != NoOptimizeEnd)
++i;
continue;
}
for (auto const& r: rules) for (auto const& r: rules)
{ {
auto vr = AssemblyItemsConstRef(&m_items).cropped(i, r.first.size()); auto vr = AssemblyItemsConstRef(&m_items).cropped(i, r.first.size());
if (matches(&r.first, vr)) if (matches(vr, &r.first))
{ {
auto rw = r.second(vr); auto rw = r.second(vr);
if (rw.size() < vr.size()) if (rw.size() < vr.size() || (rw.size() == vr.size() && popCountIncreased(vr, rw)))
{ {
copt << vr << "matches" << AssemblyItemsConstRef(&r.first) << "becomes..."; copt << vr << "matches" << AssemblyItemsConstRef(&r.first) << "becomes...";
for (unsigned j = 0; j < vr.size(); ++j) for (unsigned j = 0; j < vr.size(); ++j)
@ -297,6 +355,8 @@ Assembly& Assembly::optimise(bool _enable)
bool o = false; bool o = false;
while (m_items.size() > i + 1 && m_items[i + 1].type() != Tag) while (m_items.size() > i + 1 && m_items[i + 1].type() != Tag)
{ {
if (m_items[i + 1].type() == NoOptimizeBegin)
break;
m_items.erase(m_items.begin() + i + 1); m_items.erase(m_items.begin() + i + 1);
o = true; o = true;
} }
@ -308,6 +368,7 @@ Assembly& Assembly::optimise(bool _enable)
} }
} }
map<u256, unsigned> tags;
for (unsigned i = 0; i < m_items.size(); ++i) for (unsigned i = 0; i < m_items.size(); ++i)
if (m_items[i].type() == Tag) if (m_items[i].type() == Tag)
tags.insert(make_pair(m_items[i].data(), i)); tags.insert(make_pair(m_items[i].data(), i));
@ -416,7 +477,11 @@ bytes Assembly::assemble() const
tagPos[(unsigned)i.m_data] = ret.size(); tagPos[(unsigned)i.m_data] = ret.size();
ret.push_back((byte)Instruction::JUMPDEST); ret.push_back((byte)Instruction::JUMPDEST);
break; break;
default:; case NoOptimizeBegin:
case NoOptimizeEnd:
break;
default:
BOOST_THROW_EXCEPTION(InvalidOpcode());
} }
for (auto const& i: tagRef) for (auto const& i: tagRef)

2
libevmcore/Assembly.h

@ -32,7 +32,7 @@ namespace dev
namespace eth namespace eth
{ {
enum AssemblyItemType { UndefinedItem, Operation, Push, PushString, PushTag, PushSub, PushSubSize, Tag, PushData }; enum AssemblyItemType { UndefinedItem, Operation, Push, PushString, PushTag, PushSub, PushSubSize, Tag, PushData, NoOptimizeBegin, NoOptimizeEnd };
class Assembly; class Assembly;

260
libevmcore/Instruction.cpp

@ -162,136 +162,136 @@ const std::map<std::string, Instruction> dev::eth::c_instructions =
}; };
static const std::map<Instruction, InstructionInfo> c_instructionInfo = static const std::map<Instruction, InstructionInfo> c_instructionInfo =
{ // Add, Args, Ret { // Add, Args, Ret, SideEffects
{ Instruction::STOP, { "STOP", 0, 0, 0 } }, { Instruction::STOP, { "STOP", 0, 0, 0, true } },
{ Instruction::ADD, { "ADD", 0, 2, 1 } }, { Instruction::ADD, { "ADD", 0, 2, 1, false } },
{ Instruction::SUB, { "SUB", 0, 2, 1 } }, { Instruction::SUB, { "SUB", 0, 2, 1, false } },
{ Instruction::MUL, { "MUL", 0, 2, 1 } }, { Instruction::MUL, { "MUL", 0, 2, 1, false } },
{ Instruction::DIV, { "DIV", 0, 2, 1 } }, { Instruction::DIV, { "DIV", 0, 2, 1, false } },
{ Instruction::SDIV, { "SDIV", 0, 2, 1 } }, { Instruction::SDIV, { "SDIV", 0, 2, 1, false } },
{ Instruction::MOD, { "MOD", 0, 2, 1 } }, { Instruction::MOD, { "MOD", 0, 2, 1, false } },
{ Instruction::SMOD, { "SMOD", 0, 2, 1 } }, { Instruction::SMOD, { "SMOD", 0, 2, 1, false } },
{ Instruction::EXP, { "EXP", 0, 2, 1 } }, { Instruction::EXP, { "EXP", 0, 2, 1, false } },
{ Instruction::NOT, { "NOT", 0, 1, 1 } }, { Instruction::NOT, { "NOT", 0, 1, 1, false } },
{ Instruction::LT, { "LT", 0, 2, 1 } }, { Instruction::LT, { "LT", 0, 2, 1, false } },
{ Instruction::GT, { "GT", 0, 2, 1 } }, { Instruction::GT, { "GT", 0, 2, 1, false } },
{ Instruction::SLT, { "SLT", 0, 2, 1 } }, { Instruction::SLT, { "SLT", 0, 2, 1, false } },
{ Instruction::SGT, { "SGT", 0, 2, 1 } }, { Instruction::SGT, { "SGT", 0, 2, 1, false } },
{ Instruction::EQ, { "EQ", 0, 2, 1 } }, { Instruction::EQ, { "EQ", 0, 2, 1, false } },
{ Instruction::ISZERO, { "ISZERO", 0, 1, 1 } }, { Instruction::ISZERO, { "ISZERO", 0, 1, 1, false } },
{ Instruction::AND, { "AND", 0, 2, 1 } }, { Instruction::AND, { "AND", 0, 2, 1, false } },
{ Instruction::OR, { "OR", 0, 2, 1 } }, { Instruction::OR, { "OR", 0, 2, 1, false } },
{ Instruction::XOR, { "XOR", 0, 2, 1 } }, { Instruction::XOR, { "XOR", 0, 2, 1, false } },
{ Instruction::BYTE, { "BYTE", 0, 2, 1 } }, { Instruction::BYTE, { "BYTE", 0, 2, 1, false } },
{ Instruction::ADDMOD, { "ADDMOD", 0, 3, 1 } }, { Instruction::ADDMOD, { "ADDMOD", 0, 3, 1, false } },
{ Instruction::MULMOD, { "MULMOD", 0, 3, 1 } }, { Instruction::MULMOD, { "MULMOD", 0, 3, 1, false } },
{ Instruction::SIGNEXTEND, { "SIGNEXTEND", 0, 2, 1 } }, { Instruction::SIGNEXTEND, { "SIGNEXTEND", 0, 2, 1, false } },
{ Instruction::SHA3, { "SHA3", 0, 2, 1 } }, { Instruction::SHA3, { "SHA3", 0, 2, 1, false } },
{ Instruction::ADDRESS, { "ADDRESS", 0, 0, 1 } }, { Instruction::ADDRESS, { "ADDRESS", 0, 0, 1, false } },
{ Instruction::BALANCE, { "BALANCE", 0, 1, 1 } }, { Instruction::BALANCE, { "BALANCE", 0, 1, 1, false } },
{ Instruction::ORIGIN, { "ORIGIN", 0, 0, 1 } }, { Instruction::ORIGIN, { "ORIGIN", 0, 0, 1, false } },
{ Instruction::CALLER, { "CALLER", 0, 0, 1 } }, { Instruction::CALLER, { "CALLER", 0, 0, 1, false } },
{ Instruction::CALLVALUE, { "CALLVALUE", 0, 0, 1 } }, { Instruction::CALLVALUE, { "CALLVALUE", 0, 0, 1, false } },
{ Instruction::CALLDATALOAD,{ "CALLDATALOAD", 0, 1, 1 } }, { Instruction::CALLDATALOAD,{ "CALLDATALOAD", 0, 1, 1, false } },
{ Instruction::CALLDATASIZE,{ "CALLDATASIZE", 0, 0, 1 } }, { Instruction::CALLDATASIZE,{ "CALLDATASIZE", 0, 0, 1, false } },
{ Instruction::CALLDATACOPY,{ "CALLDATACOPY", 0, 3, 0 } }, { Instruction::CALLDATACOPY,{ "CALLDATACOPY", 0, 3, 0, true } },
{ Instruction::CODESIZE, { "CODESIZE", 0, 0, 1 } }, { Instruction::CODESIZE, { "CODESIZE", 0, 0, 1, false } },
{ Instruction::CODECOPY, { "CODECOPY", 0, 3, 0 } }, { Instruction::CODECOPY, { "CODECOPY", 0, 3, 0, true } },
{ Instruction::GASPRICE, { "GASPRICE", 0, 0, 1 } }, { Instruction::GASPRICE, { "GASPRICE", 0, 0, 1, false } },
{ Instruction::EXTCODESIZE, { "EXTCODESIZE", 0, 1, 1 } }, { Instruction::EXTCODESIZE, { "EXTCODESIZE", 0, 1, 1, false } },
{ Instruction::EXTCODECOPY, { "EXTCODECOPY", 0, 4, 0 } }, { Instruction::EXTCODECOPY, { "EXTCODECOPY", 0, 4, 0, true } },
{ Instruction::PREVHASH, { "PREVHASH", 0, 0, 1 } }, { Instruction::PREVHASH, { "PREVHASH", 0, 0, 1, false } },
{ Instruction::COINBASE, { "COINBASE", 0, 0, 1 } }, { Instruction::COINBASE, { "COINBASE", 0, 0, 1, false } },
{ Instruction::TIMESTAMP, { "TIMESTAMP", 0, 0, 1 } }, { Instruction::TIMESTAMP, { "TIMESTAMP", 0, 0, 1, false } },
{ Instruction::NUMBER, { "NUMBER", 0, 0, 1 } }, { Instruction::NUMBER, { "NUMBER", 0, 0, 1, false } },
{ Instruction::DIFFICULTY, { "DIFFICULTY", 0, 0, 1 } }, { Instruction::DIFFICULTY, { "DIFFICULTY", 0, 0, 1, false } },
{ Instruction::GASLIMIT, { "GASLIMIT", 0, 0, 1 } }, { Instruction::GASLIMIT, { "GASLIMIT", 0, 0, 1, false } },
{ Instruction::POP, { "POP", 0, 1, 0 } }, { Instruction::POP, { "POP", 0, 1, 0, false } },
{ Instruction::MLOAD, { "MLOAD", 0, 1, 1 } }, { Instruction::MLOAD, { "MLOAD", 0, 1, 1, false } },
{ Instruction::MSTORE, { "MSTORE", 0, 2, 0 } }, { Instruction::MSTORE, { "MSTORE", 0, 2, 0, true } },
{ Instruction::MSTORE8, { "MSTORE8", 0, 2, 0 } }, { Instruction::MSTORE8, { "MSTORE8", 0, 2, 0, true } },
{ Instruction::SLOAD, { "SLOAD", 0, 1, 1 } }, { Instruction::SLOAD, { "SLOAD", 0, 1, 1, false } },
{ Instruction::SSTORE, { "SSTORE", 0, 2, 0 } }, { Instruction::SSTORE, { "SSTORE", 0, 2, 0, true } },
{ Instruction::JUMP, { "JUMP", 0, 1, 0 } }, { Instruction::JUMP, { "JUMP", 0, 1, 0, true } },
{ Instruction::JUMPI, { "JUMPI", 0, 2, 0 } }, { Instruction::JUMPI, { "JUMPI", 0, 2, 0, true } },
{ Instruction::PC, { "PC", 0, 0, 1 } }, { Instruction::PC, { "PC", 0, 0, 1, false } },
{ Instruction::MSIZE, { "MSIZE", 0, 0, 1 } }, { Instruction::MSIZE, { "MSIZE", 0, 0, 1, false } },
{ Instruction::GAS, { "GAS", 0, 0, 1 } }, { Instruction::GAS, { "GAS", 0, 0, 1, false } },
{ Instruction::JUMPDEST, { "JUMPDEST", 0, 1, 0 } }, { Instruction::JUMPDEST, { "JUMPDEST", 0, 1, 0, true } },
{ Instruction::PUSH1, { "PUSH1", 1, 0, 1 } }, { Instruction::PUSH1, { "PUSH1", 1, 0, 1, false } },
{ Instruction::PUSH2, { "PUSH2", 2, 0, 1 } }, { Instruction::PUSH2, { "PUSH2", 2, 0, 1, false } },
{ Instruction::PUSH3, { "PUSH3", 3, 0, 1 } }, { Instruction::PUSH3, { "PUSH3", 3, 0, 1, false } },
{ Instruction::PUSH4, { "PUSH4", 4, 0, 1 } }, { Instruction::PUSH4, { "PUSH4", 4, 0, 1, false } },
{ Instruction::PUSH5, { "PUSH5", 5, 0, 1 } }, { Instruction::PUSH5, { "PUSH5", 5, 0, 1, false } },
{ Instruction::PUSH6, { "PUSH6", 6, 0, 1 } }, { Instruction::PUSH6, { "PUSH6", 6, 0, 1, false } },
{ Instruction::PUSH7, { "PUSH7", 7, 0, 1 } }, { Instruction::PUSH7, { "PUSH7", 7, 0, 1, false } },
{ Instruction::PUSH8, { "PUSH8", 8, 0, 1 } }, { Instruction::PUSH8, { "PUSH8", 8, 0, 1, false } },
{ Instruction::PUSH9, { "PUSH9", 9, 0, 1 } }, { Instruction::PUSH9, { "PUSH9", 9, 0, 1, false } },
{ Instruction::PUSH10, { "PUSH10", 10, 0, 1 } }, { Instruction::PUSH10, { "PUSH10", 10, 0, 1, false } },
{ Instruction::PUSH11, { "PUSH11", 11, 0, 1 } }, { Instruction::PUSH11, { "PUSH11", 11, 0, 1, false } },
{ Instruction::PUSH12, { "PUSH12", 12, 0, 1 } }, { Instruction::PUSH12, { "PUSH12", 12, 0, 1, false } },
{ Instruction::PUSH13, { "PUSH13", 13, 0, 1 } }, { Instruction::PUSH13, { "PUSH13", 13, 0, 1, false } },
{ Instruction::PUSH14, { "PUSH14", 14, 0, 1 } }, { Instruction::PUSH14, { "PUSH14", 14, 0, 1, false } },
{ Instruction::PUSH15, { "PUSH15", 15, 0, 1 } }, { Instruction::PUSH15, { "PUSH15", 15, 0, 1, false } },
{ Instruction::PUSH16, { "PUSH16", 16, 0, 1 } }, { Instruction::PUSH16, { "PUSH16", 16, 0, 1, false } },
{ Instruction::PUSH17, { "PUSH17", 17, 0, 1 } }, { Instruction::PUSH17, { "PUSH17", 17, 0, 1, false } },
{ Instruction::PUSH18, { "PUSH18", 18, 0, 1 } }, { Instruction::PUSH18, { "PUSH18", 18, 0, 1, false } },
{ Instruction::PUSH19, { "PUSH19", 19, 0, 1 } }, { Instruction::PUSH19, { "PUSH19", 19, 0, 1, false } },
{ Instruction::PUSH20, { "PUSH20", 20, 0, 1 } }, { Instruction::PUSH20, { "PUSH20", 20, 0, 1, false } },
{ Instruction::PUSH21, { "PUSH21", 21, 0, 1 } }, { Instruction::PUSH21, { "PUSH21", 21, 0, 1, false } },
{ Instruction::PUSH22, { "PUSH22", 22, 0, 1 } }, { Instruction::PUSH22, { "PUSH22", 22, 0, 1, false } },
{ Instruction::PUSH23, { "PUSH23", 23, 0, 1 } }, { Instruction::PUSH23, { "PUSH23", 23, 0, 1, false } },
{ Instruction::PUSH24, { "PUSH24", 24, 0, 1 } }, { Instruction::PUSH24, { "PUSH24", 24, 0, 1, false } },
{ Instruction::PUSH25, { "PUSH25", 25, 0, 1 } }, { Instruction::PUSH25, { "PUSH25", 25, 0, 1, false } },
{ Instruction::PUSH26, { "PUSH26", 26, 0, 1 } }, { Instruction::PUSH26, { "PUSH26", 26, 0, 1, false } },
{ Instruction::PUSH27, { "PUSH27", 27, 0, 1 } }, { Instruction::PUSH27, { "PUSH27", 27, 0, 1, false } },
{ Instruction::PUSH28, { "PUSH28", 28, 0, 1 } }, { Instruction::PUSH28, { "PUSH28", 28, 0, 1, false } },
{ Instruction::PUSH29, { "PUSH29", 29, 0, 1 } }, { Instruction::PUSH29, { "PUSH29", 29, 0, 1, false } },
{ Instruction::PUSH30, { "PUSH30", 30, 0, 1 } }, { Instruction::PUSH30, { "PUSH30", 30, 0, 1, false } },
{ Instruction::PUSH31, { "PUSH31", 31, 0, 1 } }, { Instruction::PUSH31, { "PUSH31", 31, 0, 1, false } },
{ Instruction::PUSH32, { "PUSH32", 32, 0, 1 } }, { Instruction::PUSH32, { "PUSH32", 32, 0, 1, false } },
{ Instruction::DUP1, { "DUP1", 0, 1, 2 } }, { Instruction::DUP1, { "DUP1", 0, 1, 2, false } },
{ Instruction::DUP2, { "DUP2", 0, 2, 3 } }, { Instruction::DUP2, { "DUP2", 0, 2, 3, false } },
{ Instruction::DUP3, { "DUP3", 0, 3, 4 } }, { Instruction::DUP3, { "DUP3", 0, 3, 4, false } },
{ Instruction::DUP4, { "DUP4", 0, 4, 5 } }, { Instruction::DUP4, { "DUP4", 0, 4, 5, false } },
{ Instruction::DUP5, { "DUP5", 0, 5, 6 } }, { Instruction::DUP5, { "DUP5", 0, 5, 6, false } },
{ Instruction::DUP6, { "DUP6", 0, 6, 7 } }, { Instruction::DUP6, { "DUP6", 0, 6, 7, false } },
{ Instruction::DUP7, { "DUP7", 0, 7, 8 } }, { Instruction::DUP7, { "DUP7", 0, 7, 8, false } },
{ Instruction::DUP8, { "DUP8", 0, 8, 9 } }, { Instruction::DUP8, { "DUP8", 0, 8, 9, false } },
{ Instruction::DUP9, { "DUP9", 0, 9, 10 } }, { Instruction::DUP9, { "DUP9", 0, 9, 10, false } },
{ Instruction::DUP10, { "DUP10", 0, 10, 11 } }, { Instruction::DUP10, { "DUP10", 0, 10, 11, false } },
{ Instruction::DUP11, { "DUP11", 0, 11, 12 } }, { Instruction::DUP11, { "DUP11", 0, 11, 12, false } },
{ Instruction::DUP12, { "DUP12", 0, 12, 13 } }, { Instruction::DUP12, { "DUP12", 0, 12, 13, false } },
{ Instruction::DUP13, { "DUP13", 0, 13, 14 } }, { Instruction::DUP13, { "DUP13", 0, 13, 14, false } },
{ Instruction::DUP14, { "DUP14", 0, 14, 15 } }, { Instruction::DUP14, { "DUP14", 0, 14, 15, false } },
{ Instruction::DUP15, { "DUP15", 0, 15, 16 } }, { Instruction::DUP15, { "DUP15", 0, 15, 16, false } },
{ Instruction::DUP16, { "DUP16", 0, 16, 17 } }, { Instruction::DUP16, { "DUP16", 0, 16, 17, false } },
{ Instruction::SWAP1, { "SWAP1", 0, 2, 2 } }, { Instruction::SWAP1, { "SWAP1", 0, 2, 2, false } },
{ Instruction::SWAP2, { "SWAP2", 0, 3, 3 } }, { Instruction::SWAP2, { "SWAP2", 0, 3, 3, false } },
{ Instruction::SWAP3, { "SWAP3", 0, 4, 4 } }, { Instruction::SWAP3, { "SWAP3", 0, 4, 4, false } },
{ Instruction::SWAP4, { "SWAP4", 0, 5, 5 } }, { Instruction::SWAP4, { "SWAP4", 0, 5, 5, false } },
{ Instruction::SWAP5, { "SWAP5", 0, 6, 6 } }, { Instruction::SWAP5, { "SWAP5", 0, 6, 6, false } },
{ Instruction::SWAP6, { "SWAP6", 0, 7, 7 } }, { Instruction::SWAP6, { "SWAP6", 0, 7, 7, false } },
{ Instruction::SWAP7, { "SWAP7", 0, 8, 8 } }, { Instruction::SWAP7, { "SWAP7", 0, 8, 8, false } },
{ Instruction::SWAP8, { "SWAP8", 0, 9, 9 } }, { Instruction::SWAP8, { "SWAP8", 0, 9, 9, false } },
{ Instruction::SWAP9, { "SWAP9", 0, 10, 10 } }, { Instruction::SWAP9, { "SWAP9", 0, 10, 10, false } },
{ Instruction::SWAP10, { "SWAP10", 0, 11, 11 } }, { Instruction::SWAP10, { "SWAP10", 0, 11, 11, false } },
{ Instruction::SWAP11, { "SWAP11", 0, 12, 12 } }, { Instruction::SWAP11, { "SWAP11", 0, 12, 12, false } },
{ Instruction::SWAP12, { "SWAP12", 0, 13, 13 } }, { Instruction::SWAP12, { "SWAP12", 0, 13, 13, false } },
{ Instruction::SWAP13, { "SWAP13", 0, 14, 14 } }, { Instruction::SWAP13, { "SWAP13", 0, 14, 14, false } },
{ Instruction::SWAP14, { "SWAP14", 0, 15, 15 } }, { Instruction::SWAP14, { "SWAP14", 0, 15, 15, false } },
{ Instruction::SWAP15, { "SWAP15", 0, 16, 16 } }, { Instruction::SWAP15, { "SWAP15", 0, 16, 16, false } },
{ Instruction::SWAP16, { "SWAP16", 0, 17, 17 } }, { Instruction::SWAP16, { "SWAP16", 0, 17, 17, false } },
{ Instruction::LOG0, { "LOG0", 0, 1, 0 } }, { Instruction::LOG0, { "LOG0", 0, 1, 0, true } },
{ Instruction::LOG1, { "LOG1", 0, 2, 0 } }, { Instruction::LOG1, { "LOG1", 0, 2, 0, true } },
{ Instruction::LOG2, { "LOG2", 0, 3, 0 } }, { Instruction::LOG2, { "LOG2", 0, 3, 0, true } },
{ Instruction::LOG3, { "LOG3", 0, 4, 0 } }, { Instruction::LOG3, { "LOG3", 0, 4, 0, true } },
{ Instruction::LOG4, { "LOG4", 0, 5, 0 } }, { Instruction::LOG4, { "LOG4", 0, 5, 0, true } },
{ Instruction::CREATE, { "CREATE", 0, 3, 1 } }, { Instruction::CREATE, { "CREATE", 0, 3, 1, true } },
{ Instruction::CALL, { "CALL", 0, 7, 1 } }, { Instruction::CALL, { "CALL", 0, 7, 1, true } },
{ Instruction::CALLCODE, { "CALLCODE", 0, 7, 1 } }, { Instruction::CALLCODE, { "CALLCODE", 0, 7, 1, true } },
{ Instruction::RETURN, { "RETURN", 0, 2, 0 } }, { Instruction::RETURN, { "RETURN", 0, 2, 0, true } },
{ Instruction::SUICIDE, { "SUICIDE", 0, 1, 0} } { Instruction::SUICIDE, { "SUICIDE", 0, 1, 0, true } }
}; };
string dev::eth::disassemble(bytes const& _mem) string dev::eth::disassemble(bytes const& _mem)

1
libevmcore/Instruction.h

@ -204,6 +204,7 @@ struct InstructionInfo
int additional; ///< Additional items required in memory for this instructions (only for PUSH). int additional; ///< Additional items required in memory for this instructions (only for PUSH).
int args; ///< Number of items required on the stack for this instruction (and, for the purposes of ret, the number taken from the stack). int args; ///< Number of items required on the stack for this instruction (and, for the purposes of ret, the number taken from the stack).
int ret; ///< Number of items placed (back) on the stack by this instruction, assuming args items were removed. int ret; ///< Number of items placed (back) on the stack by this instruction, assuming args items were removed.
bool sideEffects; ///< false if the only effect on the execution environment (apart from gas usage) is a change to a topmost segment of the stack
}; };
/// Information on all the instructions. /// Information on all the instructions.

80
libjsqrc/main.js

@ -66,86 +66,86 @@
var ethMethods = function () { var ethMethods = function () {
var blockCall = function (args) { var blockCall = function (args) {
return typeof args[0] === "string" ? "blockByHash" : "blockByNumber"; return typeof args[0] === "string" ? "eth_blockByHash" : "eth_blockByNumber";
}; };
var transactionCall = function (args) { var transactionCall = function (args) {
return typeof args[0] === "string" ? 'transactionByHash' : 'transactionByNumber'; return typeof args[0] === "string" ? 'eth_transactionByHash' : 'eth_transactionByNumber';
}; };
var uncleCall = function (args) { var uncleCall = function (args) {
return typeof args[0] === "string" ? 'uncleByHash' : 'uncleByNumber'; return typeof args[0] === "string" ? 'eth_uncleByHash' : 'eth_uncleByNumber';
}; };
var methods = [ var methods = [
{ name: 'balanceAt', call: 'balanceAt' }, { name: 'balanceAt', call: 'eth_balanceAt' },
{ name: 'stateAt', call: 'stateAt' }, { name: 'stateAt', call: 'eth_stateAt' },
{ name: 'countAt', call: 'countAt'}, { name: 'countAt', call: 'eth_countAt'},
{ name: 'codeAt', call: 'codeAt' }, { name: 'codeAt', call: 'eth_codeAt' },
{ name: 'transact', call: 'transact' }, { name: 'transact', call: 'eth_transact' },
{ name: 'call', call: 'call' }, { name: 'call', call: 'eth_call' },
{ name: 'block', call: blockCall }, { name: 'block', call: blockCall },
{ name: 'transaction', call: transactionCall }, { name: 'transaction', call: transactionCall },
{ name: 'uncle', call: uncleCall }, { name: 'uncle', call: uncleCall },
{ name: 'compilers', call: 'compilers' }, { name: 'compilers', call: 'eth_compilers' },
{ name: 'lll', call: 'lll' }, { name: 'lll', call: 'eth_lll' },
{ name: 'solidity', call: 'solidity' }, { name: 'solidity', call: 'eth_solidity' },
{ name: 'contractCreate', call: 'contractCreate' }, { name: 'contractCreate', call: 'eth_contractCreate' },
{ name: 'contractCall', call: 'contractCall' } { name: 'contractCall', call: 'eth_contractCall' }
]; ];
return methods; return methods;
}; };
var ethProperties = function () { var ethProperties = function () {
return [ return [
{ name: 'coinbase', getter: 'coinbase', setter: 'setCoinbase' }, { name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' },
{ name: 'listening', getter: 'listening', setter: 'setListening' }, { name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' },
{ name: 'mining', getter: 'mining', setter: 'setMining' }, { name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' },
{ name: 'gasPrice', getter: 'gasPrice' }, { name: 'gasPrice', getter: 'eth_gasPrice' },
{ name: 'account', getter: 'account' }, { name: 'account', getter: 'eth_account' },
{ name: 'accounts', getter: 'accounts' }, { name: 'accounts', getter: 'eth_accounts' },
{ name: 'peerCount', getter: 'peerCount' }, { name: 'peerCount', getter: 'eth_peerCount' },
{ name: 'defaultBlock', getter: 'defaultBlock', setter: 'setDefaultBlock' }, { name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' },
{ name: 'number', getter: 'number'} { name: 'number', getter: 'eth_number'}
]; ];
}; };
var dbMethods = function () { var dbMethods = function () {
return [ return [
{ name: 'put', call: 'put' }, { name: 'put', call: 'db_put' },
{ name: 'get', call: 'get' }, { name: 'get', call: 'db_get' },
{ name: 'putString', call: 'putString' }, { name: 'putString', call: 'db_putString' },
{ name: 'getString', call: 'getString' } { name: 'getString', call: 'db_getString' }
]; ];
}; };
var shhMethods = function () { var shhMethods = function () {
return [ return [
{ name: 'post', call: 'post' }, { name: 'post', call: 'shh_post' },
{ name: 'newIdentity', call: 'newIdentity' }, { name: 'newIdentity', call: 'shh_newIdentity' },
{ name: 'haveIdentity', call: 'haveIdentity' }, { name: 'haveIdentity', call: 'shh_haveIdentity' },
{ name: 'newGroup', call: 'newGroup' }, { name: 'newGroup', call: 'shh_newGroup' },
{ name: 'addToGroup', call: 'addToGroup' } { name: 'addToGroup', call: 'shh_addToGroup' }
]; ];
}; };
var ethWatchMethods = function () { var ethWatchMethods = function () {
var newFilter = function (args) { var newFilter = function (args) {
return typeof args[0] === 'string' ? 'newFilterString' : 'newFilter'; return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter';
}; };
return [ return [
{ name: 'newFilter', call: newFilter }, { name: 'newFilter', call: newFilter },
{ name: 'uninstallFilter', call: 'uninstallFilter' }, { name: 'uninstallFilter', call: 'eth_uninstallFilter' },
{ name: 'getMessages', call: 'getMessages' } { name: 'getMessages', call: 'eth_getMessages' }
]; ];
}; };
var shhWatchMethods = function () { var shhWatchMethods = function () {
return [ return [
{ name: 'newFilter', call: 'shhNewFilter' }, { name: 'newFilter', call: 'shh_newFilter' },
{ name: 'uninstallFilter', call: 'shhUninstallFilter' }, { name: 'uninstallFilter', call: 'shh_uninstallFilter' },
{ name: 'getMessage', call: 'shhGetMessages' } { name: 'getMessage', call: 'shh_getMessages' }
]; ];
}; };
@ -303,11 +303,11 @@
setupMethods(web3.shh, shhMethods()); setupMethods(web3.shh, shhMethods());
var ethWatch = { var ethWatch = {
changed: 'changed' changed: 'eth_changed'
}; };
setupMethods(ethWatch, ethWatchMethods()); setupMethods(ethWatch, ethWatchMethods());
var shhWatch = { var shhWatch = {
changed: 'shhChanged' changed: 'shh_changed'
}; };
setupMethods(shhWatch, shhWatchMethods()); setupMethods(shhWatch, shhWatchMethods());

2
libjsqrc/setup.js

@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** @file QEthereum.cpp /** @file setup.js
* @authors: * @authors:
* Marek Kotewicz <marek@ethdev.com> * Marek Kotewicz <marek@ethdev.com>
* @date 2014 * @date 2014

29
libqethereum/QEthereum.cpp

@ -59,13 +59,13 @@ void QWebThree::poll()
{ {
if (m_watches.size() > 0) if (m_watches.size() > 0)
{ {
QString batch = toJsonRpcBatch(m_watches, "changed"); QString batch = toJsonRpcBatch(m_watches, "eth_changed");
emit processData(batch, "changed"); emit processData(batch, "eth_changed");
} }
if (m_shhWatches.size() > 0) if (m_shhWatches.size() > 0)
{ {
QString batch = toJsonRpcBatch(m_shhWatches, "shhChanged"); QString batch = toJsonRpcBatch(m_shhWatches, "shh_changed");
emit processData(batch, "shhChanged"); emit processData(batch, "shh_changed");
} }
} }
@ -73,13 +73,13 @@ void QWebThree::clearWatches()
{ {
if (m_watches.size() > 0) if (m_watches.size() > 0)
{ {
QString batch = toJsonRpcBatch(m_watches, "uninstallFilter"); QString batch = toJsonRpcBatch(m_watches, "eth_uninstallFilter");
m_watches.clear(); m_watches.clear();
emit processData(batch, "internal"); emit processData(batch, "internal");
} }
if (m_shhWatches.size() > 0) if (m_shhWatches.size() > 0)
{ {
QString batch = toJsonRpcBatch(m_shhWatches, "shhUninstallFilter"); QString batch = toJsonRpcBatch(m_shhWatches, "shh_uninstallFilter");
m_shhWatches.clear(); m_shhWatches.clear();
emit processData(batch, "internal"); emit processData(batch, "internal");
} }
@ -106,7 +106,12 @@ void QWebThree::postMessage(QString _json)
QJsonObject f = QJsonDocument::fromJson(_json.toUtf8()).object(); QJsonObject f = QJsonDocument::fromJson(_json.toUtf8()).object();
QString method = f["call"].toString(); QString method = f["call"].toString();
if (!method.compare("uninstallFilter") && f["args"].isArray() && f["args"].toArray().size()) if (!method.compare("eth_uninstallFilter") && f["args"].isArray() && f["args"].toArray().size())
{
int idToRemove = f["args"].toArray()[0].toInt();
m_watches.erase(std::remove(m_watches.begin(), m_watches.end(), idToRemove), m_watches.end());
}
else if (!method.compare("eth_uninstallFilter") && f["args"].isArray() && f["args"].toArray().size())
{ {
int idToRemove = f["args"].toArray()[0].toInt(); int idToRemove = f["args"].toArray()[0].toInt();
m_watches.erase(std::remove(m_watches.begin(), m_watches.end(), idToRemove), m_watches.end()); m_watches.erase(std::remove(m_watches.begin(), m_watches.end(), idToRemove), m_watches.end());
@ -129,7 +134,7 @@ void QWebThree::onDataProcessed(QString _json, QString _addInfo)
if (!_addInfo.compare("internal")) if (!_addInfo.compare("internal"))
return; return;
if (!_addInfo.compare("changed")) if (!_addInfo.compare("eth_changed"))
{ {
QJsonArray resultsArray = QJsonDocument::fromJson(_json.toUtf8()).array(); QJsonArray resultsArray = QJsonDocument::fromJson(_json.toUtf8()).array();
for (int i = 0; i < resultsArray.size(); i++) for (int i = 0; i < resultsArray.size(); i++)
@ -146,7 +151,7 @@ void QWebThree::onDataProcessed(QString _json, QString _addInfo)
return; return;
} }
if (!_addInfo.compare("shhChanged")) if (!_addInfo.compare("shh_changed"))
{ {
QJsonArray resultsArray = QJsonDocument::fromJson(_json.toUtf8()).array(); QJsonArray resultsArray = QJsonDocument::fromJson(_json.toUtf8()).array();
for (int i = 0; i < resultsArray.size(); i++) for (int i = 0; i < resultsArray.size(); i++)
@ -165,11 +170,11 @@ void QWebThree::onDataProcessed(QString _json, QString _addInfo)
QJsonObject f = QJsonDocument::fromJson(_json.toUtf8()).object(); QJsonObject f = QJsonDocument::fromJson(_json.toUtf8()).object();
if ((!_addInfo.compare("newFilter") || !_addInfo.compare("newFilterString")) && f.contains("result")) if ((!_addInfo.compare("eth_newFilter") || !_addInfo.compare("eth_newFilterString")) && f.contains("result"))
m_watches.push_back(f["result"].toInt()); m_watches.push_back(f["result"].toInt());
if (!_addInfo.compare("shhNewFilter") && f.contains("result")) else if (!_addInfo.compare("shh_newFilter") && f.contains("result"))
m_shhWatches.push_back(f["result"].toInt()); m_shhWatches.push_back(f["result"].toInt());
if (!_addInfo.compare("newIdentity") && f.contains("result")) else if (!_addInfo.compare("shh_newIdentity") && f.contains("result"))
emit onNewId(f["result"].toString()); emit onNewId(f["result"].toString());
response(formatOutput(f)); response(formatOutput(f));

9
libsolidity/Compiler.cpp

@ -32,11 +32,11 @@ using namespace std;
namespace dev { namespace dev {
namespace solidity { namespace solidity {
bytes Compiler::compile(ContractDefinition& _contract) bytes Compiler::compile(ContractDefinition& _contract, bool _optimize)
{ {
Compiler compiler; Compiler compiler;
compiler.compileContract(_contract); compiler.compileContract(_contract);
return compiler.m_context.getAssembledBytecode(); return compiler.m_context.getAssembledBytecode(_optimize);
} }
void Compiler::compileContract(ContractDefinition& _contract) void Compiler::compileContract(ContractDefinition& _contract)
@ -93,10 +93,11 @@ void Compiler::appendFunctionSelector(vector<ASTPointer<FunctionDefinition>> con
eth::AssemblyItem jumpTableStart = m_context.pushNewTag(); eth::AssemblyItem jumpTableStart = m_context.pushNewTag();
m_context << eth::Instruction::ADD << eth::Instruction::JUMP; m_context << eth::Instruction::ADD << eth::Instruction::JUMP;
// jump table @todo it could be that the optimizer destroys this // jump table, tell the optimizer not to remove the JUMPDESTs
m_context << jumpTableStart; m_context << eth::AssemblyItem(eth::NoOptimizeBegin) << jumpTableStart;
for (pair<string, pair<FunctionDefinition const*, eth::AssemblyItem>> const& f: publicFunctions) for (pair<string, pair<FunctionDefinition const*, eth::AssemblyItem>> const& f: publicFunctions)
m_context.appendJumpTo(f.second.second) << eth::Instruction::JUMPDEST; m_context.appendJumpTo(f.second.second) << eth::Instruction::JUMPDEST;
m_context << eth::AssemblyItem(eth::NoOptimizeEnd);
m_context << returnTag << eth::Instruction::STOP; m_context << returnTag << eth::Instruction::STOP;

4
libsolidity/Compiler.h

@ -33,11 +33,11 @@ public:
Compiler(): m_returnTag(m_context.newTag()) {} Compiler(): m_returnTag(m_context.newTag()) {}
void compileContract(ContractDefinition& _contract); void compileContract(ContractDefinition& _contract);
bytes getAssembledBytecode() { return m_context.getAssembledBytecode(); } bytes getAssembledBytecode(bool _optimize = false) { return m_context.getAssembledBytecode(_optimize); }
void streamAssembly(std::ostream& _stream) const { m_context.streamAssembly(_stream); } void streamAssembly(std::ostream& _stream) const { m_context.streamAssembly(_stream); }
/// Compile the given contract and return the EVM bytecode. /// Compile the given contract and return the EVM bytecode.
static bytes compile(ContractDefinition& _contract); static bytes compile(ContractDefinition& _contract, bool _optimize);
private: private:
/// Creates a new compiler context / assembly and packs the current code into the data part. /// Creates a new compiler context / assembly and packs the current code into the data part.

2
libsolidity/CompilerContext.h

@ -84,7 +84,7 @@ public:
eth::Assembly const& getAssembly() const { return m_asm; } eth::Assembly const& getAssembly() const { return m_asm; }
void streamAssembly(std::ostream& _stream) const { _stream << m_asm; } void streamAssembly(std::ostream& _stream) const { _stream << m_asm; }
bytes getAssembledBytecode() const { return m_asm.assemble(); } bytes getAssembledBytecode(bool _optimize = false) { return m_asm.optimise(_optimize).assemble(); }
private: private:
eth::Assembly m_asm; eth::Assembly m_asm;

5
libsolidity/CompilerStack.cpp

@ -34,7 +34,8 @@ namespace dev
namespace solidity namespace solidity
{ {
bytes CompilerStack::compile(std::string const& _sourceCode, shared_ptr<Scanner> _scanner) bytes CompilerStack::compile(std::string const& _sourceCode, shared_ptr<Scanner> _scanner,
bool _optimize)
{ {
if (!_scanner) if (!_scanner)
_scanner = make_shared<Scanner>(); _scanner = make_shared<Scanner>();
@ -42,7 +43,7 @@ bytes CompilerStack::compile(std::string const& _sourceCode, shared_ptr<Scanner>
ASTPointer<ContractDefinition> contract = Parser().parse(_scanner); ASTPointer<ContractDefinition> contract = Parser().parse(_scanner);
NameAndTypeResolver().resolveNamesAndTypes(*contract); NameAndTypeResolver().resolveNamesAndTypes(*contract);
return Compiler::compile(*contract); return Compiler::compile(*contract, _optimize);
} }
} }

2
libsolidity/CompilerStack.h

@ -36,7 +36,7 @@ class CompilerStack
public: public:
/// Compile the given @a _sourceCode to bytecode. If a scanner is provided, it is used for /// Compile the given @a _sourceCode to bytecode. If a scanner is provided, it is used for
/// scanning the source code - this is useful for printing exception information. /// scanning the source code - this is useful for printing exception information.
static bytes compile(std::string const& _sourceCode, std::shared_ptr<Scanner> _scanner = std::shared_ptr<Scanner>()); static bytes compile(std::string const& _sourceCode, std::shared_ptr<Scanner> _scanner = std::shared_ptr<Scanner>(), bool _optimize = false);
}; };
} }

94
libweb3jsonrpc/WebThreeStubServer.cpp

@ -196,9 +196,11 @@ static dev::eth::MessageFilter toMessageFilter(Json::Value const& _json)
if (!_json["topics"].empty()) if (!_json["topics"].empty())
{ {
if (_json["topics"].isArray()) if (_json["topics"].isArray())
{
for (auto i: _json["topics"]) for (auto i: _json["topics"])
if (i.isString()) if (i.isString())
filter.topic(jsToU256(i.asString())); filter.topic(jsToU256(i.asString()));
}
else if(_json["topics"].isString()) else if(_json["topics"].isString())
filter.topic(jsToU256(_json["topics"].asString())); filter.topic(jsToU256(_json["topics"].asString()));
} }
@ -315,7 +317,7 @@ std::shared_ptr<dev::shh::Interface> WebThreeStubServer::face() const
return m_web3.whisper(); return m_web3.whisper();
} }
Json::Value WebThreeStubServer::accounts() Json::Value WebThreeStubServer::eth_accounts()
{ {
Json::Value ret(Json::arrayValue); Json::Value ret(Json::arrayValue);
for (auto i: m_accounts) for (auto i: m_accounts)
@ -323,27 +325,27 @@ Json::Value WebThreeStubServer::accounts()
return ret; return ret;
} }
std::string WebThreeStubServer::addToGroup(std::string const& _group, std::string const& _who) std::string WebThreeStubServer::shh_addToGroup(std::string const& _group, std::string const& _who)
{ {
(void)_group; (void)_group;
(void)_who; (void)_who;
return ""; return "";
} }
std::string WebThreeStubServer::balanceAt(string const& _address) std::string WebThreeStubServer::eth_balanceAt(string const& _address)
{ {
int block = 0; int block = 0;
return toJS(client()->balanceAt(jsToAddress(_address), block)); return toJS(client()->balanceAt(jsToAddress(_address), block));
} }
Json::Value WebThreeStubServer::blockByHash(std::string const& _hash) Json::Value WebThreeStubServer::eth_blockByHash(std::string const& _hash)
{ {
if (!client()) if (!client())
return ""; return "";
return toJson(client()->blockInfo(jsToFixed<32>(_hash))); return toJson(client()->blockInfo(jsToFixed<32>(_hash)));
} }
Json::Value WebThreeStubServer::blockByNumber(int const& _number) Json::Value WebThreeStubServer::eth_blockByNumber(int const& _number)
{ {
if (!client()) if (!client())
return ""; return "";
@ -386,7 +388,7 @@ static TransactionSkeleton toTransaction(Json::Value const& _json)
return ret; return ret;
} }
std::string WebThreeStubServer::call(Json::Value const& _json) std::string WebThreeStubServer::eth_call(Json::Value const& _json)
{ {
std::string ret; std::string ret;
if (!client()) if (!client())
@ -410,41 +412,41 @@ std::string WebThreeStubServer::call(Json::Value const& _json)
return ret; return ret;
} }
bool WebThreeStubServer::changed(int const& _id) bool WebThreeStubServer::eth_changed(int const& _id)
{ {
if (!client()) if (!client())
return false; return false;
return client()->checkWatch(_id); return client()->checkWatch(_id);
} }
std::string WebThreeStubServer::codeAt(string const& _address) std::string WebThreeStubServer::eth_codeAt(string const& _address)
{ {
int block = 0; int block = 0;
return client() ? jsFromBinary(client()->codeAt(jsToAddress(_address), block)) : ""; return client() ? jsFromBinary(client()->codeAt(jsToAddress(_address), block)) : "";
} }
std::string WebThreeStubServer::coinbase() std::string WebThreeStubServer::eth_coinbase()
{ {
return client() ? toJS(client()->address()) : ""; return client() ? toJS(client()->address()) : "";
} }
double WebThreeStubServer::countAt(string const& _address) double WebThreeStubServer::eth_countAt(string const& _address)
{ {
int block = 0; int block = 0;
return client() ? (double)(uint64_t)client()->countAt(jsToAddress(_address), block) : 0; return client() ? (double)(uint64_t)client()->countAt(jsToAddress(_address), block) : 0;
} }
int WebThreeStubServer::defaultBlock() int WebThreeStubServer::eth_defaultBlock()
{ {
return client() ? client()->getDefault() : 0; return client() ? client()->getDefault() : 0;
} }
std::string WebThreeStubServer::gasPrice() std::string WebThreeStubServer::eth_gasPrice()
{ {
return toJS(10 * dev::eth::szabo); return toJS(10 * dev::eth::szabo);
} }
std::string WebThreeStubServer::get(std::string const& _name, std::string const& _key) std::string WebThreeStubServer::db_get(std::string const& _name, std::string const& _key)
{ {
bytes k = sha3(_name).asBytes() + sha3(_key).asBytes(); bytes k = sha3(_name).asBytes() + sha3(_key).asBytes();
string ret; string ret;
@ -452,14 +454,14 @@ std::string WebThreeStubServer::get(std::string const& _name, std::string const&
return toJS(dev::asBytes(ret)); return toJS(dev::asBytes(ret));
} }
Json::Value WebThreeStubServer::getMessages(int const& _id) Json::Value WebThreeStubServer::eth_getMessages(int const& _id)
{ {
if (!client()) if (!client())
return Json::Value(); return Json::Value();
return toJson(client()->messages(_id)); return toJson(client()->messages(_id));
} }
std::string WebThreeStubServer::getString(std::string const& _name, std::string const& _key) std::string WebThreeStubServer::db_getString(std::string const& _name, std::string const& _key)
{ {
bytes k = sha3(_name).asBytes() + sha3(_key).asBytes(); bytes k = sha3(_name).asBytes() + sha3(_key).asBytes();
string ret; string ret;
@ -467,22 +469,22 @@ std::string WebThreeStubServer::getString(std::string const& _name, std::string
return ret; return ret;
} }
bool WebThreeStubServer::haveIdentity(std::string const& _id) bool WebThreeStubServer::shh_haveIdentity(std::string const& _id)
{ {
return m_ids.count(jsToPublic(_id)) > 0; return m_ids.count(jsToPublic(_id)) > 0;
} }
bool WebThreeStubServer::listening() bool WebThreeStubServer::eth_listening()
{ {
return m_web3.isNetworkStarted(); return m_web3.isNetworkStarted();
} }
bool WebThreeStubServer::mining() bool WebThreeStubServer::eth_mining()
{ {
return client() ? client()->isMining() : false; return client() ? client()->isMining() : false;
} }
int WebThreeStubServer::newFilter(Json::Value const& _json) int WebThreeStubServer::eth_newFilter(Json::Value const& _json)
{ {
unsigned ret = -1; unsigned ret = -1;
if (!client()) if (!client())
@ -491,7 +493,7 @@ int WebThreeStubServer::newFilter(Json::Value const& _json)
return ret; return ret;
} }
int WebThreeStubServer::newFilterString(std::string const& _filter) int WebThreeStubServer::eth_newFilterString(std::string const& _filter)
{ {
unsigned ret = -1; unsigned ret = -1;
if (!client()) if (!client())
@ -503,14 +505,14 @@ int WebThreeStubServer::newFilterString(std::string const& _filter)
return ret; return ret;
} }
std::string WebThreeStubServer::newGroup(std::string const& _id, std::string const& _who) std::string WebThreeStubServer::shh_newGroup(std::string const& _id, std::string const& _who)
{ {
(void)_id; (void)_id;
(void)_who; (void)_who;
return ""; return "";
} }
std::string WebThreeStubServer::newIdentity() std::string WebThreeStubServer::shh_newIdentity()
{ {
cnote << this << m_ids; cnote << this << m_ids;
KeyPair kp = KeyPair::create(); KeyPair kp = KeyPair::create();
@ -518,7 +520,7 @@ std::string WebThreeStubServer::newIdentity()
return toJS(kp.pub()); return toJS(kp.pub());
} }
Json::Value WebThreeStubServer::compilers() Json::Value WebThreeStubServer::eth_compilers()
{ {
Json::Value ret(Json::arrayValue); Json::Value ret(Json::arrayValue);
ret.append("lll"); ret.append("lll");
@ -538,7 +540,7 @@ static bytes paramsToBytes(Json::Value const& _params)
return data; return data;
} }
std::string WebThreeStubServer::contractCall(std::string const& _address, std::string const& _value, Json::Value const& _params) std::string WebThreeStubServer::eth_contractCall(std::string const& _address, std::string const& _value, Json::Value const& _params)
{ {
auto from = m_accounts.begin()->first; auto from = m_accounts.begin()->first;
for (auto a: m_accounts) for (auto a: m_accounts)
@ -553,7 +555,7 @@ std::string WebThreeStubServer::contractCall(std::string const& _address, std::s
return toJS(client()->call(m_accounts[from].secret(), jsToU256(_value), jsToAddress(_address), paramsToBytes(_params), gas, gasPrice)); return toJS(client()->call(m_accounts[from].secret(), jsToU256(_value), jsToAddress(_address), paramsToBytes(_params), gas, gasPrice));
} }
std::string WebThreeStubServer::contractCreate(std::string const& _bytecode, std::string const& _value) std::string WebThreeStubServer::eth_contractCreate(std::string const& _bytecode, std::string const& _value)
{ {
auto from = m_accounts.begin()->first; auto from = m_accounts.begin()->first;
for (auto a: m_accounts) for (auto a: m_accounts)
@ -567,28 +569,28 @@ std::string WebThreeStubServer::contractCreate(std::string const& _bytecode, std
return toJS(client()->transact(m_accounts[from].secret(), jsToU256(_value), jsToBytes(_bytecode), gas, gasPrice)); return toJS(client()->transact(m_accounts[from].secret(), jsToU256(_value), jsToBytes(_bytecode), gas, gasPrice));
} }
std::string WebThreeStubServer::lll(std::string const& _code) std::string WebThreeStubServer::eth_lll(std::string const& _code)
{ {
return toJS(dev::eth::compileLLL(_code)); return toJS(dev::eth::compileLLL(_code));
} }
std::string WebThreeStubServer::solidity(std::string const& _code) std::string WebThreeStubServer::eth_solidity(std::string const& _code)
{ {
shared_ptr<dev::solidity::Scanner> scanner = make_shared<dev::solidity::Scanner>(); shared_ptr<dev::solidity::Scanner> scanner = make_shared<dev::solidity::Scanner>();
return toJS(dev::solidity::CompilerStack::compile(_code, scanner)); return toJS(dev::solidity::CompilerStack::compile(_code, scanner));
} }
int WebThreeStubServer::number() int WebThreeStubServer::eth_number()
{ {
return client() ? client()->number() + 1 : 0; return client() ? client()->number() + 1 : 0;
} }
int WebThreeStubServer::peerCount() int WebThreeStubServer::eth_peerCount()
{ {
return m_web3.peerCount(); return m_web3.peerCount();
} }
bool WebThreeStubServer::post(Json::Value const& _json) bool WebThreeStubServer::shh_post(Json::Value const& _json)
{ {
cnote << this << m_ids; cnote << this << m_ids;
shh::Message m = toMessage(_json); shh::Message m = toMessage(_json);
@ -605,7 +607,7 @@ bool WebThreeStubServer::post(Json::Value const& _json)
return true; return true;
} }
bool WebThreeStubServer::put(std::string const& _name, std::string const& _key, std::string const& _value) bool WebThreeStubServer::db_put(std::string const& _name, std::string const& _key, std::string const& _value)
{ {
bytes k = sha3(_name).asBytes() + sha3(_key).asBytes(); bytes k = sha3(_name).asBytes() + sha3(_key).asBytes();
bytes v = jsToBytes(_value); bytes v = jsToBytes(_value);
@ -613,7 +615,7 @@ bool WebThreeStubServer::put(std::string const& _name, std::string const& _key,
return true; return true;
} }
bool WebThreeStubServer::putString(std::string const& _name, std::string const& _key, std::string const& _value) bool WebThreeStubServer::db_putString(std::string const& _name, std::string const& _key, std::string const& _value)
{ {
bytes k = sha3(_name).asBytes() + sha3(_key).asBytes(); bytes k = sha3(_name).asBytes() + sha3(_key).asBytes();
string v = _value; string v = _value;
@ -621,7 +623,7 @@ bool WebThreeStubServer::putString(std::string const& _name, std::string const&
return true; return true;
} }
bool WebThreeStubServer::setCoinbase(std::string const& _address) bool WebThreeStubServer::eth_setCoinbase(std::string const& _address)
{ {
if (!client()) if (!client())
return false; return false;
@ -629,7 +631,7 @@ bool WebThreeStubServer::setCoinbase(std::string const& _address)
return true; return true;
} }
bool WebThreeStubServer::setDefaultBlock(int const& _block) bool WebThreeStubServer::eth_setDefaultBlock(int const& _block)
{ {
if (!client()) if (!client())
return false; return false;
@ -637,7 +639,7 @@ bool WebThreeStubServer::setDefaultBlock(int const& _block)
return true; return true;
} }
bool WebThreeStubServer::setListening(bool const& _listening) bool WebThreeStubServer::eth_setListening(bool const& _listening)
{ {
if (_listening) if (_listening)
m_web3.startNetwork(); m_web3.startNetwork();
@ -646,7 +648,7 @@ bool WebThreeStubServer::setListening(bool const& _listening)
return true; return true;
} }
bool WebThreeStubServer::setMining(bool const& _mining) bool WebThreeStubServer::eth_setMining(bool const& _mining)
{ {
if (!client()) if (!client())
return false; return false;
@ -658,7 +660,7 @@ bool WebThreeStubServer::setMining(bool const& _mining)
return true; return true;
} }
Json::Value WebThreeStubServer::shhChanged(int const& _id) Json::Value WebThreeStubServer::shh_changed(int const& _id)
{ {
Json::Value ret(Json::arrayValue); Json::Value ret(Json::arrayValue);
auto pub = m_shhWatches[_id]; auto pub = m_shhWatches[_id];
@ -682,7 +684,7 @@ Json::Value WebThreeStubServer::shhChanged(int const& _id)
return ret; return ret;
} }
int WebThreeStubServer::shhNewFilter(Json::Value const& _json) int WebThreeStubServer::shh_newFilter(Json::Value const& _json)
{ {
auto w = toWatch(_json); auto w = toWatch(_json);
auto ret = face()->installWatch(w.first); auto ret = face()->installWatch(w.first);
@ -690,19 +692,19 @@ int WebThreeStubServer::shhNewFilter(Json::Value const& _json)
return ret; return ret;
} }
bool WebThreeStubServer::shhUninstallFilter(int const& _id) bool WebThreeStubServer::shh_uninstallFilter(int const& _id)
{ {
face()->uninstallWatch(_id); face()->uninstallWatch(_id);
return true; return true;
} }
std::string WebThreeStubServer::stateAt(string const& _address, string const& _storage) std::string WebThreeStubServer::eth_stateAt(string const& _address, string const& _storage)
{ {
int block = 0; int block = 0;
return client() ? toJS(client()->stateAt(jsToAddress(_address), jsToU256(_storage), block)) : ""; return client() ? toJS(client()->stateAt(jsToAddress(_address), jsToU256(_storage), block)) : "";
} }
std::string WebThreeStubServer::transact(Json::Value const& _json) std::string WebThreeStubServer::eth_transact(Json::Value const& _json)
{ {
std::string ret; std::string ret;
if (!client()) if (!client())
@ -732,35 +734,35 @@ std::string WebThreeStubServer::transact(Json::Value const& _json)
return ret; return ret;
} }
Json::Value WebThreeStubServer::transactionByHash(std::string const& _hash, int const& _i) Json::Value WebThreeStubServer::eth_transactionByHash(std::string const& _hash, int const& _i)
{ {
if (!client()) if (!client())
return ""; return "";
return toJson(client()->transaction(jsToFixed<32>(_hash), _i)); return toJson(client()->transaction(jsToFixed<32>(_hash), _i));
} }
Json::Value WebThreeStubServer::transactionByNumber(int const& _number, int const& _i) Json::Value WebThreeStubServer::eth_transactionByNumber(int const& _number, int const& _i)
{ {
if (!client()) if (!client())
return ""; return "";
return toJson(client()->transaction(client()->hashFromNumber(_number), _i)); return toJson(client()->transaction(client()->hashFromNumber(_number), _i));
} }
Json::Value WebThreeStubServer::uncleByHash(std::string const& _hash, int const& _i) Json::Value WebThreeStubServer::eth_uncleByHash(std::string const& _hash, int const& _i)
{ {
if (!client()) if (!client())
return ""; return "";
return toJson(client()->uncle(jsToFixed<32>(_hash), _i)); return toJson(client()->uncle(jsToFixed<32>(_hash), _i));
} }
Json::Value WebThreeStubServer::uncleByNumber(int const& _number, int const& _i) Json::Value WebThreeStubServer::eth_uncleByNumber(int const& _number, int const& _i)
{ {
if (!client()) if (!client())
return ""; return "";
return toJson(client()->uncle(client()->hashFromNumber(_number), _i)); return toJson(client()->uncle(client()->hashFromNumber(_number), _i));
} }
bool WebThreeStubServer::uninstallFilter(int const& _id) bool WebThreeStubServer::eth_uninstallFilter(int const& _id)
{ {
if (!client()) if (!client())
return false; return false;

96
libweb3jsonrpc/WebThreeStubServer.h

@ -64,53 +64,55 @@ class WebThreeStubServer: public AbstractWebThreeStubServer
public: public:
WebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, dev::WebThreeDirect& _web3, std::vector<dev::KeyPair> const& _accounts); WebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, dev::WebThreeDirect& _web3, std::vector<dev::KeyPair> const& _accounts);
virtual Json::Value accounts(); virtual Json::Value eth_accounts();
virtual std::string addToGroup(std::string const& _group, std::string const& _who); virtual std::string eth_balanceAt(std::string const& _address);
virtual std::string balanceAt(std::string const& _address); virtual Json::Value eth_blockByHash(std::string const& _hash);
virtual Json::Value blockByHash(std::string const& _hash); virtual Json::Value eth_blockByNumber(int const& _number);
virtual Json::Value blockByNumber(int const& _number); virtual std::string eth_call(Json::Value const& _json);
virtual std::string call(Json::Value const& _json); virtual bool eth_changed(int const& _id);
virtual bool changed(int const& _id); virtual std::string eth_codeAt(std::string const& _address);
virtual std::string codeAt(std::string const& _address); virtual std::string eth_coinbase();
virtual std::string coinbase(); virtual Json::Value eth_compilers();
virtual Json::Value compilers(); virtual std::string eth_contractCall(std::string const& _address, std::string const& _value, Json::Value const& _params);
virtual std::string contractCall(std::string const& _address, std::string const& _value, Json::Value const& _params); virtual std::string eth_contractCreate(std::string const& _bytecode, std::string const& _value);
virtual std::string contractCreate(std::string const& _bytecode, std::string const& _value); virtual double eth_countAt(std::string const& _address);
virtual double countAt(std::string const& _address); virtual int eth_defaultBlock();
virtual int defaultBlock(); virtual std::string eth_gasPrice();
virtual std::string gasPrice(); virtual Json::Value eth_getMessages(int const& _id);
virtual std::string get(std::string const& _name, std::string const& _key); virtual bool eth_listening();
virtual Json::Value getMessages(int const& _id); virtual bool eth_mining();
virtual std::string getString(std::string const& _name, std::string const& _key); virtual int eth_newFilter(Json::Value const& _json);
virtual bool haveIdentity(std::string const& _id); virtual int eth_newFilterString(std::string const& _filter);
virtual bool listening(); virtual int eth_number();
virtual std::string lll(std::string const& _code); virtual int eth_peerCount();
virtual bool mining(); virtual bool eth_setCoinbase(std::string const& _address);
virtual int newFilter(Json::Value const& _json); virtual bool eth_setDefaultBlock(int const& _block);
virtual int newFilterString(std::string const& _filter); virtual bool eth_setListening(bool const& _listening);
virtual std::string newGroup(std::string const& _id, std::string const& _who); virtual std::string eth_lll(std::string const& _s);
virtual std::string newIdentity(); virtual bool eth_setMining(bool const& _mining);
virtual int number(); virtual std::string eth_solidity(std::string const& _code);
virtual int peerCount(); virtual std::string eth_stateAt(std::string const& _address, std::string const& _storage);
virtual bool post(Json::Value const& _json); virtual std::string eth_transact(Json::Value const& _json);
virtual bool put(std::string const& _name, std::string const& _key, std::string const& _value); virtual Json::Value eth_transactionByHash(std::string const& _hash, int const& _i);
virtual bool putString(std::string const& _name, std::string const& _key, std::string const& _value); virtual Json::Value eth_transactionByNumber(int const& _number, int const& _i);
virtual bool setCoinbase(std::string const& _address); virtual Json::Value eth_uncleByHash(std::string const& _hash, int const& _i);
virtual bool setDefaultBlock(int const& _block); virtual Json::Value eth_uncleByNumber(int const& _number, int const& _i);
virtual bool setListening(bool const& _listening); virtual bool eth_uninstallFilter(int const& _id);
virtual bool setMining(bool const& _mining);
virtual Json::Value shhChanged(int const& _id); virtual std::string db_get(std::string const& _name, std::string const& _key);
virtual int shhNewFilter(Json::Value const& _json); virtual std::string db_getString(std::string const& _name, std::string const& _key);
virtual bool shhUninstallFilter(int const& _id); virtual bool db_put(std::string const& _name, std::string const& _key, std::string const& _value);
virtual std::string solidity(std::string const& _code); virtual bool db_putString(std::string const& _name, std::string const& _key, std::string const& _value);
virtual std::string stateAt(std::string const& _address, std::string const& _storage);
virtual std::string transact(Json::Value const& _json); virtual std::string shh_addToGroup(std::string const& _group, std::string const& _who);
virtual Json::Value transactionByHash(std::string const& _hash, int const& _i); virtual Json::Value shh_changed(int const& _id);
virtual Json::Value transactionByNumber(int const& _number, int const& _i); virtual bool shh_haveIdentity(std::string const& _id);
virtual Json::Value uncleByHash(std::string const& _hash, int const& _i); virtual int shh_newFilter(Json::Value const& _json);
virtual Json::Value uncleByNumber(int const& _number, int const& _i); virtual std::string shh_newGroup(std::string const& _id, std::string const& _who);
virtual bool uninstallFilter(int const& _id); virtual std::string shh_newIdentity();
virtual bool shh_post(Json::Value const& _json);
virtual bool shh_uninstallFilter(int const& _id);
void setAccounts(std::vector<dev::KeyPair> const& _accounts); void setAccounts(std::vector<dev::KeyPair> const& _accounts);
void setIdentities(std::vector<dev::KeyPair> const& _ids); void setIdentities(std::vector<dev::KeyPair> const& _ids);
std::map<dev::Public, dev::Secret> const& ids() const { return m_ids; } std::map<dev::Public, dev::Secret> const& ids() const { return m_ids; }

368
libweb3jsonrpc/abstractwebthreestubserver.h

@ -13,332 +13,332 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer<AbstractWebThr
AbstractWebThreeStubServer(jsonrpc::AbstractServerConnector* conn) : AbstractWebThreeStubServer(jsonrpc::AbstractServerConnector* conn) :
jsonrpc::AbstractServer<AbstractWebThreeStubServer>(conn) jsonrpc::AbstractServer<AbstractWebThreeStubServer>(conn)
{ {
this->bindAndAddMethod(new jsonrpc::Procedure("accounts", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::accountsI); this->bindAndAddMethod(new jsonrpc::Procedure("db_get", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::db_getI);
this->bindAndAddMethod(new jsonrpc::Procedure("addToGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::addToGroupI); this->bindAndAddMethod(new jsonrpc::Procedure("db_getString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::db_getStringI);
this->bindAndAddMethod(new jsonrpc::Procedure("balanceAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::balanceAtI); this->bindAndAddMethod(new jsonrpc::Procedure("db_put", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::db_putI);
this->bindAndAddMethod(new jsonrpc::Procedure("blockByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::blockByHashI); this->bindAndAddMethod(new jsonrpc::Procedure("db_putString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::db_putStringI);
this->bindAndAddMethod(new jsonrpc::Procedure("blockByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::blockByNumberI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_accounts", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::eth_accountsI);
this->bindAndAddMethod(new jsonrpc::Procedure("call", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::callI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_balanceAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_balanceAtI);
this->bindAndAddMethod(new jsonrpc::Procedure("changed", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::changedI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_blockByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_blockByHashI);
this->bindAndAddMethod(new jsonrpc::Procedure("codeAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::codeAtI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_blockByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_blockByNumberI);
this->bindAndAddMethod(new jsonrpc::Procedure("coinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::coinbaseI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_call", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_callI);
this->bindAndAddMethod(new jsonrpc::Procedure("compilers", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::compilersI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_changed", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_changedI);
this->bindAndAddMethod(new jsonrpc::Procedure("contractCall", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::contractCallI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_codeAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_codeAtI);
this->bindAndAddMethod(new jsonrpc::Procedure("contractCreate", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::contractCreateI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_coinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_coinbaseI);
this->bindAndAddMethod(new jsonrpc::Procedure("countAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_REAL, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::countAtI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_compilers", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::eth_compilersI);
this->bindAndAddMethod(new jsonrpc::Procedure("defaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::defaultBlockI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_contractCall", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::eth_contractCallI);
this->bindAndAddMethod(new jsonrpc::Procedure("gasPrice", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::gasPriceI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_contractCreate", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_contractCreateI);
this->bindAndAddMethod(new jsonrpc::Procedure("get", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::getI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_countAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_REAL, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_countAtI);
this->bindAndAddMethod(new jsonrpc::Procedure("getMessages", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::getMessagesI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_defaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_defaultBlockI);
this->bindAndAddMethod(new jsonrpc::Procedure("getString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::getStringI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_gasPrice", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_gasPriceI);
this->bindAndAddMethod(new jsonrpc::Procedure("haveIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::haveIdentityI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_getMessages", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_getMessagesI);
this->bindAndAddMethod(new jsonrpc::Procedure("listening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::listeningI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_listening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_listeningI);
this->bindAndAddMethod(new jsonrpc::Procedure("lll", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::lllI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_lll", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_lllI);
this->bindAndAddMethod(new jsonrpc::Procedure("mining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::miningI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_mining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_miningI);
this->bindAndAddMethod(new jsonrpc::Procedure("newFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::newFilterI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_newFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_newFilterI);
this->bindAndAddMethod(new jsonrpc::Procedure("newFilterString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newFilterStringI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_newFilterString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_newFilterStringI);
this->bindAndAddMethod(new jsonrpc::Procedure("newGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newGroupI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_number", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_numberI);
this->bindAndAddMethod(new jsonrpc::Procedure("newIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::newIdentityI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_peerCount", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_peerCountI);
this->bindAndAddMethod(new jsonrpc::Procedure("number", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::numberI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_setCoinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_setCoinbaseI);
this->bindAndAddMethod(new jsonrpc::Procedure("peerCount", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::peerCountI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_setDefaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_setDefaultBlockI);
this->bindAndAddMethod(new jsonrpc::Procedure("post", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::postI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_setListening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_setListeningI);
this->bindAndAddMethod(new jsonrpc::Procedure("put", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::putI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_setMining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::eth_setMiningI);
this->bindAndAddMethod(new jsonrpc::Procedure("putString", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::putStringI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_solidity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_solidityI);
this->bindAndAddMethod(new jsonrpc::Procedure("setCoinbase", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::setCoinbaseI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_stateAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_stateAtI);
this->bindAndAddMethod(new jsonrpc::Procedure("setDefaultBlock", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::setDefaultBlockI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_transact", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_transactI);
this->bindAndAddMethod(new jsonrpc::Procedure("setListening", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::setListeningI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_transactionByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_transactionByHashI);
this->bindAndAddMethod(new jsonrpc::Procedure("setMining", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_BOOLEAN, NULL), &AbstractWebThreeStubServer::setMiningI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_transactionByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_transactionByNumberI);
this->bindAndAddMethod(new jsonrpc::Procedure("shhChanged", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shhChangedI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_uncleByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_uncleByHashI);
this->bindAndAddMethod(new jsonrpc::Procedure("shhNewFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::shhNewFilterI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_uncleByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_uncleByNumberI);
this->bindAndAddMethod(new jsonrpc::Procedure("shhUninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shhUninstallFilterI); this->bindAndAddMethod(new jsonrpc::Procedure("eth_uninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_uninstallFilterI);
this->bindAndAddMethod(new jsonrpc::Procedure("solidity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::solidityI); this->bindAndAddMethod(new jsonrpc::Procedure("shh_addToGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::shh_addToGroupI);
this->bindAndAddMethod(new jsonrpc::Procedure("stateAt", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::stateAtI); this->bindAndAddMethod(new jsonrpc::Procedure("shh_changed", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shh_changedI);
this->bindAndAddMethod(new jsonrpc::Procedure("transact", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::transactI); this->bindAndAddMethod(new jsonrpc::Procedure("shh_haveIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::shh_haveIdentityI);
this->bindAndAddMethod(new jsonrpc::Procedure("transactionByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::transactionByHashI); this->bindAndAddMethod(new jsonrpc::Procedure("shh_newFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::shh_newFilterI);
this->bindAndAddMethod(new jsonrpc::Procedure("transactionByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::transactionByNumberI); this->bindAndAddMethod(new jsonrpc::Procedure("shh_newGroup", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::shh_newGroupI);
this->bindAndAddMethod(new jsonrpc::Procedure("uncleByHash", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::uncleByHashI); this->bindAndAddMethod(new jsonrpc::Procedure("shh_newIdentity", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::shh_newIdentityI);
this->bindAndAddMethod(new jsonrpc::Procedure("uncleByNumber", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::uncleByNumberI); this->bindAndAddMethod(new jsonrpc::Procedure("shh_post", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::shh_postI);
this->bindAndAddMethod(new jsonrpc::Procedure("uninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::uninstallFilterI); this->bindAndAddMethod(new jsonrpc::Procedure("shh_uninstallFilter", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::shh_uninstallFilterI);
} }
inline virtual void accountsI(const Json::Value& request, Json::Value& response) inline virtual void db_getI(const Json::Value& request, Json::Value& response)
{ {
response = this->accounts(); response = this->db_get(request[0u].asString(), request[1u].asString());
} }
inline virtual void addToGroupI(const Json::Value& request, Json::Value& response) inline virtual void db_getStringI(const Json::Value& request, Json::Value& response)
{ {
response = this->addToGroup(request[0u].asString(), request[1u].asString()); response = this->db_getString(request[0u].asString(), request[1u].asString());
} }
inline virtual void balanceAtI(const Json::Value& request, Json::Value& response) inline virtual void db_putI(const Json::Value& request, Json::Value& response)
{ {
response = this->balanceAt(request[0u].asString()); response = this->db_put(request[0u].asString(), request[1u].asString(), request[2u].asString());
} }
inline virtual void blockByHashI(const Json::Value& request, Json::Value& response) inline virtual void db_putStringI(const Json::Value& request, Json::Value& response)
{ {
response = this->blockByHash(request[0u].asString()); response = this->db_putString(request[0u].asString(), request[1u].asString(), request[2u].asString());
} }
inline virtual void blockByNumberI(const Json::Value& request, Json::Value& response) inline virtual void eth_accountsI(const Json::Value& request, Json::Value& response)
{ {
response = this->blockByNumber(request[0u].asInt()); response = this->eth_accounts();
} }
inline virtual void callI(const Json::Value& request, Json::Value& response) inline virtual void eth_balanceAtI(const Json::Value& request, Json::Value& response)
{ {
response = this->call(request[0u]); response = this->eth_balanceAt(request[0u].asString());
} }
inline virtual void changedI(const Json::Value& request, Json::Value& response) inline virtual void eth_blockByHashI(const Json::Value& request, Json::Value& response)
{ {
response = this->changed(request[0u].asInt()); response = this->eth_blockByHash(request[0u].asString());
} }
inline virtual void codeAtI(const Json::Value& request, Json::Value& response) inline virtual void eth_blockByNumberI(const Json::Value& request, Json::Value& response)
{ {
response = this->codeAt(request[0u].asString()); response = this->eth_blockByNumber(request[0u].asInt());
} }
inline virtual void coinbaseI(const Json::Value& request, Json::Value& response) inline virtual void eth_callI(const Json::Value& request, Json::Value& response)
{ {
response = this->coinbase(); response = this->eth_call(request[0u]);
} }
inline virtual void compilersI(const Json::Value& request, Json::Value& response) inline virtual void eth_changedI(const Json::Value& request, Json::Value& response)
{ {
response = this->compilers(); response = this->eth_changed(request[0u].asInt());
} }
inline virtual void contractCallI(const Json::Value& request, Json::Value& response) inline virtual void eth_codeAtI(const Json::Value& request, Json::Value& response)
{ {
response = this->contractCall(request[0u].asString(), request[1u].asString(), request[2u]); response = this->eth_codeAt(request[0u].asString());
} }
inline virtual void contractCreateI(const Json::Value& request, Json::Value& response) inline virtual void eth_coinbaseI(const Json::Value& request, Json::Value& response)
{ {
response = this->contractCreate(request[0u].asString(), request[1u].asString()); response = this->eth_coinbase();
} }
inline virtual void countAtI(const Json::Value& request, Json::Value& response) inline virtual void eth_compilersI(const Json::Value& request, Json::Value& response)
{ {
response = this->countAt(request[0u].asString()); response = this->eth_compilers();
} }
inline virtual void defaultBlockI(const Json::Value& request, Json::Value& response) inline virtual void eth_contractCallI(const Json::Value& request, Json::Value& response)
{ {
response = this->defaultBlock(); response = this->eth_contractCall(request[0u].asString(), request[1u].asString(), request[2u]);
} }
inline virtual void gasPriceI(const Json::Value& request, Json::Value& response) inline virtual void eth_contractCreateI(const Json::Value& request, Json::Value& response)
{ {
response = this->gasPrice(); response = this->eth_contractCreate(request[0u].asString(), request[1u].asString());
} }
inline virtual void getI(const Json::Value& request, Json::Value& response) inline virtual void eth_countAtI(const Json::Value& request, Json::Value& response)
{ {
response = this->get(request[0u].asString(), request[1u].asString()); response = this->eth_countAt(request[0u].asString());
} }
inline virtual void getMessagesI(const Json::Value& request, Json::Value& response) inline virtual void eth_defaultBlockI(const Json::Value& request, Json::Value& response)
{ {
response = this->getMessages(request[0u].asInt()); response = this->eth_defaultBlock();
} }
inline virtual void getStringI(const Json::Value& request, Json::Value& response) inline virtual void eth_gasPriceI(const Json::Value& request, Json::Value& response)
{ {
response = this->getString(request[0u].asString(), request[1u].asString()); response = this->eth_gasPrice();
} }
inline virtual void haveIdentityI(const Json::Value& request, Json::Value& response) inline virtual void eth_getMessagesI(const Json::Value& request, Json::Value& response)
{ {
response = this->haveIdentity(request[0u].asString()); response = this->eth_getMessages(request[0u].asInt());
} }
inline virtual void listeningI(const Json::Value& request, Json::Value& response) inline virtual void eth_listeningI(const Json::Value& request, Json::Value& response)
{ {
response = this->listening(); response = this->eth_listening();
} }
inline virtual void lllI(const Json::Value& request, Json::Value& response) inline virtual void eth_lllI(const Json::Value& request, Json::Value& response)
{ {
response = this->lll(request[0u].asString()); response = this->eth_lll(request[0u].asString());
} }
inline virtual void miningI(const Json::Value& request, Json::Value& response) inline virtual void eth_miningI(const Json::Value& request, Json::Value& response)
{ {
response = this->mining(); response = this->eth_mining();
} }
inline virtual void newFilterI(const Json::Value& request, Json::Value& response) inline virtual void eth_newFilterI(const Json::Value& request, Json::Value& response)
{ {
response = this->newFilter(request[0u]); response = this->eth_newFilter(request[0u]);
} }
inline virtual void newFilterStringI(const Json::Value& request, Json::Value& response) inline virtual void eth_newFilterStringI(const Json::Value& request, Json::Value& response)
{ {
response = this->newFilterString(request[0u].asString()); response = this->eth_newFilterString(request[0u].asString());
} }
inline virtual void newGroupI(const Json::Value& request, Json::Value& response) inline virtual void eth_numberI(const Json::Value& request, Json::Value& response)
{ {
response = this->newGroup(request[0u].asString(), request[1u].asString()); response = this->eth_number();
} }
inline virtual void newIdentityI(const Json::Value& request, Json::Value& response) inline virtual void eth_peerCountI(const Json::Value& request, Json::Value& response)
{ {
response = this->newIdentity(); response = this->eth_peerCount();
} }
inline virtual void numberI(const Json::Value& request, Json::Value& response) inline virtual void eth_setCoinbaseI(const Json::Value& request, Json::Value& response)
{ {
response = this->number(); response = this->eth_setCoinbase(request[0u].asString());
} }
inline virtual void peerCountI(const Json::Value& request, Json::Value& response) inline virtual void eth_setDefaultBlockI(const Json::Value& request, Json::Value& response)
{ {
response = this->peerCount(); response = this->eth_setDefaultBlock(request[0u].asInt());
} }
inline virtual void postI(const Json::Value& request, Json::Value& response) inline virtual void eth_setListeningI(const Json::Value& request, Json::Value& response)
{ {
response = this->post(request[0u]); response = this->eth_setListening(request[0u].asBool());
} }
inline virtual void putI(const Json::Value& request, Json::Value& response) inline virtual void eth_setMiningI(const Json::Value& request, Json::Value& response)
{ {
response = this->put(request[0u].asString(), request[1u].asString(), request[2u].asString()); response = this->eth_setMining(request[0u].asBool());
} }
inline virtual void putStringI(const Json::Value& request, Json::Value& response) inline virtual void eth_solidityI(const Json::Value& request, Json::Value& response)
{ {
response = this->putString(request[0u].asString(), request[1u].asString(), request[2u].asString()); response = this->eth_solidity(request[0u].asString());
} }
inline virtual void setCoinbaseI(const Json::Value& request, Json::Value& response) inline virtual void eth_stateAtI(const Json::Value& request, Json::Value& response)
{ {
response = this->setCoinbase(request[0u].asString()); response = this->eth_stateAt(request[0u].asString(), request[1u].asString());
} }
inline virtual void setDefaultBlockI(const Json::Value& request, Json::Value& response) inline virtual void eth_transactI(const Json::Value& request, Json::Value& response)
{ {
response = this->setDefaultBlock(request[0u].asInt()); response = this->eth_transact(request[0u]);
} }
inline virtual void setListeningI(const Json::Value& request, Json::Value& response) inline virtual void eth_transactionByHashI(const Json::Value& request, Json::Value& response)
{ {
response = this->setListening(request[0u].asBool()); response = this->eth_transactionByHash(request[0u].asString(), request[1u].asInt());
} }
inline virtual void setMiningI(const Json::Value& request, Json::Value& response) inline virtual void eth_transactionByNumberI(const Json::Value& request, Json::Value& response)
{ {
response = this->setMining(request[0u].asBool()); response = this->eth_transactionByNumber(request[0u].asInt(), request[1u].asInt());
} }
inline virtual void shhChangedI(const Json::Value& request, Json::Value& response) inline virtual void eth_uncleByHashI(const Json::Value& request, Json::Value& response)
{ {
response = this->shhChanged(request[0u].asInt()); response = this->eth_uncleByHash(request[0u].asString(), request[1u].asInt());
} }
inline virtual void shhNewFilterI(const Json::Value& request, Json::Value& response) inline virtual void eth_uncleByNumberI(const Json::Value& request, Json::Value& response)
{ {
response = this->shhNewFilter(request[0u]); response = this->eth_uncleByNumber(request[0u].asInt(), request[1u].asInt());
} }
inline virtual void shhUninstallFilterI(const Json::Value& request, Json::Value& response) inline virtual void eth_uninstallFilterI(const Json::Value& request, Json::Value& response)
{ {
response = this->shhUninstallFilter(request[0u].asInt()); response = this->eth_uninstallFilter(request[0u].asInt());
} }
inline virtual void solidityI(const Json::Value& request, Json::Value& response) inline virtual void shh_addToGroupI(const Json::Value& request, Json::Value& response)
{ {
response = this->solidity(request[0u].asString()); response = this->shh_addToGroup(request[0u].asString(), request[1u].asString());
} }
inline virtual void stateAtI(const Json::Value& request, Json::Value& response) inline virtual void shh_changedI(const Json::Value& request, Json::Value& response)
{ {
response = this->stateAt(request[0u].asString(), request[1u].asString()); response = this->shh_changed(request[0u].asInt());
} }
inline virtual void transactI(const Json::Value& request, Json::Value& response) inline virtual void shh_haveIdentityI(const Json::Value& request, Json::Value& response)
{ {
response = this->transact(request[0u]); response = this->shh_haveIdentity(request[0u].asString());
} }
inline virtual void transactionByHashI(const Json::Value& request, Json::Value& response) inline virtual void shh_newFilterI(const Json::Value& request, Json::Value& response)
{ {
response = this->transactionByHash(request[0u].asString(), request[1u].asInt()); response = this->shh_newFilter(request[0u]);
} }
inline virtual void transactionByNumberI(const Json::Value& request, Json::Value& response) inline virtual void shh_newGroupI(const Json::Value& request, Json::Value& response)
{ {
response = this->transactionByNumber(request[0u].asInt(), request[1u].asInt()); response = this->shh_newGroup(request[0u].asString(), request[1u].asString());
} }
inline virtual void uncleByHashI(const Json::Value& request, Json::Value& response) inline virtual void shh_newIdentityI(const Json::Value& request, Json::Value& response)
{ {
response = this->uncleByHash(request[0u].asString(), request[1u].asInt()); response = this->shh_newIdentity();
} }
inline virtual void uncleByNumberI(const Json::Value& request, Json::Value& response) inline virtual void shh_postI(const Json::Value& request, Json::Value& response)
{ {
response = this->uncleByNumber(request[0u].asInt(), request[1u].asInt()); response = this->shh_post(request[0u]);
} }
inline virtual void uninstallFilterI(const Json::Value& request, Json::Value& response) inline virtual void shh_uninstallFilterI(const Json::Value& request, Json::Value& response)
{ {
response = this->uninstallFilter(request[0u].asInt()); response = this->shh_uninstallFilter(request[0u].asInt());
} }
virtual Json::Value accounts() = 0; virtual std::string db_get(const std::string& param1, const std::string& param2) = 0;
virtual std::string addToGroup(const std::string& param1, const std::string& param2) = 0; virtual std::string db_getString(const std::string& param1, const std::string& param2) = 0;
virtual std::string balanceAt(const std::string& param1) = 0; virtual bool db_put(const std::string& param1, const std::string& param2, const std::string& param3) = 0;
virtual Json::Value blockByHash(const std::string& param1) = 0; virtual bool db_putString(const std::string& param1, const std::string& param2, const std::string& param3) = 0;
virtual Json::Value blockByNumber(const int& param1) = 0; virtual Json::Value eth_accounts() = 0;
virtual std::string call(const Json::Value& param1) = 0; virtual std::string eth_balanceAt(const std::string& param1) = 0;
virtual bool changed(const int& param1) = 0; virtual Json::Value eth_blockByHash(const std::string& param1) = 0;
virtual std::string codeAt(const std::string& param1) = 0; virtual Json::Value eth_blockByNumber(const int& param1) = 0;
virtual std::string coinbase() = 0; virtual std::string eth_call(const Json::Value& param1) = 0;
virtual Json::Value compilers() = 0; virtual bool eth_changed(const int& param1) = 0;
virtual std::string contractCall(const std::string& param1, const std::string& param2, const Json::Value& param3) = 0; virtual std::string eth_codeAt(const std::string& param1) = 0;
virtual std::string contractCreate(const std::string& param1, const std::string& param2) = 0; virtual std::string eth_coinbase() = 0;
virtual double countAt(const std::string& param1) = 0; virtual Json::Value eth_compilers() = 0;
virtual int defaultBlock() = 0; virtual std::string eth_contractCall(const std::string& param1, const std::string& param2, const Json::Value& param3) = 0;
virtual std::string gasPrice() = 0; virtual std::string eth_contractCreate(const std::string& param1, const std::string& param2) = 0;
virtual std::string get(const std::string& param1, const std::string& param2) = 0; virtual double eth_countAt(const std::string& param1) = 0;
virtual Json::Value getMessages(const int& param1) = 0; virtual int eth_defaultBlock() = 0;
virtual std::string getString(const std::string& param1, const std::string& param2) = 0; virtual std::string eth_gasPrice() = 0;
virtual bool haveIdentity(const std::string& param1) = 0; virtual Json::Value eth_getMessages(const int& param1) = 0;
virtual bool listening() = 0; virtual bool eth_listening() = 0;
virtual std::string lll(const std::string& param1) = 0; virtual std::string eth_lll(const std::string& param1) = 0;
virtual bool mining() = 0; virtual bool eth_mining() = 0;
virtual int newFilter(const Json::Value& param1) = 0; virtual int eth_newFilter(const Json::Value& param1) = 0;
virtual int newFilterString(const std::string& param1) = 0; virtual int eth_newFilterString(const std::string& param1) = 0;
virtual std::string newGroup(const std::string& param1, const std::string& param2) = 0; virtual int eth_number() = 0;
virtual std::string newIdentity() = 0; virtual int eth_peerCount() = 0;
virtual int number() = 0; virtual bool eth_setCoinbase(const std::string& param1) = 0;
virtual int peerCount() = 0; virtual bool eth_setDefaultBlock(const int& param1) = 0;
virtual bool post(const Json::Value& param1) = 0; virtual bool eth_setListening(const bool& param1) = 0;
virtual bool put(const std::string& param1, const std::string& param2, const std::string& param3) = 0; virtual bool eth_setMining(const bool& param1) = 0;
virtual bool putString(const std::string& param1, const std::string& param2, const std::string& param3) = 0; virtual std::string eth_solidity(const std::string& param1) = 0;
virtual bool setCoinbase(const std::string& param1) = 0; virtual std::string eth_stateAt(const std::string& param1, const std::string& param2) = 0;
virtual bool setDefaultBlock(const int& param1) = 0; virtual std::string eth_transact(const Json::Value& param1) = 0;
virtual bool setListening(const bool& param1) = 0; virtual Json::Value eth_transactionByHash(const std::string& param1, const int& param2) = 0;
virtual bool setMining(const bool& param1) = 0; virtual Json::Value eth_transactionByNumber(const int& param1, const int& param2) = 0;
virtual Json::Value shhChanged(const int& param1) = 0; virtual Json::Value eth_uncleByHash(const std::string& param1, const int& param2) = 0;
virtual int shhNewFilter(const Json::Value& param1) = 0; virtual Json::Value eth_uncleByNumber(const int& param1, const int& param2) = 0;
virtual bool shhUninstallFilter(const int& param1) = 0; virtual bool eth_uninstallFilter(const int& param1) = 0;
virtual std::string solidity(const std::string& param1) = 0; virtual std::string shh_addToGroup(const std::string& param1, const std::string& param2) = 0;
virtual std::string stateAt(const std::string& param1, const std::string& param2) = 0; virtual Json::Value shh_changed(const int& param1) = 0;
virtual std::string transact(const Json::Value& param1) = 0; virtual bool shh_haveIdentity(const std::string& param1) = 0;
virtual Json::Value transactionByHash(const std::string& param1, const int& param2) = 0; virtual int shh_newFilter(const Json::Value& param1) = 0;
virtual Json::Value transactionByNumber(const int& param1, const int& param2) = 0; virtual std::string shh_newGroup(const std::string& param1, const std::string& param2) = 0;
virtual Json::Value uncleByHash(const std::string& param1, const int& param2) = 0; virtual std::string shh_newIdentity() = 0;
virtual Json::Value uncleByNumber(const int& param1, const int& param2) = 0; virtual bool shh_post(const Json::Value& param1) = 0;
virtual bool uninstallFilter(const int& param1) = 0; virtual bool shh_uninstallFilter(const int& param1) = 0;
}; };
#endif //_ABSTRACTWEBTHREESTUBSERVER_H_ #endif //_ABSTRACTWEBTHREESTUBSERVER_H_

106
libweb3jsonrpc/spec.json

@ -1,58 +1,58 @@
[ [
{ "method": "coinbase", "params": [], "order": [], "returns" : "" }, { "method": "eth_coinbase", "params": [], "order": [], "returns" : "" },
{ "method": "setCoinbase", "params": [""], "order": [], "returns" : true }, { "method": "eth_setCoinbase", "params": [""], "order": [], "returns" : true },
{ "method": "listening", "params": [], "order": [], "returns" : false }, { "method": "eth_listening", "params": [], "order": [], "returns" : false },
{ "method": "setListening", "params": [false], "order" : [], "returns" : true }, { "method": "eth_setListening", "params": [false], "order" : [], "returns" : true },
{ "method": "mining", "params": [], "order": [], "returns" : false }, { "method": "eth_mining", "params": [], "order": [], "returns" : false },
{ "method": "setMining", "params": [false], "order" : [], "returns" : true }, { "method": "eth_setMining", "params": [false], "order" : [], "returns" : true },
{ "method": "gasPrice", "params": [], "order": [], "returns" : "" }, { "method": "eth_gasPrice", "params": [], "order": [], "returns" : "" },
{ "method": "accounts", "params": [], "order": [], "returns" : [] }, { "method": "eth_accounts", "params": [], "order": [], "returns" : [] },
{ "method": "peerCount", "params": [], "order": [], "returns" : 0 }, { "method": "eth_peerCount", "params": [], "order": [], "returns" : 0 },
{ "method": "defaultBlock", "params": [], "order": [], "returns" : 0}, { "method": "eth_defaultBlock", "params": [], "order": [], "returns" : 0},
{ "method": "setDefaultBlock", "params": [0], "order": [], "returns" : true}, { "method": "eth_setDefaultBlock", "params": [0], "order": [], "returns" : true},
{ "method": "number", "params": [], "order": [], "returns" : 0}, { "method": "eth_number", "params": [], "order": [], "returns" : 0},
{ "method": "balanceAt", "params": [""], "order": [], "returns" : ""}, { "method": "eth_balanceAt", "params": [""], "order": [], "returns" : ""},
{ "method": "stateAt", "params": ["", ""], "order": [], "returns": ""}, { "method": "eth_stateAt", "params": ["", ""], "order": [], "returns": ""},
{ "method": "countAt", "params": [""], "order": [], "returns" : 0.0}, { "method": "eth_countAt", "params": [""], "order": [], "returns" : 0.0},
{ "method": "codeAt", "params": [""], "order": [], "returns": ""}, { "method": "eth_codeAt", "params": [""], "order": [], "returns": ""},
{ "method": "transact", "params": [{}], "order": [], "returns": ""}, { "method": "eth_transact", "params": [{}], "order": [], "returns": ""},
{ "method": "call", "params": [{}], "order": [], "returns": ""}, { "method": "eth_call", "params": [{}], "order": [], "returns": ""},
{ "method": "blockByHash", "params": [""],"order": [], "returns": {}}, { "method": "eth_blockByHash", "params": [""],"order": [], "returns": {}},
{ "method": "blockByNumber", "params": [0],"order": [], "returns": {}}, { "method": "eth_blockByNumber", "params": [0],"order": [], "returns": {}},
{ "method": "transactionByHash", "params": ["", 0], "order": [], "returns": {}}, { "method": "eth_transactionByHash", "params": ["", 0], "order": [], "returns": {}},
{ "method": "transactionByNumber", "params": [0, 0], "order": [], "returns": {}}, { "method": "eth_transactionByNumber", "params": [0, 0], "order": [], "returns": {}},
{ "method": "uncleByHash", "params": ["", 0], "order": [], "returns": {}}, { "method": "eth_uncleByHash", "params": ["", 0], "order": [], "returns": {}},
{ "method": "uncleByNumber", "params": [0, 0], "order": [], "returns": {}}, { "method": "eth_uncleByNumber", "params": [0, 0], "order": [], "returns": {}},
{ "method": "compilers", "params": [], "order": [], "returns": []}, { "method": "eth_compilers", "params": [], "order": [], "returns": []},
{ "method": "lll", "params": [""], "order": [], "returns": ""}, { "method": "eth_lll", "params": [""], "order": [], "returns": ""},
{ "method": "solidity", "params": [""], "order": [], "returns": ""}, { "method": "eth_solidity", "params": [""], "order": [], "returns": ""},
{ "method": "contractCreate", "params": ["", ""], "order": [], "returns": ""}, { "method": "eth_contractCreate", "params": ["", ""], "order": [], "returns": ""},
{ "method": "contractCall", "params": ["", "", []], "order": [], "returns": ""}, { "method": "eth_contractCall", "params": ["", "", []], "order": [], "returns": ""},
{ "method": "newFilter", "params": [{}], "order": [], "returns": 0}, { "method": "eth_newFilter", "params": [{}], "order": [], "returns": 0},
{ "method": "newFilterString", "params": [""], "order": [], "returns": 0}, { "method": "eth_newFilterString", "params": [""], "order": [], "returns": 0},
{ "method": "uninstallFilter", "params": [0], "order": [], "returns": true}, { "method": "eth_uninstallFilter", "params": [0], "order": [], "returns": true},
{ "method": "changed", "params": [0], "order": [], "returns": false}, { "method": "eth_changed", "params": [0], "order": [], "returns": false},
{ "method": "getMessages", "params": [0], "order": [], "returns": []}, { "method": "eth_getMessages", "params": [0], "order": [], "returns": []},
{ "method": "put", "params": ["", "", ""], "order": [], "returns": true}, { "method": "db_put", "params": ["", "", ""], "order": [], "returns": true},
{ "method": "get", "params": ["", ""], "order": [], "returns": ""}, { "method": "db_get", "params": ["", ""], "order": [], "returns": ""},
{ "method": "putString", "params": ["", "", ""], "order": [], "returns": true}, { "method": "db_putString", "params": ["", "", ""], "order": [], "returns": true},
{ "method": "getString", "params": ["", ""], "order": [], "returns": ""}, { "method": "db_getString", "params": ["", ""], "order": [], "returns": ""},
{ "method": "post", "params": [{}], "order": [], "returns": true}, { "method": "shh_post", "params": [{}], "order": [], "returns": true},
{ "method": "newIdentity", "params": [], "order": [], "returns": ""}, { "method": "shh_newIdentity", "params": [], "order": [], "returns": ""},
{ "method": "haveIdentity", "params": [""], "order": [], "returns": false}, { "method": "shh_haveIdentity", "params": [""], "order": [], "returns": false},
{ "method": "newGroup", "params": ["", ""], "order": [], "returns": ""}, { "method": "shh_newGroup", "params": ["", ""], "order": [], "returns": ""},
{ "method": "addToGroup", "params": ["", ""], "order": [], "returns": ""}, { "method": "shh_addToGroup", "params": ["", ""], "order": [], "returns": ""},
{ "method": "shhNewFilter", "params": [{}], "order": [], "returns": 0}, { "method": "shh_newFilter", "params": [{}], "order": [], "returns": 0},
{ "method": "shhUninstallFilter", "params": [0], "order": [], "returns": true}, { "method": "shh_uninstallFilter", "params": [0], "order": [], "returns": true},
{ "method": "shhChanged", "params": [0], "order": [], "returns": []} { "method": "shh_changed", "params": [0], "order": [], "returns": []}
] ]

10
solc/main.cpp

@ -42,7 +42,8 @@ void help()
{ {
cout << "Usage solc [OPTIONS] <file>" << endl cout << "Usage solc [OPTIONS] <file>" << endl
<< "Options:" << endl << "Options:" << endl
<< " -h,--help Show this help message and exit." << endl << " -o,--optimize Optimize the bytecode for size." << endl
<< " -h,--help Show this help message and exit." << endl
<< " -V,--version Show the version and exit." << endl; << " -V,--version Show the version and exit." << endl;
exit(0); exit(0);
} }
@ -58,10 +59,13 @@ void version()
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
string infile; string infile;
bool optimize = false;
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
{ {
string arg = argv[i]; string arg = argv[i];
if (arg == "-h" || arg == "--help") if (arg == "-o" || arg == "--optimize")
optimize = true;
else if (arg == "-h" || arg == "--help")
help(); help();
else if (arg == "-V" || arg == "--version") else if (arg == "-V" || arg == "--version")
version(); version();
@ -98,7 +102,7 @@ int main(int argc, char** argv)
printer.print(cout); printer.print(cout);
compiler.compileContract(*ast); compiler.compileContract(*ast);
instructions = compiler.getAssembledBytecode(); instructions = compiler.getAssembledBytecode(optimize);
} }
catch (ParserError const& exception) catch (ParserError const& exception)
{ {

43
test/TestHelper.cpp

@ -253,7 +253,7 @@ bytes importCode(json_spirit::mObject& _o)
code.clear(); code.clear();
for (auto const& j: _o["code"].get_array()) for (auto const& j: _o["code"].get_array())
code.push_back(toByte(j)); code.push_back(toByte(j));
} }
return code; return code;
} }
@ -305,6 +305,47 @@ std::string getTestPath()
return testPath; 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) void executeTests(const string& _name, const string& _testPathAppendix, std::function<void(json_spirit::mValue&, bool)> doTests)
{ {
string testPath = getTestPath(); string testPath = getTestPath();

1
test/TestHelper.h

@ -71,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 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); void executeTests(const std::string& _name, const std::string& _testPathAppendix, std::function<void(json_spirit::mValue&, bool)> doTests);
std::string getTestPath(); std::string getTestPath();
void userDefinedTest(std::string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests);
template<typename mapType> template<typename mapType>
void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs)

46
test/jsonrpc.cpp

@ -74,14 +74,14 @@ BOOST_FIXTURE_TEST_SUITE(environment, Setup)
BOOST_AUTO_TEST_CASE(jsonrpc_defaultBlock) BOOST_AUTO_TEST_CASE(jsonrpc_defaultBlock)
{ {
cnote << "Testing jsonrpc defaultBlock..."; cnote << "Testing jsonrpc defaultBlock...";
int defaultBlock = jsonrpcClient->defaultBlock(); int defaultBlock = jsonrpcClient->eth_defaultBlock();
BOOST_CHECK_EQUAL(defaultBlock, web3->ethereum()->getDefault()); BOOST_CHECK_EQUAL(defaultBlock, web3->ethereum()->getDefault());
} }
BOOST_AUTO_TEST_CASE(jsonrpc_gasPrice) BOOST_AUTO_TEST_CASE(jsonrpc_gasPrice)
{ {
cnote << "Testing jsonrpc gasPrice..."; cnote << "Testing jsonrpc gasPrice...";
string gasPrice = jsonrpcClient->gasPrice(); string gasPrice = jsonrpcClient->eth_gasPrice();
BOOST_CHECK_EQUAL(gasPrice, toJS(10 * dev::eth::szabo)); BOOST_CHECK_EQUAL(gasPrice, toJS(10 * dev::eth::szabo));
} }
@ -90,11 +90,11 @@ BOOST_AUTO_TEST_CASE(jsonrpc_isListening)
cnote << "Testing jsonrpc isListening..."; cnote << "Testing jsonrpc isListening...";
web3->startNetwork(); web3->startNetwork();
bool listeningOn = jsonrpcClient->listening(); bool listeningOn = jsonrpcClient->eth_listening();
BOOST_CHECK_EQUAL(listeningOn, web3->isNetworkStarted()); BOOST_CHECK_EQUAL(listeningOn, web3->isNetworkStarted());
web3->stopNetwork(); web3->stopNetwork();
bool listeningOff = jsonrpcClient->listening(); bool listeningOff = jsonrpcClient->eth_listening();
BOOST_CHECK_EQUAL(listeningOff, web3->isNetworkStarted()); BOOST_CHECK_EQUAL(listeningOff, web3->isNetworkStarted());
} }
@ -103,11 +103,11 @@ BOOST_AUTO_TEST_CASE(jsonrpc_isMining)
cnote << "Testing jsonrpc isMining..."; cnote << "Testing jsonrpc isMining...";
web3->ethereum()->startMining(); web3->ethereum()->startMining();
bool miningOn = jsonrpcClient->mining(); bool miningOn = jsonrpcClient->eth_mining();
BOOST_CHECK_EQUAL(miningOn, web3->ethereum()->isMining()); BOOST_CHECK_EQUAL(miningOn, web3->ethereum()->isMining());
web3->ethereum()->stopMining(); web3->ethereum()->stopMining();
bool miningOff = jsonrpcClient->mining(); bool miningOff = jsonrpcClient->eth_mining();
BOOST_CHECK_EQUAL(miningOff, web3->ethereum()->isMining()); BOOST_CHECK_EQUAL(miningOff, web3->ethereum()->isMining());
} }
@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_accounts)
cnote << "Testing jsonrpc accounts..."; cnote << "Testing jsonrpc accounts...";
std::vector <dev::KeyPair> keys = {KeyPair::create(), KeyPair::create()}; std::vector <dev::KeyPair> keys = {KeyPair::create(), KeyPair::create()};
jsonrpcServer->setAccounts(keys); jsonrpcServer->setAccounts(keys);
Json::Value k = jsonrpcClient->accounts(); Json::Value k = jsonrpcClient->eth_accounts();
jsonrpcServer->setAccounts({}); jsonrpcServer->setAccounts({});
BOOST_CHECK_EQUAL(k.isArray(), true); BOOST_CHECK_EQUAL(k.isArray(), true);
BOOST_CHECK_EQUAL(k.size(), keys.size()); BOOST_CHECK_EQUAL(k.size(), keys.size());
@ -133,10 +133,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_accounts)
BOOST_AUTO_TEST_CASE(jsonrpc_number) BOOST_AUTO_TEST_CASE(jsonrpc_number)
{ {
cnote << "Testing jsonrpc number2..."; cnote << "Testing jsonrpc number2...";
int number = jsonrpcClient->number(); int number = jsonrpcClient->eth_number();
BOOST_CHECK_EQUAL(number, web3->ethereum()->number() + 1); BOOST_CHECK_EQUAL(number, web3->ethereum()->number() + 1);
dev::eth::mine(*(web3->ethereum()), 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(number + 1, numberAfter);
BOOST_CHECK_EQUAL(numberAfter, web3->ethereum()->number() + 1); BOOST_CHECK_EQUAL(numberAfter, web3->ethereum()->number() + 1);
} }
@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_number)
BOOST_AUTO_TEST_CASE(jsonrpc_peerCount) BOOST_AUTO_TEST_CASE(jsonrpc_peerCount)
{ {
cnote << "Testing jsonrpc peerCount..."; cnote << "Testing jsonrpc peerCount...";
int peerCount = jsonrpcClient->peerCount(); int peerCount = jsonrpcClient->eth_peerCount();
BOOST_CHECK_EQUAL(web3->peerCount(), peerCount); BOOST_CHECK_EQUAL(web3->peerCount(), peerCount);
} }
@ -152,10 +152,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_setListening)
{ {
cnote << "Testing jsonrpc setListening..."; cnote << "Testing jsonrpc setListening...";
jsonrpcClient->setListening(true); jsonrpcClient->eth_setListening(true);
BOOST_CHECK_EQUAL(web3->isNetworkStarted(), true); BOOST_CHECK_EQUAL(web3->isNetworkStarted(), true);
jsonrpcClient->setListening(false); jsonrpcClient->eth_setListening(false);
BOOST_CHECK_EQUAL(web3->isNetworkStarted(), false); BOOST_CHECK_EQUAL(web3->isNetworkStarted(), false);
} }
@ -163,10 +163,10 @@ BOOST_AUTO_TEST_CASE(jsonrpc_setMining)
{ {
cnote << "Testing jsonrpc setMining..."; cnote << "Testing jsonrpc setMining...";
jsonrpcClient->setMining(true); jsonrpcClient->eth_setMining(true);
BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), true); BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), true);
jsonrpcClient->setMining(false); jsonrpcClient->eth_setMining(false);
BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), false); BOOST_CHECK_EQUAL(web3->ethereum()->isMining(), false);
} }
@ -175,14 +175,14 @@ BOOST_AUTO_TEST_CASE(jsonrpc_stateAt)
cnote << "Testing jsonrpc stateAt..."; cnote << "Testing jsonrpc stateAt...";
dev::KeyPair key = KeyPair::create(); dev::KeyPair key = KeyPair::create();
auto address = key.address(); 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_CHECK_EQUAL(toJS(web3->ethereum()->stateAt(address, jsToU256("0"), 0)), stateAt);
} }
BOOST_AUTO_TEST_CASE(jsonrpc_transact) BOOST_AUTO_TEST_CASE(jsonrpc_transact)
{ {
cnote << "Testing jsonrpc transact..."; cnote << "Testing jsonrpc transact...";
string coinbase = jsonrpcClient->coinbase(); string coinbase = jsonrpcClient->eth_coinbase();
BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address()); BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address());
dev::KeyPair key = KeyPair::create(); dev::KeyPair key = KeyPair::create();
@ -190,14 +190,14 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact)
auto receiver = KeyPair::create(); auto receiver = KeyPair::create();
web3->ethereum()->setAddress(address); web3->ethereum()->setAddress(address);
coinbase = jsonrpcClient->coinbase(); coinbase = jsonrpcClient->eth_coinbase();
BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address()); BOOST_CHECK_EQUAL(jsToAddress(coinbase), web3->ethereum()->address());
BOOST_CHECK_EQUAL(jsToAddress(coinbase), address); BOOST_CHECK_EQUAL(jsToAddress(coinbase), address);
jsonrpcServer->setAccounts({key}); jsonrpcServer->setAccounts({key});
auto balance = web3->ethereum()->balanceAt(address, 0); auto balance = web3->ethereum()->balanceAt(address, 0);
string balanceString = jsonrpcClient->balanceAt(toJS(address)); string balanceString = jsonrpcClient->eth_balanceAt(toJS(address));
double countAt = jsonrpcClient->countAt(toJS(address)); double countAt = jsonrpcClient->eth_countAt(toJS(address));
BOOST_CHECK_EQUAL(countAt, (double)(uint64_t)web3->ethereum()->countAt(address)); BOOST_CHECK_EQUAL(countAt, (double)(uint64_t)web3->ethereum()->countAt(address));
BOOST_CHECK_EQUAL(countAt, 0); BOOST_CHECK_EQUAL(countAt, 0);
@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact)
dev::eth::mine(*(web3->ethereum()), 1); dev::eth::mine(*(web3->ethereum()), 1);
balance = web3->ethereum()->balanceAt(address, 0); 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(toJS(balance), balanceString);
BOOST_CHECK_EQUAL(jsToDecimal(balanceString), "1500000000000000000"); BOOST_CHECK_EQUAL(jsToDecimal(balanceString), "1500000000000000000");
@ -223,13 +223,13 @@ BOOST_AUTO_TEST_CASE(jsonrpc_transact)
t["gas"] = toJS(gas); t["gas"] = toJS(gas);
t["gasPrice"] = toJS(gasPrice); t["gasPrice"] = toJS(gasPrice);
jsonrpcClient->transact(t); jsonrpcClient->eth_transact(t);
jsonrpcServer->setAccounts({}); jsonrpcServer->setAccounts({});
dev::eth::mine(*(web3->ethereum()), 1); dev::eth::mine(*(web3->ethereum()), 1);
countAt = jsonrpcClient->countAt(toJS(address)); countAt = jsonrpcClient->eth_countAt(toJS(address));
auto balance2 = web3->ethereum()->balanceAt(receiver.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, (double)(uint64_t)web3->ethereum()->countAt(address));
BOOST_CHECK_EQUAL(countAt, 1); BOOST_CHECK_EQUAL(countAt, 1);

717
test/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" : ""
}
},
}

1334
test/stSystemOperationsTestFiller.json

File diff suppressed because it is too large

11
test/state.cpp

@ -43,7 +43,6 @@ namespace dev { namespace test {
void doStateTests(json_spirit::mValue& v, bool _fillin) void doStateTests(json_spirit::mValue& v, bool _fillin)
{ {
cout << "start state test\n";
for (auto& i: v.get_obj()) for (auto& i: v.get_obj())
{ {
cnote << i.first; cnote << i.first;
@ -118,4 +117,14 @@ BOOST_AUTO_TEST_CASE(stSystemOperationsTest)
dev::test::executeTests("stSystemOperationsTest", "/StateTests", dev::test::doStateTests); dev::test::executeTests("stSystemOperationsTest", "/StateTests", dev::test::doStateTests);
} }
BOOST_AUTO_TEST_CASE(stPreCompiledContracts)
{
dev::test::executeTests("stPreCompiledContracts", "/StateTests", dev::test::doStateTests);
}
BOOST_AUTO_TEST_CASE(userDefinedFileState)
{
dev::test::userDefinedTest("--statetest", dev::test::doStateTests);
}
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()

35
test/vm.cpp

@ -20,6 +20,7 @@
* vm test functions. * vm test functions.
*/ */
#include <boost/filesystem.hpp>
#include "vm.h" #include "vm.h"
using namespace std; using namespace std;
@ -423,32 +424,42 @@ BOOST_AUTO_TEST_CASE(vmPushDupSwapTest)
dev::test::executeTests("vmPushDupSwapTest", "/VMTests", dev::test::doVMTests); 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 try
{ {
cnote << "Testing VM..." << "user defined test"; cnote << "Testing ..." << path.filename();
json_spirit::mValue v; json_spirit::mValue v;
string s = asString(contents(filename)); string s = asString(dev::contents(path.string()));
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + filename + " is empty. "); 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); json_spirit::read_string(s, v);
dev::test::doVMTests(v, false); doVMTests(v, false);
} }
catch (Exception const& _e) 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) 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() BOOST_AUTO_TEST_SUITE_END()

14
test/vmArithmeticTestFiller.json

@ -1725,7 +1725,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000", "balance" : "1000000000000000000",
"nonce" : 0, "nonce" : 0,
"code" : "0x62122ff4600016600057", "code" : "0x62122ff460000b600055",
"storage": {} "storage": {}
} }
}, },
@ -1753,7 +1753,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000", "balance" : "1000000000000000000",
"nonce" : 0, "nonce" : 0,
"code" : "0x62122f6a600016600057", "code" : "0x62122f6a60000b600055",
"storage": {} "storage": {}
} }
}, },
@ -1781,7 +1781,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000", "balance" : "1000000000000000000",
"nonce" : 0, "nonce" : 0,
"code" : "0x6212faf4600116600057", "code" : "0x6212faf460010b600055",
"storage": {} "storage": {}
} }
}, },
@ -1809,7 +1809,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000", "balance" : "1000000000000000000",
"nonce" : 0, "nonce" : 0,
"code" : "0x62126af4600116600057", "code" : "0x62126af460010b600055",
"storage": {} "storage": {}
} }
}, },
@ -1837,7 +1837,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000", "balance" : "1000000000000000000",
"nonce" : 0, "nonce" : 0,
"code" : "0x62126af4605016600057", "code" : "0x62126af460500b600055",
"storage": {} "storage": {}
} }
}, },
@ -2005,7 +2005,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000", "balance" : "1000000000000000000",
"nonce" : 0, "nonce" : 0,
"code" : "0x66f000000000000161ffff16600057", "code" : "0x66f000000000000161ffff0b600055",
"storage": {} "storage": {}
} }
}, },
@ -2033,7 +2033,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000", "balance" : "1000000000000000000",
"nonce" : 0, "nonce" : 0,
"code" : "0x60ff68f0000000000000000116600057", "code" : "0x60ff68f000000000000000010b600055",
"storage": {} "storage": {}
} }
}, },

356
test/webthreestubclient.h

@ -19,25 +19,27 @@ class WebThreeStubClient
delete this->client; delete this->client;
} }
Json::Value accounts() throw (jsonrpc::JsonRpcException) std::string db_get(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p.append(param1);
Json::Value result = this->client->CallMethod("accounts",p); p.append(param2);
if (result.isArray())
return result; Json::Value result = this->client->CallMethod("db_get",p);
if (result.isString())
return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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) std::string db_getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); p.append(param2);
Json::Value result = this->client->CallMethod("addToGroup",p); Json::Value result = this->client->CallMethod("db_getString",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
@ -45,12 +47,54 @@ p.append(param2);
} }
std::string balanceAt(const std::string& param1) 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("db_put",p);
if (result.isBool())
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
bool db_putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException)
{
Json::Value p;
p.append(param1);
p.append(param2);
p.append(param3);
Json::Value result = this->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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("balanceAt",p); Json::Value result = this->client->CallMethod("eth_balanceAt",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
@ -58,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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("blockByHash",p); Json::Value result = this->client->CallMethod("eth_blockByHash",p);
if (result.isObject()) if (result.isObject())
return result; return result;
else else
@ -71,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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("blockByNumber",p); Json::Value result = this->client->CallMethod("eth_blockByNumber",p);
if (result.isObject()) if (result.isObject())
return result; return result;
else else
@ -84,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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("call",p); Json::Value result = this->client->CallMethod("eth_call",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
@ -97,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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("changed",p); Json::Value result = this->client->CallMethod("eth_changed",p);
if (result.isBool()) if (result.isBool())
return result.asBool(); return result.asBool();
else else
@ -110,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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("codeAt",p); Json::Value result = this->client->CallMethod("eth_codeAt",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
@ -123,11 +167,11 @@ p.append(param2);
} }
std::string coinbase() throw (jsonrpc::JsonRpcException) std::string eth_coinbase() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
Json::Value result = this->client->CallMethod("coinbase",p); Json::Value result = this->client->CallMethod("eth_coinbase",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
@ -135,11 +179,11 @@ p.append(param2);
} }
Json::Value compilers() throw (jsonrpc::JsonRpcException) Json::Value eth_compilers() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
Json::Value result = this->client->CallMethod("compilers",p); Json::Value result = this->client->CallMethod("eth_compilers",p);
if (result.isArray()) if (result.isArray())
return result; return result;
else else
@ -147,14 +191,14 @@ p.append(param2);
} }
std::string contractCall(const std::string& param1, const std::string& param2, const Json::Value& param3) throw (jsonrpc::JsonRpcException) std::string eth_contractCall(const std::string& param1, const std::string& param2, const Json::Value& param3) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); p.append(param2);
p.append(param3); p.append(param3);
Json::Value result = this->client->CallMethod("contractCall",p); Json::Value result = this->client->CallMethod("eth_contractCall",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
@ -162,13 +206,13 @@ p.append(param3);
} }
std::string contractCreate(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) std::string eth_contractCreate(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); p.append(param2);
Json::Value result = this->client->CallMethod("contractCreate",p); Json::Value result = this->client->CallMethod("eth_contractCreate",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
@ -176,12 +220,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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("countAt",p); Json::Value result = this->client->CallMethod("eth_countAt",p);
if (result.isDouble()) if (result.isDouble())
return result.asDouble(); return result.asDouble();
else else
@ -189,11 +233,11 @@ p.append(param2);
} }
int defaultBlock() throw (jsonrpc::JsonRpcException) int eth_defaultBlock() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
Json::Value result = this->client->CallMethod("defaultBlock",p); Json::Value result = this->client->CallMethod("eth_defaultBlock",p);
if (result.isInt()) if (result.isInt())
return result.asInt(); return result.asInt();
else else
@ -201,25 +245,11 @@ p.append(param2);
} }
std::string gasPrice() throw (jsonrpc::JsonRpcException) std::string eth_gasPrice() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; 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
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
std::string get(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("get",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
@ -227,12 +257,12 @@ p.append(param2);
} }
Json::Value getMessages(const int& param1) throw (jsonrpc::JsonRpcException) Json::Value eth_getMessages(const int& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("getMessages",p); Json::Value result = this->client->CallMethod("eth_getMessages",p);
if (result.isArray()) if (result.isArray())
return result; return result;
else else
@ -240,38 +270,11 @@ p.append(param2);
} }
std::string getString(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) bool eth_listening() 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)
{
Json::Value p;
p.append(param1);
Json::Value result = this->client->CallMethod("haveIdentity",p);
if (result.isBool())
return result.asBool();
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
bool listening() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
Json::Value result = this->client->CallMethod("listening",p); Json::Value result = this->client->CallMethod("eth_listening",p);
if (result.isBool()) if (result.isBool())
return result.asBool(); return result.asBool();
else else
@ -279,12 +282,12 @@ p.append(param2);
} }
std::string lll(const std::string& param1) throw (jsonrpc::JsonRpcException) std::string eth_lll(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("lll",p); Json::Value result = this->client->CallMethod("eth_lll",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
@ -292,11 +295,11 @@ p.append(param2);
} }
bool mining() throw (jsonrpc::JsonRpcException) bool eth_mining() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
Json::Value result = this->client->CallMethod("mining",p); Json::Value result = this->client->CallMethod("eth_mining",p);
if (result.isBool()) if (result.isBool())
return result.asBool(); return result.asBool();
else else
@ -304,12 +307,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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("newFilter",p); Json::Value result = this->client->CallMethod("eth_newFilter",p);
if (result.isInt()) if (result.isInt())
return result.asInt(); return result.asInt();
else else
@ -317,12 +320,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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("newFilterString",p); Json::Value result = this->client->CallMethod("eth_newFilterString",p);
if (result.isInt()) if (result.isInt())
return result.asInt(); return result.asInt();
else else
@ -330,62 +333,62 @@ p.append(param2);
} }
std::string newGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) int eth_number() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p = Json::nullValue;
p.append(param2); Json::Value result = this->client->CallMethod("eth_number",p);
if (result.isInt())
Json::Value result = this->client->CallMethod("newGroup",p); return result.asInt();
if (result.isString())
return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
std::string newIdentity() throw (jsonrpc::JsonRpcException) int eth_peerCount() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
Json::Value result = this->client->CallMethod("newIdentity",p); Json::Value result = this->client->CallMethod("eth_peerCount",p);
if (result.isString()) if (result.isInt())
return result.asString(); return result.asInt();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
int number() throw (jsonrpc::JsonRpcException) bool eth_setCoinbase(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p.append(param1);
Json::Value result = this->client->CallMethod("number",p);
if (result.isInt()) Json::Value result = this->client->CallMethod("eth_setCoinbase",p);
return result.asInt(); if (result.isBool())
return result.asBool();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
int peerCount() throw (jsonrpc::JsonRpcException) bool eth_setDefaultBlock(const int& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p.append(param1);
Json::Value result = this->client->CallMethod("peerCount",p);
if (result.isInt()) Json::Value result = this->client->CallMethod("eth_setDefaultBlock",p);
return result.asInt(); if (result.isBool())
return result.asBool();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
bool post(const Json::Value& param1) throw (jsonrpc::JsonRpcException) bool eth_setListening(const bool& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("post",p); Json::Value result = this->client->CallMethod("eth_setListening",p);
if (result.isBool()) if (result.isBool())
return result.asBool(); return result.asBool();
else else
@ -393,14 +396,12 @@ p.append(param2);
} }
bool put(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; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
p.append(param3);
Json::Value result = this->client->CallMethod("put",p); Json::Value result = this->client->CallMethod("eth_setMining",p);
if (result.isBool()) if (result.isBool())
return result.asBool(); return result.asBool();
else else
@ -408,105 +409,108 @@ p.append(param3);
} }
bool putString(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) std::string eth_solidity(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
p.append(param3);
Json::Value result = this->client->CallMethod("putString",p); Json::Value result = this->client->CallMethod("eth_solidity",p);
if (result.isBool()) if (result.isString())
return result.asBool(); return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
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; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("setCoinbase",p); Json::Value result = this->client->CallMethod("eth_stateAt",p);
if (result.isBool()) if (result.isString())
return result.asBool(); return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("setDefaultBlock",p); Json::Value result = this->client->CallMethod("eth_transact",p);
if (result.isBool()) if (result.isString())
return result.asBool(); return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("setListening",p); Json::Value result = this->client->CallMethod("eth_transactionByHash",p);
if (result.isBool()) if (result.isObject())
return result.asBool(); return result;
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("setMining",p); Json::Value result = this->client->CallMethod("eth_transactionByNumber",p);
if (result.isBool()) if (result.isObject())
return result.asBool(); return result;
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("shhChanged",p); Json::Value result = this->client->CallMethod("eth_uncleByHash",p);
if (result.isArray()) if (result.isObject())
return result; return result;
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("shhNewFilter",p); Json::Value result = this->client->CallMethod("eth_uncleByNumber",p);
if (result.isInt()) if (result.isObject())
return result.asInt(); return result;
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("shhUninstallFilter",p); Json::Value result = this->client->CallMethod("eth_uninstallFilter",p);
if (result.isBool()) if (result.isBool())
return result.asBool(); return result.asBool();
else else
@ -514,12 +518,13 @@ p.append(param3);
} }
std::string solidity(const std::string& param1) throw (jsonrpc::JsonRpcException) std::string shh_addToGroup(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("solidity",p); Json::Value result = this->client->CallMethod("shh_addToGroup",p);
if (result.isString()) if (result.isString())
return result.asString(); return result.asString();
else else
@ -527,95 +532,90 @@ p.append(param3);
} }
std::string stateAt(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) Json::Value shh_changed(const int& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("stateAt",p); Json::Value result = this->client->CallMethod("shh_changed",p);
if (result.isString()) if (result.isArray())
return result.asString(); return result;
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
std::string transact(const Json::Value& param1) throw (jsonrpc::JsonRpcException) bool shh_haveIdentity(const std::string& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("transact",p); Json::Value result = this->client->CallMethod("shh_haveIdentity",p);
if (result.isString()) if (result.isBool())
return result.asString(); return result.asBool();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value transactionByHash(const std::string& param1, const int& param2) throw (jsonrpc::JsonRpcException) int shh_newFilter(const Json::Value& param1) throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("transactionByHash",p); Json::Value result = this->client->CallMethod("shh_newFilter",p);
if (result.isObject()) if (result.isInt())
return result; return result.asInt();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value transactionByNumber(const int& 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; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2); p.append(param2);
Json::Value result = this->client->CallMethod("transactionByNumber",p); Json::Value result = this->client->CallMethod("shh_newGroup",p);
if (result.isObject()) if (result.isString())
return result; return result.asString();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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_newIdentity() throw (jsonrpc::JsonRpcException)
{ {
Json::Value p; Json::Value p;
p.append(param1); p = Json::nullValue;
p.append(param2); Json::Value result = this->client->CallMethod("shh_newIdentity",p);
if (result.isString())
Json::Value result = this->client->CallMethod("uncleByHash",p); return result.asString();
if (result.isObject())
return result;
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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; Json::Value p;
p.append(param1); p.append(param1);
p.append(param2);
Json::Value result = this->client->CallMethod("uncleByNumber",p); Json::Value result = this->client->CallMethod("shh_post",p);
if (result.isObject()) if (result.isBool())
return result; return result.asBool();
else else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); 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; Json::Value p;
p.append(param1); p.append(param1);
Json::Value result = this->client->CallMethod("uninstallFilter",p); Json::Value result = this->client->CallMethod("shh_uninstallFilter",p);
if (result.isBool()) if (result.isBool())
return result.asBool(); return result.asBool();
else else

Loading…
Cancel
Save