diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cd7a80c4..4603bb898 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,9 @@ function(createDefaultCacheConfig) set(PARANOIA OFF CACHE BOOL "Additional run-time checks") set(JSONRPC ON CACHE BOOL "Build with jsonprc. default on") set(EVMJIT OFF CACHE BOOL "Build a just-in-time compiler for EVM code (requires LLVM)") + set(FATDB OFF CACHE BOOL "Build with ability to list entries in the Trie. Doubles DB size, slows everything down, but good for looking at state diffs and trie contents.") + set(JUSTTESTS OFF CACHE BOOL "Build only for tests.") + set(SOLIDITY ON CACHE BOOL "Build the Solidity language components (requried unless HEADLESS)") endfunction() @@ -44,12 +47,20 @@ function(configureProject) add_definitions(-DETH_EVMJIT) endif() - if (HEADLESS) + if (FATDB) + add_definitions(-DETH_FATDB) + endif() + + if (SOLIDITY) + add_definitions(-DETH_SOLIDITY) + endif() + + if (HEADLESS OR JUSTTESTS) add_definitions(-DETH_HEADLESS) endif() endfunction() - +set(CPPETHEREUM 1) function(createBuildInfo) # Set build platform; to be written to BuildInfo.h @@ -109,8 +120,12 @@ cmake_policy(SET CMP0015 NEW) createDefaultCacheConfig() configureProject() + +# Force chromium. +set (ETH_HAVE_WEBENGINE 1) + message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") -message("-- VMTRACE: ${VMTRACE}; PARANOIA: ${PARANOIA}; HEADLESS: ${HEADLESS}; JSONRPC: ${JSONRPC}; EVMJIT: ${EVMJIT}") +message("-- VMTRACE: ${VMTRACE}; PARANOIA: ${PARANOIA}; HEADLESS: ${HEADLESS}; JSONRPC: ${JSONRPC}; EVMJIT: ${EVMJIT}; FATDB: ${FATDB}; CHROMIUM: ${ETH_HAVE_WEBENGINE}") # Default TARGET_PLATFORM to "linux". @@ -139,6 +154,7 @@ if (EVMJIT) endif() add_subdirectory(libdevcore) +add_subdirectory(rlp) add_subdirectory(libevmcore) add_subdirectory(liblll) @@ -148,8 +164,11 @@ if (NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")) endif () add_subdirectory(libsolidity) -add_subdirectory(lllc) -add_subdirectory(solc) + +if (NOT JUSTTESTS) + add_subdirectory(lllc) + add_subdirectory(solc) +endif() if (JSONRPC) add_subdirectory(libweb3jsonrpc) @@ -160,31 +179,41 @@ add_subdirectory(libp2p) add_subdirectory(libdevcrypto) add_subdirectory(libwhisper) +add_subdirectory(libethash) add_subdirectory(libethcore) add_subdirectory(libevm) add_subdirectory(libethereum) add_subdirectory(libwebthree) add_subdirectory(test) -add_subdirectory(eth) -if("x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug") - add_subdirectory(exp) -endif () +if (NOT JUSTTESTS) -# TODO check msvc -if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")) - add_subdirectory(neth) -endif () + add_subdirectory(eth) + + if("x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug") + add_subdirectory(exp) + endif () + + # TODO check msvc + if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")) + add_subdirectory(neth) + endif () + + if (NOT HEADLESS) + + add_subdirectory(libnatspec) + add_subdirectory(libjsqrc) + + if (ETH_HAVE_WEBENGINE) + add_subdirectory(alethzero) +# add_subdirectory(third) // reenable once not qtwebkit. + endif() + + add_subdirectory(mix) + + endif() -if (NOT HEADLESS) - - add_subdirectory(libnatspec) - add_subdirectory(libjsqrc) - add_subdirectory(alethzero) - add_subdirectory(third) - add_subdirectory(mix) - endif() enable_testing() diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index 4af907c5d..cbc9e087a 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -15,6 +15,9 @@ include_directories(BEFORE ..) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS}) +find_package (Qt5WebEngine QUIET) +find_package (Qt5WebEngineWidgets QUIET) + qt5_wrap_ui(ui_Main.h Main.ui) qt5_wrap_ui(ui_Debugger.h Debugger.ui) qt5_wrap_ui(ui_Transact.h Transact.ui) @@ -38,8 +41,8 @@ add_dependencies(${EXECUTABLE} BuildInfo.h) target_link_libraries(${EXECUTABLE} Qt5::Core) target_link_libraries(${EXECUTABLE} Qt5::Widgets) -target_link_libraries(${EXECUTABLE} Qt5::WebKit) -target_link_libraries(${EXECUTABLE} Qt5::WebKitWidgets) +target_link_libraries(${EXECUTABLE} Qt5::WebEngine) +target_link_libraries(${EXECUTABLE} Qt5::WebEngineWidgets) target_link_libraries(${EXECUTABLE} webthree) target_link_libraries(${EXECUTABLE} ethereum) target_link_libraries(${EXECUTABLE} evm) diff --git a/alethzero/Context.cpp b/alethzero/Context.cpp index d187e6d47..7a5a986d1 100644 --- a/alethzero/Context.cpp +++ b/alethzero/Context.cpp @@ -21,7 +21,7 @@ #include "Context.h" #include -#include +#include using namespace std; using namespace dev; using namespace dev::eth; diff --git a/alethzero/Context.h b/alethzero/Context.h index 098690455..beb368c26 100644 --- a/alethzero/Context.h +++ b/alethzero/Context.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include class QComboBox; diff --git a/alethzero/Debugger.h b/alethzero/Debugger.h index 370ad6e30..76ef6a0d3 100644 --- a/alethzero/Debugger.h +++ b/alethzero/Debugger.h @@ -22,7 +22,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/alethzero/Main.ui b/alethzero/Main.ui index 9025aa846..da5ee6c4a 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -38,6 +38,13 @@ + + + + 0 bytes used + + + @@ -95,13 +102,7 @@ - - - - about:blank - - - + @@ -806,13 +807,7 @@ 0 - - - - about:blank - - - + @@ -1667,11 +1662,6 @@ font-size: 14pt - - QWebView - QWidget -
QtWebKitWidgets/QWebView
-
MiningView QWidget @@ -1684,6 +1674,12 @@ font-size: 14pt
DownloadView.h
1
+ + QWebEngineView + QWidget +
QtWebEngineWidgets/QWebEngineView
+ 1 +
shhTo @@ -1695,10 +1691,8 @@ font-size: 14pt log post verbosity - jsConsole tabWidget urlEdit - webView idealPeers forceAddress port diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 797db6441..88b9103cb 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -19,17 +19,22 @@ * @date 2014 */ +#define QWEBENGINEINSPECTOR 1 #include // Make sure boost/asio.hpp is included before windows.h. #include +#pragma GCC diagnostic ignored "-Wpedantic" +//pragma GCC diagnostic ignored "-Werror=pedantic" #include #include #include #include -#include -#include +#include +#include +#include +#include #include #include #include @@ -40,6 +45,7 @@ #endif #include #include +#include #include #include #include @@ -112,6 +118,7 @@ Main::Main(QWidget *parent) : ui(new Ui::Main), m_transact(this, this) { + QtWebEngine::initialize(); setWindowFlags(Qt::Window); ui->setupUi(this); g_logPost = [=](string const& s, char const* c) @@ -140,6 +147,7 @@ Main::Main(QWidget *parent) : ui->configDock->close(); on_verbosity_valueChanged(); + statusBar()->addPermanentWidget(ui->cacheUsage); statusBar()->addPermanentWidget(ui->balance); statusBar()->addPermanentWidget(ui->peerCount); statusBar()->addPermanentWidget(ui->mineStatus); @@ -158,31 +166,24 @@ Main::Main(QWidget *parent) : m_server->setIdentities(keysAsVector(owned())); m_server->StartListening(); - connect(ui->webView, &QWebView::loadStarted, [this]() - { - QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); - QWebFrame* f = ui->webView->page()->mainFrame(); - f->disconnect(SIGNAL(javaScriptWindowObjectCleared())); - - connect(f, &QWebFrame::javaScriptWindowObjectCleared, [f, this]() - { - f->disconnect(); - f->addToJavaScriptWindowObject("env", this, QWebFrame::QtOwnership); - f->evaluateJavaScript(contentsOfQResource(":/js/bignumber.min.js")); - f->evaluateJavaScript(contentsOfQResource(":/js/webthree.js")); - f->evaluateJavaScript(contentsOfQResource(":/js/setup.js")); - }); - }); - - connect(ui->webView, &QWebView::loadFinished, [=]() + connect(ui->webView, &QWebEngineView::loadFinished, [this]() { +// f->disconnect(); +// f->addToJavaScriptWindowObject("env", this, QWebFrame::QtOwnership); + auto f = ui->webView->page(); + f->runJavaScript(contentsOfQResource(":/js/bignumber.min.js")); + f->runJavaScript(contentsOfQResource(":/js/webthree.js")); + f->runJavaScript(contentsOfQResource(":/js/setup.js")); }); - connect(ui->webView, &QWebView::titleChanged, [=]() + connect(ui->webView, &QWebEngineView::titleChanged, [=]() { ui->tabWidget->setTabText(0, ui->webView->title()); }); +// ui->webView->page()->settings()->setAttribute(QWebEngineSettings::DeveloperExtrasEnabled, true); +// QWebEngineInspector* inspector = new QWebEngineInspector(); +// inspector->setPage(page); readSettings(); installWatches(); startTimer(100); @@ -370,29 +371,7 @@ QString Main::contents(QString _s) void Main::load(QString _s) { QString contents = QString::fromStdString(dev::asString(dev::contents(_s.toStdString()))); - ui->webView->page()->currentFrame()->evaluateJavaScript(contents); - /* - QFile fin(_s); - if (!fin.open(QFile::ReadOnly)) - return; - QString line; - while (!fin.atEnd()) - { - QString l = QString::fromUtf8(fin.readLine()); - line.append(l); - if (line.count('"') % 2) - { - line.chop(1); - } - else if (line.endsWith("\\\n")) - line.chop(2); - else - { - ui->webView->page()->currentFrame()->evaluateJavaScript(line); - //eval(line); - line.clear(); - } - }*/ + ui->webView->page()->runJavaScript(contents); } void Main::on_newTransaction_triggered() @@ -429,35 +408,35 @@ void Main::on_jsInput_returnPressed() ui->jsInput->setText(""); } -QVariant Main::evalRaw(QString const& _js) -{ - return ui->webView->page()->currentFrame()->evaluateJavaScript(_js); -} - void Main::eval(QString const& _js) { if (_js.trimmed().isEmpty()) return; - QVariant ev = ui->webView->page()->currentFrame()->evaluateJavaScript((_js.startsWith("{") || _js.startsWith("if ") || _js.startsWith("if(")) ? _js : ("___RET=(" + _js + ")")); - QVariant jsonEv = ui->webView->page()->currentFrame()->evaluateJavaScript("JSON.stringify(___RET)"); - QString s; - if (ev.isNull()) - s = "null"; - else if (ev.type() == QVariant::String) - s = "\"" + ev.toString().toHtmlEscaped() + "\""; - else if (ev.type() == QVariant::Int || ev.type() == QVariant::Double) - s = "" + ev.toString().toHtmlEscaped() + ""; - else if (jsonEv.type() == QVariant::String) - s = "" + jsonEv.toString().toHtmlEscaped() + ""; - else - s = "unknown type"; - m_consoleHistory.push_back(qMakePair(_js, s)); - s = "" Div(Mono "position: absolute; bottom: 0; border: 0px; margin: 0px; width: 100%"); - for (auto const& i: m_consoleHistory) - s += "
>" + i.first.toHtmlEscaped() + "
" - "
 " + i.second + "
"; - s += ""; - ui->jsConsole->setHtml(s); + auto f = [=](QVariant ev) { + auto f2 = [=](QVariant jsonEv) { + QString s; + if (ev.isNull()) + s = "null"; + else if (ev.type() == QVariant::String) + s = "\"" + ev.toString().toHtmlEscaped() + "\""; + else if (ev.type() == QVariant::Int || ev.type() == QVariant::Double) + s = "" + ev.toString().toHtmlEscaped() + ""; + else if (jsonEv.type() == QVariant::String) + s = "" + jsonEv.toString().toHtmlEscaped() + ""; + else + s = "unknown type"; + m_consoleHistory.push_back(qMakePair(_js, s)); + s = "" Div(Mono "position: absolute; bottom: 0; border: 0px; margin: 0px; width: 100%"); + for (auto const& i: m_consoleHistory) + s += "
>" + i.first.toHtmlEscaped() + "
" + "
 " + i.second + "
"; + s += ""; + ui->jsConsole->setHtml(s); + }; + ui->webView->page()->runJavaScript("JSON.stringify(___RET)", f2); + }; + auto c = (_js.startsWith("{") || _js.startsWith("if ") || _js.startsWith("if(")) ? _js : ("___RET=(" + _js + ")"); + ui->webView->page()->runJavaScript(c, f); } static Public stringToPublic(QString const& _a) @@ -471,37 +450,17 @@ static Public stringToPublic(QString const& _a) return Public(); } -//static Address g_newNameReg; - QString Main::pretty(dev::Address _a) const { -/* static map s_memos; - - if (!s_memos.count(_a)) - {*/ -// if (!g_newNameReg) - auto g_newNameReg = getNameReg(); - - if (g_newNameReg) - { - QString s = QString::fromStdString(toString(abiOut(ethereum()->call(g_newNameReg, abiIn("nameOf(address)", _a))))); -// s_memos[_a] = s; - if (s.size()) - return s; - } -/* } - else - if (s_memos[_a].size()) - return s_memos[_a];*/ + auto g_newNameReg = getNameReg(); + if (g_newNameReg) + { + QString s = QString::fromStdString(toString(abiOut(ethereum()->call(g_newNameReg, abiIn("nameOf(address)", _a))))); + if (s.size()) + return s; + } h256 n; -/* - if (h160 nameReg = (u160)ethereum()->stateAt(c_config, 0)) - n = ethereum()->stateAt(nameReg, (u160)(_a)); - - if (!n) - n = ethereum()->stateAt(m_nameReg, (u160)(_a)); -*/ return fromRaw(n); } @@ -526,41 +485,13 @@ Address Main::fromString(QString const& _n) const if (_n == "(Create Contract)") return Address(); -/* static map s_memos; - - if (!s_memos.count(_n)) - {*/ -// if (!g_newNameReg) - auto g_newNameReg = getNameReg(); - - if (g_newNameReg) - { - Address a = abiOut
(ethereum()->call(g_newNameReg, abiIn("addressOf(string32)", ::fromString(_n.toStdString())))); -// s_memos[_n] = a; - if (a) - return a; - } -/* } - else - if (s_memos[_n]) - return s_memos[_n]; - - string sn = _n.toStdString(); - if (sn.size() > 32) - sn.resize(32); - h256 n; - memcpy(n.data(), sn.data(), sn.size()); - memset(n.data() + sn.size(), 0, 32 - sn.size()); - if (_n.size()) + auto g_newNameReg = getNameReg(); + if (g_newNameReg) { - if (h160 nameReg = (u160)ethereum()->stateAt(c_config, 0)) - if (h256 a = ethereum()->stateAt(nameReg, n)) - return right160(a); - - if (h256 a = ethereum()->stateAt(m_nameReg, n)) - return right160(a); - }*/ - + Address a = abiOut
(ethereum()->call(g_newNameReg, abiIn("addressOf(string32)", ::fromString(_n.toStdString())))); + if (a) + return a; + } if (_n.size() == 40) { try @@ -594,13 +525,6 @@ QString Main::lookup(QString const& _a) const h256 n; memcpy(n.data(), sn.data(), sn.size()); -/* string sn2 = _a.toStdString(); - if (sn2.size() > 32) - sn2 = sha3(sn2, false); - h256 n2; - memcpy(n2.data(), sn2.data(), sn2.size()); -*/ - h256 ret; // TODO: fix with the new DNSreg contract // if (h160 dnsReg = (u160)ethereum()->stateAt(c_config, 4, 0)) @@ -1037,31 +961,6 @@ void Main::refreshBlockCount() ui->blockCount->setText(QString("%6 #%1 @%3 T%2 PV%4 D%5").arg(d.number).arg(toLog2(d.totalDifficulty)).arg(toLog2(diff)).arg(c_protocolVersion).arg(c_databaseVersion).arg(m_privateChain.size() ? "[" + m_privateChain + "] " : "testnet")); } -static bool blockMatch(string const& _f, BlockDetails const& _b, h256 _h, CanonBlockChain const& _bc) -{ - try - { - if (_f.size() > 1 && _f.size() < 10 && _f[0] == '#' && stoul(_f.substr(1)) == _b.number) - return true; - } - catch (...) {} - if (toHex(_h.ref()).find(_f) != string::npos) - return true; - BlockInfo bi(_bc.block(_h)); - string info = toHex(bi.stateRoot.ref()) + " " + toHex(bi.coinbaseAddress.ref()) + " " + toHex(bi.transactionsRoot.ref()) + " " + toHex(bi.sha3Uncles.ref()); - if (info.find(_f) != string::npos) - return true; - return false; -} - -static bool transactionMatch(string const& _f, Transaction const& _t) -{ - string info = toHex(_t.receiveAddress().ref()) + " " + toHex(_t.sha3().ref()) + " " + toHex(_t.sha3(eth::WithoutSignature).ref()) + " " + toHex(_t.sender().ref()); - if (info.find(_f) != string::npos) - return true; - return false; -} - void Main::on_turboMining_triggered() { ethereum()->setTurboMining(ui->turboMining->isChecked()); @@ -1071,55 +970,81 @@ void Main::refreshBlockChain() { cwatch << "refreshBlockChain()"; - QByteArray oldSelected = ui->blocks->count() ? ui->blocks->currentItem()->data(Qt::UserRole).toByteArray() : QByteArray(); - ui->blocks->clear(); + // TODO: keep the same thing highlighted. + // TODO: refactor into MVC + // TODO: use get by hash/number + // TODO: transactions, log addresses, log topics - string filter = ui->blockChainFilter->text().toLower().toStdString(); auto const& bc = ethereum()->blockChain(); - unsigned i = (ui->showAll->isChecked() || !filter.empty()) ? (unsigned)-1 : 10; - for (auto h = bc.currentHash(); bc.details(h) && i; h = bc.details(h).parent, --i) - { - auto d = bc.details(h); - auto bm = blockMatch(filter, d, h, bc); - if (bm) + QStringList filters = ui->blockChainFilter->text().toLower().split(QRegExp("\\s+"), QString::SkipEmptyParts); + + h256Set blocks; + for (QString f: filters) + if (f.size() == 64) { - QListWidgetItem* blockItem = new QListWidgetItem(QString("#%1 %2").arg(d.number).arg(h.abridged().c_str()), ui->blocks); - auto hba = QByteArray((char const*)h.data(), h.size); - blockItem->setData(Qt::UserRole, hba); - if (oldSelected == hba) - blockItem->setSelected(true); + h256 h(f.toStdString()); + if (bc.isKnown(h)) + blocks.insert(h); } + else if (f.toLongLong() <= bc.number()) + blocks.insert(bc.numberHash(u256(f.toLongLong()))); + /*else if (f.size() == 40) + { + Address h(f[0]); + if (bc.(h)) + blocks.insert(h); + }*/ + + QByteArray oldSelected = ui->blocks->count() ? ui->blocks->currentItem()->data(Qt::UserRole).toByteArray() : QByteArray(); + ui->blocks->clear(); + auto showBlock = [&](h256 const& h) { + auto d = bc.details(h); + QListWidgetItem* blockItem = new QListWidgetItem(QString("#%1 %2").arg(d.number).arg(h.abridged().c_str()), ui->blocks); + auto hba = QByteArray((char const*)h.data(), h.size); + blockItem->setData(Qt::UserRole, hba); + if (oldSelected == hba) + blockItem->setSelected(true); + int n = 0; auto b = bc.block(h); for (auto const& i: RLP(b)[1]) { Transaction t(i.data(), CheckSignature::Sender); - if (bm || transactionMatch(filter, t)) - { - QString s = t.receiveAddress() ? - QString(" %2 %5> %3: %1 [%4]") - .arg(formatBalance(t.value()).c_str()) - .arg(render(t.safeSender())) - .arg(render(t.receiveAddress())) - .arg((unsigned)t.nonce()) - .arg(ethereum()->codeAt(t.receiveAddress()).size() ? '*' : '-') : - QString(" %2 +> %3: %1 [%4]") - .arg(formatBalance(t.value()).c_str()) - .arg(render(t.safeSender())) - .arg(render(right160(sha3(rlpList(t.safeSender(), t.nonce()))))) - .arg((unsigned)t.nonce()); - QListWidgetItem* txItem = new QListWidgetItem(s, ui->blocks); - auto hba = QByteArray((char const*)h.data(), h.size); - txItem->setData(Qt::UserRole, hba); - txItem->setData(Qt::UserRole + 1, n); - if (oldSelected == hba) - txItem->setSelected(true); - } + QString s = t.receiveAddress() ? + QString(" %2 %5> %3: %1 [%4]") + .arg(formatBalance(t.value()).c_str()) + .arg(render(t.safeSender())) + .arg(render(t.receiveAddress())) + .arg((unsigned)t.nonce()) + .arg(ethereum()->codeAt(t.receiveAddress()).size() ? '*' : '-') : + QString(" %2 +> %3: %1 [%4]") + .arg(formatBalance(t.value()).c_str()) + .arg(render(t.safeSender())) + .arg(render(right160(sha3(rlpList(t.safeSender(), t.nonce()))))) + .arg((unsigned)t.nonce()); + QListWidgetItem* txItem = new QListWidgetItem(s, ui->blocks); + auto hba = QByteArray((char const*)h.data(), h.size); + txItem->setData(Qt::UserRole, hba); + txItem->setData(Qt::UserRole + 1, n); + if (oldSelected == hba) + txItem->setSelected(true); n++; } - if (h == bc.genesisHash()) - break; + }; + + if (filters.empty()) + { + unsigned i = ui->showAll->isChecked() ? (unsigned)-1 : 10; + for (auto h = bc.currentHash(); bc.details(h) && i; h = bc.details(h).parent, --i) + { + showBlock(h); + if (h == bc.genesisHash()) + break; + } } + else + for (auto const& h: blocks) + showBlock(h); if (!ui->blocks->currentItem()) ui->blocks->setCurrentRow(0); @@ -1143,6 +1068,44 @@ void Main::on_refresh_triggered() refreshAll(); } +static std::string niceUsed(unsigned _n) +{ + static const vector c_units = { "bytes", "KB", "MB", "GB", "TB", "PB" }; + unsigned u = 0; + while (_n > 10240) + { + _n /= 1024; + u++; + } + if (_n > 1000) + return toString(_n / 1000) + "." + toString((min(949, _n % 1000) + 50) / 100) + " " + c_units[u + 1]; + else + return toString(_n) + " " + c_units[u]; +} + +void Main::refreshCache() +{ + BlockChain::Statistics s = ethereum()->blockChain().usage(); + QString t; + auto f = [&](unsigned n, QString l) + { + t += ("%1 " + l).arg(QString::fromStdString(niceUsed(n))); + }; + f(s.memTotal(), "total"); + t += " ("; + f(s.memBlocks, "blocks"); + t += ", "; + f(s.memReceipts, "receipts"); + t += ", "; + f(s.memLogBlooms, "blooms"); + t += ", "; + f(s.memBlockHashes + s.memTransactionAddresses, "hashes"); + t += ", "; + f(s.memDetails, "family"); + t += ")"; + ui->cacheUsage->setText(t); +} + void Main::timerEvent(QTimerEvent*) { // 7/18, Alex: aggregating timers, prelude to better threading? @@ -1171,6 +1134,7 @@ void Main::timerEvent(QTimerEvent*) interval = 0; refreshNetwork(); refreshWhispers(); + refreshCache(); poll(); } else @@ -1362,11 +1326,16 @@ void Main::on_blocks_currentItemChanged() s << "   Children: " << details.children.size() << ""; s << "
Gas used/limit: " << info.gasUsed << "/" << info.gasLimit << ""; s << "
Coinbase: " << pretty(info.coinbaseAddress).toHtmlEscaped().toStdString() << " " << info.coinbaseAddress; + s << "
Seed hash: " << info.seedHash << ""; + s << "
Mix hash: " << info.mixHash << ""; s << "
Nonce: " << info.nonce << ""; s << "
Hash w/o nonce: " << info.headerHash(WithoutNonce) << ""; s << "
Difficulty: " << info.difficulty << ""; if (info.number) - s << "
Proof-of-Work: " << ProofOfWork::eval(info.headerHash(WithoutNonce), info.nonce) << " <= " << (h256)u256((bigint(1) << 256) / info.difficulty) << ""; + { + auto e = Ethasher::eval(info); + s << "
Proof-of-Work: " << e.value << " <= " << (h256)u256((bigint(1) << 256) / info.difficulty) << " (mixhash: " << e.mixHash.abridged() << ")"; + } else s << "
Proof-of-Work: Phil has nothing to prove"; s << "
Parent: " << info.parentHash << ""; @@ -1378,9 +1347,18 @@ void Main::on_blocks_currentItemChanged() for (auto u: block[2]) { BlockInfo uncle = BlockInfo::fromHeader(u.data()); - s << "
 Hash: " << uncle.hash << ""; - s << "
 Parent: " << uncle.parentHash << ""; - s << "
 Number: " << uncle.number << ""; + char const* line = "
 "; + s << line << "Hash: " << uncle.hash << ""; + s << line << "Parent: " << uncle.parentHash << ""; + s << line << "Number: " << uncle.number << ""; + s << line << "Coinbase: " << pretty(uncle.coinbaseAddress).toHtmlEscaped().toStdString() << " " << uncle.coinbaseAddress; + s << line << "Seed hash: " << uncle.seedHash << ""; + s << line << "Mix hash: " << uncle.mixHash << ""; + s << line << "Nonce: " << uncle.nonce << ""; + s << line << "Hash w/o nonce: " << uncle.headerHash(WithoutNonce) << ""; + s << line << "Difficulty: " << uncle.difficulty << ""; + auto e = Ethasher::eval(uncle); + s << line << "Proof-of-Work: " << e.value << " <= " << (h256)u256((bigint(1) << 256) / uncle.difficulty) << " (mixhash: " << e.mixHash.abridged() << ")"; } if (info.parentHash) s << "
Pre: " << BlockInfo(ethereum()->blockChain().block(info.parentHash)).stateRoot << ""; diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index 0a2b3461e..378877468 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -76,8 +76,6 @@ public: bool confirm() const; NatSpecFace* natSpec() { return &m_natSpecDB; } - QVariant evalRaw(QString const& _js); - QString pretty(dev::Address _a) const override; QString prettyU256(dev::u256 _n) const override; QString render(dev::Address _a) const override; @@ -212,6 +210,7 @@ private: void refreshNetwork(); void refreshMining(); void refreshWhispers(); + void refreshCache(); void refreshAll(); void refreshPending(); diff --git a/alethzero/Transact.h b/alethzero/Transact.h index f14005eff..8ef4f41e0 100644 --- a/alethzero/Transact.h +++ b/alethzero/Transact.h @@ -22,7 +22,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 7cb42e0e4..6f2d1ad6c 100755 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -3,7 +3,7 @@ # C++11 check and activation if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") - set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -Werror -DSHAREDLIB -fPIC ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -Werror -pedantic -DSHAREDLIB -fPIC ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DETH_RELEASE") diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 3f6cbcd77..645942998 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -120,8 +120,8 @@ if (NOT HEADLESS) find_package (Qt5Qml REQUIRED) find_package (Qt5Network REQUIRED) find_package (Qt5Widgets REQUIRED) - find_package (Qt5WebKit REQUIRED) - find_package (Qt5WebKitWidgets REQUIRED) + find_package (Qt5WebEngine REQUIRED) + find_package (Qt5WebEngineWidgets REQUIRED) # we need to find path to macdeployqt on mac if (APPLE) diff --git a/eth/CMakeLists.txt b/eth/CMakeLists.txt index 68ee8c775..fbc6a8b24 100644 --- a/eth/CMakeLists.txt +++ b/eth/CMakeLists.txt @@ -26,7 +26,7 @@ if (JSONRPC) endif() target_link_libraries(${EXECUTABLE} webthree) -target_link_libraries(${EXECUTABLE} secp256k1) +target_link_libraries(${EXECUTABLE} ethash) if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW) add_custom_command(TARGET ${EXECUTABLE} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${MHD_DLL_RELEASE} "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") diff --git a/eth/main.cpp b/eth/main.cpp index e3753364f..3b97c561d 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -74,6 +74,9 @@ void interactiveHelp() << " jsonstop Stops the JSON-RPC server." << endl << " connect Connects to a specific peer." << endl << " verbosity () Gets or sets verbosity level." << endl + << " setetherprice

Resets the ether price." << endl + << " setpriority

Resets the transaction priority." << endl + << " minestart Starts mining." << endl << " minestart Starts mining." << endl << " minestop Stops mining." << endl << " mineforce Forces mining, even when there are no transactions." << endl @@ -85,12 +88,12 @@ void interactiveHelp() << " send Execute a given transaction with current secret." << endl << " contract Create a new contract with current secret." << endl << " peers List the peers that are connected" << endl - << " listAccounts List the accounts on the network." << endl - << " listContracts List the contracts on the network." << endl - << " setSecret Set the secret to the hex secret key." < Set the coinbase (mining payout) address." < Export the config (.RLP) to the path provided." < Import the config (.RLP) from the path provided." < Set the secret to the hex secret key." < Set the coinbase (mining payout) address." < Export the config (.RLP) to the path provided." < Import the config (.RLP) from the path provided." < Dumps a contract to /.evm." << endl << " dumptrace Dumps a transaction trace" << endl << "to . should be one of pretty, standard, standard+." << endl << " dumpreceipt Dumps a transation receipt." << endl @@ -102,35 +105,36 @@ void help() cout << "Usage eth [OPTIONS] " << endl << "Options:" << endl - << " -a,--address Set the coinbase (mining payout) address to addr (default: auto)." << endl - << " -b,--bootstrap Connect to the default Ethereum peerserver." << endl - << " -c,--client-name Add a name to your client's version string (default: blank)." << endl - << " -d,--db-path Load database from path (default: ~/.ethereum " << endl - << " /Etherum or Library/Application Support/Ethereum)." << endl - << " -f,--force-mining Mine even when there are no transaction to mine (Default: off)" << endl - << " -h,--help Show this help message and exit." << endl - << " -i,--interactive Enter interactive mode (default: non-interactive)." << endl + << " -a,--address Set the coinbase (mining payout) address to addr (default: auto)." << endl + << " -b,--bootstrap Connect to the default Ethereum peerserver." << endl + << " -B,--block-fees Set the block fee profit in the reference unit e.g. ¢ (Default: 15)." << endl + << " -c,--client-name Add a name to your client's version string (default: blank)." << endl + << " -d,--db-path Load database from path (default: ~/.ethereum " << endl + << " /Etherum or Library/Application Support/Ethereum)." << endl + << " -e,--ether-price Set the ether price in the reference unit e.g. ¢ (Default: 30.679)." << endl + << " -f,--force-mining Mine even when there are no transaction to mine (Default: off)" << endl + << " -h,--help Show this help message and exit." << endl + << " -i,--interactive Enter interactive mode (default: non-interactive)." << endl #if ETH_JSONRPC << " -j,--json-rpc Enable JSON-RPC server (default: off)." << endl << " --json-rpc-port Specify JSON-RPC server port (implies '-j', default: 8080)." << endl #endif - << " -l,--listen Listen on the given port for incoming connected (default: 30303)." << endl - << " -m,--mining Enable mining, optionally for a specified number of blocks (Default: off)" << endl - << " -n,--upnp Use upnp for NAT (default: on)." << endl - << " -L,--local-networking Use peers whose addresses are local." << endl - << " -o,--mode Start a full node or a peer node (Default: full)." << endl - << " -p,--port Connect to remote port (default: 30303)." << endl - << " -r,--remote Connect to remote host (default: none)." << endl - << " -s,--secret Set the secret key for use with send command (default: auto)." << endl - << " --structured-logging Enables structured logging." << endl - << " --structured-logging-format Give time format string for structured logging output." << endl - << " -t,--miners Number of mining threads to start (Default: " << thread::hardware_concurrency() << ")" << endl - << " -u,--public-ip Force public ip to given (default; auto)." << endl - << " -v,--verbosity <0 - 9> Set the log verbosity from 0 to 9 (Default: 8)." << endl - << " -x,--peers Attempt to connect to given number of peers (Default: 5)." << endl - << " -V,--version Show the version and exit." << endl + << " -l,--listen Listen on the given port for incoming connected (default: 30303)." << endl + << " -L,--local-networking Use peers whose addresses are local." << endl + << " -m,--mining Enable mining, optionally for a specified number of blocks (Default: off)" << endl + << " -n,--upnp Use upnp for NAT (default: on)." << endl + << " -o,--mode Start a full node or a peer node (Default: full)." << endl + << " -p,--port Connect to remote port (default: 30303)." << endl + << " -P,--priority <0 - 100> Default % priority of a transaction (default: 50)." << endl + << " -r,--remote Connect to remote host (default: none)." << endl + << " -s,--secret Set the secret key for use with send command (default: auto)." << endl + << " -t,--miners Number of mining threads to start (Default: " << thread::hardware_concurrency() << ")" << endl + << " -u,--public-ip Force public ip to given (default; auto)." << endl + << " -v,--verbosity <0 - 9> Set the log verbosity from 0 to 9 (Default: 8)." << endl + << " -x,--peers Attempt to connect to given number of peers (Default: 5)." << endl + << " -V,--version Show the version and exit." << endl #if ETH_EVMJIT - << " --jit Use EVM JIT (default: off)." << endl + << " --jit Use EVM JIT (default: off)." << endl #endif ; exit(0); @@ -141,15 +145,14 @@ string credits(bool _interactive = false) std::ostringstream cout; cout << "Ethereum (++) " << dev::Version << endl - << " Code by Gav Wood, (c) 2013, 2014." << endl + << " Code by Gav Wood et al, (c) 2013, 2014, 2015." << endl << " Based on a design by Vitalik Buterin." << endl << endl; if (_interactive) - { - cout << "Type 'netstart 30303' to start networking" << endl; - cout << "Type 'connect " << Host::pocHost() << " 30303' to connect" << endl; - cout << "Type 'exit' to quit" << endl << endl; - } + cout + << "Type 'netstart 30303' to start networking" << endl + << "Type 'connect " << Host::pocHost() << " 30303' to connect" << endl + << "Type 'exit' to quit" << endl << endl; return cout.str(); } @@ -215,6 +218,9 @@ int main(int argc, char** argv) bool structuredLogging = false; string structuredLoggingFormat = "%Y-%m-%dT%H:%M:%S"; string clientName; + TransactionPriority priority = TransactionPriority::Medium; + double etherPrice = 30.679; + double blockFees = 15.0; // Init defaults Defaults::get(); @@ -292,6 +298,48 @@ int main(int argc, char** argv) structuredLogging = true; else if ((arg == "-d" || arg == "--path" || arg == "--db-path") && i + 1 < argc) dbPath = argv[++i]; + else if ((arg == "-B" || arg == "--block-fees") && i + 1 < argc) + { + try { + blockFees = stof(argv[++i]); + } + catch (...) { + cerr << "Bad " << arg << " option: " << argv[++i] << endl; + return -1; + } + } + else if ((arg == "-e" || arg == "--ether-price") && i + 1 < argc) + { + try { + etherPrice = stof(argv[++i]); + } + catch (...) { + cerr << "Bad " << arg << " option: " << argv[++i] << endl; + return -1; + } + } + else if ((arg == "-P" || arg == "--priority") && i + 1 < argc) + { + string m = boost::to_lower_copy(string(argv[++i])); + if (m == "lowest") + priority = TransactionPriority::Lowest; + else if (m == "low") + priority = TransactionPriority::Low; + else if (m == "medium" || m == "mid" || m == "default" || m == "normal") + priority = TransactionPriority::Medium; + else if (m == "high") + priority = TransactionPriority::High; + else if (m == "highest") + priority = TransactionPriority::Highest; + else + try { + priority = (TransactionPriority)(max(0, min(100, stoi(m))) * 8 / 100); + } + catch (...) { + cerr << "Unknown " << arg << " option: " << m << endl; + return -1; + } + } else if ((arg == "-m" || arg == "--mining") && i + 1 < argc) { string m = argv[++i]; @@ -304,7 +352,7 @@ int main(int argc, char** argv) mining = stoi(m); } catch (...) { - cerr << "Unknown -m/--mining option: " << m << endl; + cerr << "Unknown " << arg << " option: " << m << endl; return -1; } } @@ -376,10 +424,12 @@ int main(int argc, char** argv) miners ); web3.setIdealPeerCount(peers); + std::shared_ptr gasPricer = make_shared(u256(double(ether / 1000) / etherPrice), u256(blockFees * 1000)); eth::Client* c = mode == NodeMode::Full ? web3.ethereum() : nullptr; StructuredLogger::starting(clientImplString, dev::Version); if (c) { + c->setGasPricer(gasPricer); c->setForceMining(forceMining); c->setAddress(coinbase); } @@ -438,6 +488,7 @@ int main(int argc, char** argv) istringstream iss(l); string cmd; iss >> cmd; + boost::to_lower(cmd); if (cmd == "netstart") { iss >> netPrefs.listenPort; @@ -469,6 +520,42 @@ int main(int argc, char** argv) iss >> enable; c->setForceMining(isTrue(enable)); } + else if (c && cmd == "setblockfees") + { + iss >> blockFees; + gasPricer->setRefBlockFees(u256(blockFees * 1000)); + cout << "Block fees: " << blockFees << endl; + } + else if (c && cmd == "setetherprice") + { + iss >> etherPrice; + gasPricer->setRefPrice(u256(double(ether / 1000) / etherPrice)); + cout << "ether Price: " << etherPrice << endl; + } + else if (c && cmd == "setpriority") + { + string m; + iss >> m; + boost::to_lower(m); + if (m == "lowest") + priority = TransactionPriority::Lowest; + else if (m == "low") + priority = TransactionPriority::Low; + else if (m == "medium" || m == "mid" || m == "default" || m == "normal") + priority = TransactionPriority::Medium; + else if (m == "high") + priority = TransactionPriority::High; + else if (m == "highest") + priority = TransactionPriority::Highest; + else + try { + priority = (TransactionPriority)(max(0, min(100, stoi(m))) * 8 / 100); + } + catch (...) { + cerr << "Unknown priority: " << m << endl; + } + cout << "Priority: " << (int)priority << "/8" << endl; + } else if (cmd == "verbosity") { if (iss.peek() != -1) @@ -539,6 +626,9 @@ int main(int argc, char** argv) iss >> hexAddr >> amount >> gasPrice >> gas >> sechex >> sdata; + if (!gasPrice) + gasPrice = gasPricer->bid(priority); + cnote << "Data:"; cnote << sdata; bytes data = dev::eth::parseData(sdata); @@ -585,7 +675,7 @@ int main(int argc, char** argv) else cwarn << "Require parameters: transact ADDRESS AMOUNT GASPRICE GAS SECRET DATA"; } - else if (c && cmd == "listContracts") + else if (c && cmd == "listcontracts") { auto acs =c->addresses(); string ss; @@ -596,7 +686,7 @@ int main(int argc, char** argv) cout << ss << endl; } } - else if (c && cmd == "listAccounts") + else if (c && cmd == "listaccounts") { auto acs =c->addresses(); string ss; @@ -812,7 +902,7 @@ int main(int argc, char** argv) } } } - else if (cmd == "setSecret") + else if (cmd == "setsecret") { if (iss.peek() != -1) { @@ -823,7 +913,7 @@ int main(int argc, char** argv) else cwarn << "Require parameter: setSecret HEXSECRETKEY"; } - else if (cmd == "setAddress") + else if (cmd == "setaddress") { if (iss.peek() != -1) { @@ -851,7 +941,7 @@ int main(int argc, char** argv) else cwarn << "Require parameter: setAddress HEXADDRESS"; } - else if (cmd == "exportConfig") + else if (cmd == "exportconfig") { if (iss.peek() != -1) { @@ -864,7 +954,7 @@ int main(int argc, char** argv) else cwarn << "Require parameter: exportConfig PATH"; } - else if (cmd == "importConfig") + else if (cmd == "importconfig") { if (iss.peek() != -1) { diff --git a/evmjit/libevmjit-cpp/Env.cpp b/evmjit/libevmjit-cpp/Env.cpp index 11882d79d..874993c84 100644 --- a/evmjit/libevmjit-cpp/Env.cpp +++ b/evmjit/libevmjit-cpp/Env.cpp @@ -1,7 +1,7 @@ #pragma GCC diagnostic ignored "-Wconversion" #include -#include +#include #include #include "Utils.h" diff --git a/libdevcore/Base64.cpp b/libdevcore/Base64.cpp new file mode 100644 index 000000000..684556cd5 --- /dev/null +++ b/libdevcore/Base64.cpp @@ -0,0 +1,126 @@ +/* + base64.cpp and base64.h + + Copyright (C) 2004-2008 René Nyffenegger + + This source code is provided 'as-is', without any express or implied + warranty. In no event will the author be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this source code must not be misrepresented; you must not + claim that you wrote the original source code. If you use this source code + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original source code. + + 3. This notice may not be removed or altered from any source distribution. + + René Nyffenegger rene.nyffenegger@adp-gmbh.ch +*/ +/// Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c +/// Originally by René Nyffenegger, modified by some other guy and then devified by Gav Wood. + +#include "Base64.h" +#include +using namespace std; +using namespace dev; + +static const std::string base64_chars = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + +static inline bool is_base64(byte c) { + return (isalnum(c) || (c == '+') || (c == '/')); +} + +std::string dev::toBase64(bytesConstRef _in) { + std::string ret; + int i = 0; + int j = 0; + byte char_array_3[3]; + byte char_array_4[4]; + + auto buf = _in.data(); + auto bufLen = _in.size(); + + while (bufLen--) { + char_array_3[i++] = *(buf++); + if (i == 3) { + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); + char_array_4[3] = char_array_3[2] & 0x3f; + + for(i = 0; (i <4) ; i++) + ret += base64_chars[char_array_4[i]]; + i = 0; + } + } + + if (i) + { + for(j = i; j < 3; j++) + char_array_3[j] = '\0'; + + char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; + char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); + char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); + char_array_4[3] = char_array_3[2] & 0x3f; + + for (j = 0; (j < i + 1); j++) + ret += base64_chars[char_array_4[j]]; + + while((i++ < 3)) + ret += '='; + } + + return ret; +} + +bytes dev::fromBase64(std::string const& encoded_string) { + int in_len = encoded_string.size(); + int i = 0; + int j = 0; + int in_ = 0; + byte char_array_4[4], char_array_3[3]; + bytes ret; + + while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) { + char_array_4[i++] = encoded_string[in_]; in_++; + if (i ==4) { + for (i = 0; i <4; i++) + char_array_4[i] = base64_chars.find(char_array_4[i]); + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (i = 0; (i < 3); i++) + ret.push_back(char_array_3[i]); + i = 0; + } + } + + if (i) { + for (j = i; j <4; j++) + char_array_4[j] = 0; + + for (j = 0; j <4; j++) + char_array_4[j] = base64_chars.find(char_array_4[j]); + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (j = 0; (j < i - 1); j++) ret.push_back(char_array_3[j]); + } + + return ret; +} diff --git a/libdevcore/Base64.h b/libdevcore/Base64.h new file mode 100644 index 000000000..1e9c88429 --- /dev/null +++ b/libdevcore/Base64.h @@ -0,0 +1,41 @@ +/* + base64.cpp and base64.h + + Copyright (C) 2004-2008 René Nyffenegger + + This source code is provided 'as-is', without any express or implied + warranty. In no event will the author be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this source code must not be misrepresented; you must not + claim that you wrote the original source code. If you use this source code + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original source code. + + 3. This notice may not be removed or altered from any source distribution. + + René Nyffenegger rene.nyffenegger@adp-gmbh.ch +*/ +/// Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c +/// Originally by René Nyffenegger. +/// DEVified by Gav Wood. +#pragma once + +#include +#include +#include + +namespace dev +{ + +std::string toBase64(bytesConstRef _in); +bytes fromBase64(std::string const& _in); + +} diff --git a/libdevcore/Common.h b/libdevcore/Common.h index 9edeacccb..b82cb827e 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -65,6 +65,7 @@ using bytesConstRef = vector_ref; // Numeric types. using bigint = boost::multiprecision::number>; +using u64 = boost::multiprecision::number>; using u128 = boost::multiprecision::number>; using u256 = boost::multiprecision::number>; using s256 = boost::multiprecision::number>; @@ -118,6 +119,12 @@ inline unsigned int toLog2(u256 _x) return ret; } +template +inline N diff(N const& _a, N const& _b) +{ + return std::max(_a, _b) - std::min(_a, _b); +} + /// RAII utility class whose destructor calls a given function. class ScopeGuard { public: diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h index 3cdf3b449..2c9fd30ef 100644 --- a/libdevcore/CommonData.h +++ b/libdevcore/CommonData.h @@ -96,7 +96,10 @@ template inline void toBigEndian(_T _val, _Out& o_out) { for (auto i = o_out.size(); i-- != 0; _val >>= 8) - o_out[i] = (typename _Out::value_type)(uint8_t)_val; + { + _T v = _val & (_T)0xff; + o_out[i] = (typename _Out::value_type)(uint8_t)v; + } } /// Converts a big-endian byte-stream represented on a templated collection to a templated integer value. diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp index feb4121cb..4fa132073 100644 --- a/libdevcore/CommonIO.cpp +++ b/libdevcore/CommonIO.cpp @@ -57,6 +57,24 @@ string dev::memDump(bytes const& _bytes, unsigned _width, bool _html) return ret.str(); } +// Don't forget to delete[] later. +bytesRef dev::contentsNew(std::string const& _file) +{ + std::ifstream is(_file, std::ifstream::binary); + if (!is) + return bytesRef(); + // get length of file: + is.seekg (0, is.end); + streamoff length = is.tellg(); + if (length == 0) // return early, MSVC does not like reading 0 bytes + return bytesRef(); + is.seekg (0, is.beg); + bytesRef ret(new byte[length], length); + is.read((char*)ret.data(), length); + is.close(); + return ret; +} + bytes dev::contents(std::string const& _file) { std::ifstream is(_file, std::ifstream::binary); @@ -66,7 +84,7 @@ bytes dev::contents(std::string const& _file) is.seekg (0, is.end); streamoff length = is.tellg(); if (length == 0) // return early, MSVC does not like reading 0 bytes - return {}; + return bytes(); is.seekg (0, is.beg); bytes ret(length); is.read((char*)ret.data(), length); @@ -74,7 +92,25 @@ bytes dev::contents(std::string const& _file) return ret; } -void dev::writeFile(std::string const& _file, bytes const& _data) +string dev::contentsString(std::string const& _file) +{ + std::ifstream is(_file, std::ifstream::binary); + if (!is) + return string(); + // get length of file: + is.seekg (0, is.end); + streamoff length = is.tellg(); + if (length == 0) // return early, MSVC does not like reading 0 bytes + return string(); + is.seekg (0, is.beg); + string ret; + ret.resize(length); + is.read((char*)ret.data(), length); + is.close(); + return ret; +} + +void dev::writeFile(std::string const& _file, bytesConstRef _data) { ofstream(_file, ios::trunc).write((char const*)_data.data(), _data.size()); } diff --git a/libdevcore/CommonIO.h b/libdevcore/CommonIO.h index 23092b702..03fc9cffc 100644 --- a/libdevcore/CommonIO.h +++ b/libdevcore/CommonIO.h @@ -36,15 +36,22 @@ #include #include #include "Common.h" +#include "Base64.h" namespace dev { /// Retrieve and returns the contents of the given file. If the file doesn't exist or isn't readable, returns an empty bytes. bytes contents(std::string const& _file); +std::string contentsString(std::string const& _file); +/// Retrieve and returns the allocated contents of the given file. If the file doesn't exist or isn't readable, returns nullptr. Don't forget to delete [] when finished. +bytesRef contentsNew(std::string const& _file); /// Write the given binary data into the given file, replacing the file if it pre-exists. -void writeFile(std::string const& _file, bytes const& _data); +void writeFile(std::string const& _file, bytesConstRef _data); +/// Write the given binary data into the given file, replacing the file if it pre-exists. +inline void writeFile(std::string const& _file, bytes const& _data) { writeFile(_file, bytesConstRef(&_data)); } +inline void writeFile(std::string const& _file, std::string const& _data) { writeFile(_file, bytesConstRef(_data)); } /// Nicely renders the given bytes to a string, optionally as HTML. /// @a _bytes: bytes array to be rendered as string. @a _width of a bytes line. diff --git a/libdevcore/CommonJS.cpp b/libdevcore/CommonJS.cpp new file mode 100644 index 000000000..f173e779e --- /dev/null +++ b/libdevcore/CommonJS.cpp @@ -0,0 +1,101 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file CommonJS.cpp + * @authors: + * Gav Wood + * Marek Kotewicz + * @date 2014 + */ + +#include "CommonJS.h" + +namespace dev +{ + +bytes jsToBytes(std::string const& _s) +{ + if (_s.substr(0, 2) == "0x") + // Hex + return fromHex(_s.substr(2)); + else if (_s.find_first_not_of("0123456789") == std::string::npos) + // Decimal + return toCompactBigEndian(bigint(_s)); + else + return bytes(); +} + +bytes padded(bytes _b, unsigned _l) +{ + while (_b.size() < _l) + _b.insert(_b.begin(), 0); + return asBytes(asString(_b).substr(_b.size() - std::max(_l, _l))); +} + +bytes paddedRight(bytes _b, unsigned _l) +{ + _b.resize(_l); + return _b; +} + +bytes unpadded(bytes _b) +{ + auto p = asString(_b).find_last_not_of((char)0); + _b.resize(p == std::string::npos ? 0 : (p + 1)); + return _b; +} + +bytes unpadLeft(bytes _b) +{ + unsigned int i = 0; + if (_b.size() == 0) + return _b; + + while (i < _b.size() && _b[i] == byte(0)) + i++; + + if (i != 0) + _b.erase(_b.begin(), _b.begin() + i); + return _b; +} + +std::string fromRaw(h256 _n, unsigned* _inc) +{ + if (_n) + { + std::string s((char const*)_n.data(), 32); + auto l = s.find_first_of('\0'); + if (!l) + return ""; + if (l != std::string::npos) + { + auto p = s.find_first_not_of('\0', l); + if (!(p == std::string::npos || (_inc && p == 31))) + return ""; + if (_inc) + *_inc = (byte)s[31]; + s.resize(l); + } + for (auto i: s) + if (i < 32) + return ""; + return s; + } + return ""; +} + +} + diff --git a/libdevcore/CommonJS.h b/libdevcore/CommonJS.h new file mode 100644 index 000000000..d3e8e6daa --- /dev/null +++ b/libdevcore/CommonJS.h @@ -0,0 +1,116 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file CommonJS.h + * @authors: + * Gav Wood + * Marek Kotewicz + * @date 2014 + */ + +#pragma once + +#include +#include "FixedHash.h" +#include "CommonData.h" +#include "CommonIO.h" + +namespace dev +{ + +template std::string toJS(FixedHash const& _h) +{ + return "0x" + toHex(_h.ref()); +} + +template std::string toJS(boost::multiprecision::number> const& _n) +{ + return "0x" + toHex(toCompactBigEndian(_n)); +} + +inline std::string toJS(dev::bytes const& _n) +{ + return "0x" + dev::toHex(_n); +} + +/// Convert string to byte array. Input parameters can be hex or dec. Returns empty array if invalid input e.g neither dec or hex. +bytes jsToBytes(std::string const& _s); +/// Add '0' on the head of @a _b until @a _l. +bytes padded(bytes _b, unsigned _l); +/// Add '0' on the queue of @a _b until @a _l. +bytes paddedRight(bytes _b, unsigned _l); +/// Removing all trailing '0'. Returns empty array if input contains only '0' char. +bytes unpadded(bytes _s); +/// Remove all 0 byte on the head of @a _s. +bytes unpadLeft(bytes _s); +/// Convert h256 into user-readable string (by directly using std::string constructor). +std::string fromRaw(h256 _n, unsigned* _inc = nullptr); + +template FixedHash jsToFixed(std::string const& _s) +{ + if (_s.substr(0, 2) == "0x") + // Hex + return FixedHash(_s.substr(2 + std::max(N * 2, _s.size() - 2) - N * 2)); + else if (_s.find_first_not_of("0123456789") == std::string::npos) + // Decimal + return (typename FixedHash::Arith)(_s); + else + // Binary + return FixedHash(); // FAIL +} + +inline std::string jsToFixed(double _s) +{ + return toJS(dev::u256(_s * (double)(dev::u256(1) << 128))); +} + +template boost::multiprecision::number> jsToInt(std::string const& _s) +{ + if (_s.substr(0, 2) == "0x") + // Hex + return fromBigEndian>>(fromHex(_s.substr(2))); + else if (_s.find_first_not_of("0123456789") == std::string::npos) + // Decimal + return boost::multiprecision::number>(_s); + else + // Binary + return 0; // FAIL +} + +inline u256 jsToU256(std::string const& _s) { return jsToInt<32>(_s); } + +inline std::string jsToDecimal(std::string const& _s) +{ + return dev::toString(jsToU256(_s)); +} + +inline std::string jsFromBinary(dev::bytes _s, unsigned _padding = 32) +{ + _s.resize(std::max(_s.size(), _padding)); + return "0x" + dev::toHex(_s); +} + +inline std::string jsFromBinary(std::string const& _s, unsigned _padding = 32) +{ + return jsFromBinary(asBytes(_s), _padding); +} + +inline double jsFromFixed(std::string const& _s) +{ + return (double)jsToU256(_s) / (double)(dev::u256(1) << 128); +} + +} diff --git a/libdevcore/Exceptions.h b/libdevcore/Exceptions.h index f3f9b1bf0..8398f9c7f 100644 --- a/libdevcore/Exceptions.h +++ b/libdevcore/Exceptions.h @@ -31,7 +31,14 @@ namespace dev { // base class for all exceptions -struct Exception: virtual std::exception, virtual boost::exception { mutable std::string m_message; }; +struct Exception: virtual std::exception, virtual boost::exception +{ + Exception(std::string _message = {}): m_message(std::move(_message)) {} + const char* what() const noexcept override { return m_message.empty() ? std::exception::what() : m_message.c_str(); } + +private: + std::string m_message; +}; struct BadHexCharacter: virtual Exception {}; struct RLPException: virtual Exception {}; @@ -40,8 +47,9 @@ struct BadRLP: virtual RLPException {}; struct NoNetworking: virtual Exception {}; struct NoUPnPDevice: virtual Exception {}; struct RootNotFound: virtual Exception {}; +struct BadRoot: virtual Exception {}; struct FileError: virtual Exception {}; -struct InterfaceNotSupported: virtual Exception { public: InterfaceNotSupported(std::string _f): m_f("Interface " + _f + " not supported.") {} virtual const char* what() const noexcept { return m_f.c_str(); } private: std::string m_f; }; +struct InterfaceNotSupported: virtual Exception { public: InterfaceNotSupported(std::string _f): Exception("Interface " + _f + " not supported.") {} }; // error information to be added to exceptions using errinfo_invalidSymbol = boost::error_info; @@ -49,5 +57,9 @@ using errinfo_wrongAddress = boost::error_info; using errinfo_comment = boost::error_info; using errinfo_required = boost::error_info; using errinfo_got = boost::error_info; +using errinfo_min = boost::error_info; +using errinfo_max = boost::error_info; using RequirementError = boost::tuple; +using errinfo_hash256 = boost::error_info; +using HashMismatchError = boost::tuple; } diff --git a/libdevcore/FixedHash.cpp b/libdevcore/FixedHash.cpp index 0369ea854..ae2d77c85 100644 --- a/libdevcore/FixedHash.cpp +++ b/libdevcore/FixedHash.cpp @@ -25,4 +25,4 @@ using namespace std; using namespace dev; -std::mt19937_64 dev::s_fixedHashEngine(time(0)); +std::random_device dev::s_fixedHashEngine; diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index 2b4e6bc08..49c6ed2bf 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -31,7 +31,7 @@ namespace dev { -extern std::mt19937_64 s_fixedHashEngine; +extern std::random_device s_fixedHashEngine; /// Fixed-size raw-byte array container type, with an API optimised for storing hashes. /// Transparently converts to/from the corresponding arithmetic type; this will @@ -53,7 +53,7 @@ public: enum ConstructFromStringType { FromHex, FromBinary }; /// Method to convert from a string. - enum ConstructFromHashType { AlignLeft, AlignRight }; + enum ConstructFromHashType { AlignLeft, AlignRight, FailIfDifferent }; /// Construct an empty hash. FixedHash() { m_data.fill(0); } @@ -65,16 +65,16 @@ public: FixedHash(Arith const& _arith) { toBigEndian(_arith, m_data); } /// Explicitly construct, copying from a byte array. - explicit FixedHash(bytes const& _b) { if (_b.size() == N) memcpy(m_data.data(), _b.data(), std::min(_b.size(), N)); } + explicit FixedHash(bytes const& _b, ConstructFromHashType _t = FailIfDifferent) { if (_b.size() == N) memcpy(m_data.data(), _b.data(), std::min(_b.size(), N)); else { m_data.fill(0); if (_t != FailIfDifferent) { auto c = std::min(_b.size(), N); for (unsigned i = 0; i < c; ++i) m_data[_t == AlignRight ? N - 1 - i : i] = _b[_t == AlignRight ? _b.size() - 1 - i : i]; } } } /// Explicitly construct, copying from a byte array. - explicit FixedHash(bytesConstRef _b) { if (_b.size() == N) memcpy(m_data.data(), _b.data(), std::min(_b.size(), N)); } + explicit FixedHash(bytesConstRef _b, ConstructFromHashType _t = FailIfDifferent) { if (_b.size() == N) memcpy(m_data.data(), _b.data(), std::min(_b.size(), N)); else { m_data.fill(0); if (_t != FailIfDifferent) { auto c = std::min(_b.size(), N); for (unsigned i = 0; i < c; ++i) m_data[_t == AlignRight ? N - 1 - i : i] = _b[_t == AlignRight ? _b.size() - 1 - i : i]; } } } /// Explicitly construct, copying from a bytes in memory with given pointer. explicit FixedHash(byte const* _bs, ConstructFromPointerType) { memcpy(m_data.data(), _bs, N); } /// Explicitly construct, copying from a string. - explicit FixedHash(std::string const& _s, ConstructFromStringType _t = FromHex): FixedHash(_t == FromHex ? fromHex(_s) : dev::asBytes(_s)) {} + explicit FixedHash(std::string const& _s, ConstructFromStringType _t = FromHex, ConstructFromHashType _ht = FailIfDifferent): FixedHash(_t == FromHex ? fromHex(_s) : dev::asBytes(_s), _ht) {} /// Convert to arithmetic type. operator Arith() const { return fromBigEndian(m_data); } @@ -85,8 +85,8 @@ public: // The obvious comparison operators. bool operator==(FixedHash const& _c) const { return m_data == _c.m_data; } bool operator!=(FixedHash const& _c) const { return m_data != _c.m_data; } - bool operator<(FixedHash const& _c) const { return m_data < _c.m_data; } - bool operator>=(FixedHash const& _c) const { return m_data >= _c.m_data; } + bool operator<(FixedHash const& _c) const { for (unsigned i = 0; i < N; ++i) if (m_data[i] < _c.m_data[i]) return true; else if (m_data[i] > _c.m_data[i]) return false; return false; } + bool operator>=(FixedHash const& _c) const { return !operator<(_c); } // The obvious binary operators. FixedHash& operator^=(FixedHash const& _c) { for (unsigned i = 0; i < N; ++i) m_data[i] ^= _c.m_data[i]; return *this; } @@ -240,11 +240,14 @@ inline std::ostream& operator<<(std::ostream& _out, FixedHash const& _h) } // Common types of FixedHash. +using h2048 = FixedHash<256>; +using h1024 = FixedHash<128>; using h520 = FixedHash<65>; using h512 = FixedHash<64>; using h256 = FixedHash<32>; using h160 = FixedHash<20>; using h128 = FixedHash<16>; +using h64 = FixedHash<8>; using h512s = std::vector; using h256s = std::vector; using h160s = std::vector; diff --git a/libdevcore/vector_ref.h b/libdevcore/vector_ref.h index 42633f6f1..2c5f07e51 100644 --- a/libdevcore/vector_ref.h +++ b/libdevcore/vector_ref.h @@ -23,7 +23,7 @@ public: vector_ref(typename std::conditional::value, std::vector::type> const*, std::vector<_T>*>::type _data): m_data(_data->data()), m_count(_data->size()) {} vector_ref(typename std::conditional::value, std::string const&, std::string&>::type _data): m_data((_T*)_data.data()), m_count(_data.size() / sizeof(_T)) {} #ifdef STORAGE_LEVELDB_INCLUDE_DB_H_ - vector_ref(leveldb::Slice const& _s): m_data(_s.data()), m_count(_s.size() / sizeof(_T)) {} + vector_ref(leveldb::Slice const& _s): m_data(reinterpret_cast<_T*>(_s.data())), m_count(_s.size() / sizeof(_T)) {} #endif explicit operator bool() const { return m_data && m_count; } diff --git a/libdevcrypto/MemoryDB.cpp b/libdevcrypto/MemoryDB.cpp index 4fc4ed9ad..56b77ddee 100644 --- a/libdevcrypto/MemoryDB.cpp +++ b/libdevcrypto/MemoryDB.cpp @@ -107,7 +107,7 @@ set MemoryDB::keys() const { set ret; for (auto const& i: m_refCount) - if (i.second) + if (i.second && h128(i.first.ref().cropped(0, 16))) ret.insert(i.first); return ret; } diff --git a/libdevcrypto/MemoryDB.h b/libdevcrypto/MemoryDB.h index 4b8d3b3a2..7d39ba73b 100644 --- a/libdevcrypto/MemoryDB.h +++ b/libdevcrypto/MemoryDB.h @@ -26,6 +26,7 @@ #include #include #include +#include "SHA3.h" namespace dev { @@ -50,11 +51,19 @@ public: bool kill(h256 _h); void purge(); + bytes lookupAux(h256 _h) const { auto h = aux(_h); return m_aux.count(h) ? m_aux.at(h) : bytes(); } + void removeAux(h256 _h) { m_auxActive.erase(aux(_h)); } + void insertAux(h256 _h, bytesConstRef _v) { auto h = aux(_h); m_auxActive.insert(h); m_aux[h] = _v.toBytes(); } + std::set keys() const; protected: + static h256 aux(h256 _k) { return h256(sha3(_k).ref().cropped(0, 24), h256::AlignLeft); } + std::map m_over; std::map m_refCount; + std::set m_auxActive; + std::map m_aux; mutable bool m_enforceRefs = false; }; diff --git a/libdevcrypto/OverlayDB.cpp b/libdevcrypto/OverlayDB.cpp index 9e110bb84..4bd698f57 100644 --- a/libdevcrypto/OverlayDB.cpp +++ b/libdevcrypto/OverlayDB.cpp @@ -19,6 +19,7 @@ * @date 2014 */ +#include #include #include "OverlayDB.h" using namespace std; @@ -51,11 +52,31 @@ void OverlayDB::commit() if (m_refCount[i.first]) m_db->Put(m_writeOptions, ldb::Slice((char const*)i.first.data(), i.first.size), ldb::Slice(i.second.data(), i.second.size())); } + for (auto const& i: m_auxActive) + if (m_aux.count(i)) + { + m_db->Put(m_writeOptions, i.ref(), bytesConstRef(&m_aux[i])); + m_aux.erase(i); + } + m_auxActive.clear(); + m_aux.clear(); m_over.clear(); m_refCount.clear(); } } +bytes OverlayDB::lookupAux(h256 _h) const +{ + bytes ret = MemoryDB::lookupAux(_h); + if (!ret.empty()) + return ret; + std::string v; + m_db->Get(m_readOptions, aux(_h).ref(), &v); + if (v.empty()) + cwarn << "Aux not found: " << _h; + return asBytes(v); +} + void OverlayDB::rollback() { m_over.clear(); diff --git a/libdevcrypto/OverlayDB.h b/libdevcrypto/OverlayDB.h index e9bd53343..d027afbd4 100644 --- a/libdevcrypto/OverlayDB.h +++ b/libdevcrypto/OverlayDB.h @@ -51,6 +51,8 @@ public: bool exists(h256 _h) const; void kill(h256 _h); + bytes lookupAux(h256 _h) const; + private: using MemoryDB::clear; diff --git a/libdevcrypto/TrieDB.h b/libdevcrypto/TrieDB.h index f5b7ff9c9..ccb9a2768 100644 --- a/libdevcrypto/TrieDB.h +++ b/libdevcrypto/TrieDB.h @@ -62,17 +62,21 @@ extern const h256 EmptyTrie; * assert(t.isEmpty()); * @endcode */ -template +template class GenericTrieDB { public: - GenericTrieDB(DB* _db): m_db(_db) {} + using DB = _DB; + + GenericTrieDB(DB* _db = nullptr): m_db(_db) {} GenericTrieDB(DB* _db, h256 _root) { open(_db, _root); } ~GenericTrieDB() {} + void open(DB* _db) { m_db = _db; } void open(DB* _db, h256 _root) { m_db = _db; setRoot(_root); } - void init(); + void init() { setRoot(insertNode(&RLPNull)); assert(node(m_root).size()); } + void setRoot(h256 _root) { m_root = _root; @@ -83,14 +87,13 @@ public: if (!node(m_root).size()) BOOST_THROW_EXCEPTION(RootNotFound()); } - bool haveRoot(h256 _root, bool _enforceRefs = true) { return _root == c_shaNull ? true : m_db->lookup(_root, _enforceRefs).size(); } /// True if the trie is uninitialised (i.e. that the DB doesn't contain the root node). bool isNull() const { return !node(m_root).size(); } /// True if the trie is initialised but empty (i.e. that the DB contains the root node which is empty). bool isEmpty() const { return m_root == c_shaNull && node(m_root).size(); } - h256 root() const { assert(node(m_root).size()); /*std::cout << "Returning root as " << ret << " (really " << m_root << ")" << std::endl;*/ return m_root; } // patch the root in the case of the empty trie. TODO: handle this properly. + h256 root() const { if (!node(m_root).size()) BOOST_THROW_EXCEPTION(BadRoot()); /*std::cout << "Returning root as " << ret << " (really " << m_root << ")" << std::endl;*/ return m_root; } // patch the root in the case of the empty trie. TODO: handle this properly. void debugPrint() {} @@ -211,6 +214,9 @@ public: iterator lower_bound(bytesConstRef _key) const { return iterator(this, _key); } +protected: + DB* db() const { return m_db; } + private: RLPStream& streamNode(RLPStream& _s, bytes const& _b); @@ -281,30 +287,33 @@ std::ostream& operator<<(std::ostream& _out, GenericTrieDB const& _db) return _out; } -template -class TrieDB: public GenericTrieDB +template +class SpecificTrieDB: public Generic { public: - TrieDB(DB* _db): GenericTrieDB(_db) {} - TrieDB(DB* _db, h256 _root): GenericTrieDB(_db, _root) {} + using DB = typename Generic::DB; + using KeyType = _KeyType; + + SpecificTrieDB(DB* _db = nullptr): Generic(_db) {} + SpecificTrieDB(DB* _db, h256 _root): Generic(_db, _root) {} std::string operator[](KeyType _k) const { return at(_k); } - bool contains(KeyType _k) const { return GenericTrieDB::contains(bytesConstRef((byte const*)&_k, sizeof(KeyType))); } - std::string at(KeyType _k) const { return GenericTrieDB::at(bytesConstRef((byte const*)&_k, sizeof(KeyType))); } - void insert(KeyType _k, bytesConstRef _value) { GenericTrieDB::insert(bytesConstRef((byte const*)&_k, sizeof(KeyType)), _value); } + bool contains(KeyType _k) const { return Generic::contains(bytesConstRef((byte const*)&_k, sizeof(KeyType))); } + std::string at(KeyType _k) const { return Generic::at(bytesConstRef((byte const*)&_k, sizeof(KeyType))); } + void insert(KeyType _k, bytesConstRef _value) { Generic::insert(bytesConstRef((byte const*)&_k, sizeof(KeyType)), _value); } void insert(KeyType _k, bytes const& _value) { insert(_k, bytesConstRef(&_value)); } - void remove(KeyType _k) { GenericTrieDB::remove(bytesConstRef((byte const*)&_k, sizeof(KeyType))); } + void remove(KeyType _k) { Generic::remove(bytesConstRef((byte const*)&_k, sizeof(KeyType))); } - class iterator: public GenericTrieDB::iterator + class iterator: public Generic::iterator { public: - using Super = typename GenericTrieDB::iterator; + using Super = typename Generic::iterator; using value_type = std::pair; iterator() {} - iterator(TrieDB const* _db): Super(_db) {} - iterator(TrieDB const* _db, bytesConstRef _k): Super(_db, _k) {} + iterator(Generic const* _db): Super(_db) {} + iterator(Generic const* _db, bytesConstRef _k): Super(_db, _k) {} value_type operator*() const { return at(); } value_type operator->() const { return at(); } @@ -317,14 +326,118 @@ public: iterator lower_bound(KeyType _k) const { return iterator(this, bytesConstRef((byte const*)&_k, sizeof(KeyType))); } }; -template -std::ostream& operator<<(std::ostream& _out, TrieDB const& _db) +template +std::ostream& operator<<(std::ostream& _out, SpecificTrieDB const& _db) { for (auto const& i: _db) _out << i.first << ": " << escaped(i.second.toString(), false) << std::endl; return _out; } +template +class HashedGenericTrieDB: private SpecificTrieDB, h256> +{ + using Super = SpecificTrieDB, h256>; + +public: + using DB = _DB; + + HashedGenericTrieDB(DB* _db = nullptr): Super(_db) {} + HashedGenericTrieDB(DB* _db, h256 _root): Super(_db, _root) {} + + using Super::open; + using Super::init; + using Super::setRoot; + + /// True if the trie is uninitialised (i.e. that the DB doesn't contain the root node). + using Super::isNull; + /// True if the trie is initialised but empty (i.e. that the DB contains the root node which is empty). + using Super::isEmpty; + + using Super::root; + + using Super::leftOvers; + using Super::check; + + std::string at(bytesConstRef _key) const { return Super::at(sha3(_key)); } + bool contains(bytesConstRef _key) { return Super::contains(sha3(_key)); } + void insert(bytesConstRef _key, bytesConstRef _value) { Super::insert(sha3(_key), _value); } + void remove(bytesConstRef _key) { Super::remove(sha3(_key)); } + + // empty from the PoV of the iterator interface; still need a basic iterator impl though. + class iterator + { + public: + using value_type = std::pair; + + iterator() {} + iterator(HashedGenericTrieDB const*) {} + iterator(HashedGenericTrieDB const*, bytesConstRef) {} + + iterator& operator++() { return *this; } + value_type operator*() const { return value_type(); } + value_type operator->() const { return value_type(); } + + bool operator==(iterator const&) const { return true; } + bool operator!=(iterator const&) const { return false; } + + value_type at() const { return value_type(); } + }; + iterator begin() const { return iterator(); } + iterator end() const { return iterator(); } + iterator lower_bound(bytesConstRef) const { return iterator(); } +}; + +// Hashed & Basic +template +class FatGenericTrieDB: public GenericTrieDB +{ + using Super = GenericTrieDB; + +public: + FatGenericTrieDB(DB* _db): Super(_db), m_secure(_db) {} + FatGenericTrieDB(DB* _db, h256 _root) { open(_db, _root); } + + void open(DB* _db, h256 _root) { Super::open(_db); m_secure.open(_db); setRoot(_root); } + + void init() { Super::init(); m_secure.init(); syncRoot(); } + + void setRoot(h256 _root) + { + if (!m_secure.isNull()) + Super::db()->removeAux(m_secure.root()); + m_secure.setRoot(_root); + auto rb = Super::db()->lookupAux(m_secure.root()); + auto r = h256(rb); + Super::setRoot(r); + } + + h256 root() const { return m_secure.root(); } + + void insert(bytesConstRef _key, bytesConstRef _value) { Super::insert(_key, _value); m_secure.insert(_key, _value); syncRoot(); } + void remove(bytesConstRef _key) { Super::remove(_key); m_secure.remove(_key); syncRoot(); } + + std::set leftOvers(std::ostream* = nullptr) const { return std::set{}; } + bool check(bool) const { return m_secure.check(false) && Super::check(false); } + +private: + void syncRoot() + { + // Root changed. Need to record the mapping so we can determine on setRoot. + Super::db()->insertAux(m_secure.root(), Super::root().ref()); + } + + HashedGenericTrieDB m_secure; +}; + +template using TrieDB = SpecificTrieDB, KeyType>; + +#if ETH_FATDB +template using SecureTrieDB = SpecificTrieDB, KeyType>; +#else +template using SecureTrieDB = SpecificTrieDB, KeyType>; +#endif + } // Template implementations... @@ -593,7 +706,7 @@ template void GenericTrieDB::iterator::next() } } -template typename TrieDB::iterator::value_type TrieDB::iterator::at() const +template typename SpecificTrieDB::iterator::value_type SpecificTrieDB::iterator::at() const { auto p = Super::at(); value_type ret; @@ -603,13 +716,6 @@ template typename TrieDB::iterator::value return ret; } -template void GenericTrieDB::init() -{ - m_root = insertNode(&RLPNull); -// std::cout << "Initialised root to " << m_root << std::endl; - assert(node(m_root).size()); -} - template void GenericTrieDB::insert(bytesConstRef _key, bytesConstRef _value) { #if ETH_PARANOIA diff --git a/libethash/CMakeLists.txt b/libethash/CMakeLists.txt new file mode 100644 index 000000000..7bc147af7 --- /dev/null +++ b/libethash/CMakeLists.txt @@ -0,0 +1,39 @@ +set(LIBRARY ethash) + +if (CPPETHEREUM) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") +#else () +endif () + +set(CMAKE_BUILD_TYPE Release) + +if (NOT MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") +endif() + +set(FILES util.c + util.h + internal.c + ethash.h + endian.h + compiler.h + fnv.h + data_sizes.h) + +if (NOT CRYPTOPP_FOUND) + find_package(CryptoPP 5.6.2) +endif() + +if (CRYPTOPP_FOUND) + add_definitions(-DWITH_CRYPTOPP) + include_directories( ${CRYPTOPP_INCLUDE_DIRS} ) + list(APPEND FILES sha3_cryptopp.cpp sha3_cryptopp.h) +else() + list(APPEND FILES sha3.c sha3.h) +endif() + +add_library(${LIBRARY} ${FILES}) + +if (CRYPTOPP_FOUND) + TARGET_LINK_LIBRARIES(${LIBRARY} ${CRYPTOPP_LIBRARIES}) +endif() diff --git a/libethash/compiler.h b/libethash/compiler.h new file mode 100644 index 000000000..9695871cd --- /dev/null +++ b/libethash/compiler.h @@ -0,0 +1,33 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file compiler.h + * @date 2014 + */ +#pragma once + +// Visual Studio doesn't support the inline keyword in C mode +#if defined(_MSC_VER) && !defined(__cplusplus) +#define inline __inline +#endif + +// pretend restrict is a standard keyword +#if defined(_MSC_VER) +#define restrict __restrict +#else +#define restrict __restrict__ +#endif + diff --git a/libethash/data_sizes.h b/libethash/data_sizes.h new file mode 100644 index 000000000..ccdf554a8 --- /dev/null +++ b/libethash/data_sizes.h @@ -0,0 +1,247 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software FoundationUUU,either version 3 of the LicenseUUU,or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be usefulU, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If notUUU,see . +*/ + +/** @file data_sizes.h +* @author Matthew Wampler-Doty +* @date 2015 +*/ + +// TODO: Update this after ~3.5 years + +#pragma once + +#include +#include "compiler.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +// 500 Epochs worth of tabulated DAG sizes (~3.5 Years) + +// Generated with the following Mathematica Code: +// GetDataSizes[n_] := Module[{ +// DAGSizeBytesInit = 2^30, +// MixBytes = 128, +// DAGGrowth = 113000000, +// j = 0}, +// Reap[ +// While[j < n, +// Module[{i = +// Floor[(DAGSizeBytesInit + DAGGrowth * j) / MixBytes]}, +// While[! PrimeQ[i], i--]; +// Sow[i*MixBytes]; j++]]]][[2]][[1]] + +static const size_t dag_sizes[] = { + 1073739904U, 1186739584U, 1299741568U, 1412741248U, 1525741696U, + 1638736768U, 1751741312U, 1864740736U, 1977740672U, 2090740864U, + 2203740544U, 2316741248U, 2429739392U, 2542740352U, 2655741824U, + 2768739712U, 2881740416U, 2994741632U, 3107740544U, 3220741504U, + 3333738112U, 3446741632U, 3559741312U, 3672740224U, 3785740928U, + 3898738304U, 4011741824U, 4124739712U, 4237735808U, 4350740864U, + 4463741824U, 4576741504U, 4689741184U, 4802739328U, 4915741568U, + 5028740224U, 5141740672U, 5254738304U, 5367741824U, 5480737664U, + 5593738112U, 5706741632U, 5819740544U, 5932734592U, 6045739904U, + 6158740096U, 6271740032U, 6384731776U, 6497732992U, 6610740352U, + 6723741056U, 6836741504U, 6949740416U, 7062740096U, 7175741824U, + 7288740224U, 7401741184U, 7514741632U, 7627741568U, 7740739712U, + 7853739136U, 7966740352U, 8079741568U, 8192739712U, 8305738624U, + 8418740864U, 8531740288U, 8644740736U, 8757735808U, 8870738816U, + 8983739264U, 9096740992U, 9209740928U, 9322739584U, 9435741824U, + 9548741504U, 9661739392U, 9774738304U, 9887741312U, 10000738688U, + 10113739136U, 10226741632U, 10339739776U, 10452741248U, 10565740928U, + 10678736512U, 10791734656U, 10904741248U, 11017738112U, 11130741632U, + 11243741312U, 11356739456U, 11469740416U, 11582734976U, 11695739008U, + 11808741248U, 11921734784U, 12034739072U, 12147741568U, 12260737408U, + 12373741696U, 12486738304U, 12599740544U, 12712740224U, 12825741184U, + 12938736256U, 13051741312U, 13164737408U, 13277738368U, 13390738048U, + 13503741824U, 13616741504U, 13729737088U, 13842740096U, 13955741312U, + 14068741504U, 14181740416U, 14294741632U, 14407739776U, 14520740224U, + 14633740928U, 14746736512U, 14859741824U, 14972740736U, 15085740928U, + 15198738304U, 15311732096U, 15424740736U, 15537739904U, 15650741632U, + 15763741568U, 15876737152U, 15989741696U, 16102740608U, 16215741056U, + 16328741248U, 16441740416U, 16554737792U, 16667740288U, 16780740992U, + 16893738112U, 17006741632U, 17119739008U, 17232735616U, 17345739392U, + 17458740352U, 17571736192U, 17684739712U, 17797739392U, 17910740096U, + 18023741312U, 18136740736U, 18249738112U, 18362738816U, 18475735424U, + 18588740224U, 18701738368U, 18814736768U, 18927737216U, 19040739968U, + 19153739648U, 19266736768U, 19379737984U, 19492739456U, 19605738368U, + 19718740352U, 19831741312U, 19944736384U, 20057741696U, 20170741376U, + 20283741824U, 20396737408U, 20509741696U, 20622741376U, 20735739008U, + 20848741504U, 20961740672U, 21074739328U, 21187740032U, 21300739456U, + 21413741696U, 21526740608U, 21639741824U, 21752737408U, 21865741696U, + 21978741376U, 22091741824U, 22204738432U, 22317740672U, 22430740096U, + 22543736704U, 22656741248U, 22769739904U, 22882739584U, 22995740288U, + 23108740736U, 23221740928U, 23334741376U, 23447737216U, 23560740992U, + 23673741184U, 23786740864U, 23899737728U, 24012741248U, 24125734784U, + 24238736512U, 24351741824U, 24464740736U, 24577737088U, 24690741632U, + 24803739776U, 24916740736U, 25029740416U, 25142740864U, 25255741568U, + 25368741248U, 25481740672U, 25594741376U, 25707741568U, 25820741504U, + 25933730432U, 26046739072U, 26159741824U, 26272741504U, 26385740672U, + 26498740096U, 26611741568U, 26724740992U, 26837739904U, 26950735232U, + 27063738496U, 27176741248U, 27289741184U, 27402740864U, 27515740544U, + 27628737152U, 27741740672U, 27854741632U, 27967740544U, 28080739712U, + 28193738368U, 28306741376U, 28419737728U, 28532739968U, 28645739648U, + 28758740096U, 28871741312U, 28984739456U, 29097740416U, 29210740864U, + 29323741312U, 29436740224U, 29549741696U, 29662738304U, 29775741568U, + 29888741504U, 30001740928U, 30114737024U, 30227735168U, 30340737664U, + 30453738368U, 30566737024U, 30679733632U, 30792740224U, 30905740928U, + 31018740352U, 31131740032U, 31244738944U, 31357737344U, 31470741376U, + 31583740544U, 31696740224U, 31809738112U, 31922739328U, 32035737472U, + 32148740992U, 32261741696U, 32374740352U, 32487741824U, 32600740736U, + 32713739648U, 32826740608U, 32939729792U, 33052740992U, 33165740672U, + 33278739584U, 33391741312U, 33504739712U, 33617740928U, 33730740608U, + 33843738496U, 33956739968U, 34069741696U, 34182739328U, 34295741824U, + 34408739968U, 34521740672U, 34634736512U, 34747741568U, 34860741248U, + 34973739392U, 35086738304U, 35199741056U, 35312736896U, 35425741184U, + 35538741376U, 35651740288U, 35764737152U, 35877741184U, 35990739584U, + 36103740544U, 36216740992U, 36329739392U, 36442737536U, 36555741568U, + 36668740736U, 36781741184U, 36894737024U, 37007741312U, 37120739456U, + 37233741184U, 37346736256U, 37459736192U, 37572734336U, 37685739904U, + 37798740352U, 37911737728U, 38024741504U, 38137739648U, 38250740608U, + 38363741824U, 38476740992U, 38589741184U, 38702740096U, 38815741312U, + 38928741248U, 39041738368U, 39154739584U, 39267741824U, 39380739712U, + 39493735808U, 39606741632U, 39719741312U, 39832741504U, 39945739648U, + 40058740352U, 40171740032U, 40284740992U, 40397740672U, 40510740352U, + 40623740288U, 40736738176U, 40849737856U, 40962741376U, 41075739776U, + 41188737664U, 41301735808U, 41414738048U, 41527741312U, 41640740992U, + 41753739904U, 41866739072U, 41979738496U, 42092740736U, 42205739648U, + 42318740608U, 42431741312U, 42544738688U, 42657741184U, 42770738048U, + 42883741568U, 42996741248U, 43109740928U, 43222736512U, 43335741056U, + 43448730496U, 43561740416U, 43674741632U, 43787740544U, 43900741504U, + 44013739648U, 44126740864U, 44239740544U, 44352741248U, 44465738368U, + 44578735232U, 44691739264U, 44804741504U, 44917741696U, 45030741376U, + 45143741824U, 45256740992U, 45369739136U, 45482740096U, 45595739776U, + 45708739712U, 45821740672U, 45934741376U, 46047741056U, 46160741248U, + 46273737088U, 46386740864U, 46499739008U, 46612739968U, 46725735296U, + 46838740864U, 46951741568U, 47064737152U, 47177741696U, 47290741376U, + 47403738752U, 47516741248U, 47629739648U, 47742741632U, 47855737984U, + 47968740224U, 48081738368U, 48194741632U, 48307739264U, 48420739712U, + 48533739136U, 48646738304U, 48759741824U, 48872741504U, 48985739392U, + 49098741376U, 49211741056U, 49324740992U, 49437738368U, 49550740864U, + 49663735424U, 49776737408U, 49889740672U, 50002738816U, 50115738752U, + 50228739712U, 50341741696U, 50454736768U, 50567738752U, 50680739968U, + 50793736832U, 50906734976U, 51019741568U, 51132739456U, 51245741696U, + 51358741376U, 51471741056U, 51584738944U, 51697734272U, 51810739072U, + 51923736448U, 52036740736U, 52149741184U, 52262737024U, 52375738496U, + 52488740992U, 52601739136U, 52714740352U, 52827736448U, 52940738176U, + 53053741696U, 53166740864U, 53279741824U, 53392741504U, 53505739136U, + 53618739584U, 53731741312U, 53844741248U, 53957741696U, 54070741376U, + 54183740288U, 54296741504U, 54409741696U, 54522739072U, 54635737472U, + 54748741504U, 54861736064U, 54974740096U, 55087741568U, 55200733568U, + 55313741696U, 55426734464U, 55539741056U, 55652741504U, 55765741184U, + 55878741376U, 55991730304U, 56104740992U, 56217740672U, 56330731648U, + 56443737472U, 56556724352U, 56669740672U, 56782739072U, 56895740032U, + 57008741248U, 57121741696U, 57234740096U, 57347741312U, 57460741504U +}; + +// 500 Epochs worth of tabulated DAG sizes (~3.5 Years) + +// Generated with the following Mathematica Code: +// GetCacheSizes[n_] := Module[{ +// DAGSizeBytesInit = 2^30, +// MixBytes = 128, +// DAGGrowth = 113000000, +// HashBytes = 64, +// DAGParents = 1024, +// j = 0}, +// Reap[ +// While[j < n, +// Module[{i = Floor[(DAGSizeBytesInit + DAGGrowth * j) / (DAGParents * HashBytes)]}, +// While[! PrimeQ[i], i--]; +// Sow[i*HashBytes]; j++]]]][[2]][[1]] + +const size_t cache_sizes[] = { + 1048384U, 1158208U, 1268416U, 1377856U, 1489856U, 1599296U, 1710656U, + 1820608U, 1930816U, 2041024U, 2151872U, 2261696U, 2371904U, 2482624U, + 2593216U, 2703296U, 2814016U, 2924224U, 3034816U, 3144896U, 3255488U, + 3365312U, 3475904U, 3586624U, 3696064U, 3806272U, 3917504U, 4027456U, + 4138304U, 4248512U, 4359104U, 4469312U, 4579264U, 4689728U, 4797376U, + 4909888U, 5020096U, 5131328U, 5241664U, 5351744U, 5461312U, 5572544U, + 5683264U, 5793472U, 5903552U, 6014144U, 6121664U, 6235072U, 6344896U, + 6454592U, 6565952U, 6675904U, 6786112U, 6896704U, 7006784U, 7117888U, + 7228096U, 7338304U, 7448768U, 7557952U, 7669184U, 7779776U, 7889216U, + 8000192U, 8110912U, 8220736U, 8331712U, 8441536U, 8552384U, 8662592U, + 8772928U, 8883136U, 8993728U, 9103168U, 9214528U, 9323968U, 9434816U, + 9545152U, 9655616U, 9766336U, 9876544U, 9986624U, 10097344U, 10207424U, + 10316864U, 10427968U, 10538432U, 10649152U, 10758976U, 10869568U, 10979776U, + 11089472U, 11200832U, 11309632U, 11420608U, 11531584U, 11641792U, 11751104U, + 11862976U, 11973184U, 12083264U, 12193856U, 12304064U, 12414656U, 12524608U, + 12635072U, 12745792U, 12855616U, 12965824U, 13076416U, 13187008U, 13297216U, + 13407808U, 13518016U, 13627072U, 13738688U, 13848256U, 13959488U, 14069696U, + 14180288U, 14290624U, 14399552U, 14511424U, 14621504U, 14732096U, 14841664U, + 14951744U, 15062336U, 15172672U, 15283264U, 15393088U, 15504448U, 15614272U, + 15723712U, 15834944U, 15945152U, 16055744U, 16165696U, 16277056U, 16387136U, + 16494784U, 16607936U, 16718272U, 16828736U, 16938176U, 17048384U, 17159872U, + 17266624U, 17380544U, 17490496U, 17600192U, 17711296U, 17821376U, 17931968U, + 18041152U, 18152896U, 18261952U, 18373568U, 18483392U, 18594112U, 18703936U, + 18814912U, 18924992U, 19034944U, 19145408U, 19256128U, 19366208U, 19477184U, + 19587136U, 19696576U, 19808192U, 19916992U, 20028352U, 20137664U, 20249024U, + 20358848U, 20470336U, 20580544U, 20689472U, 20801344U, 20911424U, 21020096U, + 21130688U, 21242176U, 21352384U, 21462208U, 21573824U, 21683392U, 21794624U, + 21904448U, 22013632U, 22125248U, 22235968U, 22344512U, 22456768U, 22566848U, + 22677056U, 22786496U, 22897984U, 23008064U, 23118272U, 23228992U, 23338816U, + 23449408U, 23560256U, 23670464U, 23780672U, 23891264U, 24001216U, 24110656U, + 24221888U, 24332608U, 24442688U, 24552512U, 24662464U, 24773696U, 24884032U, + 24994496U, 25105216U, 25215296U, 25324864U, 25435712U, 25546432U, 25655744U, + 25767232U, 25876672U, 25986368U, 26098112U, 26207936U, 26318912U, 26428736U, + 26539712U, 26650048U, 26760256U, 26869184U, 26979776U, 27091136U, 27201728U, + 27311552U, 27422272U, 27532352U, 27642304U, 27752896U, 27863744U, 27973952U, + 28082752U, 28194752U, 28305344U, 28415168U, 28524992U, 28636352U, 28746304U, + 28857152U, 28967104U, 29077184U, 29187904U, 29298496U, 29408576U, 29518912U, + 29628992U, 29739968U, 29850176U, 29960512U, 30070336U, 30180544U, 30290752U, + 30398912U, 30512192U, 30622784U, 30732992U, 30842176U, 30953536U, 31063744U, + 31174336U, 31284544U, 31395136U, 31504448U, 31615552U, 31725632U, 31835072U, + 31946176U, 32057024U, 32167232U, 32277568U, 32387008U, 32497984U, 32608832U, + 32719168U, 32829376U, 32939584U, 33050048U, 33160768U, 33271232U, 33381184U, + 33491648U, 33601856U, 33712576U, 33822016U, 33932992U, 34042816U, 34153024U, + 34263104U, 34373824U, 34485056U, 34594624U, 34704832U, 34816064U, 34926272U, + 35036224U, 35146816U, 35255104U, 35367104U, 35478208U, 35588416U, 35698496U, + 35808832U, 35918656U, 36029888U, 36139456U, 36250688U, 36360512U, 36471104U, + 36581696U, 36691136U, 36802112U, 36912448U, 37022912U, 37132864U, 37242944U, + 37354048U, 37464512U, 37574848U, 37684928U, 37794752U, 37904704U, 38015552U, + 38125888U, 38236864U, 38345792U, 38457152U, 38567744U, 38678336U, 38787776U, + 38897216U, 39009088U, 39117632U, 39230144U, 39340352U, 39450304U, 39560384U, + 39671488U, 39781312U, 39891392U, 40002112U, 40112704U, 40223168U, 40332608U, + 40443968U, 40553792U, 40664768U, 40774208U, 40884416U, 40993984U, 41105984U, + 41215424U, 41326528U, 41436992U, 41546048U, 41655872U, 41768128U, 41878336U, + 41988928U, 42098752U, 42209344U, 42319168U, 42429248U, 42540352U, 42649792U, + 42761024U, 42871616U, 42981824U, 43092032U, 43201856U, 43312832U, 43423552U, + 43533632U, 43643584U, 43753792U, 43864384U, 43974976U, 44084032U, 44195392U, + 44306368U, 44415296U, 44526016U, 44637248U, 44746816U, 44858048U, 44967872U, + 45078848U, 45188288U, 45299264U, 45409216U, 45518272U, 45630272U, 45740224U, + 45850432U, 45960896U, 46069696U, 46182208U, 46292416U, 46402624U, 46512064U, + 46623296U, 46733888U, 46843712U, 46953664U, 47065024U, 47175104U, 47285696U, + 47395904U, 47506496U, 47615296U, 47726912U, 47837632U, 47947712U, 48055232U, + 48168128U, 48277952U, 48387392U, 48499648U, 48609472U, 48720064U, 48830272U, + 48940096U, 49050944U, 49160896U, 49271744U, 49381568U, 49492288U, 49602752U, + 49712576U, 49822016U, 49934272U, 50042816U, 50154304U, 50264128U, 50374336U, + 50484416U, 50596288U, 50706752U, 50816704U, 50927168U, 51035456U, 51146944U, + 51258176U, 51366976U, 51477824U, 51589568U, 51699776U, 51809728U, 51920576U, + 52030016U, 52140736U, 52251328U, 52361152U, 52470592U, 52582592U, 52691776U, + 52803136U, 52912576U, 53020736U, 53132224U, 53242688U, 53354816U, 53465536U, + 53575232U, 53685568U, 53796544U, 53906752U, 54016832U, 54126656U, 54236992U, + 54347456U, 54457408U, 54569024U, 54679232U, 54789184U, 54899776U, 55008832U, + 55119296U, 55231168U, 55341248U, 55451584U, 55562048U, 55672256U, 55782208U, + 55893184U, 56002112U, 56113216U +}; + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/libethash/endian.h b/libethash/endian.h new file mode 100644 index 000000000..9ca842e47 --- /dev/null +++ b/libethash/endian.h @@ -0,0 +1,74 @@ +#pragma once + +#include +#include "compiler.h" + +static const uint8_t BitReverseTable256[] = + { + 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, + 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, + 0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4, + 0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC, + 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2, + 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA, + 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6, + 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE, + 0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1, + 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9, + 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5, + 0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD, + 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, + 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB, + 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7, + 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF + }; + +static inline uint32_t bitfn_swap32(uint32_t a) { + return (BitReverseTable256[a & 0xff] << 24) | + (BitReverseTable256[(a >> 8) & 0xff] << 16) | + (BitReverseTable256[(a >> 16) & 0xff] << 8) | + (BitReverseTable256[(a >> 24) & 0xff]); +} + +static inline uint64_t bitfn_swap64(uint64_t a) { + return ((uint64_t) bitfn_swap32((uint32_t) (a >> 32))) | + (((uint64_t) bitfn_swap32((uint32_t) a)) << 32); +} + +#if defined(__MINGW32__) || defined(_WIN32) + # define LITTLE_ENDIAN 1234 + # define BYTE_ORDER LITTLE_ENDIAN +#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) + # include +#elif defined(__OpenBSD__) || defined(__SVR4) + # include +#elif defined(__APPLE__) +# include +#elif defined( BSD ) && (BSD >= 199103) + # include +#elif defined( __QNXNTO__ ) && defined( __LITTLEENDIAN__ ) + # define LITTLE_ENDIAN 1234 + # define BYTE_ORDER LITTLE_ENDIAN +#elif defined( __QNXNTO__ ) && defined( __BIGENDIAN__ ) + # define BIG_ENDIAN 1234 + # define BYTE_ORDER BIG_ENDIAN +#else + +# include + +#endif + + +#if LITTLE_ENDIAN == BYTE_ORDER + +#define fix_endian32(x) (x) +#define fix_endian64(x) (x) + +#elif BIG_ENDIAN == BYTE_ORDER + +#define fix_endian32(x) bitfn_swap32(x) +#define fix_endian64(x) bitfn_swap64(x) + +#else +# error "endian not supported" +#endif // BYTE_ORDER \ No newline at end of file diff --git a/libethash/ethash.h b/libethash/ethash.h new file mode 100644 index 000000000..918a77413 --- /dev/null +++ b/libethash/ethash.h @@ -0,0 +1,93 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file ethash.h +* @date 2015 +*/ +#pragma once + +#include +#include +#include +#include +#include "compiler.h" + +#define REVISION 19 +#define DAGSIZE_BYTES_INIT 1073741824U // 2**30 +#define DAG_GROWTH 113000000U +#define EPOCH_LENGTH 30000U +#define MIX_BYTES 128 +#define DAG_PARENTS 256 +#define CACHE_ROUNDS 3 +#define ACCESSES 64 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ethash_params { + size_t full_size; // Size of full data set (in bytes, multiple of mix size (128)). + size_t cache_size; // Size of compute cache (in bytes, multiple of node size (64)). +} ethash_params; + +typedef struct ethash_return_value { + uint8_t result[32]; + uint8_t mix_hash[32]; +} ethash_return_value; + +size_t ethash_get_datasize(const uint32_t block_number); +size_t ethash_get_cachesize(const uint32_t block_number); + +// initialize the parameters +static inline void ethash_params_init(ethash_params *params, const uint32_t block_number) { + params->full_size = ethash_get_datasize(block_number); + params->cache_size = ethash_get_cachesize(block_number); +} + +typedef struct ethash_cache { + void *mem; +} ethash_cache; + +void ethash_mkcache(ethash_cache *cache, ethash_params const *params, const uint8_t seed[32]); +void ethash_compute_full_data(void *mem, ethash_params const *params, ethash_cache const *cache); +void ethash_full(ethash_return_value *ret, void const *full_mem, ethash_params const *params, const uint8_t header_hash[32], const uint64_t nonce); +void ethash_light(ethash_return_value *ret, ethash_cache const *cache, ethash_params const *params, const uint8_t header_hash[32], const uint64_t nonce); + +static inline void ethash_prep_light(void *cache, ethash_params const *params, const uint8_t seed[32]) { ethash_cache c; c.mem = cache; ethash_mkcache(&c, params, seed); } +static inline void ethash_compute_light(ethash_return_value *ret, void const *cache, ethash_params const *params, const uint8_t header_hash[32], const uint64_t nonce) { ethash_cache c; c.mem = (void*)cache; ethash_light(ret, &c, params, header_hash, nonce); } +static inline void ethash_prep_full(void *full, ethash_params const *params, void const *cache) { ethash_cache c; c.mem = (void*)cache; ethash_compute_full_data(full, params, &c); } +static inline void ethash_compute_full(ethash_return_value *ret, void const *full, ethash_params const *params, const uint8_t header_hash[32], const uint64_t nonce) { ethash_full(ret, full, params, header_hash, nonce); } + +static inline int ethash_check_difficulty( + const uint8_t hash[32], + const uint8_t difficulty[32]) { + // Difficulty is big endian + for (int i = 0; i < 32; i++) { + if (hash[i] == difficulty[i]) continue; + return hash[i] < difficulty[i]; + } + return 1; +} + +int ethash_quick_check_difficulty( + const uint8_t header_hash[32], + const uint64_t nonce, + const uint8_t mix_hash[32], + const uint8_t difficulty[32]); + +#ifdef __cplusplus +} +#endif diff --git a/libethash/fnv.h b/libethash/fnv.h new file mode 100644 index 000000000..edabeaae2 --- /dev/null +++ b/libethash/fnv.h @@ -0,0 +1,38 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file fnv.h +* @author Matthew Wampler-Doty +* @date 2015 +*/ + +#pragma once +#include +#include "compiler.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define FNV_PRIME 0x01000193 + +static inline uint32_t fnv_hash(const uint32_t x, const uint32_t y) { + return x*FNV_PRIME ^ y; +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/libethash/internal.c b/libethash/internal.c new file mode 100644 index 000000000..a2b82d375 --- /dev/null +++ b/libethash/internal.c @@ -0,0 +1,298 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file dash.cpp +* @author Tim Hughes +* @author Matthew Wampler-Doty +* @date 2015 +*/ + +#include +#include +#include +#include "ethash.h" +#include "fnv.h" +#include "endian.h" +#include "internal.h" +#include "data_sizes.h" + +#ifdef WITH_CRYPTOPP + +#include "sha3_cryptopp.h" + +#else +#include "sha3.h" +#endif // WITH_CRYPTOPP + +size_t ethash_get_datasize(const uint32_t block_number) { + assert(block_number / EPOCH_LENGTH < 500); + return dag_sizes[block_number / EPOCH_LENGTH]; +} + +size_t ethash_get_cachesize(const uint32_t block_number) { + assert(block_number / EPOCH_LENGTH < 500); + return cache_sizes[block_number / EPOCH_LENGTH]; +} + +// Follows Sergio's "STRICT MEMORY HARD HASHING FUNCTIONS" (2014) +// https://bitslog.files.wordpress.com/2013/12/memohash-v0-3.pdf +// SeqMemoHash(s, R, N) +void static ethash_compute_cache_nodes( + node *const nodes, + ethash_params const *params, + const uint8_t seed[32]) { + assert((params->cache_size % sizeof(node)) == 0); + uint32_t const num_nodes = (uint32_t)(params->cache_size / sizeof(node)); + + SHA3_512(nodes[0].bytes, seed, 32); + + for (unsigned i = 1; i != num_nodes; ++i) { + SHA3_512(nodes[i].bytes, nodes[i - 1].bytes, 64); + } + + for (unsigned j = 0; j != CACHE_ROUNDS; j++) { + for (unsigned i = 0; i != num_nodes; i++) { + uint32_t const idx = nodes[i].words[0] % num_nodes; + node data; + data = nodes[(num_nodes - 1 + i) % num_nodes]; + for (unsigned w = 0; w != NODE_WORDS; ++w) + { + data.words[w] ^= nodes[idx].words[w]; + } + SHA3_512(nodes[i].bytes, data.bytes, sizeof(data)); + } + } + + // now perform endian conversion +#if BYTE_ORDER != LITTLE_ENDIAN + for (unsigned w = 0; w != (num_nodes*NODE_WORDS); ++w) + { + nodes->words[w] = fix_endian32(nodes->words[w]); + } +#endif +} + +void ethash_mkcache( + ethash_cache *cache, + ethash_params const *params, + const uint8_t seed[32]) { + node *nodes = (node *) cache->mem; + ethash_compute_cache_nodes(nodes, params, seed); +} + +void ethash_calculate_dag_item( + node *const ret, + const unsigned node_index, + const struct ethash_params *params, + const struct ethash_cache *cache) { + + uint32_t num_parent_nodes = (uint32_t)(params->cache_size / sizeof(node)); + node const *cache_nodes = (node const *) cache->mem; + node const *init = &cache_nodes[node_index % num_parent_nodes]; + + memcpy(ret, init, sizeof(node)); + ret->words[0] ^= node_index; + SHA3_512(ret->bytes, ret->bytes, sizeof(node)); + +#if defined(_M_X64) && ENABLE_SSE + __m128i const fnv_prime = _mm_set1_epi32(FNV_PRIME); + __m128i xmm0 = ret->xmm[0]; + __m128i xmm1 = ret->xmm[1]; + __m128i xmm2 = ret->xmm[2]; + __m128i xmm3 = ret->xmm[3]; +#endif + + for (unsigned i = 0; i != DAG_PARENTS; ++i) + { + uint32_t parent_index = ((node_index ^ i)*FNV_PRIME ^ ret->words[i % NODE_WORDS]) % num_parent_nodes; + node const *parent = &cache_nodes[parent_index]; + + #if defined(_M_X64) && ENABLE_SSE + { + xmm0 = _mm_mullo_epi32(xmm0, fnv_prime); + xmm1 = _mm_mullo_epi32(xmm1, fnv_prime); + xmm2 = _mm_mullo_epi32(xmm2, fnv_prime); + xmm3 = _mm_mullo_epi32(xmm3, fnv_prime); + xmm0 = _mm_xor_si128(xmm0, parent->xmm[0]); + xmm1 = _mm_xor_si128(xmm1, parent->xmm[1]); + xmm2 = _mm_xor_si128(xmm2, parent->xmm[2]); + xmm3 = _mm_xor_si128(xmm3, parent->xmm[3]); + + // have to write to ret as values are used to compute index + ret->xmm[0] = xmm0; + ret->xmm[1] = xmm1; + ret->xmm[2] = xmm2; + ret->xmm[3] = xmm3; + } + #else + { + for (unsigned w = 0; w != NODE_WORDS; ++w) { + ret->words[w] = fnv_hash(ret->words[w], parent->words[w]); + } + } + #endif + } + + SHA3_512(ret->bytes, ret->bytes, sizeof(node)); +} + +void ethash_compute_full_data( + void *mem, + ethash_params const *params, + ethash_cache const *cache) { + assert((params->full_size % (sizeof(uint32_t) * MIX_WORDS)) == 0); + assert((params->full_size % sizeof(node)) == 0); + node *full_nodes = mem; + + // now compute full nodes + for (unsigned n = 0; n != (params->full_size / sizeof(node)); ++n) { + ethash_calculate_dag_item(&(full_nodes[n]), n, params, cache); + } +} + +static void ethash_hash( + ethash_return_value * ret, + node const *full_nodes, + ethash_cache const *cache, + ethash_params const *params, + const uint8_t header_hash[32], + const uint64_t nonce) { + + assert((params->full_size % MIX_WORDS) == 0); + + // pack hash and nonce together into first 40 bytes of s_mix + assert(sizeof(node)*8 == 512); + node s_mix[MIX_NODES + 1]; + memcpy(s_mix[0].bytes, header_hash, 32); + +#if BYTE_ORDER != LITTLE_ENDIAN + s_mix[0].double_words[4] = fix_endian64(nonce); +#else + s_mix[0].double_words[4] = nonce; +#endif + + // compute sha3-512 hash and replicate across mix + SHA3_512(s_mix->bytes, s_mix->bytes, 40); + +#if BYTE_ORDER != LITTLE_ENDIAN + for (unsigned w = 0; w != 16; ++w) { + s_mix[0].words[w] = fix_endian32(s_mix[0].words[w]); + } +#endif + + node* const mix = s_mix + 1; + for (unsigned w = 0; w != MIX_WORDS; ++w) { + mix->words[w] = s_mix[0].words[w % NODE_WORDS]; + } + + unsigned const + page_size = sizeof(uint32_t) * MIX_WORDS, + num_full_pages = (unsigned)(params->full_size / page_size); + + + for (unsigned i = 0; i != ACCESSES; ++i) + { + uint32_t const index = ((s_mix->words[0] ^ i)*FNV_PRIME ^ mix->words[i % MIX_WORDS]) % num_full_pages; + + for (unsigned n = 0; n != MIX_NODES; ++n) + { + const node * dag_node = &full_nodes[MIX_NODES * index + n]; + + if (!full_nodes) { + node tmp_node; + ethash_calculate_dag_item(&tmp_node, index * MIX_NODES + n, params, cache); + dag_node = &tmp_node; + } + + #if defined(_M_X64) && ENABLE_SSE + { + __m128i fnv_prime = _mm_set1_epi32(FNV_PRIME); + __m128i xmm0 = _mm_mullo_epi32(fnv_prime, mix[n].xmm[0]); + __m128i xmm1 = _mm_mullo_epi32(fnv_prime, mix[n].xmm[1]); + __m128i xmm2 = _mm_mullo_epi32(fnv_prime, mix[n].xmm[2]); + __m128i xmm3 = _mm_mullo_epi32(fnv_prime, mix[n].xmm[3]); + mix[n].xmm[0] = _mm_xor_si128(xmm0, dag_node->xmm[0]); + mix[n].xmm[1] = _mm_xor_si128(xmm1, dag_node->xmm[1]); + mix[n].xmm[2] = _mm_xor_si128(xmm2, dag_node->xmm[2]); + mix[n].xmm[3] = _mm_xor_si128(xmm3, dag_node->xmm[3]); + } + #else + { + for (unsigned w = 0; w != NODE_WORDS; ++w) { + mix[n].words[w] = fnv_hash(mix[n].words[w], dag_node->words[w]); + } + } + #endif + } + + } + + // compress mix + for (unsigned w = 0; w != MIX_WORDS; w += 4) + { + uint32_t reduction = mix->words[w+0]; + reduction = reduction*FNV_PRIME ^ mix->words[w+1]; + reduction = reduction*FNV_PRIME ^ mix->words[w+2]; + reduction = reduction*FNV_PRIME ^ mix->words[w+3]; + mix->words[w/4] = reduction; + } + +#if BYTE_ORDER != LITTLE_ENDIAN + for (unsigned w = 0; w != MIX_WORDS/4; ++w) { + mix->words[w] = fix_endian32(mix->words[w]); + } +#endif + + memcpy(ret->mix_hash, mix->bytes, 32); + // final Keccak hash + SHA3_256(ret->result, s_mix->bytes, 64+32); // Keccak-256(s + compressed_mix) +} + +void ethash_quick_hash( + uint8_t return_hash[32], + const uint8_t header_hash[32], + const uint64_t nonce, + const uint8_t mix_hash[32]) { + + uint8_t buf[64+32]; + memcpy(buf, header_hash, 32); +#if BYTE_ORDER != LITTLE_ENDIAN + nonce = fix_endian64(nonce); +#endif + memcpy(&(buf[32]), &nonce, 8); + SHA3_512(buf, buf, 40); + memcpy(&(buf[64]), mix_hash, 32); + SHA3_256(return_hash, buf, 64+32); +} + +int ethash_quick_check_difficulty( + const uint8_t header_hash[32], + const uint64_t nonce, + const uint8_t mix_hash[32], + const uint8_t difficulty[32]) { + + uint8_t return_hash[32]; + ethash_quick_hash(return_hash, header_hash, nonce, mix_hash); + return ethash_check_difficulty(return_hash, difficulty); +} + +void ethash_full(ethash_return_value * ret, void const *full_mem, ethash_params const *params, const uint8_t previous_hash[32], const uint64_t nonce) { + ethash_hash(ret, (node const *) full_mem, NULL, params, previous_hash, nonce); +} + +void ethash_light(ethash_return_value * ret, ethash_cache const *cache, ethash_params const *params, const uint8_t previous_hash[32], const uint64_t nonce) { + ethash_hash(ret, NULL, cache, params, previous_hash, nonce); +} diff --git a/libethash/internal.h b/libethash/internal.h new file mode 100644 index 000000000..bcbacdaa4 --- /dev/null +++ b/libethash/internal.h @@ -0,0 +1,48 @@ +#pragma once +#include "compiler.h" +#include "endian.h" +#include "ethash.h" + +#define ENABLE_SSE 1 + +#if defined(_M_X64) && ENABLE_SSE +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// compile time settings +#define NODE_WORDS (64/4) +#define MIX_WORDS (MIX_BYTES/4) +#define MIX_NODES (MIX_WORDS / NODE_WORDS) +#include + +typedef union node { + uint8_t bytes[NODE_WORDS * 4]; + uint32_t words[NODE_WORDS]; + uint64_t double_words[NODE_WORDS / 2]; + +#if defined(_M_X64) && ENABLE_SSE + __m128i xmm[NODE_WORDS/4]; +#endif + +} node; + +void ethash_calculate_dag_item( + node *const ret, + const unsigned node_index, + ethash_params const *params, + ethash_cache const *cache +); + +void ethash_quick_hash( + uint8_t return_hash[32], + const uint8_t header_hash[32], + const uint64_t nonce, + const uint8_t mix_hash[32]); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/libethash/sha3.c b/libethash/sha3.c new file mode 100644 index 000000000..0c28230b8 --- /dev/null +++ b/libethash/sha3.c @@ -0,0 +1,151 @@ +/** libkeccak-tiny +* +* A single-file implementation of SHA-3 and SHAKE. +* +* Implementor: David Leon Gil +* License: CC0, attribution kindly requested. Blame taken too, +* but not liability. +*/ +#include "sha3.h" + +#include +#include +#include +#include + +/******** The Keccak-f[1600] permutation ********/ + +/*** Constants. ***/ +static const uint8_t rho[24] = \ + { 1, 3, 6, 10, 15, 21, + 28, 36, 45, 55, 2, 14, + 27, 41, 56, 8, 25, 43, + 62, 18, 39, 61, 20, 44}; +static const uint8_t pi[24] = \ + {10, 7, 11, 17, 18, 3, + 5, 16, 8, 21, 24, 4, + 15, 23, 19, 13, 12, 2, + 20, 14, 22, 9, 6, 1}; +static const uint64_t RC[24] = \ + {1ULL, 0x8082ULL, 0x800000000000808aULL, 0x8000000080008000ULL, + 0x808bULL, 0x80000001ULL, 0x8000000080008081ULL, 0x8000000000008009ULL, + 0x8aULL, 0x88ULL, 0x80008009ULL, 0x8000000aULL, + 0x8000808bULL, 0x800000000000008bULL, 0x8000000000008089ULL, 0x8000000000008003ULL, + 0x8000000000008002ULL, 0x8000000000000080ULL, 0x800aULL, 0x800000008000000aULL, + 0x8000000080008081ULL, 0x8000000000008080ULL, 0x80000001ULL, 0x8000000080008008ULL}; + +/*** Helper macros to unroll the permutation. ***/ +#define rol(x, s) (((x) << s) | ((x) >> (64 - s))) +#define REPEAT6(e) e e e e e e +#define REPEAT24(e) REPEAT6(e e e e) +#define REPEAT5(e) e e e e e +#define FOR5(v, s, e) \ + v = 0; \ + REPEAT5(e; v += s;) + +/*** Keccak-f[1600] ***/ +static inline void keccakf(void* state) { + uint64_t* a = (uint64_t*)state; + uint64_t b[5] = {0}; + uint64_t t = 0; + uint8_t x, y; + + for (int i = 0; i < 24; i++) { + // Theta + FOR5(x, 1, + b[x] = 0; + FOR5(y, 5, + b[x] ^= a[x + y]; )) + FOR5(x, 1, + FOR5(y, 5, + a[y + x] ^= b[(x + 4) % 5] ^ rol(b[(x + 1) % 5], 1); )) + // Rho and pi + t = a[1]; + x = 0; + REPEAT24(b[0] = a[pi[x]]; + a[pi[x]] = rol(t, rho[x]); + t = b[0]; + x++; ) + // Chi + FOR5(y, + 5, + FOR5(x, 1, + b[x] = a[y + x];) + FOR5(x, 1, + a[y + x] = b[x] ^ ((~b[(x + 1) % 5]) & b[(x + 2) % 5]); )) + // Iota + a[0] ^= RC[i]; + } +} + +/******** The FIPS202-defined functions. ********/ + +/*** Some helper macros. ***/ + +#define _(S) do { S } while (0) +#define FOR(i, ST, L, S) \ + _(for (size_t i = 0; i < L; i += ST) { S; }) +#define mkapply_ds(NAME, S) \ + static inline void NAME(uint8_t* dst, \ + const uint8_t* src, \ + size_t len) { \ + FOR(i, 1, len, S); \ + } +#define mkapply_sd(NAME, S) \ + static inline void NAME(const uint8_t* src, \ + uint8_t* dst, \ + size_t len) { \ + FOR(i, 1, len, S); \ + } + +mkapply_ds(xorin, dst[i] ^= src[i]) // xorin +mkapply_sd(setout, dst[i] = src[i]) // setout + +#define P keccakf +#define Plen 200 + +// Fold P*F over the full blocks of an input. +#define foldP(I, L, F) \ + while (L >= rate) { \ + F(a, I, rate); \ + P(a); \ + I += rate; \ + L -= rate; \ + } + +/** The sponge-based hash construction. **/ +static inline int hash(uint8_t* out, size_t outlen, + const uint8_t* in, size_t inlen, + size_t rate, uint8_t delim) { + if ((out == NULL) || ((in == NULL) && inlen != 0) || (rate >= Plen)) { + return -1; + } + uint8_t a[Plen] = {0}; + // Absorb input. + foldP(in, inlen, xorin); + // Xor in the DS and pad frame. + a[inlen] ^= delim; + a[rate - 1] ^= 0x80; + // Xor in the last block. + xorin(a, in, inlen); + // Apply P + P(a); + // Squeeze output. + foldP(out, outlen, setout); + setout(a, out, outlen); + memset(a, 0, 200); + return 0; +} + +#define defsha3(bits) \ + int sha3_##bits(uint8_t* out, size_t outlen, \ + const uint8_t* in, size_t inlen) { \ + if (outlen > (bits/8)) { \ + return -1; \ + } \ + return hash(out, outlen, in, inlen, 200 - (bits / 4), 0x01); \ + } + +/*** FIPS202 SHA3 FOFs ***/ +defsha3(256) +defsha3(512) \ No newline at end of file diff --git a/libethash/sha3.h b/libethash/sha3.h new file mode 100644 index 000000000..36a0a5301 --- /dev/null +++ b/libethash/sha3.h @@ -0,0 +1,27 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "compiler.h" +#include +#include + +#define decsha3(bits) \ + int sha3_##bits(uint8_t*, size_t, const uint8_t*, size_t); + +decsha3(256) +decsha3(512) + +static inline void SHA3_256(uint8_t * const ret, uint8_t const *data, const size_t size) { + sha3_256(ret, 32, data, size); +} + +static inline void SHA3_512(uint8_t * const ret, uint8_t const *data, const size_t size) { + sha3_512(ret, 64, data, size); +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/libethash/sha3_cryptopp.cpp b/libethash/sha3_cryptopp.cpp new file mode 100644 index 000000000..9454ce04a --- /dev/null +++ b/libethash/sha3_cryptopp.cpp @@ -0,0 +1,34 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ + +/** @file sha3.cpp +* @author Tim Hughes +* @date 2015 +*/ + +#include +#include + +extern "C" { +void SHA3_256(uint8_t *const ret, const uint8_t *data, size_t size) { + CryptoPP::SHA3_256().CalculateDigest(ret, data, size); +} + +void SHA3_512(uint8_t *const ret, const uint8_t *data, size_t size) { + CryptoPP::SHA3_512().CalculateDigest(ret, data, size); +} +} \ No newline at end of file diff --git a/libethash/sha3_cryptopp.h b/libethash/sha3_cryptopp.h new file mode 100644 index 000000000..f910960e1 --- /dev/null +++ b/libethash/sha3_cryptopp.h @@ -0,0 +1,15 @@ +#pragma once + +#include "compiler.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void SHA3_256(uint8_t *const ret, const uint8_t *data, size_t size); +void SHA3_512(uint8_t *const ret, const uint8_t *data, size_t size); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/libethash/util.c b/libethash/util.c new file mode 100644 index 000000000..fbf268b7d --- /dev/null +++ b/libethash/util.c @@ -0,0 +1,41 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file util.c + * @author Tim Hughes + * @date 2015 + */ +#include +#include +#include "util.h" + +#ifdef _MSC_VER + +// foward declare without all of Windows.h +__declspec(dllimport) void __stdcall OutputDebugStringA(const char* lpOutputString); + +void debugf(const char *str, ...) +{ + va_list args; + va_start(args, str); + + char buf[1<<16]; + _vsnprintf_s(buf, sizeof(buf), sizeof(buf), str, args); + buf[sizeof(buf)-1] = '\0'; + OutputDebugStringA(buf); +} + +#endif diff --git a/libethash/util.h b/libethash/util.h new file mode 100644 index 000000000..2f59076f6 --- /dev/null +++ b/libethash/util.h @@ -0,0 +1,47 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file util.h + * @author Tim Hughes + * @date 2015 + */ +#pragma once +#include +#include "compiler.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _MSC_VER +void debugf(const char *str, ...); +#else +#define debugf printf +#endif + +static inline uint32_t min_u32(uint32_t a, uint32_t b) +{ + return a < b ? a : b; +} + +static inline uint32_t clamp_u32(uint32_t x, uint32_t min_, uint32_t max_) +{ + return x < min_ ? min_ : (x > max_ ? max_ : x); +} + +#ifdef __cplusplus +} +#endif diff --git a/libethcore/BlockInfo.cpp b/libethcore/BlockInfo.cpp index ce158c3cc..0f37294c2 100644 --- a/libethcore/BlockInfo.cpp +++ b/libethcore/BlockInfo.cpp @@ -22,23 +22,22 @@ #include #include #include -#include +#include #include "ProofOfWork.h" #include "Exceptions.h" +#include "Params.h" #include "BlockInfo.h" using namespace std; using namespace dev; using namespace dev::eth; -u256 dev::eth::c_genesisDifficulty = (u256)1 << 17; - BlockInfo::BlockInfo(): timestamp(Invalid256) { } -BlockInfo::BlockInfo(bytesConstRef _block, bool _checkNonce) +BlockInfo::BlockInfo(bytesConstRef _block, Strictness _s) { - populate(_block, _checkNonce); + populate(_block, _s); } void BlockInfo::setEmpty() @@ -56,14 +55,16 @@ void BlockInfo::setEmpty() gasUsed = 0; timestamp = 0; extraData.clear(); - nonce = h256(); + seedHash = h256(); + mixHash = h256(); + nonce = Nonce(); hash = headerHash(WithNonce); } -BlockInfo BlockInfo::fromHeader(bytesConstRef _block) +BlockInfo BlockInfo::fromHeader(bytesConstRef _block, Strictness _s) { BlockInfo ret; - ret.populateFromHeader(RLP(_block)); + ret.populateFromHeader(RLP(_block), _s); return ret; } @@ -76,11 +77,11 @@ h256 BlockInfo::headerHash(IncludeNonce _n) const void BlockInfo::streamRLP(RLPStream& _s, IncludeNonce _n) const { - _s.appendList(_n == WithNonce ? 14 : 13) + _s.appendList(_n == WithNonce ? 16 : 14) << parentHash << sha3Uncles << coinbaseAddress << stateRoot << transactionsRoot << receiptsRoot << logBloom - << difficulty << number << gasLimit << gasUsed << timestamp << extraData; + << difficulty << number << gasLimit << gasUsed << timestamp << extraData << seedHash; if (_n == WithNonce) - _s << nonce; + _s << mixHash << nonce; } h256 BlockInfo::headerHash(bytesConstRef _block) @@ -88,27 +89,29 @@ h256 BlockInfo::headerHash(bytesConstRef _block) return sha3(RLP(_block)[0].data()); } -void BlockInfo::populateFromHeader(RLP const& _header, bool _checkNonce) +void BlockInfo::populateFromHeader(RLP const& _header, Strictness _s) { hash = dev::sha3(_header.data()); int field = 0; try { - parentHash = _header[field = 0].toHash(); - sha3Uncles = _header[field = 1].toHash(); - coinbaseAddress = _header[field = 2].toHash

(); - stateRoot = _header[field = 3].toHash(); - transactionsRoot = _header[field = 4].toHash(); - receiptsRoot = _header[field = 5].toHash(); - logBloom = _header[field = 6].toHash(); + parentHash = _header[field = 0].toHash(RLP::VeryStrict); + sha3Uncles = _header[field = 1].toHash(RLP::VeryStrict); + coinbaseAddress = _header[field = 2].toHash
(RLP::VeryStrict); + stateRoot = _header[field = 3].toHash(RLP::VeryStrict); + transactionsRoot = _header[field = 4].toHash(RLP::VeryStrict); + receiptsRoot = _header[field = 5].toHash(RLP::VeryStrict); + logBloom = _header[field = 6].toHash(RLP::VeryStrict); difficulty = _header[field = 7].toInt(); number = _header[field = 8].toInt(); gasLimit = _header[field = 9].toInt(); gasUsed = _header[field = 10].toInt(); timestamp = _header[field = 11].toInt(); extraData = _header[field = 12].toBytes(); - nonce = _header[field = 13].toHash(); + seedHash = _header[field = 13].toHash(RLP::VeryStrict); + mixHash = _header[field = 14].toHash(RLP::VeryStrict); + nonce = _header[field = 15].toHash(RLP::VeryStrict); } catch (Exception const& _e) @@ -118,29 +121,38 @@ void BlockInfo::populateFromHeader(RLP const& _header, bool _checkNonce) } // check it hashes according to proof of work or that it's the genesis block. - if (_checkNonce && parentHash && !ProofOfWork::verify(headerHash(WithoutNonce), nonce, difficulty)) - BOOST_THROW_EXCEPTION(InvalidBlockNonce(headerHash(WithoutNonce), nonce, difficulty)); + if (_s == CheckEverything && parentHash && !ProofOfWork::verify(*this)) + BOOST_THROW_EXCEPTION(InvalidBlockNonce() << errinfo_hash256(headerHash(WithoutNonce)) << errinfo_nonce(nonce) << errinfo_difficulty(difficulty)); + + if (_s != CheckNothing) + { + if (gasUsed > gasLimit) + BOOST_THROW_EXCEPTION(TooMuchGasUsed() << RequirementError(bigint(gasLimit), bigint(gasUsed)) ); - if (gasUsed > gasLimit) - BOOST_THROW_EXCEPTION(TooMuchGasUsed()); + if (difficulty < c_minimumDifficulty) + BOOST_THROW_EXCEPTION(InvalidDifficulty() << RequirementError(bigint(c_minimumDifficulty), bigint(difficulty)) ); - if (number && extraData.size() > 1024) - BOOST_THROW_EXCEPTION(ExtraDataTooBig()); + if (gasLimit < c_minGasLimit) + BOOST_THROW_EXCEPTION(InvalidGasLimit() << RequirementError(bigint(c_minGasLimit), bigint(gasLimit)) ); + + if (number && extraData.size() > c_maximumExtraDataSize) + BOOST_THROW_EXCEPTION(ExtraDataTooBig() << RequirementError(bigint(c_maximumExtraDataSize), bigint(extraData.size()))); + } } -void BlockInfo::populate(bytesConstRef _block, bool _checkNonce) +void BlockInfo::populate(bytesConstRef _block, Strictness _s) { RLP root(_block); RLP header = root[0]; if (!header.isList()) - BOOST_THROW_EXCEPTION(InvalidBlockFormat(0, header.data()) << errinfo_comment("block header needs to be a list")); - populateFromHeader(header, _checkNonce); + BOOST_THROW_EXCEPTION(InvalidBlockFormat() << errinfo_comment("block header needs to be a list") << BadFieldError(0, header.data().toString())); + populateFromHeader(header, _s); if (!root[1].isList()) - BOOST_THROW_EXCEPTION(InvalidBlockFormat(1, root[1].data())); + BOOST_THROW_EXCEPTION(InvalidBlockFormat() << errinfo_comment("block transactions need to be a list") << BadFieldError(1, root[1].data().toString())); if (!root[2].isList()) - BOOST_THROW_EXCEPTION(InvalidBlockFormat(2, root[2].data())); + BOOST_THROW_EXCEPTION(InvalidBlockFormat() << errinfo_comment("block uncles need to be a list") << BadFieldError(2, root[2].data().toString())); } void BlockInfo::verifyInternals(bytesConstRef _block) const @@ -162,7 +174,7 @@ void BlockInfo::verifyInternals(bytesConstRef _block) const ++i; } if (transactionsRoot != t.root()) - BOOST_THROW_EXCEPTION(InvalidTransactionsHash(t.root(), transactionsRoot)); + BOOST_THROW_EXCEPTION(InvalidTransactionsHash() << HashMismatchError(t.root(), transactionsRoot)); if (sha3Uncles != sha3(root[2].data())) BOOST_THROW_EXCEPTION(InvalidUnclesHash()); @@ -176,31 +188,42 @@ void BlockInfo::populateFromParent(BlockInfo const& _parent) gasLimit = calculateGasLimit(_parent); gasUsed = 0; difficulty = calculateDifficulty(_parent); + seedHash = calculateSeedHash(_parent); +} + +h256 BlockInfo::calculateSeedHash(BlockInfo const& _parent) const +{ + return number % c_epochDuration == 0 ? sha3(_parent.seedHash.asBytes()) : _parent.seedHash; } u256 BlockInfo::calculateGasLimit(BlockInfo const& _parent) const { if (!parentHash) - return 1000000; + return c_genesisGasLimit; else - return max(125000, (_parent.gasLimit * (1024 - 1) + (_parent.gasUsed * 6 / 5)) / 1024); + return max(c_minGasLimit, (_parent.gasLimit * (c_gasLimitBoundDivisor - 1) + (_parent.gasUsed * 6 / 5)) / c_gasLimitBoundDivisor); } u256 BlockInfo::calculateDifficulty(BlockInfo const& _parent) const { if (!parentHash) - return c_genesisDifficulty; + return (u256)c_genesisDifficulty; else - return max(1024, timestamp >= _parent.timestamp + (c_protocolVersion == 49 ? 5 : 8) ? _parent.difficulty - (_parent.difficulty >> 10) : (_parent.difficulty + (_parent.difficulty >> 10))); + return max(c_minimumDifficulty, timestamp >= _parent.timestamp + c_durationLimit ? _parent.difficulty - (_parent.difficulty / c_difficultyBoundDivisor) : (_parent.difficulty + (_parent.difficulty / c_difficultyBoundDivisor))); } void BlockInfo::verifyParent(BlockInfo const& _parent) const -{ // Check difficulty is correct given the two timestamps. +{ + // Check difficulty is correct given the two timestamps. if (difficulty != calculateDifficulty(_parent)) - BOOST_THROW_EXCEPTION(InvalidDifficulty()); + BOOST_THROW_EXCEPTION(InvalidDifficulty() << RequirementError((bigint)calculateDifficulty(_parent), (bigint)difficulty)); + + if (gasLimit < _parent.gasLimit * (c_gasLimitBoundDivisor - 1) / c_gasLimitBoundDivisor || + gasLimit > _parent.gasLimit * (c_gasLimitBoundDivisor + 1) / c_gasLimitBoundDivisor) + BOOST_THROW_EXCEPTION(InvalidGasLimit() << errinfo_min((bigint)_parent.gasLimit * (c_gasLimitBoundDivisor - 1) / c_gasLimitBoundDivisor) << errinfo_got((bigint)gasLimit) << errinfo_max((bigint)_parent.gasLimit * (c_gasLimitBoundDivisor + 1) / c_gasLimitBoundDivisor)); - if (gasLimit != calculateGasLimit(_parent)) - BOOST_THROW_EXCEPTION(InvalidGasLimit(gasLimit, calculateGasLimit(_parent))); + if (seedHash != calculateSeedHash(_parent)) + BOOST_THROW_EXCEPTION(InvalidSeedHash()); // Check timestamp is after previous timestamp. if (parentHash) diff --git a/libethcore/BlockInfo.h b/libethcore/BlockInfo.h index 99efc6a17..20134f059 100644 --- a/libethcore/BlockInfo.h +++ b/libethcore/BlockInfo.h @@ -23,21 +23,26 @@ #include #include -#include "CommonEth.h" +#include "Common.h" namespace dev { namespace eth { -extern u256 c_genesisDifficulty; - enum IncludeNonce { WithoutNonce = 0, WithNonce = 1 }; +enum Strictness +{ + CheckEverything, + IgnoreNonce, + CheckNothing +}; + /** @brief Encapsulation of a block header. * Class to contain all of a block header's data. It is able to parse a block header and populate * from some given RLP block serialisation with the static fromHeader(), through the method @@ -76,16 +81,19 @@ public: u256 gasUsed; u256 timestamp; bytes extraData; - h256 nonce; + h256 mixHash; + h256 seedHash; + Nonce nonce; BlockInfo(); - explicit BlockInfo(bytes const& _block): BlockInfo(&_block) {} - explicit BlockInfo(bytesConstRef _block, bool _checkNonce = true); + explicit BlockInfo(bytes const& _block, Strictness _s = CheckEverything): BlockInfo(&_block, _s) {} + explicit BlockInfo(bytesConstRef _block, Strictness _s = CheckEverything); static h256 headerHash(bytes const& _block) { return headerHash(&_block); } static h256 headerHash(bytesConstRef _block); - static BlockInfo fromHeader(bytesConstRef _block); + static BlockInfo fromHeader(bytes const& _block, Strictness _s = CheckEverything) { return fromHeader(bytesConstRef(&_block), _s); } + static BlockInfo fromHeader(bytesConstRef _block, Strictness _s = CheckEverything); explicit operator bool() const { return timestamp != Invalid256; } @@ -104,21 +112,24 @@ public: gasUsed == _cmp.gasUsed && timestamp == _cmp.timestamp && extraData == _cmp.extraData && + mixHash == _cmp.mixHash && + seedHash == _cmp.seedHash && nonce == _cmp.nonce; } bool operator!=(BlockInfo const& _cmp) const { return !operator==(_cmp); } void setEmpty(); - void populateFromHeader(RLP const& _header, bool _checkNonce = true); - void populate(bytesConstRef _block, bool _checkNonce = true); - void populate(bytes const& _block, bool _checkNonce = true) { populate(&_block, _checkNonce); } + void populateFromHeader(RLP const& _header, Strictness _s = CheckEverything); + void populate(bytesConstRef _block, Strictness _s = CheckEverything); + void populate(bytes const& _block, Strictness _s = CheckEverything) { populate(&_block, _s); } void verifyInternals(bytesConstRef _block) const; void verifyParent(BlockInfo const& _parent) const; void populateFromParent(BlockInfo const& parent); u256 calculateDifficulty(BlockInfo const& _parent) const; u256 calculateGasLimit(BlockInfo const& _parent) const; + h256 calculateSeedHash(BlockInfo const& _parent) const; /// sha3 of the header only. h256 headerHash(IncludeNonce _n) const; @@ -129,7 +140,7 @@ inline std::ostream& operator<<(std::ostream& _out, BlockInfo const& _bi) { _out << _bi.hash << " " << _bi.parentHash << " " << _bi.sha3Uncles << " " << _bi.coinbaseAddress << " " << _bi.stateRoot << " " << _bi.transactionsRoot << " " << _bi.receiptsRoot << " " << _bi.logBloom << " " << _bi.difficulty << " " << _bi.number << " " << _bi.gasLimit << " " << - _bi.gasUsed << " " << _bi.timestamp << " " << _bi.nonce; + _bi.gasUsed << " " << _bi.timestamp << " " << _bi.mixHash << " " << _bi.seedHash << " " << _bi.nonce; return _out; } diff --git a/libethcore/CMakeLists.txt b/libethcore/CMakeLists.txt index 1d17525a0..f562bc948 100644 --- a/libethcore/CMakeLists.txt +++ b/libethcore/CMakeLists.txt @@ -22,6 +22,7 @@ else() add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS}) endif() +target_link_libraries(${EXECUTABLE} ethash) target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} devcore) diff --git a/libethcore/CommonEth.cpp b/libethcore/Common.cpp similarity index 85% rename from libethcore/CommonEth.cpp rename to libethcore/Common.cpp index 2264e6ec9..9eb622fe3 100644 --- a/libethcore/CommonEth.cpp +++ b/libethcore/Common.cpp @@ -14,12 +14,12 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file CommonEth.cpp +/** @file Common.cpp * @author Gav Wood * @date 2014 */ -#include "CommonEth.h" +#include "Common.h" #include #include #include "Exceptions.h" @@ -32,8 +32,15 @@ namespace dev namespace eth { -const unsigned c_protocolVersion = 54; -const unsigned c_databaseVersion = 5; +const unsigned c_protocolVersion = 56; +const unsigned c_databaseBaseVersion = 7; +#if ETH_FATDB +const unsigned c_databaseVersionModifier = 1000; +#else +const unsigned c_databaseVersionModifier = 0; +#endif + +const unsigned c_databaseVersion = c_databaseBaseVersion + c_databaseVersionModifier; vector> const& units() { diff --git a/libethcore/CommonEth.h b/libethcore/Common.h similarity index 91% rename from libethcore/CommonEth.h rename to libethcore/Common.h index 79525082f..80a253bdd 100644 --- a/libethcore/CommonEth.h +++ b/libethcore/Common.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file CommonEth.h +/** @file Common.h * @author Gav Wood * @date 2014 * @@ -44,8 +44,11 @@ std::string formatBalance(bigint const& _b); /// Get information concerning the currency denominations. std::vector> const& units(); -/// The log bloom's size (512 bit). -using LogBloom = h512; +/// The log bloom's size (2048-bit). +using LogBloom = h2048; + +/// Many log blooms. +using LogBlooms = std::vector; template inline u256 exp10() { @@ -63,5 +66,7 @@ static const u256 finney = exp10<15>(); static const u256 szabo = exp10<12>(); static const u256 wei = exp10<0>(); +using Nonce = h64; + } } diff --git a/libethcore/CommonJS.cpp b/libethcore/CommonJS.cpp index 388738528..ef9ac9f65 100644 --- a/libethcore/CommonJS.cpp +++ b/libethcore/CommonJS.cpp @@ -26,75 +26,12 @@ namespace dev { -bytes jsToBytes(std::string const& _s) +Address toAddress(std::string const& _sn) { - if (_s.substr(0, 2) == "0x") - // Hex - return fromHex(_s.substr(2)); - else if (_s.find_first_not_of("0123456789") == std::string::npos) - // Decimal - return toCompactBigEndian(bigint(_s)); + if (_sn.size() == 40) + return Address(fromHex(_sn)); else - return bytes(); -} - -bytes padded(bytes _b, unsigned _l) -{ - while (_b.size() < _l) - _b.insert(_b.begin(), 0); - return asBytes(asString(_b).substr(_b.size() - std::max(_l, _l))); -} - -bytes paddedRight(bytes _b, unsigned _l) -{ - _b.resize(_l); - return _b; -} - -bytes unpadded(bytes _b) -{ - auto p = asString(_b).find_last_not_of((char)0); - _b.resize(p == std::string::npos ? 0 : (p + 1)); - return _b; -} - -bytes unpadLeft(bytes _b) -{ - unsigned int i = 0; - if (_b.size() == 0) - return _b; - - while (i < _b.size() && _b[i] == byte(0)) - i++; - - if (i != 0) - _b.erase(_b.begin(), _b.begin() + i); - return _b; -} - -std::string fromRaw(h256 _n, unsigned* _inc) -{ - if (_n) - { - std::string s((char const*)_n.data(), 32); - auto l = s.find_first_of('\0'); - if (!l) - return ""; - if (l != std::string::npos) - { - auto p = s.find_first_not_of('\0', l); - if (!(p == std::string::npos || (_inc && p == 31))) - return ""; - if (_inc) - *_inc = (byte)s[31]; - s.resize(l); - } - for (auto i: s) - if (i < 32) - return ""; - return s; - } - return ""; + return Address(); } std::string prettyU256(u256 _n, bool _abridged) @@ -128,13 +65,5 @@ std::string prettyU256(u256 _n, bool _abridged) return s.str(); } -Address fromString(std::string const& _sn) -{ - if (_sn.size() == 40) - return Address(fromHex(_sn)); - else - return Address(); -} - } diff --git a/libethcore/CommonJS.h b/libethcore/CommonJS.h index abe74f0af..7d3071c68 100644 --- a/libethcore/CommonJS.h +++ b/libethcore/CommonJS.h @@ -24,124 +24,38 @@ #pragma once #include -#include -#include -#include -#include -#include "CommonEth.h" +#include +#include +#include "Common.h" + +// devcrypto namespace dev { -template std::string toJS(FixedHash const& _h) -{ - return "0x" + toHex(_h.ref()); -} +/// Strictly convert unprefixed hex string string to Address (h160). @returns empty address if (_a.size != 40). +Address toAddress(std::string const& _a); -template std::string toJS(boost::multiprecision::number> const& _n) -{ - return "0x" + toHex(toCompactBigEndian(_n)); -} +/// Leniently convert string to Public (h512). Accepts integers, "0x" prefixing, non-exact length. +inline Public jsToPublic(std::string const& _s) { return jsToFixed(_s); } -inline std::string toJS(dev::bytes const& _n) -{ - return "0x" + dev::toHex(_n); -} +/// Leniently convert string to Secret (h256). Accepts integers, "0x" prefixing, non-exact length. +inline Secret jsToSecret(std::string const& _s) { return jsToFixed(_s); } + +/// Leniently convert string to Address (h160). Accepts integers, "0x" prefixing, non-exact length. +inline Address jsToAddress(std::string const& _s) { return jsToFixed(_s); } -/// Convert string to byte array. Input parameters can be hex or dec. Returns empty array if invalid input e.g neither dec or hex. -bytes jsToBytes(std::string const& _s); -/// Add '0' on the head of @a _b until @a _l. -bytes padded(bytes _b, unsigned _l); -/// Add '0' on the queue of @a _b until @a _l. -bytes paddedRight(bytes _b, unsigned _l); -/// Removing all trailing '0'. Returns empty array if input contains only '0' char. -bytes unpadded(bytes _s); -/// Remove all 0 byte on the head of @a _s. -bytes unpadLeft(bytes _s); /// Convert u256 into user-readable string. Returns int/hex value of 64 bits int, hex of 160 bits FixedHash. As a fallback try to handle input as h256. std::string prettyU256(u256 _n, bool _abridged = true); -/// Convert h256 into user-readable string (by directly using std::string constructor). -std::string fromRaw(h256 _n, unsigned* _inc = nullptr); -/// Convert string to Address (h160), returns empty address if (_a.size != 40). -Address fromString(std::string const& _a); - -template FixedHash jsToFixed(std::string const& _s) -{ - if (_s.substr(0, 2) == "0x") - // Hex - return FixedHash(_s.substr(2 + std::max(N * 2, _s.size() - 2) - N * 2)); - else if (_s.find_first_not_of("0123456789") == std::string::npos) - // Decimal - return (typename FixedHash::Arith)(_s); - else - // Binary - return FixedHash(); // FAIL -} - -inline std::string jsToFixed(double _s) -{ - return toJS(dev::u256(_s * (double)(dev::u256(1) << 128))); -} - -template boost::multiprecision::number> jsToInt(std::string const& _s) -{ - if (_s.substr(0, 2) == "0x") - // Hex - return fromBigEndian>>(fromHex(_s.substr(2))); - else if (_s.find_first_not_of("0123456789") == std::string::npos) - // Decimal - return boost::multiprecision::number>(_s); - else - // Binary - return 0; // FAIL -} - -inline u256 jsToU256(std::string const& _s) { return jsToInt<32>(_s); } - -inline std::string jsToDecimal(std::string const& _s) -{ - return dev::toString(jsToU256(_s)); -} -inline std::string jsFromBinary(dev::bytes _s, unsigned _padding = 32) -{ - _s.resize(std::max(_s.size(), _padding)); - return "0x" + dev::toHex(_s); } -inline std::string jsFromBinary(std::string const& _s, unsigned _padding = 32) -{ - return jsFromBinary(asBytes(_s), _padding); -} - -inline double jsFromFixed(std::string const& _s) -{ - return (double)jsToU256(_s) / (double)(dev::u256(1) << 128); -} - -} - -// devcrypto - -#include - -namespace dev -{ - -inline Public jsToPublic(std::string const& _s) { return jsToFixed(_s); } -inline Secret jsToSecret(std::string const& _s) { return jsToFixed(_s); } - -} - - // ethcore namespace dev { namespace eth { -inline Address jsToAddress(std::string const& _s) { return jsToFixed(_s); } - struct TransactionSkeleton { bool creation = false; diff --git a/libethcore/Ethasher.cpp b/libethcore/Ethasher.cpp new file mode 100644 index 000000000..a28895a1a --- /dev/null +++ b/libethcore/Ethasher.cpp @@ -0,0 +1,115 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file Ethasher.cpp + * @author Gav Wood + * @date 2014 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "BlockInfo.h" +#include "Ethasher.h" +using namespace std; +using namespace chrono; +using namespace dev; +using namespace eth; + +Ethasher* dev::eth::Ethasher::s_this = nullptr; + +bytes const& Ethasher::cache(BlockInfo const& _header) +{ + RecursiveGuard l(x_this); + if (!m_caches.count(_header.seedHash)) + { + try { + boost::filesystem::create_directories(getDataDir() + "/ethashcache"); + } catch (...) {} + std::string memoFile = getDataDir() + "/ethashcache/" + toHex(_header.seedHash.ref().cropped(0, 4)) + ".cache"; + m_caches[_header.seedHash] = contents(memoFile); + if (m_caches[_header.seedHash].empty()) + { + ethash_params p = params((unsigned)_header.number); + m_caches[_header.seedHash].resize(p.cache_size); + ethash_prep_light(m_caches[_header.seedHash].data(), &p, _header.seedHash.data()); + writeFile(memoFile, m_caches[_header.seedHash]); + } + } + return m_caches[_header.seedHash]; +} + +bytesConstRef Ethasher::full(BlockInfo const& _header) +{ + RecursiveGuard l(x_this); + if (!m_fulls.count(_header.seedHash)) + { + if (!m_fulls.empty()) + { + delete [] m_fulls.begin()->second.data(); + m_fulls.erase(m_fulls.begin()); + } + std::string memoFile = getDataDir() + "/ethashcache/" + toHex(_header.seedHash.ref().cropped(0, 4)) + ".full"; + m_fulls[_header.seedHash] = contentsNew(memoFile); + if (!m_fulls[_header.seedHash]) + { + ethash_params p = params((unsigned)_header.number); + m_fulls[_header.seedHash] = bytesRef(new byte[p.full_size], p.full_size); + auto c = cache(_header); + ethash_prep_full(m_fulls[_header.seedHash].data(), &p, c.data()); + writeFile(memoFile, m_fulls[_header.seedHash]); + } + } + return m_fulls[_header.seedHash]; +} + +ethash_params Ethasher::params(BlockInfo const& _header) +{ + return params((unsigned)_header.number); +} + +ethash_params Ethasher::params(unsigned _n) +{ + ethash_params p; + p.cache_size = ethash_get_cachesize(_n); + p.full_size = ethash_get_datasize(_n); + return p; +} + +bool Ethasher::verify(BlockInfo const& _header) +{ + bigint boundary = (bigint(1) << 256) / _header.difficulty; + auto e = eval(_header, _header.nonce); + return (u256)e.value <= boundary && e.mixHash == _header.mixHash; +} + +Ethasher::Result Ethasher::eval(BlockInfo const& _header, Nonce const& _nonce) +{ + auto p = Ethasher::params(_header); + ethash_return_value r; + ethash_compute_light(&r, Ethasher::get()->cache(_header).data(), &p, _header.headerHash(WithoutNonce).data(), (uint64_t)(u64)_nonce); + return Result{h256(r.result, h256::ConstructFromPointer), h256(r.mix_hash, h256::ConstructFromPointer)}; +} + diff --git a/libethcore/Ethasher.h b/libethcore/Ethasher.h new file mode 100644 index 000000000..cfe0d1c82 --- /dev/null +++ b/libethcore/Ethasher.h @@ -0,0 +1,97 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file Ethasher.h + * @author Gav Wood + * @date 2014 + * + * ProofOfWork algorithm. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include // TODO: REMOVE once everything merged into this class and an opaque API can be provided. +#include "Common.h" +#include "BlockInfo.h" + +namespace dev +{ +namespace eth +{ + +class Ethasher +{ +public: + Ethasher() {} + + static Ethasher* get() { if (!s_this) s_this = new Ethasher(); return s_this; } + + bytes const& cache(BlockInfo const& _header); + bytesConstRef full(BlockInfo const& _header); + static ethash_params params(BlockInfo const& _header); + static ethash_params params(unsigned _n); + + struct Result + { + h256 value; + h256 mixHash; + }; + + static Result eval(BlockInfo const& _header) { return eval(_header, _header.nonce); } + static Result eval(BlockInfo const& _header, Nonce const& _nonce); + static bool verify(BlockInfo const& _header); + + class Miner + { + public: + Miner(BlockInfo const& _header): + m_headerHash(_header.headerHash(WithoutNonce)), + m_params(Ethasher::params(_header)), + m_datasetPointer(Ethasher::get()->full(_header).data()) + {} + + inline h256 mine(uint64_t _nonce) + { + ethash_compute_full(&m_ethashReturn, m_datasetPointer, &m_params, m_headerHash.data(), _nonce); + return h256(m_ethashReturn.result, h256::ConstructFromPointer); + } + + inline h256 lastMixHash() const + { + return h256(m_ethashReturn.mix_hash, h256::ConstructFromPointer); + } + + private: + ethash_return_value m_ethashReturn; + h256 m_headerHash; + ethash_params m_params; + void const* m_datasetPointer; + }; + +private: + static Ethasher* s_this; + RecursiveMutex x_this; + std::map m_caches; + std::map m_fulls; +}; + +} +} diff --git a/libethcore/Exceptions.cpp b/libethcore/Exceptions.cpp deleted file mode 100644 index 9b07743c5..000000000 --- a/libethcore/Exceptions.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - This file is part of cpp-ethereum. - - cpp-ethereum is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - cpp-ethereum is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . -*/ -/** @file Exceptions.cpp - * @author Gav Wood - * @date 2014 - */ - -#include "Exceptions.h" -#include -#include - -using namespace std; -using namespace dev; -using namespace dev::eth; - -#if ALL_COMPILERS_ARE_CPP11 -#define ETH_RETURN_STRING(S) thread_local static string s_what; s_what = S; return s_what.c_str(); -#elsif USE_BOOST_TLS -static boost::thread_specific_ptr g_exceptionMessage; -#define ETH_RETURN_STRING(S) if (!g_exceptionMessage.get()); g_exceptionMessage.reset(new string); *g_exceptionMessage.get() = S; return g_exceptionMessage.get()->c_str(); -#else -#define ETH_RETURN_STRING(S) m_message = S; return m_message.c_str(); -#endif - -const char* InvalidBlockFormat::what() const noexcept { ETH_RETURN_STRING("Invalid block format: Bad field " + toString(m_f) + " (" + toHex(m_d) + ")"); } -const char* UncleInChain::what() const noexcept { ETH_RETURN_STRING("Uncle in block already mentioned: Uncles " + toString(m_uncles) + " (" + m_block.abridged() + ")"); } -const char* InvalidTransactionsHash::what() const noexcept { ETH_RETURN_STRING("Invalid transactions hash: header says: " + toHex(m_head.ref()) + " block is:" + toHex(m_real.ref())); } -const char* InvalidGasLimit::what() const noexcept { ETH_RETURN_STRING("Invalid gas limit (provided: " + toString(provided) + " valid:" + toString(valid) + ")"); } -const char* InvalidMinGasPrice::what() const noexcept { ETH_RETURN_STRING("Invalid minimum gas price (provided: " + toString(provided) + " limit:" + toString(limit) + ")"); } -const char* InvalidNonce::what() const noexcept { ETH_RETURN_STRING("Invalid nonce (r: " + toString(required) + " c:" + toString(candidate) + ")"); } -const char* InvalidBlockNonce::what() const noexcept { ETH_RETURN_STRING("Invalid nonce (h: " + toString(h) + " n:" + toString(n) + " d:" + toString(d) + ")"); } - diff --git a/libethcore/Exceptions.h b/libethcore/Exceptions.h index 3fd62afbd..0059854f7 100644 --- a/libethcore/Exceptions.h +++ b/libethcore/Exceptions.h @@ -22,6 +22,7 @@ #pragma once #include +#include "Common.h" namespace dev { @@ -32,6 +33,8 @@ namespace eth using errinfo_name = boost::error_info; using errinfo_field = boost::error_info; using errinfo_data = boost::error_info; +using errinfo_nonce = boost::error_info; +using errinfo_difficulty = boost::error_info; using BadFieldError = boost::tuple; struct DatabaseAlreadyOpen: virtual dev::Exception {}; @@ -44,26 +47,27 @@ struct FeeTooSmall: virtual dev::Exception {}; struct TooMuchGasUsed: virtual dev::Exception {}; struct ExtraDataTooBig: virtual dev::Exception {}; struct InvalidSignature: virtual dev::Exception {}; -class InvalidBlockFormat: virtual public dev::Exception { public: InvalidBlockFormat(int _f, bytesConstRef _d): m_f(_f), m_d(_d.toBytes()) {} int m_f; bytes m_d; virtual const char* what() const noexcept; }; +class InvalidBlockFormat: virtual public dev::Exception {}; struct InvalidUnclesHash: virtual dev::Exception {}; struct InvalidUncle: virtual dev::Exception {}; +struct TooManyUncles: virtual dev::Exception {}; struct UncleTooOld: virtual dev::Exception {}; -class UncleInChain: virtual public dev::Exception { public: UncleInChain(h256Set _uncles, h256 _block): m_uncles(_uncles), m_block(_block) {} h256Set m_uncles; h256 m_block; virtual const char* what() const noexcept; }; +class UncleInChain: virtual public dev::Exception {}; struct DuplicateUncleNonce: virtual dev::Exception {}; struct InvalidStateRoot: virtual dev::Exception {}; struct InvalidGasUsed: virtual dev::Exception {}; -class InvalidTransactionsHash: virtual public dev::Exception { public: InvalidTransactionsHash(h256 _head, h256 _real): m_head(_head), m_real(_real) {} h256 m_head; h256 m_real; virtual const char* what() const noexcept; }; +class InvalidTransactionsHash: virtual public dev::Exception {}; struct InvalidTransaction: virtual dev::Exception {}; struct InvalidDifficulty: virtual dev::Exception {}; -class InvalidGasLimit: virtual public dev::Exception { public: InvalidGasLimit(u256 _provided = 0, u256 _valid = 0): provided(_provided), valid(_valid) {} u256 provided; u256 valid; virtual const char* what() const noexcept; }; -class InvalidMinGasPrice: virtual public dev::Exception { public: InvalidMinGasPrice(u256 _provided = 0, u256 _limit = 0): provided(_provided), limit(_limit) {} u256 provided; u256 limit; virtual const char* what() const noexcept; }; +struct InvalidSeedHash: virtual dev::Exception {}; +class InvalidGasLimit: virtual public dev::Exception {}; struct InvalidTransactionGasUsed: virtual dev::Exception {}; struct InvalidTransactionsStateRoot: virtual dev::Exception {}; struct InvalidReceiptsStateRoot: virtual dev::Exception {}; struct InvalidTimestamp: virtual dev::Exception {}; struct InvalidLogBloom: virtual dev::Exception {}; -class InvalidNonce: virtual public dev::Exception { public: InvalidNonce(u256 _required = 0, u256 _candidate = 0): required(_required), candidate(_candidate) {} u256 required; u256 candidate; virtual const char* what() const noexcept; }; -class InvalidBlockNonce: virtual public dev::Exception { public: InvalidBlockNonce(h256 _h = h256(), h256 _n = h256(), u256 _d = 0): h(_h), n(_n), d(_d) {} h256 h; h256 n; u256 d; virtual const char* what() const noexcept; }; +class InvalidNonce: virtual public dev::Exception {}; +class InvalidBlockNonce: virtual public dev::Exception {}; struct InvalidParentHash: virtual dev::Exception {}; struct InvalidNumber: virtual dev::Exception {}; struct InvalidContractAddress: virtual public dev::Exception {}; diff --git a/libethcore/Params.cpp b/libethcore/Params.cpp new file mode 100644 index 000000000..d1154abcc --- /dev/null +++ b/libethcore/Params.cpp @@ -0,0 +1,78 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file FeeStructure.cpp + * @author Gav Wood + * @date 2014 + */ + +#include "Params.h" + +using namespace std; +namespace dev +{ +namespace eth +{ + +//--- BEGIN: AUTOGENERATED FROM /feeStructure.json +u256 const c_genesisDifficulty = 131072; +u256 const c_maximumExtraDataSize = 1024; +u256 const c_epochDuration = 3000; +u256 const c_genesisGasLimit = 1000000; +u256 const c_minGasLimit = 125000; +u256 const c_gasLimitBoundDivisor = 1024; +u256 const c_minimumDifficulty = 131072; +u256 const c_difficultyBoundDivisor = 2048; +u256 const c_durationLimit = 8; +u256 const c_tierStepGas[] = {0, 2, 3, 5, 8, 10, 20, 0}; +u256 const c_expGas = 10; +u256 const c_expByteGas = 10; +u256 const c_sha3Gas = 30; +u256 const c_sha3WordGas = 6; +u256 const c_sloadGas = 50; +u256 const c_sstoreSetGas = 20000; +u256 const c_sstoreResetGas = 5000; +u256 const c_sstoreClearGas = 5000; +u256 const c_sstoreRefundGas = 15000; +u256 const c_jumpdestGas = 1; +u256 const c_logGas = 375; +u256 const c_logDataGas = 8; +u256 const c_logTopicGas = 375; +u256 const c_createGas = 32000; +u256 const c_callGas = 40; +u256 const c_callStipend = 2300; +u256 const c_callValueTransferGas = 9000; +u256 const c_callNewAccountGas = 25000; +u256 const c_suicideRefundGas = 24000; +u256 const c_memoryGas = 3; +u256 const c_quadCoeffDiv = 512; +u256 const c_createDataGas = 200; +u256 const c_txGas = 21000; +u256 const c_txDataZeroGas = 4; +u256 const c_txDataNonZeroGas = 68; +u256 const c_copyGas = 3; +u256 const c_ecrecoverGas = 3000; +u256 const c_sha256Gas = 60; +u256 const c_sha256WordGas = 12; +u256 const c_ripemd160Gas = 600; +u256 const c_ripemd160WordGas = 120; +u256 const c_identityGas = 15; +u256 const c_identityWordGas = 3; +//--- END: AUTOGENERATED FROM /feeStructure.json + +} +} + diff --git a/libethcore/Params.h b/libethcore/Params.h new file mode 100644 index 000000000..cab1852fa --- /dev/null +++ b/libethcore/Params.h @@ -0,0 +1,78 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file FeeStructure.h + * @author Gav Wood + * @date 2014 + */ + +#pragma once + +#include + +namespace dev +{ +namespace eth +{ + +//--- BEGIN: AUTOGENERATED FROM /feeStructure.json +extern u256 const c_genesisDifficulty; +extern u256 const c_maximumExtraDataSize; +extern u256 const c_epochDuration; +extern u256 const c_genesisGasLimit; +extern u256 const c_minGasLimit; +extern u256 const c_gasLimitBoundDivisor; +extern u256 const c_minimumDifficulty; +extern u256 const c_difficultyBoundDivisor; +extern u256 const c_durationLimit; + +extern u256 const c_tierStepGas[8]; ///< Once per operation, for a selection of them. +extern u256 const c_expGas; ///< Once per EXP instuction. +extern u256 const c_expByteGas; ///< Times ceil(log256(exponent)) for the EXP instruction. +extern u256 const c_sha3Gas; ///< Once per SHA3 operation. +extern u256 const c_sha3WordGas; ///< Once per word of the SHA3 operation's data. +extern u256 const c_copyGas; ///< Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added. +extern u256 const c_sloadGas; ///< Once per SLOAD operation. +extern u256 const c_sstoreSetGas; ///< Once per SSTORE operation if the zeroness changes from zero. +extern u256 const c_sstoreResetGas; ///< Once per SSTORE operation if the zeroness doesn't change. +extern u256 const c_sstoreClearGas; ///< Once per SSTORE operation if the zeroness changes to zero. +extern u256 const c_sstoreRefundGas; ///< Refunded gas, once per SSTORE operation if the zeroness changes to zero. +extern u256 const c_jumpdestGas; ///< Once per JUMPDEST operation. +extern u256 const c_logGas; ///< Per LOG* operation. +extern u256 const c_logDataGas; ///< Per byte in a LOG* operation's data. +extern u256 const c_logTopicGas; ///< Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas. +extern u256 const c_createGas; ///< Once per CREATE operation & contract-creation transaction. +extern u256 const c_createDataGas; +extern u256 const c_callGas; ///< Once per CALL operation & message call transaction. +extern u256 const c_callStipend; ///< Free gas given at beginning of call. +extern u256 const c_callNewAccountGas; ///< Paid for CALL when the destination address didn't exist prior. +extern u256 const c_callValueTransferGas; ///< Paid for CALL when the value transfor is non-zero. +extern u256 const c_suicideRefundGas; ///< Refunded following a suicide operation. +extern u256 const c_memoryGas; ///< Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL. +extern u256 const c_quadCoeffDiv; ///< Divisor for the quadratic particle of the memory cost equation. +extern u256 const c_txGas; ///< Per transaction. NOTE: Not payable on data of calls between transactions. +extern u256 const c_txDataZeroGas; ///< Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions. +extern u256 const c_txDataNonZeroGas; ///< Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions. +extern u256 const c_ecrecoverGas; +extern u256 const c_sha256Gas; +extern u256 const c_sha256WordGas; +extern u256 const c_ripemd160Gas; +extern u256 const c_ripemd160WordGas; +extern u256 const c_identityGas; +extern u256 const c_identityWordGas; + +} +} diff --git a/libethcore/ProofOfWork.cpp b/libethcore/ProofOfWork.cpp index 181e379b5..d261ccb1c 100644 --- a/libethcore/ProofOfWork.cpp +++ b/libethcore/ProofOfWork.cpp @@ -20,12 +20,18 @@ */ #include +#include #include #include #include #include +#include +#include #include +#include #include +#include "BlockInfo.h" +#include "Ethasher.h" #include "ProofOfWork.h" using namespace std; using namespace std::chrono; @@ -35,72 +41,56 @@ namespace dev namespace eth { -template -static inline void update(_T& _sha, u256 const& _value) +bool Ethash::verify(BlockInfo const& _header) { - int i = 0; - for (u256 v = _value; v; ++i, v >>= 8) {} - byte buf[32]; - bytesRef bufRef(buf, i); - toBigEndian(_value, bufRef); - _sha.Update(buf, i); + return Ethasher::verify(_header); } -template -static inline void update(_T& _sha, h256 const& _value) +std::pair Ethash::mine(BlockInfo const& _header, unsigned _msTimeout, bool _continue, bool _turbo) { - int i = 0; - byte const* data = _value.data(); - for (; i != 32 && data[i] == 0; ++i); - _sha.Update(data + i, 32 - i); -} + Ethasher::Miner m(_header); -template -static inline h256 get(_T& _sha) -{ - h256 ret; - _sha.TruncatedFinal(&ret[0], 32); - return ret; -} + std::pair ret; + static std::mt19937_64 s_eng((time(0) + *reinterpret_cast(m_last.data()))); + uint64_t tryNonce = (uint64_t)(u64)(m_last = Nonce::random(s_eng)); -h256 DaggerEvaluator::node(h256 const& _root, h256 const& _xn, uint_fast32_t _L, uint_fast32_t _i) -{ - if (_L == _i) - return _root; - u256 m = (_L == 9) ? 16 : 3; - CryptoPP::SHA3_256 bsha; - for (uint_fast32_t k = 0; k < m; ++k) + bigint boundary = (bigint(1) << 256) / _header.difficulty; + ret.first.requirement = log2((double)boundary); + + // 2^ 0 32 64 128 256 + // [--------*-------------------------] + // + // evaluate until we run out of time + auto startTime = std::chrono::steady_clock::now(); + if (!_turbo) + std::this_thread::sleep_for(std::chrono::milliseconds(_msTimeout * 90 / 100)); + double best = 1e99; // high enough to be effectively infinity :) + Proof result; + unsigned hashCount = 0; + for (; (std::chrono::steady_clock::now() - startTime) < std::chrono::milliseconds(_msTimeout) && _continue; tryNonce++, hashCount++) { - CryptoPP::SHA3_256 sha; - update(sha, _root); - update(sha, _xn); - update(sha, (u256)_L); - update(sha, (u256)_i); - update(sha, (u256)k); - uint_fast32_t pk = (uint_fast32_t)(u256)get(sha) & ((1 << ((_L - 1) * 3)) - 1); - auto u = node(_root, _xn, _L - 1, pk); - update(bsha, u); + u256 val(m.mine(tryNonce)); + best = std::min(best, log2((double)val)); + if (val <= boundary) + { + ret.first.completed = true; + result.mixHash = m.lastMixHash(); + result.nonce = u64(tryNonce); + break; + } } - return get(bsha); -} + ret.first.hashes = hashCount; + ret.first.best = best; + ret.second = result; -h256 DaggerEvaluator::eval(h256 const& _root, h256 const& _nonce) -{ - h256 extranonce = (u256)_nonce >> 26; // with xn = floor(n / 2^26) -> assuming this is with xn = floor(N / 2^26) - CryptoPP::SHA3_256 bsha; - for (uint_fast32_t k = 0; k < 4; ++k) + if (ret.first.completed) { - //sha256(D || xn || i || k) -> sha256(D || xn || k) - there's no 'i' here! - CryptoPP::SHA3_256 sha; - update(sha, _root); - update(sha, extranonce); - update(sha, _nonce); - update(sha, (u256)k); - uint_fast32_t pk = (uint_fast32_t)(u256)get(sha) & 0x1ffffff; // mod 8^8 * 2 [ == mod 2^25 ?! ] [ == & ((1 << 25) - 1) ] [ == & 0x1ffffff ] - auto u = node(_root, extranonce, 9, pk); - update(bsha, u); + BlockInfo test = _header; + assignResult(result, test); + assert(verify(test)); } - return get(bsha); + + return ret; } } diff --git a/libethcore/ProofOfWork.h b/libethcore/ProofOfWork.h index c3c3f192b..250ddb73d 100644 --- a/libethcore/ProofOfWork.h +++ b/libethcore/ProofOfWork.h @@ -27,7 +27,8 @@ #include #include #include -#include "CommonEth.h" +#include "Common.h" +#include "BlockInfo.h" #define FAKE_DAGGER 1 @@ -45,47 +46,58 @@ struct MineInfo bool completed = false; }; -template -class ProofOfWorkEngine: public Evaluator +class Ethash { public: - static bool verify(h256 const& _root, h256 const& _nonce, u256 const& _difficulty) { return (bigint)(u256)Evaluator::eval(_root, _nonce) <= (bigint(1) << 256) / _difficulty; } + struct Proof + { + Nonce nonce; + h256 mixHash; + }; - inline std::pair mine(h256 const& _root, u256 const& _difficulty, unsigned _msTimeout = 100, bool _continue = true, bool _turbo = false); + static bool verify(BlockInfo const& _header); + std::pair mine(BlockInfo const& _header, unsigned _msTimeout = 100, bool _continue = true, bool _turbo = false); + static void assignResult(Proof const& _r, BlockInfo& _header) { _header.nonce = _r.nonce; _header.mixHash = _r.mixHash; } protected: - h256 m_last; + Nonce m_last; }; -class SHA3Evaluator +template +class ProofOfWorkEngine: public Evaluator { public: - static h256 eval(h256 const& _root, h256 const& _nonce) { h256 b[2] = { _root, _nonce }; return sha3(bytesConstRef((byte const*)&b[0], 64)); } -}; + using Proof = Nonce; -// TODO: class ARPoWEvaluator + static bool verify(BlockInfo const& _header) { return (bigint)(u256)Evaluator::eval(_header.headerHash(WithoutNonce), _header.nonce) <= (bigint(1) << 256) / _header.difficulty; } + inline std::pair mine(BlockInfo const& _header, unsigned _msTimeout = 100, bool _continue = true, bool _turbo = false); + static void assignResult(Proof const& _r, BlockInfo& _header) { _header.nonce = _r; } -class DaggerEvaluator +protected: + Nonce m_last; +}; + +class SHA3Evaluator { public: - static h256 eval(h256 const& _root, h256 const& _nonce); - -private: - static h256 node(h256 const& _root, h256 const& _xn, uint_fast32_t _L, uint_fast32_t _i); + static h256 eval(h256 const& _root, Nonce const& _nonce) { h256 b[2] = { _root, h256(_nonce) }; return sha3(bytesConstRef((byte const*)&b[0], 64)); } }; using SHA3ProofOfWork = ProofOfWorkEngine; -using ProofOfWork = SHA3ProofOfWork; +using ProofOfWork = Ethash; template -std::pair ProofOfWorkEngine::mine(h256 const& _root, u256 const& _difficulty, unsigned _msTimeout, bool _continue, bool _turbo) +std::pair::Proof> ProofOfWorkEngine::mine(BlockInfo const& _header, unsigned _msTimeout, bool _continue, bool _turbo) { - std::pair ret; + auto headerHashWithoutNonce = _header.headerHash(WithoutNonce); + auto difficulty = _header.difficulty; + + std::pair ret; static std::mt19937_64 s_eng((time(0) + *reinterpret_cast(m_last.data()))); - u256 s = (m_last = h256::random(s_eng)); + Nonce::Arith s = (m_last = Nonce::random(s_eng)); - bigint d = (bigint(1) << 256) / _difficulty; + bigint d = (bigint(1) << 256) / difficulty; ret.first.requirement = log2((double)d); // 2^ 0 32 64 128 256 @@ -96,12 +108,12 @@ std::pair ProofOfWorkEngine::mine(h256 const& _root, if (!_turbo) std::this_thread::sleep_for(std::chrono::milliseconds(_msTimeout * 90 / 100)); double best = 1e99; // high enough to be effectively infinity :) - h256 solution; + ProofOfWorkEngine::Proof solution; unsigned h = 0; for (; (std::chrono::steady_clock::now() - startTime) < std::chrono::milliseconds(_msTimeout) && _continue; s++, h++) { - solution = (h256)s; - auto e = (bigint)(u256)Evaluator::eval(_root, solution); + solution = (ProofOfWorkEngine::Proof)s; + auto e = (bigint)(u256)Evaluator::eval(headerHashWithoutNonce, solution); best = std::min(best, log2((double)e)); if (e <= d) { @@ -114,7 +126,11 @@ std::pair ProofOfWorkEngine::mine(h256 const& _root, ret.second = solution; if (ret.first.completed) - assert(verify(_root, solution, _difficulty)); + { + BlockInfo test = _header; + assignResult(solution, test); + assert(verify(test)); + } return ret; } diff --git a/libethereum/Account.cpp b/libethereum/Account.cpp index 74b6ebe7b..13eb0a8cd 100644 --- a/libethereum/Account.cpp +++ b/libethereum/Account.cpp @@ -20,7 +20,7 @@ */ #include "Account.h" -#include +#include using namespace std; using namespace dev; using namespace dev::eth; diff --git a/libethereum/Account.h b/libethereum/Account.h index 3f3a5d548..2cc962baa 100644 --- a/libethereum/Account.h +++ b/libethereum/Account.h @@ -76,28 +76,40 @@ public: ContractConception }; + /// Changedness of account to create. + enum Changedness + { + /// Account starts as though it has been changed. + Changed, + /// Account starts as though it has not been changed. + Unchanged + }; + /// Construct a dead Account. Account() {} /// Construct an alive Account, with given endowment, for either a normal (non-contract) account or for a /// contract account in the /// conception phase, where the code is not yet known. - Account(u256 _balance, NewAccountType _t): m_isAlive(true), m_balance(_balance), m_codeHash(_t == NormalCreation ? EmptySHA3 : c_contractConceptionCodeHash) {} + Account(u256 _balance, NewAccountType _t, Changedness _c = Changed): m_isAlive(true), m_isUnchanged(_c == Unchanged), m_balance(_balance), m_codeHash(_t == NormalCreation ? EmptySHA3 : c_contractConceptionCodeHash) {} /// Explicit constructor for wierd cases of construction of a normal account. - Account(u256 _nonce, u256 _balance): m_isAlive(true), m_nonce(_nonce), m_balance(_balance) {} + Account(u256 _nonce, u256 _balance, Changedness _c = Changed): m_isAlive(true), m_isUnchanged(_c == Unchanged), m_nonce(_nonce), m_balance(_balance) {} /// Explicit constructor for wierd cases of construction or a contract account. - Account(u256 _nonce, u256 _balance, h256 _contractRoot, h256 _codeHash): m_isAlive(true), m_nonce(_nonce), m_balance(_balance), m_storageRoot(_contractRoot), m_codeHash(_codeHash) { assert(_contractRoot); } + Account(u256 _nonce, u256 _balance, h256 _contractRoot, h256 _codeHash, Changedness _c): m_isAlive(true), m_isUnchanged(_c == Unchanged), m_nonce(_nonce), m_balance(_balance), m_storageRoot(_contractRoot), m_codeHash(_codeHash) { assert(_contractRoot); } /// Kill this account. Useful for the suicide opcode. Following this call, isAlive() returns false. - void kill() { m_isAlive = false; m_storageOverlay.clear(); m_codeHash = EmptySHA3; m_storageRoot = EmptyTrie; m_balance = 0; m_nonce = 0; } + void kill() { m_isAlive = false; m_storageOverlay.clear(); m_codeHash = EmptySHA3; m_storageRoot = EmptyTrie; m_balance = 0; m_nonce = 0; changed(); } /// @returns true iff this object represents an account in the state. Returns false if this object /// represents an account that should no longer exist in the trie (an account that never existed or was /// suicided). bool isAlive() const { return m_isAlive; } + /// @returns true if the account is unchanged from creation. + bool isDirty() const { return !m_isUnchanged; } + /// @returns the balance of this account. Can be altered in place. u256& balance() { return m_balance; } @@ -106,7 +118,7 @@ public: u256 const& balance() const { return m_balance; } /// Increments the balance of this account by the given amount. It's a bigint, so can be negative. - void addBalance(bigint _i) { m_balance = (u256)((bigint)m_balance + _i); } + void addBalance(bigint _i) { if (!_i) return; m_balance = (u256)((bigint)m_balance + _i); changed(); } /// @returns the nonce of the account. Can be altered in place. u256& nonce() { return m_nonce; } @@ -115,7 +127,7 @@ public: u256 const& nonce() const { return m_nonce; } /// Increment the nonce of the account by one. - void incNonce() { m_nonce++; } + void incNonce() { m_nonce++; changed(); } /// @returns the root of the trie (whose nodes are stored in the state db externally to this class) @@ -127,7 +139,7 @@ public: /// Set a key/value pair in the account's storage. This actually goes into the overlay, for committing /// to the trie later. - void setStorage(u256 _p, u256 _v) { m_storageOverlay[_p] = _v; } + void setStorage(u256 _p, u256 _v) { m_storageOverlay[_p] = _v; changed(); } /// @returns true if we are in the contract-conception state and setCode is valid to call. bool isFreshCode() const { return m_codeHash == c_contractConceptionCodeHash; } @@ -140,8 +152,8 @@ public: h256 codeHash() const { assert(!isFreshCode()); return m_codeHash; } /// Sets the code of the account. Must only be called when isFreshCode() returns true. - void setCode(bytes&& _code) { assert(isFreshCode()); m_codeCache = _code; } - void setCode(bytes const& _code) { assert(isFreshCode()); m_codeCache = _code; } + void setCode(bytes&& _code) { assert(isFreshCode()); m_codeCache = _code; changed(); } + void setCode(bytes const& _code) { assert(isFreshCode()); m_codeCache = _code; changed(); } /// @returns true if the account's code is available through code(). bool codeCacheValid() const { return m_codeHash == EmptySHA3 || m_codeHash == c_contractConceptionCodeHash || m_codeCache.size(); } @@ -154,9 +166,15 @@ public: bytes const& code() const { assert(codeCacheValid()); return m_codeCache; } private: + /// Note that we've altered the account. + void changed() { m_isUnchanged = false; } + /// Is this account existant? If not, it represents a deleted account. bool m_isAlive = false; + /// True if we've not made any alteration to the account having been given it's properties directly. + bool m_isUnchanged = false; + /// Account's nonce. u256 m_nonce = 0; diff --git a/libethereum/AccountDiff.h b/libethereum/AccountDiff.h index 0c0ede4ae..dd494c0a5 100644 --- a/libethereum/AccountDiff.h +++ b/libethereum/AccountDiff.h @@ -23,7 +23,7 @@ #include #include -#include +#include namespace dev { diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index aabce4d4b..dd0bfad67 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -19,6 +19,8 @@ * @date 2014 */ +#include + #include "BlockChain.h" #include @@ -44,14 +46,17 @@ namespace js = json_spirit; std::ostream& dev::eth::operator<<(std::ostream& _out, BlockChain const& _bc) { string cmp = toBigEndianString(_bc.currentHash()); - auto it = _bc.m_extrasDB->NewIterator(_bc.m_readOptions); + auto it = _bc.m_blocksDB->NewIterator(_bc.m_readOptions); for (it->SeekToFirst(); it->Valid(); it->Next()) if (it->key().ToString() != "best") { - string rlpString = it->value().ToString(); - RLP r(rlpString); - BlockDetails d(r); - _out << toHex(it->key().ToString()) << ": " << d.number << " @ " << d.parent << (cmp == it->key().ToString() ? " BEST" : "") << std::endl; + try { + BlockInfo d(bytesConstRef(it->value())); + _out << toHex(it->key().ToString()) << ": " << d.number << " @ " << d.parentHash << (cmp == it->key().ToString() ? " BEST" : "") << std::endl; + } + catch (...) { + cwarn << "Invalid DB entry:" << toHex(it->key().ToString()) << " -> " << toHex(bytesConstRef(it->value())); + } } delete it; return _out; @@ -71,8 +76,33 @@ ldb::Slice dev::eth::toSlice(h256 _h, unsigned _sub) #endif } +#if ETH_DEBUG +static const chrono::system_clock::duration c_collectionDuration = chrono::seconds(15); +static const unsigned c_collectionQueueSize = 2; +static const unsigned c_maxCacheSize = 1024 * 1024 * 1; +static const unsigned c_minCacheSize = 1; +#else + +/// Duration between flushes. +static const chrono::system_clock::duration c_collectionDuration = chrono::seconds(60); + +/// Length of death row (total time in cache is multiple of this and collection duration). +static const unsigned c_collectionQueueSize = 20; + +/// Max size, above which we start forcing cache reduction. +static const unsigned c_maxCacheSize = 1024 * 1024 * 64; + +/// Min size, below which we don't bother flushing it. +static const unsigned c_minCacheSize = 1024 * 1024 * 32; + +#endif + BlockChain::BlockChain(bytes const& _genesisBlock, std::string _path, bool _killExisting) { + // initialise deathrow. + m_cacheUsage.resize(c_collectionQueueSize); + m_lastCollection = chrono::system_clock::now(); + // Initialise with the genesis as the last block on the longest chain. m_genesisBlock = _genesisBlock; m_genesisHash = sha3(RLP(m_genesisBlock)[0].data()); @@ -98,9 +128,9 @@ void BlockChain::open(std::string _path, bool _killExisting) ldb::Options o; o.create_if_missing = true; - ldb::DB::Open(o, _path + "/blocks", &m_db); + ldb::DB::Open(o, _path + "/blocks", &m_blocksDB); ldb::DB::Open(o, _path + "/details", &m_extrasDB); - if (!m_db) + if (!m_blocksDB) BOOST_THROW_EXCEPTION(DatabaseAlreadyOpen()); if (!m_extrasDB) BOOST_THROW_EXCEPTION(DatabaseAlreadyOpen()); @@ -128,10 +158,10 @@ void BlockChain::close() { cnote << "Closing blockchain DB"; delete m_extrasDB; - delete m_db; + delete m_blocksDB; m_lastBlockHash = m_genesisHash; m_details.clear(); - m_cache.clear(); + m_blocks.clear(); } template @@ -213,7 +243,7 @@ h256s BlockChain::import(bytes const& _block, OverlayDB const& _db) RLP blockRLP(_block); if (!blockRLP.isList()) - BOOST_THROW_EXCEPTION(InvalidBlockFormat(0, blockRLP.data()) << errinfo_comment("block header needs to be a list")); + BOOST_THROW_EXCEPTION(InvalidBlockFormat() << errinfo_comment("block header needs to be a list") << BadFieldError(0, blockRLP.data().toString())); bi.populate(&_block); bi.verifyInternals(&_block); @@ -290,6 +320,23 @@ h256s BlockChain::import(bytes const& _block, OverlayDB const& _db) m_details[newHash] = BlockDetails((unsigned)pd.number + 1, td, bi.parentHash, {}); m_details[bi.parentHash].children.push_back(newHash); } + { + WriteGuard l(x_blockHashes); + m_blockHashes[h256(bi.number)].value = newHash; + } + // Collate transaction hashes and remember who they were. + h256s tas; + { + RLP blockRLP(_block); + TransactionAddress ta; + ta.blockHash = newHash; + WriteGuard l(x_transactionAddresses); + for (ta.index = 0; ta.index < blockRLP[1].itemCount(); ++ta.index) + { + tas.push_back(sha3(blockRLP[1][ta.index].data())); + m_transactionAddresses[tas.back()] = ta; + } + } { WriteGuard l(x_logBlooms); m_logBlooms[newHash] = blb; @@ -299,11 +346,14 @@ h256s BlockChain::import(bytes const& _block, OverlayDB const& _db) m_receipts[newHash] = br; } - m_extrasDB->Put(m_writeOptions, toSlice(newHash), (ldb::Slice)dev::ref(m_details[newHash].rlp())); - m_extrasDB->Put(m_writeOptions, toSlice(bi.parentHash), (ldb::Slice)dev::ref(m_details[bi.parentHash].rlp())); - m_extrasDB->Put(m_writeOptions, toSlice(newHash, 3), (ldb::Slice)dev::ref(m_logBlooms[newHash].rlp())); - m_extrasDB->Put(m_writeOptions, toSlice(newHash, 4), (ldb::Slice)dev::ref(m_receipts[newHash].rlp())); - m_db->Put(m_writeOptions, toSlice(newHash), (ldb::Slice)ref(_block)); + m_blocksDB->Put(m_writeOptions, toSlice(newHash), (ldb::Slice)ref(_block)); + m_extrasDB->Put(m_writeOptions, toSlice(newHash, ExtraDetails), (ldb::Slice)dev::ref(m_details[newHash].rlp())); + m_extrasDB->Put(m_writeOptions, toSlice(bi.parentHash, ExtraDetails), (ldb::Slice)dev::ref(m_details[bi.parentHash].rlp())); + m_extrasDB->Put(m_writeOptions, toSlice(h256(bi.number), ExtraBlockHash), (ldb::Slice)dev::ref(m_blockHashes[h256(bi.number)].rlp())); + for (auto const& h: tas) + m_extrasDB->Put(m_writeOptions, toSlice(h, ExtraTransactionAddress), (ldb::Slice)dev::ref(m_transactionAddresses[h].rlp())); + m_extrasDB->Put(m_writeOptions, toSlice(newHash, ExtraLogBlooms), (ldb::Slice)dev::ref(m_logBlooms[newHash].rlp())); + m_extrasDB->Put(m_writeOptions, toSlice(newHash, ExtraReceipts), (ldb::Slice)dev::ref(m_receipts[newHash].rlp())); #if ETH_PARANOIA checkConsistency(); @@ -403,13 +453,110 @@ h256s BlockChain::treeRoute(h256 _from, h256 _to, h256* o_common, bool _pre, boo return ret; } +void BlockChain::noteUsed(h256 const& _h, unsigned _extra) const +{ + auto id = CacheID(_h, _extra); + Guard l(x_cacheUsage); + m_cacheUsage[0].insert(id); + if (m_cacheUsage[1].count(id)) + m_cacheUsage[1].erase(id); + else + m_inUse.insert(id); +} + +template static unsigned getHashSize(map const& _map) +{ + unsigned ret = 0; + for (auto const& i: _map) + ret += i.second.size + 64; + return ret; +} + +void BlockChain::updateStats() const +{ + { + ReadGuard l1(x_blocks); + m_lastStats.memBlocks = 0; + for (auto const& i: m_blocks) + m_lastStats.memBlocks += i.second.size() + 64; + } + { + ReadGuard l2(x_details); + m_lastStats.memDetails = getHashSize(m_details); + } + { + ReadGuard l5(x_logBlooms); + m_lastStats.memLogBlooms = getHashSize(m_logBlooms); + } + { + ReadGuard l4(x_receipts); + m_lastStats.memReceipts = getHashSize(m_receipts); + } + { + ReadGuard l3(x_blockHashes); + m_lastStats.memBlockHashes = getHashSize(m_blockHashes); + } + { + ReadGuard l6(x_transactionAddresses); + m_lastStats.memTransactionAddresses = getHashSize(m_transactionAddresses); + } +} + +void BlockChain::garbageCollect(bool _force) +{ + updateStats(); + + if (!_force && chrono::system_clock::now() < m_lastCollection + c_collectionDuration && m_lastStats.memTotal() < c_maxCacheSize) + return; + if (m_lastStats.memTotal() < c_minCacheSize) + return; + + m_lastCollection = chrono::system_clock::now(); + + Guard l(x_cacheUsage); + WriteGuard l1(x_blocks); + WriteGuard l2(x_details); + WriteGuard l3(x_blockHashes); + WriteGuard l4(x_receipts); + WriteGuard l5(x_logBlooms); + WriteGuard l6(x_transactionAddresses); + for (CacheID const& id: m_cacheUsage.back()) + { + m_inUse.erase(id); + // kill i from cache. + switch (id.second) + { + case (unsigned)-1: + m_blocks.erase(id.first); + break; + case ExtraDetails: + m_details.erase(id.first); + break; + case ExtraBlockHash: + m_blockHashes.erase(id.first); + break; + case ExtraReceipts: + m_receipts.erase(id.first); + break; + case ExtraLogBlooms: + m_logBlooms.erase(id.first); + break; + case ExtraTransactionAddress: + m_transactionAddresses.erase(id.first); + break; + } + } + m_cacheUsage.pop_back(); + m_cacheUsage.push_front(std::set{}); +} + void BlockChain::checkConsistency() { { WriteGuard l(x_details); m_details.clear(); } - ldb::Iterator* it = m_db->NewIterator(m_readOptions); + ldb::Iterator* it = m_blocksDB->NewIterator(m_readOptions); for (it->SeekToFirst(); it->Valid(); it->Next()) if (it->key().size() == 32) { @@ -452,12 +599,12 @@ bool BlockChain::isKnown(h256 _hash) const if (_hash == m_genesisHash) return true; { - ReadGuard l(x_cache); - if (m_cache.count(_hash)) + ReadGuard l(x_blocks); + if (m_blocks.count(_hash)) return true; } string d; - m_db->Get(m_readOptions, ldb::Slice((char const*)&_hash, 32), &d); + m_blocksDB->Get(m_readOptions, ldb::Slice((char const*)&_hash, 32), &d); return !!d.size(); } @@ -467,14 +614,14 @@ bytes BlockChain::block(h256 _hash) const return m_genesisBlock; { - ReadGuard l(x_cache); - auto it = m_cache.find(_hash); - if (it != m_cache.end()) + ReadGuard l(x_blocks); + auto it = m_blocks.find(_hash); + if (it != m_blocks.end()) return it->second; } string d; - m_db->Get(m_readOptions, ldb::Slice((char const*)&_hash, 32), &d); + m_blocksDB->Get(m_readOptions, ldb::Slice((char const*)&_hash, 32), &d); if (!d.size()) { @@ -482,18 +629,11 @@ bytes BlockChain::block(h256 _hash) const return bytes(); } - WriteGuard l(x_cache); - m_cache[_hash].resize(d.size()); - memcpy(m_cache[_hash].data(), d.data(), d.size()); + WriteGuard l(x_blocks); + m_blocks[_hash].resize(d.size()); + memcpy(m_blocks[_hash].data(), d.data(), d.size()); - return m_cache[_hash]; -} + noteUsed(_hash); -h256 BlockChain::numberHash(unsigned _n) const -{ - if (!_n) - return genesisHash(); - h256 ret = currentHash(); - for (; _n < details().number; ++_n, ret = details(ret).parent) {} - return ret; + return m_blocks[_hash]; } diff --git a/libethereum/BlockChain.h b/libethereum/BlockChain.h index 576deaadf..0c1a81066 100644 --- a/libethereum/BlockChain.h +++ b/libethereum/BlockChain.h @@ -26,14 +26,16 @@ #include #pragma warning(pop) -#include +#include +#include #include #include -#include +#include #include #include #include "BlockDetails.h" #include "Account.h" +#include "Transaction.h" #include "BlockQueue.h" namespace ldb = leveldb; @@ -61,6 +63,17 @@ std::map const& genesisState(); ldb::Slice toSlice(h256 _h, unsigned _sub = 0); +using BlocksHash = std::map; +using TransactionHashes = h256s; + +enum { + ExtraDetails = 0, + ExtraBlockHash, + ExtraTransactionAddress, + ExtraLogBlooms, + ExtraReceipts +}; + /** * @brief Implements the blockchain database. All data this gives is disk-backed. * @threadsafe @@ -96,24 +109,34 @@ public: BlockInfo info(h256 _hash) const { return BlockInfo(block(_hash)); } BlockInfo info() const { return BlockInfo(block()); } - /// Get the familiar details concerning a block (or the most recent mined if none given). Thread-safe. - BlockDetails details(h256 _hash) const { return queryExtras(_hash, m_details, x_details, NullBlockDetails); } + /// Get a block (RLP format) for the given hash (or the most recent mined if none given). Thread-safe. + bytes block(h256 _hash) const; + bytes block() const { return block(currentHash()); } + + /// Get the familial details concerning a block (or the most recent mined if none given). Thread-safe. + BlockDetails details(h256 _hash) const { return queryExtras(_hash, m_details, x_details, NullBlockDetails); } BlockDetails details() const { return details(currentHash()); } /// Get the transactions' log blooms of a block (or the most recent mined if none given). Thread-safe. - BlockLogBlooms logBlooms(h256 _hash) const { return queryExtras(_hash, m_logBlooms, x_logBlooms, NullBlockLogBlooms); } + BlockLogBlooms logBlooms(h256 _hash) const { return queryExtras(_hash, m_logBlooms, x_logBlooms, NullBlockLogBlooms); } BlockLogBlooms logBlooms() const { return logBlooms(currentHash()); } /// Get the transactions' receipts of a block (or the most recent mined if none given). Thread-safe. - BlockReceipts receipts(h256 _hash) const { return queryExtras(_hash, m_receipts, x_receipts, NullBlockReceipts); } + BlockReceipts receipts(h256 _hash) const { return queryExtras(_hash, m_receipts, x_receipts, NullBlockReceipts); } BlockReceipts receipts() const { return receipts(currentHash()); } - /// Get a block (RLP format) for the given hash (or the most recent mined if none given). Thread-safe. - bytes block(h256 _hash) const; - bytes block() const { return block(currentHash()); } + /// Get a list of transaction hashes for a given block. Thread-safe. + TransactionHashes transactionHashes(h256 _hash) const { auto b = block(_hash); RLP rlp(b); h256s ret; for (auto t: rlp[1]) ret.push_back(sha3(t.data())); return ret; } + TransactionHashes transactionHashes() const { return transactionHashes(currentHash()); } + + /// Get a list of transaction hashes for a given block. Thread-safe. + h256 numberHash(u256 _index) const { if (!_index) return genesisHash(); return queryExtras(h256(_index), m_blockHashes, x_blockHashes, NullBlockHash).value; } + + /// Get a transaction from its hash. Thread-safe. + bytes transaction(h256 _transactionHash) const { TransactionAddress ta = queryExtras(_transactionHash, m_transactionAddresses, x_transactionAddresses, NullTransactionAddress); if (!ta) return bytes(); return transaction(ta.blockHash, ta.index); } /// Get a block's transaction (RLP format) for the given block hash (or the most recent mined if none given) & index. Thread-safe. - bytes transaction(h256 _hash, unsigned _i) const { bytes b = block(_hash); return RLP(b)[1][_i].data().toBytes(); } + bytes transaction(h256 _blockHash, unsigned _i) const { bytes b = block(_blockHash); return RLP(b)[1][_i].data().toBytes(); } bytes transaction(unsigned _i) const { return transaction(currentHash(), _i); } /// Get a number for the given hash (or the most recent mined if none given). Thread-safe. @@ -126,9 +149,6 @@ public: /// Get the hash of the genesis block. Thread-safe. h256 genesisHash() const { return m_genesisHash; } - /// Get the hash of a block of a given number. Slow; try not to use it too much. - h256 numberHash(unsigned _n) const; - /// Get all blocks not allowed as uncles given a parent (i.e. featured as uncles/main in parent, parent + 1, ... parent + 5). /// @returns set including the header-hash of every parent (including @a _parent) up to and including generation +5 /// togther with all their quoted uncles. @@ -150,6 +170,23 @@ public: */ h256s treeRoute(h256 _from, h256 _to, h256* o_common = nullptr, bool _pre = true, bool _post = true) const; + struct Statistics + { + unsigned memBlocks; + unsigned memDetails; + unsigned memLogBlooms; + unsigned memReceipts; + unsigned memTransactionAddresses; + unsigned memBlockHashes; + unsigned memTotal() const { return memBlocks + memDetails + memLogBlooms + memReceipts + memTransactionAddresses + memBlockHashes; } + }; + + /// @returns statistics about memory usage. + Statistics usage(bool _freshen = false) const { if (_freshen) updateStats(); return m_lastStats; } + + /// Deallocate unused data. + void garbageCollect(bool _force = false); + private: void open(std::string _path, bool _killExisting = false); void close(); @@ -171,6 +208,8 @@ private: return _n; } + noteUsed(_h, N); + WriteGuard l(_x); auto ret = _m.insert(std::make_pair(_h, T(RLP(s)))); return ret.first->second; @@ -179,17 +218,31 @@ private: void checkConsistency(); /// The caches of the disk DB and their locks. - mutable boost::shared_mutex x_details; + mutable SharedMutex x_blocks; + mutable BlocksHash m_blocks; + mutable SharedMutex x_details; mutable BlockDetailsHash m_details; - mutable boost::shared_mutex x_logBlooms; + mutable SharedMutex x_logBlooms; mutable BlockLogBloomsHash m_logBlooms; - mutable boost::shared_mutex x_receipts; + mutable SharedMutex x_receipts; mutable BlockReceiptsHash m_receipts; - mutable boost::shared_mutex x_cache; - mutable std::map m_cache; + mutable SharedMutex x_transactionAddresses; + mutable TransactionAddressHash m_transactionAddresses; + mutable SharedMutex x_blockHashes; + mutable BlockHashHash m_blockHashes; + + using CacheID = std::pair; + mutable Mutex x_cacheUsage; + mutable std::deque> m_cacheUsage; + mutable std::set m_inUse; + void noteUsed(h256 const& _h, unsigned _extra = (unsigned)-1) const; + std::chrono::system_clock::time_point m_lastCollection; + + void updateStats() const; + mutable Statistics m_lastStats; /// The disk DBs. Thread-safe, so no need for locks. - ldb::DB* m_db; + ldb::DB* m_blocksDB; ldb::DB* m_extrasDB; /// Hash of the last (valid) block on the longest chain. diff --git a/libethereum/BlockDetails.cpp b/libethereum/BlockDetails.cpp index 58f37b7aa..c15939fdb 100644 --- a/libethereum/BlockDetails.cpp +++ b/libethereum/BlockDetails.cpp @@ -32,9 +32,12 @@ BlockDetails::BlockDetails(RLP const& _r) totalDifficulty = _r[1].toInt(); parent = _r[2].toHash(); children = _r[3].toVector(); + size = _r.size(); } bytes BlockDetails::rlp() const { - return rlpList(number, totalDifficulty, parent, children); + auto ret = rlpList(number, totalDifficulty, parent, children); + size = ret.size(); + return ret; } diff --git a/libethereum/BlockDetails.h b/libethereum/BlockDetails.h index 61b9667c4..ed478568d 100644 --- a/libethereum/BlockDetails.h +++ b/libethereum/BlockDetails.h @@ -46,37 +46,69 @@ struct BlockDetails bool isNull() const { return !totalDifficulty; } explicit operator bool() const { return !isNull(); } - unsigned number; // TODO: remove? + unsigned number; u256 totalDifficulty; h256 parent; h256s children; + + mutable unsigned size; }; struct BlockLogBlooms { BlockLogBlooms() {} - BlockLogBlooms(RLP const& _r) { blooms = _r.toVector(); } - bytes rlp() const { RLPStream s; s << blooms; return s.out(); } + BlockLogBlooms(RLP const& _r) { blooms = _r.toVector(); size = _r.data().size(); } + bytes rlp() const { RLPStream s; s << blooms; size = s.out().size(); return s.out(); } - h512s blooms; + LogBlooms blooms; + mutable unsigned size; }; struct BlockReceipts { BlockReceipts() {} - BlockReceipts(RLP const& _r) { for (auto const& i: _r) receipts.emplace_back(i.data()); } - bytes rlp() const { RLPStream s(receipts.size()); for (TransactionReceipt const& i: receipts) i.streamRLP(s); return s.out(); } + BlockReceipts(RLP const& _r) { for (auto const& i: _r) receipts.emplace_back(i.data()); size = _r.data().size(); } + bytes rlp() const { RLPStream s(receipts.size()); for (TransactionReceipt const& i: receipts) i.streamRLP(s); size = s.out().size(); return s.out(); } TransactionReceipts receipts; + mutable unsigned size; +}; + +struct BlockHash +{ + BlockHash() {} + BlockHash(RLP const& _r) { value = _r.toHash(); } + bytes rlp() const { return dev::rlp(value); } + + h256 value; + static const unsigned size = 65; +}; + +struct TransactionAddress +{ + TransactionAddress() {} + TransactionAddress(RLP const& _rlp) { blockHash = _rlp[0].toHash(); index = _rlp[1].toInt(); } + bytes rlp() const { RLPStream s(2); s << blockHash << index; return s.out(); } + + explicit operator bool() const { return !!blockHash; } + + h256 blockHash; + unsigned index = 0; + + static const unsigned size = 67; }; using BlockDetailsHash = std::map; using BlockLogBloomsHash = std::map; using BlockReceiptsHash = std::map; +using TransactionAddressHash = std::map; +using BlockHashHash = std::map; static const BlockDetails NullBlockDetails; static const BlockLogBlooms NullBlockLogBlooms; static const BlockReceipts NullBlockReceipts; +static const TransactionAddress NullTransactionAddress; +static const BlockHash NullBlockHash; } } diff --git a/libethereum/BlockQueue.cpp b/libethereum/BlockQueue.cpp index 01c8c796c..29c9a4c71 100644 --- a/libethereum/BlockQueue.cpp +++ b/libethereum/BlockQueue.cpp @@ -107,7 +107,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc) void BlockQueue::tick(BlockChain const& _bc) { unsigned t = time(0); - for (auto i = m_future.begin(); i != m_future.end() && i->first < time(0); ++i) + for (auto i = m_future.begin(); i != m_future.end() && i->first < t; ++i) import(&(i->second), _bc); WriteGuard l(m_lock); diff --git a/libethereum/BlockQueue.h b/libethereum/BlockQueue.h index 210b9eeb0..5eefa9d8e 100644 --- a/libethereum/BlockQueue.h +++ b/libethereum/BlockQueue.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include namespace dev diff --git a/libethereum/CachedAddressState.cpp b/libethereum/CachedAddressState.cpp index 5f9be6944..e2fadc8b5 100644 --- a/libethereum/CachedAddressState.cpp +++ b/libethereum/CachedAddressState.cpp @@ -56,9 +56,9 @@ std::map CachedAddressState::storage() const std::map ret; if (m_r) { - TrieDB memdb(const_cast(m_o), m_r[2].toHash()); // promise we won't alter the overlay! :) - for (auto const& j: memdb) - ret[j.first] = RLP(j.second).toInt(); + SecureTrieDB memdb(const_cast(m_o), m_r[2].toHash()); // promise we won't alter the overlay! :) +// for (auto const& j: memdb) +// ret[j.first] = RLP(j.second).toInt(); } if (m_s) for (auto const& j: m_s->storageOverlay()) diff --git a/libethereum/CachedAddressState.h b/libethereum/CachedAddressState.h index 301f54338..8a3c3a607 100644 --- a/libethereum/CachedAddressState.h +++ b/libethereum/CachedAddressState.h @@ -45,7 +45,10 @@ public: u256 balance() const; u256 nonce() const; bytes code() const; + + // TODO: DEPRECATE. std::map storage() const; + AccountDiff diff(CachedAddressState const& _c); private: diff --git a/libethereum/CanonBlockChain.cpp b/libethereum/CanonBlockChain.cpp index b0fe90a78..569bddca1 100644 --- a/libethereum/CanonBlockChain.cpp +++ b/libethereum/CanonBlockChain.cpp @@ -43,6 +43,7 @@ namespace js = json_spirit; std::map const& dev::eth::genesisState() { static std::map s_ret; + if (s_ret.empty()) { js::mValue val; @@ -66,6 +67,8 @@ std::map const& dev::eth::genesisState() return s_ret; } +// TODO: place Registry in here. + std::unique_ptr CanonBlockChain::s_genesis; boost::shared_mutex CanonBlockChain::x_genesis; @@ -76,14 +79,14 @@ bytes CanonBlockChain::createGenesisBlock() h256 stateRoot; { MemoryDB db; - TrieDB state(&db); + SecureTrieDB state(&db); state.init(); dev::eth::commit(genesisState(), db, state); stateRoot = state.root(); } - block.appendList(14) - << h256() << EmptyListSHA3 << h160() << stateRoot << EmptyTrie << EmptyTrie << LogBloom() << c_genesisDifficulty << 0 << 1000000 << 0 << (unsigned)0 << string() << sha3(bytes(1, 42)); + block.appendList(16) + << h256() << EmptyListSHA3 << h160() << stateRoot << EmptyTrie << EmptyTrie << LogBloom() << c_genesisDifficulty << 0 << 1000000 << 0 << (unsigned)0 << string() << h256() << h256() << Nonce(u64(42)); block.appendRaw(RLPEmptyList); block.appendRaw(RLPEmptyList); return block.out(); diff --git a/libethereum/CanonBlockChain.h b/libethereum/CanonBlockChain.h index d9739097a..7110dbc90 100644 --- a/libethereum/CanonBlockChain.h +++ b/libethereum/CanonBlockChain.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include "BlockDetails.h" diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index b0b95c7bf..b6c310d34 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -60,14 +60,84 @@ void VersionChecker::setOk() } } +void BasicGasPricer::update(BlockChain const& _bc) +{ + unsigned c = 0; + h256 p = _bc.currentHash(); + m_gasPerBlock = _bc.info(p).gasLimit; + + map dist; + unsigned total = 0; + while (c < 1000 && p) + { + BlockInfo bi = _bc.info(p); + if (bi.transactionsRoot != EmptyTrie) + { + auto bb = _bc.block(p); + RLP r(bb); + BlockReceipts brs(_bc.receipts(bi.hash)); + for (unsigned i = 0; i < r[1].size(); ++i) + { + auto gu = brs.receipts[i].gasUsed(); + dist[Transaction(r[1][i].data(), CheckSignature::None).gasPrice()] += (unsigned)brs.receipts[i].gasUsed(); + total += (unsigned)gu; + } + } + p = bi.parentHash; + ++c; + } + if (total > 0) + { + unsigned t = 0; + unsigned q = 1; + m_octiles[0] = dist.begin()->first; + for (auto const& i: dist) + { + for (; t <= total * q / 8 && t + i.second > total * q / 8; ++q) + m_octiles[q] = i.first; + if (q > 7) + break; + } + m_octiles[8] = dist.rbegin()->first; + } +} + Client::Client(p2p::Host* _extNet, std::string const& _dbPath, bool _forceClean, u256 _networkId, int _miners): Worker("eth"), m_vc(_dbPath), m_bc(_dbPath, !m_vc.ok() || _forceClean), + m_gp(new TrivialGasPricer), + m_stateDB(State::openDB(_dbPath, !m_vc.ok() || _forceClean)), + m_preMine(Address(), m_stateDB), + m_postMine(Address(), m_stateDB) +{ + m_gp->update(m_bc); + + m_host = _extNet->registerCapability(new EthereumHost(m_bc, m_tq, m_bq, _networkId)); + + if (_miners > -1) + setMiningThreads(_miners); + else + setMiningThreads(); + if (_dbPath.size()) + Defaults::setDBPath(_dbPath); + m_vc.setOk(); + doWork(); + + startWorking(); +} + +Client::Client(p2p::Host* _extNet, std::shared_ptr _gp, std::string const& _dbPath, bool _forceClean, u256 _networkId, int _miners): + Worker("eth"), + m_vc(_dbPath), + m_bc(_dbPath, !m_vc.ok() || _forceClean), + m_gp(_gp), m_stateDB(State::openDB(_dbPath, !m_vc.ok() || _forceClean)), m_preMine(Address(), m_stateDB), m_postMine(Address(), m_stateDB) { + m_gp->update(m_bc); + m_host = _extNet->registerCapability(new EthereumHost(m_bc, m_tq, m_bq, _networkId)); if (_miners > -1) @@ -278,11 +348,11 @@ LocalisedLogEntries Client::checkWatch(unsigned _watchId) LocalisedLogEntries ret; try { -#if ETH_DEBUG +#if ETH_DEBUG && 0 cdebug << "checkWatch" << _watchId; #endif auto& w = m_watches.at(_watchId); -#if ETH_DEBUG +#if ETH_DEBUG && 0 cdebug << "lastPoll updated to " << chrono::duration_cast(chrono::system_clock::now().time_since_epoch()).count(); #endif std::swap(ret, w.changes); @@ -503,10 +573,10 @@ pair Client::getWork() return make_pair(m_remoteMiner.workHash(), m_remoteMiner.difficulty()); } -bool Client::submitNonce(h256 const&_nonce) +bool Client::submitWork(ProofOfWork::Proof const& _proof) { Guard l(x_remoteMiner); - return m_remoteMiner.submitWork(_nonce); + return m_remoteMiner.submitWork(_proof); } void Client::doWork() @@ -520,9 +590,18 @@ void Client::doWork() { if (m.isComplete()) { - cwork << "CHAIN <== postSTATE"; + // TODO: enable a short-circuit option since we mined it. will need to get the end state from the miner. + auto lm = dynamic_cast(&m); h256s hs; + if (false && lm && !m_verifyOwnBlocks) { + // TODO: implement + //m_bc.attemptImport(m_blockData(), m_stateDB, lm->state()); + // TODO: derive hs from lm->state() + } + else + { + cwork << "CHAIN <== postSTATE"; WriteGuard l(x_stateDB); hs = m_bc.attemptImport(m.blockData(), m_stateDB); } @@ -583,7 +662,7 @@ void Client::doWork() // returns h256s as blooms, once for each transaction. cwork << "postSTATE <== TQ"; - TransactionReceipts newPendingReceipts = m_postMine.sync(m_bc, m_tq); + TransactionReceipts newPendingReceipts = m_postMine.sync(m_bc, m_tq, *m_gp); if (newPendingReceipts.size()) { for (size_t i = 0; i < newPendingReceipts.size(); i++) @@ -610,7 +689,7 @@ void Client::doWork() this_thread::sleep_for(chrono::milliseconds(100)); if (chrono::system_clock::now() - m_lastGarbageCollection > chrono::seconds(5)) { - // garbage collect on watches + // watches garbage collection vector toUninstall; { Guard l(m_filterLock); @@ -623,6 +702,10 @@ void Client::doWork() } for (auto i: toUninstall) uninstallWatch(i); + + // blockchain GC + m_bc.garbageCollect(); + m_lastGarbageCollection = chrono::system_clock::now(); } } diff --git a/libethereum/Client.h b/libethereum/Client.h index 5fabca10b..9cbfd7989 100644 --- a/libethereum/Client.h +++ b/libethereum/Client.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include "CanonBlockChain.h" #include "TransactionQueue.h" @@ -148,7 +148,7 @@ public: h256 workHash() const { return m_state.info().headerHash(IncludeNonce::WithoutNonce); } u256 const& difficulty() const { return m_state.info().difficulty; } - bool submitWork(h256 const& _nonce) { return (m_isComplete = m_state.completeMine(_nonce)); } + bool submitWork(ProofOfWork::Proof const& _result) { return (m_isComplete = m_state.completeMine(_result)); } virtual bool isComplete() const override { return m_isComplete; } virtual bytes const& blockData() const { return m_state.blockData(); } @@ -160,6 +160,26 @@ private: State m_state; }; +class BasicGasPricer: public GasPricer +{ +public: + explicit BasicGasPricer(u256 _weiPerRef, u256 _refsPerBlock): m_weiPerRef(_weiPerRef), m_refsPerBlock(_refsPerBlock) {} + + void setRefPrice(u256 _weiPerRef) { m_weiPerRef = _weiPerRef; } + void setRefBlockFees(u256 _refsPerBlock) { m_refsPerBlock = _refsPerBlock; } + + u256 ask(State const&) const override { return m_weiPerRef * m_refsPerBlock / m_gasPerBlock; } + u256 bid(TransactionPriority _p = TransactionPriority::Medium) const override { return m_octiles[(int)_p] > 0 ? m_octiles[(int)_p] : (m_weiPerRef * m_refsPerBlock / m_gasPerBlock); } + + void update(BlockChain const& _bc) override; + +private: + u256 m_weiPerRef; + u256 m_refsPerBlock; + u256 m_gasPerBlock = 1000000; + std::array m_octiles; +}; + /** * @brief Main API hub for interfacing with Ethereum. */ @@ -177,9 +197,21 @@ public: int _miners = -1 ); + explicit Client( + p2p::Host* _host, + std::shared_ptr _gpForAdoption, // pass it in with new. + std::string const& _dbPath = std::string(), + bool _forceClean = false, + u256 _networkId = 0, + int _miners = -1 + ); + /// Destructor. virtual ~Client(); + /// Resets the gas pricer to some other object. + void setGasPricer(std::shared_ptr _gp) { m_gp = _gp; } + /// Submits the given message-call transaction. virtual void transact(Secret _secret, u256 _value, Address _dest, bytes const& _data = bytes(), u256 _gas = 10000, u256 _gasPrice = 10 * szabo); @@ -303,8 +335,8 @@ public: /// Update to the latest transactions and get hash of the current block to be mined minus the /// nonce (the 'work hash') and the difficulty to be met. virtual std::pair getWork() override; - /// Submit the nonce for the proof-of-work. - virtual bool submitNonce(h256 const&_nonce) override; + /// Submit the proof for the proof-of-work. + virtual bool submitWork(ProofOfWork::Proof const& _proof) override; // Debug stuff: @@ -352,6 +384,7 @@ private: CanonBlockChain m_bc; ///< Maintains block database. TransactionQueue m_tq; ///< Maintains a list of incoming transactions not yet in a block on the blockchain. BlockQueue m_bq; ///< Maintains a list of incoming blocks not yet on the blockchain (to be imported). + std::shared_ptr m_gp; ///< The gas pricer. mutable SharedMutex x_stateDB; ///< Lock on the state DB, effectively a lock on m_postMine. OverlayDB m_stateDB; ///< Acts as the central point for the state database, so multiple States can share it. @@ -368,6 +401,9 @@ private: bool m_paranoia = false; ///< Should we be paranoid about our state? bool m_turboMining = false; ///< Don't squander all of our time mining actually just sleeping. bool m_forceMining = false; ///< Mine even when there are no transactions pending? + bool m_verifyOwnBlocks = true; ///< Should be verify blocks that we mined? + + mutable Mutex m_filterLock; std::map m_filters; diff --git a/libethereum/CommonNet.cpp b/libethereum/CommonNet.cpp index 5a9d3d0c9..57681eac0 100644 --- a/libethereum/CommonNet.cpp +++ b/libethereum/CommonNet.cpp @@ -25,4 +25,4 @@ using namespace dev; using namespace dev::eth; #pragma GCC diagnostic ignored "-Wunused-variable" -namespace { char dummy; }; +namespace { char dummy; } diff --git a/libethereum/EthereumHost.h b/libethereum/EthereumHost.h index 0f06230ff..06575092c 100644 --- a/libethereum/EthereumHost.h +++ b/libethereum/EthereumHost.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include "CommonNet.h" #include "EthereumPeer.h" diff --git a/libethereum/EthereumPeer.h b/libethereum/EthereumPeer.h index f33c9ddea..c95df6945 100644 --- a/libethereum/EthereumPeer.h +++ b/libethereum/EthereumPeer.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include "CommonNet.h" #include "DownloadMan.h" @@ -131,7 +131,7 @@ private: DownloadSub m_sub; /// Have we received a GetTransactions packet that we haven't yet answered? - bool m_requireTransactions; + bool m_requireTransactions = false; Mutex x_knownBlocks; h256Set m_knownBlocks; ///< Blocks that the peer already knows about (that don't need to be sent to them). diff --git a/libethereum/Executive.cpp b/libethereum/Executive.cpp index 86e2d5568..e009b49fb 100644 --- a/libethereum/Executive.cpp +++ b/libethereum/Executive.cpp @@ -66,7 +66,7 @@ bool Executive::setup() if (m_t.nonce() != nonceReq) { clog(StateDetail) << "Invalid Nonce: Require" << nonceReq << " Got" << m_t.nonce(); - BOOST_THROW_EXCEPTION(InvalidNonce(nonceReq, m_t.nonce())); + BOOST_THROW_EXCEPTION(InvalidNonce() << RequirementError((bigint)nonceReq, (bigint)m_t.nonce())); } // Check gas cost is enough. @@ -176,7 +176,7 @@ OnOpFunc Executive::simpleTrace() o << endl << " STACK" << endl; for (auto i: vm.stack()) o << (h256)i << endl; - o << " MEMORY" << endl << (vm.memory().size() > 1000) ? " mem size greater than 1000 bytes " : memDump(vm.memory()); + o << " MEMORY" << endl << ((vm.memory().size() > 1000) ? " mem size greater than 1000 bytes " : memDump(vm.memory())); o << " STORAGE" << endl; for (auto const& i: ext.state().storage(ext.myAddress)) o << showbase << hex << i.first << ": " << i.second << endl; @@ -236,6 +236,10 @@ bool Executive::go(OnOpFunc const& _onOp) void Executive::finalize() { + // Accumulate refunds for suicides. + if (m_ext) + m_ext->sub.refunds += c_suicideRefundGas * m_ext->sub.suicides.size(); + // SSTORE refunds... // must be done before the miner gets the fees. if (m_ext) diff --git a/libethereum/Executive.h b/libethereum/Executive.h index bb5563604..2e89f0623 100644 --- a/libethereum/Executive.h +++ b/libethereum/Executive.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include "Transaction.h" diff --git a/libethereum/ExtVM.h b/libethereum/ExtVM.h index 30cbf1a5a..d63cd943a 100644 --- a/libethereum/ExtVM.h +++ b/libethereum/ExtVM.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include "State.h" @@ -69,6 +69,9 @@ public: /// Determine account's TX count. virtual u256 txCount(Address _a) override final { return m_s.transactionsFrom(_a); } + /// Does the account exist? + virtual bool exists(Address _a) override final { return m_s.addressInUse(_a); } + /// Suicide the associated contract to the given address. virtual void suicide(Address _a) override final { diff --git a/libethereum/GenesisInfo.cpp b/libethereum/GenesisInfo.cpp index b9b45d4b4..4e6a48284 100644 --- a/libethereum/GenesisInfo.cpp +++ b/libethereum/GenesisInfo.cpp @@ -24,6 +24,10 @@ std::string const dev::eth::c_genesisInfo = R"ETHEREUM( { + "0000000000000000000000000000000000000001": { "wei": "1" }, + "0000000000000000000000000000000000000002": { "wei": "1" }, + "0000000000000000000000000000000000000003": { "wei": "1" }, + "0000000000000000000000000000000000000004": { "wei": "1" }, "dbdbdb2cbd23b783741e8d7fcf51e459b497e4a6": { "wei": "1606938044258990275541962092341162602522202993782792835301376" }, "e6716f9544a56c530d868e4bfbacb172315bdead": { "wei": "1606938044258990275541962092341162602522202993782792835301376" }, "b9c015918bdaba24b4ff057a92a3873d6eb201be": { "wei": "1606938044258990275541962092341162602522202993782792835301376" }, @@ -32,9 +36,5 @@ R"ETHEREUM( "cd2a3d9f938e13cd947ec05abc7fe734df8dd826": { "wei": "1606938044258990275541962092341162602522202993782792835301376" }, "6c386a4b26f73c802f34673f7248bb118f97424a": { "wei": "1606938044258990275541962092341162602522202993782792835301376" }, "e4157b34ea9615cfbde6b4fda419828124b70c78": { "wei": "1606938044258990275541962092341162602522202993782792835301376" }, - "b0afc46d9ce366d06ab4952ca27db1d9557ae9fd": { "finney": "154162184" }, - "f6b1e9dc460d4d62cc22ec5f987d726929c0f9f0": { "finney": "102774789" }, - "cc45122d8b7fa0b1eaa6b29e0fb561422a9239d0": { "finney": "51387394" }, - "b7576e9d314df41ec5506494293afb1bd5d3f65d": { "finney": "69423399" }, } )ETHEREUM"; diff --git a/libethereum/Interface.cpp b/libethereum/Interface.cpp index 7d731bb1f..545604d90 100644 --- a/libethereum/Interface.cpp +++ b/libethereum/Interface.cpp @@ -22,4 +22,4 @@ #include "Interface.h" #pragma GCC diagnostic ignored "-Wunused-variable" -namespace { char dummy; }; +namespace { char dummy; } diff --git a/libethereum/Interface.h b/libethereum/Interface.h index 847c181e0..817a5e4b0 100644 --- a/libethereum/Interface.h +++ b/libethereum/Interface.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "LogFilter.h" #include "Transaction.h" #include "AccountDiff.h" @@ -154,7 +154,7 @@ public: /// Get hash of the current block to be mined minus the nonce (the 'work hash'). virtual std::pair getWork() = 0; /// Submit the nonce for the proof-of-work. - virtual bool submitNonce(h256 const&) = 0; + virtual bool submitWork(ProofOfWork::Proof const& _proof) = 0; /// Check the progress of the mining. virtual MineProgress miningProgress() const = 0; diff --git a/libethereum/LogFilter.h b/libethereum/LogFilter.h index 5f68cd5d0..7b8922a03 100644 --- a/libethereum/LogFilter.h +++ b/libethereum/LogFilter.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include "TransactionReceipt.h" namespace dev diff --git a/libethereum/Miner.h b/libethereum/Miner.h index 5914770d2..e472c6f64 100644 --- a/libethereum/Miner.h +++ b/libethereum/Miner.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "State.h" namespace dev @@ -131,6 +131,9 @@ public: /// Get and clear the mining history. std::list miningHistory() { Guard l(x_mineInfo); auto ret = m_mineHistory; m_mineHistory.clear(); return ret; } + /// @returns the state on which we mined. + State const& state() const { return m_mineState; } + private: /// Do some work on the mining. virtual void doWork(); diff --git a/libethereum/Precompiled.cpp b/libethereum/Precompiled.cpp index 732782d3f..62d159418 100644 --- a/libethereum/Precompiled.cpp +++ b/libethereum/Precompiled.cpp @@ -23,7 +23,8 @@ #include #include -#include +#include +#include using namespace std; using namespace dev; using namespace dev::eth; @@ -82,10 +83,10 @@ static bytes identityCode(bytesConstRef _in) static const std::map c_precompiled = { - { 1, { [](bytesConstRef) -> bigint { return (bigint)500; }, ecrecoverCode }}, - { 2, { [](bytesConstRef i) -> bigint { return (bigint)50 + (i.size() + 31) / 32 * 50; }, sha256Code }}, - { 3, { [](bytesConstRef i) -> bigint { return (bigint)50 + (i.size() + 31) / 32 * 50; }, ripemd160Code }}, - { 4, { [](bytesConstRef i) -> bigint { return (bigint)1 + (i.size() + 31) / 32 * 1; }, identityCode }} + { 1, { [](bytesConstRef) -> bigint { return c_ecrecoverGas; }, ecrecoverCode }}, + { 2, { [](bytesConstRef i) -> bigint { return c_sha256Gas + (i.size() + 31) / 32 * c_sha256WordGas; }, sha256Code }}, + { 3, { [](bytesConstRef i) -> bigint { return c_ripemd160Gas + (i.size() + 31) / 32 * c_ripemd160WordGas; }, ripemd160Code }}, + { 4, { [](bytesConstRef i) -> bigint { return c_identityGas + (i.size() + 31) / 32 * c_identityWordGas; }, identityCode }} }; std::map const& dev::eth::precompiled() diff --git a/libethereum/State.cpp b/libethereum/State.cpp index fad9112db..d1e430dbe 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -134,7 +134,7 @@ State::State(State const& _s): void State::paranoia(std::string const& _when, bool _enforceRefs) const { -#if ETH_PARANOIA +#if ETH_PARANOIA && !ETH_FATDB // TODO: variable on context; just need to work out when there should be no leftovers // [in general this is hard since contract alteration will result in nodes in the DB that are no directly part of the state DB]. if (!isTrieGood(_enforceRefs, false)) @@ -169,18 +169,6 @@ State::~State() { } -Address State::nextActiveAddress(Address _a) const -{ - auto it = m_state.lower_bound(_a); - if ((*it).first == _a) - ++it; - if (it == m_state.end()) - // exchange comments if we want to wraparound -// it = m_state.begin(); - return Address(); - return (*it).first; -} - StateDiff State::diff(State const& _c) const { StateDiff ret; @@ -189,8 +177,8 @@ StateDiff State::diff(State const& _c) const std::set
trieAds; std::set
trieAdsD; - auto trie = TrieDB(const_cast(&m_db), rootHash()); - auto trieD = TrieDB(const_cast(&_c.m_db), _c.rootHash()); + auto trie = SecureTrieDB(const_cast(&m_db), rootHash()); + auto trieD = SecureTrieDB(const_cast(&_c.m_db), _c.rootHash()); for (auto i: trie) ads.insert(i.first), trieAds.insert(i.first); @@ -237,7 +225,7 @@ void State::ensureCached(std::map& _cache, Address _a, bool _r if (state.isNull()) s = Account(0, Account::NormalCreation); else - s = Account(state[0].toInt(), state[1].toInt(), state[2].toHash(), state[3].toHash()); + s = Account(state[0].toInt(), state[1].toInt(), state[2].toHash(), state[3].toHash(), Account::Unchanged); bool ok; tie(it, ok) = _cache.insert(make_pair(_a, s)); } @@ -268,7 +256,7 @@ bool State::sync(BlockChain const& _bc, h256 _block, BlockInfo const& _bi) { auto b = _bc.block(_block); bi.populate(b); - // bi.verifyInternals(_bc.block(_block)); // Unneeded - we already verify on import into the blockchain. +// bi.verifyInternals(_bc.block(_block)); // Unneeded - we already verify on import into the blockchain. break; } catch (Exception const& _e) @@ -412,7 +400,7 @@ bool State::cull(TransactionQueue& _tq) const return ret; } -TransactionReceipts State::sync(BlockChain const& _bc, TransactionQueue& _tq, bool* o_transactionQueueChanged) +TransactionReceipts State::sync(BlockChain const& _bc, TransactionQueue& _tq, GasPricer const& _gp, bool* o_transactionQueueChanged) { // TRANSACTIONS TransactionReceipts ret; @@ -426,20 +414,27 @@ TransactionReceipts State::sync(BlockChain const& _bc, TransactionQueue& _tq, bo for (auto const& i: ts) if (!m_transactionSet.count(i.first)) { - // don't have it yet! Execute it now. try { - uncommitToMine(); -// boost::timer t; - execute(lh, i.second); - ret.push_back(m_receipts.back()); - _tq.noteGood(i); - ++goodTxs; -// cnote << "TX took:" << t.elapsed() * 1000; + Transaction t(i.second, CheckSignature::Sender); + if (t.gasPrice() >= _gp.ask(*this)) + { + // don't have it yet! Execute it now. + uncommitToMine(); + // boost::timer t; + execute(lh, i.second); + ret.push_back(m_receipts.back()); + _tq.noteGood(i); + ++goodTxs; + // cnote << "TX took:" << t.elapsed() * 1000; + } } catch (InvalidNonce const& in) { - if (in.required > in.candidate) + bigint const* req = boost::get_error_info(in); + bigint const* got = boost::get_error_info(in); + + if (*req > *got) { // too old _tq.drop(i.first); @@ -474,7 +469,7 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, bool _checkNonce) // m_currentBlock is assumed to be prepopulated and reset. #if !ETH_RELEASE - BlockInfo bi(_block, _checkNonce); + BlockInfo bi(_block, _checkNonce ? CheckEverything : IgnoreNonce); assert(m_previousBlock.hash == bi.parentHash); assert(m_currentBlock.parentHash == bi.parentHash); assert(rootHash() == m_previousBlock.stateRoot); @@ -484,7 +479,7 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, bool _checkNonce) BOOST_THROW_EXCEPTION(InvalidParentHash()); // Populate m_currentBlock with the correct values. - m_currentBlock.populate(_block, _checkNonce); + m_currentBlock.populate(_block, _checkNonce ? CheckEverything : IgnoreNonce); m_currentBlock.verifyInternals(_block); // cnote << "playback begins:" << m_state.root(); @@ -499,10 +494,11 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, bool _checkNonce) receiptsTrie.init(); LastHashes lh = getLastHashes(_bc, (unsigned)m_previousBlock.number); + RLP rlp(_block); // All ok with the block generally. Play back the transactions now... unsigned i = 0; - for (auto const& tr: RLP(_block)[1]) + for (auto const& tr: rlp[1]) { RLPStream k; k << i; @@ -516,17 +512,11 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, bool _checkNonce) ++i; } - if (transactionsTrie.root() != m_currentBlock.transactionsRoot) - { - cwarn << "Bad transactions state root!"; - BOOST_THROW_EXCEPTION(InvalidTransactionsStateRoot()); - } - if (receiptsTrie.root() != m_currentBlock.receiptsRoot) { cwarn << "Bad receipts state root."; cwarn << "Block:" << toHex(_block); - cwarn << "Block RLP:" << RLP(_block); + cwarn << "Block RLP:" << rlp; cwarn << "Calculated: " << receiptsTrie.root(); for (unsigned j = 0; j < i; ++j) { @@ -561,13 +551,17 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, bool _checkNonce) u256 tdIncrease = m_currentBlock.difficulty; // Check uncles & apply their rewards to state. - set nonces = { m_currentBlock.nonce }; + if (rlp[2].itemCount() > 2) + BOOST_THROW_EXCEPTION(TooManyUncles()); + + set nonces = { m_currentBlock.nonce }; Addresses rewarded; set knownUncles = _bc.allUnclesFrom(m_currentBlock.parentHash); - for (auto const& i: RLP(_block)[2]) + + for (auto const& i: rlp[2]) { if (knownUncles.count(sha3(i.data()))) - BOOST_THROW_EXCEPTION(UncleInChain(knownUncles, sha3(i.data()) )); + BOOST_THROW_EXCEPTION(UncleInChain() << errinfo_comment("Uncle in block already mentioned") << errinfo_data(toString(knownUncles)) << errinfo_hash256(sha3(i.data())) ); BlockInfo uncle = BlockInfo::fromHeader(i.data()); if (nonces.count(uncle.nonce)) @@ -592,9 +586,10 @@ u256 State::enact(bytesConstRef _block, BlockChain const& _bc, bool _checkNonce) { cwarn << "Bad state root!"; cnote << "Given to be:" << m_currentBlock.stateRoot; - cnote << TrieDB(&m_db, m_currentBlock.stateRoot); + // TODO: Fix +// cnote << SecureTrieDB(&m_db, m_currentBlock.stateRoot); cnote << "Calculated to be:" << rootHash(); - cnote << m_state; +// cnote << m_state; cnote << *this; // Rollback the trie. m_db.rollback(); @@ -637,7 +632,7 @@ void State::uncommitToMine() if (!m_transactions.size()) m_state.setRoot(m_previousBlock.stateRoot); else - m_state.setRoot(m_receipts[m_receipts.size() - 1].stateRoot()); + m_state.setRoot(m_receipts.back().stateRoot()); m_db = m_lastTx; paranoia("Uncommited to mine", true); m_currentBlock.sha3Uncles = h256(); @@ -711,7 +706,7 @@ void State::commitToMine(BlockChain const& _bc) // cout << "Checking " << m_previousBlock.hash << ", parent=" << m_previousBlock.parentHash << endl; set knownUncles = _bc.allUnclesFrom(m_currentBlock.parentHash); auto p = m_previousBlock.parentHash; - for (unsigned gen = 0; gen < 6 && p != _bc.genesisHash(); ++gen, p = _bc.details(p).parent) + for (unsigned gen = 0; gen < 6 && p != _bc.genesisHash() && unclesCount < 2; ++gen, p = _bc.details(p).parent) { auto us = _bc.details(p).children; assert(us.size() >= 1); // must be at least 1 child of our grandparent - it's our own parent! @@ -722,6 +717,8 @@ void State::commitToMine(BlockChain const& _bc) ubi.streamRLP(unclesData, WithNonce); ++unclesCount; uncleAddresses.push_back(ubi.coinbaseAddress); + if (unclesCount == 2) + break; } } } @@ -784,23 +781,28 @@ MineInfo State::mine(unsigned _msTimeout, bool _turbo) MineInfo ret; // TODO: Miner class that keeps dagger between mine calls (or just non-polling mining). - tie(ret, m_currentBlock.nonce) = m_pow.mine(m_currentBlock.headerHash(WithoutNonce), m_currentBlock.difficulty, _msTimeout, true, _turbo); + ProofOfWork::Proof r; + tie(ret, r) = m_pow.mine(m_currentBlock, _msTimeout, true, _turbo); if (!ret.completed) m_currentBytes.clear(); else - cnote << "Completed" << m_currentBlock.headerHash(WithoutNonce).abridged() << m_currentBlock.nonce.abridged() << m_currentBlock.difficulty << ProofOfWork::verify(m_currentBlock.headerHash(WithoutNonce), m_currentBlock.nonce, m_currentBlock.difficulty); + { + ProofOfWork::assignResult(r, m_currentBlock); + cnote << "Completed" << m_currentBlock.headerHash(WithoutNonce).abridged() << m_currentBlock.nonce.abridged() << m_currentBlock.difficulty << ProofOfWork::verify(m_currentBlock); + } return ret; } -bool State::completeMine(h256 const& _nonce) +bool State::completeMine(ProofOfWork::Proof const& _nonce) { - if (!m_pow.verify(m_currentBlock.headerHash(WithoutNonce), _nonce, m_currentBlock.difficulty)) + ProofOfWork::assignResult(_nonce, m_currentBlock); + + if (!m_pow.verify(m_currentBlock)) return false; - m_currentBlock.nonce = _nonce; - cnote << "Completed" << m_currentBlock.headerHash(WithoutNonce).abridged() << m_currentBlock.nonce.abridged() << m_currentBlock.difficulty << ProofOfWork::verify(m_currentBlock.headerHash(WithoutNonce), m_currentBlock.nonce, m_currentBlock.difficulty); + cnote << "Completed" << m_currentBlock.headerHash(WithoutNonce).abridged() << m_currentBlock.nonce.abridged() << m_currentBlock.difficulty << ProofOfWork::verify(m_currentBlock); completeMine(); @@ -908,7 +910,7 @@ Address State::newContract(u256 _balance, bytes const& _code) auto it = m_cache.find(ret); if (it == m_cache.end()) { - m_cache[ret] = Account(0, _balance, EmptyTrie, h); + m_cache[ret] = Account(0, _balance, EmptyTrie, h, Account::Changed); return ret; } } @@ -939,7 +941,7 @@ u256 State::storage(Address _id, u256 _memory) const return mit->second; // Not in the storage cache - go to the DB. - TrieDB memdb(const_cast(&m_db), it->second.baseRoot()); // promise we won't change the overlay! :) + SecureTrieDB memdb(const_cast(&m_db), it->second.baseRoot()); // promise we won't change the overlay! :) string payload = memdb.at(_memory); u256 ret = payload.size() ? RLP(payload).toInt() : 0; it->second.setStorage(_memory, ret); @@ -957,7 +959,7 @@ map State::storage(Address _id) const // Pull out all values from trie storage. if (it->second.baseRoot()) { - TrieDB memdb(const_cast(&m_db), it->second.baseRoot()); // promise we won't alter the overlay! :) + SecureTrieDB memdb(const_cast(&m_db), it->second.baseRoot()); // promise we won't alter the overlay! :) for (auto const& i: memdb) ret[i.first] = RLP(i.second).toInt(); } @@ -1010,24 +1012,24 @@ bool State::isTrieGood(bool _enforceRefs, bool _requireNoLeftOvers) const cwarn << "LEFTOVERS" << (e ? "[enforced" : "[unenforced") << "refs]"; cnote << "Left:" << lo; cnote << "Keys:" << m_db.keys(); - m_state.debugStructure(cerr); +// m_state.debugStructure(cerr); return false; } // TODO: Enable once fixed. - for (auto const& i: m_state) +/* for (auto const& i: m_state) { RLP r(i.second); - TrieDB storageDB(const_cast(&m_db), r[2].toHash()); // promise not to alter OverlayDB. + SecureTrieDB storageDB(const_cast(&m_db), r[2].toHash()); // promise not to alter OverlayDB. for (auto const& j: storageDB) { (void)j; } if (!e && r[3].toHash() != EmptySHA3 && m_db.lookup(r[3].toHash()).empty()) return false; - } + }*/ } catch (InvalidTrie const&) { cwarn << "BAD TRIE" << (e ? "[enforced" : "[unenforced") << "refs]"; cnote << m_db.keys(); - m_state.debugStructure(cerr); +// m_state.debugStructure(cerr); return false; } return true; @@ -1102,7 +1104,7 @@ u256 State::execute(LastHashes const& _lh, bytesConstRef _rlp, bytes* o_output, commit(); -#if ETH_PARANOIA +#if ETH_PARANOIA && !ETH_FATDB ctrace << "Executed; now" << rootHash(); ctrace << old.diff(*this); @@ -1162,7 +1164,7 @@ std::ostream& dev::eth::operator<<(std::ostream& _out, State const& _s) _out << "--- " << _s.rootHash() << std::endl; std::set
d; std::set
dtr; - auto trie = TrieDB(const_cast(&_s.m_db), _s.rootHash()); + auto trie = SecureTrieDB(const_cast(&_s.m_db), _s.rootHash()); for (auto i: trie) d.insert(i.first), dtr.insert(i.first); for (auto i: _s.m_cache) @@ -1194,7 +1196,7 @@ std::ostream& dev::eth::operator<<(std::ostream& _out, State const& _s) std::set cached; if (r) { - TrieDB memdb(const_cast(&_s.m_db), r[2].toHash()); // promise we won't alter the overlay! :) + SecureTrieDB memdb(const_cast(&_s.m_db), r[2].toHash()); // promise we won't alter the overlay! :) for (auto const& j: memdb) mem[j.first] = RLP(j.second).toInt(), back.insert(j.first); } diff --git a/libethereum/State.h b/libethereum/State.h index 813141d17..78ec85f38 100644 --- a/libethereum/State.h +++ b/libethereum/State.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include "TransactionQueue.h" #include "Account.h" @@ -47,6 +47,7 @@ namespace eth { class BlockChain; +class State; struct StateChat: public LogChannel { static const char* name() { return "-S-"; } static const int verbosity = 4; }; struct StateTrace: public LogChannel { static const char* name() { return "=S="; } static const int verbosity = 7; }; @@ -55,6 +56,33 @@ struct StateSafeExceptions: public LogChannel { static const char* name() { retu enum class BaseState { Empty, CanonGenesis }; +enum class TransactionPriority +{ + Lowest = 0, + Low = 2, + Medium = 4, + High = 6, + Highest = 8 +}; + +class GasPricer +{ +public: + GasPricer() {} + + virtual u256 ask(State const&) const = 0; + virtual u256 bid(TransactionPriority _p = TransactionPriority::Medium) const = 0; + + virtual void update(BlockChain const&) {} +}; + +class TrivialGasPricer: public GasPricer +{ +protected: + u256 ask(State const&) const override { return 10 * szabo; } + u256 bid(TransactionPriority = TransactionPriority::Medium) const override { return 10 * szabo; } +}; + /** * @brief Model of the current state of the ledger. * Maintains current ledger (m_current) as a fast hash-map. This is hashed only when required (i.e. to create or verify a block). @@ -94,9 +122,6 @@ public: /// @returns the set containing all addresses currently in use in Ethereum. std::map addresses() const; - /// @returns the address b such that b > @a _a . - Address nextActiveAddress(Address _a) const; - /// Get the header information on the present block. BlockInfo const& info() const { return m_currentBlock; } @@ -115,7 +140,7 @@ public: /// Pass in a solution to the proof-of-work. /// @returns true iff the given nonce is a proof-of-work for this State's block. - bool completeMine(h256 const& _nonce); + bool completeMine(ProofOfWork::Proof const& _result); /// Attempt to find valid nonce for block that this state represents. /// This function is thread-safe. You can safely have other interactions with this object while it is happening. @@ -150,10 +175,11 @@ public: /// @returns a list of receipts one for each transaction placed from the queue into the state. /// @a o_transactionQueueChanged boolean pointer, the value of which will be set to true if the transaction queue /// changed and the pointer is non-null - TransactionReceipts sync(BlockChain const& _bc, TransactionQueue& _tq, bool* o_transactionQueueChanged = nullptr); + TransactionReceipts sync(BlockChain const& _bc, TransactionQueue& _tq, GasPricer const& _gp, bool* o_transactionQueueChanged = nullptr); /// Like sync but only operate on _tq, killing the invalid/old ones. bool cull(TransactionQueue& _tq) const; + /// Returns the last few block hashes of the current chain. LastHashes getLastHashes(BlockChain const& _bc, unsigned _n) const; /// Execute a given transaction. @@ -299,7 +325,7 @@ private: void paranoia(std::string const& _when, bool _enforceRefs = false) const; OverlayDB m_db; ///< Our overlay for the state tree. - TrieDB m_state; ///< Our state tree, as an OverlayDB DB. + SecureTrieDB m_state; ///< Our state tree, as an OverlayDB DB. Transactions m_transactions; ///< The current list of transactions that we've included in the state. TransactionReceipts m_receipts; ///< The corresponding list of transaction receipts. std::set m_transactionSet; ///< The set of transaction hashes that we've included in the state. @@ -328,43 +354,46 @@ private: std::ostream& operator<<(std::ostream& _out, State const& _s); template -void commit(std::map const& _cache, DB& _db, TrieDB& _state) +void commit(std::map const& _cache, DB& _db, SecureTrieDB& _state) { for (auto const& i: _cache) - if (!i.second.isAlive()) - _state.remove(i.first); - else + if (i.second.isDirty()) { - RLPStream s(4); - s << i.second.nonce() << i.second.balance(); - - if (i.second.storageOverlay().empty()) - { - assert(i.second.baseRoot()); - s.append(i.second.baseRoot()); - } + if (!i.second.isAlive()) + _state.remove(i.first); else { - TrieDB storageDB(&_db, i.second.baseRoot()); - for (auto const& j: i.second.storageOverlay()) - if (j.second) - storageDB.insert(j.first, rlp(j.second)); - else - storageDB.remove(j.first); - assert(storageDB.root()); - s.append(storageDB.root()); + RLPStream s(4); + s << i.second.nonce() << i.second.balance(); + + if (i.second.storageOverlay().empty()) + { + assert(i.second.baseRoot()); + s.append(i.second.baseRoot()); + } + else + { + SecureTrieDB storageDB(&_db, i.second.baseRoot()); + for (auto const& j: i.second.storageOverlay()) + if (j.second) + storageDB.insert(j.first, rlp(j.second)); + else + storageDB.remove(j.first); + assert(storageDB.root()); + s.append(storageDB.root()); + } + + if (i.second.isFreshCode()) + { + h256 ch = sha3(i.second.code()); + _db.insert(ch, &i.second.code()); + s << ch; + } + else + s << i.second.codeHash(); + + _state.insert(i.first, &s.out()); } - - if (i.second.isFreshCode()) - { - h256 ch = sha3(i.second.code()); - _db.insert(ch, &i.second.code()); - s << ch; - } - else - s << i.second.codeHash(); - - _state.insert(i.first, &s.out()); } } diff --git a/libethereum/Transaction.h b/libethereum/Transaction.h index a9044970f..7dd28f7c6 100644 --- a/libethereum/Transaction.h +++ b/libethereum/Transaction.h @@ -23,7 +23,7 @@ #include #include -#include +#include namespace dev { diff --git a/libethereum/TransactionQueue.h b/libethereum/TransactionQueue.h index 22a420602..b58944e4f 100644 --- a/libethereum/TransactionQueue.h +++ b/libethereum/TransactionQueue.h @@ -23,7 +23,7 @@ #include #include -#include "libethcore/CommonEth.h" +#include "libethcore/Common.h" #include namespace dev diff --git a/libethereum/Utility.cpp b/libethereum/Utility.cpp index 31c5e278a..7b0a961b2 100644 --- a/libethereum/Utility.cpp +++ b/libethereum/Utility.cpp @@ -22,7 +22,7 @@ #include "Utility.h" #include -#include +#include #include using namespace std; using namespace dev; diff --git a/libevm/All.h b/libevm/All.h index 89c451ef4..2360d91b8 100644 --- a/libevm/All.h +++ b/libevm/All.h @@ -1,5 +1,4 @@ #pragma once #include "ExtVMFace.h" -#include "FeeStructure.h" #include "VM.h" diff --git a/libevm/ExtVMFace.h b/libevm/ExtVMFace.h index 49535958a..4c6bcad0c 100644 --- a/libevm/ExtVMFace.h +++ b/libevm/ExtVMFace.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include namespace dev @@ -143,6 +143,9 @@ public: /// Determine account's TX count. virtual u256 txCount(Address) { return 0; } + /// Does the account exist? + virtual bool exists(Address) { return false; } + /// Suicide the associated contract and give proceeds to the given address. virtual void suicide(Address) { sub.suicides.insert(myAddress); } diff --git a/libevm/FeeStructure.cpp b/libevm/FeeStructure.cpp deleted file mode 100644 index 94eb956af..000000000 --- a/libevm/FeeStructure.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - This file is part of cpp-ethereum. - - cpp-ethereum is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - cpp-ethereum is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . -*/ -/** @file FeeStructure.cpp - * @author Gav Wood - * @date 2014 - */ - -#include "FeeStructure.h" - -using namespace std; -using namespace dev; -using namespace dev::eth; - -u256 const dev::eth::c_stepGas = 1; -u256 const dev::eth::c_balanceGas = 20; -u256 const dev::eth::c_sha3Gas = 10; -u256 const dev::eth::c_sha3WordGas = 10; -u256 const dev::eth::c_sloadGas = 20; -u256 const dev::eth::c_sstoreSetGas = 300; -u256 const dev::eth::c_sstoreResetGas = 100; -u256 const dev::eth::c_sstoreRefundGas = 100; -u256 const dev::eth::c_createGas = 100; -u256 const dev::eth::c_createDataGas = 5; -u256 const dev::eth::c_callGas = 20; -u256 const dev::eth::c_expGas = 1; -u256 const dev::eth::c_expByteGas = 1; -u256 const dev::eth::c_memoryGas = 1; -u256 const dev::eth::c_txDataZeroGas = 1; -u256 const dev::eth::c_txDataNonZeroGas = 5; -u256 const dev::eth::c_txGas = 500; -u256 const dev::eth::c_logGas = 32; -u256 const dev::eth::c_logDataGas = 1; -u256 const dev::eth::c_logTopicGas = 32; -u256 const dev::eth::c_copyGas = 1; diff --git a/libevm/FeeStructure.h b/libevm/FeeStructure.h deleted file mode 100644 index 8ef384265..000000000 --- a/libevm/FeeStructure.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - This file is part of cpp-ethereum. - - cpp-ethereum is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - cpp-ethereum is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . -*/ -/** @file FeeStructure.h - * @author Gav Wood - * @date 2014 - */ - -#pragma once - -#include - -namespace dev -{ -namespace eth -{ - -extern u256 const c_stepGas; ///< Once per operation, except for SSTORE, SLOAD, BALANCE, SHA3, CREATE, CALL. -extern u256 const c_balanceGas; ///< Once per BALANCE operation. -extern u256 const c_sha3Gas; ///< Once per SHA3 operation. -extern u256 const c_sha3WordGas; -extern u256 const c_sloadGas; ///< Once per SLOAD operation. -extern u256 const c_sstoreSetGas; ///< Once per SSTORE operation if the zeroness changes from zero. -extern u256 const c_sstoreResetGas; ///< Once per SSTORE operation if the zeroness doesn't change. -extern u256 const c_sstoreRefundGas; ///< Refunded gas, once per SSTORE operation if the zeroness changes to zero. -extern u256 const c_createGas; ///< Once per CREATE operation & contract-creation transaction. -extern u256 const c_createDataGas; -extern u256 const c_callGas; ///< Once per CALL operation & message call transaction. -extern u256 const c_expGas; ///< Once per EXP instuction. -extern u256 const c_expByteGas; ///< Times ceil(log256(exponent)) for the EXP instruction. -extern u256 const c_memoryGas; ///< Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL. -extern u256 const c_txDataZeroGas; ///< Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions. -extern u256 const c_txDataNonZeroGas; ///< Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions. -extern u256 const c_txGas; ///< Per transaction. NOTE: Not payable on data of calls between transactions. -extern u256 const c_logGas; ///< Per LOG* operation. -extern u256 const c_logDataGas; ///< Per byte in a LOG* operation's data. -extern u256 const c_logTopicGas; ///< Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas. -extern u256 const c_copyGas; ///< Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added. - -} -} diff --git a/libevm/VM.cpp b/libevm/VM.cpp index 2ba18eda6..e0b487c9b 100644 --- a/libevm/VM.cpp +++ b/libevm/VM.cpp @@ -21,7 +21,7 @@ #include "VM.h" #include - +using namespace std; using namespace dev; using namespace dev::eth; @@ -32,13 +32,33 @@ void VM::reset(u256 _gas) noexcept m_jumpDests.clear(); } +struct InstructionMetric +{ + int gasPriceTier; + int args; +}; + +static array metrics() +{ + array s_ret; + for (unsigned i = 0; i < 256; ++i) + { + InstructionInfo inst = instructionInfo((Instruction)i); + s_ret[i].gasPriceTier = inst.gasPriceTier; + s_ret[i].args = inst.args; + } + return s_ret; +} + bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) { + static const array c_metrics = metrics(); + auto memNeed = [](u256 _offset, dev::u256 _size) { return _size ? (bigint)_offset + _size : (bigint)0; }; auto gasForMem = [](bigint _size) -> bigint { bigint s = _size / 32; - return (bigint)c_memoryGas * (s + s * s / 1024); + return (bigint)c_memoryGas * s + s * s / c_quadCoeffDiv; }; if (m_jumpDests.empty()) @@ -55,38 +75,36 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) { // INSTRUCTION... Instruction inst = (Instruction)_ext.getCode(m_curPC); + auto metric = c_metrics[(int)inst]; + int gasPriceTier = metric.gasPriceTier; + + if (gasPriceTier == InvalidTier) + BOOST_THROW_EXCEPTION(BadInstruction()); // FEES... - bigint runGas = c_stepGas; + bigint runGas = c_tierStepGas[metric.gasPriceTier]; bigint newTempSize = m_temp.size(); bigint copySize = 0; + // should work, but just seems to result in immediate errorless exit on initial execution. yeah. weird. + //m_onFail = std::function(onOperation); + + require(metric.args); + auto onOperation = [&]() { if (_onOp) _onOp(osteps - _steps - 1, inst, newTempSize > m_temp.size() ? (newTempSize - m_temp.size()) / 32 : bigint(0), runGas, this, &_ext); }; - // should work, but just seems to result in immediate errorless exit on initial execution. yeah. weird. - //m_onFail = std::function(onOperation); switch (inst) { - case Instruction::STOP: - runGas = 0; - break; - - case Instruction::SUICIDE: - require(1); - runGas = 0; - break; - case Instruction::SSTORE: - require(2); if (!_ext.store(m_stack.back()) && m_stack[m_stack.size() - 2]) runGas = c_sstoreSetGas; else if (_ext.store(m_stack.back()) && !m_stack[m_stack.size() - 2]) { - runGas = 0; + runGas = c_sstoreClearGas; _ext.sub.refunds += c_sstoreRefundGas; } else @@ -94,52 +112,43 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) break; case Instruction::SLOAD: - require(1); runGas = c_sloadGas; break; // These all operate on memory and therefore potentially expand it: case Instruction::MSTORE: - require(2); newTempSize = (bigint)m_stack.back() + 32; break; case Instruction::MSTORE8: - require(2); newTempSize = (bigint)m_stack.back() + 1; break; case Instruction::MLOAD: - require(1); newTempSize = (bigint)m_stack.back() + 32; break; case Instruction::RETURN: - require(2); newTempSize = memNeed(m_stack.back(), m_stack[m_stack.size() - 2]); break; case Instruction::SHA3: - require(2); runGas = c_sha3Gas + (m_stack[m_stack.size() - 2] + 31) / 32 * c_sha3WordGas; newTempSize = memNeed(m_stack.back(), m_stack[m_stack.size() - 2]); break; case Instruction::CALLDATACOPY: - require(3); copySize = m_stack[m_stack.size() - 3]; newTempSize = memNeed(m_stack.back(), m_stack[m_stack.size() - 3]); break; case Instruction::CODECOPY: - require(3); copySize = m_stack[m_stack.size() - 3]; newTempSize = memNeed(m_stack.back(), m_stack[m_stack.size() - 3]); break; case Instruction::EXTCODECOPY: - require(4); copySize = m_stack[m_stack.size() - 4]; newTempSize = memNeed(m_stack[m_stack.size() - 2], m_stack[m_stack.size() - 4]); break; - case Instruction::BALANCE: - require(1); - runGas = c_balanceGas; + case Instruction::JUMPDEST: + runGas = 1; break; + case Instruction::LOG0: case Instruction::LOG1: case Instruction::LOG2: @@ -147,7 +156,6 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) case Instruction::LOG4: { unsigned n = (unsigned)inst - (unsigned)Instruction::LOG0; - require(n + 2); runGas = c_logGas + c_logTopicGas * n + (bigint)c_logDataGas * m_stack[m_stack.size() - 2]; newTempSize = memNeed(m_stack[m_stack.size() - 1], m_stack[m_stack.size() - 2]); break; @@ -155,155 +163,33 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) case Instruction::CALL: case Instruction::CALLCODE: - require(7); runGas = (bigint)c_callGas + m_stack[m_stack.size() - 1]; + if (inst != Instruction::CALLCODE && !_ext.exists(asAddress(m_stack[m_stack.size() - 2]))) + runGas += c_callNewAccountGas; + if (m_stack[m_stack.size() - 3] > 0) + runGas += c_callValueTransferGas; newTempSize = std::max(memNeed(m_stack[m_stack.size() - 6], m_stack[m_stack.size() - 7]), memNeed(m_stack[m_stack.size() - 4], m_stack[m_stack.size() - 5])); break; case Instruction::CREATE: { - require(3); newTempSize = memNeed(m_stack[m_stack.size() - 2], m_stack[m_stack.size() - 3]); runGas = c_createGas; break; } case Instruction::EXP: { - require(2); auto expon = m_stack[m_stack.size() - 2]; runGas = c_expGas + c_expByteGas * (32 - (h256(expon).firstBitSet() / 8)); break; } - - case Instruction::BLOCKHASH: - require(1); - break; - - case Instruction::PC: - case Instruction::MSIZE: - case Instruction::GAS: - case Instruction::JUMPDEST: - case Instruction::ADDRESS: - case Instruction::ORIGIN: - case Instruction::CALLER: - case Instruction::CALLVALUE: - case Instruction::CALLDATASIZE: - case Instruction::CODESIZE: - case Instruction::GASPRICE: - case Instruction::COINBASE: - case Instruction::TIMESTAMP: - case Instruction::NUMBER: - case Instruction::DIFFICULTY: - case Instruction::GASLIMIT: - case Instruction::PUSH1: - case Instruction::PUSH2: - case Instruction::PUSH3: - case Instruction::PUSH4: - case Instruction::PUSH5: - case Instruction::PUSH6: - case Instruction::PUSH7: - case Instruction::PUSH8: - case Instruction::PUSH9: - case Instruction::PUSH10: - case Instruction::PUSH11: - case Instruction::PUSH12: - case Instruction::PUSH13: - case Instruction::PUSH14: - case Instruction::PUSH15: - case Instruction::PUSH16: - case Instruction::PUSH17: - case Instruction::PUSH18: - case Instruction::PUSH19: - case Instruction::PUSH20: - case Instruction::PUSH21: - case Instruction::PUSH22: - case Instruction::PUSH23: - case Instruction::PUSH24: - case Instruction::PUSH25: - case Instruction::PUSH26: - case Instruction::PUSH27: - case Instruction::PUSH28: - case Instruction::PUSH29: - case Instruction::PUSH30: - case Instruction::PUSH31: - case Instruction::PUSH32: - break; - case Instruction::NOT: - case Instruction::ISZERO: - case Instruction::CALLDATALOAD: - case Instruction::EXTCODESIZE: - case Instruction::POP: - case Instruction::JUMP: - require(1); - break; - case Instruction::ADD: - case Instruction::MUL: - case Instruction::SUB: - case Instruction::DIV: - case Instruction::SDIV: - case Instruction::MOD: - case Instruction::SMOD: - case Instruction::LT: - case Instruction::GT: - case Instruction::SLT: - case Instruction::SGT: - case Instruction::EQ: - case Instruction::AND: - case Instruction::OR: - case Instruction::XOR: - case Instruction::BYTE: - case Instruction::JUMPI: - case Instruction::SIGNEXTEND: - require(2); - break; - case Instruction::ADDMOD: - case Instruction::MULMOD: - require(3); - break; - case Instruction::DUP1: - case Instruction::DUP2: - case Instruction::DUP3: - case Instruction::DUP4: - case Instruction::DUP5: - case Instruction::DUP6: - case Instruction::DUP7: - case Instruction::DUP8: - case Instruction::DUP9: - case Instruction::DUP10: - case Instruction::DUP11: - case Instruction::DUP12: - case Instruction::DUP13: - case Instruction::DUP14: - case Instruction::DUP15: - case Instruction::DUP16: - require(1 + (int)inst - (int)Instruction::DUP1); - break; - case Instruction::SWAP1: - case Instruction::SWAP2: - case Instruction::SWAP3: - case Instruction::SWAP4: - case Instruction::SWAP5: - case Instruction::SWAP6: - case Instruction::SWAP7: - case Instruction::SWAP8: - case Instruction::SWAP9: - case Instruction::SWAP10: - case Instruction::SWAP11: - case Instruction::SWAP12: - case Instruction::SWAP13: - case Instruction::SWAP14: - case Instruction::SWAP15: - case Instruction::SWAP16: - require((int)inst - (int)Instruction::SWAP1 + 2); - break; - default: - BOOST_THROW_EXCEPTION(BadInstruction()); + default:; } newTempSize = (newTempSize + 31) / 32 * 32; if (newTempSize > m_temp.size()) runGas += gasForMem(newTempSize) - gasForMem(m_temp.size()); - runGas += c_copyGas * (copySize + 31) / 32; + runGas += c_copyGas * ((copySize + 31) / 32); onOperation(); // if (_onOp) @@ -677,21 +563,6 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) break; case Instruction::JUMPDEST: break; -/* case Instruction::LOG0: - _ext.log({}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 1], (unsigned)m_stack[m_stack.size() - 2])); - break; - case Instruction::LOG1: - _ext.log({m_stack[m_stack.size() - 1]}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 2], (unsigned)m_stack[m_stack.size() - 3])); - break; - case Instruction::LOG2: - _ext.log({m_stack[m_stack.size() - 1], m_stack[m_stack.size() - 2]}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 3], (unsigned)m_stack[m_stack.size() - 4])); - break; - case Instruction::LOG3: - _ext.log({m_stack[m_stack.size() - 1], m_stack[m_stack.size() - 2], m_stack[m_stack.size() - 3]}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 4], (unsigned)m_stack[m_stack.size() - 5])); - break; - case Instruction::LOG4: - _ext.log({m_stack[m_stack.size() - 1], m_stack[m_stack.size() - 2], m_stack[m_stack.size() - 3], m_stack[m_stack.size() - 4]}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 5], (unsigned)m_stack[m_stack.size() - 6])); - break;*/ case Instruction::LOG0: _ext.log({}, bytesConstRef(m_temp.data() + (unsigned)m_stack[m_stack.size() - 1], (unsigned)m_stack[m_stack.size() - 2])); m_stack.pop_back(); @@ -749,6 +620,8 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) case Instruction::CALLCODE: { u256 gas = m_stack.back(); + if (m_stack[m_stack.size() - 3] > 0) + gas += c_callStipend; m_stack.pop_back(); Address receiveAddress = asAddress(m_stack.back()); m_stack.pop_back(); diff --git a/libevm/VM.h b/libevm/VM.h index ecf5de292..f2c773e4b 100644 --- a/libevm/VM.h +++ b/libevm/VM.h @@ -23,11 +23,11 @@ #include #include -#include +#include #include #include #include -#include "FeeStructure.h" +#include #include "VMFace.h" namespace dev diff --git a/libevmcore/Assembly.cpp b/libevmcore/Assembly.cpp index 80ac8c68f..5e9d2fcd3 100644 --- a/libevmcore/Assembly.cpp +++ b/libevmcore/Assembly.cpp @@ -21,6 +21,8 @@ #include "Assembly.h" +#include + #include using namespace std; @@ -171,48 +173,74 @@ ostream& dev::eth::operator<<(ostream& _out, AssemblyItemsConstRef _i) return _out; } -ostream& Assembly::streamRLP(ostream& _out, string const& _prefix) const +string Assembly::getLocationFromSources(StringMap const& _sourceCodes, SourceLocation const& _location) const +{ + if (_location.isEmpty() || _sourceCodes.empty() || _location.start >= _location.end || _location.start < 0) + return ""; + + auto it = _sourceCodes.find(*_location.sourceName); + if (it == _sourceCodes.end()) + return ""; + + string const& source = it->second; + if (size_t(_location.start) >= source.size()) + return ""; + + string cut = source.substr(_location.start, _location.end - _location.start); + auto newLinePos = cut.find_first_of("\n"); + if (newLinePos != string::npos) + cut = cut.substr(0, newLinePos) + "..."; + + return move(cut); +} + +ostream& Assembly::streamRLP(ostream& _out, string const& _prefix, StringMap const& _sourceCodes) const { _out << _prefix << ".code:" << endl; for (AssemblyItem const& i: m_items) + { + string sourceLine = getLocationFromSources(_sourceCodes, i.getLocation()); + _out << _prefix; switch (i.m_type) { case Operation: - _out << _prefix << " " << instructionInfo((Instruction)(byte)i.m_data).name << endl; + _out << " " << instructionInfo((Instruction)(byte)i.m_data).name; break; case Push: - _out << _prefix << " PUSH " << i.m_data << endl; + _out << " PUSH " << i.m_data; break; case PushString: - _out << _prefix << " PUSH \"" << m_strings.at((h256)i.m_data) << "\"" << endl; + _out << " PUSH \"" << m_strings.at((h256)i.m_data) << "\""; break; case PushTag: - _out << _prefix << " PUSH [tag" << i.m_data << "]" << endl; + _out << " PUSH [tag" << i.m_data << "]"; break; case PushSub: - _out << _prefix << " PUSH [$" << h256(i.m_data).abridged() << "]" << endl; + _out << " PUSH [$" << h256(i.m_data).abridged() << "]"; break; case PushSubSize: - _out << _prefix << " PUSH #[$" << h256(i.m_data).abridged() << "]" << endl; + _out << " PUSH #[$" << h256(i.m_data).abridged() << "]"; break; case PushProgramSize: - _out << _prefix << " PUSHSIZE" << endl; + _out << " PUSHSIZE"; break; case Tag: - _out << _prefix << "tag" << i.m_data << ": " << endl << _prefix << " JUMPDEST" << endl; + _out << "tag" << i.m_data << ": " << endl << _prefix << " JUMPDEST"; break; case PushData: - _out << _prefix << " PUSH [" << hex << (unsigned)i.m_data << "]" << endl; + _out << " PUSH [" << hex << (unsigned)i.m_data << "]"; break; case NoOptimizeBegin: - _out << _prefix << "DoNotOptimze{{" << endl; + _out << "DoNotOptimze{{"; break; case NoOptimizeEnd: - _out << _prefix << "DoNotOptimze}}" << endl; + _out << "DoNotOptimze}}"; break; default: BOOST_THROW_EXCEPTION(InvalidOpcode()); } + _out << string("\t\t") << sourceLine << endl; + } if (!m_data.empty() || !m_subs.empty()) { diff --git a/libevmcore/Assembly.h b/libevmcore/Assembly.h index 73d2b663c..4b818e624 100644 --- a/libevmcore/Assembly.h +++ b/libevmcore/Assembly.h @@ -100,9 +100,7 @@ public: AssemblyItem appendJumpI() { auto ret = append(newPushTag()); append(Instruction::JUMPI); return ret; } AssemblyItem appendJump(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(Instruction::JUMP); return ret; } AssemblyItem appendJumpI(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(Instruction::JUMPI); return ret; } - template Assembly& operator<<(T const& _d) { append(_d); return *this; } - AssemblyItems const& getItems() const { return m_items; } AssemblyItem const& back() const { return m_items.back(); } std::string backString() const { return m_items.size() && m_items.back().m_type == PushString ? m_strings.at((h256)m_items.back().m_data) : std::string(); } @@ -116,18 +114,17 @@ public: void popTo(int _deposit) { while (m_deposit > _deposit) append(Instruction::POP); } void injectStart(AssemblyItem const& _i); - std::string out() const { std::stringstream ret; streamRLP(ret); return ret.str(); } - int deposit() const { return m_deposit; } void adjustDeposit(int _adjustment) { m_deposit += _adjustment; if (asserts(m_deposit >= 0)) BOOST_THROW_EXCEPTION(InvalidDeposit()); } void setDeposit(int _deposit) { m_deposit = _deposit; if (asserts(m_deposit >= 0)) BOOST_THROW_EXCEPTION(InvalidDeposit()); } bytes assemble() const; Assembly& optimise(bool _enable); - std::ostream& streamRLP(std::ostream& _out, std::string const& _prefix = "") const; + std::ostream& streamRLP(std::ostream& _out, std::string const& _prefix = "", const StringMap &_sourceCodes = StringMap()) const; -private: +protected: + std::string getLocationFromSources(StringMap const& _sourceCodes, SourceLocation const& _location) const; void donePath() { if (m_totalDeposit != INT_MAX && m_totalDeposit != m_deposit) BOOST_THROW_EXCEPTION(InvalidDeposit()); } unsigned bytesRequired() const; diff --git a/libevmcore/Instruction.cpp b/libevmcore/Instruction.cpp index bba3d7745..23f19ac94 100644 --- a/libevmcore/Instruction.cpp +++ b/libevmcore/Instruction.cpp @@ -162,136 +162,136 @@ const std::map dev::eth::c_instructions = }; static const std::map c_instructionInfo = -{ // Add, Args, Ret, SideEffects - { Instruction::STOP, { "STOP", 0, 0, 0, true } }, - { Instruction::ADD, { "ADD", 0, 2, 1, false } }, - { Instruction::SUB, { "SUB", 0, 2, 1, false } }, - { Instruction::MUL, { "MUL", 0, 2, 1, false } }, - { Instruction::DIV, { "DIV", 0, 2, 1, false } }, - { Instruction::SDIV, { "SDIV", 0, 2, 1, false } }, - { Instruction::MOD, { "MOD", 0, 2, 1, false } }, - { Instruction::SMOD, { "SMOD", 0, 2, 1, false } }, - { Instruction::EXP, { "EXP", 0, 2, 1, false } }, - { Instruction::NOT, { "NOT", 0, 1, 1, false } }, - { Instruction::LT, { "LT", 0, 2, 1, false } }, - { Instruction::GT, { "GT", 0, 2, 1, false } }, - { Instruction::SLT, { "SLT", 0, 2, 1, false } }, - { Instruction::SGT, { "SGT", 0, 2, 1, false } }, - { Instruction::EQ, { "EQ", 0, 2, 1, false } }, - { Instruction::ISZERO, { "ISZERO", 0, 1, 1, false } }, - { Instruction::AND, { "AND", 0, 2, 1, false } }, - { Instruction::OR, { "OR", 0, 2, 1, false } }, - { Instruction::XOR, { "XOR", 0, 2, 1, false } }, - { Instruction::BYTE, { "BYTE", 0, 2, 1, false } }, - { Instruction::ADDMOD, { "ADDMOD", 0, 3, 1, false } }, - { Instruction::MULMOD, { "MULMOD", 0, 3, 1, false } }, - { Instruction::SIGNEXTEND, { "SIGNEXTEND", 0, 2, 1, false } }, - { Instruction::SHA3, { "SHA3", 0, 2, 1, false } }, - { Instruction::ADDRESS, { "ADDRESS", 0, 0, 1, false } }, - { Instruction::BALANCE, { "BALANCE", 0, 1, 1, false } }, - { Instruction::ORIGIN, { "ORIGIN", 0, 0, 1, false } }, - { Instruction::CALLER, { "CALLER", 0, 0, 1, false } }, - { Instruction::CALLVALUE, { "CALLVALUE", 0, 0, 1, false } }, - { Instruction::CALLDATALOAD,{ "CALLDATALOAD", 0, 1, 1, false } }, - { Instruction::CALLDATASIZE,{ "CALLDATASIZE", 0, 0, 1, false } }, - { Instruction::CALLDATACOPY,{ "CALLDATACOPY", 0, 3, 0, true } }, - { Instruction::CODESIZE, { "CODESIZE", 0, 0, 1, false } }, - { Instruction::CODECOPY, { "CODECOPY", 0, 3, 0, true } }, - { Instruction::GASPRICE, { "GASPRICE", 0, 0, 1, false } }, - { Instruction::EXTCODESIZE, { "EXTCODESIZE", 0, 1, 1, false } }, - { Instruction::EXTCODECOPY, { "EXTCODECOPY", 0, 4, 0, true } }, - { Instruction::BLOCKHASH, { "BLOCKHASH", 0, 1, 1, false } }, - { Instruction::COINBASE, { "COINBASE", 0, 0, 1, false } }, - { Instruction::TIMESTAMP, { "TIMESTAMP", 0, 0, 1, false } }, - { Instruction::NUMBER, { "NUMBER", 0, 0, 1, false } }, - { Instruction::DIFFICULTY, { "DIFFICULTY", 0, 0, 1, false } }, - { Instruction::GASLIMIT, { "GASLIMIT", 0, 0, 1, false } }, - { Instruction::POP, { "POP", 0, 1, 0, false } }, - { Instruction::MLOAD, { "MLOAD", 0, 1, 1, false } }, - { Instruction::MSTORE, { "MSTORE", 0, 2, 0, true } }, - { Instruction::MSTORE8, { "MSTORE8", 0, 2, 0, true } }, - { Instruction::SLOAD, { "SLOAD", 0, 1, 1, false } }, - { Instruction::SSTORE, { "SSTORE", 0, 2, 0, true } }, - { Instruction::JUMP, { "JUMP", 0, 1, 0, true } }, - { Instruction::JUMPI, { "JUMPI", 0, 2, 0, true } }, - { Instruction::PC, { "PC", 0, 0, 1, false } }, - { Instruction::MSIZE, { "MSIZE", 0, 0, 1, false } }, - { Instruction::GAS, { "GAS", 0, 0, 1, false } }, - { Instruction::JUMPDEST, { "JUMPDEST", 0, 1, 0, true } }, - { Instruction::PUSH1, { "PUSH1", 1, 0, 1, false } }, - { Instruction::PUSH2, { "PUSH2", 2, 0, 1, false } }, - { Instruction::PUSH3, { "PUSH3", 3, 0, 1, false } }, - { Instruction::PUSH4, { "PUSH4", 4, 0, 1, false } }, - { Instruction::PUSH5, { "PUSH5", 5, 0, 1, false } }, - { Instruction::PUSH6, { "PUSH6", 6, 0, 1, false } }, - { Instruction::PUSH7, { "PUSH7", 7, 0, 1, false } }, - { Instruction::PUSH8, { "PUSH8", 8, 0, 1, false } }, - { Instruction::PUSH9, { "PUSH9", 9, 0, 1, false } }, - { Instruction::PUSH10, { "PUSH10", 10, 0, 1, false } }, - { Instruction::PUSH11, { "PUSH11", 11, 0, 1, false } }, - { Instruction::PUSH12, { "PUSH12", 12, 0, 1, false } }, - { Instruction::PUSH13, { "PUSH13", 13, 0, 1, false } }, - { Instruction::PUSH14, { "PUSH14", 14, 0, 1, false } }, - { Instruction::PUSH15, { "PUSH15", 15, 0, 1, false } }, - { Instruction::PUSH16, { "PUSH16", 16, 0, 1, false } }, - { Instruction::PUSH17, { "PUSH17", 17, 0, 1, false } }, - { Instruction::PUSH18, { "PUSH18", 18, 0, 1, false } }, - { Instruction::PUSH19, { "PUSH19", 19, 0, 1, false } }, - { Instruction::PUSH20, { "PUSH20", 20, 0, 1, false } }, - { Instruction::PUSH21, { "PUSH21", 21, 0, 1, false } }, - { Instruction::PUSH22, { "PUSH22", 22, 0, 1, false } }, - { Instruction::PUSH23, { "PUSH23", 23, 0, 1, false } }, - { Instruction::PUSH24, { "PUSH24", 24, 0, 1, false } }, - { Instruction::PUSH25, { "PUSH25", 25, 0, 1, false } }, - { Instruction::PUSH26, { "PUSH26", 26, 0, 1, false } }, - { Instruction::PUSH27, { "PUSH27", 27, 0, 1, false } }, - { Instruction::PUSH28, { "PUSH28", 28, 0, 1, false } }, - { Instruction::PUSH29, { "PUSH29", 29, 0, 1, false } }, - { Instruction::PUSH30, { "PUSH30", 30, 0, 1, false } }, - { Instruction::PUSH31, { "PUSH31", 31, 0, 1, false } }, - { Instruction::PUSH32, { "PUSH32", 32, 0, 1, false } }, - { Instruction::DUP1, { "DUP1", 0, 1, 2, false } }, - { Instruction::DUP2, { "DUP2", 0, 2, 3, false } }, - { Instruction::DUP3, { "DUP3", 0, 3, 4, false } }, - { Instruction::DUP4, { "DUP4", 0, 4, 5, false } }, - { Instruction::DUP5, { "DUP5", 0, 5, 6, false } }, - { Instruction::DUP6, { "DUP6", 0, 6, 7, false } }, - { Instruction::DUP7, { "DUP7", 0, 7, 8, false } }, - { Instruction::DUP8, { "DUP8", 0, 8, 9, false } }, - { Instruction::DUP9, { "DUP9", 0, 9, 10, false } }, - { Instruction::DUP10, { "DUP10", 0, 10, 11, false } }, - { Instruction::DUP11, { "DUP11", 0, 11, 12, false } }, - { Instruction::DUP12, { "DUP12", 0, 12, 13, false } }, - { Instruction::DUP13, { "DUP13", 0, 13, 14, false } }, - { Instruction::DUP14, { "DUP14", 0, 14, 15, false } }, - { Instruction::DUP15, { "DUP15", 0, 15, 16, false } }, - { Instruction::DUP16, { "DUP16", 0, 16, 17, false } }, - { Instruction::SWAP1, { "SWAP1", 0, 2, 2, false } }, - { Instruction::SWAP2, { "SWAP2", 0, 3, 3, false } }, - { Instruction::SWAP3, { "SWAP3", 0, 4, 4, false } }, - { Instruction::SWAP4, { "SWAP4", 0, 5, 5, false } }, - { Instruction::SWAP5, { "SWAP5", 0, 6, 6, false } }, - { Instruction::SWAP6, { "SWAP6", 0, 7, 7, false } }, - { Instruction::SWAP7, { "SWAP7", 0, 8, 8, false } }, - { Instruction::SWAP8, { "SWAP8", 0, 9, 9, false } }, - { Instruction::SWAP9, { "SWAP9", 0, 10, 10, false } }, - { Instruction::SWAP10, { "SWAP10", 0, 11, 11, false } }, - { Instruction::SWAP11, { "SWAP11", 0, 12, 12, false } }, - { Instruction::SWAP12, { "SWAP12", 0, 13, 13, false } }, - { Instruction::SWAP13, { "SWAP13", 0, 14, 14, false } }, - { Instruction::SWAP14, { "SWAP14", 0, 15, 15, false } }, - { Instruction::SWAP15, { "SWAP15", 0, 16, 16, false } }, - { Instruction::SWAP16, { "SWAP16", 0, 17, 17, false } }, - { Instruction::LOG0, { "LOG0", 0, 2, 0, true } }, - { Instruction::LOG1, { "LOG1", 0, 3, 0, true } }, - { Instruction::LOG2, { "LOG2", 0, 4, 0, true } }, - { Instruction::LOG3, { "LOG3", 0, 5, 0, true } }, - { Instruction::LOG4, { "LOG4", 0, 6, 0, true } }, - { Instruction::CREATE, { "CREATE", 0, 3, 1, true } }, - { Instruction::CALL, { "CALL", 0, 7, 1, true } }, - { Instruction::CALLCODE, { "CALLCODE", 0, 7, 1, true } }, - { Instruction::RETURN, { "RETURN", 0, 2, 0, true } }, - { Instruction::SUICIDE, { "SUICIDE", 0, 1, 0, true } } +{ // Add, Args, Ret, SideEffects, GasPriceTier + { Instruction::STOP, { "STOP", 0, 0, 0, true, ZeroTier } }, + { Instruction::ADD, { "ADD", 0, 2, 1, false, VeryLowTier } }, + { Instruction::SUB, { "SUB", 0, 2, 1, false, VeryLowTier } }, + { Instruction::MUL, { "MUL", 0, 2, 1, false, LowTier } }, + { Instruction::DIV, { "DIV", 0, 2, 1, false, LowTier } }, + { Instruction::SDIV, { "SDIV", 0, 2, 1, false, LowTier } }, + { Instruction::MOD, { "MOD", 0, 2, 1, false, LowTier } }, + { Instruction::SMOD, { "SMOD", 0, 2, 1, false, LowTier } }, + { Instruction::EXP, { "EXP", 0, 2, 1, false, SpecialTier } }, + { Instruction::NOT, { "NOT", 0, 1, 1, false, VeryLowTier } }, + { Instruction::LT, { "LT", 0, 2, 1, false, VeryLowTier } }, + { Instruction::GT, { "GT", 0, 2, 1, false, VeryLowTier } }, + { Instruction::SLT, { "SLT", 0, 2, 1, false, VeryLowTier } }, + { Instruction::SGT, { "SGT", 0, 2, 1, false, VeryLowTier } }, + { Instruction::EQ, { "EQ", 0, 2, 1, false, VeryLowTier } }, + { Instruction::ISZERO, { "ISZERO", 0, 1, 1, false, VeryLowTier } }, + { Instruction::AND, { "AND", 0, 2, 1, false, VeryLowTier } }, + { Instruction::OR, { "OR", 0, 2, 1, false, VeryLowTier } }, + { Instruction::XOR, { "XOR", 0, 2, 1, false, VeryLowTier } }, + { Instruction::BYTE, { "BYTE", 0, 2, 1, false, VeryLowTier } }, + { Instruction::ADDMOD, { "ADDMOD", 0, 3, 1, false, MidTier } }, + { Instruction::MULMOD, { "MULMOD", 0, 3, 1, false, MidTier } }, + { Instruction::SIGNEXTEND, { "SIGNEXTEND", 0, 2, 1, false, LowTier } }, + { Instruction::SHA3, { "SHA3", 0, 2, 1, false, SpecialTier } }, + { Instruction::ADDRESS, { "ADDRESS", 0, 0, 1, false, BaseTier } }, + { Instruction::BALANCE, { "BALANCE", 0, 1, 1, false, ExtTier } }, + { Instruction::ORIGIN, { "ORIGIN", 0, 0, 1, false, BaseTier } }, + { Instruction::CALLER, { "CALLER", 0, 0, 1, false, BaseTier } }, + { Instruction::CALLVALUE, { "CALLVALUE", 0, 0, 1, false, BaseTier } }, + { Instruction::CALLDATALOAD,{ "CALLDATALOAD", 0, 1, 1, false, VeryLowTier } }, + { Instruction::CALLDATASIZE,{ "CALLDATASIZE", 0, 0, 1, false, BaseTier } }, + { Instruction::CALLDATACOPY,{ "CALLDATACOPY", 0, 3, 0, true, VeryLowTier } }, + { Instruction::CODESIZE, { "CODESIZE", 0, 0, 1, false, BaseTier } }, + { Instruction::CODECOPY, { "CODECOPY", 0, 3, 0, true, VeryLowTier } }, + { Instruction::GASPRICE, { "GASPRICE", 0, 0, 1, false, BaseTier } }, + { Instruction::EXTCODESIZE, { "EXTCODESIZE", 0, 1, 1, false, ExtTier } }, + { Instruction::EXTCODECOPY, { "EXTCODECOPY", 0, 4, 0, true, ExtTier } }, + { Instruction::BLOCKHASH, { "BLOCKHASH", 0, 1, 1, false, ExtTier } }, + { Instruction::COINBASE, { "COINBASE", 0, 0, 1, false, BaseTier } }, + { Instruction::TIMESTAMP, { "TIMESTAMP", 0, 0, 1, false, BaseTier } }, + { Instruction::NUMBER, { "NUMBER", 0, 0, 1, false, BaseTier } }, + { Instruction::DIFFICULTY, { "DIFFICULTY", 0, 0, 1, false, BaseTier } }, + { Instruction::GASLIMIT, { "GASLIMIT", 0, 0, 1, false, BaseTier } }, + { Instruction::POP, { "POP", 0, 1, 0, false, BaseTier } }, + { Instruction::MLOAD, { "MLOAD", 0, 1, 1, false, VeryLowTier } }, + { Instruction::MSTORE, { "MSTORE", 0, 2, 0, true, VeryLowTier } }, + { Instruction::MSTORE8, { "MSTORE8", 0, 2, 0, true, VeryLowTier } }, + { Instruction::SLOAD, { "SLOAD", 0, 1, 1, false, SpecialTier } }, + { Instruction::SSTORE, { "SSTORE", 0, 2, 0, true, SpecialTier } }, + { Instruction::JUMP, { "JUMP", 0, 1, 0, true, MidTier } }, + { Instruction::JUMPI, { "JUMPI", 0, 2, 0, true, HighTier } }, + { Instruction::PC, { "PC", 0, 0, 1, false, BaseTier } }, + { Instruction::MSIZE, { "MSIZE", 0, 0, 1, false, BaseTier } }, + { Instruction::GAS, { "GAS", 0, 0, 1, false, BaseTier } }, + { Instruction::JUMPDEST, { "JUMPDEST", 0, 0, 0, true, SpecialTier } }, + { Instruction::PUSH1, { "PUSH1", 1, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH2, { "PUSH2", 2, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH3, { "PUSH3", 3, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH4, { "PUSH4", 4, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH5, { "PUSH5", 5, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH6, { "PUSH6", 6, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH7, { "PUSH7", 7, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH8, { "PUSH8", 8, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH9, { "PUSH9", 9, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH10, { "PUSH10", 10, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH11, { "PUSH11", 11, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH12, { "PUSH12", 12, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH13, { "PUSH13", 13, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH14, { "PUSH14", 14, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH15, { "PUSH15", 15, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH16, { "PUSH16", 16, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH17, { "PUSH17", 17, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH18, { "PUSH18", 18, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH19, { "PUSH19", 19, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH20, { "PUSH20", 20, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH21, { "PUSH21", 21, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH22, { "PUSH22", 22, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH23, { "PUSH23", 23, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH24, { "PUSH24", 24, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH25, { "PUSH25", 25, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH26, { "PUSH26", 26, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH27, { "PUSH27", 27, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH28, { "PUSH28", 28, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH29, { "PUSH29", 29, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH30, { "PUSH30", 30, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH31, { "PUSH31", 31, 0, 1, false, VeryLowTier } }, + { Instruction::PUSH32, { "PUSH32", 32, 0, 1, false, VeryLowTier } }, + { Instruction::DUP1, { "DUP1", 0, 1, 2, false, VeryLowTier } }, + { Instruction::DUP2, { "DUP2", 0, 2, 3, false, VeryLowTier } }, + { Instruction::DUP3, { "DUP3", 0, 3, 4, false, VeryLowTier } }, + { Instruction::DUP4, { "DUP4", 0, 4, 5, false, VeryLowTier } }, + { Instruction::DUP5, { "DUP5", 0, 5, 6, false, VeryLowTier } }, + { Instruction::DUP6, { "DUP6", 0, 6, 7, false, VeryLowTier } }, + { Instruction::DUP7, { "DUP7", 0, 7, 8, false, VeryLowTier } }, + { Instruction::DUP8, { "DUP8", 0, 8, 9, false, VeryLowTier } }, + { Instruction::DUP9, { "DUP9", 0, 9, 10, false, VeryLowTier } }, + { Instruction::DUP10, { "DUP10", 0, 10, 11, false, VeryLowTier } }, + { Instruction::DUP11, { "DUP11", 0, 11, 12, false, VeryLowTier } }, + { Instruction::DUP12, { "DUP12", 0, 12, 13, false, VeryLowTier } }, + { Instruction::DUP13, { "DUP13", 0, 13, 14, false, VeryLowTier } }, + { Instruction::DUP14, { "DUP14", 0, 14, 15, false, VeryLowTier } }, + { Instruction::DUP15, { "DUP15", 0, 15, 16, false, VeryLowTier } }, + { Instruction::DUP16, { "DUP16", 0, 16, 17, false, VeryLowTier } }, + { Instruction::SWAP1, { "SWAP1", 0, 2, 2, false, VeryLowTier } }, + { Instruction::SWAP2, { "SWAP2", 0, 3, 3, false, VeryLowTier } }, + { Instruction::SWAP3, { "SWAP3", 0, 4, 4, false, VeryLowTier } }, + { Instruction::SWAP4, { "SWAP4", 0, 5, 5, false, VeryLowTier } }, + { Instruction::SWAP5, { "SWAP5", 0, 6, 6, false, VeryLowTier } }, + { Instruction::SWAP6, { "SWAP6", 0, 7, 7, false, VeryLowTier } }, + { Instruction::SWAP7, { "SWAP7", 0, 8, 8, false, VeryLowTier } }, + { Instruction::SWAP8, { "SWAP8", 0, 9, 9, false, VeryLowTier } }, + { Instruction::SWAP9, { "SWAP9", 0, 10, 10, false, VeryLowTier } }, + { Instruction::SWAP10, { "SWAP10", 0, 11, 11, false, VeryLowTier } }, + { Instruction::SWAP11, { "SWAP11", 0, 12, 12, false, VeryLowTier } }, + { Instruction::SWAP12, { "SWAP12", 0, 13, 13, false, VeryLowTier } }, + { Instruction::SWAP13, { "SWAP13", 0, 14, 14, false, VeryLowTier } }, + { Instruction::SWAP14, { "SWAP14", 0, 15, 15, false, VeryLowTier } }, + { Instruction::SWAP15, { "SWAP15", 0, 16, 16, false, VeryLowTier } }, + { Instruction::SWAP16, { "SWAP16", 0, 17, 17, false, VeryLowTier } }, + { Instruction::LOG0, { "LOG0", 0, 2, 0, true, SpecialTier } }, + { Instruction::LOG1, { "LOG1", 0, 3, 0, true, SpecialTier } }, + { Instruction::LOG2, { "LOG2", 0, 4, 0, true, SpecialTier } }, + { Instruction::LOG3, { "LOG3", 0, 5, 0, true, SpecialTier } }, + { Instruction::LOG4, { "LOG4", 0, 6, 0, true, SpecialTier } }, + { Instruction::CREATE, { "CREATE", 0, 3, 1, true, SpecialTier } }, + { Instruction::CALL, { "CALL", 0, 7, 1, true, SpecialTier } }, + { Instruction::CALLCODE, { "CALLCODE", 0, 7, 1, true, SpecialTier } }, + { Instruction::RETURN, { "RETURN", 0, 2, 0, true, ZeroTier } }, + { Instruction::SUICIDE, { "SUICIDE", 0, 1, 0, true, ZeroTier } } }; string dev::eth::disassemble(bytes const& _mem) @@ -326,12 +326,7 @@ InstructionInfo dev::eth::instructionInfo(Instruction _inst) } catch (...) { -#ifndef BOOST_NO_EXCEPTIONS - cwarn << "\n" << boost::current_exception_diagnostic_information(); -#else - cwarn << "\n"; -#endif - return InstructionInfo({"", 0, 0, 0, false}); + return InstructionInfo({"", 0, 0, 0, false, InvalidTier}); } } diff --git a/libevmcore/Instruction.h b/libevmcore/Instruction.h index 5cf002c4c..9eab92713 100644 --- a/libevmcore/Instruction.h +++ b/libevmcore/Instruction.h @@ -223,6 +223,19 @@ inline Instruction logInstruction(unsigned _number) return Instruction(unsigned(Instruction::LOG0) + _number); } +enum Tier +{ + ZeroTier = 0, // 0, Zero + BaseTier, // 2, Quick + VeryLowTier, // 3, Fastest + LowTier, // 5, Fast + MidTier, // 8, Mid + HighTier, // 10, Slow + ExtTier, // 20, Ext + SpecialTier, // multiparam or otherwise special + InvalidTier // Invalid. +}; + /// Information structure for a particular instruction. struct InstructionInfo { @@ -231,6 +244,7 @@ struct InstructionInfo 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. 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 + int gasPriceTier; ///< Tier for gas pricing. }; /// Information on all the instructions. diff --git a/libjsqrc/ethereumjs/dist/ethereum.js b/libjsqrc/ethereumjs/dist/ethereum.js index 41ab0b99a..69d393699 100644 --- a/libjsqrc/ethereumjs/dist/ethereum.js +++ b/libjsqrc/ethereumjs/dist/ethereum.js @@ -1787,6 +1787,14 @@ var web3 = { }; }, + canary: function (abi) { + return function(addr) { + // Default to address of Config. TODO: rremove prior to genesis. + addr = addr || '0xc6d9d2cd449a754c494264e1809c50e34d64562b'; + return addr; + }; + }, + /// @param filter may be a string, object or event /// @param indexed is optional, this is an object with optional event indexed params /// @param options is optional, this is an object with optional event options ('max'...) diff --git a/libjsqrc/ethereumjs/dist/ethereum.js.map b/libjsqrc/ethereumjs/dist/ethereum.js.map index 1cb7bbd3f..2b788900e 100644 --- a/libjsqrc/ethereumjs/dist/ethereum.js.map +++ b/libjsqrc/ethereumjs/dist/ethereum.js.map @@ -23,7 +23,7 @@ "index.js" ], "names": [], - "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", + "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", "file": "generated.js", "sourceRoot": "", "sourcesContent": [ @@ -45,7 +45,7 @@ "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file types.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar f = require('./formatters');\n\n/// @param expected type prefix (string)\n/// @returns function which checks if type has matching prefix. if yes, returns true, otherwise false\nvar prefixedType = function (prefix) {\n return function (type) {\n return type.indexOf(prefix) === 0;\n };\n};\n\n/// @param expected type name (string)\n/// @returns function which checks if type is matching expected one. if yes, returns true, otherwise false\nvar namedType = function (name) {\n return function (type) {\n return name === type;\n };\n};\n\n/// Setups input formatters for solidity types\n/// @returns an array of input formatters \nvar inputTypes = function () {\n \n return [\n { type: prefixedType('uint'), format: f.formatInputInt },\n { type: prefixedType('int'), format: f.formatInputInt },\n { type: prefixedType('hash'), format: f.formatInputInt },\n { type: prefixedType('string'), format: f.formatInputString }, \n { type: prefixedType('real'), format: f.formatInputReal },\n { type: prefixedType('ureal'), format: f.formatInputReal },\n { type: namedType('address'), format: f.formatInputInt },\n { type: namedType('bool'), format: f.formatInputBool }\n ];\n};\n\n/// Setups output formaters for solidity types\n/// @returns an array of output formatters\nvar outputTypes = function () {\n\n return [\n { type: prefixedType('uint'), format: f.formatOutputUInt },\n { type: prefixedType('int'), format: f.formatOutputInt },\n { type: prefixedType('hash'), format: f.formatOutputHash },\n { type: prefixedType('string'), format: f.formatOutputString },\n { type: prefixedType('real'), format: f.formatOutputReal },\n { type: prefixedType('ureal'), format: f.formatOutputUReal },\n { type: namedType('address'), format: f.formatOutputAddress },\n { type: namedType('bool'), format: f.formatOutputBool }\n ];\n};\n\nmodule.exports = {\n prefixedType: prefixedType,\n namedType: namedType,\n inputTypes: inputTypes,\n outputTypes: outputTypes\n};\n\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file utils.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar c = require('./const');\n\n/// Finds first index of array element matching pattern\n/// @param array\n/// @param callback pattern\n/// @returns index of element\nvar findIndex = function (array, callback) {\n var end = false;\n var i = 0;\n for (; i < array.length && !end; i++) {\n end = callback(array[i]);\n }\n return end ? i - 1 : -1;\n};\n\n/// @returns ascii string representation of hex value prefixed with 0x\nvar toAscii = function(hex) {\n// Find termination\n var str = \"\";\n var i = 0, l = hex.length;\n if (hex.substring(0, 2) === '0x') {\n i = 2;\n }\n for (; i < l; i+=2) {\n var code = parseInt(hex.substr(i, 2), 16);\n if (code === 0) {\n break;\n }\n\n str += String.fromCharCode(code);\n }\n\n return str;\n};\n \nvar toHex = function(str) {\n var hex = \"\";\n for(var i = 0; i < str.length; i++) {\n var n = str.charCodeAt(i).toString(16);\n hex += n.length < 2 ? '0' + n : n;\n }\n\n return hex;\n};\n\n/// @returns hex representation (prefixed by 0x) of ascii string\nvar fromAscii = function(str, pad) {\n pad = pad === undefined ? 0 : pad;\n var hex = toHex(str);\n while (hex.length < pad*2)\n hex += \"00\";\n return \"0x\" + hex;\n};\n\n/// @returns display name for function/event eg. multiply(uint256) -> multiply\nvar extractDisplayName = function (name) {\n var length = name.indexOf('('); \n return length !== -1 ? name.substr(0, length) : name;\n};\n\n/// @returns overloaded part of function/event name\nvar extractTypeName = function (name) {\n /// TODO: make it invulnerable\n var length = name.indexOf('(');\n return length !== -1 ? name.substr(length + 1, name.length - 1 - (length + 1)).replace(' ', '') : \"\";\n};\n\n/// Filters all function from input abi\n/// @returns abi array with filtered objects of type 'function'\nvar filterFunctions = function (json) {\n return json.filter(function (current) {\n return current.type === 'function'; \n }); \n};\n\n/// Filters all events form input abi\n/// @returns abi array with filtered objects of type 'event'\nvar filterEvents = function (json) {\n return json.filter(function (current) {\n return current.type === 'event';\n });\n};\n\n/// used to transform value/string to eth string\n/// TODO: use BigNumber.js to parse int\n/// TODO: add tests for it!\nvar toEth = function (str) {\n /*jshint maxcomplexity:7 */\n var val = typeof str === \"string\" ? str.indexOf('0x') === 0 ? parseInt(str.substr(2), 16) : parseInt(str) : str;\n var unit = 0;\n var units = c.ETH_UNITS;\n while (val > 3000 && unit < units.length - 1)\n {\n val /= 1000;\n unit++;\n }\n var s = val.toString().length < val.toFixed(2).length ? val.toString() : val.toFixed(2);\n var replaceFunction = function($0, $1, $2) {\n return $1 + ',' + $2;\n };\n\n while (true) {\n var o = s;\n s = s.replace(/(\\d)(\\d\\d\\d[\\.\\,])/, replaceFunction);\n if (o === s)\n break;\n }\n return s + ' ' + units[unit];\n};\n\nmodule.exports = {\n findIndex: findIndex,\n toAscii: toAscii,\n fromAscii: fromAscii,\n extractDisplayName: extractDisplayName,\n extractTypeName: extractTypeName,\n filterFunctions: filterFunctions,\n filterEvents: filterEvents,\n toEth: toEth\n};\n\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file watches.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\n/// @returns an array of objects describing web3.eth.watch api methods\nvar eth = function () {\n var newFilter = function (args) {\n return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter';\n };\n\n return [\n { name: 'newFilter', call: newFilter },\n { name: 'uninstallFilter', call: 'eth_uninstallFilter' },\n { name: 'getMessages', call: 'eth_filterLogs' }\n ];\n};\n\n/// @returns an array of objects describing web3.shh.watch api methods\nvar shh = function () {\n return [\n { name: 'newFilter', call: 'shh_newFilter' },\n { name: 'uninstallFilter', call: 'shh_uninstallFilter' },\n { name: 'getMessages', call: 'shh_getMessages' }\n ];\n};\n\nmodule.exports = {\n eth: eth,\n shh: shh\n};\n\n", - "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file web3.js\n * @authors:\n * Jeffrey Wilcke \n * Marek Kotewicz \n * Marian Oancea \n * Gav Wood \n * @date 2014\n */\n\nif (\"build\" !== 'build') {/*\n var BigNumber = require('bignumber.js');\n*/}\n\nvar eth = require('./eth');\nvar db = require('./db');\nvar shh = require('./shh');\nvar watches = require('./watches');\nvar filter = require('./filter');\nvar utils = require('./utils');\nvar requestManager = require('./requestmanager');\n\n/// @returns an array of objects describing web3 api methods\nvar web3Methods = function () {\n return [\n { name: 'sha3', call: 'web3_sha3' }\n ];\n};\n\n/// creates methods in a given object based on method description on input\n/// setups api calls for these methods\nvar setupMethods = function (obj, methods) {\n methods.forEach(function (method) {\n obj[method.name] = function () {\n var args = Array.prototype.slice.call(arguments);\n var call = typeof method.call === 'function' ? method.call(args) : method.call;\n return web3.manager.send({\n method: call,\n params: args\n });\n };\n });\n};\n\n/// creates properties in a given object based on properties description on input\n/// setups api calls for these properties\nvar setupProperties = function (obj, properties) {\n properties.forEach(function (property) {\n var proto = {};\n proto.get = function () {\n return web3.manager.send({\n method: property.getter\n });\n };\n\n if (property.setter) {\n proto.set = function (val) {\n return web3.manager.send({\n method: property.setter,\n params: [val]\n });\n };\n }\n Object.defineProperty(obj, property.name, proto);\n });\n};\n\n/*jshint maxparams:4 */\nvar startPolling = function (method, id, callback, uninstall) {\n web3.manager.startPolling({\n method: method, \n params: [id]\n }, id, callback, uninstall); \n};\n/*jshint maxparams:3 */\n\nvar stopPolling = function (id) {\n web3.manager.stopPolling(id);\n};\n\nvar ethWatch = {\n startPolling: startPolling.bind(null, 'eth_changed'), \n stopPolling: stopPolling\n};\n\nvar shhWatch = {\n startPolling: startPolling.bind(null, 'shh_changed'), \n stopPolling: stopPolling\n};\n\n/// setups web3 object, and it's in-browser executed methods\nvar web3 = {\n manager: requestManager(),\n providers: {},\n\n /// @returns ascii string representation of hex value prefixed with 0x\n toAscii: utils.toAscii,\n\n /// @returns hex representation (prefixed by 0x) of ascii string\n fromAscii: utils.fromAscii,\n\n /// @returns decimal representaton of hex value prefixed by 0x\n toDecimal: function (val) {\n // remove 0x and place 0, if it's required\n val = val.length > 2 ? val.substring(2) : \"0\";\n return (new BigNumber(val, 16).toString(10));\n },\n\n /// @returns hex representation (prefixed by 0x) of decimal value\n fromDecimal: function (val) {\n return \"0x\" + (new BigNumber(val).toString(16));\n },\n\n /// used to transform value/string to eth string\n toEth: utils.toEth,\n\n /// eth object prototype\n eth: {\n contractFromAbi: function (abi) {\n return function(addr) {\n // Default to address of Config. TODO: rremove prior to genesis.\n addr = addr || '0xc6d9d2cd449a754c494264e1809c50e34d64562b';\n var ret = web3.eth.contract(addr, abi);\n ret.address = addr;\n return ret;\n };\n },\n\n /// @param filter may be a string, object or event\n /// @param indexed is optional, this is an object with optional event indexed params\n /// @param options is optional, this is an object with optional event options ('max'...)\n /// TODO: fix it, 4 params? no way\n /*jshint maxparams:4 */\n watch: function (fil, indexed, options, formatter) {\n if (fil._isEvent) {\n return fil(indexed, options);\n }\n return filter(fil, ethWatch, formatter);\n }\n /*jshint maxparams:3 */\n },\n\n /// db object prototype\n db: {},\n\n /// shh object prototype\n shh: {\n /// @param filter may be a string, object or event\n watch: function (fil) {\n return filter(fil, shhWatch);\n }\n },\n setProvider: function (provider) {\n web3.manager.setProvider(provider);\n },\n \n /// Should be called to reset state of web3 object\n /// Resets everything except manager\n reset: function () {\n web3.manager.reset(); \n }\n};\n\n/// setups all api methods\nsetupMethods(web3, web3Methods());\nsetupMethods(web3.eth, eth.methods());\nsetupProperties(web3.eth, eth.properties());\nsetupMethods(web3.db, db.methods());\nsetupMethods(web3.shh, shh.methods());\nsetupMethods(ethWatch, watches.eth());\nsetupMethods(shhWatch, watches.shh());\n\nmodule.exports = web3;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file web3.js\n * @authors:\n * Jeffrey Wilcke \n * Marek Kotewicz \n * Marian Oancea \n * Gav Wood \n * @date 2014\n */\n\nif (\"build\" !== 'build') {/*\n var BigNumber = require('bignumber.js');\n*/}\n\nvar eth = require('./eth');\nvar db = require('./db');\nvar shh = require('./shh');\nvar watches = require('./watches');\nvar filter = require('./filter');\nvar utils = require('./utils');\nvar requestManager = require('./requestmanager');\n\n/// @returns an array of objects describing web3 api methods\nvar web3Methods = function () {\n return [\n { name: 'sha3', call: 'web3_sha3' }\n ];\n};\n\n/// creates methods in a given object based on method description on input\n/// setups api calls for these methods\nvar setupMethods = function (obj, methods) {\n methods.forEach(function (method) {\n obj[method.name] = function () {\n var args = Array.prototype.slice.call(arguments);\n var call = typeof method.call === 'function' ? method.call(args) : method.call;\n return web3.manager.send({\n method: call,\n params: args\n });\n };\n });\n};\n\n/// creates properties in a given object based on properties description on input\n/// setups api calls for these properties\nvar setupProperties = function (obj, properties) {\n properties.forEach(function (property) {\n var proto = {};\n proto.get = function () {\n return web3.manager.send({\n method: property.getter\n });\n };\n\n if (property.setter) {\n proto.set = function (val) {\n return web3.manager.send({\n method: property.setter,\n params: [val]\n });\n };\n }\n Object.defineProperty(obj, property.name, proto);\n });\n};\n\n/*jshint maxparams:4 */\nvar startPolling = function (method, id, callback, uninstall) {\n web3.manager.startPolling({\n method: method, \n params: [id]\n }, id, callback, uninstall); \n};\n/*jshint maxparams:3 */\n\nvar stopPolling = function (id) {\n web3.manager.stopPolling(id);\n};\n\nvar ethWatch = {\n startPolling: startPolling.bind(null, 'eth_changed'), \n stopPolling: stopPolling\n};\n\nvar shhWatch = {\n startPolling: startPolling.bind(null, 'shh_changed'), \n stopPolling: stopPolling\n};\n\n/// setups web3 object, and it's in-browser executed methods\nvar web3 = {\n manager: requestManager(),\n providers: {},\n\n /// @returns ascii string representation of hex value prefixed with 0x\n toAscii: utils.toAscii,\n\n /// @returns hex representation (prefixed by 0x) of ascii string\n fromAscii: utils.fromAscii,\n\n /// @returns decimal representaton of hex value prefixed by 0x\n toDecimal: function (val) {\n // remove 0x and place 0, if it's required\n val = val.length > 2 ? val.substring(2) : \"0\";\n return (new BigNumber(val, 16).toString(10));\n },\n\n /// @returns hex representation (prefixed by 0x) of decimal value\n fromDecimal: function (val) {\n return \"0x\" + (new BigNumber(val).toString(16));\n },\n\n /// used to transform value/string to eth string\n toEth: utils.toEth,\n\n /// eth object prototype\n eth: {\n contractFromAbi: function (abi) {\n return function(addr) {\n // Default to address of Config. TODO: rremove prior to genesis.\n addr = addr || '0xc6d9d2cd449a754c494264e1809c50e34d64562b';\n var ret = web3.eth.contract(addr, abi);\n ret.address = addr;\n return ret;\n };\n },\n\n canary: function (abi) {\n return function(addr) {\n // Default to address of Config. TODO: rremove prior to genesis.\n addr = addr || '0xc6d9d2cd449a754c494264e1809c50e34d64562b';\n return addr;\n };\n },\n\n /// @param filter may be a string, object or event\n /// @param indexed is optional, this is an object with optional event indexed params\n /// @param options is optional, this is an object with optional event options ('max'...)\n /// TODO: fix it, 4 params? no way\n /*jshint maxparams:4 */\n watch: function (fil, indexed, options, formatter) {\n if (fil._isEvent) {\n return fil(indexed, options);\n }\n return filter(fil, ethWatch, formatter);\n }\n /*jshint maxparams:3 */\n },\n\n /// db object prototype\n db: {},\n\n /// shh object prototype\n shh: {\n /// @param filter may be a string, object or event\n watch: function (fil) {\n return filter(fil, shhWatch);\n }\n },\n setProvider: function (provider) {\n web3.manager.setProvider(provider);\n },\n \n /// Should be called to reset state of web3 object\n /// Resets everything except manager\n reset: function () {\n web3.manager.reset(); \n }\n};\n\n/// setups all api methods\nsetupMethods(web3, web3Methods());\nsetupMethods(web3.eth, eth.methods());\nsetupProperties(web3.eth, eth.properties());\nsetupMethods(web3.db, db.methods());\nsetupMethods(web3.shh, shh.methods());\nsetupMethods(ethWatch, watches.eth());\nsetupMethods(shhWatch, watches.shh());\n\nmodule.exports = web3;\n\n", "var web3 = require('./lib/web3');\nweb3.providers.HttpSyncProvider = require('./lib/httpsync');\nweb3.providers.QtSyncProvider = require('./lib/qtsync');\nweb3.eth.contract = require('./lib/contract');\nweb3.abi = require('./lib/abi');\n\nmodule.exports = web3;\n" ] } \ No newline at end of file diff --git a/libjsqrc/ethereumjs/dist/ethereum.min.js b/libjsqrc/ethereumjs/dist/ethereum.min.js index 373a4aba4..e65ae4f09 100644 --- a/libjsqrc/ethereumjs/dist/ethereum.min.js +++ b/libjsqrc/ethereumjs/dist/ethereum.min.js @@ -1 +1 @@ -require=function t(n,e,r){function o(i,u){if(!e[i]){if(!n[i]){var f="function"==typeof require&&require;if(!u&&f)return f(i,!0);if(a)return a(i,!0);var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var c=e[i]={exports:{}};n[i][0].call(c.exports,function(t){var e=n[i][1][t];return o(e?e:t)},c,c.exports,t,n,e,r)}return e[i].exports}for(var a="function"==typeof require&&require,i=0;iv;v++)g.push(h(n.slice(0,f))),n=n.slice(f);e.push(g)}else r.prefixedType("string")(t[s].type)?(c=c.slice(f),e.push(h(n.slice(0,f))),n=n.slice(f)):(e.push(h(n.slice(0,f))),n=n.slice(f))}),e},h=function(t){var n={};return t.forEach(function(t){var r=e.extractDisplayName(t.name),o=e.extractTypeName(t.name),a=function(){var n=Array.prototype.slice.call(arguments);return c(t.inputs,n)};void 0===n[r]&&(n[r]=a),n[r][o]=a}),n},d=function(t){var n={};return t.forEach(function(t){var r=e.extractDisplayName(t.name),o=e.extractTypeName(t.name),a=function(n){return m(t.outputs,n)};void 0===n[r]&&(n[r]=a),n[r][o]=a}),n};n.exports={inputParser:h,outputParser:d,formatInput:c,formatOutput:m}},{"./const":2,"./formatters":8,"./types":15,"./utils":16}],2:[function(t,n){var e=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];n.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:e,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:BigNumber.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3}},{}],3:[function(t,n){var e=t("./web3"),r=t("./abi"),o=t("./utils"),a=t("./event"),i=t("./signature"),u=function(t){e._currentContractAbi=t.abi,e._currentContractAddress=t.address,e._currentContractMethodName=t.method,e._currentContractMethodParams=t.params},f=function(t){t.call=function(n){return t._isTransact=!1,t._options=n,t},t.transact=function(n){return t._isTransact=!0,t._options=n,t},t._options={},["gas","gasPrice","value","from"].forEach(function(n){t[n]=function(e){return t._options[n]=e,t}})},s=function(t,n,a){var f=r.inputParser(n),s=r.outputParser(n);o.filterFunctions(n).forEach(function(r){var c=o.extractDisplayName(r.name),l=o.extractTypeName(r.name),p=function(){var o=Array.prototype.slice.call(arguments),p=i.functionSignatureFromAscii(r.name),m=f[c][l].apply(null,o),h=t._options||{};h.to=a,h.data=p+m;var d=t._isTransact===!0||t._isTransact!==!1&&!r.constant,g=h.collapse!==!1;if(t._options={},t._isTransact=null,d)return u({abi:n,address:a,method:r.name,params:o}),void e.eth.transact(h);var v=e.eth.call(h),y=s[c][l](v);return g&&(1===y.length?y=y[0]:0===y.length&&(y=null)),y};void 0===t[c]&&(t[c]=p),t[c][l]=p})},c=function(t,n,e){t.address=e,t._onWatchEventResult=function(t){var e=event.getMatchingEvent(o.filterEvents(n)),r=a.outputParser(e);return r(t)},Object.defineProperty(t,"topic",{get:function(){return o.filterEvents(n).map(function(t){return i.eventSignatureFromAscii(t.name)})}})},l=function(t,n,r){o.filterEvents(n).forEach(function(n){var u=function(){var t=Array.prototype.slice.call(arguments),o=i.eventSignatureFromAscii(n.name),u=a.inputParser(r,o,n),f=u.apply(null,t),s=function(t){var e=a.outputParser(n);return e(t)};return e.eth.watch(f,void 0,void 0,s)};u._isEvent=!0;var f=o.extractDisplayName(n.name),s=o.extractTypeName(n.name);void 0===t[f]&&(t[f]=u),t[f][s]=u})},p=function(t,n){n.forEach(function(t){if(-1===t.name.indexOf("(")){var n=t.name,e=t.inputs.map(function(t){return t.type}).join();t.name=n+"("+e+")"}});var e={};return f(e),s(e,n,t),c(e,n,t),l(e,n,t),e};n.exports=p},{"./abi":1,"./event":6,"./signature":14,"./utils":16,"./web3":18}],4:[function(t,n){var e=function(){return[{name:"put",call:"db_put"},{name:"get",call:"db_get"},{name:"putString",call:"db_putString"},{name:"getString",call:"db_getString"}]};n.exports={methods:e}},{}],5:[function(t,n){var e=function(){var t=function(t){return"string"==typeof t[0]?"eth_blockByHash":"eth_blockByNumber"},n=function(t){return"string"==typeof t[0]?"eth_transactionByHash":"eth_transactionByNumber"},e=function(t){return"string"==typeof t[0]?"eth_uncleByHash":"eth_uncleByNumber"},r=function(t){return"string"==typeof t[0]?"eth_transactionCountByHash":"eth_transactionCountByNumber"},o=function(t){return"string"==typeof t[0]?"eth_uncleCountByHash":"eth_uncleCountByNumber"};return[{name:"balanceAt",call:"eth_balanceAt"},{name:"stateAt",call:"eth_stateAt"},{name:"storageAt",call:"eth_storageAt"},{name:"countAt",call:"eth_countAt"},{name:"codeAt",call:"eth_codeAt"},{name:"transact",call:"eth_transact"},{name:"call",call:"eth_call"},{name:"block",call:t},{name:"transaction",call:n},{name:"uncle",call:e},{name:"compilers",call:"eth_compilers"},{name:"flush",call:"eth_flush"},{name:"lll",call:"eth_lll"},{name:"solidity",call:"eth_solidity"},{name:"serpent",call:"eth_serpent"},{name:"logs",call:"eth_logs"},{name:"transactionCount",call:r},{name:"uncleCount",call:o}]},r=function(){return[{name:"coinbase",getter:"eth_coinbase",setter:"eth_setCoinbase"},{name:"listening",getter:"eth_listening",setter:"eth_setListening"},{name:"mining",getter:"eth_mining",setter:"eth_setMining"},{name:"gasPrice",getter:"eth_gasPrice"},{name:"accounts",getter:"eth_accounts"},{name:"peerCount",getter:"eth_peerCount"},{name:"defaultBlock",getter:"eth_defaultBlock",setter:"eth_setDefaultBlock"},{name:"number",getter:"eth_number"}]};n.exports={methods:e,properties:r}},{}],6:[function(t,n){var e=t("./abi"),r=t("./utils"),o=t("./signature"),a=function(t,n){return t.filter(function(t){return t.indexed===n})},i=function(t,n){var e=r.findIndex(t,function(t){return t.name===n});return-1===e?void console.error("indexed param with name "+n+" not found"):t[e]},u=function(t,n){return Object.keys(n).map(function(r){var o=[i(a(t.inputs,!0),r)],u=n[r];return u instanceof Array?u.map(function(t){return e.formatInput(o,[t])}):e.formatInput(o,[u])})},f=function(t,n,e){return function(r,o){var a=o||{};return a.address=t,a.topic=[],a.topic.push(n),r&&(a.topic=a.topic.concat(u(e,r))),a}},s=function(t,n,e){var r=n.slice(),o=e.slice();return t.reduce(function(t,n){var e;return e=n.indexed?r.splice(0,1)[0]:o.splice(0,1)[0],t[n.name]=e,t},{})},c=function(t){return function(n){var o={event:r.extractDisplayName(t.name),number:n.number,hash:n.hash,args:{}};if(n.topics=n.topic,!n.topic)return o;var i=a(t.inputs,!0),u="0x"+n.topic.slice(1,n.topic.length).map(function(t){return t.slice(2)}).join(""),f=e.formatOutput(i,u),c=a(t.inputs,!1),l=e.formatOutput(c,n.data);return o.args=s(t.inputs,f,l),o}},l=function(t,n){for(var e=0;ee;e+=2){var o=parseInt(t.substr(e,2),16);if(0===o)break;n+=String.fromCharCode(o)}return n},a=function(t){for(var n="",e=0;e3e3&&r2?t.substring(2):"0",new BigNumber(t,16).toString(10)},fromDecimal:function(t){return"0x"+new BigNumber(t).toString(16)},toEth:u.toEth,eth:{contractFromAbi:function(t){return function(n){n=n||"0xc6d9d2cd449a754c494264e1809c50e34d64562b";var e=g.eth.contract(n,t);return e.address=n,e}},watch:function(t,n,e,r){return t._isEvent?t(n,e):i(t,h,r)}},db:{},shh:{watch:function(t){return i(t,d)}},setProvider:function(t){g.manager.setProvider(t)},reset:function(){g.manager.reset()}};c(g,s()),c(g.eth,e.methods()),l(g.eth,e.properties()),c(g.db,r.methods()),c(g.shh,o.methods()),c(h,a.eth()),c(d,a.shh()),n.exports=g},{"./db":4,"./eth":5,"./filter":7,"./requestmanager":12,"./shh":13,"./utils":16,"./watches":17}],web3:[function(t,n){var e=t("./lib/web3");e.providers.HttpSyncProvider=t("./lib/httpsync"),e.providers.QtSyncProvider=t("./lib/qtsync"),e.eth.contract=t("./lib/contract"),e.abi=t("./lib/abi"),n.exports=e},{"./lib/abi":1,"./lib/contract":3,"./lib/httpsync":9,"./lib/qtsync":11,"./lib/web3":18}]},{},["web3"]); \ No newline at end of file +require=function t(n,e,r){function o(i,u){if(!e[i]){if(!n[i]){var f="function"==typeof require&&require;if(!u&&f)return f(i,!0);if(a)return a(i,!0);var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var c=e[i]={exports:{}};n[i][0].call(c.exports,function(t){var e=n[i][1][t];return o(e?e:t)},c,c.exports,t,n,e,r)}return e[i].exports}for(var a="function"==typeof require&&require,i=0;iv;v++)g.push(h(n.slice(0,f))),n=n.slice(f);e.push(g)}else r.prefixedType("string")(t[s].type)?(c=c.slice(f),e.push(h(n.slice(0,f))),n=n.slice(f)):(e.push(h(n.slice(0,f))),n=n.slice(f))}),e},h=function(t){var n={};return t.forEach(function(t){var r=e.extractDisplayName(t.name),o=e.extractTypeName(t.name),a=function(){var n=Array.prototype.slice.call(arguments);return c(t.inputs,n)};void 0===n[r]&&(n[r]=a),n[r][o]=a}),n},d=function(t){var n={};return t.forEach(function(t){var r=e.extractDisplayName(t.name),o=e.extractTypeName(t.name),a=function(n){return m(t.outputs,n)};void 0===n[r]&&(n[r]=a),n[r][o]=a}),n};n.exports={inputParser:h,outputParser:d,formatInput:c,formatOutput:m}},{"./const":2,"./formatters":8,"./types":15,"./utils":16}],2:[function(t,n){var e=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];n.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:e,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:BigNumber.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3}},{}],3:[function(t,n){var e=t("./web3"),r=t("./abi"),o=t("./utils"),a=t("./event"),i=t("./signature"),u=function(t){e._currentContractAbi=t.abi,e._currentContractAddress=t.address,e._currentContractMethodName=t.method,e._currentContractMethodParams=t.params},f=function(t){t.call=function(n){return t._isTransact=!1,t._options=n,t},t.transact=function(n){return t._isTransact=!0,t._options=n,t},t._options={},["gas","gasPrice","value","from"].forEach(function(n){t[n]=function(e){return t._options[n]=e,t}})},s=function(t,n,a){var f=r.inputParser(n),s=r.outputParser(n);o.filterFunctions(n).forEach(function(r){var c=o.extractDisplayName(r.name),l=o.extractTypeName(r.name),p=function(){var o=Array.prototype.slice.call(arguments),p=i.functionSignatureFromAscii(r.name),m=f[c][l].apply(null,o),h=t._options||{};h.to=a,h.data=p+m;var d=t._isTransact===!0||t._isTransact!==!1&&!r.constant,g=h.collapse!==!1;if(t._options={},t._isTransact=null,d)return u({abi:n,address:a,method:r.name,params:o}),void e.eth.transact(h);var v=e.eth.call(h),y=s[c][l](v);return g&&(1===y.length?y=y[0]:0===y.length&&(y=null)),y};void 0===t[c]&&(t[c]=p),t[c][l]=p})},c=function(t,n,e){t.address=e,t._onWatchEventResult=function(t){var e=event.getMatchingEvent(o.filterEvents(n)),r=a.outputParser(e);return r(t)},Object.defineProperty(t,"topic",{get:function(){return o.filterEvents(n).map(function(t){return i.eventSignatureFromAscii(t.name)})}})},l=function(t,n,r){o.filterEvents(n).forEach(function(n){var u=function(){var t=Array.prototype.slice.call(arguments),o=i.eventSignatureFromAscii(n.name),u=a.inputParser(r,o,n),f=u.apply(null,t),s=function(t){var e=a.outputParser(n);return e(t)};return e.eth.watch(f,void 0,void 0,s)};u._isEvent=!0;var f=o.extractDisplayName(n.name),s=o.extractTypeName(n.name);void 0===t[f]&&(t[f]=u),t[f][s]=u})},p=function(t,n){n.forEach(function(t){if(-1===t.name.indexOf("(")){var n=t.name,e=t.inputs.map(function(t){return t.type}).join();t.name=n+"("+e+")"}});var e={};return f(e),s(e,n,t),c(e,n,t),l(e,n,t),e};n.exports=p},{"./abi":1,"./event":6,"./signature":14,"./utils":16,"./web3":18}],4:[function(t,n){var e=function(){return[{name:"put",call:"db_put"},{name:"get",call:"db_get"},{name:"putString",call:"db_putString"},{name:"getString",call:"db_getString"}]};n.exports={methods:e}},{}],5:[function(t,n){var e=function(){var t=function(t){return"string"==typeof t[0]?"eth_blockByHash":"eth_blockByNumber"},n=function(t){return"string"==typeof t[0]?"eth_transactionByHash":"eth_transactionByNumber"},e=function(t){return"string"==typeof t[0]?"eth_uncleByHash":"eth_uncleByNumber"},r=function(t){return"string"==typeof t[0]?"eth_transactionCountByHash":"eth_transactionCountByNumber"},o=function(t){return"string"==typeof t[0]?"eth_uncleCountByHash":"eth_uncleCountByNumber"};return[{name:"balanceAt",call:"eth_balanceAt"},{name:"stateAt",call:"eth_stateAt"},{name:"storageAt",call:"eth_storageAt"},{name:"countAt",call:"eth_countAt"},{name:"codeAt",call:"eth_codeAt"},{name:"transact",call:"eth_transact"},{name:"call",call:"eth_call"},{name:"block",call:t},{name:"transaction",call:n},{name:"uncle",call:e},{name:"compilers",call:"eth_compilers"},{name:"flush",call:"eth_flush"},{name:"lll",call:"eth_lll"},{name:"solidity",call:"eth_solidity"},{name:"serpent",call:"eth_serpent"},{name:"logs",call:"eth_logs"},{name:"transactionCount",call:r},{name:"uncleCount",call:o}]},r=function(){return[{name:"coinbase",getter:"eth_coinbase",setter:"eth_setCoinbase"},{name:"listening",getter:"eth_listening",setter:"eth_setListening"},{name:"mining",getter:"eth_mining",setter:"eth_setMining"},{name:"gasPrice",getter:"eth_gasPrice"},{name:"accounts",getter:"eth_accounts"},{name:"peerCount",getter:"eth_peerCount"},{name:"defaultBlock",getter:"eth_defaultBlock",setter:"eth_setDefaultBlock"},{name:"number",getter:"eth_number"}]};n.exports={methods:e,properties:r}},{}],6:[function(t,n){var e=t("./abi"),r=t("./utils"),o=t("./signature"),a=function(t,n){return t.filter(function(t){return t.indexed===n})},i=function(t,n){var e=r.findIndex(t,function(t){return t.name===n});return-1===e?void console.error("indexed param with name "+n+" not found"):t[e]},u=function(t,n){return Object.keys(n).map(function(r){var o=[i(a(t.inputs,!0),r)],u=n[r];return u instanceof Array?u.map(function(t){return e.formatInput(o,[t])}):e.formatInput(o,[u])})},f=function(t,n,e){return function(r,o){var a=o||{};return a.address=t,a.topic=[],a.topic.push(n),r&&(a.topic=a.topic.concat(u(e,r))),a}},s=function(t,n,e){var r=n.slice(),o=e.slice();return t.reduce(function(t,n){var e;return e=n.indexed?r.splice(0,1)[0]:o.splice(0,1)[0],t[n.name]=e,t},{})},c=function(t){return function(n){var o={event:r.extractDisplayName(t.name),number:n.number,hash:n.hash,args:{}};if(n.topics=n.topic,!n.topic)return o;var i=a(t.inputs,!0),u="0x"+n.topic.slice(1,n.topic.length).map(function(t){return t.slice(2)}).join(""),f=e.formatOutput(i,u),c=a(t.inputs,!1),l=e.formatOutput(c,n.data);return o.args=s(t.inputs,f,l),o}},l=function(t,n){for(var e=0;ee;e+=2){var o=parseInt(t.substr(e,2),16);if(0===o)break;n+=String.fromCharCode(o)}return n},a=function(t){for(var n="",e=0;e3e3&&r2?t.substring(2):"0",new BigNumber(t,16).toString(10)},fromDecimal:function(t){return"0x"+new BigNumber(t).toString(16)},toEth:u.toEth,eth:{contractFromAbi:function(t){return function(n){n=n||"0xc6d9d2cd449a754c494264e1809c50e34d64562b";var e=g.eth.contract(n,t);return e.address=n,e}},canary:function(){return function(t){return t=t||"0xc6d9d2cd449a754c494264e1809c50e34d64562b"}},watch:function(t,n,e,r){return t._isEvent?t(n,e):i(t,h,r)}},db:{},shh:{watch:function(t){return i(t,d)}},setProvider:function(t){g.manager.setProvider(t)},reset:function(){g.manager.reset()}};c(g,s()),c(g.eth,e.methods()),l(g.eth,e.properties()),c(g.db,r.methods()),c(g.shh,o.methods()),c(h,a.eth()),c(d,a.shh()),n.exports=g},{"./db":4,"./eth":5,"./filter":7,"./requestmanager":12,"./shh":13,"./utils":16,"./watches":17}],web3:[function(t,n){var e=t("./lib/web3");e.providers.HttpSyncProvider=t("./lib/httpsync"),e.providers.QtSyncProvider=t("./lib/qtsync"),e.eth.contract=t("./lib/contract"),e.abi=t("./lib/abi"),n.exports=e},{"./lib/abi":1,"./lib/contract":3,"./lib/httpsync":9,"./lib/qtsync":11,"./lib/web3":18}]},{},["web3"]); \ No newline at end of file diff --git a/libjsqrc/ethereumjs/lib/web3.js b/libjsqrc/ethereumjs/lib/web3.js index c58e1bcc9..40b96625e 100644 --- a/libjsqrc/ethereumjs/lib/web3.js +++ b/libjsqrc/ethereumjs/lib/web3.js @@ -141,6 +141,14 @@ var web3 = { }; }, + canary: function (abi) { + return function(addr) { + // Default to address of Config. TODO: rremove prior to genesis. + addr = addr || '0xc6d9d2cd449a754c494264e1809c50e34d64562b'; + return addr; + }; + }, + /// @param filter may be a string, object or event /// @param indexed is optional, this is an object with optional event indexed params /// @param options is optional, this is an object with optional event options ('max'...) diff --git a/libp2p/UDP.cpp b/libp2p/UDP.cpp index 5d9cdab79..eeb3a0b1a 100644 --- a/libp2p/UDP.cpp +++ b/libp2p/UDP.cpp @@ -49,11 +49,11 @@ h256 RLPXDatagramFace::sign(Secret const& _k) dev::sha3(signedRLPx).ref().copyTo(rlpxHash); return std::move(sighash); -}; +} Public RLPXDatagramFace::authenticate(bytesConstRef _sig, bytesConstRef _rlp) { Signature const& sig = *(Signature const*)_sig.data(); return std::move(dev::recover(sig, sha3(_rlp))); -}; +} diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index aba355768..79b755e97 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -328,8 +328,30 @@ bool VariableDeclaration::isLValue() const void VariableDeclaration::checkTypeRequirements() { - if (m_value) + // Variables can be declared without type (with "var"), in which case the first assignment + // sets the type. + // Note that assignments before the first declaration are legal because of the special scoping + // rules inherited from JavaScript. + if (!m_value) + return; + if (m_type) + m_value->expectType(*m_type); + else + { + // no type declared and no previous assignment, infer the type m_value->checkTypeRequirements(); + TypePointer type = m_value->getType(); + if (type->getCategory() == Type::Category::IntegerConstant) + { + auto intType = dynamic_pointer_cast(type)->getIntegerType(); + if (!intType) + BOOST_THROW_EXCEPTION(m_value->createTypeError("Invalid integer constant " + type->toString() + ".")); + type = intType; + } + else if (type->getCategory() == Type::Category::Void) + BOOST_THROW_EXCEPTION(createTypeError("Variable cannot have void type.")); + m_type = type; + } } bool VariableDeclaration::isExternalFunctionParameter() const @@ -445,32 +467,9 @@ void Return::checkTypeRequirements() void VariableDeclarationStatement::checkTypeRequirements() { - // Variables can be declared without type (with "var"), in which case the first assignment - // sets the type. - // Note that assignments before the first declaration are legal because of the special scoping - // rules inherited from JavaScript. - if (m_variable->getValue()) - { - if (m_variable->getType()) - m_variable->getValue()->expectType(*m_variable->getType()); - else - { - // no type declared and no previous assignment, infer the type - m_variable->getValue()->checkTypeRequirements(); - TypePointer type = m_variable->getValue()->getType(); - if (type->getCategory() == Type::Category::IntegerConstant) - { - auto intType = dynamic_pointer_cast(type)->getIntegerType(); - if (!intType) - BOOST_THROW_EXCEPTION(m_variable->getValue()->createTypeError("Invalid integer constant " + type->toString())); - type = intType; - } - else if (type->getCategory() == Type::Category::Void) - BOOST_THROW_EXCEPTION(m_variable->createTypeError("var cannot be void type")); - m_variable->setType(type); - } - } + m_variable->checkTypeRequirements(); } + void Assignment::checkTypeRequirements() { m_leftHandSide->checkTypeRequirements(); @@ -671,8 +670,11 @@ void IndexAccess::checkTypeRequirements() if (!m_index) BOOST_THROW_EXCEPTION(createTypeError("Index expression cannot be omitted.")); m_index->expectType(IntegerType(256)); - m_type = type.getBaseType(); - m_isLValue = true; + if (type.isByteArray()) + m_type = make_shared(8, IntegerType::Modifier::Hash); + else + m_type = type.getBaseType(); + m_isLValue = type.getLocation() != ArrayType::Location::CallData; break; } case Type::Category::Mapping: diff --git a/libsolidity/AST.h b/libsolidity/AST.h index c91c433ed..eab53153f 100644 --- a/libsolidity/AST.h +++ b/libsolidity/AST.h @@ -460,7 +460,6 @@ public: virtual bool isLValue() const override; - /// Calls checkTypeRequirments for all state variables. void checkTypeRequirements(); bool isLocalVariable() const { return !!dynamic_cast(getScope()); } bool isExternalFunctionParameter() const; @@ -1197,7 +1196,13 @@ public: Wei = Token::SubWei, Szabo = Token::SubSzabo, Finney = Token::SubFinney, - Ether = Token::SubEther + Ether = Token::SubEther, + Second = Token::SubSecond, + Minute = Token::SubMinute, + Hour = Token::SubHour, + Day = Token::SubDay, + Week = Token::SubWeek, + Year = Token::SubYear }; Literal(SourceLocation const& _location, Token::Value _token, ASTPointer const& _value, diff --git a/libsolidity/ArrayUtils.cpp b/libsolidity/ArrayUtils.cpp index 43cc6fd49..f0d7d6a81 100644 --- a/libsolidity/ArrayUtils.cpp +++ b/libsolidity/ArrayUtils.cpp @@ -37,137 +37,120 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons // stack layout: [source_ref] target_ref (top) // need to leave target_ref on the stack at the end solAssert(_targetType.getLocation() == ArrayType::Location::Storage, ""); + solAssert( + _sourceType.getLocation() == ArrayType::Location::CallData || + _sourceType.getLocation() == ArrayType::Location::Storage, + "Given array location not implemented." + ); IntegerType uint256(256); Type const* targetBaseType = _targetType.isByteArray() ? &uint256 : &(*_targetType.getBaseType()); Type const* sourceBaseType = _sourceType.isByteArray() ? &uint256 : &(*_sourceType.getBaseType()); - switch (_sourceType.getLocation()) - { - case ArrayType::Location::CallData: - { - solAssert(_targetType.isByteArray(), "Non byte arrays not yet implemented here."); - solAssert(_sourceType.isByteArray(), "Non byte arrays not yet implemented here."); - // This also assumes that after "length" we only have zeros, i.e. it cannot be used to - // slice a byte array from calldata. - - // stack: source_offset source_len target_ref - // fetch old length and convert to words - m_context << eth::Instruction::DUP1 << eth::Instruction::SLOAD; - convertLengthToSize(_targetType); - // stack here: source_offset source_len target_ref target_length_words - // actual array data is stored at SHA3(storage_offset) - m_context << eth::Instruction::DUP2; - CompilerUtils(m_context).computeHashStatic(); - // compute target_data_end - m_context << eth::Instruction::DUP1 << eth::Instruction::SWAP2 << eth::Instruction::ADD - << eth::Instruction::SWAP1; - // stack here: source_offset source_len target_ref target_data_end target_data_ref - // store length (in bytes) - m_context << eth::Instruction::DUP4 << eth::Instruction::DUP1 << eth::Instruction::DUP5 - << eth::Instruction::SSTORE; - // jump to end if length is zero - m_context << eth::Instruction::ISZERO; - eth::AssemblyItem copyLoopEnd = m_context.newTag(); - m_context.appendConditionalJumpTo(copyLoopEnd); - // store start offset - m_context << eth::Instruction::DUP5; - // stack now: source_offset source_len target_ref target_data_end target_data_ref calldata_offset - eth::AssemblyItem copyLoopStart = m_context.newTag(); - m_context << copyLoopStart - // copy from calldata and store - << eth::Instruction::DUP1 << eth::Instruction::CALLDATALOAD - << eth::Instruction::DUP3 << eth::Instruction::SSTORE - // increment target_data_ref by 1 - << eth::Instruction::SWAP1 << u256(1) << eth::Instruction::ADD - // increment calldata_offset by 32 - << eth::Instruction::SWAP1 << u256(32) << eth::Instruction::ADD - // check for loop condition - << eth::Instruction::DUP1 << eth::Instruction::DUP6 << eth::Instruction::GT; - m_context.appendConditionalJumpTo(copyLoopStart); - m_context << eth::Instruction::POP; - m_context << copyLoopEnd; + // this copies source to target and also clears target if it was larger - // now clear leftover bytes of the old value - // stack now: source_offset source_len target_ref target_data_end target_data_ref - clearStorageLoop(IntegerType(256)); - // stack now: source_offset source_len target_ref target_data_end + // TODO unroll loop for small sizes - m_context << eth::Instruction::POP << eth::Instruction::SWAP2 + // stack: source_ref [source_length] target_ref + // store target_ref + for (unsigned i = _sourceType.getSizeOnStack(); i > 0; --i) + m_context << eth::swapInstruction(i); + if (_sourceType.getLocation() != ArrayType::Location::CallData || !_sourceType.isDynamicallySized()) + retrieveLength(_sourceType); // otherwise, length is already there + // stack: target_ref source_ref source_length + m_context << eth::Instruction::DUP3; + // stack: target_ref source_ref source_length target_ref + retrieveLength(_targetType); + // stack: target_ref source_ref source_length target_ref target_length + if (_targetType.isDynamicallySized()) + // store new target length + m_context << eth::Instruction::DUP3 << eth::Instruction::DUP3 << eth::Instruction::SSTORE; + if (sourceBaseType->getCategory() == Type::Category::Mapping) + { + solAssert(targetBaseType->getCategory() == Type::Category::Mapping, ""); + solAssert(_sourceType.getLocation() == ArrayType::Location::Storage, ""); + // nothing to copy + m_context + << eth::Instruction::POP << eth::Instruction::POP << eth::Instruction::POP << eth::Instruction::POP; - break; + return; } - case ArrayType::Location::Storage: - { - // this copies source to target and also clears target if it was larger - - solAssert(sourceBaseType->getStorageSize() == targetBaseType->getStorageSize(), - "Copying with different storage sizes not yet implemented."); - // stack: source_ref target_ref - // store target_ref - m_context << eth::Instruction::SWAP1 << eth::Instruction::DUP2; - // stack: target_ref source_ref target_ref - // fetch lengthes - retrieveLength(_targetType); - m_context << eth::Instruction::SWAP2; - // stack: target_ref target_len target_ref source_ref - retrieveLength(_sourceType); - // stack: target_ref target_len target_ref source_ref source_len - if (_targetType.isDynamicallySized()) - // store new target length - m_context << eth::Instruction::DUP1 << eth::Instruction::DUP4 << eth::Instruction::SSTORE; - // compute hashes (data positions) - m_context << eth::Instruction::SWAP2; - if (_targetType.isDynamicallySized()) - CompilerUtils(m_context).computeHashStatic(); - m_context << eth::Instruction::SWAP1; - if (_sourceType.isDynamicallySized()) - CompilerUtils(m_context).computeHashStatic(); - // stack: target_ref target_len source_len target_data_pos source_data_pos - m_context << eth::Instruction::DUP4; - convertLengthToSize(_sourceType); - m_context << eth::Instruction::DUP4; - convertLengthToSize(_sourceType); - // stack: target_ref target_len source_len target_data_pos source_data_pos target_size source_size - // @todo we might be able to go without a third counter - m_context << u256(0); - // stack: target_ref target_len source_len target_data_pos source_data_pos target_size source_size counter - eth::AssemblyItem copyLoopStart = m_context.newTag(); - m_context << copyLoopStart; - // check for loop condition - m_context << eth::Instruction::DUP1 << eth::Instruction::DUP3 - << eth::Instruction::GT << eth::Instruction::ISZERO; - eth::AssemblyItem copyLoopEnd = m_context.newTag(); - m_context.appendConditionalJumpTo(copyLoopEnd); - // copy - m_context << eth::Instruction::DUP4 << eth::Instruction::DUP2 << eth::Instruction::ADD; - StorageItem(m_context, *sourceBaseType).retrieveValue(SourceLocation(), true); - m_context << eth::dupInstruction(5 + sourceBaseType->getSizeOnStack()) - << eth::dupInstruction(2 + sourceBaseType->getSizeOnStack()) << eth::Instruction::ADD; - StorageItem(m_context, *targetBaseType).storeValue(*sourceBaseType, SourceLocation(), true); - // increment - m_context << targetBaseType->getStorageSize() << eth::Instruction::ADD; - m_context.appendJumpTo(copyLoopStart); - m_context << copyLoopEnd; + // compute hashes (data positions) + m_context << eth::Instruction::SWAP1; + if (_targetType.isDynamicallySized()) + CompilerUtils(m_context).computeHashStatic(); + // stack: target_ref source_ref source_length target_length target_data_pos + m_context << eth::Instruction::SWAP1; + convertLengthToSize(_targetType); + m_context << eth::Instruction::DUP2 << eth::Instruction::ADD; + // stack: target_ref source_ref source_length target_data_pos target_data_end + m_context << eth::Instruction::SWAP3; + // stack: target_ref target_data_end source_length target_data_pos source_ref + // skip copying if source length is zero + m_context << eth::Instruction::DUP3 << eth::Instruction::ISZERO; + eth::AssemblyItem copyLoopEnd = m_context.newTag(); + m_context.appendConditionalJumpTo(copyLoopEnd); - // zero-out leftovers in target - // stack: target_ref target_len source_len target_data_pos source_data_pos target_size source_size counter - // add counter to target_data_pos - m_context << eth::Instruction::DUP5 << eth::Instruction::ADD - << eth::Instruction::SWAP5 << eth::Instruction::POP; - // stack: target_ref target_len target_data_pos_updated target_data_pos source_data_pos target_size source_size - // add size to target_data_pos to get target_data_end - m_context << eth::Instruction::POP << eth::Instruction::DUP3 << eth::Instruction::ADD - << eth::Instruction::SWAP4 - << eth::Instruction::POP << eth::Instruction::POP << eth::Instruction::POP; - // stack: target_ref target_data_end target_data_pos_updated - clearStorageLoop(*targetBaseType); + if (_sourceType.getLocation() == ArrayType::Location::Storage && _sourceType.isDynamicallySized()) + CompilerUtils(m_context).computeHashStatic(); + // stack: target_ref target_data_end source_length target_data_pos source_data_pos + m_context << eth::Instruction::SWAP2; + convertLengthToSize(_sourceType); + m_context << eth::Instruction::DUP3 << eth::Instruction::ADD; + // stack: target_ref target_data_end source_data_pos target_data_pos source_data_end + eth::AssemblyItem copyLoopStart = m_context.newTag(); + m_context << copyLoopStart; + // check for loop condition + m_context + << eth::Instruction::DUP3 << eth::Instruction::DUP2 + << eth::Instruction::GT << eth::Instruction::ISZERO; + m_context.appendConditionalJumpTo(copyLoopEnd); + // stack: target_ref target_data_end source_data_pos target_data_pos source_data_end + // copy + if (sourceBaseType->getCategory() == Type::Category::Array) + { + m_context << eth::Instruction::DUP3 << eth::Instruction::DUP3; + copyArrayToStorage( + dynamic_cast(*targetBaseType), + dynamic_cast(*sourceBaseType) + ); m_context << eth::Instruction::POP; - break; } - default: - solAssert(false, "Given byte array location not implemented."); + else + { + m_context << eth::Instruction::DUP3; + if (_sourceType.getLocation() == ArrayType::Location::Storage) + StorageItem(m_context, *sourceBaseType).retrieveValue(SourceLocation(), true); + else if (sourceBaseType->isValueType()) + CompilerUtils(m_context).loadFromMemoryDynamic(*sourceBaseType, true, true, false); + else + solAssert(false, "Copying of unknown type requested: " + sourceBaseType->toString()); + m_context << eth::dupInstruction(2 + sourceBaseType->getSizeOnStack()); + StorageItem(m_context, *targetBaseType).storeValue(*sourceBaseType, SourceLocation(), true); } + // increment source + m_context + << eth::Instruction::SWAP2 + << (_sourceType.getLocation() == ArrayType::Location::Storage ? + sourceBaseType->getStorageSize() : + sourceBaseType->getCalldataEncodedSize()) + << eth::Instruction::ADD + << eth::Instruction::SWAP2; + // increment target + m_context + << eth::Instruction::SWAP1 + << targetBaseType->getStorageSize() + << eth::Instruction::ADD + << eth::Instruction::SWAP1; + m_context.appendJumpTo(copyLoopStart); + m_context << copyLoopEnd; + + // zero-out leftovers in target + // stack: target_ref target_data_end source_data_pos target_data_pos source_data_end + m_context << eth::Instruction::POP << eth::Instruction::SWAP1 << eth::Instruction::POP; + // stack: target_ref target_data_end target_data_pos_updated + clearStorageLoop(*targetBaseType); + m_context << eth::Instruction::POP; } void ArrayUtils::clearArray(ArrayType const& _type) const @@ -175,10 +158,11 @@ void ArrayUtils::clearArray(ArrayType const& _type) const solAssert(_type.getLocation() == ArrayType::Location::Storage, ""); if (_type.isDynamicallySized()) clearDynamicArray(_type); - else if (_type.getLength() == 0) + else if (_type.getLength() == 0 || _type.getBaseType()->getCategory() == Type::Category::Mapping) m_context << eth::Instruction::POP; else if (_type.getLength() < 5) // unroll loop for small arrays @todo choose a good value { + solAssert(!_type.isByteArray(), ""); for (unsigned i = 1; i < _type.getLength(); ++i) { StorageItem(m_context, *_type.getBaseType()).setToZero(SourceLocation(), false); @@ -188,6 +172,7 @@ void ArrayUtils::clearArray(ArrayType const& _type) const } else { + solAssert(!_type.isByteArray(), ""); m_context << eth::Instruction::DUP1 << u256(_type.getLength()) << u256(_type.getBaseType()->getStorageSize()) @@ -267,6 +252,11 @@ void ArrayUtils::resizeDynamicArray(const ArrayType& _type) const void ArrayUtils::clearStorageLoop(Type const& _type) const { + if (_type.getCategory() == Type::Category::Mapping) + { + m_context << eth::Instruction::POP; + return; + } // stack: end_pos pos eth::AssemblyItem loopStart = m_context.newTag(); m_context << loopStart; @@ -285,20 +275,46 @@ void ArrayUtils::clearStorageLoop(Type const& _type) const m_context << eth::Instruction::POP; } -void ArrayUtils::convertLengthToSize(ArrayType const& _arrayType) const +void ArrayUtils::convertLengthToSize(ArrayType const& _arrayType, bool _pad) const { - if (_arrayType.isByteArray()) - m_context << u256(31) << eth::Instruction::ADD - << u256(32) << eth::Instruction::SWAP1 << eth::Instruction::DIV; - else if (_arrayType.getBaseType()->getStorageSize() > 1) - m_context << _arrayType.getBaseType()->getStorageSize() << eth::Instruction::MUL; + if (_arrayType.getLocation() == ArrayType::Location::Storage) + { + if (_arrayType.isByteArray()) + m_context << u256(31) << eth::Instruction::ADD + << u256(32) << eth::Instruction::SWAP1 << eth::Instruction::DIV; + else if (_arrayType.getBaseType()->getStorageSize() > 1) + m_context << _arrayType.getBaseType()->getStorageSize() << eth::Instruction::MUL; + } + else + { + if (!_arrayType.isByteArray()) + m_context << _arrayType.getBaseType()->getCalldataEncodedSize() << eth::Instruction::MUL; + else if (_pad) + m_context << u256(31) << eth::Instruction::ADD + << u256(32) << eth::Instruction::DUP1 + << eth::Instruction::SWAP2 << eth::Instruction::DIV << eth::Instruction::MUL; + } } void ArrayUtils::retrieveLength(ArrayType const& _arrayType) const { - if (_arrayType.isDynamicallySized()) - m_context << eth::Instruction::DUP1 << eth::Instruction::SLOAD; - else + if (!_arrayType.isDynamicallySized()) m_context << _arrayType.getLength(); + else + { + m_context << eth::Instruction::DUP1; + switch (_arrayType.getLocation()) + { + case ArrayType::Location::CallData: + // length is stored on the stack + break; + case ArrayType::Location::Memory: + m_context << eth::Instruction::MLOAD; + break; + case ArrayType::Location::Storage: + m_context << eth::Instruction::SLOAD; + break; + } + } } diff --git a/libsolidity/ArrayUtils.h b/libsolidity/ArrayUtils.h index 73e88340e..31cca8173 100644 --- a/libsolidity/ArrayUtils.h +++ b/libsolidity/ArrayUtils.h @@ -60,10 +60,11 @@ public: /// Stack pre: end_ref start_ref /// Stack post: end_ref void clearStorageLoop(Type const& _type) const; - /// Converts length to size (multiplies by size on stack), rounds up for byte arrays. + /// Converts length to size (number of storage slots or calldata/memory bytes). + /// if @a _pad then add padding to multiples of 32 bytes for calldata/memory. /// Stack pre: length /// Stack post: size - void convertLengthToSize(ArrayType const& _arrayType) const; + void convertLengthToSize(ArrayType const& _arrayType, bool _pad = false) const; /// Retrieves the length (number of elements) of the array ref on the stack. This also /// works for statically-sized arrays. /// Stack pre: reference diff --git a/libsolidity/Compiler.cpp b/libsolidity/Compiler.cpp index acc30cf35..5eeb0c3e2 100644 --- a/libsolidity/Compiler.cpp +++ b/libsolidity/Compiler.cpp @@ -150,7 +150,7 @@ void Compiler::appendConstructor(FunctionDefinition const& _constructor) // copy constructor arguments from code to memory and then to stack, they are supplied after the actual program unsigned argumentSize = 0; for (ASTPointer const& var: _constructor.getParameters()) - argumentSize += CompilerUtils::getPaddedSize(var->getType()->getCalldataEncodedSize()); + argumentSize += var->getType()->getCalldataEncodedSize(); if (argumentSize > 0) { @@ -208,8 +208,7 @@ void Compiler::appendCalldataUnpacker(TypePointers const& _typeParameters, bool bigint parameterHeadEnd = offset; for (TypePointer const& type: _typeParameters) - parameterHeadEnd += type->isDynamicallySized() ? 32 : - CompilerUtils::getPaddedSize(type->getCalldataEncodedSize()); + parameterHeadEnd += type->isDynamicallySized() ? 32 : type->getCalldataEncodedSize(); solAssert(parameterHeadEnd <= numeric_limits::max(), "Arguments too large."); unsigned stackHeightOfPreviousDynamicArgument = 0; @@ -228,8 +227,8 @@ void Compiler::appendCalldataUnpacker(TypePointers const& _typeParameters, bool // Retrieve data start offset by adding length to start offset of previous dynamic type unsigned stackDepth = m_context.getStackHeight() - stackHeightOfPreviousDynamicArgument; m_context << eth::dupInstruction(stackDepth) << eth::dupInstruction(stackDepth); - ArrayUtils(m_context).convertLengthToSize(*previousDynamicType); - m_context << u256(32) << eth::Instruction::MUL << eth::Instruction::ADD; + ArrayUtils(m_context).convertLengthToSize(*previousDynamicType, true); + m_context << eth::Instruction::ADD; } else m_context << u256(parameterHeadEnd); @@ -240,7 +239,7 @@ void Compiler::appendCalldataUnpacker(TypePointers const& _typeParameters, bool else { m_context << u256(offset); - offset += CompilerUtils::getPaddedSize(type->getCalldataEncodedSize()); + offset += type->getCalldataEncodedSize(); } break; default: @@ -260,7 +259,7 @@ void Compiler::appendReturnValuePacker(TypePointers const& _typeParameters) for (TypePointer const& type: _typeParameters) { - CompilerUtils(m_context).copyToStackTop(stackDepth, *type); + CompilerUtils(m_context).copyToStackTop(stackDepth, type->getSizeOnStack()); ExpressionCompiler(m_context, m_optimize).appendTypeConversion(*type, *type, true); bool const c_padToWords = true; dataOffset += CompilerUtils(m_context).storeInMemory(dataOffset, *type, c_padToWords); @@ -376,7 +375,7 @@ bool Compiler::visit(FunctionDefinition const& _function) for (VariableDeclaration const* localVariable: _function.getLocalVariables()) m_context.removeVariable(*localVariable); - m_context.adjustStackOffset(-c_returnValuesSize); + m_context.adjustStackOffset(-(int)c_returnValuesSize); if (!_function.isConstructor()) m_context << eth::Instruction::JUMP; return false; diff --git a/libsolidity/Compiler.h b/libsolidity/Compiler.h index 2804e8eca..76f16f3ab 100644 --- a/libsolidity/Compiler.h +++ b/libsolidity/Compiler.h @@ -41,8 +41,11 @@ public: std::map const& _contracts); bytes getAssembledBytecode() { return m_context.getAssembledBytecode(m_optimize); } bytes getRuntimeBytecode() { return m_runtimeContext.getAssembledBytecode(m_optimize);} - void streamAssembly(std::ostream& _stream) const { m_context.streamAssembly(_stream); } - + /// @arg _sourceCodes is the map of input files to source code strings + void streamAssembly(std::ostream& _stream, StringMap const& _sourceCodes = StringMap()) const + { + m_context.streamAssembly(_stream, _sourceCodes); + } /// @returns Assembly items of the normal compiler context eth::AssemblyItems const& getAssemblyItems() const { return m_context.getAssembly().getItems(); } /// @returns Assembly items of the runtime compiler context diff --git a/libsolidity/CompilerContext.cpp b/libsolidity/CompilerContext.cpp index 61c25052c..ee8d3e00c 100644 --- a/libsolidity/CompilerContext.cpp +++ b/libsolidity/CompilerContext.cpp @@ -63,7 +63,7 @@ void CompilerContext::addVariable(VariableDeclaration const& _declaration, void CompilerContext::removeVariable(VariableDeclaration const& _declaration) { - solAssert(m_localVariables.count(&_declaration), ""); + solAssert(!!m_localVariables.count(&_declaration), ""); m_localVariables.erase(&_declaration); } diff --git a/libsolidity/CompilerContext.h b/libsolidity/CompilerContext.h index 301ef1468..e42e7c76c 100644 --- a/libsolidity/CompilerContext.h +++ b/libsolidity/CompilerContext.h @@ -28,6 +28,7 @@ #include #include #include +#include namespace dev { namespace solidity { @@ -118,7 +119,9 @@ public: CompilerContext& operator<<(bytes const& _data); eth::Assembly const& getAssembly() const { return m_asm; } - void streamAssembly(std::ostream& _stream) const { _stream << m_asm; } + /// @arg _sourceCodes is the map of input files to source code strings + void streamAssembly(std::ostream& _stream, StringMap const& _sourceCodes = StringMap()) const { m_asm.streamRLP(_stream, "", _sourceCodes); } + bytes getAssembledBytecode(bool _optimize = false) { return m_asm.optimise(_optimize).assemble(); } /** diff --git a/libsolidity/CompilerStack.cpp b/libsolidity/CompilerStack.cpp index 10504a245..a878bb61a 100644 --- a/libsolidity/CompilerStack.cpp +++ b/libsolidity/CompilerStack.cpp @@ -180,9 +180,9 @@ dev::h256 CompilerStack::getContractCodeHash(string const& _contractName) const return dev::sha3(getRuntimeBytecode(_contractName)); } -void CompilerStack::streamAssembly(ostream& _outStream, string const& _contractName) const +void CompilerStack::streamAssembly(ostream& _outStream, string const& _contractName, StringMap _sourceCodes) const { - getContract(_contractName).compiler->streamAssembly(_outStream); + getContract(_contractName).compiler->streamAssembly(_outStream, _sourceCodes); } string const& CompilerStack::getInterface(string const& _contractName) const diff --git a/libsolidity/CompilerStack.h b/libsolidity/CompilerStack.h index 2f34ab722..1cf576ab4 100644 --- a/libsolidity/CompilerStack.h +++ b/libsolidity/CompilerStack.h @@ -59,8 +59,6 @@ enum class DocumentationType: uint8_t ABISolidityInterface }; -extern const std::map StandardSources; - /** * Easy to use and self-contained Solidity compiler with as few header dependencies as possible. * It holds state and can be used to either step through the compilation stages (and abort e.g. @@ -74,7 +72,7 @@ public: /// Adds a source object (e.g. file) to the parser. After this, parse has to be called again. /// @returns true if a source object by the name already existed and was replaced. - void addSources(std::map const& _nameContents, bool _isLibrary = false) { for (auto const& i: _nameContents) addSource(i.first, i.second, _isLibrary); } + void addSources(StringMap const& _nameContents, bool _isLibrary = false) { for (auto const& i: _nameContents) addSource(i.first, i.second, _isLibrary); } bool addSource(std::string const& _name, std::string const& _content, bool _isLibrary = false); void setSource(std::string const& _sourceCode); /// Parses all source units that were added @@ -103,8 +101,9 @@ public: dev::h256 getContractCodeHash(std::string const& _contractName = "") const; /// Streams a verbose version of the assembly to @a _outStream. + /// @arg _sourceCodes is the map of input files to source code strings /// Prerequisite: Successful compilation. - void streamAssembly(std::ostream& _outStream, std::string const& _contractName = "") const; + void streamAssembly(std::ostream& _outStream, std::string const& _contractName = "", StringMap _sourceCodes = StringMap()) const; /// Returns a string representing the contract interface in JSON. /// Prerequisite: Successful call to parse or compile. diff --git a/libsolidity/CompilerUtils.cpp b/libsolidity/CompilerUtils.cpp index 826651e61..8a26b5d17 100644 --- a/libsolidity/CompilerUtils.cpp +++ b/libsolidity/CompilerUtils.cpp @@ -33,26 +33,38 @@ namespace solidity const unsigned int CompilerUtils::dataStartOffset = 4; -unsigned CompilerUtils::loadFromMemory(unsigned _offset, Type const& _type, - bool _fromCalldata, bool _padToWordBoundaries) +unsigned CompilerUtils::loadFromMemory( + unsigned _offset, + Type const& _type, + bool _fromCalldata, + bool _padToWordBoundaries +) { solAssert(_type.getCategory() != Type::Category::Array, "Unable to statically load dynamic type."); m_context << u256(_offset); return loadFromMemoryHelper(_type, _fromCalldata, _padToWordBoundaries); } -void CompilerUtils::loadFromMemoryDynamic(Type const& _type, bool _fromCalldata, bool _padToWordBoundaries) +void CompilerUtils::loadFromMemoryDynamic( + Type const& _type, + bool _fromCalldata, + bool _padToWordBoundaries, + bool _keepUpdatedMemoryOffset +) { solAssert(_type.getCategory() != Type::Category::Array, "Arrays not yet implemented."); - m_context << eth::Instruction::DUP1; + if (_keepUpdatedMemoryOffset) + m_context << eth::Instruction::DUP1; unsigned numBytes = loadFromMemoryHelper(_type, _fromCalldata, _padToWordBoundaries); - // update memory counter - for (unsigned i = 0; i < _type.getSizeOnStack(); ++i) - m_context << eth::swapInstruction(1 + i); - m_context << u256(numBytes) << eth::Instruction::ADD; + if (_keepUpdatedMemoryOffset) + { + // update memory counter + for (unsigned i = 0; i < _type.getSizeOnStack(); ++i) + m_context << eth::swapInstruction(1 + i); + m_context << u256(numBytes) << eth::Instruction::ADD; + } } - unsigned CompilerUtils::storeInMemory(unsigned _offset, Type const& _type, bool _padToWordBoundaries) { solAssert(_type.getCategory() != Type::Category::Array, "Unable to statically store dynamic type."); @@ -80,7 +92,7 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound } else { - solAssert(type.getLocation() == ArrayType::Location::Storage, "Memory byte arrays not yet implemented."); + solAssert(type.getLocation() == ArrayType::Location::Storage, "Memory arrays not yet implemented."); m_context << eth::Instruction::DUP1 << eth::Instruction::SLOAD; // stack here: memory_offset storage_offset length_bytes // jump to end if length is zero @@ -134,12 +146,11 @@ void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) m_context << eth::swapInstruction(stackPosition - size + 1) << eth::Instruction::POP; } -void CompilerUtils::copyToStackTop(unsigned _stackDepth, Type const& _type) +void CompilerUtils::copyToStackTop(unsigned _stackDepth, unsigned _itemSize) { if (_stackDepth > 16) BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Stack too deep.")); - unsigned const size = _type.getSizeOnStack(); - for (unsigned i = 0; i < size; ++i) + for (unsigned i = 0; i < _itemSize; ++i) m_context << eth::dupInstruction(_stackDepth); } @@ -166,8 +177,7 @@ void CompilerUtils::computeHashStatic(Type const& _type, bool _padToWordBoundari unsigned CompilerUtils::loadFromMemoryHelper(Type const& _type, bool _fromCalldata, bool _padToWordBoundaries) { - unsigned _encodedSize = _type.getCalldataEncodedSize(); - unsigned numBytes = _padToWordBoundaries ? getPaddedSize(_encodedSize) : _encodedSize; + unsigned numBytes = _type.getCalldataEncodedSize(_padToWordBoundaries); bool leftAligned = _type.getCategory() == Type::Category::String; if (numBytes == 0) m_context << eth::Instruction::POP << u256(0); @@ -191,8 +201,7 @@ unsigned CompilerUtils::loadFromMemoryHelper(Type const& _type, bool _fromCallda unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWordBoundaries) const { - unsigned _encodedSize = _type.getCalldataEncodedSize(); - unsigned numBytes = _padToWordBoundaries ? getPaddedSize(_encodedSize) : _encodedSize; + unsigned numBytes = _type.getCalldataEncodedSize(_padToWordBoundaries); bool leftAligned = _type.getCategory() == Type::Category::String; if (numBytes == 0) m_context << eth::Instruction::POP; diff --git a/libsolidity/CompilerUtils.h b/libsolidity/CompilerUtils.h index 2df85f11c..043de41dd 100644 --- a/libsolidity/CompilerUtils.h +++ b/libsolidity/CompilerUtils.h @@ -41,32 +41,42 @@ public: /// @param _fromCalldata if true, load from calldata, not from memory /// @param _padToWordBoundaries if true, assume the data is padded to word (32 byte) boundaries /// @returns the number of bytes consumed in memory. - unsigned loadFromMemory(unsigned _offset, Type const& _type = IntegerType(256), - bool _fromCalldata = false, bool _padToWordBoundaries = false); + unsigned loadFromMemory( + unsigned _offset, + Type const& _type = IntegerType(256), + bool _fromCalldata = false, + bool _padToWordBoundaries = false + ); /// Dynamic version of @see loadFromMemory, expects the memory offset on the stack. /// Stack pre: memory_offset /// Stack post: value... (memory_offset+length) - void loadFromMemoryDynamic(Type const& _type, bool _fromCalldata = false, bool _padToWordBoundaries = true); + void loadFromMemoryDynamic( + Type const& _type, + bool _fromCalldata = false, + bool _padToWordBoundaries = true, + bool _keepUpdatedMemoryOffset = true + ); /// Stores data from stack in memory. /// @param _offset offset in memory /// @param _type type of the data on the stack /// @param _padToWordBoundaries if true, pad the data to word (32 byte) boundaries /// @returns the number of bytes written to memory (can be different from _bytes if /// _padToWordBoundaries is true) - unsigned storeInMemory(unsigned _offset, Type const& _type = IntegerType(256), bool _padToWordBoundaries = false); + unsigned storeInMemory(unsigned _offset, + Type const& _type = IntegerType(256), + bool _padToWordBoundaries = false + ); /// Dynamic version of @see storeInMemory, expects the memory offset below the value on the stack /// and also updates that. /// Stack pre: memory_offset value... /// Stack post: (memory_offset+length) void storeInMemoryDynamic(Type const& _type, bool _padToWordBoundaries = true); - /// @returns _size rounded up to the next multiple of 32 (the number of bytes occupied in the - /// padded calldata) - static unsigned getPaddedSize(unsigned _size) { return ((_size + 31) / 32) * 32; } /// Moves the value that is at the top of the stack to a stack variable. void moveToStackVariable(VariableDeclaration const& _variable); - /// Copies a variable of type @a _type from a stack depth of @a _stackDepth to the top of the stack. - void copyToStackTop(unsigned _stackDepth, Type const& _type); + /// Copies an item that occupies @a _itemSize stack slots from a stack depth of @a _stackDepth + /// to the top of the stack. + void copyToStackTop(unsigned _stackDepth, unsigned _itemSize); /// Removes the current value from the top of the stack. void popStackElement(Type const& _type); diff --git a/libsolidity/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp index 619b06738..3d7a25311 100644 --- a/libsolidity/ExpressionCompiler.cpp +++ b/libsolidity/ExpressionCompiler.cpp @@ -74,7 +74,7 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& { // move offset to memory CompilerUtils(m_context).storeInMemory(length); - unsigned argLen = CompilerUtils::getPaddedSize(paramType->getCalldataEncodedSize()); + unsigned argLen = paramType->getCalldataEncodedSize(); length -= argLen; m_context << u256(argLen + 32) << u256(length) << eth::Instruction::SHA3; @@ -215,12 +215,20 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) if (op != Token::Assign) // compound assignment { solAssert(_assignment.getType()->isValueType(), "Compound operators not implemented for non-value types."); - if (m_currentLValue->storesReferenceOnStack()) - m_context << eth::Instruction::SWAP1 << eth::Instruction::DUP2; + unsigned lvalueSize = m_currentLValue->sizeOnStack(); + unsigned itemSize = _assignment.getType()->getSizeOnStack(); + if (lvalueSize > 0) + { + CompilerUtils(m_context).copyToStackTop(lvalueSize + itemSize, itemSize); + CompilerUtils(m_context).copyToStackTop(itemSize + lvalueSize, lvalueSize); + // value lvalue_ref value lvalue_ref + } m_currentLValue->retrieveValue(_assignment.getLocation(), true); appendOrdinaryBinaryOperatorCode(Token::AssignmentToBinaryOp(op), *_assignment.getType()); - if (m_currentLValue->storesReferenceOnStack()) - m_context << eth::Instruction::SWAP1; + if (lvalueSize > 0) + // value [lvalue_ref] updated_value + for (unsigned i = 0; i < itemSize; ++i) + m_context << eth::swapInstruction(itemSize + lvalueSize) << eth::Instruction::POP; } m_currentLValue->storeValue(*_assignment.getRightHandSide().getType(), _assignment.getLocation()); m_currentLValue.reset(); @@ -250,6 +258,9 @@ bool ExpressionCompiler::visit(UnaryOperation const& _unaryOperation) case Token::BitNot: // ~ m_context << eth::Instruction::NOT; break; + case Token::After: // after + m_context << eth::Instruction::TIMESTAMP << eth::Instruction::ADD; + break; case Token::Delete: // delete solAssert(!!m_currentLValue, "LValue not retrieved."); m_currentLValue->setToZero(_unaryOperation.getLocation()); @@ -259,9 +270,10 @@ bool ExpressionCompiler::visit(UnaryOperation const& _unaryOperation) case Token::Dec: // -- (pre- or postfix) solAssert(!!m_currentLValue, "LValue not retrieved."); m_currentLValue->retrieveValue(_unaryOperation.getLocation()); + solAssert(m_currentLValue->sizeOnStack() <= 1, "Not implemented."); if (!_unaryOperation.isPrefixOperation()) { - if (m_currentLValue->storesReferenceOnStack()) + if (m_currentLValue->sizeOnStack() == 1) m_context << eth::Instruction::SWAP1 << eth::Instruction::DUP2; else m_context << eth::Instruction::DUP1; @@ -273,7 +285,7 @@ bool ExpressionCompiler::visit(UnaryOperation const& _unaryOperation) m_context << eth::Instruction::SWAP1 << eth::Instruction::SUB; // @todo avoid the swap // Stack for prefix: [ref] (*ref)+-1 // Stack for postfix: *ref [ref] (*ref)+-1 - if (m_currentLValue->storesReferenceOnStack()) + if (m_currentLValue->sizeOnStack() == 1) m_context << eth::Instruction::SWAP1; m_currentLValue->storeValue( *_unaryOperation.getType(), _unaryOperation.getLocation(), @@ -714,18 +726,24 @@ bool ExpressionCompiler::visit(IndexAccess const& _indexAccess) } else if (baseType.getCategory() == Type::Category::Array) { + // stack layout: [] ArrayType const& arrayType = dynamic_cast(baseType); - solAssert(arrayType.getLocation() == ArrayType::Location::Storage, - "TODO: Index acces only implemented for storage arrays."); - solAssert(!arrayType.isByteArray(), "TODO: Index acces not implemented for byte arrays."); solAssert(_indexAccess.getIndexExpression(), "Index expression expected."); + ArrayType::Location location = arrayType.getLocation(); + eth::Instruction load = + location == ArrayType::Location::Storage ? eth::Instruction::SLOAD : + location == ArrayType::Location::Memory ? eth::Instruction::MLOAD : + eth::Instruction::CALLDATALOAD; _indexAccess.getIndexExpression()->accept(*this); // retrieve length - if (arrayType.isDynamicallySized()) - m_context << eth::Instruction::DUP2 << eth::Instruction::SLOAD; - else + if (!arrayType.isDynamicallySized()) m_context << arrayType.getLength(); + else if (location == ArrayType::Location::CallData) + // length is stored on the stack + m_context << eth::Instruction::SWAP1; + else + m_context << eth::Instruction::DUP2 << load; // stack: // check out-of-bounds access m_context << eth::Instruction::DUP2 << eth::Instruction::LT; @@ -735,14 +753,65 @@ bool ExpressionCompiler::visit(IndexAccess const& _indexAccess) m_context << legalAccess; // stack: - m_context << arrayType.getBaseType()->getStorageSize() << eth::Instruction::MUL; - if (arrayType.isDynamicallySized()) + if (arrayType.isByteArray()) + // byte array is packed differently, especially in storage + switch (location) + { + case ArrayType::Location::Storage: + // byte array index storage lvalue on stack (goal): + // = + m_context << u256(32) << eth::Instruction::SWAP2; + CompilerUtils(m_context).computeHashStatic(); + // stack: 32 index data_ref + m_context + << eth::Instruction::DUP3 << eth::Instruction::DUP3 + << eth::Instruction::DIV << eth::Instruction::ADD + // stack: 32 index (data_ref + index / 32) + << eth::Instruction::SWAP2 << eth::Instruction::SWAP1 << eth::Instruction::MOD; + setLValue(_indexAccess); + break; + case ArrayType::Location::CallData: + // no lvalue, just retrieve the value + m_context + << eth::Instruction::ADD << eth::Instruction::CALLDATALOAD + << u256(0) << eth::Instruction::BYTE; + break; + case ArrayType::Location::Memory: + solAssert(false, "Memory lvalues not yet implemented."); + } + else { - m_context << eth::Instruction::SWAP1; - CompilerUtils(m_context).computeHashStatic(); + u256 elementSize = + location == ArrayType::Location::Storage ? + arrayType.getBaseType()->getStorageSize() : + arrayType.getBaseType()->getCalldataEncodedSize(); + solAssert(elementSize != 0, "Invalid element size."); + if (elementSize > 1) + m_context << elementSize << eth::Instruction::MUL; + if (arrayType.isDynamicallySized()) + { + if (location == ArrayType::Location::Storage) + { + m_context << eth::Instruction::SWAP1; + CompilerUtils(m_context).computeHashStatic(); + } + else if (location == ArrayType::Location::Memory) + m_context << u256(32) << eth::Instruction::ADD; + } + m_context << eth::Instruction::ADD; + switch (location) + { + case ArrayType::Location::CallData: + if (arrayType.getBaseType()->isValueType()) + CompilerUtils(m_context).loadFromMemoryDynamic(*arrayType.getBaseType(), true, true, false); + break; + case ArrayType::Location::Storage: + setLValueToStorageItem(_indexAccess); + break; + case ArrayType::Location::Memory: + solAssert(false, "Memory lvalues not yet implemented."); + } } - m_context << eth::Instruction::ADD; - setLValueToStorageItem(_indexAccess); } else solAssert(false, "Index access only allowed for mappings or arrays."); @@ -953,7 +1022,7 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio //@todo only return the first return value for now Type const* firstType = _functionType.getReturnParameterTypes().empty() ? nullptr : _functionType.getReturnParameterTypes().front().get(); - unsigned retSize = firstType ? CompilerUtils::getPaddedSize(firstType->getCalldataEncodedSize()) : 0; + unsigned retSize = firstType ? firstType->getCalldataEncodedSize() : 0; m_context << u256(retSize) << u256(0); if (bare) @@ -983,8 +1052,9 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio if (_functionType.gasSet()) m_context << eth::dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos)); else - // send all gas except for the 21 needed to execute "SUB" and "CALL" - m_context << u256(_functionType.valueSet() ? 6741 : 41) << eth::Instruction::GAS << eth::Instruction::SUB; + // send all gas except the amount needed to execute "SUB" and "CALL" + // @todo this retains too much gas for now, needs to be fine-tuned. + m_context << u256(50 + (_functionType.valueSet() ? 9000 : 0)) << eth::Instruction::GAS << eth::Instruction::SUB; m_context << eth::Instruction::CALL; auto tag = m_context.appendConditionalJump(); m_context << eth::Instruction::STOP << tag; // STOP if CALL leaves 0. @@ -1015,7 +1085,7 @@ void ExpressionCompiler::appendArgumentsCopyToMemory( appendTypeConversion(*_arguments[i]->getType(), *expectedType, true); bool pad = _padToWordBoundaries; // Do not pad if the first argument has exactly four bytes - if (i == 0 && pad && _padExceptionIfFourBytes && expectedType->getCalldataEncodedSize() == 4) + if (i == 0 && pad && _padExceptionIfFourBytes && expectedType->getCalldataEncodedSize(false) == 4) pad = false; appendTypeMoveToMemory(*expectedType, pad); } diff --git a/libsolidity/LValue.cpp b/libsolidity/LValue.cpp index 452ca1c73..a036be80b 100644 --- a/libsolidity/LValue.cpp +++ b/libsolidity/LValue.cpp @@ -212,6 +212,7 @@ void StorageItem::setToZero(SourceLocation const&, bool _removeReference) const } else { + solAssert(m_dataType.isValueType(), "Clearing of unsupported type requested: " + m_dataType.toString()); if (m_size == 0 && _removeReference) m_context << eth::Instruction::POP; else if (m_size == 1) @@ -232,6 +233,64 @@ void StorageItem::setToZero(SourceLocation const&, bool _removeReference) const } } +/// Used in StorageByteArrayElement +static IntegerType byteType(8, IntegerType::Modifier::Hash); + +StorageByteArrayElement::StorageByteArrayElement(CompilerContext& _compilerContext): + LValue(_compilerContext, byteType) +{ +} + +void StorageByteArrayElement::retrieveValue(SourceLocation const&, bool _remove) const +{ + // stack: ref byte_number + if (_remove) + m_context << eth::Instruction::SWAP1 << eth::Instruction::SLOAD + << eth::Instruction::SWAP1 << eth::Instruction::BYTE; + else + m_context << eth::Instruction::DUP2 << eth::Instruction::SLOAD + << eth::Instruction::DUP2 << eth::Instruction::BYTE; +} + +void StorageByteArrayElement::storeValue(Type const&, SourceLocation const&, bool _move) const +{ + //@todo optimize this + + // stack: value ref byte_number + m_context << u256(31) << eth::Instruction::SUB << u256(0x100) << eth::Instruction::EXP; + // stack: value ref (1<<(8*(31-byte_number))) + m_context << eth::Instruction::DUP2 << eth::Instruction::SLOAD; + // stack: value ref (1<<(8*(31-byte_number))) old_full_value + // clear byte in old value + m_context << eth::Instruction::DUP2 << u256(0xff) << eth::Instruction::MUL + << eth::Instruction::NOT << eth::Instruction::AND; + // stack: value ref (1<<(32-byte_number)) old_full_value_with_cleared_byte + m_context << eth::Instruction::SWAP1 << eth::Instruction::DUP4 << eth::Instruction::MUL + << eth::Instruction::OR; + // stack: value ref new_full_value + m_context << eth::Instruction::SWAP1 << eth::Instruction::SSTORE; + if (_move) + m_context << eth::Instruction::POP; +} + +void StorageByteArrayElement::setToZero(SourceLocation const&, bool _removeReference) const +{ + // stack: ref byte_number + if (!_removeReference) + m_context << eth::Instruction::SWAP1 << eth::Instruction::DUP2; + m_context << u256(31) << eth::Instruction::SUB << u256(0x100) << eth::Instruction::EXP; + // stack: ref (1<<(8*(31-byte_number))) + m_context << eth::Instruction::DUP2 << eth::Instruction::SLOAD; + // stack: ref (1<<(8*(31-byte_number))) old_full_value + // clear byte in old value + m_context << eth::Instruction::SWAP1 << u256(0xff) << eth::Instruction::MUL << eth::Instruction::AND; + // stack: ref old_full_value_with_cleared_byte + m_context << eth::Instruction::SWAP1 << eth::Instruction::SSTORE; + if (!_removeReference) + m_context << eth::Instruction::SWAP1; + else + m_context << eth::Instruction::POP; +} StorageArrayLength::StorageArrayLength(CompilerContext& _compilerContext, const ArrayType& _arrayType): LValue(_compilerContext, *_arrayType.getMemberType("length")), @@ -262,4 +321,3 @@ void StorageArrayLength::setToZero(SourceLocation const&, bool _removeReference) m_context << eth::Instruction::DUP1; ArrayUtils(m_context).clearDynamicArray(m_arrayType); } - diff --git a/libsolidity/LValue.h b/libsolidity/LValue.h index 1ed0ae011..c57c80e37 100644 --- a/libsolidity/LValue.h +++ b/libsolidity/LValue.h @@ -46,8 +46,8 @@ protected: m_context(_compilerContext), m_dataType(_dataType) {} public: - /// @returns true if this lvalue reference type occupies a slot on the stack. - virtual bool storesReferenceOnStack() const = 0; + /// @returns the number of stack slots occupied by the lvalue reference + virtual unsigned sizeOnStack() const { return 1; } /// Copies the value of the current lvalue to the top of the stack and, if @a _remove is true, /// also removes the reference from the stack. /// @a _location source location of the current expression, used for error reporting. @@ -61,7 +61,9 @@ public: /// Stores zero in the lvalue. Removes the reference from the stack if @a _removeReference is true. /// @a _location is the source location of the requested operation virtual void setToZero( - SourceLocation const& _location = SourceLocation(), bool _removeReference = true) const = 0; + SourceLocation const& _location = SourceLocation(), + bool _removeReference = true + ) const = 0; protected: CompilerContext& m_context; @@ -76,12 +78,17 @@ class StackVariable: public LValue public: StackVariable(CompilerContext& _compilerContext, Declaration const& _declaration); - virtual bool storesReferenceOnStack() const { return false; } + virtual unsigned sizeOnStack() const override { return 0; } virtual void retrieveValue(SourceLocation const& _location, bool _remove = false) const override; - virtual void storeValue(Type const& _sourceType, - SourceLocation const& _location = SourceLocation(), bool _move = false) const override; + virtual void storeValue( + Type const& _sourceType, + SourceLocation const& _location = SourceLocation(), + bool _move = false + ) const override; virtual void setToZero( - SourceLocation const& _location = SourceLocation(), bool _removeReference = true) const override; + SourceLocation const& _location = SourceLocation(), + bool _removeReference = true + ) const override; private: /// Base stack offset (@see CompilerContext::getBaseStackOffsetOfVariable) of the local variable. @@ -100,12 +107,16 @@ public: StorageItem(CompilerContext& _compilerContext, Declaration const& _declaration); /// Constructs the LValue and assumes that the storage reference is already on the stack. StorageItem(CompilerContext& _compilerContext, Type const& _type); - virtual bool storesReferenceOnStack() const { return true; } virtual void retrieveValue(SourceLocation const& _location, bool _remove = false) const override; - virtual void storeValue(Type const& _sourceType, - SourceLocation const& _location = SourceLocation(), bool _move = false) const override; + virtual void storeValue( + Type const& _sourceType, + SourceLocation const& _location = SourceLocation(), + bool _move = false + ) const override; virtual void setToZero( - SourceLocation const& _location = SourceLocation(), bool _removeReference = true) const override; + SourceLocation const& _location = SourceLocation(), + bool _removeReference = true + ) const override; private: /// Number of stack elements occupied by the value (not the reference). @@ -113,6 +124,28 @@ private: unsigned m_size; }; +/** + * Reference to a single byte inside a storage byte array. + * Stack: + */ +class StorageByteArrayElement: public LValue +{ +public: + /// Constructs the LValue and assumes that the storage reference is already on the stack. + StorageByteArrayElement(CompilerContext& _compilerContext); + virtual unsigned sizeOnStack() const override { return 2; } + virtual void retrieveValue(SourceLocation const& _location, bool _remove = false) const override; + virtual void storeValue( + Type const& _sourceType, + SourceLocation const& _location = SourceLocation(), + bool _move = false + ) const override; + virtual void setToZero( + SourceLocation const& _location = SourceLocation(), + bool _removeReference = true + ) const override; +}; + /** * Reference to the "length" member of a dynamically-sized array. This is an LValue with special * semantics since assignments to it might reduce its length and thus arrays members have to be @@ -123,12 +156,16 @@ class StorageArrayLength: public LValue public: /// Constructs the LValue, assumes that the reference to the array head is already on the stack. StorageArrayLength(CompilerContext& _compilerContext, ArrayType const& _arrayType); - virtual bool storesReferenceOnStack() const { return true; } virtual void retrieveValue(SourceLocation const& _location, bool _remove = false) const override; - virtual void storeValue(Type const& _sourceType, - SourceLocation const& _location = SourceLocation(), bool _move = false) const override; + virtual void storeValue( + Type const& _sourceType, + SourceLocation const& _location = SourceLocation(), + bool _move = false + ) const override; virtual void setToZero( - SourceLocation const& _location = SourceLocation(), bool _removeReference = true) const override; + SourceLocation const& _location = SourceLocation(), + bool _removeReference = true + ) const override; private: ArrayType const& m_arrayType; diff --git a/libsolidity/Parser.cpp b/libsolidity/Parser.cpp index 3c88efc7c..44d111591 100644 --- a/libsolidity/Parser.cpp +++ b/libsolidity/Parser.cpp @@ -822,6 +822,15 @@ ASTPointer Parser::parsePrimaryExpression() expression = nodeFactory.createNode(token, literal, subdenomination); break; } + if (Token::isTimeSubdenomination(m_scanner->peekNextToken())) + { + ASTPointer literal = getLiteralAndAdvance(); + nodeFactory.markEndPosition(); + Literal::SubDenomination subdenomination = static_cast(m_scanner->getCurrentToken()); + m_scanner->next(); + expression = nodeFactory.createNode(token, literal, subdenomination); + break; + } // fall-through case Token::StringLiteral: nodeFactory.markEndPosition(); diff --git a/libsolidity/Token.h b/libsolidity/Token.h index 19afaee3a..85979b566 100644 --- a/libsolidity/Token.h +++ b/libsolidity/Token.h @@ -163,7 +163,7 @@ namespace solidity K(New, "new", 0) \ K(Public, "public", 0) \ K(Private, "private", 0) \ - K(Internal, "internal", 0) \ + K(Internal, "internal", 0) \ K(Return, "return", 0) \ K(Returns, "returns", 0) \ K(Struct, "struct", 0) \ @@ -172,11 +172,18 @@ namespace solidity K(While, "while", 0) \ K(Enum, "enum", 0) \ \ - /* Ether subdenominations */ \ - K(SubWei, "wei", 0) \ - K(SubSzabo, "szabo", 0) \ - K(SubFinney, "finney", 0) \ - K(SubEther, "ether", 0) \ + /* Ether subdenominations */ \ + K(SubWei, "wei", 0) \ + K(SubSzabo, "szabo", 0) \ + K(SubFinney, "finney", 0) \ + K(SubEther, "ether", 0) \ + K(SubSecond, "seconds", 0) \ + K(SubMinute, "minutes", 0) \ + K(SubHour, "hours", 0) \ + K(SubDay, "days", 0) \ + K(SubWeek, "weeks", 0) \ + K(SubYear, "years", 0) \ + K(After, "after", 0) \ /* type keywords, keep them in this order, keep int as first keyword * the implementation in Types.cpp has to be synced to this here */\ K(Int, "int", 0) \ @@ -377,12 +384,13 @@ public: } static bool isBitOp(Value op) { return (BitOr <= op && op <= SHR) || op == BitNot; } - static bool isUnaryOp(Value op) { return (Not <= op && op <= Delete) || op == Add || op == Sub; } + static bool isUnaryOp(Value op) { return (Not <= op && op <= Delete) || op == Add || op == Sub || op == After; } static bool isCountOp(Value op) { return op == Inc || op == Dec; } static bool isShiftOp(Value op) { return (SHL <= op) && (op <= SHR); } static bool isVisibilitySpecifier(Value op) { return isVariableVisibilitySpecifier(op) || op == External; } static bool isVariableVisibilitySpecifier(Value op) { return op == Public || op == Private || op == Internal; } - static bool isEtherSubdenomination(Value op) { return op == SubWei || op == SubSzabo || op == SubFinney || op == Token::SubEther; } + static bool isEtherSubdenomination(Value op) { return op == SubWei || op == SubSzabo || op == SubFinney || op == SubEther; } + static bool isTimeSubdenomination(Value op) { return op == SubSecond || op == SubMinute || op == SubHour || op == SubDay || op == SubWeek || op == SubYear; } // Returns a string corresponding to the JS token string // (.e., "<" for the token LT) or NULL if the token doesn't diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index 96feefff5..454d79d9b 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -195,7 +195,8 @@ TypePointer IntegerType::unaryOperatorResult(Token::Value _operator) const return TypePointer(); // for non-hash integers, we allow +, -, ++ and -- else if (_operator == Token::Add || _operator == Token::Sub || - _operator == Token::Inc || _operator == Token::Dec) + _operator == Token::Inc || _operator == Token::Dec || + _operator == Token::After) return shared_from_this(); else return TypePointer(); @@ -251,6 +252,7 @@ IntegerConstantType::IntegerConstantType(Literal const& _literal) switch (_literal.getSubDenomination()) { case Literal::SubDenomination::Wei: + case Literal::SubDenomination::Second: case Literal::SubDenomination::None: break; case Literal::SubDenomination::Szabo: @@ -262,6 +264,21 @@ IntegerConstantType::IntegerConstantType(Literal const& _literal) case Literal::SubDenomination::Ether: m_value *= bigint("1000000000000000000"); break; + case Literal::SubDenomination::Minute: + m_value *= bigint("60"); + break; + case Literal::SubDenomination::Hour: + m_value *= bigint("3600"); + break; + case Literal::SubDenomination::Day: + m_value *= bigint("86400"); + break; + case Literal::SubDenomination::Week: + m_value *= bigint("604800"); + break; + case Literal::SubDenomination::Year: + m_value *= bigint("31536000"); + break; } } @@ -291,6 +308,8 @@ TypePointer IntegerConstantType::unaryOperatorResult(Token::Value _operator) con case Token::Sub: value = -m_value; break; + case Token::After: + return shared_from_this(); default: return TypePointer(); } @@ -570,11 +589,12 @@ bool ArrayType::operator==(Type const& _other) const return isDynamicallySized() || getLength() == other.getLength(); } -unsigned ArrayType::getCalldataEncodedSize() const +unsigned ArrayType::getCalldataEncodedSize(bool _padded) const { if (isDynamicallySized()) return 0; - bigint size = bigint(getLength()) * (isByteArray() ? 1 : getBaseType()->getCalldataEncodedSize()); + bigint size = bigint(getLength()) * (isByteArray() ? 1 : getBaseType()->getCalldataEncodedSize(_padded)); + size = ((size + 31) / 32) * 32; solAssert(size <= numeric_limits::max(), "Array size does not fit unsigned."); return unsigned(size); } diff --git a/libsolidity/Types.h b/libsolidity/Types.h index afecf3c8e..6cef8d64a 100644 --- a/libsolidity/Types.h +++ b/libsolidity/Types.h @@ -120,8 +120,10 @@ public: /// @returns number of bytes used by this type when encoded for CALL, or 0 if the encoding /// is not a simple big-endian encoding or the type cannot be stored in calldata. - /// Note that irrespective of this size, each calldata element is padded to a multiple of 32 bytes. - virtual unsigned getCalldataEncodedSize() const { return 0; } + /// If @a _padded then it is assumed that each element is padded to a multiple of 32 bytes. + virtual unsigned getCalldataEncodedSize(bool _padded) const { (void)_padded; return 0; } + /// Convenience version of @see getCalldataEncodedSize(bool) + unsigned getCalldataEncodedSize() const { return getCalldataEncodedSize(true); } /// @returns true if the type is dynamically encoded in calldata virtual bool isDynamicallySized() const { return false; } /// @returns number of bytes required to hold this value in storage. @@ -176,7 +178,7 @@ public: virtual bool operator==(Type const& _other) const override; - virtual unsigned getCalldataEncodedSize() const override { return m_bits / 8; } + virtual unsigned getCalldataEncodedSize(bool _padded = true) const override { return _padded ? 32 : m_bits / 8; } virtual bool isValueType() const override { return true; } virtual MemberList const& getMembers() const { return isAddress() ? AddressMemberList : EmptyMemberList; } @@ -247,7 +249,7 @@ public: virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override; virtual bool operator==(Type const& _other) const override; - virtual unsigned getCalldataEncodedSize() const override { return m_bytes; } + virtual unsigned getCalldataEncodedSize(bool _padded) const override { return _padded && m_bytes > 0 ? 32 : m_bytes; } virtual bool isValueType() const override { return true; } virtual std::string toString() const override { return "string" + dev::toString(m_bytes); } @@ -271,7 +273,7 @@ public: virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; virtual TypePointer binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const override; - virtual unsigned getCalldataEncodedSize() const { return 1; } + virtual unsigned getCalldataEncodedSize(bool _padded) const { return _padded ? 32 : 1; } virtual bool isValueType() const override { return true; } virtual std::string toString() const override { return "bool"; } @@ -302,7 +304,7 @@ public: virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override; virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; virtual bool operator==(const Type& _other) const override; - virtual unsigned getCalldataEncodedSize() const override; + virtual unsigned getCalldataEncodedSize(bool _padded) const override; virtual bool isDynamicallySized() const { return m_hasDynamicLength; } virtual u256 getStorageSize() const override; virtual unsigned getSizeOnStack() const override; diff --git a/libweb3jsonrpc/WebThreeStubServerBase.cpp b/libweb3jsonrpc/WebThreeStubServerBase.cpp index f0d8bf6ef..70c8ca9de 100644 --- a/libweb3jsonrpc/WebThreeStubServerBase.cpp +++ b/libweb3jsonrpc/WebThreeStubServerBase.cpp @@ -461,9 +461,9 @@ Json::Value WebThreeStubServerBase::eth_getWork() return ret; } -bool WebThreeStubServerBase::eth_submitWork(std::string const& _nonce) +bool WebThreeStubServerBase::eth_submitWork(std::string const& _nonce, std::string const& _mixHash) { - return client()->submitNonce(jsToFixed<32>(_nonce)); + return client()->submitWork(ProofOfWork::Proof{jsToFixed(_nonce), jsToFixed<32>(_mixHash)}); } int WebThreeStubServerBase::eth_register(std::string const& _address) @@ -710,7 +710,7 @@ std::string WebThreeStubServerBase::eth_transact(Json::Value const& _json) if (t.creation) ret = toJS(right160(sha3(rlpList(t.from, client()->countAt(t.from)))));; if (!t.gasPrice) - t.gasPrice = 10 * dev::eth::szabo; + t.gasPrice = 10 * dev::eth::szabo; // TODO: should be determined by user somehow. if (!t.gas) t.gas = min(client()->gasLimitRemaining(), client()->balanceAt(t.from) / t.gasPrice); diff --git a/libweb3jsonrpc/WebThreeStubServerBase.h b/libweb3jsonrpc/WebThreeStubServerBase.h index 9535c33a0..993c82c5c 100644 --- a/libweb3jsonrpc/WebThreeStubServerBase.h +++ b/libweb3jsonrpc/WebThreeStubServerBase.h @@ -110,7 +110,7 @@ public: virtual bool eth_uninstallFilter(int _id); virtual Json::Value eth_getWork(); - virtual bool eth_submitWork(std::string const& _nonce); + virtual bool eth_submitWork(std::string const& _nonce, std::string const& _mixHash); virtual int eth_register(std::string const& _address); virtual bool eth_unregister(int _id); diff --git a/libweb3jsonrpc/abstractwebthreestubserver.h b/libweb3jsonrpc/abstractwebthreestubserver.h index e40c68acd..bb84afc9b 100644 --- a/libweb3jsonrpc/abstractwebthreestubserver.h +++ b/libweb3jsonrpc/abstractwebthreestubserver.h @@ -54,7 +54,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServerbindAndAddMethod(jsonrpc::Procedure("eth_filterLogs", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_filterLogsI); this->bindAndAddMethod(jsonrpc::Procedure("eth_logs", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_OBJECT, NULL), &AbstractWebThreeStubServer::eth_logsI); this->bindAndAddMethod(jsonrpc::Procedure("eth_getWork", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, NULL), &AbstractWebThreeStubServer::eth_getWorkI); - this->bindAndAddMethod(jsonrpc::Procedure("eth_submitWork", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_submitWorkI); + this->bindAndAddMethod(jsonrpc::Procedure("eth_submitWork", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_submitWorkI); this->bindAndAddMethod(jsonrpc::Procedure("eth_register", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::eth_registerI); this->bindAndAddMethod(jsonrpc::Procedure("eth_unregister", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_unregisterI); this->bindAndAddMethod(jsonrpc::Procedure("eth_queuedTransactions", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_ARRAY, "param1",jsonrpc::JSON_INTEGER, NULL), &AbstractWebThreeStubServer::eth_queuedTransactionsI); @@ -254,7 +254,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServereth_submitWork(request[0u].asString()); + response = this->eth_submitWork(request[0u].asString(), request[1u].asString()); } inline virtual void eth_registerI(const Json::Value &request, Json::Value &response) { @@ -363,7 +363,7 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer _accounts) m_watches.clear(); m_stateDB = OverlayDB(); - TrieDB accountState(&m_stateDB); + SecureTrieDB accountState(&m_stateDB); accountState.init(); std::map genesisState; diff --git a/mix/MixClient.h b/mix/MixClient.h index 55a40eb2a..958d9d8bd 100644 --- a/mix/MixClient.h +++ b/mix/MixClient.h @@ -87,7 +87,7 @@ public: bool isMining() override; eth::MineProgress miningProgress() const override; std::pair getWork() override { return std::pair(); } - bool submitNonce(h256 const&) override { return false; } + bool submitWork(eth::ProofOfWork::Proof const&) override { return false; } /// @returns the last mined block information eth::BlockInfo blockInfo() const; std::vector userAccounts() { return m_userAccounts; } diff --git a/mix/QEther.h b/mix/QEther.h index 794ba2ba1..f50c39e7c 100644 --- a/mix/QEther.h +++ b/mix/QEther.h @@ -23,7 +23,7 @@ #pragma once #include -#include +#include #include "QBigInt.h" namespace dev diff --git a/rlp/CMakeLists.txt b/rlp/CMakeLists.txt new file mode 100644 index 000000000..0e2b5f57b --- /dev/null +++ b/rlp/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_policy(SET CMP0015 NEW) +set(CMAKE_AUTOMOC OFF) + +aux_source_directory(. SRC_LIST) + +include_directories(BEFORE ..) +include_directories(${LEVELDB_INCLUDE_DIRS}) + +set(EXECUTABLE rlp) + +add_executable(${EXECUTABLE} ${SRC_LIST}) + +target_link_libraries(${EXECUTABLE} devcrypto) + +install( TARGETS ${EXECUTABLE} DESTINATION bin) + diff --git a/rlp/main.cpp b/rlp/main.cpp new file mode 100644 index 000000000..44873e4e4 --- /dev/null +++ b/rlp/main.cpp @@ -0,0 +1,381 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file main.cpp + * @author Gav Wood + * @date 2014 + * RLP tool. + */ +#include +#include +#include +#include "../test/JsonSpiritHeaders.h" +#include +#include +#include +using namespace std; +using namespace dev; +namespace js = json_spirit; + +void help() +{ + cout + << "Usage rlp [OPTIONS] [ | -- ]" << endl + << "Options:" << endl + << " -r,--render Render the given RLP. Options:" << endl + << " --indent Use string as the level indentation (default ' ')." << endl + << " --hex-ints Render integers in hex." << endl + << " --ascii-strings Render data as C-style strings or hex depending on content being ASCII." << endl + << " --force-string Force all data to be rendered as C-style strings." << endl + << " --force-escape When rendering as C-style strings, force all characters to be escaped." << endl + << " --force-hex Force all data to be rendered as raw hex." << endl + << " -l,--list-archive List the items in the RLP list by hash and size." << endl + << " -e,--extract-archive Extract all items in the RLP list, named by hash." << endl + << " -c,--create Given a simplified JSON string, output the RLP." << endl + << "General options:" << endl + << " -L,--lenience Try not to bomb out early if possible." << endl + << " -x,--hex,--base-16 Treat input RLP as hex encoded data." << endl + << " --64,--base-64 Treat input RLP as base-64 encoded data." << endl + << " -b,--bin,--base-256 Treat input RLP as raw binary data." << endl + << " -h,--help Print this help message and exit." << endl + << " -V,--version Show the version and exit." << endl + ; + exit(0); +} + +void version() +{ + cout << "rlp version " << dev::Version << endl; + exit(0); +} + +enum class Mode { + ListArchive, + ExtractArchive, + Render, + Create +}; + +enum class Encoding { + Auto, + Hex, + Base64, + Binary, +}; + +bool isAscii(string const& _s) +{ + // Always hex-encode anything beginning with 0x to avoid ambiguity. + if (_s.size() >= 2 && _s.substr(0, 2) == "0x") + return false; + + for (char c: _s) + if (c < 32) + return false; + return true; +} + +class RLPStreamer +{ +public: + struct Prefs + { + string indent = " "; + bool hexInts = false; + bool hexPrefix = true; + bool forceString = true; + bool escapeAll = false; + bool forceHex = false; + }; + + RLPStreamer(ostream& _out, Prefs _p): m_out(_out), m_prefs(_p) {} + + void output(RLP const& _d, unsigned _level = 0) + { + if (_d.isNull()) + m_out << "null"; + else if (_d.isInt()) + if (m_prefs.hexInts) + m_out << (m_prefs.hexPrefix ? "0x" : "") << toHex(toCompactBigEndian(_d.toInt(RLP::LaisezFaire), 1), 1); + else + m_out << _d.toInt(RLP::LaisezFaire); + else if (_d.isData()) + if (m_prefs.forceString || (!m_prefs.forceHex && isAscii(_d.toString()))) + m_out << escaped(_d.toString(), m_prefs.escapeAll); + else + m_out << (m_prefs.hexPrefix ? "0x" : "") << toHex(_d.data()); + else if (_d.isList()) + { + m_out << "["; + string newline = "\n"; + for (unsigned i = 0; i < _level + 1; ++i) + newline += m_prefs.indent; + int j = 0; + for (auto i: _d) + { + m_out << (j++ ? + (m_prefs.indent.empty() ? ", " : ("," + newline)) : + (m_prefs.indent.empty() ? " " : newline)); + output(i, _level + 1); + } + newline = newline.substr(0, newline.size() - m_prefs.indent.size()); + m_out << (m_prefs.indent.empty() ? (j ? " ]" : "]") : (j ? newline + "]" : "]")); + } + } + +private: + std::ostream& m_out; + Prefs m_prefs; +}; + +int main(int argc, char** argv) +{ + Encoding encoding = Encoding::Auto; + Mode mode = Mode::Render; + string inputFile = "--"; + bool lenience = false; + RLPStreamer::Prefs prefs; + + for (int i = 1; i < argc; ++i) + { + string arg = argv[i]; + if (arg == "-h" || arg == "--help") + help(); + else if (arg == "-r" || arg == "--render") + mode = Mode::Render; + else if (arg == "-c" || arg == "--create") + mode = Mode::Create; + else if ((arg == "-i" || arg == "--indent") && argc > i) + prefs.indent = argv[++i]; + else if (arg == "--hex-ints") + prefs.hexInts = true; + else if (arg == "--ascii-strings") + prefs.forceString = prefs.forceHex = false; + else if (arg == "--force-string") + prefs.forceString = true; + else if (arg == "--force-hex") + prefs.forceHex = true; + else if (arg == "--force-escape") + prefs.escapeAll = true; + else if (arg == "-l" || arg == "--list-archive") + mode = Mode::ListArchive; + else if (arg == "-e" || arg == "--extract-archive") + mode = Mode::ExtractArchive; + else if (arg == "-L" || arg == "--lenience") + lenience = true; + else if (arg == "-V" || arg == "--version") + version(); + else if (arg == "-x" || arg == "--hex" || arg == "--base-16") + encoding = Encoding::Hex; + else if (arg == "--64" || arg == "--base-64") + encoding = Encoding::Base64; + else if (arg == "-b" || arg == "--bin" || arg == "--base-256") + encoding = Encoding::Binary; + else + inputFile = arg; + } + + bytes in; + if (inputFile == "--") + for (int i = cin.get(); i != -1; i = cin.get()) + in.push_back((byte)i); + else + in = contents(inputFile); + + bytes b; + + if (mode != Mode::Create) + { + if (encoding == Encoding::Auto) + { + encoding = Encoding::Hex; + for (char b: in) + if (b != '\n' && b != ' ' && b != '\t') + { + if (encoding == Encoding::Hex && (b < '0' || b > '9' ) && (b < 'a' || b > 'f' ) && (b < 'A' || b > 'F' )) + { + cerr << "'" << b << "':" << (int)b << endl; + encoding = Encoding::Base64; + } + if (encoding == Encoding::Base64 && (b < '0' || b > '9' ) && (b < 'a' || b > 'z' ) && (b < 'A' || b > 'Z' ) && b != '+' && b != '/') + { + encoding = Encoding::Binary; + break; + } + } + } + switch (encoding) + { + case Encoding::Hex: + { + string s = asString(in); + boost::algorithm::replace_all(s, " ", ""); + boost::algorithm::replace_all(s, "\n", ""); + boost::algorithm::replace_all(s, "\t", ""); + b = fromHex(s); + break; + } + case Encoding::Base64: + { + string s = asString(in); + boost::algorithm::replace_all(s, " ", ""); + boost::algorithm::replace_all(s, "\n", ""); + boost::algorithm::replace_all(s, "\t", ""); + b = fromBase64(s); + break; + } + default: + swap(b, in); + break; + } + } + + try + { + RLP rlp(b); + switch (mode) + { + case Mode::ListArchive: + { + if (!rlp.isList()) + { + cout << "Error: Invalid format; RLP data is not a list." << endl; + exit(1); + } + cout << rlp.itemCount() << " items:" << endl; + for (auto i: rlp) + { + if (!i.isData()) + { + cout << "Error: Invalid format; RLP list item is not data." << endl; + if (!lenience) + exit(1); + } + cout << " " << i.size() << " bytes: " << sha3(i.data()) << endl; + } + break; + } + case Mode::ExtractArchive: + { + if (!rlp.isList()) + { + cout << "Error: Invalid format; RLP data is not a list." << endl; + exit(1); + } + cout << rlp.itemCount() << " items:" << endl; + for (auto i: rlp) + { + if (!i.isData()) + { + cout << "Error: Invalid format; RLP list item is not data." << endl; + if (!lenience) + exit(1); + } + ofstream fout; + fout.open(toString(sha3(i.data()))); + fout.write(reinterpret_cast(i.data().data()), i.data().size()); + } + break; + } + case Mode::Render: + { + RLPStreamer s(cout, prefs); + s.output(rlp); + cout << endl; + break; + } + case Mode::Create: + { + vector v(1); + try { + js::read_string(asString(in), v[0]); + } + catch (...) + { + cerr << "Error: Invalid format; bad JSON." << endl; + exit(1); + } + RLPStream out; + while (!v.empty()) + { + auto vb = v.back(); + v.pop_back(); + switch (vb.type()) + { + case js::array_type: + { + js::mArray a = vb.get_array(); + out.appendList(a.size()); + for (int i = a.size() - 1; i >= 0; --i) + v.push_back(a[i]); + break; + } + case js::str_type: + { + string const& s = vb.get_str(); + if (s.size() >= 2 && s.substr(0, 2) == "0x") + out << fromHex(s); + else + { + // assume it's a normal JS escaped string. + bytes ss; + ss.reserve(s.size()); + for (unsigned i = 0; i < s.size(); ++i) + if (s[i] == '\\' && i + 1 < s.size()) + { + if (s[++i] == 'x' && i + 2 < s.size()) + ss.push_back(fromHex(s.substr(i, 2))[0]); + } + else if (s[i] != '\\') + ss.push_back((byte)s[i]); + out << ss; + } + break; + } + case js::int_type: + out << vb.get_int(); + break; + default: + cerr << "ERROR: Unsupported type in JSON." << endl; + if (!lenience) + exit(1); + } + } + switch (encoding) + { + case Encoding::Hex: case Encoding::Auto: + cout << toHex(out.out()) << endl; + break; + case Encoding::Base64: + cout << toBase64(&out.out()) << endl; + break; + case Encoding::Binary: + cout.write((char const*)out.out().data(), out.out().size()); + break; + } + break; + } + default:; + } + } + catch (...) + { + cerr << "Error: Invalid format; bad RLP." << endl; + exit(1); + } + + return 0; +} diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index db12231a7..08acb5ebd 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -424,13 +424,13 @@ void CommandLineInterface::actOnInput() if (outputToStdout(choice)) { cout << "EVM assembly:" << endl; - m_compiler->streamAssembly(cout, contract); + m_compiler->streamAssembly(cout, contract, m_sourceCodes); } if (outputToFile(choice)) { ofstream outFile(contract + ".evm"); - m_compiler->streamAssembly(outFile, contract); + m_compiler->streamAssembly(outFile, contract, m_sourceCodes); outFile.close(); } } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7ddfdb40d..292f62a03 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -26,7 +26,7 @@ target_link_libraries(testeth ethereum) target_link_libraries(testeth ethcore) target_link_libraries(testeth secp256k1) target_link_libraries(testeth solidity) -if (NOT HEADLESS) +if (NOT HEADLESS AND NOT JUSTTESTS) target_link_libraries(testeth webthree) target_link_libraries(testeth natspec) endif() diff --git a/test/MemTrie.cpp b/test/MemTrie.cpp index c3a44e1e5..ab5a13b60 100644 --- a/test/MemTrie.cpp +++ b/test/MemTrie.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include using namespace std; using namespace dev; using namespace dev::eth; diff --git a/test/SolidityABIJSON.cpp b/test/SolidityABIJSON.cpp index 10873b5ab..5f67a5667 100644 --- a/test/SolidityABIJSON.cpp +++ b/test/SolidityABIJSON.cpp @@ -20,7 +20,7 @@ * Unit tests for the solidity compiler JSON Interface output. */ -#include +#include "TestHelper.h" #include #include #include @@ -39,15 +39,7 @@ public: void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString) { - try - { - m_compilerStack.parse(_code); - } - catch(boost::exception const& _e) - { - auto msg = std::string("Parsing contract failed with: ") + boost::diagnostic_information(_e); - BOOST_FAIL(msg); - } + ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse(_code), "Parsing contract failed"); std::string generatedInterfaceString = m_compilerStack.getMetadata("", DocumentationType::ABIInterface); Json::Value generatedInterface; m_reader.parse(generatedInterfaceString, generatedInterface); diff --git a/test/SolidityEndToEndTest.cpp b/test/SolidityEndToEndTest.cpp index 0b3836ade..ae2417052 100644 --- a/test/SolidityEndToEndTest.cpp +++ b/test/SolidityEndToEndTest.cpp @@ -2949,6 +2949,164 @@ BOOST_AUTO_TEST_CASE(array_copy_storage_storage_struct) BOOST_CHECK(m_state.storage(m_contractAddress).empty()); } +BOOST_AUTO_TEST_CASE(external_array_args) +{ + char const* sourceCode = R"( + contract c { + function test(uint[8] a, uint[] b, uint[5] c, uint a_index, uint b_index, uint c_index) + external returns (uint av, uint bv, uint cv) { + av = a[a_index]; + bv = b[b_index]; + cv = c[c_index]; + } + } + )"; + compileAndRun(sourceCode); + bytes params = encodeArgs( + 1, 2, 3, 4, 5, 6, 7, 8, // a + 3, // b.length + 21, 22, 23, 24, 25, // c + 0, 1, 2, // (a,b,c)_index + 11, 12, 13 // b + ); + BOOST_CHECK(callContractFunction("test(uint256[8],uint256[],uint256[5],uint256,uint256,uint256)", params) == encodeArgs(1, 12, 23)); +} + +BOOST_AUTO_TEST_CASE(bytes_index_access) +{ + char const* sourceCode = R"( + contract c { + bytes data; + function direct(bytes arg, uint index) external returns (uint) { + return uint(arg[index]); + } + function storageCopyRead(bytes arg, uint index) external returns (uint) { + data = arg; + return uint(data[index]); + } + function storageWrite() external returns (uint) { + data.length = 35; + data[31] = 0x77; + data[32] = 0x14; + + data[31] = 1; + data[31] |= 8; + data[30] = 1; + data[32] = 3; + return uint(data[30]) * 0x100 | uint(data[31]) * 0x10 | uint(data[32]); + } + } + )"; + compileAndRun(sourceCode); + string array{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33}; + BOOST_CHECK(callContractFunction("direct(bytes,uint256)", u256(array.length()), 32, array) == encodeArgs(32)); + BOOST_CHECK(callContractFunction("storageCopyRead(bytes,uint256)", u256(array.length()), 32, array) == encodeArgs(32)); + BOOST_CHECK(callContractFunction("storageWrite()") == encodeArgs(0x193)); +} + +BOOST_AUTO_TEST_CASE(array_copy_calldata_storage) +{ + char const* sourceCode = R"( + contract c { + uint[9] m_data; + uint[] m_data_dyn; + uint8[][] m_byte_data; + function store(uint[9] a, uint8[3][] b) external returns (uint8) { + m_data = a; + m_data_dyn = a; + m_byte_data = b; + return b[3][1]; // note that access and declaration are reversed to each other + } + function retrieve() returns (uint a, uint b, uint c, uint d, uint e, uint f, uint g) { + a = m_data.length; + b = m_data[7]; + c = m_data_dyn.length; + d = m_data_dyn[7]; + e = m_byte_data.length; + f = m_byte_data[3].length; + g = m_byte_data[3][1]; + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("store(uint256[9],uint8[3][])", encodeArgs( + 21, 22, 23, 24, 25, 26, 27, 28, 29, // a + 4, // size of b + 1, 2, 3, // b[0] + 11, 12, 13, // b[1] + 21, 22, 23, // b[2] + 31, 32, 33 // b[3] + )) == encodeArgs(32)); + BOOST_CHECK(callContractFunction("retrieve()") == encodeArgs( + 9, 28, 9, 28, + 4, 3, 32)); +} + +BOOST_AUTO_TEST_CASE(array_copy_nested_array) +{ + char const* sourceCode = R"( + contract c { + uint[4][] a; + uint[5][] b; + uint[][] c; + function test(uint[2][] d) external returns (uint) { + a = d; + b = a; + c = b; + return c[1][1] | c[1][2] | c[1][3] | c[1][4]; + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("test(uint256[2][])", encodeArgs( + 3, + 7, 8, + 9, 10, + 11, 12 + )) == encodeArgs(10)); +} + +BOOST_AUTO_TEST_CASE(array_copy_including_mapping) +{ + char const* sourceCode = R"( + contract c { + mapping(uint=>uint)[90][] large; + mapping(uint=>uint)[3][] small; + function test() returns (uint r) { + large.length = small.length = 7; + large[3][2][0] = 2; + large[1] = large[3]; + small[3][2][0] = 2; + small[1] = small[2]; + r = (( + small[3][2][0] * 0x100 | + small[1][2][0]) * 0x100 | + large[3][2][0]) * 0x100 | + large[1][2][0]; + delete small; + delete large; + } + function clear() returns (uint r) { + large.length = small.length = 7; + small[3][2][0] = 0; + large[3][2][0] = 0; + small.length = large.length = 0; + return 7; + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("test()") == encodeArgs(0x02000200)); + // storage is not empty because we cannot delete the mappings + BOOST_CHECK(!m_state.storage(m_contractAddress).empty()); + BOOST_CHECK(callContractFunction("clear()") == encodeArgs(7)); + BOOST_CHECK(m_state.storage(m_contractAddress).empty()); +} + BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base) { char const* sourceCode = R"( diff --git a/test/SolidityExpressionCompiler.cpp b/test/SolidityExpressionCompiler.cpp index 3340334f8..7034085ef 100644 --- a/test/SolidityExpressionCompiler.cpp +++ b/test/SolidityExpressionCompiler.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include "TestHelper.h" using namespace std; @@ -72,8 +72,8 @@ private: Expression* m_expression; }; -Declaration const& resolveDeclaration(vector const& _namespacedName, - NameAndTypeResolver const& _resolver) +Declaration const& resolveDeclaration( + vector const& _namespacedName, NameAndTypeResolver const& _resolver) { Declaration const* declaration = nullptr; // bracers are required, cause msvc couldnt handle this macro in for statement @@ -112,13 +112,13 @@ bytes compileFirstExpression(const string& _sourceCode, vector> _ for (ASTPointer const& node: sourceUnit->getNodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) { - BOOST_REQUIRE_NO_THROW(resolver.resolveNamesAndTypes(*contract)); + ETH_TEST_REQUIRE_NO_THROW(resolver.resolveNamesAndTypes(*contract), "Resolving names failed"); inheritanceHierarchy = vector(1, contract); } for (ASTPointer const& node: sourceUnit->getNodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) { - BOOST_REQUIRE_NO_THROW(resolver.checkTypeRequirements(*contract)); + ETH_TEST_REQUIRE_NO_THROW(resolver.checkTypeRequirements(*contract), "Checking type Requirements failed"); } for (ASTPointer const& node: sourceUnit->getNodes()) if (ContractDefinition* contract = dynamic_cast(node.get())) diff --git a/test/SolidityInterface.cpp b/test/SolidityInterface.cpp index 354715182..ecab64c8c 100644 --- a/test/SolidityInterface.cpp +++ b/test/SolidityInterface.cpp @@ -20,7 +20,7 @@ * Unit tests for generating source interfaces for Solidity contracts. */ -#include +#include "TestHelper.h" #include #include @@ -42,9 +42,9 @@ public: ContractDefinition const& checkInterface(string const& _code, string const& _contractName = "") { m_code = _code; - BOOST_REQUIRE_NO_THROW(m_compilerStack.parse(_code)); + ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse(_code), "Parsing failed"); m_interface = m_compilerStack.getMetadata("", DocumentationType::ABISolidityInterface); - BOOST_REQUIRE_NO_THROW(m_reCompiler.parse(m_interface)); + ETH_TEST_REQUIRE_NO_THROW(m_reCompiler.parse(m_interface), "Interface parsing failed"); return m_reCompiler.getContractDefinition(_contractName); } diff --git a/test/SolidityNameAndTypeResolution.cpp b/test/SolidityNameAndTypeResolution.cpp index a48b62d0d..c3a4a3377 100644 --- a/test/SolidityNameAndTypeResolution.cpp +++ b/test/SolidityNameAndTypeResolution.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include "TestHelper.h" using namespace std; @@ -58,30 +58,6 @@ ASTPointer parseTextAndResolveNames(std::string const& _source) return sourceUnit; } -ASTPointer parseTextAndResolveNamesWithChecks(std::string const& _source) -{ - Parser parser; - ASTPointer sourceUnit; - try - { - sourceUnit = parser.parse(std::make_shared(CharStream(_source))); - NameAndTypeResolver resolver({}); - resolver.registerDeclarations(*sourceUnit); - for (ASTPointer const& node: sourceUnit->getNodes()) - if (ContractDefinition* contract = dynamic_cast(node.get())) - resolver.resolveNamesAndTypes(*contract); - for (ASTPointer const& node: sourceUnit->getNodes()) - if (ContractDefinition* contract = dynamic_cast(node.get())) - resolver.checkTypeRequirements(*contract); - } - catch(boost::exception const& _e) - { - auto msg = std::string("Parsing text and resolving names failed with: \n") + boost::diagnostic_information(_e); - BOOST_FAIL(msg); - } - return sourceUnit; -} - static ContractDefinition const* retrieveContract(ASTPointer _source, unsigned index) { ContractDefinition* contract; @@ -109,7 +85,7 @@ BOOST_AUTO_TEST_CASE(smoke_test) " uint256 stateVariable1;\n" " function fun(uint256 arg1) { var x; uint256 y; }" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(double_stateVariable_declaration) @@ -144,7 +120,7 @@ BOOST_AUTO_TEST_CASE(name_shadowing) " uint256 variable;\n" " function f() { uint32 variable ; }" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(name_references) @@ -153,7 +129,7 @@ BOOST_AUTO_TEST_CASE(name_references) " uint256 variable;\n" " function f(uint256 arg) returns (uint out) { f(variable); test; out; }" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(undeclared_name) @@ -171,7 +147,7 @@ BOOST_AUTO_TEST_CASE(reference_to_later_declaration) " function g() { f(); }" " function f() { }" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(struct_definition_directly_recursive) @@ -209,7 +185,7 @@ BOOST_AUTO_TEST_CASE(struct_definition_recursion_via_mapping) " mapping(uint => MyStructName1) x;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(type_inference_smoke_test) @@ -217,7 +193,7 @@ BOOST_AUTO_TEST_CASE(type_inference_smoke_test) char const* text = "contract test {\n" " function f(uint256 arg1, uint32 arg2) returns (bool ret) { var x = arg1 + arg2 == 8; ret = x; }" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(type_checking_return) @@ -225,7 +201,7 @@ BOOST_AUTO_TEST_CASE(type_checking_return) char const* text = "contract test {\n" " function f() returns (bool r) { return 1 >= 2; }" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(type_checking_return_wrong_number) @@ -250,7 +226,7 @@ BOOST_AUTO_TEST_CASE(type_checking_function_call) " function f() returns (bool r) { return g(12, true) == 3; }\n" " function g(uint256 a, bool b) returns (uint256 r) { }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(type_conversion_for_comparison) @@ -258,7 +234,7 @@ BOOST_AUTO_TEST_CASE(type_conversion_for_comparison) char const* text = "contract test {\n" " function f() { uint32(2) == int64(2); }" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(type_conversion_for_comparison_invalid) @@ -274,7 +250,7 @@ BOOST_AUTO_TEST_CASE(type_inference_explicit_conversion) char const* text = "contract test {\n" " function f() returns (int256 r) { var x = int256(uint32(2)); return x; }" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(large_string_literal) @@ -292,7 +268,7 @@ BOOST_AUTO_TEST_CASE(balance) " uint256 x = address(0).balance;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(balance_invalid) @@ -332,7 +308,7 @@ BOOST_AUTO_TEST_CASE(assignment_to_struct) " data = a;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(returns_in_constructor) @@ -356,7 +332,7 @@ BOOST_AUTO_TEST_CASE(forward_function_reference) " if (First(2).fun() == true) return 1;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(comparison_bitop_precedence) @@ -366,7 +342,7 @@ BOOST_AUTO_TEST_CASE(comparison_bitop_precedence) " return 1 & 2 == 8 & 9 && 1 ^ 2 < 4 | 6;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(function_canonical_signature) @@ -423,7 +399,7 @@ BOOST_AUTO_TEST_CASE(inheritance_basic) function f() { baseMember = 7; } } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(inheritance_diamond_basic) @@ -436,7 +412,7 @@ BOOST_AUTO_TEST_CASE(inheritance_diamond_basic) function g() { f(); rootFunction(); } } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(cyclic_inheritance) @@ -492,7 +468,7 @@ BOOST_AUTO_TEST_CASE(complex_inheritance) contract B { function f() {} function g() returns (uint8 r) {} } contract C is A, B { } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(constructor_visibility) @@ -502,7 +478,7 @@ BOOST_AUTO_TEST_CASE(constructor_visibility) contract A { function A() { } } contract B is A { function f() { A x = A(0); } } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(overriding_constructor) @@ -512,7 +488,7 @@ BOOST_AUTO_TEST_CASE(overriding_constructor) contract A { function A() { } } contract B is A { function A() returns (uint8 r) {} } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(missing_base_constructor_arguments) @@ -541,7 +517,7 @@ BOOST_AUTO_TEST_CASE(implicit_derived_to_base_conversion) function f() { A a = B(1); } } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(implicit_base_to_derived_conversion) @@ -564,7 +540,7 @@ BOOST_AUTO_TEST_CASE(function_modifier_invocation) modifier mod2(string7 a) { while (a == "1234567") _ } } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(invalid_function_modifier_type) @@ -587,7 +563,7 @@ BOOST_AUTO_TEST_CASE(function_modifier_invocation_parameters) modifier mod2(string7 a) { while (a == "1234567") _ } } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(function_modifier_invocation_local_variables) @@ -598,7 +574,7 @@ BOOST_AUTO_TEST_CASE(function_modifier_invocation_local_variables) modifier mod(uint a) { if (a > 0) _ } } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(legal_modifier_override) @@ -607,7 +583,7 @@ BOOST_AUTO_TEST_CASE(legal_modifier_override) contract A { modifier mod(uint a) {} } contract B is A { modifier mod(uint a) {} } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(illegal_modifier_override) @@ -661,7 +637,7 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors) ASTPointer source; ContractDefinition const* contract; - BOOST_CHECK_NO_THROW(source = parseTextAndResolveNamesWithChecks(text)); + ETH_TEST_CHECK_NO_THROW(source = parseTextAndResolveNames(text), "Parsing and Resolving names failed"); BOOST_REQUIRE((contract = retrieveContract(source, 0)) != nullptr); FunctionTypePointer function = retrieveFunctionBySignature(contract, "foo()"); BOOST_REQUIRE(function && function->hasDeclaration()); @@ -711,7 +687,7 @@ BOOST_AUTO_TEST_CASE(private_state_variable) ASTPointer source; ContractDefinition const* contract; - BOOST_CHECK_NO_THROW(source = parseTextAndResolveNamesWithChecks(text)); + ETH_TEST_CHECK_NO_THROW(source = parseTextAndResolveNames(text), "Parsing and Resolving names failed"); BOOST_CHECK((contract = retrieveContract(source, 0)) != nullptr); FunctionTypePointer function; function = retrieveFunctionBySignature(contract, "foo()"); @@ -729,7 +705,7 @@ BOOST_AUTO_TEST_CASE(base_class_state_variable_accessor) "contract Child is Parent{\n" " function foo() returns (uint256) { return Parent.m_aMember; }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(base_class_state_variable_internal_member) @@ -740,7 +716,7 @@ BOOST_AUTO_TEST_CASE(base_class_state_variable_internal_member) "contract Child is Parent{\n" " function foo() returns (uint256) { return Parent.m_aMember; }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(state_variable_member_of_wrong_class1) @@ -780,7 +756,7 @@ BOOST_AUTO_TEST_CASE(fallback_function) function() { x = 2; } } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(fallback_function_with_arguments) @@ -817,7 +793,7 @@ BOOST_AUTO_TEST_CASE(fallback_function_inheritance) function() { x = 2; } } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(event) @@ -827,7 +803,7 @@ BOOST_AUTO_TEST_CASE(event) event e(uint indexed a, string3 indexed s, bool indexed b); function f() { e(2, "abc", true); } })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(event_too_many_indexed) @@ -847,7 +823,7 @@ BOOST_AUTO_TEST_CASE(event_call) event e(uint a, string3 indexed s, bool indexed b); function f() { e(2, "abc", true); } })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(event_inheritance) @@ -859,7 +835,7 @@ BOOST_AUTO_TEST_CASE(event_inheritance) contract c is base { function f() { e(2, "abc", true); } })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(multiple_events_argument_clash) @@ -869,7 +845,7 @@ BOOST_AUTO_TEST_CASE(multiple_events_argument_clash) event e1(uint a, uint e1, uint e2); event e2(uint a, uint e1, uint e2); })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(access_to_default_function_visibility) @@ -881,7 +857,7 @@ BOOST_AUTO_TEST_CASE(access_to_default_function_visibility) contract d { function g() { c(0).f(); } })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(access_to_internal_function) @@ -917,7 +893,7 @@ BOOST_AUTO_TEST_CASE(access_to_internal_state_variable) contract d { function g() { c(0).a(); } })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(error_count_in_named_args) @@ -963,7 +939,7 @@ BOOST_AUTO_TEST_CASE(empty_name_input_parameter) function f(uint){ } })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(empty_name_return_parameter) @@ -973,7 +949,7 @@ BOOST_AUTO_TEST_CASE(empty_name_return_parameter) function f() returns(bool){ } })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one) @@ -984,7 +960,7 @@ BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one) return k; } })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(empty_name_return_parameter_with_named_one) @@ -1014,7 +990,8 @@ BOOST_AUTO_TEST_CASE(overflow_caused_by_ether_units) } uint256 a; })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCodeFine)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCodeFine), + "Parsing and Resolving names failed"); char const* sourceCode = R"( contract c { function c () @@ -1056,7 +1033,7 @@ BOOST_AUTO_TEST_CASE(enum_member_access) ActionChoices choices; } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(enum_invalid_member_access) @@ -1088,7 +1065,7 @@ BOOST_AUTO_TEST_CASE(enum_explicit_conversion_is_okay) uint64 b; } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(int_to_enum_explicit_conversion_is_okay) @@ -1105,7 +1082,7 @@ BOOST_AUTO_TEST_CASE(int_to_enum_explicit_conversion_is_okay) ActionChoices b; } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(enum_implicit_conversion_is_not_okay) @@ -1225,7 +1202,7 @@ BOOST_AUTO_TEST_CASE(test_for_bug_override_function_with_bytearray_type) function f(bytes _a) external returns (uint256 r) {r = 42;} } )"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(sourceCode)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCode), "Parsing and Name Resolving failed"); } BOOST_AUTO_TEST_CASE(array_with_nonconstant_length) @@ -1267,7 +1244,7 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types_conversion_possible) uint8[] b; function f() { a = b; } })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(array_copy_with_different_types_static_dynamic) @@ -1278,7 +1255,7 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types_static_dynamic) uint8[80] b; function f() { a = b; } })"; - BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); + ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed"); } BOOST_AUTO_TEST_CASE(array_copy_with_different_types_dynamic_static) @@ -1292,6 +1269,24 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types_dynamic_static) BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); } +BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_int) +{ + char const* text = R"( + contract c { + uint8 a = 1000; + })"; + BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); +} + +BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_string) +{ + char const* text = R"( + contract c { + uint a = "abc"; + })"; + BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/SolidityNatspecJSON.cpp b/test/SolidityNatspecJSON.cpp index d1a443c21..edfe89861 100644 --- a/test/SolidityNatspecJSON.cpp +++ b/test/SolidityNatspecJSON.cpp @@ -20,7 +20,7 @@ * Unit tests for the solidity compiler JSON Interface output. */ -#include +#include "TestHelper.h" #include #include #include @@ -43,15 +43,7 @@ public: bool _userDocumentation) { std::string generatedDocumentationString; - try - { - m_compilerStack.parse(_code); - } - catch(boost::exception const& _e) - { - auto msg = std::string("Parsing contract failed with: ") + boost::diagnostic_information(_e); - BOOST_FAIL(msg); - } + ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse(_code), "Parsing failed"); if (_userDocumentation) generatedDocumentationString = m_compilerStack.getMetadata("", DocumentationType::NatspecUser); diff --git a/test/SolidityParser.cpp b/test/SolidityParser.cpp index 28221cc62..88b86e638 100644 --- a/test/SolidityParser.cpp +++ b/test/SolidityParser.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include "TestHelper.h" using namespace std; @@ -50,22 +50,6 @@ ASTPointer parseText(std::string const& _source) return ASTPointer(); } -ASTPointer parseTextExplainError(std::string const& _source) -{ - try - { - return parseText(_source); - } - catch (Exception const& exception) - { - // LTODO: Print the error in a kind of a better way? - // In absence of CompilerStack we can't use SourceReferenceFormatter - cout << "Exception while parsing: " << diagnostic_information(exception); - // rethrow to signal test failure - throw exception; - } -} - static void checkFunctionNatspec(ASTPointer _function, std::string const& _expectedDoc) { @@ -84,7 +68,7 @@ BOOST_AUTO_TEST_CASE(smoke_test) char const* text = "contract test {\n" " uint256 stateVariable1;\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed."); } BOOST_AUTO_TEST_CASE(missing_variable_name_in_declaration) @@ -103,7 +87,7 @@ BOOST_AUTO_TEST_CASE(empty_function) " returns (int id)\n" " { }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed."); } BOOST_AUTO_TEST_CASE(no_function_params) @@ -112,7 +96,7 @@ BOOST_AUTO_TEST_CASE(no_function_params) " uint256 stateVar;\n" " function functionName() {}\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed."); } BOOST_AUTO_TEST_CASE(single_function_param) @@ -121,7 +105,7 @@ BOOST_AUTO_TEST_CASE(single_function_param) " uint256 stateVar;\n" " function functionName(hash hashin) returns (hash hashout) {}\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed."); } BOOST_AUTO_TEST_CASE(missing_parameter_name_in_named_args) @@ -151,9 +135,9 @@ BOOST_AUTO_TEST_CASE(function_natspec_documentation) " /// This is a test function\n" " function functionName(hash hashin) returns (hash hashout) {}\n" "}\n"; - BOOST_REQUIRE_NO_THROW(contract = parseText(text)); + ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); auto functions = contract->getDefinedFunctions(); - BOOST_REQUIRE_NO_THROW(function = functions.at(0)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); checkFunctionNatspec(function, "This is a test function"); } @@ -166,9 +150,9 @@ BOOST_AUTO_TEST_CASE(function_normal_comments) " // We won't see this comment\n" " function functionName(hash hashin) returns (hash hashout) {}\n" "}\n"; - BOOST_REQUIRE_NO_THROW(contract = parseText(text)); + ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); auto functions = contract->getDefinedFunctions(); - BOOST_REQUIRE_NO_THROW(function = functions.at(0)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); BOOST_CHECK_MESSAGE(function->getDocumentation() == nullptr, "Should not have gotten a Natspecc comment for this function"); } @@ -188,20 +172,20 @@ BOOST_AUTO_TEST_CASE(multiple_functions_natspec_documentation) " /// This is test function 4\n" " function functionName4(hash hashin) returns (hash hashout) {}\n" "}\n"; - BOOST_REQUIRE_NO_THROW(contract = parseText(text)); + ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); auto functions = contract->getDefinedFunctions(); - BOOST_REQUIRE_NO_THROW(function = functions.at(0)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); checkFunctionNatspec(function, "This is test function 1"); - BOOST_REQUIRE_NO_THROW(function = functions.at(1)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(1), "Failed to retrieve function"); checkFunctionNatspec(function, "This is test function 2"); - BOOST_REQUIRE_NO_THROW(function = functions.at(2)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(2), "Failed to retrieve function"); BOOST_CHECK_MESSAGE(function->getDocumentation() == nullptr, "Should not have gotten natspec comment for functionName3()"); - BOOST_REQUIRE_NO_THROW(function = functions.at(3)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(3), "Failed to retrieve function"); checkFunctionNatspec(function, "This is test function 4"); } @@ -215,10 +199,10 @@ BOOST_AUTO_TEST_CASE(multiline_function_documentation) " /// and it has 2 lines\n" " function functionName1(hash hashin) returns (hash hashout) {}\n" "}\n"; - BOOST_REQUIRE_NO_THROW(contract = parseText(text)); + ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); auto functions = contract->getDefinedFunctions(); - BOOST_REQUIRE_NO_THROW(function = functions.at(0)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); checkFunctionNatspec(function, "This is a test function\n" " and it has 2 lines"); } @@ -240,13 +224,13 @@ BOOST_AUTO_TEST_CASE(natspec_comment_in_function_body) " /// and it has 2 lines\n" " function fun(hash hashin) returns (hash hashout) {}\n" "}\n"; - BOOST_REQUIRE_NO_THROW(contract = parseText(text)); + ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); auto functions = contract->getDefinedFunctions(); - BOOST_REQUIRE_NO_THROW(function = functions.at(0)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); checkFunctionNatspec(function, "fun1 description"); - BOOST_REQUIRE_NO_THROW(function = functions.at(1)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(1), "Failed to retrieve function"); checkFunctionNatspec(function, "This is a test function\n" " and it has 2 lines"); } @@ -266,10 +250,10 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_between_keyword_and_signature) " string name = \"Solidity\";" " }\n" "}\n"; - BOOST_REQUIRE_NO_THROW(contract = parseText(text)); + ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); auto functions = contract->getDefinedFunctions(); - BOOST_REQUIRE_NO_THROW(function = functions.at(0)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); BOOST_CHECK_MESSAGE(!function->getDocumentation(), "Shouldn't get natspec docstring for this function"); } @@ -289,10 +273,10 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_after_signature) " string name = \"Solidity\";" " }\n" "}\n"; - BOOST_REQUIRE_NO_THROW(contract = parseText(text)); + ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed"); auto functions = contract->getDefinedFunctions(); - BOOST_REQUIRE_NO_THROW(function = functions.at(0)); + ETH_TEST_REQUIRE_NO_THROW(function = functions.at(0), "Failed to retrieve function"); BOOST_CHECK_MESSAGE(!function->getDocumentation(), "Shouldn't get natspec docstring for this function"); } @@ -306,7 +290,7 @@ BOOST_AUTO_TEST_CASE(struct_definition) " uint256 count;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(mapping) @@ -314,7 +298,7 @@ BOOST_AUTO_TEST_CASE(mapping) char const* text = "contract test {\n" " mapping(address => string) names;\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(mapping_in_struct) @@ -326,7 +310,7 @@ BOOST_AUTO_TEST_CASE(mapping_in_struct) " mapping(hash => test_struct) self_reference;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(mapping_to_mapping_in_struct) @@ -337,7 +321,7 @@ BOOST_AUTO_TEST_CASE(mapping_to_mapping_in_struct) " mapping (uint64 => mapping (hash => uint)) complex_mapping;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(variable_definition) @@ -350,7 +334,7 @@ BOOST_AUTO_TEST_CASE(variable_definition) " customtype varname;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(variable_definition_with_initialization) @@ -364,7 +348,7 @@ BOOST_AUTO_TEST_CASE(variable_definition_with_initialization) " customtype varname;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(variable_definition_in_function_parameter) @@ -408,7 +392,7 @@ BOOST_AUTO_TEST_CASE(operator_expression) " uint256 x = (1 + 4) || false && (1 - 12) + -9;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(complex_expression) @@ -418,7 +402,7 @@ BOOST_AUTO_TEST_CASE(complex_expression) " uint256 x = (1 + 4).member(++67)[a/=9] || true;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(exp_expression) @@ -429,7 +413,7 @@ BOOST_AUTO_TEST_CASE(exp_expression) uint256 x = 3 ** a; } })"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(while_loop) @@ -439,7 +423,7 @@ BOOST_AUTO_TEST_CASE(while_loop) " while (true) { uint256 x = 1; break; continue; } x = 9;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(for_loop_vardef_initexpr) @@ -450,7 +434,7 @@ BOOST_AUTO_TEST_CASE(for_loop_vardef_initexpr) " { uint256 x = i; break; continue; }\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextExplainError(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(for_loop_simple_initexpr) @@ -462,7 +446,7 @@ BOOST_AUTO_TEST_CASE(for_loop_simple_initexpr) " { uint256 x = i; break; continue; }\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextExplainError(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(for_loop_simple_noexpr) @@ -474,7 +458,7 @@ BOOST_AUTO_TEST_CASE(for_loop_simple_noexpr) " { uint256 x = i; break; continue; }\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextExplainError(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(for_loop_single_stmt_body) @@ -486,7 +470,7 @@ BOOST_AUTO_TEST_CASE(for_loop_single_stmt_body) " continue;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseTextExplainError(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(if_statement) @@ -496,7 +480,7 @@ BOOST_AUTO_TEST_CASE(if_statement) " if (a >= 8) return 2; else { var b = 7; }\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(else_if_statement) @@ -506,7 +490,7 @@ BOOST_AUTO_TEST_CASE(else_if_statement) " if (a < 0) b = 0x67; else if (a == 0) b = 0x12; else b = 0x78;\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(statement_starting_with_type_conversion) @@ -518,7 +502,7 @@ BOOST_AUTO_TEST_CASE(statement_starting_with_type_conversion) " uint64[](3);\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(type_conversion_to_dynamic_array) @@ -528,7 +512,7 @@ BOOST_AUTO_TEST_CASE(type_conversion_to_dynamic_array) " var x = uint64[](3);\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(import_directive) @@ -539,7 +523,7 @@ BOOST_AUTO_TEST_CASE(import_directive) " uint64(2);\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(multiple_contracts) @@ -554,7 +538,7 @@ BOOST_AUTO_TEST_CASE(multiple_contracts) " uint64(2);\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(multiple_contracts_and_imports) @@ -572,7 +556,7 @@ BOOST_AUTO_TEST_CASE(multiple_contracts_and_imports) " }\n" "}\n" "import \"ghi\";\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(contract_inheritance) @@ -587,7 +571,7 @@ BOOST_AUTO_TEST_CASE(contract_inheritance) " uint64(2);\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(contract_multiple_inheritance) @@ -602,7 +586,7 @@ BOOST_AUTO_TEST_CASE(contract_multiple_inheritance) " uint64(2);\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(contract_multiple_inheritance_with_arguments) @@ -617,7 +601,7 @@ BOOST_AUTO_TEST_CASE(contract_multiple_inheritance_with_arguments) " uint64(2);\n" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(placeholder_in_function_context) @@ -628,7 +612,7 @@ BOOST_AUTO_TEST_CASE(placeholder_in_function_context) " return _ + 1;" " }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(modifier) @@ -636,7 +620,7 @@ BOOST_AUTO_TEST_CASE(modifier) char const* text = "contract c {\n" " modifier mod { if (msg.sender == 0) _ }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(modifier_arguments) @@ -644,7 +628,7 @@ BOOST_AUTO_TEST_CASE(modifier_arguments) char const* text = "contract c {\n" " modifier mod(uint a) { if (msg.sender == a) _ }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(modifier_invocation) @@ -654,7 +638,7 @@ BOOST_AUTO_TEST_CASE(modifier_invocation) " modifier mod2 { if (msg.sender == 2) _ }\n" " function f() mod1(7) mod2 { }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(fallback_function) @@ -662,7 +646,7 @@ BOOST_AUTO_TEST_CASE(fallback_function) char const* text = "contract c {\n" " function() { }\n" "}\n"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(event) @@ -671,7 +655,7 @@ BOOST_AUTO_TEST_CASE(event) contract c { event e(); })"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(event_arguments) @@ -680,7 +664,7 @@ BOOST_AUTO_TEST_CASE(event_arguments) contract c { event e(uint a, string32 s); })"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(event_arguments_indexed) @@ -689,7 +673,7 @@ BOOST_AUTO_TEST_CASE(event_arguments_indexed) contract c { event e(uint a, string32 indexed s, bool indexed b); })"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(visibility_specifiers) @@ -705,7 +689,7 @@ BOOST_AUTO_TEST_CASE(visibility_specifiers) function f_public() public {} function f_internal() internal {} })"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(multiple_visibility_specifiers) @@ -733,7 +717,7 @@ BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations) uint256 c; uint256 d; })"; - BOOST_CHECK_NO_THROW(parseTextExplainError(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations_in_expressions) @@ -746,7 +730,7 @@ BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations_in_expression } uint256 a; })"; - BOOST_CHECK_NO_THROW(parseTextExplainError(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(enum_valid_declaration) @@ -760,7 +744,7 @@ BOOST_AUTO_TEST_CASE(enum_valid_declaration) } uint256 a; })"; - BOOST_CHECK_NO_THROW(parseTextExplainError(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(empty_enum_declaration) @@ -769,7 +753,7 @@ BOOST_AUTO_TEST_CASE(empty_enum_declaration) contract c { enum foo { } })"; - BOOST_CHECK_NO_THROW(parseTextExplainError(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(malformed_enum_declaration) @@ -787,7 +771,7 @@ BOOST_AUTO_TEST_CASE(external_function) contract c { function x() external {} })"; - BOOST_CHECK_NO_THROW(parseTextExplainError(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(external_variable) @@ -808,7 +792,7 @@ BOOST_AUTO_TEST_CASE(arrays_in_storage) struct x { uint[2**20] b; y[0] c; } struct y { uint d; mapping(uint=>x)[] e; } })"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(arrays_in_events) @@ -817,7 +801,7 @@ BOOST_AUTO_TEST_CASE(arrays_in_events) contract c { event e(uint[10] a, string7[8] indexed b, c[3] x); })"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(arrays_in_expressions) @@ -826,7 +810,7 @@ BOOST_AUTO_TEST_CASE(arrays_in_expressions) contract c { function f() { c[10] a = 7; uint8[10 * 2] x; } })"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_CASE(multi_arrays) @@ -835,7 +819,7 @@ BOOST_AUTO_TEST_CASE(multi_arrays) contract c { mapping(uint => mapping(uint => int8)[8][][9])[] x; })"; - BOOST_CHECK_NO_THROW(parseText(text)); + ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/test/SolidityScanner.cpp b/test/SolidityScanner.cpp index 2e4e5db08..8d3e53929 100644 --- a/test/SolidityScanner.cpp +++ b/test/SolidityScanner.cpp @@ -264,6 +264,23 @@ BOOST_AUTO_TEST_CASE(ether_subdenominations) BOOST_CHECK_EQUAL(scanner.next(), Token::SubEther); } +BOOST_AUTO_TEST_CASE(time_subdenominations) +{ + Scanner scanner(CharStream("seconds minutes hours days weeks years")); + BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::SubSecond); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubMinute); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubHour); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubDay); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubWeek); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubYear); +} + +BOOST_AUTO_TEST_CASE(time_after) +{ + Scanner scanner(CharStream("after 1")); + BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::After); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 82add295e..befd571ea 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -69,7 +69,7 @@ namespace test struct ValueTooLarge: virtual Exception {}; bigint const c_max256plus1 = bigint(1) << 256; -ImportTest::ImportTest(json_spirit::mObject& _o, bool isFiller): m_TestObject(_o) +ImportTest::ImportTest(json_spirit::mObject& _o, bool isFiller) : m_statePre(Address(_o["env"].get_obj()["currentCoinbase"].get_str()), OverlayDB(), eth::BaseState::Empty), m_statePost(Address(_o["env"].get_obj()["currentCoinbase"].get_str()), OverlayDB(), eth::BaseState::Empty), m_TestObject(_o) { importEnv(_o["env"].get_obj()); importState(_o["pre"].get_obj(), m_statePre); @@ -183,13 +183,8 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) // export post state json_spirit::mObject postState; - std::map genesis = genesisState(); - for (auto const& a: _statePost.addresses()) { - if (genesis.count(a.first)) - continue; - json_spirit::mObject o; o["balance"] = toString(_statePost.balance(a.first)); o["nonce"] = toString(_statePost.transactionsFrom(a.first)); @@ -205,14 +200,13 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) } m_TestObject["post"] = json_spirit::mValue(postState); + m_TestObject["postStateRoot"] = toHex(_statePost.rootHash().asBytes()); + // export pre state json_spirit::mObject preState; for (auto const& a: m_statePre.addresses()) { - if (genesis.count(a.first)) - continue; - json_spirit::mObject o; o["balance"] = toString(m_statePre.balance(a.first)); o["nonce"] = toString(m_statePre.transactionsFrom(a.first)); diff --git a/test/TestHelper.h b/test/TestHelper.h index 6f9143c5c..0f23f945c 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -44,12 +44,64 @@ void connectClients(Client& c1, Client& c2); namespace test { +/// Make sure that no Exception is thrown during testing. If one is thrown show its info and fail the test. +/// Our version of BOOST_REQUIRE_NO_THROW() +/// @param _statenent The statement for which to make sure no exceptions are thrown +/// @param _message A message to act as a prefix to the expression's error information +#define ETH_TEST_REQUIRE_NO_THROW(_statement, _message) \ + do \ + { \ + try \ + { \ + BOOST_TEST_PASSPOINT(); \ + _statement; \ + } \ + catch (boost::exception const& _e) \ + { \ + auto msg = std::string(_message " due to an exception thrown by " \ + BOOST_STRINGIZE(_statement) "\n") + boost::diagnostic_information(_e); \ + BOOST_CHECK_IMPL(false, msg, REQUIRE, CHECK_MSG); \ + } \ + catch (...) \ + { \ + BOOST_CHECK_IMPL(false, "Unknown exception thrown by " \ + BOOST_STRINGIZE(_statement), REQUIRE, CHECK_MSG); \ + } \ + } \ + while (0) + +/// Check if an Exception is thrown during testing. If one is thrown show its info and continue the test +/// Our version of BOOST_CHECK_NO_THROW() +/// @param _statement The statement for which to make sure no exceptions are thrown +/// @param _message A message to act as a prefix to the expression's error information +#define ETH_TEST_CHECK_NO_THROW(_statement, _message) \ + do \ + { \ + try \ + { \ + BOOST_TEST_PASSPOINT(); \ + _statement; \ + } \ + catch (boost::exception const& _e) \ + { \ + auto msg = std::string(_message " due to an exception thrown by " \ + BOOST_STRINGIZE(_statement) "\n") + boost::diagnostic_information(_e); \ + BOOST_CHECK_IMPL(false, msg, CHECK, CHECK_MSG); \ + } \ + catch (...) \ + { \ + BOOST_CHECK_IMPL(false, "Unknown exception thrown by " \ + BOOST_STRINGIZE(_statement), CHECK, CHECK_MSG ); \ + } \ + } \ + while (0) + + class ImportTest { public: - ImportTest(json_spirit::mObject& _o) : m_TestObject(_o) {} + ImportTest(json_spirit::mObject& _o) : m_statePre(Address(), OverlayDB(), eth::BaseState::Empty), m_statePost(Address(), OverlayDB(), eth::BaseState::Empty), m_TestObject(_o) {} ImportTest(json_spirit::mObject& _o, bool isFiller); - // imports void importEnv(json_spirit::mObject& _o); void importState(json_spirit::mObject& _o, eth::State& _state); diff --git a/test/TrieHash.cpp b/test/TrieHash.cpp index ee4f2e87d..ccf12c162 100644 --- a/test/TrieHash.cpp +++ b/test/TrieHash.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include using namespace std; using namespace dev; using namespace dev::eth; diff --git a/test/bcBlockChainTestFiller.json b/test/bcBlockChainTestFiller.json new file mode 100644 index 000000000..b149f5938 --- /dev/null +++ b/test/bcBlockChainTestFiller.json @@ -0,0 +1,62 @@ +{ + "minDifficulty" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "100000000", + "gasUsed" : "0", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "8000000", + "gasPrice" : "0", + "nonce" : "1", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + } + ] + } +} diff --git a/test/bcInvalidHeaderTestFiller.json b/test/bcInvalidHeaderTestFiller.json new file mode 100644 index 000000000..39a91a583 --- /dev/null +++ b/test/bcInvalidHeaderTestFiller.json @@ -0,0 +1,774 @@ +{ + "log1_wrongBlockNumber" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "number" : "2" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "log1_wrongBloom" : { + + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongCoinbase" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongDifficulty" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "difficulty" : "10000" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "DifferentExtraData" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "extraData" : "0x42" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongGasLimit" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "gasLimit" : "100000" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + + ] + }, + + "wrongGasUsed" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "gasUsed" : "0" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongNumber" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "number" : "0" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongParentHash" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongReceiptTrie" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongStateRoot" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongTimestamp" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "timestamp" : "0x54c98c80" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongTransactionsTrie" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "transactionsTrie" : "0x55e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongUncleHash" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "uncleHash" : "0x0dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + } +} diff --git a/test/bcUncleTestFiller.json b/test/bcUncleTestFiller.json new file mode 100644 index 000000000..639051f2b --- /dev/null +++ b/test/bcUncleTestFiller.json @@ -0,0 +1,539 @@ +{ + "uncleHeaderAtBlock2" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "100000000", + "gasUsed" : "0", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "1", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0000000000000000000000000000000000000000", + "difficulty" : "131072", + "extraData" : "0x", + "gasLimit" : "99902343", + "gasUsed" : "0", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "18a524c1790fa83b", + "number" : "1", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "0x54c98c82", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + } + ] + }, + + "oneUncle" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "100000000", + "gasUsed" : "0", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "1", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "2", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0000000000000000000000000000000000000000", + "difficulty" : "131072", + "extraData" : "0x", + "gasLimit" : "99902343", + "gasUsed" : "0", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "18a524c1790fa83b", + "number" : "2", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "0x54c98c82", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + } + ] + }, + + "twoEqualUncle" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "100000000", + "gasUsed" : "0", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "1", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "2", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0000000000000000000000000000000000000000", + "difficulty" : "131072", + "extraData" : "0x", + "gasLimit" : "99902343", + "gasUsed" : "0", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "18a524c1790fa83b", + "number" : "2", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "0x54c98c82", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0000000000000000000000000000000000000000", + "difficulty" : "131072", + "extraData" : "0x", + "gasLimit" : "99902343", + "gasUsed" : "0", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "18a524c1790fa83b", + "number" : "2", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "0x54c98c82", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + } + ] + }, + + "twoUncle" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "100000000", + "gasUsed" : "0", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "1", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "2", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0000000000000000000000000000000000000000", + "difficulty" : "131072", + "extraData" : "0x", + "gasLimit" : "99902343", + "gasUsed" : "0", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "18a524c1790fa83b", + "number" : "2", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "0x54c98c82", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0000000000000000000000000000000000000000", + "difficulty" : "131072", + "extraData" : "0x", + "gasLimit" : "99902343", + "gasUsed" : "0", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "b55af905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "18a524c1790fa83b", + "number" : "2", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "0x54c98c82", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + } + ] + }, + + "threeUncle" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "100000000", + "gasUsed" : "0", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "1", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "80000050", + "gasPrice" : "1", + "nonce" : "2", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0000000000000000000000000000000000000000", + "difficulty" : "131072", + "extraData" : "0x", + "gasLimit" : "99902343", + "gasUsed" : "0", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "18a524c1790fa83b", + "number" : "2", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "0x54c98c82", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0000000000000000000000000000000000000000", + "difficulty" : "131072", + "extraData" : "0x", + "gasLimit" : "99902343", + "gasUsed" : "0", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "b55af905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "18a524c1790fa83b", + "number" : "2", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "0x54c98c82", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0000000000000000000000000000000000000000", + "difficulty" : "131072", + "extraData" : "0x", + "gasLimit" : "99902343", + "gasUsed" : "0", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "a55af905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "18a524c1790fa83b", + "number" : "2", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "0x54c98c82", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + } + ] + } + + +} diff --git a/test/bcValidBlockTestFiller.json b/test/bcValidBlockTestFiller.json new file mode 100644 index 000000000..14d4cfb2c --- /dev/null +++ b/test/bcValidBlockTestFiller.json @@ -0,0 +1,397 @@ +{ + + "diff1024" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "85000", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + } + ] + + }, + + "gasPrice0" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "85000", + "gasPrice" : "0", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "gasLimitTooHigh" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "1000001", + "gasPrice" : "0", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "SimpleTx" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "txOrder" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "7000000000" + }, + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "8000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "txEqualValue" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + }, + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "9", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "log1_correct" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000000000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "dataTx" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "125000", + "gasUsed" : "100", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "seedHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0xefb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "0x60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b56", + "gasLimit" : "50000", + "gasPrice" : "50", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "" + } + ], + "uncleHeaders" : [ + ] + } + ] + } +} + + diff --git a/test/blInvalidHeaderTestFiller.json b/test/blInvalidHeaderTestFiller.json deleted file mode 100644 index 482eafc56..000000000 --- a/test/blInvalidHeaderTestFiller.json +++ /dev/null @@ -1,687 +0,0 @@ -{ - "log1_wrongBlockNumber" : { - "blockHeader" : { - "number" : "2" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "log1_wrongBloom" : { - "blockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongCoinbase" : { - "blockHeader" : { - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongDifficulty" : { - "blockHeader" : { - "difficulty" : "10000" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "DifferentExtraData" : { - "blockHeader" : { - "extraData" : "42" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongGasLimit" : { - "blockHeader" : { - "gasLimit" : "100000" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongGasUsed" : { - "blockHeader" : { - "gasUsed" : "0" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongNumber" : { - "blockHeader" : { - "number" : "0" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongParentHash" : { - "blockHeader" : { - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongReceiptTrie" : { - "blockHeader" : { - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongStateRoot" : { - "blockHeader" : { - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongTimestamp" : { - "blockHeader" : { - "timestamp" : "0x54c98c80" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongTransactionsTrie" : { - "blockHeader" : { - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "wrongUncleHash" : { - "blockHeader" : { - "uncleHash" : "0x0dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - } -} diff --git a/test/blValidBlockTestFiller.json b/test/blValidBlockTestFiller.json deleted file mode 100644 index 8099c0dd6..000000000 --- a/test/blValidBlockTestFiller.json +++ /dev/null @@ -1,381 +0,0 @@ -{ - "diffTooLowToChange" : { - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "1023", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "850", - "gasPrice" : "1", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - - "diff1024" : { - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "1024", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "850", - "gasPrice" : "1", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - - "gasPrice0" : { - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "850", - "gasPrice" : "0", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - - "gasLimitTooHigh" : { - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "1000000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "850", - "gasPrice" : "0", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - - "SimpleTx" : { - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "500", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "10" - } - ], - "uncleHeaders" : [ - ] - }, - - "txOrder" : { - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "500", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "7000000000" - }, - { - "data" : "", - "gasLimit" : "500", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "8000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "txEqualValue" : { - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "500", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - }, - { - "data" : "", - "gasLimit" : "500", - "gasPrice" : "9", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ] - }, - - "log1_correct" : { - "genesisBlockHeader" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "10000", - "extraData" : "42", - "gasLimit" : "100000", - "gasUsed" : "0", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "0", - "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", - "nonce" : "0", - "code" : "", - "storage": {} - }, - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "100", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", - "storage": {} - } - }, - "transactions" : [ - { - "data" : "", - "gasLimit" : "5000", - "gasPrice" : "10", - "nonce" : "0", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" - } - ], - "uncleHeaders" : [ - ], - - "firstBlockTest" : { - "block" : { - "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", - "difficulty" : "023101", - "extraData" : "42", - "gasLimit" : "0x0dddb6", - "gasUsed" : "100", - "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d", - "number" : "62", - "parentHash" : "0xefb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5", - "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", - "timestamp" : "0x54c98c81", - "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", - "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" - }, - "pre" : { - }, - "transactions" : [ - { - "data" : "0x60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b56", - "gasLimit" : "0x0f3e6f", - "gasPrice" : "0x09184e72a000", - "nonce" : "0", - "r" : "0xd4287e915ebac7a8af390560fa53c8f0b7f13802ba0393d7afa5823c2560ca89", - "s" : "0xae75db31a34f7e386ad459646de98ec3a1c88cc91b11620b4ffd86871f579942", - "to" : "", - "v" : "0x1b", - "value" : "" - } - ], - } - - } -} - diff --git a/test/block.cpp b/test/block.cpp deleted file mode 100644 index 7c50eef4d..000000000 --- a/test/block.cpp +++ /dev/null @@ -1,521 +0,0 @@ -/* - This file is part of cpp-ethereum. - - cpp-ethereum is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - cpp-ethereum is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . -*/ -/** @file block.cpp - * @author Christoph Jentzsch - * @date 2015 - * block test functions. - */ - -#include -#include -#include "TestHelper.h" - -using namespace std; -using namespace json_spirit; -using namespace dev; -using namespace dev::eth; - -namespace dev { namespace test { - -bytes createBlockRLPFromFields(mObject& _tObj) -{ - RLPStream rlpStream; - rlpStream.appendList(_tObj.size()); - - if (_tObj.count("parentHash")) - rlpStream << importByteArray(_tObj["parentHash"].get_str()); - - if (_tObj.count("uncleHash")) - rlpStream << importByteArray(_tObj["uncleHash"].get_str()); - - if (_tObj.count("coinbase")) - rlpStream << importByteArray(_tObj["coinbase"].get_str()); - - if (_tObj.count("stateRoot")) - rlpStream << importByteArray(_tObj["stateRoot"].get_str()); - - if (_tObj.count("transactionsTrie")) - rlpStream << importByteArray(_tObj["transactionsTrie"].get_str()); - - if (_tObj.count("receiptTrie")) - rlpStream << importByteArray(_tObj["receiptTrie"].get_str()); - - if (_tObj.count("bloom")) - rlpStream << importByteArray(_tObj["bloom"].get_str()); - - if (_tObj.count("difficulty")) - rlpStream << bigint(_tObj["difficulty"].get_str()); - - if (_tObj.count("number")) - rlpStream << bigint(_tObj["number"].get_str()); - - if (_tObj.count("gasLimit")) - rlpStream << bigint(_tObj["gasLimit"].get_str()); - - if (_tObj.count("gasUsed")) - rlpStream << bigint(_tObj["gasUsed"].get_str()); - - if (_tObj.count("timestamp")) - rlpStream << bigint(_tObj["timestamp"].get_str()); - - if (_tObj.count("extraData")) - rlpStream << importByteArray(_tObj["extraData"].get_str()); - - if (_tObj.count("nonce")) - rlpStream << importByteArray(_tObj["nonce"].get_str()); - - return rlpStream.out(); -} - -void overwriteBlockHeader(mObject& _o, BlockInfo _current_BlockHeader) -{ - if (_o.count("blockHeader")) - { - if (_o["blockHeader"].get_obj().size() != 14) - { - - BlockInfo tmp = _current_BlockHeader; - - if (_o["blockHeader"].get_obj().count("parentHash")) - tmp.parentHash = h256(_o["blockHeader"].get_obj()["parentHash"].get_str()); - - if (_o["blockHeader"].get_obj().count("uncleHash")) - tmp.sha3Uncles = h256(_o["blockHeader"].get_obj()["uncleHash"].get_str()); - - if (_o["blockHeader"].get_obj().count("coinbase")) - tmp.coinbaseAddress = Address(_o["blockHeader"].get_obj()["coinbase"].get_str()); - - if (_o["blockHeader"].get_obj().count("stateRoot")) - tmp.stateRoot = h256(_o["blockHeader"].get_obj()["stateRoot"].get_str()); - - if (_o["blockHeader"].get_obj().count("transactionsTrie")) - tmp.transactionsRoot = h256(_o["blockHeader"].get_obj()["transactionsTrie"].get_str()); - - if (_o["blockHeader"].get_obj().count("receiptTrie")) - tmp.receiptsRoot = h256(_o["blockHeader"].get_obj()["receiptTrie"].get_str()); - - if (_o["blockHeader"].get_obj().count("bloom")) - tmp.logBloom = LogBloom(_o["blockHeader"].get_obj()["bloom"].get_str()); - - if (_o["blockHeader"].get_obj().count("difficulty")) - tmp.difficulty = toInt(_o["blockHeader"].get_obj()["difficulty"]); - - if (_o["blockHeader"].get_obj().count("number")) - tmp.number = toInt(_o["blockHeader"].get_obj()["number"]); - - if (_o["blockHeader"].get_obj().count("gasLimit")) - tmp.gasLimit = toInt(_o["blockHeader"].get_obj()["gasLimit"]); - - if (_o["blockHeader"].get_obj().count("gasUsed")) - tmp.gasUsed = toInt(_o["blockHeader"].get_obj()["gasUsed"]); - - if (_o["blockHeader"].get_obj().count("timestamp")) - tmp.timestamp = toInt(_o["blockHeader"].get_obj()["timestamp"]); - - if (_o["blockHeader"].get_obj().count("extraData")) - tmp.extraData = importByteArray(_o["blockHeader"].get_obj()["extraData"].get_str()); - - // find new valid nonce - - if (tmp != _current_BlockHeader) - { - _current_BlockHeader = tmp; - cout << "new header!\n"; - ProofOfWork pow; - MineInfo ret; - while (!ProofOfWork::verify(_current_BlockHeader.headerHash(WithoutNonce), _current_BlockHeader.nonce, _current_BlockHeader.difficulty)) - tie(ret, _current_BlockHeader.nonce) = pow.mine(_current_BlockHeader.headerHash(WithoutNonce), _current_BlockHeader.difficulty, 10000, true, true); - } - } - else - { - // take the blockheader as is - const bytes c_blockRLP = createBlockRLPFromFields(_o["blockHeader"].get_obj()); - const RLP c_bRLP(c_blockRLP); - _current_BlockHeader.populateFromHeader(c_bRLP, false); - } - } -} - -void doBlockTests(json_spirit::mValue& _v, bool _fillin) -{ - for (auto& i: _v.get_obj()) - { - cerr << i.first << endl; - mObject& o = i.second.get_obj(); - - BOOST_REQUIRE(o.count("genesisBlockHeader")); - BlockInfo blockFromFields; - try - { - // construct genesis block - const bytes c_blockRLP = createBlockRLPFromFields(o["genesisBlockHeader"].get_obj()); - const RLP c_bRLP(c_blockRLP); - blockFromFields.populateFromHeader(c_bRLP, false); - } - catch (Exception const& _e) - { - cnote << "block population did throw an exception: " << diagnostic_information(_e); - BOOST_ERROR("Failed block population with Exception: " << _e.what()); - continue; - } - catch (std::exception const& _e) - { - BOOST_ERROR("Failed block population with Exception: " << _e.what()); - continue; - } - catch(...) - { - cnote << "block population did throw an unknown exception\n"; - continue; - } - - BOOST_REQUIRE(o.count("pre")); - - ImportTest importer(o["pre"].get_obj()); - State state(Address(), OverlayDB(), BaseState::Empty); - importer.importState(o["pre"].get_obj(), state); - state.commit(); - - if (_fillin) - blockFromFields.stateRoot = state.rootHash(); - else - BOOST_CHECK_MESSAGE(blockFromFields.stateRoot == state.rootHash(), "root hash does not match"); - - if (_fillin) - { - // find new valid nonce - ProofOfWork pow; - MineInfo ret; - while (!ProofOfWork::verify(blockFromFields.headerHash(WithoutNonce), blockFromFields.nonce, blockFromFields.difficulty)) - tie(ret, blockFromFields.nonce) = pow.mine(blockFromFields.headerHash(WithoutNonce), blockFromFields.difficulty, 1000, true, true); - - //update genesis block in json file - o["genesisBlockHeader"].get_obj()["stateRoot"] = toString(blockFromFields.stateRoot); - o["genesisBlockHeader"].get_obj()["nonce"] = toString(blockFromFields.nonce); - } - - // create new "genesis" block - RLPStream rlpStream; - blockFromFields.streamRLP(rlpStream, WithNonce); - - RLPStream block(3); - block.appendRaw(rlpStream.out()); - block.appendRaw(RLPEmptyList); - block.appendRaw(RLPEmptyList); - - blockFromFields.verifyInternals(&block.out()); - - // construct blockchain - BlockChain bc(block.out(), string(), true); - - if (_fillin) - { - BOOST_REQUIRE(o.count("transactions")); - - TransactionQueue txs; - - for (auto const& txObj: o["transactions"].get_array()) - { - mObject tx = txObj.get_obj(); - importer.importTransaction(tx); - if (!txs.attemptImport(importer.m_transaction.rlp())) - cnote << "failed importing transaction\n"; - } - - try - { - state.sync(bc); - state.sync(bc,txs); - state.commitToMine(bc); - MineInfo info; - for (info.completed = false; !info.completed; info = state.mine()) {} - state.completeMine(); - } - catch (Exception const& _e) - { - cnote << "state sync or mining did throw an exception: " << diagnostic_information(_e); - return; - } - catch (std::exception const& _e) - { - cnote << "state sync or mining did throw an exception: " << _e.what(); - return; - } - - // write valid txs - mArray txArray; - Transactions txList; - for (auto const& txi: txs.transactions()) - { - Transaction tx(txi.second, CheckSignature::Sender); - txList.push_back(tx); - mObject txObject; - txObject["nonce"] = toString(tx.nonce()); - txObject["data"] = toHex(tx.data()); - txObject["gasLimit"] = toString(tx.gas()); - txObject["gasPrice"] = toString(tx.gasPrice()); - txObject["r"] = "0x" + toString(tx.signature().r); - txObject["s"] = "0x" + toString(tx.signature().s); - txObject["v"] = to_string(tx.signature().v + 27); - txObject["to"] = toString(tx.receiveAddress()); - txObject["value"] = toString(tx.value()); - - txArray.push_back(txObject); - } - - o["transactions"] = txArray; - o["rlp"] = "0x" + toHex(state.blockData()); - - BlockInfo current_BlockHeader = state.info(); - - // overwrite blockheader with (possible wrong) data from "blockheader" in filler; - overwriteBlockHeader(o, current_BlockHeader); - - // write block header - mObject oBlockHeader; - oBlockHeader["parentHash"] = toString(current_BlockHeader.parentHash); - oBlockHeader["uncleHash"] = toString(current_BlockHeader.sha3Uncles); - oBlockHeader["coinbase"] = toString(current_BlockHeader.coinbaseAddress); - oBlockHeader["stateRoot"] = toString(current_BlockHeader.stateRoot); - oBlockHeader["transactionsTrie"] = toString(current_BlockHeader.transactionsRoot); - oBlockHeader["receiptTrie"] = toString(current_BlockHeader.receiptsRoot); - oBlockHeader["bloom"] = toString(current_BlockHeader.logBloom); - oBlockHeader["difficulty"] = toString(current_BlockHeader.difficulty); - oBlockHeader["number"] = toString(current_BlockHeader.number); - oBlockHeader["gasLimit"] = toString(current_BlockHeader.gasLimit); - oBlockHeader["gasUsed"] = toString(current_BlockHeader.gasUsed); - oBlockHeader["timestamp"] = toString(current_BlockHeader.timestamp); - oBlockHeader["extraData"] = toHex(current_BlockHeader.extraData); - oBlockHeader["nonce"] = toString(current_BlockHeader.nonce); - - o["blockHeader"] = oBlockHeader; - - // write uncle list - mArray aUncleList; // as of now, our parent is always the genesis block, so we can not have uncles. - o["uncleHeaders"] = aUncleList; - - //txs: - - RLPStream txStream; - txStream.appendList(txList.size()); - for (unsigned i = 0; i < txList.size(); ++i) - { - RLPStream txrlp; - txList[i].streamRLP(txrlp); - txStream.appendRaw(txrlp.out()); - } - - RLPStream rlpStream2; - current_BlockHeader.streamRLP(rlpStream2, WithNonce); - - RLPStream block2(3); - block2.appendRaw(rlpStream2.out()); - block2.appendRaw(txStream.out()); - block2.appendRaw(RLPEmptyList); - - o["rlp"] = "0x" + toHex(block2.out()); - - if (sha3(RLP(state.blockData())[0].data()) != sha3(RLP(block2.out())[0].data())) - cnote << "block header mismatch\n"; - - if (sha3(RLP(state.blockData())[1].data()) != sha3(RLP(block2.out())[1].data())) - cnote << "txs mismatch\n"; - - if (sha3(RLP(state.blockData())[2].data()) != sha3(RLP(block2.out())[2].data())) - cnote << "uncle list mismatch\n"; - - try - { - ImportTest importerTmp(o["pre"].get_obj()); - State stateTmp(Address(), OverlayDB(), BaseState::Empty); - importerTmp.importState(o["pre"].get_obj(), stateTmp); - stateTmp.commit(); - BlockChain bcTmp(block.out(), getDataDir() + "/tmpBlockChain.bc", true); - stateTmp.sync(bcTmp); - bc.import(block2.out(), stateTmp.db()); - stateTmp.sync(bcTmp); - } - // if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given - catch (...) - { - cnote << "block is invalid!\n"; - o.erase(o.find("blockHeader")); - o.erase(o.find("uncleHeaders")); - o.erase(o.find("transactions")); - } - } - - else - { - bytes blockRLP; - try - { - state.sync(bc); - blockRLP = importByteArray(o["rlp"].get_str()); - bc.import(blockRLP, state.db()); - state.sync(bc); - } - // if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given - catch (Exception const& _e) - { - cnote << "state sync or block import did throw an exception: " << diagnostic_information(_e); - BOOST_CHECK(o.count("blockHeader") == 0); - BOOST_CHECK(o.count("transactions") == 0); - BOOST_CHECK(o.count("uncleHeaders") == 0); - continue; - } - catch (std::exception const& _e) - { - cnote << "state sync or block import did throw an exception: " << _e.what(); - BOOST_CHECK(o.count("blockHeader") == 0); - BOOST_CHECK(o.count("transactions") == 0); - BOOST_CHECK(o.count("uncleHeaders") == 0); - continue; - } - catch(...) - { - cnote << "state sync or block import did throw an exception\n"; - BOOST_CHECK(o.count("blockHeader") == 0); - BOOST_CHECK(o.count("transactions") == 0); - BOOST_CHECK(o.count("uncleHeaders") == 0); - continue; - } - - BOOST_REQUIRE(o.count("blockHeader")); - - mObject tObj = o["blockHeader"].get_obj(); - BlockInfo blockHeaderFromFields; - const bytes c_rlpBytesBlockHeader = createBlockRLPFromFields(tObj); - const RLP c_blockHeaderRLP(c_rlpBytesBlockHeader); - blockHeaderFromFields.populateFromHeader(c_blockHeaderRLP, false); - - BlockInfo blockFromRlp = bc.info(); - - //Check the fields restored from RLP to original fields - BOOST_CHECK_MESSAGE(blockHeaderFromFields.headerHash(WithNonce) == blockFromRlp.headerHash(WithNonce), "hash in given RLP not matching the block hash!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.parentHash == blockFromRlp.parentHash, "parentHash in given RLP not matching the block parentHash!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.sha3Uncles == blockFromRlp.sha3Uncles, "sha3Uncles in given RLP not matching the block sha3Uncles!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.coinbaseAddress == blockFromRlp.coinbaseAddress,"coinbaseAddress in given RLP not matching the block coinbaseAddress!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.stateRoot == blockFromRlp.stateRoot, "stateRoot in given RLP not matching the block stateRoot!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.transactionsRoot == blockFromRlp.transactionsRoot, "transactionsRoot in given RLP not matching the block transactionsRoot!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.receiptsRoot == blockFromRlp.receiptsRoot, "receiptsRoot in given RLP not matching the block receiptsRoot!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.logBloom == blockFromRlp.logBloom, "logBloom in given RLP not matching the block logBloom!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.difficulty == blockFromRlp.difficulty, "difficulty in given RLP not matching the block difficulty!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.number == blockFromRlp.number, "number in given RLP not matching the block number!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasLimit == blockFromRlp.gasLimit,"gasLimit in given RLP not matching the block gasLimit!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasUsed == blockFromRlp.gasUsed, "gasUsed in given RLP not matching the block gasUsed!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.timestamp == blockFromRlp.timestamp, "timestamp in given RLP not matching the block timestamp!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.extraData == blockFromRlp.extraData, "extraData in given RLP not matching the block extraData!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.nonce == blockFromRlp.nonce, "nonce in given RLP not matching the block nonce!"); - - BOOST_CHECK_MESSAGE(blockHeaderFromFields == blockFromRlp, "However, blockHeaderFromFields != blockFromRlp!"); - - //Check transaction list - Transactions txsFromField; - - for (auto const& txObj: o["transactions"].get_array()) - { - mObject tx = txObj.get_obj(); - - BOOST_REQUIRE(tx.count("nonce")); - BOOST_REQUIRE(tx.count("gasPrice")); - BOOST_REQUIRE(tx.count("gasLimit")); - BOOST_REQUIRE(tx.count("to")); - BOOST_REQUIRE(tx.count("value")); - BOOST_REQUIRE(tx.count("v")); - BOOST_REQUIRE(tx.count("r")); - BOOST_REQUIRE(tx.count("s")); - BOOST_REQUIRE(tx.count("data")); - - try - { - Transaction t(createRLPStreamFromTransactionFields(tx).out(), CheckSignature::Sender); - txsFromField.push_back(t); - } - catch (Exception const& _e) - { - BOOST_ERROR("Failed transaction constructor with Exception: " << diagnostic_information(_e)); - } - catch (exception const& _e) - { - cnote << _e.what(); - } - } - - Transactions txsFromRlp; - RLP root(blockRLP); - for (auto const& tr: root[1]) - { - Transaction tx(tr.data(), CheckSignature::Sender); - txsFromRlp.push_back(tx); - } - - BOOST_CHECK_MESSAGE(txsFromRlp.size() == txsFromField.size(), "transaction list size does not match"); - - for (size_t i = 0; i < txsFromField.size(); ++i) - { - BOOST_CHECK_MESSAGE(txsFromField[i].data() == txsFromRlp[i].data(), "transaction data in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].gas() == txsFromRlp[i].gas(), "transaction gasLimit in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].gasPrice() == txsFromRlp[i].gasPrice(), "transaction gasPrice in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].nonce() == txsFromRlp[i].nonce(), "transaction nonce in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].signature().r == txsFromRlp[i].signature().r, "transaction r in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].signature().s == txsFromRlp[i].signature().s, "transaction s in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].signature().v == txsFromRlp[i].signature().v, "transaction v in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].receiveAddress() == txsFromRlp[i].receiveAddress(), "transaction receiveAddress in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].value() == txsFromRlp[i].value(), "transaction receiveAddress in rlp and in field do not match"); - - BOOST_CHECK_MESSAGE(txsFromField[i] == txsFromRlp[i], "transactions in rlp and in transaction field do not match"); - } - - // check uncle list - BOOST_CHECK_MESSAGE((o["uncleList"].type() == json_spirit::null_type ? 0 : o["uncleList"].get_array().size()) == 0, "Uncle list is not empty, but the genesis block can not have uncles"); - } - } -} - -} }// Namespace Close - - -BOOST_AUTO_TEST_SUITE(BlockTests) - -BOOST_AUTO_TEST_CASE(blValidBlockTest) -{ - dev::test::executeTests("blValidBlockTest", "/BlockTests", dev::test::doBlockTests); -} - -BOOST_AUTO_TEST_CASE(blInvalidTransactionRLP) -{ - dev::test::executeTests("blInvalidTransactionRLP", "/BlockTests", dev::test::doBlockTests); -} - -BOOST_AUTO_TEST_CASE(blInvalidHeaderTest) -{ - dev::test::executeTests("blInvalidHeaderTest", "/BlockTests", dev::test::doBlockTests); -} - -BOOST_AUTO_TEST_CASE(blForkBlocks) -{ - dev::test::executeTests("blForkBlocks", "/BlockTests", dev::test::doBlockTests); -} - -BOOST_AUTO_TEST_CASE(userDefinedFile) -{ - dev::test::userDefinedTest("--singletest", dev::test::doBlockTests); -} - -BOOST_AUTO_TEST_SUITE_END() diff --git a/test/blockchain.cpp b/test/blockchain.cpp new file mode 100644 index 000000000..0e1128ef9 --- /dev/null +++ b/test/blockchain.cpp @@ -0,0 +1,648 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file block.cpp + * @author Christoph Jentzsch + * @date 2015 + * block test functions. + */ + +#include +#include +#include "TestHelper.h" + +using namespace std; +using namespace json_spirit; +using namespace dev; +using namespace dev::eth; + +namespace dev { namespace test { + +bytes createBlockRLPFromFields(mObject& _tObj); +void overwriteBlockHeader(BlockInfo& _current_BlockHeader, mObject& _blObj); +BlockInfo constructBlock(mObject& _o); +void updatePoW(BlockInfo& _bi); +void writeBlockHeaderToJson(mObject& _o, const BlockInfo& _bi); +RLPStream createFullBlockFromHeader(const BlockInfo& _bi, const bytes& _txs = RLPEmptyList, const bytes& _uncles = RLPEmptyList); + +void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) +{ + for (auto& i: _v.get_obj()) + { + cerr << i.first << endl; + mObject& o = i.second.get_obj(); + + BOOST_REQUIRE(o.count("genesisBlockHeader")); + BlockInfo biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj()); + + BOOST_REQUIRE(o.count("pre")); + ImportTest importer(o["pre"].get_obj()); + State state(Address(), OverlayDB(), BaseState::Empty); + importer.importState(o["pre"].get_obj(), state); + state.commit(); + + if (_fillin) + biGenesisBlock.stateRoot = state.rootHash(); + else + BOOST_CHECK_MESSAGE(biGenesisBlock.stateRoot == state.rootHash(), "root hash does not match"); + + if (_fillin) + { + // find new valid nonce + updatePoW(biGenesisBlock); + + //update genesis block in json file + writeBlockHeaderToJson(o["genesisBlockHeader"].get_obj(), biGenesisBlock); + } + + // create new "genesis" block + RLPStream rlpGenesisBlock = createFullBlockFromHeader(biGenesisBlock); + biGenesisBlock.verifyInternals(&rlpGenesisBlock.out()); + + // construct blockchain + BlockChain bc(rlpGenesisBlock.out(), string(), true); + + if (_fillin) + { + BOOST_REQUIRE(o.count("blocks")); + mArray blArray; + vector vBiBlocks; + vBiBlocks.push_back(biGenesisBlock); + for (auto const& bl: o["blocks"].get_array()) + { + mObject blObj = bl.get_obj(); + + // get txs + TransactionQueue txs; + TrivialGasPricer gp; + BOOST_REQUIRE(blObj.count("transactions")); + for (auto const& txObj: blObj["transactions"].get_array()) + { + mObject tx = txObj.get_obj(); + importer.importTransaction(tx); + if (!txs.attemptImport(importer.m_transaction.rlp())) + cnote << "failed importing transaction\n"; + } + + // write uncle list + BlockQueue uncleBlockQueue; + mArray aUncleList; + vector vBiUncles; + + for (auto const& uHObj: blObj["uncleHeaders"].get_array()) + { + mObject uncleHeaderObj = uHObj.get_obj(); + BlockInfo uncleBlockFromFields = constructBlock(uncleHeaderObj); + + // make uncle header valid + uncleBlockFromFields.timestamp = (u256)time(0); + if (vBiBlocks.size() > 2) + uncleBlockFromFields.populateFromParent(vBiBlocks[vBiBlocks.size()-2]); + else + continue; + + updatePoW(uncleBlockFromFields); + writeBlockHeaderToJson(uncleHeaderObj, uncleBlockFromFields); + + aUncleList.push_back(uncleHeaderObj); + vBiUncles.push_back(uncleBlockFromFields); + + cnote << "import uncle in blockQueue"; + RLPStream uncle = createFullBlockFromHeader(uncleBlockFromFields); + uncleBlockQueue.import(&uncle.out(), bc); + } + + blObj["uncleHeaders"] = aUncleList; + bc.sync(uncleBlockQueue, state.db(), 4); + state.commitToMine(bc); + + try + { + state.sync(bc); + state.sync(bc, txs, gp); + state.commitToMine(bc); + MineInfo info; + for (info.completed = false; !info.completed; info = state.mine()) {} + state.completeMine(); + } + catch (Exception const& _e) + { + cnote << "state sync or mining did throw an exception: " << diagnostic_information(_e); + return; + } + catch (std::exception const& _e) + { + cnote << "state sync or mining did throw an exception: " << _e.what(); + return; + } + + blObj["rlp"] = "0x" + toHex(state.blockData()); + + // write valid txs + mArray txArray; + Transactions txList; + for (auto const& txi: txs.transactions()) + { + Transaction tx(txi.second, CheckSignature::Sender); + txList.push_back(tx); + mObject txObject; + txObject["nonce"] = toString(tx.nonce()); + txObject["data"] = "0x" + toHex(tx.data()); + txObject["gasLimit"] = toString(tx.gas()); + txObject["gasPrice"] = toString(tx.gasPrice()); + txObject["r"] = "0x" + toString(tx.signature().r); + txObject["s"] = "0x" + toString(tx.signature().s); + txObject["v"] = to_string(tx.signature().v + 27); + txObject["to"] = tx.isCreation() ? "" : toString(tx.receiveAddress()); + txObject["value"] = toString(tx.value()); + + txArray.push_back(txObject); + } + + blObj["transactions"] = txArray; + + BlockInfo current_BlockHeader = state.info(); + + if (blObj.count("blockHeader")) + overwriteBlockHeader(current_BlockHeader, blObj); + + // write block header + mObject oBlockHeader; + writeBlockHeaderToJson(oBlockHeader, current_BlockHeader); + blObj["blockHeader"] = oBlockHeader; + vBiBlocks.push_back(current_BlockHeader); + + // compare blocks from state and from rlp + RLPStream txStream; + txStream.appendList(txList.size()); + for (unsigned i = 0; i < txList.size(); ++i) + { + RLPStream txrlp; + txList[i].streamRLP(txrlp); + txStream.appendRaw(txrlp.out()); + } + + RLPStream uncleStream; + uncleStream.appendList(vBiUncles.size()); + for (unsigned i = 0; i < vBiUncles.size(); ++i) + { + RLPStream uncleRlp; + vBiUncles[i].streamRLP(uncleRlp, WithNonce); + uncleStream.appendRaw(uncleRlp.out()); + } + + RLPStream block2 = createFullBlockFromHeader(current_BlockHeader, txStream.out(), uncleStream.out()); + + blObj["rlp"] = "0x" + toHex(block2.out()); + + if (sha3(RLP(state.blockData())[0].data()) != sha3(RLP(block2.out())[0].data())) + cnote << "block header mismatch\n"; + + if (sha3(RLP(state.blockData())[1].data()) != sha3(RLP(block2.out())[1].data())) + cnote << "txs mismatch\n"; + + if (sha3(RLP(state.blockData())[2].data()) != sha3(RLP(block2.out())[2].data())) + cnote << "uncle list mismatch\n" << RLP(state.blockData())[2].data() << "\n" << RLP(block2.out())[2].data(); + + try + { + state.sync(bc); + bc.import(block2.out(), state.db()); + state.sync(bc); + state.commit(); + } + // if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given + catch (...) + { + cnote << "block is invalid!\n"; + blObj.erase(blObj.find("blockHeader")); + blObj.erase(blObj.find("uncleHeaders")); + blObj.erase(blObj.find("transactions")); + } + blArray.push_back(blObj); + } + o["blocks"] = blArray; + } + + else + { + for (auto const& bl: o["blocks"].get_array()) + { + mObject blObj = bl.get_obj(); + bytes blockRLP; + try + { + state.sync(bc); + blockRLP = importByteArray(blObj["rlp"].get_str()); + bc.import(blockRLP, state.db()); + state.sync(bc); + } + // if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given + catch (Exception const& _e) + { + cnote << "state sync or block import did throw an exception: " << diagnostic_information(_e); + BOOST_CHECK(blObj.count("blockHeader") == 0); + BOOST_CHECK(blObj.count("transactions") == 0); + BOOST_CHECK(blObj.count("uncleHeaders") == 0); + continue; + } + catch (std::exception const& _e) + { + cnote << "state sync or block import did throw an exception: " << _e.what(); + BOOST_CHECK(blObj.count("blockHeader") == 0); + BOOST_CHECK(blObj.count("transactions") == 0); + BOOST_CHECK(blObj.count("uncleHeaders") == 0); + continue; + } + catch(...) + { + cnote << "state sync or block import did throw an exception\n"; + BOOST_CHECK(blObj.count("blockHeader") == 0); + BOOST_CHECK(blObj.count("transactions") == 0); + BOOST_CHECK(blObj.count("uncleHeaders") == 0); + continue; + } + + BOOST_REQUIRE(blObj.count("blockHeader")); + + mObject tObj = blObj["blockHeader"].get_obj(); + BlockInfo blockHeaderFromFields; + const bytes c_rlpBytesBlockHeader = createBlockRLPFromFields(tObj); + const RLP c_blockHeaderRLP(c_rlpBytesBlockHeader); + blockHeaderFromFields.populateFromHeader(c_blockHeaderRLP, IgnoreNonce); + + BlockInfo blockFromRlp = bc.info(); + + //Check the fields restored from RLP to original fields + BOOST_CHECK_MESSAGE(blockHeaderFromFields.headerHash(WithNonce) == blockFromRlp.headerHash(WithNonce), "hash in given RLP not matching the block hash!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.parentHash == blockFromRlp.parentHash, "parentHash in given RLP not matching the block parentHash!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.sha3Uncles == blockFromRlp.sha3Uncles, "sha3Uncles in given RLP not matching the block sha3Uncles!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.coinbaseAddress == blockFromRlp.coinbaseAddress,"coinbaseAddress in given RLP not matching the block coinbaseAddress!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.stateRoot == blockFromRlp.stateRoot, "stateRoot in given RLP not matching the block stateRoot!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.transactionsRoot == blockFromRlp.transactionsRoot, "transactionsRoot in given RLP not matching the block transactionsRoot!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.receiptsRoot == blockFromRlp.receiptsRoot, "receiptsRoot in given RLP not matching the block receiptsRoot!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.logBloom == blockFromRlp.logBloom, "logBloom in given RLP not matching the block logBloom!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.difficulty == blockFromRlp.difficulty, "difficulty in given RLP not matching the block difficulty!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.number == blockFromRlp.number, "number in given RLP not matching the block number!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasLimit == blockFromRlp.gasLimit,"gasLimit in given RLP not matching the block gasLimit!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasUsed == blockFromRlp.gasUsed, "gasUsed in given RLP not matching the block gasUsed!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.timestamp == blockFromRlp.timestamp, "timestamp in given RLP not matching the block timestamp!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.extraData == blockFromRlp.extraData, "extraData in given RLP not matching the block extraData!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.mixHash == blockFromRlp.mixHash, "mixHash in given RLP not matching the block mixHash!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.seedHash == blockFromRlp.seedHash, "transactionsRoot in given RLP not matching the block transactionsRoot!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.nonce == blockFromRlp.nonce, "nonce in given RLP not matching the block nonce!"); + + BOOST_CHECK_MESSAGE(blockHeaderFromFields == blockFromRlp, "However, blockHeaderFromFields != blockFromRlp!"); + + //Check transaction list + + Transactions txsFromField; + + for (auto const& txObj: blObj["transactions"].get_array()) + { + mObject tx = txObj.get_obj(); + + BOOST_REQUIRE(tx.count("nonce")); + BOOST_REQUIRE(tx.count("gasPrice")); + BOOST_REQUIRE(tx.count("gasLimit")); + BOOST_REQUIRE(tx.count("to")); + BOOST_REQUIRE(tx.count("value")); + BOOST_REQUIRE(tx.count("v")); + BOOST_REQUIRE(tx.count("r")); + BOOST_REQUIRE(tx.count("s")); + BOOST_REQUIRE(tx.count("data")); + + try + { + Transaction t(createRLPStreamFromTransactionFields(tx).out(), CheckSignature::Sender); + txsFromField.push_back(t); + } + catch (Exception const& _e) + { + BOOST_ERROR("Failed transaction constructor with Exception: " << diagnostic_information(_e)); + } + catch (exception const& _e) + { + cnote << _e.what(); + } + } + + Transactions txsFromRlp; + RLP root(blockRLP); + for (auto const& tr: root[1]) + { + Transaction tx(tr.data(), CheckSignature::Sender); + txsFromRlp.push_back(tx); + } + + BOOST_CHECK_MESSAGE(txsFromRlp.size() == txsFromField.size(), "transaction list size does not match"); + + for (size_t i = 0; i < txsFromField.size(); ++i) + { + BOOST_CHECK_MESSAGE(txsFromField[i].data() == txsFromRlp[i].data(), "transaction data in rlp and in field do not match"); + BOOST_CHECK_MESSAGE(txsFromField[i].gas() == txsFromRlp[i].gas(), "transaction gasLimit in rlp and in field do not match"); + BOOST_CHECK_MESSAGE(txsFromField[i].gasPrice() == txsFromRlp[i].gasPrice(), "transaction gasPrice in rlp and in field do not match"); + BOOST_CHECK_MESSAGE(txsFromField[i].nonce() == txsFromRlp[i].nonce(), "transaction nonce in rlp and in field do not match"); + BOOST_CHECK_MESSAGE(txsFromField[i].signature().r == txsFromRlp[i].signature().r, "transaction r in rlp and in field do not match"); + BOOST_CHECK_MESSAGE(txsFromField[i].signature().s == txsFromRlp[i].signature().s, "transaction s in rlp and in field do not match"); + BOOST_CHECK_MESSAGE(txsFromField[i].signature().v == txsFromRlp[i].signature().v, "transaction v in rlp and in field do not match"); + BOOST_CHECK_MESSAGE(txsFromField[i].receiveAddress() == txsFromRlp[i].receiveAddress(), "transaction receiveAddress in rlp and in field do not match"); + BOOST_CHECK_MESSAGE(txsFromField[i].value() == txsFromRlp[i].value(), "transaction receiveAddress in rlp and in field do not match"); + + BOOST_CHECK_MESSAGE(txsFromField[i] == txsFromRlp[i], "transactions from rlp and transaction from field do not match"); + BOOST_CHECK_MESSAGE(txsFromField[i].rlp() == txsFromRlp[i].rlp(), "transactions rlp do not match"); + + } + + // check uncle list + + // uncles from uncle list field + vector uBlHsFromField; + if (blObj["uncleHeaders"].type() != json_spirit::null_type) + for (auto const& uBlHeaderObj: blObj["uncleHeaders"].get_array()) + { + mObject uBlH = uBlHeaderObj.get_obj(); + cout << "uBlH.size(): " << uBlH.size() << endl; + BOOST_REQUIRE(uBlH.size() == 17); + bytes uncleRLP = createBlockRLPFromFields(uBlH); + const RLP c_uRLP(uncleRLP); + BlockInfo uncleBlockHeader; + try + { + uncleBlockHeader.populateFromHeader(c_uRLP); + } + catch(...) + { + BOOST_ERROR("invalid uncle header"); + } + uBlHsFromField.push_back(uncleBlockHeader); + } + + // uncles from block RLP + vector uBlHsFromRlp; + for (auto const& uRLP: root[2]) + { + BlockInfo uBl; + uBl.populateFromHeader(uRLP); + uBlHsFromRlp.push_back(uBl); + } + + BOOST_REQUIRE_EQUAL(uBlHsFromField.size(), uBlHsFromRlp.size()); + + for (size_t i = 0; i < uBlHsFromField.size(); ++i) + BOOST_CHECK_MESSAGE(uBlHsFromField[i] == uBlHsFromRlp[i], "block header in rlp and in field do not match"); + } + } + } +} + +// helping functions + +bytes createBlockRLPFromFields(mObject& _tObj) +{ + RLPStream rlpStream; + rlpStream.appendList(_tObj.count("hash") > 0 ? (_tObj.size() - 1) : _tObj.size()); + + if (_tObj.count("parentHash")) + rlpStream << importByteArray(_tObj["parentHash"].get_str()); + + if (_tObj.count("uncleHash")) + rlpStream << importByteArray(_tObj["uncleHash"].get_str()); + + if (_tObj.count("coinbase")) + rlpStream << importByteArray(_tObj["coinbase"].get_str()); + + if (_tObj.count("stateRoot")) + rlpStream << importByteArray(_tObj["stateRoot"].get_str()); + + if (_tObj.count("transactionsTrie")) + rlpStream << importByteArray(_tObj["transactionsTrie"].get_str()); + + if (_tObj.count("receiptTrie")) + rlpStream << importByteArray(_tObj["receiptTrie"].get_str()); + + if (_tObj.count("bloom")) + rlpStream << importByteArray(_tObj["bloom"].get_str()); + + if (_tObj.count("difficulty")) + rlpStream << bigint(_tObj["difficulty"].get_str()); + + if (_tObj.count("number")) + rlpStream << bigint(_tObj["number"].get_str()); + + if (_tObj.count("gasLimit")) + rlpStream << bigint(_tObj["gasLimit"].get_str()); + + if (_tObj.count("gasUsed")) + rlpStream << bigint(_tObj["gasUsed"].get_str()); + + if (_tObj.count("timestamp")) + rlpStream << bigint(_tObj["timestamp"].get_str()); + + if (_tObj.count("extraData")) + rlpStream << fromHex(_tObj["extraData"].get_str()); + + if (_tObj.count("seedHash")) + rlpStream << importByteArray(_tObj["seedHash"].get_str()); + + if (_tObj.count("mixHash")) + rlpStream << importByteArray(_tObj["mixHash"].get_str()); + + if (_tObj.count("nonce")) + rlpStream << importByteArray(_tObj["nonce"].get_str()); + + return rlpStream.out(); +} + +void overwriteBlockHeader(BlockInfo& _current_BlockHeader, mObject& _blObj) +{ + if (_blObj["blockHeader"].get_obj().size() != 14) + { + + BlockInfo tmp = _current_BlockHeader; + + if (_blObj["blockHeader"].get_obj().count("parentHash")) + tmp.parentHash = h256(_blObj["blockHeader"].get_obj()["parentHash"].get_str()); + + if (_blObj["blockHeader"].get_obj().count("uncleHash")) + tmp.sha3Uncles = h256(_blObj["blockHeader"].get_obj()["uncleHash"].get_str()); + + if (_blObj["blockHeader"].get_obj().count("coinbase")) + tmp.coinbaseAddress = Address(_blObj["blockHeader"].get_obj()["coinbase"].get_str()); + + if (_blObj["blockHeader"].get_obj().count("stateRoot")) + tmp.stateRoot = h256(_blObj["blockHeader"].get_obj()["stateRoot"].get_str()); + + if (_blObj["blockHeader"].get_obj().count("transactionsTrie")) + tmp.transactionsRoot = h256(_blObj["blockHeader"].get_obj()["transactionsTrie"].get_str()); + + if (_blObj["blockHeader"].get_obj().count("receiptTrie")) + tmp.receiptsRoot = h256(_blObj["blockHeader"].get_obj()["receiptTrie"].get_str()); + + if (_blObj["blockHeader"].get_obj().count("bloom")) + tmp.logBloom = LogBloom(_blObj["blockHeader"].get_obj()["bloom"].get_str()); + + if (_blObj["blockHeader"].get_obj().count("difficulty")) + tmp.difficulty = toInt(_blObj["blockHeader"].get_obj()["difficulty"]); + + if (_blObj["blockHeader"].get_obj().count("number")) + tmp.number = toInt(_blObj["blockHeader"].get_obj()["number"]); + + if (_blObj["blockHeader"].get_obj().count("gasLimit")) + tmp.gasLimit = toInt(_blObj["blockHeader"].get_obj()["gasLimit"]); + + if (_blObj["blockHeader"].get_obj().count("gasUsed")) + tmp.gasUsed = toInt(_blObj["blockHeader"].get_obj()["gasUsed"]); + + if (_blObj["blockHeader"].get_obj().count("timestamp")) + tmp.timestamp = toInt(_blObj["blockHeader"].get_obj()["timestamp"]); + + if (_blObj["blockHeader"].get_obj().count("extraData")) + tmp.extraData = importByteArray(_blObj["blockHeader"].get_obj()["extraData"].get_str()); + + if (_blObj["blockHeader"].get_obj().count("mixHash")) + tmp.mixHash = h256(_blObj["blockHeader"].get_obj()["mixHash"].get_str()); + + if (_blObj["blockHeader"].get_obj().count("seedHash")) + tmp.seedHash = h256(_blObj["blockHeader"].get_obj()["seedHash"].get_str()); + + // find new valid nonce + + if (tmp != _current_BlockHeader) + { + _current_BlockHeader = tmp; + + ProofOfWork pow; + std::pair ret; + while (!ProofOfWork::verify(_current_BlockHeader)) + { + ret = pow.mine(_current_BlockHeader, 1000, true, true); // tie(ret, blockFromFields.nonce) + Ethash::assignResult(ret.second, _current_BlockHeader); + } + } + } + else + { + // take the blockheader as is + const bytes c_blockRLP = createBlockRLPFromFields(_blObj["blockHeader"].get_obj()); + const RLP c_bRLP(c_blockRLP); + _current_BlockHeader.populateFromHeader(c_bRLP, IgnoreNonce); + } +} + +BlockInfo constructBlock(mObject& _o) +{ + + BlockInfo ret; + try + { + // construct genesis block + const bytes c_blockRLP = createBlockRLPFromFields(_o); + const RLP c_bRLP(c_blockRLP); + ret.populateFromHeader(c_bRLP, IgnoreNonce); + } + catch (Exception const& _e) + { + cnote << "block population did throw an exception: " << diagnostic_information(_e); + BOOST_ERROR("Failed block population with Exception: " << _e.what()); + } + catch (std::exception const& _e) + { + BOOST_ERROR("Failed block population with Exception: " << _e.what()); + } + catch(...) + { + BOOST_ERROR("block population did throw an unknown exception\n"); + } + return ret; +} + +void updatePoW(BlockInfo& _bi) +{ + ProofOfWork pow; + std::pair ret; + while (!ProofOfWork::verify(_bi)) + { + ret = pow.mine(_bi, 10000, true, true); // tie(ret, blockFromFields.nonce) + Ethash::assignResult(ret.second, _bi); + } +} + +void writeBlockHeaderToJson(mObject& _o, const BlockInfo& _bi) +{ + _o["parentHash"] = toString(_bi.parentHash); + _o["uncleHash"] = toString(_bi.sha3Uncles); + _o["coinbase"] = toString(_bi.coinbaseAddress); + _o["stateRoot"] = toString(_bi.stateRoot); + _o["transactionsTrie"] = toString(_bi.transactionsRoot); + _o["receiptTrie"] = toString(_bi.receiptsRoot); + _o["bloom"] = toString(_bi.logBloom); + _o["difficulty"] = toString(_bi.difficulty); + _o["number"] = toString(_bi.number); + _o["gasLimit"] = toString(_bi.gasLimit); + _o["gasUsed"] = toString(_bi.gasUsed); + _o["timestamp"] = toString(_bi.timestamp); + _o["extraData"] ="0x" + toHex(_bi.extraData); + _o["mixHash"] = toString(_bi.mixHash); + _o["seedHash"] = toString(_bi.seedHash); + _o["nonce"] = toString(_bi.nonce); + _o["hash"] = toString(_bi.hash); +} + +RLPStream createFullBlockFromHeader(const BlockInfo& _bi,const bytes& _txs, const bytes& _uncles ) +{ + RLPStream rlpStream; + _bi.streamRLP(rlpStream, WithNonce); + + RLPStream ret(3); + ret.appendRaw(rlpStream.out()); + ret.appendRaw(_txs); + ret.appendRaw(_uncles); + + return ret; +} +} }// Namespace Close + + +BOOST_AUTO_TEST_SUITE(BlockChainTests) + +BOOST_AUTO_TEST_CASE(bcBlockChainTest) +{ + dev::test::executeTests("bcBlockChainTest", "/BlockTests", dev::test::doBlockchainTests); +} + +BOOST_AUTO_TEST_CASE(bcValidBlockTest) +{ + dev::test::executeTests("bcValidBlockTest", "/BlockTests", dev::test::doBlockchainTests); +} + +BOOST_AUTO_TEST_CASE(bcInvalidHeaderTest) +{ + dev::test::executeTests("bcInvalidHeaderTest", "/BlockTests", dev::test::doBlockchainTests); +} + +BOOST_AUTO_TEST_CASE(bcUncleTest) +{ + dev::test::executeTests("bcUncleTest", "/BlockTests", dev::test::doBlockchainTests); +} + +BOOST_AUTO_TEST_CASE(userDefinedFileBc) +{ + dev::test::userDefinedTest("--bctest", dev::test::doBlockchainTests); +} + +BOOST_AUTO_TEST_SUITE_END() + diff --git a/test/commonjs.cpp b/test/commonjs.cpp index 041a14f68..72582c540 100644 --- a/test/commonjs.cpp +++ b/test/commonjs.cpp @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(jsToAddress) cnote << "Testing jsToPublic..."; KeyPair kp = KeyPair::create(); string string = toJS(kp.address()); - Address address = dev::eth::jsToAddress(string); + Address address = dev::jsToAddress(string); BOOST_CHECK_EQUAL(kp.address(), address); } diff --git a/test/dagger.cpp b/test/dagger.cpp index 9422b6a96..a2bd6be68 100644 --- a/test/dagger.cpp +++ b/test/dagger.cpp @@ -17,35 +17,69 @@ /** @file dagger.cpp * @author Gav Wood * @date 2014 - * ProofOfWork test functions. + * Dashimoto test functions. */ -#include -#include +#include +#include +#include "JsonSpiritHeaders.h" +#include #include +#include +#include +#include "TestHelper.h" + using namespace std; -using namespace std::chrono; using namespace dev; using namespace dev::eth; -int daggerTest() +namespace js = json_spirit; + +using dev::operator <<; + +BOOST_AUTO_TEST_SUITE(DashimotoTests) + +BOOST_AUTO_TEST_CASE(basic_test) { - cnote << "Testing ProofOfWork..."; - // Test dagger - { - auto s = steady_clock::now(); - cout << hex << ProofOfWork().eval((h256)(u256)1, (h256)(u256)0); - cout << " " << dec << duration_cast(steady_clock::now() - s).count() << " ms" << endl; - cout << hex << ProofOfWork().eval((h256)(u256)1, (h256)(u256)1); - cout << " " << dec << duration_cast(steady_clock::now() - s).count() << " ms" << endl; - } + string testPath = test::getTestPath(); + + testPath += "/PoWTests"; + + cnote << "Testing Secure Trie..."; + js::mValue v; + string s = asString(contents(testPath + "/ethash_tests.json")); + BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'ethash_tests.json' is empty. Have you cloned the 'tests' repo branch develop?"); + js::read_string(s, v); + for (auto& i: v.get_obj()) { - auto s = steady_clock::now(); - cout << hex << ProofOfWork().eval((h256)(u256)1, (h256)(u256)0); - cout << " " << dec << duration_cast(steady_clock::now() - s).count() << " ms" << endl; - cout << hex << ProofOfWork().eval((h256)(u256)1, (h256)(u256)1); - cout << " " << dec << duration_cast(steady_clock::now() - s).count() << " ms" << endl; + cnote << i.first; + js::mObject& o = i.second.get_obj(); + vector> ss; + BlockInfo header = BlockInfo::fromHeader(fromHex(o["header"].get_str()), CheckNothing); + h256 headerHash(o["header_hash"].get_str()); + Nonce nonce(o["nonce"].get_str()); + BOOST_REQUIRE_EQUAL(headerHash, header.headerHash(WithoutNonce)); + BOOST_REQUIRE_EQUAL(nonce, header.nonce); + + unsigned cacheSize(o["cache_size"].get_int()); + h256 cacheHash(o["cache_hash"].get_str()); + BOOST_REQUIRE_EQUAL(Ethasher::get()->cache(header).size(), cacheSize); + BOOST_REQUIRE_EQUAL(sha3(Ethasher::get()->cache(header)), cacheHash); + +#if TEST_FULL + unsigned fullSize(o["full_size"].get_int()); + h256 fullHash(o["full_hash"].get_str()); + BOOST_REQUIRE_EQUAL(Ethasher::get()->full(header).size(), fullSize); + BOOST_REQUIRE_EQUAL(sha3(Ethasher::get()->full(header)), fullHash); +#endif + + h256 result(o["result"].get_str()); + Ethasher::Result r = Ethasher::eval(header); + BOOST_REQUIRE_EQUAL(r.value, result); + BOOST_REQUIRE_EQUAL(r.mixHash, header.mixHash); } - return 0; } +BOOST_AUTO_TEST_SUITE_END() + + diff --git a/test/solidityExecutionFramework.h b/test/solidityExecutionFramework.h index 4ef9bfdc8..86062a90b 100644 --- a/test/solidityExecutionFramework.h +++ b/test/solidityExecutionFramework.h @@ -25,7 +25,7 @@ #include #include -#include +#include "TestHelper.h" #include #include #include @@ -46,16 +46,8 @@ public: bytes const& compileAndRun(std::string const& _sourceCode, u256 const& _value = 0, std::string const& _contractName = "") { dev::solidity::CompilerStack compiler(m_addStandardSources); - try - { - compiler.addSource("", _sourceCode); - compiler.compile(m_optimize); - } - catch(boost::exception const& _e) - { - auto msg = std::string("Compiling contract failed with: ") + boost::diagnostic_information(_e); - BOOST_FAIL(msg); - } + compiler.addSource("", _sourceCode); + ETH_TEST_REQUIRE_NO_THROW(compiler.compile(m_optimize), "Compiling contract failed"); bytes code = compiler.getBytecode(_contractName); sendMessage(code, true, _value); @@ -178,7 +170,7 @@ protected: Address m_contractAddress; eth::State m_state; u256 const m_gasPrice = 100 * eth::szabo; - u256 const m_gas = 1000000; + u256 const m_gas = 100000000; bytes m_output; eth::LogEntries m_logs; }; diff --git a/test/stBlockHashTestFiller.json b/test/stBlockHashTestFiller.json index af2234976..5ecc5b1c7 100644 --- a/test/stBlockHashTestFiller.json +++ b/test/stBlockHashTestFiller.json @@ -25,7 +25,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "8500", + "gasLimit" : "28500", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -59,7 +59,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "8500", + "gasLimit" : "28500", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -93,7 +93,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "8500", + "gasLimit" : "28500", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", diff --git a/test/stExampleFiller.json b/test/stExampleFiller.json index 7acf695ed..9daefbd54 100644 --- a/test/stExampleFiller.json +++ b/test/stExampleFiller.json @@ -26,7 +26,7 @@ }, "transaction" : { "data" : "", - "gasLimit" : "10000", + "gasLimit" : "400000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", diff --git a/test/stInitCodeTestFiller.json b/test/stInitCodeTestFiller.json index ea5467df8..902290121 100644 --- a/test/stInitCodeTestFiller.json +++ b/test/stInitCodeTestFiller.json @@ -21,7 +21,7 @@ "transaction" : { "data" : "0x600a80600c6000396000f200600160008035811a8100", - "gasLimit" : "599", + "gasLimit" : "32599", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -43,7 +43,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "2", + "balance" : "22177", "code" : "", "nonce" : "0", "storage" : { @@ -53,7 +53,7 @@ "transaction" : { "data" : "0x600a80600c6000396000f200600160008035811a8100", - "gasLimit" : "599", + "gasLimit" : "22176", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -74,7 +74,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "70000", "code" : "", "nonce" : "0", "storage" : { @@ -84,7 +84,7 @@ "transaction" : { "data" : "0x600a80600c6000396000f200600160008035811a8100", - "gasLimit" : "590", + "gasLimit" : "21590", "gasPrice" : "3", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -104,7 +104,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "50000", "code" : "", "nonce" : "0", "storage" : { @@ -114,7 +114,7 @@ "transaction" : { "data" : "0x6000f1", - "gasLimit" : "1000", + "gasLimit" : "40000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -135,7 +135,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "100000", "code" : "", "nonce" : "0", "storage" : { @@ -145,7 +145,7 @@ "transaction" : { "data" : "0x600a80600c6000396000fff2ffff600160008035811a81", - "gasLimit" : "1000", + "gasLimit" : "23000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -166,7 +166,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "100000", "code" : "", "nonce" : "0", "storage" : { @@ -176,7 +176,7 @@ "transaction" : { "data" : "0x600a80600c600039600000f20000600160008035811a81", - "gasLimit" : "1000", + "gasLimit" : "23000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -197,7 +197,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "100000", "code" : "", "nonce" : "0", "storage" : { @@ -207,7 +207,7 @@ "transaction" : { "data" : "0x600a80600c6000396000f200ff600160008035811a81", - "gasLimit" : "1000", + "gasLimit" : "23000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -245,7 +245,7 @@ "transaction" : { "data" : "0x00", - "gasLimit" : "10000", + "gasLimit" : "40000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -283,7 +283,7 @@ "transaction" : { "data" : "0x00", - "gasLimit" : "10000", + "gasLimit" : "40000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -521,7 +521,7 @@ "transaction" : { "data" : "", - "gasLimit" : "5000", + "gasLimit" : "41000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -560,7 +560,7 @@ "transaction" : { "data" : "", - "gasLimit" : "15000", + "gasLimit" : "25000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", diff --git a/test/stLogTestsFiller.json b/test/stLogTestsFiller.json index 0f31c4c63..3b13698cf 100644 --- a/test/stLogTestsFiller.json +++ b/test/stLogTestsFiller.json @@ -32,7 +32,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -73,7 +73,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -114,9 +114,9 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "100000", + "value" : "2100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "data" : "" } @@ -156,7 +156,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -197,7 +197,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -238,7 +238,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -279,7 +279,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -320,7 +320,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -361,7 +361,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -402,7 +402,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -444,7 +444,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -485,7 +485,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -526,7 +526,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -567,7 +567,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -608,7 +608,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -649,7 +649,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -690,7 +690,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -731,7 +731,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -772,7 +772,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -814,7 +814,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -855,7 +855,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -896,7 +896,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -937,7 +937,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -978,7 +978,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1019,7 +1019,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1060,7 +1060,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1101,7 +1101,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1142,7 +1142,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1184,7 +1184,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1225,7 +1225,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1266,7 +1266,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1307,7 +1307,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1348,7 +1348,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1389,7 +1389,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1430,7 +1430,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1471,7 +1471,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1512,7 +1512,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1553,7 +1553,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1595,7 +1595,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1636,7 +1636,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1677,7 +1677,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1718,7 +1718,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1759,7 +1759,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1800,7 +1800,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1841,7 +1841,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "210000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", diff --git a/test/stMemoryTestFiller.json b/test/stMemoryTestFiller.json index e2b3b95a0..f34307443 100644 --- a/test/stMemoryTestFiller.json +++ b/test/stMemoryTestFiller.json @@ -25,7 +25,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "1000", + "gasLimit" : "22000", "to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1459,7 +1459,5 @@ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "data" : "0xff55883355001144bbccddffeeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } - }, - - + } } diff --git a/test/stPreCompiledContractsFiller.json b/test/stPreCompiledContractsFiller.json index 7c7fd8e4b..d571dfccc 100644 --- a/test/stPreCompiledContractsFiller.json +++ b/test/stPreCompiledContractsFiller.json @@ -378,16 +378,16 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "10000000", + "currentGasLimit" : "100000000", "currentDifficulty" : "256", "currentTimestamp" : 1, "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" }, "pre" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "20000000", + "balance" : "200000000", "nonce" : "0", - "code" : "{ [[ 2 ]] (CALL 500 2 0x13 0 0 0 32) [[ 0 ]] (MLOAD 0)}", + "code" : "{ [[ 2 ]] (CALL 20000000 2 0x13 0 0 0 32) [[ 0 ]] (MLOAD 0)}", "storage": {} }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { diff --git a/test/stRefundTestFiller.json b/test/stRefundTestFiller.json index 4809c0987..9e867a508 100644 --- a/test/stRefundTestFiller.json +++ b/test/stRefundTestFiller.json @@ -18,7 +18,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1000", + "balance" : "100000", "nonce" : "0", "code" : "", "storage": {} @@ -27,7 +27,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "850", + "gasLimit" : "22850", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -54,7 +54,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1000", + "balance" : "100000", "nonce" : "0", "code" : "", "storage": {} @@ -63,7 +63,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "850", + "gasLimit" : "22850", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -90,7 +90,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "500", + "balance" : "50000", "nonce" : "0", "code" : "", "storage": {} @@ -99,7 +99,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "500", + "gasLimit" : "21000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -126,7 +126,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "502", + "balance" : "50200", "nonce" : "0", "code" : "", "storage": {} @@ -135,7 +135,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "502", + "gasLimit" : "21002", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -166,7 +166,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "100000", "nonce" : "0", "code" : "", "storage": {} @@ -175,7 +175,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "100000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -206,7 +206,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "100000", "nonce" : "0", "code" : "", "storage": {} @@ -215,7 +215,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "100000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -247,7 +247,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "100000", "nonce" : "0", "code" : "", "storage": {} @@ -256,7 +256,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "100000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -288,7 +288,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "100000", "nonce" : "0", "code" : "", "storage": {} @@ -297,7 +297,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "100000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", diff --git a/test/stSolidityTestFiller.json b/test/stSolidityTestFiller.json index 549c5f226..948dc5f7a 100644 --- a/test/stSolidityTestFiller.json +++ b/test/stSolidityTestFiller.json @@ -278,7 +278,7 @@ { "//" : "run()", "data" : "0xc0406226", - "gasLimit" : "15000", + "gasLimit" : "35000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -333,7 +333,7 @@ { "//" : "testRecursiveMethods()", "data" : "0x981a3165", - "gasLimit" : "2000", + "gasLimit" : "25000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -378,7 +378,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "500", + "balance" : "50000", "nonce" : "0", "code" : "", "storage": {} @@ -388,7 +388,7 @@ { "//" : "testInfiniteLoop()", "data" : "0x296df0df", - "gasLimit" : "10000", + "gasLimit" : "30000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -463,7 +463,7 @@ { "//" : "run(uint256)", "data" : "0xa444f5e900000000000000000000000000000000000000000000000000000000000204", - "gasLimit" : "10000", + "gasLimit" : "30000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -508,7 +508,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "500", + "balance" : "50000", "nonce" : "0", "code" : "", "storage": {} @@ -518,7 +518,7 @@ { "//" : "run()", "data" : "0xc0406226", - "gasLimit" : "10000", + "gasLimit" : "30000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", diff --git a/test/stSpecialTestFiller.json b/test/stSpecialTestFiller.json index d01072b46..223d9f75f 100644 --- a/test/stSpecialTestFiller.json +++ b/test/stSpecialTestFiller.json @@ -22,7 +22,7 @@ "storage": {} }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1000", + "balance" : "100000", "nonce" : "0", "code" : "", "storage": {} @@ -31,7 +31,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "850", + "gasLimit" : "22850", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", diff --git a/test/stSystemOperationsTestFiller.json b/test/stSystemOperationsTestFiller.json index 3b08ca67b..7460ca94e 100644 --- a/test/stSystemOperationsTestFiller.json +++ b/test/stSystemOperationsTestFiller.json @@ -25,7 +25,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -60,7 +60,7 @@ }, "transaction" : { "data" : "", - "gasLimit" : "10000", + "gasLimit" : "30000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -95,7 +95,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -129,7 +129,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -163,7 +163,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -197,7 +197,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -232,7 +232,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -257,7 +257,7 @@ "storage": {} }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1000", + "balance" : "100000", "nonce" : "0", "code" : "", "storage": {} @@ -266,7 +266,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -300,7 +300,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -334,7 +334,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -368,7 +368,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -410,7 +410,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -452,7 +452,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -494,7 +494,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -536,7 +536,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -578,7 +578,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -619,7 +619,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -660,7 +660,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -701,7 +701,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -743,7 +743,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -785,7 +785,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -827,7 +827,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -870,7 +870,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -911,7 +911,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -952,7 +952,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -993,7 +993,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1035,7 +1035,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1076,7 +1076,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "10000", + "gasLimit" : "30000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", diff --git a/test/stTransactionTestFiller.json b/test/stTransactionTestFiller.json index 6b50774eb..9bd7436bc 100644 --- a/test/stTransactionTestFiller.json +++ b/test/stTransactionTestFiller.json @@ -30,6 +30,37 @@ } }, + "EmptyTransaction2" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : + { + "data" : "", + "gasLimit" : "22000", + "gasPrice" : "", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "" + } + }, + "TransactionSendingToEmpty" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", @@ -52,7 +83,7 @@ "transaction" : { "data" : "", - "gasLimit" : "500", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -84,7 +115,7 @@ "transaction" : { "data" : "", - "gasLimit" : "5000", + "gasLimit" : "25000", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -116,7 +147,7 @@ "transaction" : { "data" : "", - "gasLimit" : "5000", + "gasLimit" : "25000", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -138,7 +169,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1101", + "balance" : "22000", "code" : "", "nonce" : "0", "storage" : { @@ -148,12 +179,12 @@ "transaction" : { "data" : "", - "gasLimit" : "600", + "gasLimit" : "21600", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "value" : "502" + "value" : "5000" } }, @@ -170,7 +201,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1000", + "balance" : "22000", "code" : "", "nonce" : "0", "storage" : { @@ -180,20 +211,20 @@ "transaction" : { "data" : "", - "gasLimit" : "600", + "gasLimit" : "21600", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "value" : "502" + "value" : "5000" } }, "InternalCallHittingGasLimit" : { "env" : { - "currentCoinbase" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentCoinbase" : "2adf5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "1100", + "currentGasLimit" : "22000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -227,7 +258,101 @@ "transaction" : { "data" : "", - "gasLimit" : "1100", + "gasLimit" : "21100", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10" + } + }, + + "InternalCallHittingGasLimit2" : { + "env" : { + "currentCoinbase" : "2adf5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "47766", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0", + "code" : "{ (CALL 25000 0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b 1 0 0 0 0) }", + "nonce" : "0", + "storage" : { + } + }, + + "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0", + "code" : "{[[1]]55}", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : + { + "data" : "", + "gasLimit" : "47766", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10" + } + }, + + "InternalCallHittingGasLimitSuccess" : { + "env" : { + "currentCoinbase" : "2adf5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "220000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0", + "code" : "{ (CALL 25000 0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b 1 0 0 0 0) }", + "nonce" : "0", + "storage" : { + } + }, + + "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0", + "code" : "{[[1]]55}", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : + { + "data" : "", + "gasLimit" : "150000", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -240,7 +365,7 @@ "env" : { "currentCoinbase" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "1100", + "currentGasLimit" : "21100", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -258,7 +383,7 @@ "transaction" : { "data" : "", - "gasLimit" : "1100", + "gasLimit" : "21100", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -271,7 +396,7 @@ "env" : { "currentCoinbase" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "1100", + "currentGasLimit" : "21100", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -289,7 +414,7 @@ "transaction" : { "data" : "", - "gasLimit" : "1101", + "gasLimit" : "21101", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -302,7 +427,7 @@ "env" : { "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "10000", + "currentGasLimit" : "10000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -310,7 +435,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "7000", + "balance" : "140000", "code" : "", "nonce" : "0", "storage" : { @@ -339,7 +464,7 @@ "transaction" : { "data" : "", - "gasLimit" : "600", + "gasLimit" : "130000", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -352,7 +477,7 @@ "env" : { "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "10000", + "currentGasLimit" : "100000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -360,7 +485,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "7000", + "balance" : "30000", "code" : "", "nonce" : "0", "storage" : { @@ -389,7 +514,7 @@ "transaction" : { "data" : "", - "gasLimit" : "600", + "gasLimit" : "21100", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -402,7 +527,7 @@ "env" : { "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "10000", + "currentGasLimit" : "1000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -410,7 +535,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "7000", + "balance" : "22000", "code" : "", "nonce" : "0", "storage" : { @@ -449,7 +574,7 @@ "transaction" : { "data" : "", - "gasLimit" : "700", + "gasLimit" : "21100", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -462,7 +587,7 @@ "env" : { "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "10000", + "currentGasLimit" : "10000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -470,7 +595,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "7000", + "balance" : "500000", "code" : "", "nonce" : "0", "storage" : { @@ -514,7 +639,7 @@ "transaction" : { "data" : "", - "gasLimit" : "700", + "gasLimit" : "23000", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -527,7 +652,7 @@ "env" : { "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "10000", + "currentGasLimit" : "1000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -535,7 +660,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "7000", + "balance" : "100000", "code" : "", "nonce" : "0", "storage" : { @@ -544,7 +669,7 @@ "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10", - "code" : "{(CALL 0 0 1 0 0 0 0) (SUICIDE 0)}", + "code" : "{(CALL 20000 0x0000000000000000000000000000000000000000 1 0 0 0 0) (SUICIDE 0)}", "nonce" : "0", "storage" : { } @@ -552,7 +677,7 @@ "0000000000000000000000000000000000000000" : { "balance" : "0", - "code" : "{(SUICIDE 1)}", + "code" : "{(SUICIDE 0x0000000000000000000000000000000000000001)}", "nonce" : "0", "storage" : { } @@ -563,7 +688,7 @@ "transaction" : { "data" : "", - "gasLimit" : "700", + "gasLimit" : "50000", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -576,7 +701,7 @@ "env" : { "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "10000", + "currentGasLimit" : "10000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -584,7 +709,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "7000", + "balance" : "1000000", "code" : "", "nonce" : "0", "storage" : { @@ -592,8 +717,8 @@ }, "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10", - "code" : "{(CALL 20 0 1 0 0 0 0) (SUICIDE 0)}", + "balance" : "1000", + "code" : "{(CALL 22000 0x0000000000000000000000000000000000000000 1 0 0 0 0) (SUICIDE 0)}", "nonce" : "0", "storage" : { } @@ -601,7 +726,7 @@ "0000000000000000000000000000000000000000" : { "balance" : "0", - "code" : "{(SUICIDE 1)}", + "code" : "{(SUICIDE 0x0000000000000000000000000000000000000001)}", "nonce" : "0", "storage" : { } @@ -612,7 +737,7 @@ "transaction" : { "data" : "", - "gasLimit" : "700", + "gasLimit" : "50000", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -633,7 +758,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "7000", + "balance" : "122000", "code" : "", "nonce" : "0", "storage" : { @@ -642,7 +767,7 @@ "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000", - "code" : "{(SUICIDE 0) (CALL 0 2000 0 0 0 0 0) }", + "code" : "{(SUICIDE 0) (CALL 2000 0x0000000000000000000000000000000000000000 0 0 0 0 0) }", "nonce" : "0", "storage" : { } @@ -650,7 +775,7 @@ "0000000000000000000000000000000000000000" : { "balance" : "1110", - "code" : "{(SUICIDE 1)}", + "code" : "{(SUICIDE 0x0000000000000000000000000000000000000001)}", "nonce" : "0", "storage" : { } @@ -660,7 +785,7 @@ "transaction" : { "data" : "", - "gasLimit" : "3700", + "gasLimit" : "33700", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -673,7 +798,7 @@ "env" : { "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "10000", + "currentGasLimit" : "1000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -681,7 +806,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "7000", + "balance" : "122000", "code" : "", "nonce" : "0", "storage" : { @@ -700,7 +825,7 @@ "transaction" : { "data" : "", - "gasLimit" : "1700", + "gasLimit" : "31700", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -713,7 +838,7 @@ "env" : { "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", - "currentGasLimit" : "10000", + "currentGasLimit" : "1000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -721,7 +846,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "7000", + "balance" : "22000", "code" : "", "nonce" : "0", "storage" : { @@ -740,7 +865,7 @@ "transaction" : { "data" : "", - "gasLimit" : "1700", + "gasLimit" : "21700", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -771,7 +896,7 @@ "transaction" : { "data" : "", - "gasLimit" : "1000", + "gasLimit" : "22000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -784,7 +909,7 @@ "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", - "currentGasLimit" : "1000000", + "currentGasLimit" : "100000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -802,7 +927,7 @@ "transaction" : { "data" : "", - "gasLimit" : "1000", + "gasLimit" : "22000", "gasPrice" : "1", "nonce" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -811,11 +936,11 @@ } }, - "TransactionCosts555" : { + "TransactionDataCosts652" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -833,7 +958,7 @@ "transaction" : { "data" : "0x00000000000000000000112233445566778f32", - "gasLimit" : "1000", + "gasLimit" : "22000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -846,7 +971,7 @@ "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -854,7 +979,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "3000", + "balance" : "43000", "code" : "", "nonce" : "0", "storage" : { @@ -864,7 +989,7 @@ "transaction" : { "data" : "", - "gasLimit" : "5100", + "gasLimit" : "35100", "gasPrice" : "0", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -877,7 +1002,7 @@ "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", - "currentGasLimit" : "1000000", + "currentGasLimit" : "100000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -885,7 +1010,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "3000", + "balance" : "33000", "code" : "", "nonce" : "0", "storage" : { @@ -908,7 +1033,7 @@ "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentNumber" : "0", "currentTimestamp" : 1, "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" @@ -916,7 +1041,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "3000", + "balance" : "133000", "code" : "", "nonce" : "0", "storage" : { @@ -926,7 +1051,7 @@ "transaction" : { "data" : "0x3240349548983454", - "gasLimit" : "500", + "gasLimit" : "32600", "gasPrice" : "0", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -999,7 +1124,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "value" : "900" + "value" : "" } }, @@ -1048,7 +1173,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "100000", + "balance" : "1000000", "code" : "", "nonce" : "0", "storage" : { @@ -1058,7 +1183,7 @@ "transaction" : { "data" : "", - "gasLimit" : "1000", + "gasLimit" : "22000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1079,7 +1204,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "132000", "code" : "", "nonce" : "0", "storage" : { @@ -1089,7 +1214,7 @@ "transaction" : { "data" : "0x602280600c6000396000f30060e060020a600035048063f8a8fd6d14601457005b601a6020565b60006000f35b56", - "gasLimit" : "882", + "gasLimit" : "23679", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1098,7 +1223,7 @@ } }, - "CreateTransactionWorking" : { + "CreateTransactionSuccess" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -1110,7 +1235,7 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "100000", "code" : "", "nonce" : "0", "storage" : { @@ -1120,7 +1245,7 @@ "transaction" : { "data" : "0x602280600c6000396000f30060e060020a600035048063f8a8fd6d14601457005b601a6020565b60006000f35b56", - "gasLimit" : "883", + "gasLimit" : "70000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -1141,7 +1266,46 @@ "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000", + "balance" : "30000", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0", + "code" : "{(MSTORE 0 0x600c600055) (CREATE 0 27 5)}", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : + { + "data" : "", + "gasLimit" : "21882", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "100" + } + }, + + "CreateMessageSuccess" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "400000", "code" : "", "nonce" : "0", "storage" : { @@ -1159,7 +1323,7 @@ "transaction" : { "data" : "", - "gasLimit" : "882", + "gasLimit" : "131882", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", diff --git a/test/state.cpp b/test/state.cpp index 17ebe2b77..5202aff22 100644 --- a/test/state.cpp +++ b/test/state.cpp @@ -65,6 +65,7 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) catch (Exception const& _e) { cnote << "state execution did throw an exception: " << diagnostic_information(_e); + theState.commit(); } catch (std::exception const& _e) { @@ -72,7 +73,13 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) } if (_fillin) + { +#if ETH_FATDB importer.exportTest(output, theState); +#else + BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("You can not fill tests when FATDB is switched off")); +#endif + } else { BOOST_REQUIRE(o.count("post") > 0); @@ -85,6 +92,7 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) checkLog(theState.pending().size() ? theState.log(0) : LogEntries(), importer.m_environment.sub.logs); // check addresses +#if ETH_FATDB auto expectedAddrs = importer.m_statePost.addresses(); auto resultAddrs = theState.addresses(); for (auto& expectedPair : expectedAddrs) @@ -103,6 +111,8 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) } } checkAddresses >(expectedAddrs, resultAddrs); +#endif + BOOST_CHECK_MESSAGE(theState.rootHash() == h256(o["postStateRoot"].get_str()), "wrong post state root"); } } } @@ -162,50 +172,51 @@ BOOST_AUTO_TEST_CASE(stBlockHashTest) BOOST_AUTO_TEST_CASE(stQuadraticComplexityTest) { - for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) - { - string arg = boost::unit_test::framework::master_test_suite().argv[i]; - if (arg == "--quadratic" || arg == "--all") - { - auto start = chrono::steady_clock::now(); - - dev::test::executeTests("stQuadraticComplexityTest", "/StateTests", dev::test::doStateTests); - - auto end = chrono::steady_clock::now(); - auto duration(chrono::duration_cast(end - start)); - cnote << "test duration: " << duration.count() << " milliseconds.\n"; - } - } + for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) + { + string arg = boost::unit_test::framework::master_test_suite().argv[i]; + if (arg == "--quadratic" || arg == "--all") + { + auto start = chrono::steady_clock::now(); + + dev::test::executeTests("stQuadraticComplexityTest", "/StateTests", dev::test::doStateTests); + + auto end = chrono::steady_clock::now(); + auto duration(chrono::duration_cast(end - start)); + cnote << "test duration: " << duration.count() << " milliseconds.\n"; + } + } } BOOST_AUTO_TEST_CASE(stMemoryStressTest) { - for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) - { - string arg = boost::unit_test::framework::master_test_suite().argv[i]; - if (arg == "--memory" || arg == "--all") - { - auto start = chrono::steady_clock::now(); - - dev::test::executeTests("stMemoryStressTest", "/StateTests", dev::test::doStateTests); - - auto end = chrono::steady_clock::now(); - auto duration(chrono::duration_cast(end - start)); - cnote << "test duration: " << duration.count() << " milliseconds.\n"; - } - } + for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) + { + string arg = boost::unit_test::framework::master_test_suite().argv[i]; + if (arg == "--memory" || arg == "--all") + { + auto start = chrono::steady_clock::now(); + + dev::test::executeTests("stMemoryStressTest", "/StateTests", dev::test::doStateTests); + + auto end = chrono::steady_clock::now(); + auto duration(chrono::duration_cast(end - start)); + cnote << "test duration: " << duration.count() << " milliseconds.\n"; + } + } } -BOOST_AUTO_TEST_CASE(stSolidityTest) -{ - dev::test::executeTests("stSolidityTest", "/StateTests", dev::test::doStateTests); -} + BOOST_AUTO_TEST_CASE(stSolidityTest) + { + dev::test::executeTests("stSolidityTest", "/StateTests", dev::test::doStateTests); + } BOOST_AUTO_TEST_CASE(stMemoryTest) { - dev::test::executeTests("stMemoryTest", "/StateTests", dev::test::doStateTests); + dev::test::executeTests("stMemoryTest", "/StateTests", dev::test::doStateTests); } + BOOST_AUTO_TEST_CASE(stCreateTest) { for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) diff --git a/test/stateOriginal.cpp b/test/stateOriginal.cpp index 65ff5084f..5b7b0415e 100644 --- a/test/stateOriginal.cpp +++ b/test/stateOriginal.cpp @@ -20,6 +20,7 @@ * State test functions. */ +#include #include #include #include @@ -29,7 +30,21 @@ using namespace std; using namespace dev; using namespace dev::eth; -int stateTest() +namespace dev +{ +namespace test +{ + +int stateTest(); + +BOOST_AUTO_TEST_SUITE(StateIntegration) + +BOOST_AUTO_TEST_CASE(Basic) +{ + State s; +} + +BOOST_AUTO_TEST_CASE(Complex) { cnote << "Testing State..."; @@ -37,14 +52,15 @@ int stateTest() KeyPair myMiner = sha3("Gav's Miner"); // KeyPair you = sha3("123"); - Defaults::setDBPath(boost::filesystem::temp_directory_path().string()); + Defaults::setDBPath(boost::filesystem::temp_directory_path().string() + "/" + toString(chrono::system_clock::now().time_since_epoch().count())); OverlayDB stateDB = State::openDB(); CanonBlockChain bc; - State s(myMiner.address(), stateDB); - cout << bc; + State s(myMiner.address(), stateDB); + cout << s; + // Sync up - this won't do much until we use the last state. s.sync(bc); @@ -52,7 +68,7 @@ int stateTest() // Mine to get some ether! s.commitToMine(bc); - while (!s.mine(100).completed) {} + while (!s.mine(100, true).completed) {} s.completeMine(); bc.attemptImport(s.blockData(), stateDB); @@ -65,7 +81,7 @@ int stateTest() // Inject a transaction to transfer funds from miner to me. bytes tx; { - Transaction t(1000, 0, 0, me.address(), bytes(), s.transactionsFrom(myMiner.address()), myMiner.secret()); + Transaction t(1000, 10000, 10000, me.address(), bytes(), s.transactionsFrom(myMiner.address()), myMiner.secret()); assert(t.sender() == myMiner.address()); tx = t.rlp(); } @@ -76,7 +92,7 @@ int stateTest() // Mine to get some ether and set in stone. s.commitToMine(bc); s.commitToMine(bc); - while (!s.mine(50).completed) { s.commitToMine(bc); } + while (!s.mine(100, true).completed) {} s.completeMine(); bc.attemptImport(s.blockData(), stateDB); @@ -85,7 +101,9 @@ int stateTest() s.sync(bc); cout << s; - - return 0; } +BOOST_AUTO_TEST_SUITE_END() + +} +} diff --git a/test/trie.cpp b/test/trie.cpp index dd335b4a6..9e59dd316 100644 --- a/test/trie.cpp +++ b/test/trie.cpp @@ -50,8 +50,92 @@ static unsigned fac(unsigned _i) } } +using dev::operator <<; + BOOST_AUTO_TEST_SUITE(TrieTests) +BOOST_AUTO_TEST_CASE(fat_trie) +{ + h256 r; + MemoryDB fm; + { + FatGenericTrieDB ft(&fm); + ft.init(); + ft.insert(h256("69", h256::FromHex, h256::AlignRight).ref(), h256("414243", h256::FromHex, h256::AlignRight).ref()); + for (auto i: ft) + cnote << i.first << i.second; + r = ft.root(); + } + { + FatGenericTrieDB ft(&fm); + ft.setRoot(r); + for (auto i: ft) + cnote << i.first << i.second; + } +} + +BOOST_AUTO_TEST_CASE(hex_encoded_securetrie_test) +{ + string testPath = test::getTestPath(); + + testPath += "/TrieTests"; + + cnote << "Testing Secure Trie..."; + js::mValue v; + string s = asString(contents(testPath + "/hex_encoded_securetrie_test.json")); + BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'hex_encoded_securetrie_test.json' is empty. Have you cloned the 'tests' repo branch develop?"); + js::read_string(s, v); + for (auto& i: v.get_obj()) + { + cnote << i.first; + js::mObject& o = i.second.get_obj(); + vector> ss; + for (auto i: o["in"].get_obj()) + { + ss.push_back(make_pair(i.first, i.second.get_str())); + if (!ss.back().first.find("0x")) + ss.back().first = asString(fromHex(ss.back().first.substr(2))); + if (!ss.back().second.find("0x")) + ss.back().second = asString(fromHex(ss.back().second.substr(2))); + } + for (unsigned j = 0; j < min(1000000000u, dev::test::fac((unsigned)ss.size())); ++j) + { + next_permutation(ss.begin(), ss.end()); + MemoryDB m; + GenericTrieDB t(&m); + MemoryDB hm; + HashedGenericTrieDB ht(&hm); + MemoryDB fm; + FatGenericTrieDB ft(&fm); + t.init(); + ht.init(); + ft.init(); + BOOST_REQUIRE(t.check(true)); + BOOST_REQUIRE(ht.check(true)); + BOOST_REQUIRE(ft.check(true)); + for (auto const& k: ss) + { + t.insert(k.first, k.second); + ht.insert(k.first, k.second); + ft.insert(k.first, k.second); + BOOST_REQUIRE(t.check(true)); + BOOST_REQUIRE(ht.check(true)); + BOOST_REQUIRE(ft.check(true)); + for (auto i = ft.begin(), j = t.begin(); i != ft.end() && j != t.end(); ++i, ++j) + { + BOOST_CHECK_EQUAL(i == ft.end(), j == t.end()); + BOOST_REQUIRE((*i).first.toBytes() == (*j).first.toBytes()); + BOOST_REQUIRE((*i).second.toBytes() == (*j).second.toBytes()); + } + BOOST_CHECK_EQUAL(ht.root(), ft.root()); + } + BOOST_REQUIRE(!o["root"].is_null()); + BOOST_CHECK_EQUAL(o["root"].get_str(), "0x" + toHex(ht.root().asArray())); + BOOST_CHECK_EQUAL(o["root"].get_str(), "0x" + toHex(ft.root().asArray())); + } + } +} + BOOST_AUTO_TEST_CASE(trie_test_anyorder) { string testPath = test::getTestPath(); @@ -81,15 +165,35 @@ BOOST_AUTO_TEST_CASE(trie_test_anyorder) next_permutation(ss.begin(), ss.end()); MemoryDB m; GenericTrieDB t(&m); + MemoryDB hm; + HashedGenericTrieDB ht(&hm); + MemoryDB fm; + FatGenericTrieDB ft(&fm); t.init(); + ht.init(); + ft.init(); BOOST_REQUIRE(t.check(true)); + BOOST_REQUIRE(ht.check(true)); + BOOST_REQUIRE(ft.check(true)); for (auto const& k: ss) { t.insert(k.first, k.second); + ht.insert(k.first, k.second); + ft.insert(k.first, k.second); BOOST_REQUIRE(t.check(true)); + BOOST_REQUIRE(ht.check(true)); + BOOST_REQUIRE(ft.check(true)); + for (auto i = ft.begin(), j = t.begin(); i != ft.end() && j != t.end(); ++i, ++j) + { + BOOST_CHECK_EQUAL(i == ft.end(), j == t.end()); + BOOST_REQUIRE((*i).first.toBytes() == (*j).first.toBytes()); + BOOST_REQUIRE((*i).second.toBytes() == (*j).second.toBytes()); + } + BOOST_CHECK_EQUAL(ht.root(), ft.root()); } BOOST_REQUIRE(!o["root"].is_null()); BOOST_CHECK_EQUAL(o["root"].get_str(), "0x" + toHex(t.root().asArray())); + BOOST_CHECK_EQUAL(ht.root(), ft.root()); } } } @@ -141,15 +245,33 @@ BOOST_AUTO_TEST_CASE(trie_tests_ordered) MemoryDB m; GenericTrieDB t(&m); + MemoryDB hm; + HashedGenericTrieDB ht(&hm); + MemoryDB fm; + FatGenericTrieDB ft(&fm); t.init(); + ht.init(); + ft.init(); BOOST_REQUIRE(t.check(true)); + BOOST_REQUIRE(ht.check(true)); + BOOST_REQUIRE(ft.check(true)); + for (auto const& k: ss) { if (find(keysToBeDeleted.begin(), keysToBeDeleted.end(), k.first) != keysToBeDeleted.end() && k.second.empty()) - t.remove(k.first); + t.remove(k.first), ht.remove(k.first), ft.remove(k.first); else - t.insert(k.first, k.second); + t.insert(k.first, k.second), ht.insert(k.first, k.second), ft.insert(k.first, k.second); BOOST_REQUIRE(t.check(true)); + BOOST_REQUIRE(ht.check(true)); + BOOST_REQUIRE(ft.check(true)); + for (auto i = ft.begin(), j = t.begin(); i != ft.end() && j != t.end(); ++i, ++j) + { + BOOST_CHECK_EQUAL(i == ft.end(), j == t.end()); + BOOST_REQUIRE((*i).first.toBytes() == (*j).first.toBytes()); + BOOST_REQUIRE((*i).second.toBytes() == (*j).second.toBytes()); + } + BOOST_CHECK_EQUAL(ht.root(), ft.root()); } BOOST_REQUIRE(!o["root"].is_null()); diff --git a/test/vm.cpp b/test/vm.cpp index e78753e6a..eb7c174ec 100644 --- a/test/vm.cpp +++ b/test/vm.cpp @@ -533,33 +533,33 @@ BOOST_AUTO_TEST_CASE(vmPerformanceTest) } } -BOOST_AUTO_TEST_CASE(vmInputLimitsTest1) -{ - for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) - { - string arg = boost::unit_test::framework::master_test_suite().argv[i]; - if (arg == "--inputlimits" || arg == "--all") - { - auto start = chrono::steady_clock::now(); - - dev::test::executeTests("vmInputLimitsTest1", "/VMTests", dev::test::doVMTests); - - auto end = chrono::steady_clock::now(); - auto duration(chrono::duration_cast(end - start)); - cnote << "test duration: " << duration.count() << " milliseconds.\n"; - } - } -} - -BOOST_AUTO_TEST_CASE(vmInputLimitsTest2) -{ - for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) - { - string arg = boost::unit_test::framework::master_test_suite().argv[i]; - if (arg == "--inputlimits" || arg == "--all") - dev::test::executeTests("vmInputLimitsTest2", "/VMTests", dev::test::doVMTests); - } -} +//BOOST_AUTO_TEST_CASE(vmInputLimitsTest1) +//{ +// for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) +// { +// string arg = boost::unit_test::framework::master_test_suite().argv[i]; +// if (arg == "--inputlimits" || arg == "--all") +// { +// auto start = chrono::steady_clock::now(); + +// dev::test::executeTests("vmInputLimitsTest1", "/VMTests", dev::test::doVMTests); + +// auto end = chrono::steady_clock::now(); +// auto duration(chrono::duration_cast(end - start)); +// cnote << "test duration: " << duration.count() << " milliseconds.\n"; +// } +// } +//} + +//BOOST_AUTO_TEST_CASE(vmInputLimitsTest2) +//{ +// for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) +// { +// string arg = boost::unit_test::framework::master_test_suite().argv[i]; +// if (arg == "--inputlimits" || arg == "--all") +// dev::test::executeTests("vmInputLimitsTest2", "/VMTests", dev::test::doVMTests); +// } +//} BOOST_AUTO_TEST_CASE(vmRandom) { diff --git a/test/vm.h b/test/vm.h index f27bce50b..1c0190b69 100644 --- a/test/vm.h +++ b/test/vm.h @@ -52,6 +52,7 @@ public: virtual u256 store(u256 _n) override { return std::get<2>(addresses[myAddress])[_n]; } virtual void setStore(u256 _n, u256 _v) override { std::get<2>(addresses[myAddress])[_n] = _v; } + virtual bool exists(Address _a) override { return !!addresses.count(_a); } virtual u256 balance(Address _a) override { return std::get<0>(addresses[_a]); } virtual void subBalance(u256 _a) override { std::get<0>(addresses[myAddress]) -= _a; } virtual u256 txCount(Address _a) override { return std::get<1>(addresses[_a]); } diff --git a/test/vmArithmeticTestFiller.json b/test/vmArithmeticTestFiller.json index 1484de19c..3e453f8e9 100644 --- a/test/vmArithmeticTestFiller.json +++ b/test/vmArithmeticTestFiller.json @@ -23,7 +23,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -51,7 +51,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -79,7 +79,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -107,7 +107,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -135,7 +135,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -163,7 +163,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -192,7 +192,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -221,7 +221,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -249,7 +249,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -277,7 +277,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -305,7 +305,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -333,7 +333,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -361,7 +361,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -389,7 +389,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -417,7 +417,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -445,7 +445,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -473,7 +473,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -501,7 +501,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -529,7 +529,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -557,7 +557,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -585,7 +585,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -613,7 +613,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -641,7 +641,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -669,7 +669,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -697,7 +697,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -725,7 +725,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -753,7 +753,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -781,7 +781,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -809,7 +809,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -837,7 +837,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -865,7 +865,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -893,7 +893,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -921,7 +921,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1005,7 +1005,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1033,7 +1033,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1061,7 +1061,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1089,7 +1089,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1117,7 +1117,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1145,7 +1145,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1173,7 +1173,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1201,7 +1201,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1229,7 +1229,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1257,7 +1257,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1369,7 +1369,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1397,7 +1397,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1537,7 +1537,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1565,7 +1565,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1593,7 +1593,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1621,7 +1621,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1649,7 +1649,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1677,7 +1677,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1705,7 +1705,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1733,7 +1733,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1762,7 +1762,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1790,7 +1790,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1930,7 +1930,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1958,7 +1958,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1986,7 +1986,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2014,7 +2014,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2042,7 +2042,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2070,7 +2070,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2098,7 +2098,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2126,7 +2126,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2154,7 +2154,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2183,7 +2183,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2211,7 +2211,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2239,7 +2239,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2267,7 +2267,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2295,7 +2295,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2323,7 +2323,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2351,7 +2351,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2379,7 +2379,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2407,7 +2407,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2435,7 +2435,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2463,7 +2463,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2491,7 +2491,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2519,7 +2519,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2547,7 +2547,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2575,7 +2575,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2603,7 +2603,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2631,7 +2631,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2659,7 +2659,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2687,7 +2687,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2715,7 +2715,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2743,7 +2743,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2771,7 +2771,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2799,7 +2799,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2827,7 +2827,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2855,7 +2855,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2883,7 +2883,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2911,7 +2911,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2939,7 +2939,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2967,7 +2967,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2995,7 +2995,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3023,7 +3023,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3051,7 +3051,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3079,7 +3079,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3107,7 +3107,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3135,7 +3135,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3163,7 +3163,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3191,7 +3191,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3219,7 +3219,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3247,7 +3247,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3275,7 +3275,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3303,7 +3303,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3331,7 +3331,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3359,7 +3359,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3387,7 +3387,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3415,7 +3415,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3443,7 +3443,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3471,7 +3471,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3499,7 +3499,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3527,7 +3527,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3535,7 +3535,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3555,7 +3555,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3563,7 +3563,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3583,7 +3583,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3591,7 +3591,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3611,7 +3611,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3619,7 +3619,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3639,7 +3639,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3647,7 +3647,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3667,7 +3667,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3675,7 +3675,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3695,7 +3695,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3703,7 +3703,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3723,7 +3723,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3731,7 +3731,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3751,7 +3751,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3759,7 +3759,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "100000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3779,7 +3779,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "10000000" } }, @@ -3787,7 +3787,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3807,7 +3807,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3815,7 +3815,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3835,7 +3835,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3843,7 +3843,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3863,7 +3863,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3871,7 +3871,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3891,7 +3891,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3899,7 +3899,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3919,7 +3919,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3927,7 +3927,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3947,7 +3947,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3955,7 +3955,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -3975,7 +3975,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -3983,7 +3983,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4003,7 +4003,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4011,7 +4011,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4031,7 +4031,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4039,7 +4039,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4059,7 +4059,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4067,7 +4067,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4087,7 +4087,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4095,7 +4095,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4115,7 +4115,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4123,7 +4123,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4143,7 +4143,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4151,7 +4151,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4171,7 +4171,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4179,7 +4179,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4199,7 +4199,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4207,7 +4207,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4227,7 +4227,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4235,7 +4235,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4255,7 +4255,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4263,7 +4263,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4283,7 +4283,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4291,7 +4291,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4311,7 +4311,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4319,7 +4319,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4339,7 +4339,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4347,7 +4347,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4367,7 +4367,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4375,7 +4375,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4395,7 +4395,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4403,7 +4403,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4423,7 +4423,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4431,7 +4431,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4451,7 +4451,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4459,7 +4459,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4479,7 +4479,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4487,7 +4487,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4507,7 +4507,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4515,7 +4515,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4535,7 +4535,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4543,7 +4543,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4563,7 +4563,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4571,7 +4571,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4591,7 +4591,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4599,7 +4599,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4619,7 +4619,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4627,7 +4627,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4647,7 +4647,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4655,7 +4655,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4675,7 +4675,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4683,7 +4683,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4703,7 +4703,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4711,7 +4711,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4731,7 +4731,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4739,7 +4739,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4759,7 +4759,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4767,7 +4767,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4787,7 +4787,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4795,7 +4795,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4815,7 +4815,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4823,7 +4823,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4843,7 +4843,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4851,7 +4851,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4871,7 +4871,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } }, @@ -4879,7 +4879,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "10000000", "currentDifficulty" : "256", "currentTimestamp" : "1", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -4899,7 +4899,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "1000000" } } } diff --git a/test/vmBitwiseLogicOperationTestFiller.json b/test/vmBitwiseLogicOperationTestFiller.json index 8954dca1e..1eb923f4f 100644 --- a/test/vmBitwiseLogicOperationTestFiller.json +++ b/test/vmBitwiseLogicOperationTestFiller.json @@ -10,7 +10,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (LT (- 0 2) 0 )}", "storage": {} @@ -20,10 +20,10 @@ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", - "value" : "1000000000000000000", + "value" : "10000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -38,7 +38,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "10000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (LT 0 (- 0 2) )}", "storage": {} @@ -48,10 +48,10 @@ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", - "value" : "1000000000000000000", + "value" : "10000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -66,7 +66,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "10000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (LT 115792089237316195423570985008687907853269984665640564039457584007913129639935 0 )}", "storage": {} @@ -76,10 +76,10 @@ "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", - "value" : "1000000000000000000", - "data" : "", + "value" : "10000000000000000000", + "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -95,7 +95,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (LT 0 115792089237316195423570985008687907853269984665640564039457584007913129639935 )}", "storage": {} @@ -108,7 +108,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -123,7 +123,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] ( GT (- 0 2) 0 )}", "storage": {} @@ -136,7 +136,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -151,7 +151,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (GT 0 (- 0 2) )}", "storage": {} @@ -164,7 +164,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -179,7 +179,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (GT 115792089237316195423570985008687907853269984665640564039457584007913129639935 0 )}", "storage": {} @@ -192,7 +192,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -208,7 +208,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (GT 0 115792089237316195423570985008687907853269984665640564039457584007913129639935 )}", "storage": {} @@ -221,7 +221,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -236,7 +236,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SLT (- 0 2) 0 )}", "storage": {} @@ -249,7 +249,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -264,7 +264,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SLT 0 (- 0 2) )}", "storage": {} @@ -277,7 +277,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -292,7 +292,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SLT 115792089237316195423570985008687907853269984665640564039457584007913129639935 0 )}", "storage": {} @@ -305,7 +305,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -321,7 +321,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SLT 0 115792089237316195423570985008687907853269984665640564039457584007913129639935 )}", "storage": {} @@ -334,7 +334,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -349,7 +349,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SLT (- 0 5) (- 0 3) )}", "storage": {} @@ -362,7 +362,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -377,7 +377,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SGT (- 0 2) 0 )}", "storage": {} @@ -390,7 +390,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -405,7 +405,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SGT 0 (- 0 2) )}", "storage": {} @@ -418,7 +418,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -433,7 +433,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SGT 115792089237316195423570985008687907853269984665640564039457584007913129639935 0 )}", "storage": {} @@ -446,7 +446,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -462,7 +462,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SGT 0 115792089237316195423570985008687907853269984665640564039457584007913129639935 )}", "storage": {} @@ -475,7 +475,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -490,7 +490,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SGT (- 0 5) (- 0 3) )}", "storage": {} @@ -503,7 +503,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -518,7 +518,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (EQ (- 0 5) (- 0 3) )}", "storage": {} @@ -531,7 +531,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -546,7 +546,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (EQ 0 0)}", "storage": {} @@ -559,7 +559,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -574,7 +574,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (EQ 115792089237316195423570985008687907853269984665640564039457584007913129639935 115792089237316195423570985008687907853269984665640564039457584007913129639935 )}", "storage": {} @@ -587,7 +587,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -602,7 +602,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (ISZERO 115792089237316195423570985008687907853269984665640564039457584007913129639935 )}", "storage": {} @@ -615,7 +615,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -630,7 +630,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (ISZERO 0 )}", "storage": {} @@ -643,7 +643,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "iszeo2": { @@ -657,7 +657,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (ISZERO (- 0 2) )}", "storage": {} @@ -670,7 +670,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -685,7 +685,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (AND 2 2) }", "storage": {} @@ -698,7 +698,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -713,7 +713,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (AND 2 1) }", "storage": {} @@ -726,7 +726,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -741,7 +741,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (AND 3 1) }", "storage": {} @@ -754,7 +754,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "and3": { @@ -768,7 +768,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (AND 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef) } ", "storage": {} @@ -781,7 +781,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "and4": { @@ -795,7 +795,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (AND 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) } ", "storage": {} @@ -808,7 +808,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -823,7 +823,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (AND 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeefeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) } ", "storage": {} @@ -836,7 +836,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -851,7 +851,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (OR 2 2) } ", "storage": {} @@ -864,7 +864,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -879,7 +879,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (OR 2 1) } ", "storage": {} @@ -892,7 +892,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -907,7 +907,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (OR 3 1) } ", "storage": {} @@ -920,7 +920,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "or3": { @@ -934,7 +934,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (OR 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef) } ", "storage": {} @@ -947,7 +947,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "or4": { @@ -961,7 +961,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (OR 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) } ", "storage": {} @@ -974,7 +974,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -989,7 +989,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (OR 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeefeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) } ", "storage": {} @@ -1002,7 +1002,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1017,7 +1017,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (XOR 2 2) } ", "storage": {} @@ -1030,7 +1030,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1045,7 +1045,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (XOR 2 1) } ", "storage": {} @@ -1058,7 +1058,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1073,7 +1073,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (XOR 3 1) } ", "storage": {} @@ -1086,7 +1086,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "xor3": { @@ -1100,7 +1100,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (XOR 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef) } ", "storage": {} @@ -1113,7 +1113,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "xor4": { @@ -1127,7 +1127,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (XOR 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) } ", "storage": {} @@ -1140,7 +1140,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1155,7 +1155,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (XOR 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeefeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) } ", "storage": {} @@ -1168,7 +1168,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1183,7 +1183,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (NOT 0 )}", "storage": {} @@ -1196,7 +1196,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1211,7 +1211,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (NOT 2 )}", "storage": {} @@ -1224,7 +1224,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1239,7 +1239,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (NOT 115792089237316195423570985008687907853269984665640564039457584007913129639935 )}", "storage": {} @@ -1252,7 +1252,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1267,7 +1267,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (NOT (- 0 2) )}", "storage": {} @@ -1280,7 +1280,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1295,7 +1295,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (NOT (- 0 115792089237316195423570985008687907853269984665640564039457584007913129639935) )}", "storage": {} @@ -1308,7 +1308,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1323,7 +1323,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (NOT (- 0 0) )}", "storage": {} @@ -1336,7 +1336,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1351,7 +1351,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE (- 31 0) 0x8040201008040201 ) } ", "storage": {} @@ -1364,7 +1364,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "byte1": { @@ -1378,7 +1378,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE (- 31 1) 0x8040201008040201 ) } ", "storage": {} @@ -1391,7 +1391,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "byte2": { @@ -1405,7 +1405,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE (- 31 2) 0x8040201008040201 ) } ", "storage": {} @@ -1418,7 +1418,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1433,7 +1433,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE (- 31 3) 0x8040201008040201 ) } ", "storage": {} @@ -1446,7 +1446,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1461,7 +1461,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE (- 31 4) 0x8040201008040201 ) } ", "storage": {} @@ -1474,7 +1474,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1489,7 +1489,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE (- 31 5) 0x8040201008040201 ) } ", "storage": {} @@ -1502,7 +1502,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1518,7 +1518,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE (- 31 6) 0x8040201008040201 ) } ", "storage": {} @@ -1531,7 +1531,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1546,7 +1546,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE (- 31 7) 0x8040201008040201 ) } ", "storage": {} @@ -1559,7 +1559,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1575,7 +1575,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE (- 31 31) 0x8040201008040201 ) } ", "storage": {} @@ -1588,7 +1588,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1603,7 +1603,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE (SDIV 31 32) 0x8040201008040201 ) } ", "storage": {} @@ -1616,7 +1616,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1631,7 +1631,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0x8040201008040201 ) } ", "storage": {} @@ -1644,7 +1644,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1659,7 +1659,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "1000000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BYTE 0 0x8040201008040201) } ", "storage": {} @@ -1672,7 +1672,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } } } diff --git a/test/vmBlockInfoTestFiller.json b/test/vmBlockInfoTestFiller.json index 04cbec51c..c86a9f2cb 100644 --- a/test/vmBlockInfoTestFiller.json +++ b/test/vmBlockInfoTestFiller.json @@ -10,7 +10,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BLOCKHASH 2) }", "storage": {} @@ -23,7 +23,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -38,7 +38,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BLOCKHASH 1) }", "storage": {} @@ -51,7 +51,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -66,7 +66,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BLOCKHASH 1) }", "storage": {} @@ -79,7 +79,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -94,7 +94,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BLOCKHASH 0) }", "storage": {} @@ -107,7 +107,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -122,7 +122,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BLOCKHASH 1) [[ 1 ]] (BLOCKHASH 2) [[ 2 ]] (BLOCKHASH 256) }", "storage": {} @@ -135,7 +135,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -150,7 +150,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BLOCKHASH 0) [[ 1 ]] (BLOCKHASH 257) [[ 2 ]] (BLOCKHASH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }", "storage": {} @@ -163,7 +163,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -178,7 +178,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (COINBASE) }", "storage": {} @@ -191,7 +191,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -206,7 +206,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (TIMESTAMP) }", "storage": {} @@ -219,7 +219,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -234,7 +234,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (NUMBER) }", "storage": {} @@ -247,7 +247,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -262,7 +262,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (DIFFICULTY) }", "storage": {} @@ -275,7 +275,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -290,7 +290,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (GASLIMIT) }", "storage": {} @@ -303,7 +303,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } } } diff --git a/test/vmEnvironmentalInfoTestFiller.json b/test/vmEnvironmentalInfoTestFiller.json index c63cd914c..4de871d9e 100644 --- a/test/vmEnvironmentalInfoTestFiller.json +++ b/test/vmEnvironmentalInfoTestFiller.json @@ -10,7 +10,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (ADDRESS)}", "storage": {} @@ -38,7 +38,7 @@ }, "pre" : { "cd1722f3947def4cf144679da39c4c32bdc35681" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (ADDRESS)}", "storage": {} @@ -66,7 +66,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BALANCE 0xcd1722f3947def4cf144679da39c4c32bdc35681 )}", "storage": {} @@ -94,7 +94,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BALANCE 0xcd1722f3947def4cf144679da39c4c32bdc35681aa )}", "storage": {} @@ -122,7 +122,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BALANCE 0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6aa )}", "storage": {} @@ -150,7 +150,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BALANCE 0xaa0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6 )}", "storage": {} @@ -179,7 +179,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (BALANCE 0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6 )}", "storage": {} @@ -207,7 +207,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (EQ (BALANCE 0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6) (BALANCE (ADDRESS)))}", "storage": {} @@ -236,7 +236,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (EQ (BALANCE 0xcd1722f3947def4cf144679da39c4c32bdc35681) (BALANCE (CALLER)))}", "storage": {} @@ -264,7 +264,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (ORIGIN)}", "storage": {} @@ -292,7 +292,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CALLER)}", "storage": {} @@ -321,7 +321,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CALLVALUE)}", "storage": {} @@ -350,7 +350,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CALLDATALOAD 0)}", "storage": {} @@ -378,7 +378,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CALLDATALOAD 1)}", "storage": {} @@ -406,7 +406,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CALLDATALOAD 5)}", "storage": {} @@ -434,7 +434,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CALLDATALOAD 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa)}", "storage": {} @@ -462,7 +462,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CALLDATASIZE)}", "storage": {} @@ -490,7 +490,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CALLDATASIZE)}", "storage": {} @@ -518,7 +518,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CALLDATASIZE)}", "storage": {} @@ -546,7 +546,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (CALLDATACOPY 0 1 2 ) [[ 0 ]] @0}", "storage": {} @@ -574,7 +574,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (CALLDATACOPY 0 0 0 ) [[ 0 ]] @0}", "storage": {} @@ -602,7 +602,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (CALLDATACOPY 0 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa 0xff ) [[ 0 ]] @0}", "storage": {} @@ -630,7 +630,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (CALLDATACOPY 0 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa 9 ) [[ 0 ]] @0}", "storage": {} @@ -658,7 +658,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (CALLDATACOPY 0 1 1 ) [[ 0 ]] @0}", "storage": {} @@ -686,7 +686,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (CALLDATACOPY 0 1 0 ) [[ 0 ]] @0}", "storage": {} @@ -882,7 +882,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CODESIZE)}", "storage": {} @@ -910,7 +910,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (CODECOPY 0 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa 8 ) [[ 0 ]] @0}", "storage": {} @@ -938,7 +938,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (CODECOPY 0 0 5 ) [[ 0 ]] @0 }", "storage": {} @@ -966,7 +966,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (CODECOPY 0 0 5 ) [[ 0 ]] @0 }", "storage": {} @@ -994,7 +994,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (CODECOPY 0 0 0 ) [[ 0 ]] @0 }", "storage": {} @@ -1022,7 +1022,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (GASPRICE) }", "storage": {} @@ -1050,7 +1050,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (EXTCODESIZE 0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6aa )}", "storage": {} @@ -1078,7 +1078,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (EXTCODESIZE 0xaa0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6 )}", "storage": {} @@ -1107,13 +1107,13 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (EQ (EXTCODESIZE (CALLER)) (CODESIZE) ) }", "storage": {} }, "cd1722f3947def4cf144679da39c4c32bdc35681" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (EQ (EXTCODESIZE (CALLER)) (CODESIZE) ) }", "storage": {} @@ -1140,13 +1140,13 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (CODESIZE) }", "storage": {} }, "cd1722f3947def4cf144679da39c4c32bdc35681" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (EXTCODESIZE (CALLER) ) }", "storage": {} @@ -1174,7 +1174,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (EXTCODECOPY (ADDRESS) 0 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa 8 ) [[ 0 ]] @0}", "storage": {} @@ -1202,13 +1202,13 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (EXTCODECOPY (CALLER) 0 0 0 ) ) [[ 0 ]] @0 }", "storage": {} }, "cd1722f3947def4cf144679da39c4c32bdc35681" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] 5 }", "storage": {} @@ -1237,13 +1237,13 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (EXTCODECOPY (CALLER) 0 0 (EXTCODESIZE (CALLER) ) ) [[ 0 ]] @0 }", "storage": {} }, "cd1722f3947def4cf144679da39c4c32bdc35681" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] 5 }", "storage": {} @@ -1271,13 +1271,13 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (EXTCODECOPY 0xaacd1722f3947def4cf144679da39c4c32bdc35681 0 0 (EXTCODESIZE (CALLER) ) ) [[ 0 ]] @0 }", "storage": {} }, "cd1722f3947def4cf144679da39c4c32bdc35681" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] 5 }", "storage": {} @@ -1305,13 +1305,13 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (EXTCODECOPY 0xcd1722f3947def4cf144679da39c4c32bdc35681aa 0 0 (EXTCODESIZE (CALLER) ) ) [[ 0 ]] @0 }", "storage": {} }, "cd1722f3947def4cf144679da39c4c32bdc35681" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] 5 }", "storage": {} diff --git a/test/vmIOandFlowOperationsTestFiller.json b/test/vmIOandFlowOperationsTestFiller.json index f71109e17..995b9d6da 100644 --- a/test/vmIOandFlowOperationsTestFiller.json +++ b/test/vmIOandFlowOperationsTestFiller.json @@ -10,7 +10,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6002600360045055", "storage": {} @@ -23,7 +23,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -38,7 +38,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x5060026003600455", "storage": {} @@ -51,7 +51,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -66,7 +66,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600260035155", "storage": {} @@ -79,7 +79,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -94,7 +94,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600260035255", "storage": {} @@ -107,7 +107,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -122,7 +122,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{(MSTORE 0 23) [[ 1 ]] (MLOAD 0) } ", "storage": {} @@ -135,7 +135,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -150,7 +150,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{[[ 0 ]] (MLOAD 0) } ", "storage": {} @@ -163,7 +163,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -178,7 +178,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{(MSTORE 1 23) [[ 1 ]] (MLOAD 0) } ", "storage": {} @@ -191,7 +191,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -206,7 +206,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 1 ]] (MLOAD 7489573) } ", "storage": {} @@ -219,7 +219,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -234,7 +234,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 1 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) [[ 1 ]] (MLOAD 1) } ", "storage": {} @@ -247,7 +247,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -262,7 +262,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 1 (+ 2 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) ) [[ 1 ]] (MLOAD 1) } ", "storage": {} @@ -275,7 +275,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -290,7 +290,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 1 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff23 ) [[ 1 ]] (MLOAD 1) } ", "storage": {} @@ -303,7 +303,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -318,7 +318,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE8 1 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff23 ) [[ 1 ]] (MLOAD 1) } ", "storage": {} @@ -331,7 +331,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -346,7 +346,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE8 1 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ) [[ 1 ]] (MLOAD 1) } ", "storage": {} @@ -359,7 +359,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -374,7 +374,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE8 1 0xff) (MSTORE8 2 0xee) [[ 1 ]] (MLOAD 0) } ", "storage": {} @@ -387,7 +387,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -402,7 +402,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (SSTORE 0 0xff) (SSTORE 10 0xee) [[ 20 ]] (SLOAD 0) } ", "storage": {} @@ -415,7 +415,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -430,7 +430,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (SSTORE 0 0xff) (SSTORE 10 0xee) [[ 20 ]] (SLOAD 100) } ", "storage": {} @@ -443,7 +443,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -458,7 +458,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (SSTORE 0 0xff) (SSTORE 1 0xee) (SSTORE 2 0xdd) [[ 10 ]] (SLOAD 1) [[ 20 ]] (SLOAD 2) } ", "storage": {} @@ -471,7 +471,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -486,7 +486,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6009565b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b", "storage": {} @@ -514,7 +514,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6006560060015b6002600355", "storage": {} @@ -527,7 +527,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -542,7 +542,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60016008570060015b6002600355", "storage": {} @@ -555,7 +555,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -570,7 +570,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60055661eeff", "storage": {} @@ -583,7 +583,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -598,7 +598,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600456655b6001600155", "storage": {} @@ -611,7 +611,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -626,7 +626,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600160075761eeff", "storage": {} @@ -639,7 +639,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -654,7 +654,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6001600657655b6001600155", "storage": {} @@ -667,7 +667,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -682,7 +682,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x5b600056", "storage": {} @@ -695,7 +695,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -710,7 +710,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x565b600056", "storage": {} @@ -723,7 +723,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -823,7 +823,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6002600401565b600360005260206000f3600656", "storage": {} @@ -836,7 +836,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -851,7 +851,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236007566001600255", "storage": {} @@ -864,7 +864,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "jump0_jumpdest0": { @@ -878,7 +878,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x602360075660015b600255", "storage": {} @@ -891,7 +891,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -906,7 +906,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236007566001600255", "storage": {} @@ -919,7 +919,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -934,7 +934,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x602360085660015b600255", "storage": {} @@ -947,7 +947,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -962,7 +962,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600a6008505660015b600255", "storage": {} @@ -975,7 +975,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -990,7 +990,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600b6008505660015b600255", "storage": {} @@ -1003,7 +1003,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1018,7 +1018,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x620fffff620fffff0156", "storage": {} @@ -1031,7 +1031,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1046,7 +1046,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x602360016009576001600255", "storage": {} @@ -1059,7 +1059,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1074,7 +1074,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236001600a5760015b600255", "storage": {} @@ -1087,7 +1087,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1102,7 +1102,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x602360006009576001600255", "storage": {} @@ -1115,7 +1115,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1130,7 +1130,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff576002600355", "storage": {} @@ -1143,7 +1143,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1158,7 +1158,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6008600101560060015b6002600355", "storage": {} @@ -1171,7 +1171,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1186,7 +1186,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60016008600301570060015b6002600355", "storage": {} @@ -1199,7 +1199,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1214,7 +1214,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60056003015661eeff", "storage": {} @@ -1227,7 +1227,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1242,7 +1242,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600460030156655b6001600155", "storage": {} @@ -1255,7 +1255,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1270,7 +1270,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600160076003015761eeff", "storage": {} @@ -1283,7 +1283,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1298,7 +1298,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6001600660030157655b6001600155", "storage": {} @@ -1311,7 +1311,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1326,7 +1326,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x5b586000555960115758600052596000575b58600055", "storage": {} @@ -1339,7 +1339,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1354,7 +1354,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x5b600060000156", "storage": {} @@ -1367,7 +1367,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1382,7 +1382,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236007600301566001600255", "storage": {} @@ -1395,7 +1395,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "DynamicJump0_jumpdest0": { @@ -1409,7 +1409,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x602360076003015660015b600255", "storage": {} @@ -1422,7 +1422,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1437,7 +1437,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236007600301566001600255", "storage": {} @@ -1450,7 +1450,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1465,7 +1465,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x602360086003015660015b600255", "storage": {} @@ -1478,7 +1478,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1493,7 +1493,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600a6008506003015660015b600255", "storage": {} @@ -1506,7 +1506,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1521,7 +1521,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600b6008506003015660015b600255", "storage": {} @@ -1534,7 +1534,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1549,7 +1549,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x620fffff620fffff0160030156", "storage": {} @@ -1562,7 +1562,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1577,7 +1577,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x602360016009600301576001600255", "storage": {} @@ -1590,7 +1590,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1605,7 +1605,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236001600a6003015760015b600255", "storage": {} @@ -1618,7 +1618,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1633,7 +1633,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x602360006009600301576001600255", "storage": {} @@ -1646,7 +1646,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1661,7 +1661,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0600301576002600355", "storage": {} @@ -1674,7 +1674,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1689,7 +1689,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600160084301570060015b6002600355", "storage": {} @@ -1702,7 +1702,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1717,7 +1717,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600543015661eeff", "storage": {} @@ -1730,7 +1730,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1745,7 +1745,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6004430156655b6001600155", "storage": {} @@ -1758,7 +1758,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1773,7 +1773,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6001600743015761eeff", "storage": {} @@ -1786,7 +1786,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1801,7 +1801,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60016006430157655b6001600155", "storage": {} @@ -1814,7 +1814,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1829,7 +1829,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x5b600060000156", "storage": {} @@ -1842,7 +1842,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1857,7 +1857,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x602360074301566001600255", "storage": {} @@ -1870,7 +1870,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "BlockNumberDynamicJump0_jumpdest0": { @@ -1884,7 +1884,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600743015660015b600255", "storage": {} @@ -1897,7 +1897,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1912,7 +1912,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x602360074301566001600255", "storage": {} @@ -1925,7 +1925,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1940,7 +1940,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600843015660015b600255", "storage": {} @@ -1953,7 +1953,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1968,7 +1968,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600a60085043015660015b600255", "storage": {} @@ -1981,7 +1981,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1996,7 +1996,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600b60085043015660015b600255", "storage": {} @@ -2009,7 +2009,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2024,7 +2024,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x620fffff620fffff01430156", "storage": {} @@ -2037,7 +2037,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2052,7 +2052,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600160094301576001600255", "storage": {} @@ -2065,7 +2065,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2080,7 +2080,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236001600a43015760015b600255", "storage": {} @@ -2093,7 +2093,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2108,7 +2108,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600060094301576001600255", "storage": {} @@ -2121,7 +2121,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2136,7 +2136,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04301576002600355", "storage": {} @@ -2149,7 +2149,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2165,7 +2165,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "//" : "PUSH1 3 JUMP", "code" : "0x6009436006575b566001", @@ -2179,7 +2179,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2194,7 +2194,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600a436006575b5660015b6001600155", "storage": {} @@ -2207,7 +2207,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2222,7 +2222,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x435660615b4343025660615b60615b5b5b6001600155", "storage": {} @@ -2235,7 +2235,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2250,7 +2250,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x435660615b4343025660615b60615b605b6001600155", "storage": {} @@ -2263,7 +2263,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2278,7 +2278,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x435631615b60615b60615b606001600155", "storage": {} @@ -2291,7 +2291,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2306,7 +2306,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x435631615b60615b60615b606001600155", "storage": {} @@ -2319,7 +2319,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2334,7 +2334,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x435631615b60615b60615b606001600155", "storage": {} @@ -2347,7 +2347,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2362,7 +2362,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6001600860005401570060015b6002600355", "storage" : { @@ -2377,7 +2377,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2392,7 +2392,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6005600054015661eeff", "storage" : { @@ -2407,7 +2407,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2422,7 +2422,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60046000540156655b6001600155", "storage" : { @@ -2437,7 +2437,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2452,7 +2452,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60016007600054015761eeff", "storage" : { @@ -2467,7 +2467,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2482,7 +2482,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600160066000540157655b6001600155", "storage" : { @@ -2497,7 +2497,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2512,7 +2512,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x5b600060000156", "storage" : { @@ -2527,7 +2527,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2542,7 +2542,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600760005401566001600255", "storage" : { @@ -2558,7 +2558,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "JDfromStorageDynamicJump0_jumpdest0": { @@ -2572,7 +2572,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236007600054015660015b600255", "storage" : { @@ -2587,7 +2587,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2602,7 +2602,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600760005401566001600255", "storage" : { @@ -2618,7 +2618,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2633,7 +2633,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236008600054015660015b600255", "storage" : { @@ -2648,7 +2648,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2663,7 +2663,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600a600850600054015660015b600255", "storage" : { @@ -2679,7 +2679,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2694,7 +2694,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6023600b600850600054015660015b600255", "storage" : { @@ -2709,7 +2709,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2724,7 +2724,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x620fffff620fffff016000540156", "storage" : { @@ -2740,7 +2740,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2755,7 +2755,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236001600960005401576001600255", "storage" : { @@ -2770,7 +2770,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2785,7 +2785,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236001600a600054015760015b600255", "storage" : { @@ -2801,7 +2801,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2816,7 +2816,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60236000600960005401576001600255", "storage" : { @@ -2831,7 +2831,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2846,7 +2846,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff060005401576002600355", "storage" : { @@ -2861,7 +2861,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2877,7 +2877,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (PC)}", "storage": {} @@ -2890,7 +2890,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2905,7 +2905,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{(SSTORE 0 0xff) [[ 0 ]] (PC)}", "storage": {} @@ -2918,7 +2918,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2933,7 +2933,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{(MSTORE 0 0xff) [[ 0 ]] (MSIZE)}", "storage": {} @@ -2946,7 +2946,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2961,7 +2961,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{(MSTORE 0 0xffffffffff) [[ 0 ]] (MSIZE)}", "storage": {} @@ -2974,7 +2974,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -2989,7 +2989,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{(MSTORE 0 0xffffffffff) (MSTORE 32 0xeeee) [[ 0 ]] (MSIZE)}", "storage": {} @@ -3002,7 +3002,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3017,7 +3017,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{(MSTORE 0 0xffffffffff) (MSTORE 90 0xeeee) [[ 0 ]] (MSIZE)}", "storage": {} @@ -3030,7 +3030,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3045,7 +3045,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{(MSTORE 0 0xffffffffff) (MSTORE 90 0xeeee) [[ 0 ]] (GAS)}", "storage": {} @@ -3058,7 +3058,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3073,7 +3073,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{[[ 0 ]] (GAS)}", "storage": {} @@ -3086,7 +3086,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3101,7 +3101,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 0x112233445566778899001122334455667788990011223344556677889900aabb 0 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 1 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 2 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 3 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 4 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 5 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 6 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 7 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 8 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 9 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 10 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 11 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 12 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 13 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 14 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 15 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 16 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 17 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 18 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 19 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 20 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 21 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 22 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 23 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 24 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 25 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 26 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 27 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 28 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 29 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 30 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 31 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 32 BYTE 0x112233445566778899001122334455667788990011223344556677889900aabb 2014 BYTE 0 0 SSTORE)", "storage": {} @@ -3114,7 +3114,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3129,7 +3129,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 2 0 MSTORE8 3 1 MSTORE8 0 MLOAD 1 MLOAD ADD 2 MSTORE 64 0 RETURN)", "storage": {} @@ -3142,7 +3142,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3157,7 +3157,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 1 1000000 RETURN)", "storage": {} @@ -3170,7 +3170,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3185,7 +3185,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [i] 1 ( if (> @i 0) { (return 39) [i] 2 } (return 1) ) }", "storage": {} @@ -3198,7 +3198,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3213,7 +3213,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 0x4 0x6 0x9 0x14 JUMP JUMPDEST 0xa SUB 0x0 MSTORE MSIZE 0x0 RETURN JUMPDEST 0x0 MSTORE ADD 0x9 JUMP)", "storage": {} @@ -3226,7 +3226,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3241,7 +3241,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[69]] (caller) (return 0 (lll (when (= (caller) @@69) (for {} (< @i (calldatasize)) [i](+ @i 64) [[ (calldataload @i) ]] (calldataload (+ @i 32)) ) ) 0))}", "storage": {} @@ -3254,7 +3254,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3279,7 +3279,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "code" : "(asm 10 0 MSTORE JUMPDEST 0 MLOAD 1 SWAP1 SUB DUP1 0 MSTORE 5 JUMPI)", "nonce" : "0", "storage" : {} @@ -3298,7 +3298,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 27 37 MUL JUMP JUMPDEST)", "storage": {} @@ -3311,7 +3311,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3326,7 +3326,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 1 3 3 MUL JUMPI 0 0 JUMP)", "storage": {} @@ -3339,7 +3339,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3354,7 +3354,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(for [i]:10 (> @i 0) [i](- @i 1) [j](+ @i @j))", "storage": {} @@ -3367,7 +3367,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3382,7 +3382,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(for [i]:0 (< @i 10) [i](+ @i 1) [j](+ @i @j))", "storage": {} @@ -3395,7 +3395,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3410,7 +3410,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 4 3 ADD JUMP STOP JUMPDEST 1 0 MSTORE MSIZE 0 RETURN)", "storage": {} @@ -3423,7 +3423,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3438,7 +3438,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 8 6 ADD JUMP STOP JUMPDEST 1 0 MSTORE STOP JUMPDEST 2 0 MSTORE MSIZE 0 RETURN)", "storage": {} @@ -3451,7 +3451,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3466,7 +3466,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 1 4 5 ADD JUMPI STOP JUMPDEST 1 0 MSTORE MSIZE 0 RETURN)", "storage": {} @@ -3479,7 +3479,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3494,7 +3494,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 0 7 5 ADD JUMPI 1 0 MSTORE STOP JUMPDEST)", "storage": {} @@ -3507,7 +3507,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3522,7 +3522,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 10 JUMPDEST 1 DUP2 SUB DUP1 2 JUMPI 0 MSTORE8 1 MSTORE8 2 MSTORE8 3 MSTORE8 4 MSTORE8 5 MSTORE8 6 MSTORE8 7 MSTORE8 8 MSTORE8 9 MSTORE8 MSIZE 0 RETURN)", "storage": {} @@ -3535,7 +3535,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -3550,7 +3550,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(when (> 1 0) [i] 13)", "storage": {} @@ -3563,7 +3563,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } } } diff --git a/test/vmLogTestFiller.json b/test/vmLogTestFiller.json index 5b63957c5..fea69a4a9 100644 --- a/test/vmLogTestFiller.json +++ b/test/vmLogTestFiller.json @@ -10,7 +10,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (LOG0 0 0) }", "storage": {} @@ -23,7 +23,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -38,7 +38,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG0 0 32) }", "storage": {} @@ -51,7 +51,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -66,7 +66,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG0 0 32) (LOG0 2 16) }", "storage": {} @@ -79,7 +79,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -94,7 +94,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG0 0 1) }", "storage": {} @@ -107,7 +107,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -123,7 +123,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG0 31 1) }", "storage": {} @@ -136,7 +136,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -151,7 +151,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 1) }", "storage": {} @@ -164,7 +164,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -179,7 +179,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG0 1 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }", "storage": {} @@ -192,7 +192,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -207,7 +207,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG0 1 0) }", "storage": {} @@ -220,7 +220,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -235,7 +235,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (LOG1 0 0 0) }", "storage": {} @@ -248,7 +248,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -263,7 +263,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", "storage": {} @@ -276,7 +276,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -291,7 +291,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG1 0 1 0) }", "storage": {} @@ -304,7 +304,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -320,7 +320,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG1 31 1 0) }", "storage": {} @@ -333,7 +333,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -348,7 +348,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG1 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 1 0) }", "storage": {} @@ -361,7 +361,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -376,7 +376,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG1 1 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0) }", "storage": {} @@ -389,7 +389,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -404,7 +404,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG1 1 0 0) }", "storage": {} @@ -417,7 +417,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -432,7 +432,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG1 0 32 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }", "storage": {} @@ -445,7 +445,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -460,7 +460,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE8 0 0xff) (LOG1 0 32 (CALLER)) }", "storage": {} @@ -473,7 +473,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -488,7 +488,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (LOG2 0 0 0 0) }", "storage": {} @@ -501,7 +501,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -516,7 +516,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG2 0 32 0 0) }", "storage": {} @@ -529,7 +529,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -544,7 +544,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG2 0 1 0 0) }", "storage": {} @@ -557,7 +557,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -573,7 +573,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG2 31 1 0 0) }", "storage": {} @@ -586,7 +586,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -601,7 +601,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG2 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 1 0 0) }", "storage": {} @@ -614,7 +614,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -629,7 +629,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG2 1 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0 0) }", "storage": {} @@ -642,7 +642,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -657,7 +657,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG2 1 0 0 0) }", "storage": {} @@ -670,7 +670,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -685,7 +685,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG2 0 32 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }", "storage": {} @@ -698,7 +698,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -713,7 +713,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE8 0 0xff) (LOG2 0 32 0 (CALLER) ) }", "storage": {} @@ -726,7 +726,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -741,7 +741,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (LOG3 0 0 0 0 0) }", "storage": {} @@ -754,7 +754,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -769,7 +769,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG3 0 32 0 0 0) }", "storage": {} @@ -782,7 +782,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -797,7 +797,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG3 0 1 0 0 0) }", "storage": {} @@ -810,7 +810,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -826,7 +826,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG3 31 1 0 0 0) }", "storage": {} @@ -839,7 +839,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -854,7 +854,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG3 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 1 0 0 0) }", "storage": {} @@ -867,7 +867,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -882,7 +882,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG3 1 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0 0 0) }", "storage": {} @@ -895,7 +895,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -910,7 +910,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG3 1 0 0 0 0) }", "storage": {} @@ -923,7 +923,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -938,7 +938,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG3 0 32 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }", "storage": {} @@ -951,7 +951,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -966,7 +966,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE8 0 0xff) (LOG3 0 32 0 0 (CALLER) ) }", "storage": {} @@ -979,7 +979,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -994,7 +994,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE8 0 0xff) (LOG3 0 32 (PC) (PC) (PC) ) }", "storage": {} @@ -1007,7 +1007,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1022,7 +1022,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (LOG4 0 0 0 0 0 0) }", "storage": {} @@ -1035,7 +1035,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1050,7 +1050,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG4 0 32 0 0 0 0) }", "storage": {} @@ -1063,7 +1063,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1078,7 +1078,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG4 0 1 0 0 0 0) }", "storage": {} @@ -1091,7 +1091,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1107,7 +1107,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG4 31 1 0 0 0 0) }", "storage": {} @@ -1120,7 +1120,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1135,7 +1135,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG4 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 1 0 0 0 0) }", "storage": {} @@ -1148,7 +1148,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1163,7 +1163,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG4 1 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0 0 0 0) }", "storage": {} @@ -1176,7 +1176,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1191,7 +1191,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG4 1 0 0 0 0 0) }", "storage": {} @@ -1204,7 +1204,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1219,7 +1219,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd) (LOG4 0 32 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) }", "storage": {} @@ -1232,7 +1232,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1247,7 +1247,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE8 0 0xff) (LOG3 0 32 0 0 0 (CALLER) ) }", "storage": {} @@ -1260,7 +1260,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1275,7 +1275,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE8 0 0xff) (LOG3 0 32 (PC) (PC) (PC) (PC) ) }", "storage": {} @@ -1288,7 +1288,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } } } diff --git a/test/vmPerformanceTestFiller.json b/test/vmPerformanceTestFiller.json index e33bd1955..e9cb4806d 100644 --- a/test/vmPerformanceTestFiller.json +++ b/test/vmPerformanceTestFiller.json @@ -10,7 +10,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "//" : "ManyFunctions.sol", "code" : "0x60e060020a60003504806301f99ad7146108c3578063023a624a146108d857806303bdecf5146108ed57806305fe035f14610902578063082d8f4914610917578063090bf3b71461092c5780630bd9c534146109415780630c4bfa94146109565780630e20ebe21461096b5780630f76de0d1461098057806310cfcc191461099557806313ce15a9146109aa578063140dcec4146109bf57806314d07a3e146109d45780631687f112146109e957806316eb6603146109fe578063172cf71714610a135780631bd6f59614610a285780631cdb857114610a3d5780631cf74ece14610a525780631d09ba2c14610a675780631f69aa5114610a7c578063223dcc7414610a9157806325e524d314610aa6578063261de7c414610abb5780632632924d14610ad05780632909cc5d14610ae55780632981699814610afa5780632a85a45d14610b0f5780632ca36da014610b245780632cbf1f0d14610b395780632d0f557314610b4e5780632d97867814610b6357806331db9efd14610b7857806332064db714610b8d57806332931fbb14610ba2578063355f51a014610bb7578063361bb34014610bcc578063364ddb0e14610be15780633792a01814610bf657806338c68f8f14610c0b57806338e586fd14610c20578063392d42ae14610c3557806339a87bd914610c4a5780633a95a33214610c5f5780633b8ecdf914610c745780633cf0659a14610c895780633eaf992314610c9e5780633fe97ead14610cb35780633ff11c8b14610cc8578063404efc5314610cdd578063407fce7b14610cf257806340c3b18714610d07578063440208c314610d1c57806344e86b2f14610d31578063455df57914610d465780634689ab4d14610d5b57806346be2e0c14610d70578063487cd86f14610d8557806348e6178214610d9a57806349d4a34414610daf5780634a0f597414610dc45780634bc24ec514610dd95780634c2fe45614610dee5780634cc885d414610e035780634eaaad7b14610e185780634eb166af14610e2d5780635050093414610e42578063506bff1114610e57578063508762c114610e6c578063526938f814610e8157806354400c6014610e96578063559510d814610eab57806355a5f70214610ec057806356ca528f14610ed5578063570a2a1614610eea5780635dab2e0f14610eff5780635dca53d314610f1457806362017ebc14610f29578063621a25f814610f3e578063626d4a3614610f5357806362b6a28214610f6857806364faf22c14610f7d57806366d7ffde14610f9257806367b886e814610fa757806367e902c714610fbc57806369d7774014610fd15780636b7ae8e614610fe65780636c3b659114610ffb5780636e54181e146110105780636e978d91146110255780636f63d2ec1461103a578063706332d11461104f57806370ac4bb9146110645780637138ef521461107957806371dd46a91461108e57806372a7c229146110a35780637376fc8d146110b8578063738a2679146110cd57806374552650146110e2578063746fc8d0146110f757806379254bb81461110c5780637adaa3f8146111215780637e4eb35b14611136578063885ec18e1461114b5780638b9ff6b6146111605780638ce113dc146111755780638defbc5e1461118a5780638f4613d51461119f5780638fdc24ba146111b45780639002dba4146111c957806391d15735146111de57806391d43b23146111f357806393b14daa1461120857806394d63afd1461121d57806395805dad1461123257806396f68782146112475780639740e4a21461125c578063981290131461127157806399a3f0e8146112865780639acb1ad41461129b5780639be07908146112b05780639c15be0b146112c55780639d451c4d146112da5780639d8ee943146112ef5780639ef6ca0f14611304578063a0db0a2214611319578063a18e2eb91461132e578063a408384914611343578063a57544da14611358578063a5a83e4d1461136d578063a6843f3414611382578063a6dacdd714611397578063a8c4c8bc146113ac578063aa058a73146113c1578063aad62da2146113d6578063aaf3e4f4146113eb578063ab81e77314611400578063abc93aee14611415578063abde33f71461142a578063b114b96c1461143f578063b3df873714611454578063b4174cb014611469578063b5d02a561461147e578063b731e84814611493578063b7b96723146114a8578063bbcded7a146114bd578063bbececa9146114d2578063beca7440146114e7578063bf8981c0146114fc578063c028c67414611511578063c2385fa614611526578063c319a02c1461153b578063c569bae014611550578063c6715f8114611565578063c7b98dec1461157a578063c9acab841461158f578063ca9efc73146115a4578063cad80024146115b9578063cdadb0fa146115ce578063cdbdf391146115e3578063cf460fa5146115f8578063cf69318a1461160d578063d1835b8c14611622578063d353a1cb14611637578063d3e141e01461164c578063d5ec7e1d14611661578063d7ead1de14611676578063d90b02aa1461168b578063d959e244146116a0578063d9e68b44146116b5578063daacb24f146116ca578063dc12a805146116df578063dd946033146116f4578063dda5142414611709578063de6612171461171e578063dfb9560c14611733578063e03827d214611748578063e21720001461175d578063e2c718d814611772578063e3da539914611787578063e48e603f1461179c578063e5f9ec29146117b1578063e6c0459a146117c6578063e70addec146117db578063e7a01215146117f0578063ea7f4d2714611805578063ebb6c59f1461181a578063ed6302be1461182f578063ed64b36b14611844578063eecd278914611859578063f0ed14e01461186e578063f0f2134414611883578063f1e328f914611898578063f1e6f4cd146118ad578063f32fe995146118c2578063f75165c6146118d7578063f7ed71d0146118ec578063f80f44f314611901578063f8bc050514611916578063fbd3c51a1461192b578063fd72009014611940578063fed3a3001461195557005b6108ce600435612edf565b8060005260206000f35b6108e3600435612fb5565b8060005260206000f35b6108f8600435613f47565b8060005260206000f35b61090d600435612a11565b8060005260206000f35b6109226004356127ec565b8060005260206000f35b61093760043561215c565b8060005260206000f35b61094c6004356128c2565b8060005260206000f35b61096160043561310f565b8060005260206000f35b610976600435614e0b565b8060005260206000f35b61098b600435613269565b8060005260206000f35b6109a0600435611a82565b8060005260206000f35b6109b5600435613e71565b8060005260206000f35b6109ca600435611dd2565b8060005260206000f35b6109df6004356120d0565b8060005260206000f35b6109f4600435613755565b8060005260206000f35b610a096004356134e3565b8060005260206000f35b610a1e6004356137e1565b8060005260206000f35b610a3360043561382b565b8060005260206000f35b610a48600435612b0b565b8060005260206000f35b610a5d60043561386d565b8060005260206000f35b610a726004356131e5565b8060005260206000f35b610a876004356143e9565b8060005260206000f35b610a9c60043561319b565b8060005260206000f35b610ab1600435612e11565b8060005260206000f35b610ac660043561234a565b8060005260206000f35b610adb6004356121e8565b8060005260206000f35b610af06004356119f6565b8060005260206000f35b610b05600435613bff565b8060005260206000f35b610b1a600435612606565b8060005260206000f35b610b2f6004356126d4565b8060005260206000f35b610b44600435613bb5565b8060005260206000f35b610b59600435612462565b8060005260206000f35b610b6e600435611e14565b8060005260206000f35b610b836004356149ab565b8060005260206000f35b610b98600435611c26565b8060005260206000f35b610bad600435612a7f565b8060005260206000f35b610bc2600435613457565b8060005260206000f35b610bd760043561340d565b8060005260206000f35b610bec60043561363d565b8060005260206000f35b610c01600435612e53565b8060005260206000f35b610c1660043561477b565b8060005260206000f35b610c2b600435612c6d565b8060005260206000f35b610c40600435612648565b8060005260206000f35b610c55600435612274565b8060005260206000f35b610c6a6004356138f9565b8060005260206000f35b610c7f600435612b55565b8060005260206000f35b610c94600435611eea565b8060005260206000f35b610ca9600435613ebb565b8060005260206000f35b610cbe600435613499565b8060005260206000f35b610cd3600435614807565b8060005260206000f35b610ce8600435611fb8565b8060005260206000f35b610cfd600435613083565b8060005260206000f35b610d126004356125bc565b8060005260206000f35b610d27600435613041565b8060005260206000f35b610d3c6004356140a1565b8060005260206000f35b610d516004356147bd565b8060005260206000f35b610d66600435611c70565b8060005260206000f35b610d7b600435612300565b8060005260206000f35b610d906004356123d6565b8060005260206000f35b610da5600435612c23565b8060005260206000f35b610dba600435614faf565b8060005260206000f35b610dcf600435612044565b8060005260206000f35b610de4600435613ae7565b8060005260206000f35b610df9600435614cf3565b8060005260206000f35b610e0e600435613d17565b8060005260206000f35b610e2360043561412d565b8060005260206000f35b610e38600435614177565b8060005260206000f35b610e4d60043561208e565b8060005260206000f35b610e62600435612dc7565b8060005260206000f35b610e77600435612f29565b8060005260206000f35b610e8c6004356124a4565b8060005260206000f35b610ea1600435611b58565b8060005260206000f35b610eb66004356136c9565b8060005260206000f35b610ecb600435613227565b8060005260206000f35b610ee0600435611acc565b8060005260206000f35b610ef5600435613687565b8060005260206000f35b610f0a6004356146a5565b8060005260206000f35b610f1f6004356121a6565b8060005260206000f35b610f346004356132f5565b8060005260206000f35b610f49600435613da3565b8060005260206000f35b610f5e60043561379f565b8060005260206000f35b610f73600435612878565b8060005260206000f35b610f88600435611b0e565b8060005260206000f35b610f9d600435611ea0565b8060005260206000f35b610fb2600435614ed9565b8060005260206000f35b610fc7600435614bdb565b8060005260206000f35b610fdc600435614c1d565b8060005260206000f35b610ff1600435614245565b8060005260206000f35b6110066004356146ef565b8060005260206000f35b61101b60043561428f565b8060005260206000f35b611030600435614ac3565b8060005260206000f35b611045600435613de5565b8060005260206000f35b61105a6004356132b3565b8060005260206000f35b61106f6004356122be565b8060005260206000f35b611084600435612e9d565b8060005260206000f35b611099600435611b9a565b8060005260206000f35b6110ae6004356127aa565b8060005260206000f35b6110c3600435613e2f565b8060005260206000f35b6110d8600435614849565b8060005260206000f35b6110ed600435614dc1565b8060005260206000f35b61110260043561333f565b8060005260206000f35b61111760043561211a565b8060005260206000f35b61112c600435612692565b8060005260206000f35b611141600435612904565b8060005260206000f35b611156600435612d3b565b8060005260206000f35b61116b600435614b91565b8060005260206000f35b611180600435613a5b565b8060005260206000f35b611195600435612232565b8060005260206000f35b6111aa600435612f6b565b8060005260206000f35b6111bf600435614d35565b8060005260206000f35b6111d4600435611a40565b8060005260206000f35b6111e9600435612ff7565b8060005260206000f35b6111fe60043561431b565b8060005260206000f35b611213600435613159565b8060005260206000f35b611228600435612b97565b8060005260206000f35b61123d600435612990565b8060005260206000f35b611252600435613b73565b8060005260206000f35b611267600435614961565b8060005260206000f35b61127c600435613381565b8060005260206000f35b611291600435613fd3565b8060005260206000f35b6112a660043561257a565b8060005260206000f35b6112bb600435614501565b8060005260206000f35b6112d0600435613d59565b8060005260206000f35b6112e56004356143a7565b8060005260206000f35b6112fa60043561405f565b8060005260206000f35b61130f60043561238c565b8060005260206000f35b611324600435612be1565b8060005260206000f35b611339600435613f89565b8060005260206000f35b61134e60043561294e565b8060005260206000f35b6113636004356124ee565b8060005260206000f35b611378600435614b4f565b8060005260206000f35b61138d6004356133cb565b8060005260206000f35b6113a26004356139cf565b8060005260206000f35b6113b7600435613c8b565b8060005260206000f35b6113cc600435612cf9565b8060005260206000f35b6113e1600435614a79565b8060005260206000f35b6113f66004356149ed565b8060005260206000f35b61140b600435613b29565b8060005260206000f35b611420600435613ccd565b8060005260206000f35b611435600435611f76565b8060005260206000f35b61144a600435614ff1565b8060005260206000f35b61145f600435613525565b8060005260206000f35b61147460043561356f565b8060005260206000f35b6114896004356129dc565b8060005260206000f35b61149e600435614ca9565b8060005260206000f35b6114b3600435612d85565b8060005260206000f35b6114c86004356141b9565b8060005260206000f35b6114dd600435614475565b8060005260206000f35b6114f26004356135fb565b8060005260206000f35b611507600435612530565b8060005260206000f35b61151c600435614663565b8060005260206000f35b611531600435614433565b8060005260206000f35b611546600435614f23565b8060005260206000f35b61155b600435614c67565b8060005260206000f35b611570600435611d3e565b8060005260206000f35b611585600435612a3d565b8060005260206000f35b61159a600435613a11565b8060005260206000f35b6115af600435614619565b8060005260206000f35b6115c4600435613985565b8060005260206000f35b6115d9600435613943565b8060005260206000f35b6115ee600435612418565b8060005260206000f35b6116036004356119b4565b8060005260206000f35b611618600435613a9d565b8060005260206000f35b61162d600435611cb2565b8060005260206000f35b6116426004356129d2565b8060005260206000f35b611657600435612caf565b8060005260206000f35b61166c600435611d88565b8060005260206000f35b611681600435614203565b8060005260206000f35b61169660043561458d565b8060005260206000f35b6116ab600435611f2c565b8060005260206000f35b6116c0600435612a23565b8060005260206000f35b6116d5600435612836565b8060005260206000f35b6116ea6004356138b7565b8060005260206000f35b6116ff6004356145d7565b8060005260206000f35b61171460043561454b565b8060005260206000f35b6117296004356142d1565b8060005260206000f35b61173e600435611e5e565b8060005260206000f35b611753600435614015565b8060005260206000f35b611768600435613c41565b8060005260206000f35b61177d600435611be4565b8060005260206000f35b611792600435614b05565b8060005260206000f35b6117a7600435613713565b8060005260206000f35b6117bc6004356135b1565b8060005260206000f35b6117d16004356144bf565b8060005260206000f35b6117e660043561491f565b8060005260206000f35b6117fb600435612ac9565b8060005260206000f35b6118106004356130cd565b8060005260206000f35b6118256004356140eb565b8060005260206000f35b61183a600435614f65565b8060005260206000f35b61184f60043561196a565b8060005260206000f35b6118646004356148d5565b8060005260206000f35b611879600435614d7f565b8060005260206000f35b61188e600435612002565b8060005260206000f35b6118a3600435613efd565b8060005260206000f35b6118b860043561271e565b8060005260206000f35b6118cd600435614e4d565b8060005260206000f35b6118e2600435611cfc565b8060005260206000f35b6118f7600435612760565b8060005260206000f35b61190c600435614e97565b8060005260206000f35b61192160043561435d565b8060005260206000f35b611936600435614731565b8060005260206000f35b61194b600435614893565b8060005260206000f35b611960600435614a37565b8060005260206000f35b6000600061197f61197a846129dc565b6129dc565b9050605d60020a811015611992576119a2565b61199b816119f6565b91506119ae565b6119ab816119b4565b91505b50919050565b600060006119c1836129dc565b9050605e60020a8110156119d4576119e4565b6119dd81611a40565b91506119f0565b6119ed81611a82565b91505b50919050565b60006000611a0b611a06846129dc565b6129dc565b9050605e60020a811015611a1e57611a2e565b611a2781611a82565b9150611a3a565b611a3781611a40565b91505b50919050565b60006000611a4d836129dc565b9050605f60020a811015611a6057611a70565b611a6981611acc565b9150611a7c565b611a7981611b0e565b91505b50919050565b60006000611a97611a92846129dc565b6129dc565b9050605f60020a811015611aaa57611aba565b611ab381611b0e565b9150611ac6565b611ac381611acc565b91505b50919050565b60006000611ad9836129dc565b9050606060020a811015611aec57611afc565b611af581611b58565b9150611b08565b611b0581611b9a565b91505b50919050565b60006000611b23611b1e846129dc565b6129dc565b9050606060020a811015611b3657611b46565b611b3f81611b9a565b9150611b52565b611b4f81611b58565b91505b50919050565b60006000611b65836129dc565b9050606160020a811015611b7857611b88565b611b8181611be4565b9150611b94565b611b9181611c26565b91505b50919050565b60006000611baf611baa846129dc565b6129dc565b9050606160020a811015611bc257611bd2565b611bcb81611c26565b9150611bde565b611bdb81611be4565b91505b50919050565b60006000611bf1836129dc565b9050606260020a811015611c0457611c14565b611c0d81611c70565b9150611c20565b611c1d81611cb2565b91505b50919050565b60006000611c3b611c36846129dc565b6129dc565b9050606260020a811015611c4e57611c5e565b611c5781611cb2565b9150611c6a565b611c6781611c70565b91505b50919050565b60006000611c7d836129dc565b9050606360020a811015611c9057611ca0565b611c9981611cfc565b9150611cac565b611ca981611d88565b91505b50919050565b60006000611cc7611cc2846129dc565b6129dc565b9050606360020a811015611cda57611cea565b611ce381611d88565b9150611cf6565b611cf381611cfc565b91505b50919050565b60006000611d09836129dc565b9050606460020a811015611d1c57611d2c565b611d2581611dd2565b9150611d38565b611d3581611e14565b91505b50919050565b60006000611d53611d4e846129dc565b6129dc565b9050607a60020a811015611d6657611d76565b611d6f81613269565b9150611d82565b611d7f81613227565b91505b50919050565b60006000611d9d611d98846129dc565b6129dc565b9050606460020a811015611db057611dc0565b611db981611e14565b9150611dcc565b611dc981611dd2565b91505b50919050565b60006000611ddf836129dc565b9050606560020a811015611df257611e02565b611dfb81611e5e565b9150611e0e565b611e0b81611ea0565b91505b50919050565b60006000611e29611e24846129dc565b6129dc565b9050606560020a811015611e3c57611e4c565b611e4581611ea0565b9150611e58565b611e5581611e5e565b91505b50919050565b60006000611e6b836129dc565b9050606660020a811015611e7e57611e8e565b611e8781611eea565b9150611e9a565b611e9781611f2c565b91505b50919050565b60006000611eb5611eb0846129dc565b6129dc565b9050606660020a811015611ec857611ed8565b611ed181611f2c565b9150611ee4565b611ee181611eea565b91505b50919050565b60006000611ef7836129dc565b9050606760020a811015611f0a57611f1a565b611f1381611f76565b9150611f26565b611f2381611fb8565b91505b50919050565b60006000611f41611f3c846129dc565b6129dc565b9050606760020a811015611f5457611f64565b611f5d81611fb8565b9150611f70565b611f6d81611f76565b91505b50919050565b60006000611f83836129dc565b9050606860020a811015611f9657611fa6565b611f9f81612002565b9150611fb2565b611faf81612044565b91505b50919050565b60006000611fcd611fc8846129dc565b6129dc565b9050606860020a811015611fe057611ff0565b611fe981612044565b9150611ffc565b611ff981612002565b91505b50919050565b6000600061200f836129dc565b9050606960020a81101561202257612032565b61202b8161208e565b915061203e565b61203b816120d0565b91505b50919050565b60006000612059612054846129dc565b6129dc565b9050606960020a81101561206c5761207c565b612075816120d0565b9150612088565b6120858161208e565b91505b50919050565b6000600061209b836129dc565b9050606a60020a8110156120ae576120be565b6120b78161211a565b91506120ca565b6120c78161215c565b91505b50919050565b600060006120e56120e0846129dc565b6129dc565b9050606a60020a8110156120f857612108565b6121018161215c565b9150612114565b6121118161211a565b91505b50919050565b60006000612127836129dc565b9050606b60020a81101561213a5761214a565b612143816121a6565b9150612156565b612153816121e8565b91505b50919050565b6000600061217161216c846129dc565b6129dc565b9050606b60020a81101561218457612194565b61218d816121e8565b91506121a0565b61219d816121a6565b91505b50919050565b600060006121b3836129dc565b9050606c60020a8110156121c6576121d6565b6121cf81612232565b91506121e2565b6121df81612274565b91505b50919050565b600060006121fd6121f8846129dc565b6129dc565b9050606c60020a81101561221057612220565b61221981612274565b915061222c565b61222981612232565b91505b50919050565b6000600061223f836129dc565b9050606d60020a81101561225257612262565b61225b816122be565b915061226e565b61226b81612300565b91505b50919050565b60006000612289612284846129dc565b6129dc565b9050606d60020a81101561229c576122ac565b6122a581612300565b91506122b8565b6122b5816122be565b91505b50919050565b600060006122cb836129dc565b9050606e60020a8110156122de576122ee565b6122e78161234a565b91506122fa565b6122f78161238c565b91505b50919050565b60006000612315612310846129dc565b6129dc565b9050606e60020a81101561232857612338565b6123318161238c565b9150612344565b6123418161234a565b91505b50919050565b60006000612357836129dc565b9050606f60020a81101561236a5761237a565b612373816123d6565b9150612386565b61238381612418565b91505b50919050565b600060006123a161239c846129dc565b6129dc565b9050606f60020a8110156123b4576123c4565b6123bd81612418565b91506123d0565b6123cd816123d6565b91505b50919050565b600060006123e3836129dc565b9050607060020a8110156123f657612406565b6123ff81612462565b9150612412565b61240f816124a4565b91505b50919050565b6000600061242d612428846129dc565b6129dc565b9050607060020a81101561244057612450565b612449816124a4565b915061245c565b61245981612462565b91505b50919050565b6000600061246f836129dc565b9050607160020a81101561248257612492565b61248b816124ee565b915061249e565b61249b81612530565b91505b50919050565b600060006124b96124b4846129dc565b6129dc565b9050607160020a8110156124cc576124dc565b6124d581612530565b91506124e8565b6124e5816124ee565b91505b50919050565b600060006124fb836129dc565b9050607260020a81101561250e5761251e565b6125178161257a565b915061252a565b612527816125bc565b91505b50919050565b60006000612545612540846129dc565b6129dc565b9050607260020a81101561255857612568565b612561816125bc565b9150612574565b6125718161257a565b91505b50919050565b60006000612587836129dc565b9050607360020a81101561259a576125aa565b6125a381612606565b91506125b6565b6125b381612648565b91505b50919050565b600060006125d16125cc846129dc565b6129dc565b9050607360020a8110156125e4576125f4565b6125ed81612648565b9150612600565b6125fd81612606565b91505b50919050565b60006000612613836129dc565b9050607460020a81101561262657612636565b61262f81612692565b9150612642565b61263f816126d4565b91505b50919050565b6000600061265d612658846129dc565b6129dc565b9050607460020a81101561267057612680565b612679816126d4565b915061268c565b61268981612692565b91505b50919050565b6000600061269f836129dc565b9050607560020a8110156126b2576126c2565b6126bb8161271e565b91506126ce565b6126cb81612760565b91505b50919050565b600060006126e96126e4846129dc565b6129dc565b9050607560020a8110156126fc5761270c565b61270581612760565b9150612718565b6127158161271e565b91505b50919050565b6000600061272b836129dc565b9050607660020a81101561273e5761274e565b612747816127aa565b915061275a565b612757816127ec565b91505b50919050565b60006000612775612770846129dc565b6129dc565b9050607660020a81101561278857612798565b612791816127ec565b91506127a4565b6127a1816127aa565b91505b50919050565b600060006127b7836129dc565b9050607760020a8110156127ca576127da565b6127d381612836565b91506127e6565b6127e381612878565b91505b50919050565b600060006128016127fc846129dc565b6129dc565b9050607760020a81101561281457612824565b61281d81612878565b9150612830565b61282d81612836565b91505b50919050565b60006000612843836129dc565b9050607860020a81101561285657612866565b61285f816128c2565b9150612872565b61286f81612904565b91505b50919050565b6000600061288d612888846129dc565b6129dc565b9050607860020a8110156128a0576128b0565b6128a981612904565b91506128bc565b6128b9816128c2565b91505b50919050565b600060006128cf836129dc565b9050607960020a8110156128e2576128f2565b6128eb8161294e565b91506128fe565b6128fb81611d3e565b91505b50919050565b60006000612919612914846129dc565b6129dc565b9050607960020a81101561292c5761293c565b61293581611d3e565b9150612948565b6129458161294e565b91505b50919050565b6000600061295b836129dc565b9050607a60020a81101561296e5761297e565b61297781613227565b915061298a565b61298781613269565b91505b50919050565b6000600061299d836129dc565b9050604e60020a8110156129b0576129c0565b6129b981612a7f565b91506129cc565b6129c981612a3d565b91505b50919050565b6000819050919050565b600060007f5851f42d4c957f2c0000000000000000000000000000000000000000000000019050828102600101915050919050565b6000612a1c826129d2565b9050919050565b6000612a36612a31836129dc565b6129d2565b9050919050565b60006000612a4a836129dc565b9050604f60020a811015612a5d57612a6d565b612a6681612ac9565b9150612a79565b612a7681612b0b565b91505b50919050565b60006000612a94612a8f846129dc565b6129dc565b9050604f60020a811015612aa757612ab7565b612ab081612b0b565b9150612ac3565b612ac081612ac9565b91505b50919050565b60006000612ad6836129dc565b9050605060020a811015612ae957612af9565b612af281612b55565b9150612b05565b612b0281612b97565b91505b50919050565b60006000612b20612b1b846129dc565b6129dc565b9050605060020a811015612b3357612b43565b612b3c81612b97565b9150612b4f565b612b4c81612b55565b91505b50919050565b60006000612b62836129dc565b9050605160020a811015612b7557612b85565b612b7e81612be1565b9150612b91565b612b8e81612c23565b91505b50919050565b60006000612bac612ba7846129dc565b6129dc565b9050605160020a811015612bbf57612bcf565b612bc881612c23565b9150612bdb565b612bd881612be1565b91505b50919050565b60006000612bee836129dc565b9050605260020a811015612c0157612c11565b612c0a81612c6d565b9150612c1d565b612c1a81612caf565b91505b50919050565b60006000612c38612c33846129dc565b6129dc565b9050605260020a811015612c4b57612c5b565b612c5481612caf565b9150612c67565b612c6481612c6d565b91505b50919050565b60006000612c7a836129dc565b9050605360020a811015612c8d57612c9d565b612c9681612cf9565b9150612ca9565b612ca681612d3b565b91505b50919050565b60006000612cc4612cbf846129dc565b6129dc565b9050605360020a811015612cd757612ce7565b612ce081612d3b565b9150612cf3565b612cf081612cf9565b91505b50919050565b60006000612d06836129dc565b9050605460020a811015612d1957612d29565b612d2281612d85565b9150612d35565b612d3281612dc7565b91505b50919050565b60006000612d50612d4b846129dc565b6129dc565b9050605460020a811015612d6357612d73565b612d6c81612dc7565b9150612d7f565b612d7c81612d85565b91505b50919050565b60006000612d92836129dc565b9050605560020a811015612da557612db5565b612dae81612e11565b9150612dc1565b612dbe81612e53565b91505b50919050565b60006000612ddc612dd7846129dc565b6129dc565b9050605560020a811015612def57612dff565b612df881612e53565b9150612e0b565b612e0881612e11565b91505b50919050565b60006000612e1e836129dc565b9050605660020a811015612e3157612e41565b612e3a81612e9d565b9150612e4d565b612e4a81612edf565b91505b50919050565b60006000612e68612e63846129dc565b6129dc565b9050605660020a811015612e7b57612e8b565b612e8481612edf565b9150612e97565b612e9481612e9d565b91505b50919050565b60006000612eaa836129dc565b9050605760020a811015612ebd57612ecd565b612ec681612f29565b9150612ed9565b612ed681612f6b565b91505b50919050565b60006000612ef4612eef846129dc565b6129dc565b9050605760020a811015612f0757612f17565b612f1081612f6b565b9150612f23565b612f2081612f29565b91505b50919050565b60006000612f36836129dc565b9050605860020a811015612f4957612f59565b612f5281612fb5565b9150612f65565b612f6281612ff7565b91505b50919050565b60006000612f80612f7b846129dc565b6129dc565b9050605860020a811015612f9357612fa3565b612f9c81612ff7565b9150612faf565b612fac81612fb5565b91505b50919050565b60006000612fc2836129dc565b9050605960020a811015612fd557612fe5565b612fde81613041565b9150612ff1565b612fee81613083565b91505b50919050565b6000600061300c613007846129dc565b6129dc565b9050605960020a81101561301f5761302f565b61302881613083565b915061303b565b61303881613041565b91505b50919050565b6000600061304e836129dc565b9050605a60020a81101561306157613071565b61306a816130cd565b915061307d565b61307a8161310f565b91505b50919050565b60006000613098613093846129dc565b6129dc565b9050605a60020a8110156130ab576130bb565b6130b48161310f565b91506130c7565b6130c4816130cd565b91505b50919050565b600060006130da836129dc565b9050605b60020a8110156130ed576130fd565b6130f681613159565b9150613109565b6131068161319b565b91505b50919050565b6000600061312461311f846129dc565b6129dc565b9050605b60020a81101561313757613147565b6131408161319b565b9150613153565b61315081613159565b91505b50919050565b60006000613166836129dc565b9050605c60020a81101561317957613189565b613182816131e5565b9150613195565b6131928161196a565b91505b50919050565b600060006131b06131ab846129dc565b6129dc565b9050605c60020a8110156131c3576131d3565b6131cc8161196a565b91506131df565b6131dc816131e5565b91505b50919050565b600060006131f2836129dc565b9050605d60020a81101561320557613215565b61320e816119b4565b9150613221565b61321e816119f6565b91505b50919050565b60006000613234836129dc565b9050607b60020a81101561324757613257565b613250816132b3565b9150613263565b613260816132f5565b91505b50919050565b6000600061327e613279846129dc565b6129dc565b9050607b60020a811015613291576132a1565b61329a816132f5565b91506132ad565b6132aa816132b3565b91505b50919050565b600060006132c0836129dc565b9050607c60020a8110156132d3576132e3565b6132dc8161333f565b91506132ef565b6132ec81613381565b91505b50919050565b6000600061330a613305846129dc565b6129dc565b9050607c60020a81101561331d5761332d565b61332681613381565b9150613339565b6133368161333f565b91505b50919050565b6000600061334c836129dc565b9050607d60020a81101561335f5761336f565b613368816133cb565b915061337b565b6133788161340d565b91505b50919050565b60006000613396613391846129dc565b6129dc565b9050607d60020a8110156133a9576133b9565b6133b28161340d565b91506133c5565b6133c2816133cb565b91505b50919050565b600060006133d8836129dc565b9050607e60020a8110156133eb576133fb565b6133f481613457565b9150613407565b61340481613499565b91505b50919050565b6000600061342261341d846129dc565b6129dc565b9050607e60020a81101561343557613445565b61343e81613499565b9150613451565b61344e81613457565b91505b50919050565b60006000613464836129dc565b9050607f60020a81101561347757613487565b613480816134e3565b9150613493565b61349081613525565b91505b50919050565b600060006134ae6134a9846129dc565b6129dc565b9050607f60020a8110156134c1576134d1565b6134ca81613525565b91506134dd565b6134da816134e3565b91505b50919050565b600060006134f0836129dc565b9050608060020a81101561350357613513565b61350c8161356f565b915061351f565b61351c816135b1565b91505b50919050565b6000600061353a613535846129dc565b6129dc565b9050608060020a81101561354d5761355d565b613556816135b1565b9150613569565b6135668161356f565b91505b50919050565b6000600061357c836129dc565b9050608160020a81101561358f5761359f565b613598816135fb565b91506135ab565b6135a88161363d565b91505b50919050565b600060006135c66135c1846129dc565b6129dc565b9050608160020a8110156135d9576135e9565b6135e28161363d565b91506135f5565b6135f2816135fb565b91505b50919050565b60006000613608836129dc565b9050608260020a81101561361b5761362b565b61362481613687565b9150613637565b613634816136c9565b91505b50919050565b6000600061365261364d846129dc565b6129dc565b9050608260020a81101561366557613675565b61366e816136c9565b9150613681565b61367e81613687565b91505b50919050565b60006000613694836129dc565b9050608360020a8110156136a7576136b7565b6136b081613713565b91506136c3565b6136c081613755565b91505b50919050565b600060006136de6136d9846129dc565b6129dc565b9050608360020a8110156136f157613701565b6136fa81613755565b915061370d565b61370a81613713565b91505b50919050565b60006000613720836129dc565b9050608460020a81101561373357613743565b61373c8161379f565b915061374f565b61374c816137e1565b91505b50919050565b6000600061376a613765846129dc565b6129dc565b9050608460020a81101561377d5761378d565b613786816137e1565b9150613799565b6137968161379f565b91505b50919050565b600060006137ac836129dc565b9050608560020a8110156137bf576137cf565b6137c88161382b565b91506137db565b6137d88161386d565b91505b50919050565b600060006137f66137f1846129dc565b6129dc565b9050608560020a81101561380957613819565b6138128161386d565b9150613825565b6138228161382b565b91505b50919050565b60006000613838836129dc565b9050608660020a81101561384b5761385b565b613854816138b7565b9150613867565b613864816138f9565b91505b50919050565b6000600061388261387d846129dc565b6129dc565b9050608660020a811015613895576138a5565b61389e816138f9565b91506138b1565b6138ae816138b7565b91505b50919050565b600060006138c4836129dc565b9050608760020a8110156138d7576138e7565b6138e081613943565b91506138f3565b6138f081613985565b91505b50919050565b6000600061390e613909846129dc565b6129dc565b9050608760020a81101561392157613931565b61392a81613985565b915061393d565b61393a81613943565b91505b50919050565b60006000613950836129dc565b9050608860020a81101561396357613973565b61396c816139cf565b915061397f565b61397c81613a11565b91505b50919050565b6000600061399a613995846129dc565b6129dc565b9050608860020a8110156139ad576139bd565b6139b681613a11565b91506139c9565b6139c6816139cf565b91505b50919050565b600060006139dc836129dc565b9050608960020a8110156139ef576139ff565b6139f881613a5b565b9150613a0b565b613a0881613a9d565b91505b50919050565b60006000613a26613a21846129dc565b6129dc565b9050608960020a811015613a3957613a49565b613a4281613a9d565b9150613a55565b613a5281613a5b565b91505b50919050565b60006000613a68836129dc565b9050608a60020a811015613a7b57613a8b565b613a8481613ae7565b9150613a97565b613a9481613b29565b91505b50919050565b60006000613ab2613aad846129dc565b6129dc565b9050608a60020a811015613ac557613ad5565b613ace81613b29565b9150613ae1565b613ade81613ae7565b91505b50919050565b60006000613af4836129dc565b9050608b60020a811015613b0757613b17565b613b1081613b73565b9150613b23565b613b2081613bb5565b91505b50919050565b60006000613b3e613b39846129dc565b6129dc565b9050608b60020a811015613b5157613b61565b613b5a81613bb5565b9150613b6d565b613b6a81613b73565b91505b50919050565b60006000613b80836129dc565b9050608c60020a811015613b9357613ba3565b613b9c81613bff565b9150613baf565b613bac81613c41565b91505b50919050565b60006000613bca613bc5846129dc565b6129dc565b9050608c60020a811015613bdd57613bed565b613be681613c41565b9150613bf9565b613bf681613bff565b91505b50919050565b60006000613c0c836129dc565b9050608d60020a811015613c1f57613c2f565b613c2881613c8b565b9150613c3b565b613c3881613ccd565b91505b50919050565b60006000613c56613c51846129dc565b6129dc565b9050608d60020a811015613c6957613c79565b613c7281613ccd565b9150613c85565b613c8281613c8b565b91505b50919050565b60006000613c98836129dc565b9050608e60020a811015613cab57613cbb565b613cb481613d17565b9150613cc7565b613cc481613d59565b91505b50919050565b60006000613ce2613cdd846129dc565b6129dc565b9050608e60020a811015613cf557613d05565b613cfe81613d59565b9150613d11565b613d0e81613d17565b91505b50919050565b60006000613d24836129dc565b9050608f60020a811015613d3757613d47565b613d4081613da3565b9150613d53565b613d5081613de5565b91505b50919050565b60006000613d6e613d69846129dc565b6129dc565b9050608f60020a811015613d8157613d91565b613d8a81613de5565b9150613d9d565b613d9a81613da3565b91505b50919050565b60006000613db0836129dc565b9050609060020a811015613dc357613dd3565b613dcc81613e2f565b9150613ddf565b613ddc81613e71565b91505b50919050565b60006000613dfa613df5846129dc565b6129dc565b9050609060020a811015613e0d57613e1d565b613e1681613e71565b9150613e29565b613e2681613e2f565b91505b50919050565b60006000613e3c836129dc565b9050609160020a811015613e4f57613e5f565b613e5881613ebb565b9150613e6b565b613e6881613efd565b91505b50919050565b60006000613e86613e81846129dc565b6129dc565b9050609160020a811015613e9957613ea9565b613ea281613efd565b9150613eb5565b613eb281613ebb565b91505b50919050565b60006000613ec8836129dc565b9050609260020a811015613edb57613eeb565b613ee481613f47565b9150613ef7565b613ef481613f89565b91505b50919050565b60006000613f12613f0d846129dc565b6129dc565b9050609260020a811015613f2557613f35565b613f2e81613f89565b9150613f41565b613f3e81613f47565b91505b50919050565b60006000613f54836129dc565b9050609360020a811015613f6757613f77565b613f7081613fd3565b9150613f83565b613f8081614015565b91505b50919050565b60006000613f9e613f99846129dc565b6129dc565b9050609360020a811015613fb157613fc1565b613fba81614015565b9150613fcd565b613fca81613fd3565b91505b50919050565b60006000613fe0836129dc565b9050609460020a811015613ff357614003565b613ffc8161405f565b915061400f565b61400c816140a1565b91505b50919050565b6000600061402a614025846129dc565b6129dc565b9050609460020a81101561403d5761404d565b614046816140a1565b9150614059565b6140568161405f565b91505b50919050565b6000600061406c836129dc565b9050609560020a81101561407f5761408f565b614088816140eb565b915061409b565b6140988161412d565b91505b50919050565b600060006140b66140b1846129dc565b6129dc565b9050609560020a8110156140c9576140d9565b6140d28161412d565b91506140e5565b6140e2816140eb565b91505b50919050565b600060006140f8836129dc565b9050609660020a81101561410b5761411b565b61411481614177565b9150614127565b614124816141b9565b91505b50919050565b6000600061414261413d846129dc565b6129dc565b9050609660020a81101561415557614165565b61415e816141b9565b9150614171565b61416e81614177565b91505b50919050565b60006000614184836129dc565b9050609760020a811015614197576141a7565b6141a081614203565b91506141b3565b6141b081614245565b91505b50919050565b600060006141ce6141c9846129dc565b6129dc565b9050609760020a8110156141e1576141f1565b6141ea81614245565b91506141fd565b6141fa81614203565b91505b50919050565b60006000614210836129dc565b9050609860020a81101561422357614233565b61422c8161428f565b915061423f565b61423c816142d1565b91505b50919050565b6000600061425a614255846129dc565b6129dc565b9050609860020a81101561426d5761427d565b614276816142d1565b9150614289565b6142868161428f565b91505b50919050565b6000600061429c836129dc565b9050609960020a8110156142af576142bf565b6142b88161431b565b91506142cb565b6142c88161435d565b91505b50919050565b600060006142e66142e1846129dc565b6129dc565b9050609960020a8110156142f957614309565b6143028161435d565b9150614315565b6143128161431b565b91505b50919050565b60006000614328836129dc565b9050609a60020a81101561433b5761434b565b614344816143a7565b9150614357565b614354816143e9565b91505b50919050565b6000600061437261436d846129dc565b6129dc565b9050609a60020a81101561438557614395565b61438e816143e9565b91506143a1565b61439e816143a7565b91505b50919050565b600060006143b4836129dc565b9050609b60020a8110156143c7576143d7565b6143d081614433565b91506143e3565b6143e081614475565b91505b50919050565b600060006143fe6143f9846129dc565b6129dc565b9050609b60020a81101561441157614421565b61441a81614475565b915061442d565b61442a81614433565b91505b50919050565b60006000614440836129dc565b9050609c60020a81101561445357614463565b61445c816144bf565b915061446f565b61446c81614501565b91505b50919050565b6000600061448a614485846129dc565b6129dc565b9050609c60020a81101561449d576144ad565b6144a681614501565b91506144b9565b6144b6816144bf565b91505b50919050565b600060006144cc836129dc565b9050609d60020a8110156144df576144ef565b6144e88161454b565b91506144fb565b6144f88161458d565b91505b50919050565b60006000614516614511846129dc565b6129dc565b9050609d60020a81101561452957614539565b6145328161458d565b9150614545565b6145428161454b565b91505b50919050565b60006000614558836129dc565b9050609e60020a81101561456b5761457b565b614574816145d7565b9150614587565b61458481614619565b91505b50919050565b600060006145a261459d846129dc565b6129dc565b9050609e60020a8110156145b5576145c5565b6145be81614619565b91506145d1565b6145ce816145d7565b91505b50919050565b600060006145e4836129dc565b9050609f60020a8110156145f757614607565b61460081614663565b9150614613565b614610816146a5565b91505b50919050565b6000600061462e614629846129dc565b6129dc565b9050609f60020a81101561464157614651565b61464a816146a5565b915061465d565b61465a81614663565b91505b50919050565b60006000614670836129dc565b905060a060020a81101561468357614693565b61468c816146ef565b915061469f565b61469c81614731565b91505b50919050565b600060006146ba6146b5846129dc565b6129dc565b905060a060020a8110156146cd576146dd565b6146d681614731565b91506146e9565b6146e6816146ef565b91505b50919050565b600060006146fc836129dc565b905060a160020a81101561470f5761471f565b6147188161477b565b915061472b565b614728816147bd565b91505b50919050565b60006000614746614741846129dc565b6129dc565b905060a160020a81101561475957614769565b614762816147bd565b9150614775565b6147728161477b565b91505b50919050565b60006000614788836129dc565b905060a260020a81101561479b576147ab565b6147a481614807565b91506147b7565b6147b481614849565b91505b50919050565b600060006147d26147cd846129dc565b6129dc565b905060a260020a8110156147e5576147f5565b6147ee81614849565b9150614801565b6147fe81614807565b91505b50919050565b60006000614814836129dc565b905060a360020a81101561482757614837565b61483081614893565b9150614843565b614840816148d5565b91505b50919050565b6000600061485e614859846129dc565b6129dc565b905060a360020a81101561487157614881565b61487a816148d5565b915061488d565b61488a81614893565b91505b50919050565b600060006148a0836129dc565b905060a460020a8110156148b3576148c3565b6148bc8161491f565b91506148cf565b6148cc81614961565b91505b50919050565b600060006148ea6148e5846129dc565b6129dc565b905060a460020a8110156148fd5761490d565b61490681614961565b9150614919565b6149168161491f565b91505b50919050565b6000600061492c836129dc565b905060a560020a81101561493f5761494f565b614948816149ab565b915061495b565b614958816149ed565b91505b50919050565b60006000614976614971846129dc565b6129dc565b905060a560020a81101561498957614999565b614992816149ed565b91506149a5565b6149a2816149ab565b91505b50919050565b600060006149b8836129dc565b905060a660020a8110156149cb576149db565b6149d481614a37565b91506149e7565b6149e481614a79565b91505b50919050565b60006000614a026149fd846129dc565b6129dc565b905060a660020a811015614a1557614a25565b614a1e81614a79565b9150614a31565b614a2e81614a37565b91505b50919050565b60006000614a44836129dc565b905060a760020a811015614a5757614a67565b614a6081614ac3565b9150614a73565b614a7081614b05565b91505b50919050565b60006000614a8e614a89846129dc565b6129dc565b905060a760020a811015614aa157614ab1565b614aaa81614b05565b9150614abd565b614aba81614ac3565b91505b50919050565b60006000614ad0836129dc565b905060a860020a811015614ae357614af3565b614aec81614b4f565b9150614aff565b614afc81614b91565b91505b50919050565b60006000614b1a614b15846129dc565b6129dc565b905060a860020a811015614b2d57614b3d565b614b3681614b91565b9150614b49565b614b4681614b4f565b91505b50919050565b60006000614b5c836129dc565b905060a960020a811015614b6f57614b7f565b614b7881614bdb565b9150614b8b565b614b8881614c1d565b91505b50919050565b60006000614ba6614ba1846129dc565b6129dc565b905060a960020a811015614bb957614bc9565b614bc281614c1d565b9150614bd5565b614bd281614bdb565b91505b50919050565b60006000614be8836129dc565b905060aa60020a811015614bfb57614c0b565b614c0481614c67565b9150614c17565b614c1481614ca9565b91505b50919050565b60006000614c32614c2d846129dc565b6129dc565b905060aa60020a811015614c4557614c55565b614c4e81614ca9565b9150614c61565b614c5e81614c67565b91505b50919050565b60006000614c74836129dc565b905060ab60020a811015614c8757614c97565b614c9081614cf3565b9150614ca3565b614ca081614d35565b91505b50919050565b60006000614cbe614cb9846129dc565b6129dc565b905060ab60020a811015614cd157614ce1565b614cda81614d35565b9150614ced565b614cea81614cf3565b91505b50919050565b60006000614d00836129dc565b905060ac60020a811015614d1357614d23565b614d1c81614d7f565b9150614d2f565b614d2c81614dc1565b91505b50919050565b60006000614d4a614d45846129dc565b6129dc565b905060ac60020a811015614d5d57614d6d565b614d6681614dc1565b9150614d79565b614d7681614d7f565b91505b50919050565b60006000614d8c836129dc565b905060ad60020a811015614d9f57614daf565b614da881614e0b565b9150614dbb565b614db881614e4d565b91505b50919050565b60006000614dd6614dd1846129dc565b6129dc565b905060ad60020a811015614de957614df9565b614df281614e4d565b9150614e05565b614e0281614e0b565b91505b50919050565b60006000614e18836129dc565b905060ae60020a811015614e2b57614e3b565b614e3481614e97565b9150614e47565b614e4481614ed9565b91505b50919050565b60006000614e62614e5d846129dc565b6129dc565b905060ae60020a811015614e7557614e85565b614e7e81614ed9565b9150614e91565b614e8e81614e97565b91505b50919050565b60006000614ea4836129dc565b905060af60020a811015614eb757614ec7565b614ec081614f23565b9150614ed3565b614ed081614f65565b91505b50919050565b60006000614eee614ee9846129dc565b6129dc565b905060af60020a811015614f0157614f11565b614f0a81614f65565b9150614f1d565b614f1a81614f23565b91505b50919050565b60006000614f30836129dc565b905060b060020a811015614f4357614f53565b614f4c81614faf565b9150614f5f565b614f5c81614ff1565b91505b50919050565b60006000614f7a614f75846129dc565b6129dc565b905060b060020a811015614f8d57614f9d565b614f9681614ff1565b9150614fa9565b614fa681614faf565b91505b50919050565b60006000614fbc836129dc565b905060b160020a811015614fcf57614fdf565b614fd881612a11565b9150614feb565b614fe881612a23565b91505b50919050565b60006000615006615001846129dc565b6129dc565b905060b160020a81101561501957615029565b61502281612a23565b9150615035565b61503281612a11565b91505b5091905056", @@ -25,7 +25,7 @@ "//" : "ManyFunctions.start(1)", "data" : "0x95805DAD0000000000000000000000000000000000000000000000000000000000000001", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "ackermann31": { @@ -39,7 +39,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "//" : "PerformanceTester.sol", "code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056", @@ -54,7 +54,7 @@ "//" : "ackermann(3, 1)", "data" : "0x2839e92800000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, "ackermann32": { @@ -68,7 +68,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "//" : "PerformanceTester.sol", "code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056", @@ -97,7 +97,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "//" : "PerformanceTester.sol", "code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056", @@ -126,7 +126,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "//" : "PerformanceTester.sol", "code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056", @@ -155,7 +155,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "//" : "PerformanceTester.sol", "code" : "0x60e060020a6000350480632839e92814601e57806361047ff414603457005b602a6004356024356047565b8060005260206000f35b603d6004356099565b8060005260206000f35b600082600014605457605e565b8160010190506093565b81600014606957607b565b60756001840360016047565b90506093565b609060018403608c85600186036047565b6047565b90505b92915050565b6000816000148060a95750816001145b60b05760b7565b81905060cf565b60c1600283036099565b60cb600184036099565b0190505b91905056", diff --git a/test/vmPushDupSwapTestFiller.json b/test/vmPushDupSwapTestFiller.json index 1aca47922..9b8930e01 100644 --- a/test/vmPushDupSwapTestFiller.json +++ b/test/vmPushDupSwapTestFiller.json @@ -10,7 +10,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60ff600355", "storage": {} @@ -23,7 +23,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -38,7 +38,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60", "storage": {} @@ -51,7 +51,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -66,7 +66,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x61eeff600355", "storage": {} @@ -79,7 +79,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -94,7 +94,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x62ddeeff600355", "storage": {} @@ -107,7 +107,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -122,7 +122,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x63ccddeeff600355", "storage": {} @@ -135,7 +135,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -150,7 +150,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x64bbccddeeff600355", "storage": {} @@ -163,7 +163,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -178,7 +178,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x65aabbccddeeff600355", "storage": {} @@ -191,7 +191,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -206,7 +206,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6699aabbccddeeff600355", "storage": {} @@ -219,7 +219,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -234,7 +234,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x678899aabbccddeeff600355", "storage": {} @@ -247,7 +247,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -262,7 +262,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x68778899aabbccddeeff600355", "storage": {} @@ -275,7 +275,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -290,7 +290,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6966778899aabbccddeeff600355", "storage": {} @@ -303,7 +303,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -318,7 +318,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6a5566778899aabbccddeeff600355", "storage": {} @@ -331,7 +331,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -346,7 +346,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6b445566778899aabbccddeeff600355", "storage": {} @@ -359,7 +359,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -374,7 +374,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6c33445566778899aabbccddeeff600355", "storage": {} @@ -387,7 +387,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -402,7 +402,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6d2233445566778899aabbccddeeff600355", "storage": {} @@ -415,7 +415,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -430,7 +430,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6e112233445566778899aabbccddeeff600355", "storage": {} @@ -443,7 +443,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -458,7 +458,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6f10112233445566778899aabbccddeeff600355", "storage": {} @@ -471,7 +471,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -486,7 +486,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x70ff00112233445566778899aabbccddeeff600355", "storage": {} @@ -499,7 +499,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -514,7 +514,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x71eeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -527,7 +527,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -542,7 +542,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x72ddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -555,7 +555,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -570,7 +570,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x73ccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -583,7 +583,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -598,7 +598,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x74bbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -611,7 +611,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -626,7 +626,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x75aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -639,7 +639,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -654,7 +654,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7699aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -667,7 +667,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -682,7 +682,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x778899aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -695,7 +695,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -710,7 +710,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x78778899aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -723,7 +723,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -738,7 +738,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7966778899aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -751,7 +751,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -767,7 +767,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7a5566778899aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -780,7 +780,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -795,7 +795,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7b445566778899aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -808,7 +808,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -823,7 +823,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7c33445566778899aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -836,7 +836,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -851,7 +851,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7d2233445566778899aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -864,7 +864,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -879,7 +879,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7e112233445566778899aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -892,7 +892,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -907,7 +907,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7f10112233445566778899aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -920,7 +920,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -935,7 +935,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7fff10112233445566778899aabbccddeeff00112233445566778899aabbccddeeff600355", "storage": {} @@ -948,7 +948,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -964,7 +964,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7fff10112233445566778899aabbccddeeff00112233445566778899aabbccdd", "storage": {} @@ -977,7 +977,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -992,7 +992,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 101 2002 303303 40444404 50555555505 60666666666606 7777777777777777 888888888888888888 99999999999999999999 10000000000000000000001 10111111111111111111111101 2022222222222222222222222202 303333333333333333333333333303 4044444444444444444444444444444404 505555555555555555555555555555555505 60666666666666666666666666666666666606 7077777777777777777777777777777777777707 808888888888888888888888888888888888888808 90999999999999999999999999999999999999999909 100000000000000000000000000000000000000000000001 10111111111111111111111111111111111111111111111101 2022222222222222222222222222222222222222222222222202 303333333333333333333333333333333333333333333333333303 40444444444444444444444444444444444444444444444444444404 50555555555555555555555555555555555555555555555555555555505 6066666666666666666666666666666666666666666666666666666666606 707777777777777777777777777777777777777777777777777777777777707 808888888888888888888888888888888888888888888888888888888888888808 90999999999999999999999999999999999999999999999999999999999999999909 100000000000000000000000000000000000000000000000000000000000000000000001 10111111111111111111111111111111111111111111111111111111111111111111111101 2022222222222222222222222222222222222222222222222222222222222222222222222202)", "storage": {} @@ -1020,7 +1020,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7f10112233445566778899aabbccddeeff00112233445566778899aabbccddeeff80600355", "storage": {} @@ -1033,7 +1033,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1048,7 +1048,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7f10112233445566778899aabbccddeeff00112233445566778899aabbccddeeff81600355", "storage": {} @@ -1061,7 +1061,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1076,7 +1076,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6002600181600355", "storage": {} @@ -1089,7 +1089,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1104,7 +1104,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60036002600182600355", "storage": {} @@ -1117,7 +1117,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1132,7 +1132,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600460036002600183600355", "storage": {} @@ -1145,7 +1145,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1160,7 +1160,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6005600460036002600184600355", "storage": {} @@ -1173,7 +1173,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1188,7 +1188,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60066005600460036002600185600355", "storage": {} @@ -1201,7 +1201,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1216,7 +1216,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600760066005600460036002600186600355", "storage": {} @@ -1229,7 +1229,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1244,7 +1244,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6008600760066005600460036002600187600355", "storage": {} @@ -1257,7 +1257,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1272,7 +1272,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60096008600760066005600460036002600188600355", "storage": {} @@ -1285,7 +1285,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1300,7 +1300,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600a60096008600760066005600460036002600189600355", "storage": {} @@ -1313,7 +1313,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1328,7 +1328,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600b600a6009600860076006600560046003600260018a600355", "storage": {} @@ -1341,7 +1341,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1356,7 +1356,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600c600b600a6009600860076006600560046003600260018b600355", "storage": {} @@ -1369,7 +1369,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1384,7 +1384,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600d600c600b600a6009600860076006600560046003600260018c600355", "storage": {} @@ -1397,7 +1397,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1412,7 +1412,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600e600d600c600b600a6009600860076006600560046003600260018d600355", "storage": {} @@ -1425,7 +1425,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1440,7 +1440,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600f600e600d600c600b600a6009600860076006600560046003600260018e600355", "storage": {} @@ -1453,7 +1453,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1468,7 +1468,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6010600f600e600d600c600b600a6009600860076006600560046003600260018f600355", "storage": {} @@ -1481,7 +1481,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1496,7 +1496,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7f10112233445566778899aabbccddeeff00112233445566778899aabbccddeeff60039055", "storage": {} @@ -1509,7 +1509,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1524,7 +1524,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x7f10112233445566778899aabbccddeeff00112233445566778899aabbccddeeff60039155", "storage": {} @@ -1537,7 +1537,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1552,7 +1552,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6002600160039155", "storage": {} @@ -1565,7 +1565,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1580,7 +1580,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60036002600160039255", "storage": {} @@ -1593,7 +1593,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1608,7 +1608,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600460036002600160039355", "storage": {} @@ -1621,7 +1621,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1636,7 +1636,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6005600460036002600160039455", "storage": {} @@ -1649,7 +1649,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1664,7 +1664,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60066005600460036002600160039555", "storage": {} @@ -1677,7 +1677,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1692,7 +1692,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600760066005600460036002600160039655", "storage": {} @@ -1705,7 +1705,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1720,7 +1720,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6008600760066005600460036002600160039755", "storage": {} @@ -1733,7 +1733,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1748,7 +1748,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x60096008600760066005600460036002600160039855", "storage": {} @@ -1761,7 +1761,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1776,7 +1776,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600a60096008600760066005600460036002600160039955", "storage": {} @@ -1789,7 +1789,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1804,7 +1804,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600b600a60096008600760066005600460036002600160039a55", "storage": {} @@ -1817,7 +1817,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1832,7 +1832,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600c600b600a60096008600760066005600460036002600160039b55", "storage": {} @@ -1845,7 +1845,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1860,7 +1860,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600d600c600b600a60096008600760066005600460036002600160039c55", "storage": {} @@ -1873,7 +1873,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1888,7 +1888,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600e600d600c600b600a60096008600760066005600460036002600160039d55", "storage": {} @@ -1901,7 +1901,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1916,7 +1916,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x600f600e600d600c600b600a60096008600760066005600460036002600160039e55", "storage": {} @@ -1929,7 +1929,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1944,7 +1944,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6010600f600e600d600c600b600a60096008600760066005600460036002600160039f55", "storage": {} @@ -1957,7 +1957,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1972,7 +1972,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(asm 5 2 1 12 JUMPI POP POP STOP JUMPDEST SWAP1 1 22 JUMPI POP POP STOP JUMPDEST SUB 0 MSTORE 1 31 RETURN)", "storage": {} @@ -1985,7 +1985,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } } } diff --git a/test/vmSha3TestFiller.json b/test/vmSha3TestFiller.json index 142af79d0..f10601f00 100644 --- a/test/vmSha3TestFiller.json +++ b/test/vmSha3TestFiller.json @@ -10,7 +10,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SHA3 0 0)}", "storage": {} @@ -38,7 +38,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SHA3 4 5)}", "storage": {} @@ -51,7 +51,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -66,7 +66,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SHA3 10 10)}", "storage": {} @@ -79,7 +79,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -94,7 +94,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SHA3 1000 0xfffff)}", "storage": {} @@ -107,7 +107,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -122,7 +122,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SHA3 0xfffffffff 100)}", "storage": {} @@ -135,7 +135,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -150,7 +150,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SHA3 10000 0xfffffffff )}", "storage": {} @@ -163,7 +163,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -178,7 +178,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (SHA3 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)}", "storage": {} @@ -191,7 +191,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, diff --git a/test/vmSystemOperationsTestFiller.json b/test/vmSystemOperationsTestFiller.json index 709af7079..bdbbdc29b 100644 --- a/test/vmSystemOperationsTestFiller.json +++ b/test/vmSystemOperationsTestFiller.json @@ -10,7 +10,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0x601080600c6000396000f3006000355415600957005b60203560003555) [[ 0 ]] (CREATE 23 3 29) }", "storage": {} @@ -23,7 +23,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -51,7 +51,7 @@ "value" : "100", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -79,7 +79,7 @@ "value" : "100", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -107,7 +107,7 @@ "value" : "100", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -122,7 +122,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 1000000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 64 0) }", "storage": {} @@ -161,14 +161,14 @@ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", "code" : "0x4243434242434243f14555", "data" : "0x", - "gas" : "10000", + "gas" : "100000", "gasPrice" : "100000000000000", "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000" }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "code" : "0x4243434242434243f14555", "nonce" : "0", "storage" : { @@ -188,7 +188,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 1000000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 0 2) }", "storage": {} @@ -224,7 +224,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) (POST 1000000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 ) }", "storage": {} @@ -260,7 +260,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLSTATELESS 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 0 2 ) }", "storage": {} @@ -296,7 +296,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 0 2 ) }", "storage": {} @@ -333,7 +333,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 100 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 64 0) }", "storage": {} @@ -369,7 +369,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 987654321 64 64 0) }", "storage": {} @@ -405,7 +405,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 9865432 64 0) }", "storage": {} @@ -441,7 +441,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 987654 1) }", "storage": {} @@ -478,7 +478,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 987654 0) }", "storage": {} @@ -514,7 +514,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 987654 0 64 0) }", "storage": {} @@ -556,7 +556,7 @@ "storage": {} }, "945304eb96065b2a98b57a48a06ae28d285a71b5" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (+ (SLOAD 0) 1) [[ 1 ]] (CALL (- (GAS) 224) (ADDRESS) 0 0 0 0 0) } ", "storage": {} @@ -668,7 +668,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (SUICIDE (CALLER))}", "storage": {} @@ -704,7 +704,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (SUICIDE 0xaa1722f3947def4cf144679da39c4c32bdc35681 )}", "storage": {} @@ -740,7 +740,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (SUICIDE (ADDRESS) )}", "storage": {} @@ -866,7 +866,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) (POST 1000000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 ) }", "storage": {} @@ -902,7 +902,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLSTATELESS 1000000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 64 0) }", "storage": {} @@ -938,7 +938,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 1000000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 64 0) }", "storage": {} @@ -974,7 +974,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "0x6000355415600957005b60203560003555", "storage": {} @@ -987,7 +987,7 @@ "value" : "1000000000000000000", "data" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffafffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -1002,7 +1002,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ (PC) ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) }", "storage": {} @@ -1038,7 +1038,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ (PC) ]] (CALL (- (GAS) 1000) 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) }", "storage": {} @@ -1074,7 +1074,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ 0 ]] (ADD (SLOAD 0) 1) (CALL (- (GAS) 1000) 0x945304eb96065b2a98b57a48a06ae28d285a71b5 1 0 0 0 0) }", "storage": {} @@ -1146,7 +1146,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ (PC) ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) (SUICIDE 0x945304eb96065b2a98b57a48a06ae28d285a71b5) }", "storage": {} @@ -1182,7 +1182,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ [[ (PC) ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) }", "storage": {} diff --git a/test/vmtestsFiller.json b/test/vmtestsFiller.json index 75bf1da8f..c9f157f11 100644 --- a/test/vmtestsFiller.json +++ b/test/vmtestsFiller.json @@ -10,7 +10,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(suicide (caller))", "storage": {} @@ -23,7 +23,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -38,7 +38,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "{ (call (- (gas) 200) (caller) (+ 2 2 (* 4 4 4) (/ 2 2) (% 3 2) (- 8 2 2)) 0 0 0 0) }", "storage": {} @@ -51,7 +51,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -66,7 +66,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(seq (when (and 1 1) (call (- (gas) 200) (caller) 2 0 0 0 0)) (when (and 1 0) (call (- (gas) 200) (caller) 3 0 0 0 0)) (when (and 0 1) (call (- (gas) 200) (caller) 4 0 0 0 0)) (when (and 0 0) (call (- (gas) 200) (caller) 5 0 0 0 0)) (when (or 1 1) (call (- (gas) 200) (caller) 12 0 0 0 0)) (when (or 1 0) (call (- (gas) 200) (caller) 13 0 0 0 0)) (when (or 0 1) (call (- (gas) 200) (caller) 14 0 0 0 0)) (when (or 0 0) (call (- (gas) 200) (caller) 15 0 0 0 0)) )", "storage": {} @@ -79,7 +79,7 @@ "value" : "1000000000000000000", "data" : "", "gasPrice" : "100000000000000", - "gas" : "10000" + "gas" : "100000" } }, @@ -94,7 +94,7 @@ }, "pre" : { "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { - "balance" : "1000000000000000000", + "balance" : "100000000000000000000000", "nonce" : "0", "code" : "(call (- (gas) 200) (caller) 500000000000000000 0 0 0 0)", "storage": {} @@ -107,7 +107,7 @@ "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", "value" : "1000000000000000000", "gasPrice" : "100000000000000", - "gas" : "10000", + "gas" : "100000", "data" : "" } } diff --git a/test/webthreestubclient.h b/test/webthreestubclient.h index 70aa9db99..6d97ea67a 100644 --- a/test/webthreestubclient.h +++ b/test/webthreestubclient.h @@ -437,10 +437,11 @@ class WebThreeStubClient : public jsonrpc::Client else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - bool eth_submitWork(const std::string& param1) throw (jsonrpc::JsonRpcException) + bool eth_submitWork(const std::string& param1, const std::string& param2) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); + p.append(param2); Json::Value result = this->CallMethod("eth_submitWork",p); if (result.isBool()) return result.asBool(); diff --git a/third/MainWin.h b/third/MainWin.h index 513cfe96e..2f8f95f0e 100644 --- a/third/MainWin.h +++ b/third/MainWin.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include namespace Ui {