From 387e67ee40c73006623481680c6e255d5ccedd60 Mon Sep 17 00:00:00 2001 From: caktux Date: Sat, 21 Mar 2015 15:57:40 -0400 Subject: [PATCH 1/4] apply fix for #1250 to neth, take some creds --- neth/main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/neth/main.cpp b/neth/main.cpp index 275ac3ea4..80b3bc261 100644 --- a/neth/main.cpp +++ b/neth/main.cpp @@ -65,7 +65,7 @@ bool isFalse(std::string const& _m) void help() { cout - << "Usage neth [OPTIONS] " << endl + << "Usage neth [OPTIONS]" << endl << "Options:" << endl << " -a,--address Set the coinbase (mining payout) address to addr (default: auto)." << endl << " -c,--client-name Add a name to your client's version string (default: blank)." << endl @@ -122,7 +122,7 @@ string credits() std::ostringstream ccout; ccout << "NEthereum (++) " << dev::Version << endl - << " Code by Gav Wood & , (c) 2013, 2014." << endl + << " Code by Gav Wood & caktux, (c) 2013, 2014, 2015." << endl << " Based on a design by Vitalik Buterin." << endl << endl; ccout << "Type 'netstart 30303' to start networking" << endl; @@ -428,7 +428,10 @@ int main(int argc, char** argv) else if (arg == "-V" || arg == "--version") version(); else - remoteHost = argv[i]; + { + cerr << "Invalid argument: " << arg << endl; + exit(-1); + } } if (!clientName.empty()) From b78634637bc78d877120041d7b38a2aa9c357af9 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 22 Mar 2015 19:40:04 +0100 Subject: [PATCH 2/4] Transact now prevents executing failing transactions. --- alethzero/Transact.cpp | 45 ++++++++++++++++++++++++------------------ alethzero/Transact.h | 1 + 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index 35a9c47d2..c9cd5e7b4 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -186,6 +186,7 @@ void Transact::rejigData() { if (!ethereum()) return; + m_allGood = true; if (isCreation()) { string src = ui->data->toPlainText().toStdString(); @@ -210,11 +211,11 @@ void Transact::rejigData() { ostringstream error; solidity::SourceReferenceFormatter::printExceptionInformation(error, exception, "Error", compiler); - solidity = "

Solidity

" + QString::fromStdString(error.str()).toHtmlEscaped() + "
"; + errors.push_back("Solidity: " + error.str()); } catch (...) { - solidity = "

Solidity

Uncaught exception.
"; + errors.push_back("Solidity: Uncaught exception"); } } #ifndef _MSC_VER @@ -223,8 +224,6 @@ void Transact::rejigData() try { m_data = dev::asBytes(::compile(src)); - for (auto& i: errors) - i = "(LLL " + i + ")"; } catch (string const& err) { @@ -237,22 +236,18 @@ void Transact::rejigData() m_data = compileLLL(src, ui->optimize->isChecked(), &errors); if (errors.empty()) { - auto asmcode = compileLLLToAsm(src, false); - lll = "

Pre

" + QString::fromStdString(asmcode).toHtmlEscaped() + "
"; - if (ui->optimize->isChecked()) - { - asmcode = compileLLLToAsm(src, true); - lll = "

Opt

" + QString::fromStdString(asmcode).toHtmlEscaped() + "
" + lll; - } + auto asmcode = compileLLLToAsm(src, ui->optimize->isChecked()); + lll = "

LLL

" + QString::fromStdString(asmcode).toHtmlEscaped() + "
"; } } - QString errs; + QString htmlErrors; qint64 gasNeeded = 0; if (errors.size()) { - errs = "

Errors

"; + htmlErrors = "

Errors

