Browse Source

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

cl-refactor
Gav Wood 11 years ago
parent
commit
f89880ffd4
  1. 43
      eth/main.cpp
  2. 45
      neth/main.cpp

43
eth/main.cpp

@ -447,12 +447,12 @@ int main(int argc, char** argv)
if (size < 40) if (size < 40)
{ {
if (size > 0) if (size > 0)
cwarn << "Invalid address length: " << size; cwarn << "Invalid address length:" << size;
} }
else if (gasPrice < info.minGasPrice) else if (gasPrice < info.minGasPrice)
cwarn << "Minimum gas price is " << info.minGasPrice; cwarn << "Minimum gas price is" << info.minGasPrice;
else if (gas < minGas) else if (gas < minGas)
cwarn << "Minimum gas amount is " << minGas; cwarn << "Minimum gas amount is" << minGas;
else if (ssize < 40) else if (ssize < 40)
{ {
if (ssize > 0) if (ssize > 0)
@ -514,7 +514,7 @@ int main(int argc, char** argv)
if (size < 40) if (size < 40)
{ {
if (size > 0) if (size > 0)
cwarn << "Invalid address length: " << size; cwarn << "Invalid address length:" << size;
} }
else else
{ {
@ -549,7 +549,7 @@ int main(int argc, char** argv)
bytes init; bytes init;
cnote << "Init:"; cnote << "Init:";
cnote << sinit; cnote << sinit;
cnote << "Code size: " << size; cnote << "Code size:" << size;
if (size < 1) if (size < 1)
cwarn << "No code submitted"; cwarn << "No code submitted";
else else
@ -566,9 +566,9 @@ int main(int argc, char** argv)
if (endowment < 0) if (endowment < 0)
cwarn << "Invalid endowment"; cwarn << "Invalid endowment";
else if (gasPrice < info.minGasPrice) else if (gasPrice < info.minGasPrice)
cwarn << "Minimum gas price is " << info.minGasPrice; cwarn << "Minimum gas price is" << info.minGasPrice;
else if (gas < minGas) else if (gas < minGas)
cwarn << "Minimum gas amount is " << minGas; cwarn << "Minimum gas amount is" << minGas;
else else
c.transact(us.secret(), endowment, init, gas, gasPrice); c.transact(us.secret(), endowment, init, gas, gasPrice);
} }
@ -587,17 +587,26 @@ int main(int argc, char** argv)
ClientGuard g(&c); ClientGuard g(&c);
auto h = h160(fromHex(rechex)); auto h = h160(fromHex(rechex));
stringstream s; stringstream s;
auto mem = c.state().storage(h);
for (auto const& i: mem) try
s << "@" << showbase << hex << i.first << " " << showbase << hex << i.second << endl; {
s << endl << disassemble(c.state().code(h)); auto storage = c.state().storage(h);
for (auto const& i: storage)
string outFile = getDataDir() + "/" + rechex + ".evm"; s << "@" << showbase << hex << i.first << " " << showbase << hex << i.second << endl;
ofstream ofs; s << endl << disassemble(c.state().code(h)) << endl;
ofs.open(outFile, ofstream::binary);
ofs.write(s.str().c_str(), s.str().length()); string outFile = getDataDir() + "/" + rechex + ".evm";
ofs.close(); ofstream ofs;
ofs.open(outFile, ofstream::binary);
ofs.write(s.str().c_str(), s.str().length());
ofs.close();
cnote << "Saved" << rechex << "to" << outFile;
}
catch (eth::InvalidTrie)
{
cwarn << "Corrupted trie.";
}
} }
} }
else if (cmd == "setSecret") else if (cmd == "setSecret")

45
neth/main.cpp

@ -151,7 +151,7 @@ void version()
exit(0); exit(0);
} }
Address c_config = Address("9ef0f0d81e040012600b0c1abdef7c48f720f88a"); Address c_config = Address("661005d2720d855f1d9976f88bb10c1a3398c77f");
string pretty(h160 _a, eth::State _st) string pretty(h160 _a, eth::State _st)
{ {
string ns; string ns;
@ -667,12 +667,12 @@ int main(int argc, char** argv)
if (size < 40) if (size < 40)
{ {
if (size > 0) if (size > 0)
cwarn << "Invalid address length: " << size; cwarn << "Invalid address length:" << size;
} }
else if (gasPrice < info.minGasPrice) else if (gasPrice < info.minGasPrice)
cwarn << "Minimum gas price is " << info.minGasPrice; cwarn << "Minimum gas price is" << info.minGasPrice;
else if (gas < minGas) else if (gas < minGas)
cwarn << "Minimum gas amount is " << minGas; cwarn << "Minimum gas amount is" << minGas;
else if (ssize < 40) else if (ssize < 40)
{ {
if (ssize > 0) if (ssize > 0)
@ -712,7 +712,7 @@ int main(int argc, char** argv)
if (size < 40) if (size < 40)
{ {
if (size > 0) if (size > 0)
cwarn << "Invalid address length: " << size; cwarn << "Invalid address length:" << size;
} }
else else
{ {
@ -769,7 +769,7 @@ int main(int argc, char** argv)
bytes init; bytes init;
cnote << "Init:"; cnote << "Init:";
cnote << sinit; cnote << sinit;
cnote << "Code size: " << size; cnote << "Code size:" << size;
if (size < 1) if (size < 1)
cwarn << "No code submitted"; cwarn << "No code submitted";
else else
@ -786,9 +786,9 @@ int main(int argc, char** argv)
if (endowment < 0) if (endowment < 0)
cwarn << "Invalid endowment"; cwarn << "Invalid endowment";
else if (gasPrice < info.minGasPrice) else if (gasPrice < info.minGasPrice)
cwarn << "Minimum gas price is " << info.minGasPrice; cwarn << "Minimum gas price is" << info.minGasPrice;
else if (gas < minGas) else if (gas < minGas)
cwarn << "Minimum gas amount is " << minGas; cwarn << "Minimum gas amount is" << minGas;
else else
{ {
c.transact(us.secret(), endowment, init, gas, gasPrice); c.transact(us.secret(), endowment, init, gas, gasPrice);
@ -807,17 +807,26 @@ int main(int argc, char** argv)
ClientGuard g(&c); ClientGuard g(&c);
auto h = h160(fromHex(rechex)); auto h = h160(fromHex(rechex));
stringstream s; stringstream s;
auto mem = c.state().storage(h);
for (auto const& i: mem) try
s << "@" << showbase << hex << i.first << " " << showbase << hex << i.second << endl; {
s << endl << disassemble(c.state().code(h)); auto storage = c.state().storage(h);
for (auto const& i: storage)
string outFile = getDataDir() + "/" + rechex + ".evm"; s << "@" << showbase << hex << i.first << " " << showbase << hex << i.second << endl;
ofstream ofs; s << endl << disassemble(c.state().code(h)) << endl;
ofs.open(outFile, ofstream::binary);
ofs.write(s.str().c_str(), s.str().length()); string outFile = getDataDir() + "/" + rechex + ".evm";
ofs.close(); ofstream ofs;
ofs.open(outFile, ofstream::binary);
ofs.write(s.str().c_str(), s.str().length());
ofs.close();
cnote << "Saved" << rechex << "to" << outFile;
}
catch (eth::InvalidTrie)
{
cwarn << "Corrupted trie.";
}
} }
} }
else if (cmd == "reset") else if (cmd == "reset")

Loading…
Cancel
Save