"; for (auto const& i: errors) - errs.append("
" + QString::fromStdString(i).toHtmlEscaped() + "
"); + htmlErrors.append("
" + QString::fromStdString(i).toHtmlEscaped() + "
"); + m_allGood = false; } else { @@ -260,26 +255,32 @@ void Transact::rejigData() { auto s = findSecret(value() + ethereum()->gasLimitRemaining() * gasPrice()); if (!s) - errs += "
ERROR No single account contains enough gas.
"; + htmlErrors += "
WARNING No single account contains a comfortable amount of gas.
"; // TODO: use account with most balance anyway. else { ExecutionResult er = ethereum()->create(s, value(), m_data, ethereum()->gasLimitRemaining(), gasPrice()); gasNeeded = (qint64)er.gasUsed; auto base = (qint64)Interface::txGas(m_data, 0); - errs += QString("
INFO Gas required: %1 base, %2 init
").arg(base).arg((qint64)er.gasUsed - base); + htmlErrors += QString("
INFO Gas required: %1 base, %2 init
").arg(base).arg((qint64)er.gasUsed - base); if (er.excepted != TransactionException::None) - errs += "
ERROR " + QString::fromStdString(toString(er.excepted)) + "
"; + { + htmlErrors += "
ERROR " + QString::fromStdString(toString(er.excepted)) + "
"; + m_allGood = false; + } if (er.codeDeposit == CodeDeposit::Failed) - errs += "
ERROR Code deposit failed due to insufficient gas
"; + { + htmlErrors += "
ERROR Code deposit failed due to insufficient gas
"; + m_allGood = false; + } } } else gasNeeded = (qint64)Interface::txGas(m_data, 0); } - ui->code->setHtml(errs + lll + solidity + "

Code

" + QString::fromStdString(disassemble(m_data)).toHtmlEscaped() + "

Hex

" Div(Mono) + QString::fromStdString(toHex(m_data)) + ""); + ui->code->setHtml(htmlErrors + lll + solidity + "

Code

" + QString::fromStdString(disassemble(m_data)).toHtmlEscaped() + "

Hex

" Div(Mono) + QString::fromStdString(toHex(m_data)) + ""); if (ui->gas->value() == ui->gas->minimum()) { @@ -296,6 +297,7 @@ void Transact::rejigData() } else { + m_allGood = true; auto base = (qint64)Interface::txGas(m_data, 0); m_data = parseData(ui->data->toPlainText().toStdString()); auto to = m_context->fromString(ui->destination->currentText()); @@ -326,7 +328,10 @@ void Transact::rejigData() errs += QString("
INFO Gas required: %1 base, %2 exec
").arg(base).arg((qint64)er.gasUsed - base); if (er.excepted != TransactionException::None) + { errs += "
ERROR " + QString::fromStdString(toString(er.excepted)) + "
"; + m_allGood = false; + } } } else @@ -356,6 +361,8 @@ void Transact::rejigData() ui->code->setHtml(errs + "

NatSpec

" + natspec + "

Dump

" + QString::fromStdString(dev::memDump(m_data, 8, true)) + "

Hex

" + Div(Mono) + QString::fromStdString(toHex(m_data)) + ""); } updateFee(); + + ui->send->setEnabled(m_allGood); } Secret Transact::findSecret(u256 _totalReq) const diff --git a/alethzero/Transact.h b/alethzero/Transact.h index b3702a6ae..0ad9d5653 100644 --- a/alethzero/Transact.h +++ b/alethzero/Transact.h @@ -80,4 +80,5 @@ private: dev::eth::Client* m_ethereum = nullptr; Context* m_context = nullptr; NatSpecFace* m_natSpecDB = nullptr; + bool m_allGood = false; }; From 7738cb7d4f49fa22aecc52162d557823b7108f4f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 22 Mar 2015 21:42:14 +0100 Subject: [PATCH 3/4] Vastly cleaner Transact dialog code & mechanisms. Works better for lower balances. --- alethzero/Transact.cpp | 386 +++++++++++++++++++++-------------------- alethzero/Transact.h | 2 +- 2 files changed, 196 insertions(+), 192 deletions(-) diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index c9cd5e7b4..7248ee4a6 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -25,6 +25,7 @@ #include "Transact.h" #include +#include #include #include #include @@ -135,21 +136,6 @@ void Transact::updateFee() ui->total->setPalette(p); } -string Transact::getFunctionHashes(dev::solidity::CompilerStack const& _compiler, string const& _contractName) -{ - string ret = ""; - auto const& contract = _compiler.getContractDefinition(_contractName); - auto interfaceFunctions = contract.getInterfaceFunctions(); - - for (auto const& it: interfaceFunctions) - { - ret += it.first.abridged(); - ret += " :"; - ret += it.second->getDeclaration().getName() + "\n"; - } - return ret; -} - void Transact::on_destination_currentTextChanged(QString) { if (ui->destination->currentText().size() && ui->destination->currentText() != "(Create Contract)") @@ -182,202 +168,222 @@ static std::string toString(TransactionException _te) } } -void Transact::rejigData() +static string getFunctionHashes(dev::solidity::CompilerStack const& _compiler, string const& _contractName) { - if (!ethereum()) - return; - m_allGood = true; - if (isCreation()) + string ret = ""; + auto const& contract = _compiler.getContractDefinition(_contractName); + auto interfaceFunctions = contract.getInterfaceFunctions(); + + for (auto const& it: interfaceFunctions) { - string src = ui->data->toPlainText().toStdString(); - vector errors; - QString lll; - QString solidity; - if (src.find_first_not_of("1234567890abcdefABCDEF") == string::npos && src.size() % 2 == 0) - m_data = fromHex(src); - else if (sourceIsSolidity(src)) + ret += it.first.abridged(); + ret += " :"; + ret += it.second->getDeclaration().getName() + "\n"; + } + return ret; +} + +static tuple, bytes, string> userInputToCode(string const& _user, bool _opt) +{ + string lll; + string solidity; + bytes data; + vector errors; + if (_user.find_first_not_of("1234567890abcdefABCDEF\n\t ") == string::npos && _user.size() % 2 == 0) + { + std::string u = _user; + boost::replace_all_copy(u, "\n", ""); + boost::replace_all_copy(u, "\t", ""); + boost::replace_all_copy(u, " ", ""); + data = fromHex(u); + } + else if (sourceIsSolidity(_user)) + { + dev::solidity::CompilerStack compiler(true); + try { - dev::solidity::CompilerStack compiler(true); - try - { // compiler.addSources(dev::solidity::StandardSources); - m_data = compiler.compile(src, ui->optimize->isChecked()); - solidity = "

Solidity

"; - solidity += "
var " + QString::fromStdString(compiler.defaultContractName()) + " = web3.eth.contractFromAbi(" + QString::fromStdString(compiler.getInterface()).replace(QRegExp("\\s"), "").toHtmlEscaped() + ");
"; - solidity += "
" + QString::fromStdString(compiler.getSolidityInterface()).toHtmlEscaped() + "
"; - solidity += "
" + QString::fromStdString(getFunctionHashes(compiler)).toHtmlEscaped() + "
"; - } - catch (dev::Exception const& exception) - { - ostringstream error; - solidity::SourceReferenceFormatter::printExceptionInformation(error, exception, "Error", compiler); - errors.push_back("Solidity: " + error.str()); - } - catch (...) - { - errors.push_back("Solidity: Uncaught exception"); - } + data = compiler.compile(_user, _opt); + solidity = "

Solidity

"; + solidity += "
var " + compiler.defaultContractName() + " = web3.eth.contract(" + QString::fromStdString(compiler.getInterface()).replace(QRegExp("\\s"), "").toHtmlEscaped().toStdString() + ");
"; + solidity += "
" + QString::fromStdString(compiler.getSolidityInterface()).toHtmlEscaped().toStdString() + "
"; + solidity += "
" + QString::fromStdString(getFunctionHashes(compiler, "")).toHtmlEscaped().toStdString() + "
"; } + catch (dev::Exception const& exception) + { + ostringstream error; + solidity::SourceReferenceFormatter::printExceptionInformation(error, exception, "Error", compiler); + errors.push_back("Solidity: " + error.str()); + } + catch (...) + { + errors.push_back("Solidity: Uncaught exception"); + } + } #ifndef _MSC_VER - else if (sourceIsSerpent(src)) + else if (sourceIsSerpent(_user)) + { + try { - try - { - m_data = dev::asBytes(::compile(src)); - } - catch (string const& err) - { - errors.push_back("Serpent " + err); - } + data = dev::asBytes(::compile(_user)); } -#endif - else + catch (string const& err) { - m_data = compileLLL(src, ui->optimize->isChecked(), &errors); - if (errors.empty()) - { - auto asmcode = compileLLLToAsm(src, ui->optimize->isChecked()); - lll = "

LLL

" + QString::fromStdString(asmcode).toHtmlEscaped() + "
"; - } + errors.push_back("Serpent " + err); } - QString htmlErrors; - qint64 gasNeeded = 0; - if (errors.size()) + } +#endif + else + { + data = compileLLL(_user, _opt, &errors); + if (errors.empty()) { - htmlErrors = "

Errors

"; - for (auto const& i: errors) - htmlErrors.append("
" + QString::fromStdString(i).toHtmlEscaped() + "
"); - m_allGood = false; + auto asmcode = compileLLLToAsm(_user, _opt); + lll = "

LLL

" + QString::fromStdString(asmcode).toHtmlEscaped().toStdString() + "
"; } + } + return make_tuple(errors, data, lll + solidity); +} + +string Transact::natspecNotice(Address _to, bytes const& _data) +{ + if (ethereum()->codeAt(_to, PendingBlock).size()) + { + string userNotice = m_natSpecDB->getUserNotice(ethereum()->postState().codeHash(_to), _data); + if (userNotice.empty()) + return "Destination contract unknown."; else { - if (true) - { - auto s = findSecret(value() + ethereum()->gasLimitRemaining() * gasPrice()); - if (!s) - htmlErrors += "
WARNING No single account contains a comfortable amount of gas.
"; - // TODO: use account with most balance anyway. - else - { - ExecutionResult er = ethereum()->create(s, value(), m_data, ethereum()->gasLimitRemaining(), gasPrice()); - gasNeeded = (qint64)er.gasUsed; - auto base = (qint64)Interface::txGas(m_data, 0); - htmlErrors += QString("
INFO Gas required: %1 base, %2 init
").arg(base).arg((qint64)er.gasUsed - base); - - if (er.excepted != TransactionException::None) - { - htmlErrors += "
ERROR " + QString::fromStdString(toString(er.excepted)) + "
"; - m_allGood = false; - } - if (er.codeDeposit == CodeDeposit::Failed) - { - htmlErrors += "
ERROR Code deposit failed due to insufficient gas
"; - m_allGood = false; - } - } - } - else - gasNeeded = (qint64)Interface::txGas(m_data, 0); + NatspecExpressionEvaluator evaluator; + return evaluator.evalExpression(QString::fromStdString(userNotice)).toStdString(); } + } + else + return "Destination not a contract."; +} + +void Transact::rejigData() +{ + if (!ethereum()) + return; - ui->code->setHtml(htmlErrors + lll + solidity + "

Code

" + QString::fromStdString(disassemble(m_data)).toHtmlEscaped() + "

Hex

" Div(Mono) + QString::fromStdString(toHex(m_data)) + ""); + // Determine how much balance we have to play with... + auto s = findSecret(value() + ethereum()->gasLimitRemaining() * gasPrice()); + auto b = ethereum()->balanceAt(KeyPair(s).address(), PendingBlock); + + m_allGood = true; + QString htmlInfo; - if (ui->gas->value() == ui->gas->minimum()) + auto bail = [&](QString he) { + m_allGood = false; + ui->send->setEnabled(false); + ui->code->setHtml(he + htmlInfo); + }; + + // Determine m_info. + if (isCreation()) + { + string info; + vector errors; + tie(errors, m_data, info) = userInputToCode(ui->data->toPlainText().toStdString(), ui->optimize->isChecked()); + if (errors.size()) { - ui->gas->setMinimum(gasNeeded); - ui->gas->setValue(gasNeeded); + // Errors determining transaction data (i.e. init code). Bail. + QString htmlErrors; + for (auto const& i: errors) + htmlErrors.append("
ERROR " + QString::fromStdString(i).toHtmlEscaped() + "
"); + bail(htmlErrors); + return; } - else - ui->gas->setMinimum(gasNeeded); -// if (!ui->gas->isEnabled()) -// ui->gas->setValue(m_backupGas); - ui->gas->setEnabled(true); -// if (ui->gas->value() == ui->gas->minimum() && !src.empty()) -// ui->gas->setValue((int)(m_ethereum->postState().gasLimitRemaining() / 10)); + htmlInfo = QString::fromStdString(info) + "

Code

" + QString::fromStdString(disassemble(m_data)).toHtmlEscaped(); } else { - m_allGood = true; - auto base = (qint64)Interface::txGas(m_data, 0); m_data = parseData(ui->data->toPlainText().toStdString()); - auto to = m_context->fromString(ui->destination->currentText()); - QString natspec; - QString errs; - if (ethereum()->codeAt(to, PendingBlock).size()) - { - string userNotice = m_natSpecDB->getUserNotice(ethereum()->postState().codeHash(to), m_data); - if (userNotice.empty()) - natspec = "Destination contract unknown."; - else - { - NatspecExpressionEvaluator evaluator; - natspec = evaluator.evalExpression(QString::fromStdString(userNotice)); - } + htmlInfo = "

Dump

" + QString::fromStdString(dev::memDump(m_data, 8, true)); + } - qint64 gasNeeded = 0; - if (true) - { - auto s = findSecret(value() + ethereum()->gasLimitRemaining() * gasPrice()); - if (!s) - errs += "
ERROR No single account contains enough gas.
"; - // TODO: use account with most balance anyway. - else - { - ExecutionResult er = ethereum()->call(s, value(), to, m_data, ethereum()->gasLimitRemaining(), gasPrice()); - gasNeeded = (qint64)er.gasUsed; - errs += QString("
INFO Gas required: %1 base, %2 exec
").arg(base).arg((qint64)er.gasUsed - base); - - if (er.excepted != TransactionException::None) - { - errs += "
ERROR " + QString::fromStdString(toString(er.excepted)) + "
"; - m_allGood = false; - } - } - } - else - gasNeeded = (qint64)Interface::txGas(m_data, 0); + htmlInfo += "

Hex

" + QString(Div(Mono)) + QString::fromStdString(toHex(m_data)) + ""; - if (ui->gas->value() == ui->gas->minimum()) - { - ui->gas->setMinimum(gasNeeded); - ui->gas->setValue(gasNeeded); - } - else - ui->gas->setMinimum(gasNeeded); + // Determine the minimum amount of gas we need to play... + qint64 baseGas = (qint64)Interface::txGas(m_data, 0); + qint64 gasNeeded = 0; - if (!ui->gas->isEnabled()) - ui->gas->setValue(m_backupGas); - ui->gas->setEnabled(true); - } - else - { - natspec += "Destination not a contract."; - if (ui->gas->isEnabled()) - m_backupGas = ui->gas->value(); - ui->gas->setMinimum(base); - ui->gas->setValue(base); - ui->gas->setEnabled(false); - } - ui->code->setHtml(errs + "

NatSpec

" + natspec + "

Dump

" + QString::fromStdString(dev::memDump(m_data, 8, true)) + "

Hex

" + Div(Mono) + QString::fromStdString(toHex(m_data)) + ""); + if (b < value() + baseGas * gasPrice()) + { + // Not enough - bail. + bail("
ERROR No single account contains enough for paying even the basic amount of gas required.
"); + return; + } + else + gasNeeded = min((qint64)ethereum()->gasLimitRemaining(), (qint64)((b - value()) / gasPrice())); + + // Dry-run execution to determine gas requirement and any execution errors + Address to; + ExecutionResult er; + if (isCreation()) + er = ethereum()->create(s, value(), m_data, gasNeeded, gasPrice()); + else + { + to = m_context->fromString(ui->destination->currentText()); + er = ethereum()->call(s, value(), to, m_data, ethereum()->gasLimitRemaining(), gasPrice()); + } + gasNeeded = (qint64)er.gasUsed; + htmlInfo = QString("
INFO Gas required: %1 total = %2 base, %3 exec
").arg(gasNeeded).arg(baseGas).arg(gasNeeded - baseGas) + htmlInfo; + + if (er.excepted != TransactionException::None) + { + bail("
ERROR " + QString::fromStdString(toString(er.excepted)) + "
"); + return; } + if (er.codeDeposit == CodeDeposit::Failed) + { + bail("
ERROR Code deposit failed due to insufficient gas
"); + return; + } + + // Add Natspec information + if (!isCreation()) + htmlInfo = "
INFO " + QString::fromStdString(natspecNotice(to, m_data)).toHtmlEscaped() + "
" + htmlInfo; + + // Update gas + if (ui->gas->value() == ui->gas->minimum()) + { + ui->gas->setMinimum(gasNeeded); + ui->gas->setValue(gasNeeded); + } + else + ui->gas->setMinimum(gasNeeded); + updateFee(); + ui->code->setHtml(htmlInfo); ui->send->setEnabled(m_allGood); } Secret Transact::findSecret(u256 _totalReq) const { - if (ethereum()) - for (auto const& i: m_myKeys) - if (ethereum()->balanceAt(i.address(), PendingBlock) >= _totalReq) - return i.secret(); - return Secret(); + if (!ethereum()) + return Secret(); + + Secret best; + u256 bestBalance = 0; + for (auto const& i: m_myKeys) + { + auto b = ethereum()->balanceAt(i.address(), PendingBlock); + if (b >= _totalReq) + return i.secret(); + if (b > bestBalance) + bestBalance = b, best = i.secret(); + } + return best; } void Transact::on_send_clicked() { Secret s = findSecret(value() + fee()); - if (!s) + auto b = ethereum()->balanceAt(KeyPair(s).address(), PendingBlock); + if (!s || b < value() + fee()) { QMessageBox::critical(this, "Transaction Failed", "Couldn't make transaction: no single account contains at least the required amount."); return; @@ -400,9 +406,7 @@ void Transact::on_send_clicked() m_natSpecDB->add(contractHash, compiler.getMetadata(s, dev::solidity::DocumentationType::NatspecUser)); } } - catch (...) - { - } + catch (...) {} } else ethereum()->submitTransaction(s, value(), m_context->fromString(ui->destination->currentText()), m_data, ui->gas->value(), gasPrice()); @@ -411,24 +415,24 @@ void Transact::on_send_clicked() void Transact::on_debug_clicked() { + Secret s = findSecret(value() + fee()); + auto b = ethereum()->balanceAt(KeyPair(s).address(), PendingBlock); + if (!s || b < value() + fee()) + { + QMessageBox::critical(this, "Transaction Failed", "Couldn't make transaction: no single account contains at least the required amount."); + return; + } + try { - u256 totalReq = value() + fee(); - for (auto i: m_myKeys) - if (ethereum()->balanceAt(i.address()) >= totalReq) - { - State st(ethereum()->postState()); - Secret s = i.secret(); - Transaction t = isCreation() ? - Transaction(value(), gasPrice(), ui->gas->value(), m_data, st.transactionsFrom(dev::toAddress(s)), s) : - Transaction(value(), gasPrice(), ui->gas->value(), m_context->fromString(ui->destination->currentText()), m_data, st.transactionsFrom(dev::toAddress(s)), s); - Debugger dw(m_context, this); - Executive e(st, ethereum()->blockChain(), 0); - dw.populate(e, t); - dw.exec(); - return; - } - QMessageBox::critical(this, "Transaction Failed", "Couldn't make transaction: no single account contains at least the required amount."); + State st(ethereum()->postState()); + Transaction t = isCreation() ? + Transaction(value(), gasPrice(), ui->gas->value(), m_data, st.transactionsFrom(dev::toAddress(s)), s) : + Transaction(value(), gasPrice(), ui->gas->value(), m_context->fromString(ui->destination->currentText()), m_data, st.transactionsFrom(dev::toAddress(s)), s); + Debugger dw(m_context, this); + Executive e(st, ethereum()->blockChain(), 0); + dw.populate(e, t); + dw.exec(); } catch (dev::Exception const& _e) { diff --git a/alethzero/Transact.h b/alethzero/Transact.h index 0ad9d5653..71bc393b2 100644 --- a/alethzero/Transact.h +++ b/alethzero/Transact.h @@ -68,7 +68,7 @@ private: dev::u256 value() const; dev::u256 gasPrice() const; - std::string getFunctionHashes(dev::solidity::CompilerStack const& _compiler, std::string const& _contractName = std::string()); + std::string natspecNotice(dev::Address _to, dev::bytes const& _data); dev::Secret findSecret(dev::u256 _totalReq) const; Ui::Transact* ui = nullptr; From e01002bef92ba598faf9ece95565891f432ecc8d Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 22 Mar 2015 22:26:10 +0100 Subject: [PATCH 4/4] Fix signed/unsigned mismatch. --- test/peer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/peer.cpp b/test/peer.cpp index ba8fb0b6e..bfb4680d3 100644 --- a/test/peer.cpp +++ b/test/peer.cpp @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(save_nodes) RLP r(firstHostNetwork); BOOST_REQUIRE(r.itemCount() == 3); - BOOST_REQUIRE(r[0].toInt() == dev::p2p::c_protocolVersion); + BOOST_REQUIRE(r[0].toInt() == dev::p2p::c_protocolVersion); BOOST_REQUIRE_EQUAL(r[1].toBytes().size(), 32); // secret BOOST_REQUIRE_EQUAL(r[2].itemCount(), 5); }