Browse Source

Merge branch 'develop' into discovery

Conflicts:
	libp2p/NodeTable.cpp
cl-refactor
subtly 10 years ago
parent
commit
6dd5b57e74
  1. 2
      abi/main.cpp
  2. 2
      alethzero/NatspecHandler.cpp
  3. 4
      eth/main.cpp
  4. 14
      libdevcore/Log.h
  5. 23
      libdevcore/Worker.cpp
  6. 6
      libethereum/BlockChain.cpp
  7. 52
      libethereum/Client.cpp
  8. 4
      libethereum/ClientBase.cpp
  9. 2
      libethereum/EthereumHost.cpp
  10. 14
      libethereum/EthereumPeer.cpp
  11. 26
      libethereum/State.cpp
  12. 2
      libethereum/State.h
  13. 2
      libethereum/TransactionQueue.cpp
  14. 16
      libp2p/Host.cpp
  15. 2
      libp2p/Network.cpp
  16. 8
      libp2p/NodeTable.cpp
  17. 6
      libp2p/Session.cpp
  18. 2
      libsolidity/InterfaceHandler.cpp
  19. 6
      libweb3jsonrpc/WebThreeStubServerBase.cpp
  20. 4
      mix/ContractCallDataEncoder.cpp
  21. 23
      mix/qml/QAddressView.qml
  22. 2
      mix/qml/StateListModel.qml
  23. 43
      mix/qml/StructView.qml
  24. 4
      mix/qml/TransactionDialog.qml
  25. 2
      mix/qml/VariablesView.qml
  26. 11
      solc/CommandLineInterface.cpp
  27. 6
      test/libdevcrypto/trie.cpp
  28. 12
      test/libsolidity/SolidityInterface.cpp
  29. 10
      test/libwhisper/whisperTopic.cpp

2
abi/main.cpp

@ -43,7 +43,7 @@ void help()
<< " -h,--help Print this help message and exit." << endl
<< " -V,--version Show the version and exit." << endl
<< "Input options:" << endl
<< " -f,--format-prefix Require all input formats to be prefixed e.g. 0x for hex, . for decimal, @ for binary." << endl
<< " -f,--format-prefix Require all input formats to be prefixed e.g. 0x for hex, + for decimal, ' for binary." << endl
<< " -F,--no-format-prefix Require no input format to be prefixed." << endl
<< " -t,--typing Require all arguments to be typed e.g. b32: (bytes32), u64: (uint64), b[]: (byte[]), i: (int256)." << endl
<< " -T,--no-typing Require no arguments to be typed." << endl

2
alethzero/NatspecHandler.cpp

@ -58,7 +58,7 @@ string NatspecHandler::retrieve(dev::h256 const& _contractHash) const
{
string ret;
m_db->Get(m_readOptions, _contractHash.ref(), &ret);
cdebug << "Looking up NatSpec: " << _contractHash.abridged() << ret;
cdebug << "Looking up NatSpec: " << _contractHash << ret;
return ret;
}

4
eth/main.cpp

@ -517,7 +517,7 @@ int main(int argc, char** argv)
bool bootstrap = false;
/// Mining params
unsigned mining = ~(unsigned)0;
unsigned mining = 0;
bool forceMining = false;
KeyPair sigKey = KeyPair::create();
Secret sessionSecret;
@ -1317,9 +1317,9 @@ int main(int argc, char** argv)
{
string hexAddr;
u256 amount;
int size = hexAddr.length();
iss >> hexAddr >> amount;
int size = hexAddr.length();
if (size < 40)
{
if (size > 0)

14
libdevcore/Log.h

@ -87,11 +87,12 @@ struct WarnChannel: public LogChannel { static const char* name(); static const
struct NoteChannel: public LogChannel { static const char* name(); };
struct DebugChannel: public LogChannel { static const char* name(); static const int verbosity = 0; };
enum LogTag
enum class LogTag
{
None,
url,
error
Url,
Error,
Special
};
class LogOutputStreamBase
@ -103,12 +104,13 @@ public:
{
switch (m_logTag)
{
case url: m_sstr << EthNavyUnder; break;
case error: m_sstr << EthRedBold; break;
case LogTag::Url: m_sstr << EthNavyUnder; break;
case LogTag::Error: m_sstr << EthRedBold; break;
case LogTag::Special: m_sstr << EthWhiteBold; break;
default:;
}
m_sstr << _t << EthReset;
m_logTag = None;
m_logTag = LogTag::None;
}
void append(unsigned long _t) { m_sstr << EthBlue << _t << EthReset; }

23
libdevcore/Worker.cpp

@ -29,18 +29,25 @@ using namespace dev;
void Worker::startWorking()
{
// cnote << "startWorking for thread" << m_name;
cnote << "startWorking for thread" << m_name;
Guard l(x_work);
m_state = WorkerState::Starting;
if (!m_work)
if (m_work)
{
WorkerState ex = WorkerState::Stopped;
m_state.compare_exchange_strong(ex, WorkerState::Starting);
}
else
{
m_state = WorkerState::Starting;
m_work.reset(new thread([&]()
{
setThreadName(m_name.c_str());
cnote << "Thread begins";
while (m_state != WorkerState::Killing)
{
WorkerState ex = WorkerState::Starting;
m_state.compare_exchange_strong(ex, WorkerState::Started);
bool ok = m_state.compare_exchange_strong(ex, WorkerState::Started);
cnote << "Trying to set Started: Thread was" << (unsigned)ex << "; " << ok;
startedWorking();
cnote << "Entering work loop...";
@ -52,22 +59,25 @@ void Worker::startWorking()
// m_state.compare_exchange_strong(ex, WorkerState::Stopped);
ex = m_state.exchange(WorkerState::Stopped);
if (ex == WorkerState::Killing)
cnote << "State: Stopped: Thread was" << (unsigned)ex;
if (ex == WorkerState::Killing || ex == WorkerState::Starting)
m_state.exchange(ex);
cnote << "Waiting until not Stopped...";
while (m_state == WorkerState::Stopped)
this_thread::sleep_for(chrono::milliseconds(20));
}
}));
cnote << "Spawning" << m_name;
}
cnote << "Waiting until Started...";
while (m_state != WorkerState::Started)
this_thread::sleep_for(chrono::microseconds(20));
}
void Worker::stopWorking()
{
// cnote << "stopWorking for thread" << m_name;
cnote << "stopWorking for thread" << m_name;
ETH_GUARDED(x_work)
if (m_work)
{
@ -75,6 +85,7 @@ void Worker::stopWorking()
WorkerState ex = WorkerState::Started;
m_state.compare_exchange_strong(ex, WorkerState::Stopping);
cnote << "Waiting until Stopped...";
while (m_state != WorkerState::Stopped)
this_thread::sleep_for(chrono::microseconds(20));
}

6
libethereum/BlockChain.cpp

@ -320,14 +320,14 @@ tuple<h256s, h256s, bool> BlockChain::sync(BlockQueue& _bq, OverlayDB const& _st
}
catch (dev::eth::UnknownParent)
{
cwarn << "ODD: Import queue contains block with unknown parent." << error << boost::current_exception_diagnostic_information();
cwarn << "ODD: Import queue contains block with unknown parent." << LogTag::Error << boost::current_exception_diagnostic_information();
// NOTE: don't reimport since the queue should guarantee everything in the right order.
// Can't continue - chain bad.
badBlocks.push_back(BlockInfo::headerHash(block));
}
catch (Exception const& _e)
{
cnote << "Exception while importing block. Someone (Jeff? That you?) seems to be giving us dodgy blocks!" << error << diagnostic_information(_e);
cnote << "Exception while importing block. Someone (Jeff? That you?) seems to be giving us dodgy blocks!" << LogTag::Error << diagnostic_information(_e);
// NOTE: don't reimport since the queue should guarantee everything in the right order.
// Can't continue - chain bad.
badBlocks.push_back(BlockInfo::headerHash(block));
@ -611,7 +611,7 @@ ImportRoute BlockChain::import(bytes const& _block, OverlayDB const& _db, Import
m_extrasDB->Put(m_writeOptions, ldb::Slice("best"), ldb::Slice((char const*)&(bi.hash()), 32));
}
clog(BlockChainNote) << " Imported and best" << td << " (#" << bi.number << "). Has" << (details(bi.parentHash).children.size() - 1) << "siblings. Route:" << toString(route);
clog(BlockChainNote) << " Imported and best" << td << " (#" << bi.number << "). Has" << (details(bi.parentHash).children.size() - 1) << "siblings. Route:" << route;
noteCanonChanged();
StructuredLogger::chainNewHead(

52
libethereum/Client.cpp

@ -237,9 +237,6 @@ void Client::doneWorking()
void Client::killChain()
{
WriteGuard l(x_postMine);
WriteGuard l2(x_preMine);
bool wasMining = isMining();
if (wasMining)
stopMining();
@ -248,18 +245,21 @@ void Client::killChain()
m_tq.clear();
m_bq.clear();
m_farm.stop();
m_preMine = State();
m_postMine = State();
// ETH_WRITE_GUARDED(x_stateDB) // no point doing this yet since we can't control where else it's open yet.
{
WriteGuard l(x_postMine);
WriteGuard l2(x_preMine);
m_preMine = State();
m_postMine = State();
m_stateDB = OverlayDB();
m_stateDB = State::openDB(Defaults::dbPath(), WithExisting::Kill);
}
m_bc.reopen(Defaults::dbPath(), WithExisting::Kill);
m_bc.reopen(Defaults::dbPath(), WithExisting::Kill);
m_preMine = State(m_stateDB);
m_postMine = State(m_stateDB);
m_preMine = State(m_stateDB, BaseState::CanonGenesis);
m_postMine = State(m_stateDB);
}
if (auto h = m_host.lock())
h->reset();
@ -291,24 +291,23 @@ void Client::clearPending()
noteChanged(changeds);
}
template <class T>
static string filtersToString(T const& _fs)
template <class S, class T>
static S& filtersStreamOut(S& _out, T const& _fs)
{
stringstream ret;
ret << "{";
_out << "{";
unsigned i = 0;
for (h256 const& f: _fs)
{
ret << (i++ ? ", " : "");
_out << (i++ ? ", " : "");
if (f == PendingChangedFilter)
ret << url << "pending";
_out << LogTag::Special << "pending";
else if (f == ChainChangedFilter)
ret << url << "chain";
_out << LogTag::Special << "chain";
else
ret << f;
_out << f;
}
ret << "}";
return ret.str();
_out << "}";
return _out;
}
void Client::appendFromNewPending(TransactionReceipt const& _receipt, h256Set& io_changed, h256 _transactionHash)
@ -572,16 +571,21 @@ void Client::noteChanged(h256Set const& _filters)
{
Guard l(x_filtersWatches);
if (_filters.size())
cnote << "noteChanged(" << filtersToString(_filters) << ")";
filtersStreamOut(cnote << "noteChanged:", _filters);
// accrue all changes left in each filter into the watches.
for (auto& w: m_watches)
if (_filters.count(w.second.id))
{
cwatch << "!!!" << w.first << (m_filters.count(w.second.id) ? w.second.id.abridged() : w.second.id == PendingChangedFilter ? "pending" : w.second.id == ChainChangedFilter ? "chain" : "???");
if (m_filters.count(w.second.id)) // Normal filtering watch
if (m_filters.count(w.second.id))
{
cwatch << "!!!" << w.first << w.second.id.abridged();
w.second.changes += m_filters.at(w.second.id).changes;
else // Special ('pending'/'latest') watch
}
else
{
cwatch << "!!!" << w.first << LogTag::Special << (w.second.id == PendingChangedFilter ? "pending" : w.second.id == ChainChangedFilter ? "chain" : "???");
w.second.changes.push_back(LocalisedLogEntry(SpecialLogEntry, 0));
}
}
// clear the filters now.
for (auto& i: m_filters)

4
libethereum/ClientBase.cpp

@ -226,7 +226,7 @@ unsigned ClientBase::installWatch(LogFilter const& _f, Reaping _r)
Guard l(x_filtersWatches);
if (!m_filters.count(h))
{
cwatch << "FFF" << _f << h.abridged();
cwatch << "FFF" << _f << h;
m_filters.insert(make_pair(h, _f));
}
}
@ -240,7 +240,7 @@ unsigned ClientBase::installWatch(h256 _h, Reaping _r)
Guard l(x_filtersWatches);
ret = m_watches.size() ? m_watches.rbegin()->first + 1 : 0;
m_watches[ret] = ClientWatch(_h, _r);
cwatch << "+++" << ret << _h.abridged();
cwatch << "+++" << ret << _h;
}
#if INITIAL_STATE_AS_CHANGES
auto ch = logs(ret);

2
libethereum/EthereumHost.cpp

@ -61,7 +61,7 @@ bool EthereumHost::ensureInitialised()
{
// First time - just initialise.
m_latestBlockSent = m_chain.currentHash();
clog(NetNote) << "Initialising: latest=" << m_latestBlockSent.abridged();
clog(NetNote) << "Initialising: latest=" << m_latestBlockSent;
for (auto const& i: m_tq.transactions())
m_transactionsSent.insert(i.first);

14
libethereum/EthereumPeer.cpp

@ -134,7 +134,7 @@ void EthereumPeer::transition(Asking _a, bool _force)
clog(NetWarn) << "Bad state: asking for Hashes yet not syncing!";
if (shouldGrabBlocks())
{
clog(NetNote) << "Difficulty of hashchain HIGHER. Grabbing" << m_syncingNeededBlocks.size() << "blocks [latest now" << m_syncingLatestHash.abridged() << ", was" << host()->m_latestBlockSent.abridged() << "]";
clog(NetNote) << "Difficulty of hashchain HIGHER. Grabbing" << m_syncingNeededBlocks.size() << "blocks [latest now" << m_syncingLatestHash << ", was" << host()->m_latestBlockSent << "]";
host()->m_man.resetToChain(m_syncingNeededBlocks);
// host()->m_latestBlockSent = m_syncingLatestHash;
@ -253,7 +253,7 @@ bool EthereumPeer::shouldGrabBlocks() const
if (m_syncingNeededBlocks.empty())
return false;
clog(NetNote) << "Should grab blocks? " << td << "vs" << ctd << ";" << m_syncingNeededBlocks.size() << " blocks, ends" << m_syncingNeededBlocks.back().abridged();
clog(NetNote) << "Should grab blocks? " << td << "vs" << ctd << ";" << m_syncingNeededBlocks.size() << " blocks, ends" << m_syncingNeededBlocks.back();
if (td < ctd || (td == ctd && host()->m_chain.currentHash() == lh))
return false;
@ -280,7 +280,7 @@ void EthereumPeer::attemptSync()
unsigned n = host()->m_chain.number();
u256 td = host()->m_chain.details().totalDifficulty;
clog(NetAllDetail) << "Attempt chain-grab? Latest:" << c.abridged() << ", number:" << n << ", TD:" << td << " versus " << m_totalDifficulty;
clog(NetAllDetail) << "Attempt chain-grab? Latest:" << c << ", number:" << n << ", TD:" << td << " versus " << m_totalDifficulty;
if (td >= m_totalDifficulty)
{
clog(NetAllDetail) << "No. Our chain is better.";
@ -310,7 +310,7 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r)
m_latestHash = _r[3].toHash<h256>();
auto genesisHash = _r[4].toHash<h256>();
clog(NetMessageSummary) << "Status:" << m_protocolVersion << "/" << m_networkId << "/" << genesisHash.abridged() << ", TD:" << m_totalDifficulty << "=" << m_latestHash.abridged();
clog(NetMessageSummary) << "Status:" << m_protocolVersion << "/" << m_networkId << "/" << genesisHash << ", TD:" << m_totalDifficulty << "=" << m_latestHash;
if (genesisHash != host()->m_chain.genesisHash())
disable("Invalid genesis hash");
@ -358,7 +358,7 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r)
{
h256 later = _r[0].toHash<h256>();
unsigned limit = _r[1].toInt<unsigned>();
clog(NetMessageSummary) << "GetBlockHashes (" << limit << "entries," << later.abridged() << ")";
clog(NetMessageSummary) << "GetBlockHashes (" << limit << "entries," << later << ")";
unsigned c = min<unsigned>(host()->m_chain.number(later), limit);
@ -413,7 +413,7 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r)
knowns++;
m_syncingLastReceivedHash = h;
}
clog(NetMessageSummary) << knowns << "knowns," << unknowns << "unknowns; now at" << m_syncingLastReceivedHash.abridged();
clog(NetMessageSummary) << knowns << "knowns," << unknowns << "unknowns; now at" << m_syncingLastReceivedHash;
// run through - ask for more.
transition(Asking::Hashes);
break;
@ -526,7 +526,7 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r)
case NewBlockPacket:
{
auto h = BlockInfo::headerHash(_r[0].data());
clog(NetMessageSummary) << "NewBlock: " << h.abridged();
clog(NetMessageSummary) << "NewBlock: " << h;
if (_r.itemCount() != 2)
disable("NewBlock without 2 data fields.");

26
libethereum/State.cpp

@ -329,7 +329,7 @@ bool State::sync(BlockChain const& _bc, h256 _block, BlockInfo const& _bi, Impor
if (m_db.lookup(bi.stateRoot).empty())
{
cwarn << "Unable to sync to" << bi.hash().abridged() << "; state root" << bi.stateRoot.abridged() << "not found in database.";
cwarn << "Unable to sync to" << bi.hash() << "; state root" << bi.stateRoot << "not found in database.";
cwarn << "Database corrupt: contains block without stateRoot:" << bi;
cwarn << "Bailing.";
exit(-1);
@ -500,7 +500,7 @@ pair<TransactionReceipts, bool> State::sync(BlockChain const& _bc, TransactionQu
else if (i.second.gasPrice() < _gp.ask(*this) * 9 / 10)
{
// less than 90% of our ask price for gas. drop.
cnote << i.first.abridged() << "Dropping El Cheapo transaction (<90% of ask price)";
cnote << i.first << "Dropping El Cheapo transaction (<90% of ask price)";
_tq.drop(i.first);
}
}
@ -512,13 +512,13 @@ pair<TransactionReceipts, bool> State::sync(BlockChain const& _bc, TransactionQu
if (req > got)
{
// too old
cnote << i.first.abridged() << "Dropping old transaction (nonce too low)";
cnote << i.first << "Dropping old transaction (nonce too low)";
_tq.drop(i.first);
}
else if (got > req + 5)
{
// too new
cnote << i.first.abridged() << "Dropping new transaction (> 5 nonces ahead)";
cnote << i.first << "Dropping new transaction (> 5 nonces ahead)";
_tq.drop(i.first);
}
else
@ -529,7 +529,7 @@ pair<TransactionReceipts, bool> State::sync(BlockChain const& _bc, TransactionQu
bigint const& got = *boost::get_error_info<errinfo_got>(e);
if (got > m_currentBlock.gasLimit)
{
cnote << i.first.abridged() << "Dropping over-gassy transaction (gas > block's gas limit)";
cnote << i.first << "Dropping over-gassy transaction (gas > block's gas limit)";
_tq.drop(i.first);
}
else
@ -538,14 +538,14 @@ pair<TransactionReceipts, bool> State::sync(BlockChain const& _bc, TransactionQu
catch (Exception const& _e)
{
// Something else went wrong - drop it.
cnote << i.first.abridged() << "Dropping invalid transaction:" << diagnostic_information(_e);
cnote << i.first << "Dropping invalid transaction:" << diagnostic_information(_e);
_tq.drop(i.first);
}
catch (std::exception const&)
{
// Something else went wrong - drop it.
_tq.drop(i.first);
cnote << i.first.abridged() << "Transaction caused low-level exception :(";
cnote << i.first << "Transaction caused low-level exception :(";
}
}
if (chrono::steady_clock::now() > deadline)
@ -709,15 +709,15 @@ void State::cleanup(bool _fullCommit)
paranoia("immediately before database commit", true);
// Commit the new trie to disk.
clog(StateTrace) << "Committing to disk: stateRoot" << m_currentBlock.stateRoot.abridged() << "=" << rootHash().abridged() << "=" << toHex(asBytes(m_db.lookup(rootHash())));
clog(StateTrace) << "Committing to disk: stateRoot" << m_currentBlock.stateRoot << "=" << rootHash() << "=" << toHex(asBytes(m_db.lookup(rootHash())));
m_db.commit();
clog(StateTrace) << "Committed: stateRoot" << m_currentBlock.stateRoot.abridged() << "=" << rootHash().abridged() << "=" << toHex(asBytes(m_db.lookup(rootHash())));
clog(StateTrace) << "Committed: stateRoot" << m_currentBlock.stateRoot << "=" << rootHash() << "=" << toHex(asBytes(m_db.lookup(rootHash())));
paranoia("immediately after database commit", true);
m_previousBlock = m_currentBlock;
m_currentBlock.populateFromParent(m_previousBlock);
clog(StateTrace) << "finalising enactment. current -> previous, hash is" << m_previousBlock.hash().abridged();
clog(StateTrace) << "finalising enactment. current -> previous, hash is" << m_previousBlock.hash();
}
else
m_db.rollback();
@ -789,7 +789,7 @@ void State::commitToMine(BlockChain const& _bc)
{
uncommitToMine();
// cnote << "Committing to mine on block" << m_previousBlock.hash.abridged();
// cnote << "Committing to mine on block" << m_previousBlock.hash;
#if ETH_PARANOIA && 0
commit();
cnote << "Pre-reward stateRoot:" << m_state.root();
@ -866,7 +866,7 @@ void State::commitToMine(BlockChain const& _bc)
// Commit any and all changes to the trie that are in the cache, then update the state root accordingly.
commit();
// cnote << "Post-reward stateRoot:" << m_state.root().abridged();
// cnote << "Post-reward stateRoot:" << m_state.root();
// cnote << m_state;
// cnote << *this;
@ -890,7 +890,7 @@ void State::completeMine()
ret.appendRaw(m_currentUncles);
ret.swapOut(m_currentBytes);
m_currentBlock.noteDirty();
cnote << "Mined " << m_currentBlock.hash().abridged() << "(parent: " << m_currentBlock.parentHash.abridged() << ")";
cnote << "Mined " << m_currentBlock.hash() << "(parent: " << m_currentBlock.parentHash << ")";
StructuredLogger::minedNewBlock(
m_currentBlock.hash().abridged(),
m_currentBlock.nonce.abridged(),

2
libethereum/State.h

@ -174,7 +174,7 @@ public:
PoW::assignResult(_result, m_currentBlock);
cnote << "Completed" << m_currentBlock.headerHash(WithoutNonce).abridged() << m_currentBlock.nonce.abridged() << m_currentBlock.difficulty << PoW::verify(m_currentBlock);
cnote << "Completed" << m_currentBlock.headerHash(WithoutNonce) << m_currentBlock.nonce << m_currentBlock.difficulty << PoW::verify(m_currentBlock);
completeMine();

2
libethereum/TransactionQueue.cpp

@ -57,7 +57,7 @@ ImportResult TransactionQueue::import(bytesConstRef _transactionRLP, ImportCallb
m_known.insert(h);
if (_cb)
m_callbacks[h] = _cb;
ctxq << "Queued vaguely legit-looking transaction" << h.abridged();
ctxq << "Queued vaguely legit-looking transaction" << h;
m_onReady();
}
catch (Exception const& _e)

16
libp2p/Host.cpp

@ -204,7 +204,7 @@ void Host::startPeerSession(Public const& _id, RLP const& _rlp, RLPXFrameIO* _io
stringstream capslog;
for (auto cap: caps)
capslog << "(" << cap.first << "," << dec << cap.second << ")";
clog(NetMessageSummary) << "Hello: " << clientVersion << "V[" << protocolVersion << "]" << _id.abridged() << showbase << capslog.str() << dec << listenPort;
clog(NetMessageSummary) << "Hello: " << clientVersion << "V[" << protocolVersion << "]" << _id << showbase << capslog.str() << dec << listenPort;
// create session so disconnects are managed
auto ps = make_shared<Session>(this, _io, p, PeerSessionInfo({_id, clientVersion, _endpoint.address().to_string(), listenPort, chrono::steady_clock::duration(), _rlp[2].toSet<CapDesc>(), 0, map<string, string>()}));
@ -221,7 +221,7 @@ void Host::startPeerSession(Public const& _id, RLP const& _rlp, RLPXFrameIO* _io
if(s->isConnected())
{
// Already connected.
clog(NetWarn) << "Session already exists for peer with id" << _id.abridged();
clog(NetWarn) << "Session already exists for peer with id" << _id;
ps->disconnect(DuplicatePeer);
return;
}
@ -238,7 +238,7 @@ void Host::startPeerSession(Public const& _id, RLP const& _rlp, RLPXFrameIO* _io
m_sessions[_id] = ps;
}
clog(NetNote) << "p2p.host.peer.register" << _id.abridged();
clog(NetNote) << "p2p.host.peer.register" << _id;
StructuredLogger::p2pConnected(_id.abridged(), ps->m_peer->endpoint, ps->m_peer->m_lastConnected, clientVersion, peerCount());
}
@ -466,7 +466,7 @@ void Host::connect(std::shared_ptr<Peer> const& _p)
}
bi::tcp::endpoint ep(_p->endpoint);
clog(NetConnect) << "Attempting connection to node" << _p->id.abridged() << "@" << ep << "from" << id().abridged();
clog(NetConnect) << "Attempting connection to node" << _p->id << "@" << ep << "from" << id();
auto socket = make_shared<RLPXSocket>(new bi::tcp::socket(m_ioService));
socket->ref().async_connect(ep, [=](boost::system::error_code const& ec)
{
@ -475,13 +475,13 @@ void Host::connect(std::shared_ptr<Peer> const& _p)
if (ec)
{
clog(NetConnect) << "Connection refused to node" << _p->id.abridged() << "@" << ep << "(" << ec.message() << ")";
clog(NetConnect) << "Connection refused to node" << _p->id << "@" << ep << "(" << ec.message() << ")";
// Manually set error (session not present)
_p->m_lastDisconnect = TCPError;
}
else
{
clog(NetConnect) << "Connecting to" << _p->id.abridged() << "@" << ep;
clog(NetConnect) << "Connecting to" << _p->id << "@" << ep;
auto handshake = make_shared<RLPXHandshake>(this, socket, _p->id);
{
Guard l(x_connecting);
@ -619,14 +619,14 @@ void Host::startedWorking()
runAcceptor();
}
else
clog(NetNote) << "p2p.start.notice id:" << id().abridged() << "TCP Listen port is invalid or unavailable.";
clog(NetNote) << "p2p.start.notice id:" << id() << "TCP Listen port is invalid or unavailable.";
shared_ptr<NodeTable> nodeTable(new NodeTable(m_ioService, m_alias, NodeIPEndpoint(bi::address::from_string(listenAddress()), listenPort(), listenPort())));
nodeTable->setEventHandler(new HostNodeTableHandler(*this));
m_nodeTable = nodeTable;
restoreNetwork(&m_restoreNetwork);
clog(NetNote) << "p2p.started id:" << id().abridged();
clog(NetNote) << "p2p.started id:" << id();
run(boost::system::error_code());
}

2
libp2p/Network.cpp

@ -228,7 +228,7 @@ bi::tcp::endpoint Network::resolveHost(string const& _addr)
bi::tcp::resolver r(s_resolverIoService);
auto it = r.resolve({split[0], toString(port)}, ec);
if (ec)
clog(NetWarn) << "Error resolving host address..." << url << _addr << ":" << error << ec.message();
clog(NetWarn) << "Error resolving host address..." << LogTag::Url << _addr << ":" << LogTag::Error << ec.message();
else
ep = *it;
}

8
libp2p/NodeTable.cpp

@ -317,9 +317,7 @@ void NodeTable::noteActiveNode(Public const& _pubk, bi::udp::endpoint const& _en
node->endpoint.udpPort = _endpoint.port();
if (!!node && !node->pending)
{
// todo: drop in favor of ping/pong packets
clog(NodeTableConnect) << "Noting active node:" << _pubk.abridged() << _endpoint.address().to_string() << ":" << _endpoint.port();
clog(NodeTableConnect) << "Noting active node:" << _pubk << _endpoint.address().to_string() << ":" << _endpoint.port();
shared_ptr<NodeEntry> contested;
{
Guard l(x_state);
@ -371,7 +369,7 @@ void NodeTable::dropNode(shared_ptr<NodeEntry> _n)
}
// notify host
clog(NodeTableUpdate) << "p2p.nodes.drop " << _n->id.abridged();
clog(NodeTableUpdate) << "p2p.nodes.drop " << _n->id;
if (m_nodeEventHandler)
m_nodeEventHandler->appendEvent(_n->id, NodeEntryDropped);
}
@ -461,7 +459,7 @@ void NodeTable::onReceived(UDPSocketFace*, bi::udp::endpoint const& _from, bytes
m_node.endpoint.address = in.destination.address;
m_node.endpoint.udpPort = in.destination.udpPort;
clog(NodeTableConnect) << "PONG from " << nodeid.abridged() << _from;
clog(NodeTableConnect) << "PONG from " << nodeid << _from;
break;
}

6
libp2p/Session.cpp

@ -138,7 +138,7 @@ void Session::serviceNodesRequest()
auto rs = randomSelection(peers, 10);
for (auto const& i: rs)
{
clog(NetTriviaDetail) << "Sending peer " << i.id.abridged() << i.endpoint;
clog(NetTriviaDetail) << "Sending peer " << i.id << i.endpoint;
if (i.endpoint.address.is_v4())
s.appendList(3) << bytesConstRef(i.endpoint.address.to_v4().to_bytes().data(), 4) << i.endpoint.tcpPort << i.id;
else// if (i.second.address().is_v6()) - assumed
@ -215,7 +215,7 @@ bool Session::interpret(PacketType _t, RLP const& _r)
auto ep = bi::tcp::endpoint(peerAddress, _r[i][1].toInt<short>());
NodeId id = _r[i][2].toHash<NodeId>();
clog(NetAllDetail) << "Checking: " << ep << "(" << id.abridged() << ")";
clog(NetAllDetail) << "Checking: " << ep << "(" << id << ")";
if (!isPublicAddress(peerAddress))
goto CONTINUE; // Private address. Ignore.
@ -238,7 +238,7 @@ bool Session::interpret(PacketType _t, RLP const& _r)
// OK passed all our checks. Assume it's good.
addRating(1000);
m_server->addNode(id, NodeIPEndpoint(ep.address(), ep.port(), ep.port()));
clog(NetTriviaDetail) << "New peer: " << ep << "(" << id .abridged()<< ")";
clog(NetTriviaDetail) << "New peer: " << ep << "(" << id << ")";
CONTINUE:;
LAMEPEER:;
}

2
libsolidity/InterfaceHandler.cpp

@ -107,7 +107,7 @@ unique_ptr<string> InterfaceHandler::getABISolidityInterface(ContractDefinition
ret += "returns" + populateParameters(it.second->getReturnParameterNames(), it.second->getReturnParameterTypeNames());
else if (ret.back() == ' ')
ret.pop_back();
ret += "{}";
ret += ";";
}
return unique_ptr<string>(new string(ret + "}"));

6
libweb3jsonrpc/WebThreeStubServerBase.cpp

@ -848,7 +848,7 @@ bool WebThreeStubServerBase::shh_post(Json::Value const& _json)
Secret from;
if (m.from() && m_ids.count(m.from()))
{
cwarn << "Silently signing message from identity" << m.from().abridged() << ": User validation hook goes here.";
cwarn << "Silently signing message from identity" << m.from() << ": User validation hook goes here.";
// TODO: insert validification hook here.
from = m_ids[m.from()];
}
@ -940,7 +940,7 @@ Json::Value WebThreeStubServerBase::shh_getFilterChanges(string const& _filterId
shh::Message m;
if (pub)
{
cwarn << "Silently decrypting message from identity" << pub.abridged() << ": User validation hook goes here.";
cwarn << "Silently decrypting message from identity" << pub << ": User validation hook goes here.";
m = e.open(face()->fullTopic(id), m_ids[pub]);
}
else
@ -973,7 +973,7 @@ Json::Value WebThreeStubServerBase::shh_getMessages(string const& _filterId)
shh::Message m;
if (pub)
{
cwarn << "Silently decrypting message from identity" << pub.abridged() << ": User validation hook goes here.";
cwarn << "Silently decrypting message from identity" << pub << ": User validation hook goes here.";
m = e.open(face()->fullTopic(id), m_ids[pub]);
}
else

4
mix/ContractCallDataEncoder.cpp

@ -195,7 +195,7 @@ QVariant ContractCallDataEncoder::decode(SolidityType const& _type, bytes const&
bytes rawParam(32);
value.populate(&rawParam);
QSolidityType::Type type = _type.type;
if (type == QSolidityType::Type::SignedInteger || type == QSolidityType::Type::UnsignedInteger || type == QSolidityType::Type::Address)
if (type == QSolidityType::Type::SignedInteger || type == QSolidityType::Type::UnsignedInteger)
return QVariant::fromValue(toString(decodeInt(rawParam)));
else if (type == QSolidityType::Type::Bool)
return QVariant::fromValue(toString(decodeBool(rawParam)));
@ -203,6 +203,8 @@ QVariant ContractCallDataEncoder::decode(SolidityType const& _type, bytes const&
return QVariant::fromValue(toString(decodeBytes(rawParam)));
else if (type == QSolidityType::Type::Struct)
return QVariant::fromValue(QString("struct")); //TODO
else if (type == QSolidityType::Type::Address)
return QVariant::fromValue(toString(decodeBytes(unpadLeft(rawParam))));
else
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Parameter declaration not found"));
}

23
mix/qml/QAddressView.qml

@ -5,10 +5,12 @@ import QtQuick.Controls.Styles 1.3
Item
{
property alias value: textinput.text
property alias contractCreationTr: ctrModel
property alias accountRef: ctrModel
property string subType
property bool readOnly
id: editRoot
height: 20
width: 200
width: 320
SourceSansProBold
{
@ -17,19 +19,19 @@ Item
function init()
{
trCombobox.visible = ctrModel.count > 1; //index 0 is a blank value.
if (value.indexOf("<") === 0)
trCombobox.visible = !readOnly
textinput.readOnly = readOnly
if (!readOnly)
{
for (var k = 0; k < ctrModel.count; k++)
{
if ("<" + ctrModel.get(k).functionId + ">" === value)
if (ctrModel.get(k).value === value)
{
trCombobox.currentIndex = k;
return;
}
}
trCombobox.currentIndex = 0;
value = "";
}
}
@ -43,7 +45,7 @@ Item
text: value
width: parent.width
height: parent.width
wrapMode: Text.WrapAnywhere
wrapMode: Text.WordWrap
clip: true
font.family: boldFont.name
MouseArea {
@ -73,7 +75,7 @@ Item
property bool selected: false
id: trCombobox
model: ctrModel
textRole: "functionId"
textRole: "itemid"
height: 20
anchors.verticalCenter: parent.verticalCenter
anchors.left: textinput.parent.right
@ -84,7 +86,10 @@ Item
return;
else if (currentText !== " - ")
{
textinput.text = "<" + currentText + ">";
if (model.get(currentIndex).type === "contract")
textinput.text = "<" + currentText + ">";
else
textinput.text = model.get(currentIndex).value; //address
trCombobox.selected = true;
}
else if (textinput.text.indexOf("<") === 0)

2
mix/qml/StateListModel.qml

@ -183,7 +183,7 @@ Item {
_secret = clientModel.newSecret();
var address = clientModel.address(_secret);
var name = qsTr("Account") + "-" + address.substring(0, 4);
return { name: name, secret: _secret, balance: QEtherHelper.createEther(_balance, _unit) };
return { name: name, secret: _secret, balance: QEtherHelper.createEther(_balance, _unit), address: address };
}
function createDefaultState() {

43
mix/qml/StructView.qml

@ -7,8 +7,10 @@ Column
{
id: root
property alias members: repeater.model //js array
property variant accounts
property var value: ({})
property int transactionIndex
property string context
Layout.fillWidth: true
spacing: 10
Repeater
@ -69,21 +71,40 @@ Column
var vals = value;
if (ptype.category === QSolidityType.Address)
{
item.contractCreationTr.append({"functionId": " - "});
var trCr = -1;
for (var k = 0; k < transactionsModel.count; k++)
item.value = getValue();
item.readOnly = context === "variable";
if (context === "parameter")
{
if (k >= transactionIndex)
break;
var tr = transactionsModel.get(k);
if (tr.functionId === tr.contractId)
var dec = modelData.type.name.split(" ");
item.subType = dec[0];
item.accountRef.append({"itemid": " - "});
if (item.subType === "contract" || item.subType === "address")
{
var trCr = 0;
for (var k = 0; k < transactionsModel.count; k++)
{
if (k >= transactionIndex)
break;
var tr = transactionsModel.get(k);
if (tr.functionId === tr.contractId && (dec[1] === tr.contractId || item.subType === "address"))
{
item.accountRef.append({ "itemid": tr.contractId + " - " + trCr, "value": "<" + tr.contractId + " - " + trCr + ">", "type": "contract" });
trCr++;
}
}
}
if (item.subType === "address")
{
trCr++;
if (modelData.type.name === qsTr("contract") + " " + tr.contractId)
item.contractCreationTr.append({ "functionId": tr.contractId + " - " + trCr });
for (k = 0; k < accounts.length; k++)
{
if (accounts[k].address === undefined)
accounts[k].address = clientModel.address(accounts[k].secret);
item.accountRef.append({ "itemid": accounts[k].name, "value": "0x" + accounts[k].address, "type": "address" });
}
}
}
item.value = getValue();
item.init();
}
else if (ptype.category === QSolidityType.Struct && !item.members)

4
mix/qml/TransactionDialog.qml

@ -11,7 +11,7 @@ import "."
Dialog {
id: modalTransactionDialog
modality: Qt.ApplicationModal
width: 520
width: 570
height: 500
visible: false
title: qsTr("Edit Transaction")
@ -387,6 +387,8 @@ Dialog {
id: typeLoader
Layout.preferredWidth: 150
members: paramsModel;
accounts: senderComboBox.model
context: "parameter"
}
}

2
mix/qml/VariablesView.qml

@ -24,6 +24,8 @@ DebugInfoList
members: []
value: {}
Layout.preferredWidth: parent.width
context: "variable"
width: parent.width
}
}
}

11
solc/CommandLineInterface.cpp

@ -270,7 +270,7 @@ bool CommandLineInterface::parseArguments(int argc, char** argv)
}
catch (po::error const& _exception)
{
cout << _exception.what() << endl;
cerr << _exception.what() << endl;
return false;
}
if (m_args.count("combined-json"))
@ -279,7 +279,7 @@ bool CommandLineInterface::parseArguments(int argc, char** argv)
for (string const& item: boost::split(requests, m_args["combined-json"].as<string>(), boost::is_any_of(",")))
if (!g_combinedJsonArgs.count(item))
{
cout << "Invalid option to --combined-json: " << item << endl;
cerr << "Invalid option to --combined-json: " << item << endl;
return false;
}
}
@ -317,13 +317,13 @@ bool CommandLineInterface::processInput()
auto path = boost::filesystem::path(infile);
if (!boost::filesystem::exists(path))
{
cout << "Skipping non existant input file \"" << infile << "\"" << endl;
cerr << "Skipping non existant input file \"" << infile << "\"" << endl;
continue;
}
if (!boost::filesystem::is_regular_file(path))
{
cout << "\"" << infile << "\" is not a valid file. Skipping" << endl;
cerr << "\"" << infile << "\" is not a valid file. Skipping" << endl;
continue;
}
@ -380,6 +380,9 @@ bool CommandLineInterface::processInput()
void CommandLineInterface::handleCombinedJSON()
{
if (!m_args.count("combined-json"))
return;
Json::Value output(Json::objectValue);
set<string> requests;

6
test/libdevcrypto/trie.cpp

@ -522,17 +522,17 @@ BOOST_AUTO_TEST_CASE(trieStess)
cwarn << "Good:" << d2.root();
// for (auto i: dm2.get())
// cwarn << i.first.abridged() << ": " << RLP(i.second);
// cwarn << i.first << ": " << RLP(i.second);
d2.debugStructure(cerr);
cwarn << "Broken:" << d.root(); // Leaves an extension -> extension (3c1... -> 742...)
// for (auto i: dm.get())
// cwarn << i.first.abridged() << ": " << RLP(i.second);
// cwarn << i.first << ": " << RLP(i.second);
d.debugStructure(cerr);
d2.insert(k, v);
cwarn << "Pres:" << d2.root();
// for (auto i: dm2.get())
// cwarn << i.first.abridged() << ": " << RLP(i.second);
// cwarn << i.first << ": " << RLP(i.second);
d2.debugStructure(cerr);
g_logVerbosity = 99;
d2.remove(k);

12
test/libsolidity/SolidityInterface.cpp

@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(single_function)
"}\n");
BOOST_REQUIRE_EQUAL(1, contract.getDefinedFunctions().size());
BOOST_CHECK_EQUAL(getSourcePart(*contract.getDefinedFunctions().front()),
"function f(uint256 a)returns(uint256 d){}");
"function f(uint256 a)returns(uint256 d);");
}
BOOST_AUTO_TEST_CASE(single_constant_function)
@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(single_constant_function)
"contract test { function f(uint a) constant returns(bytes1 x) { 1==2; } }");
BOOST_REQUIRE_EQUAL(1, contract.getDefinedFunctions().size());
BOOST_CHECK_EQUAL(getSourcePart(*contract.getDefinedFunctions().front()),
"function f(uint256 a)constant returns(bytes1 x){}");
"function f(uint256 a)constant returns(bytes1 x);");
}
BOOST_AUTO_TEST_CASE(multiple_functions)
@ -97,8 +97,8 @@ BOOST_AUTO_TEST_CASE(multiple_functions)
" function g(uint b) returns(uint e) { return b * 8; }\n"
"}\n";
ContractDefinition const& contract = checkInterface(sourceCode);
set<string> expectation({"function f(uint256 a)returns(uint256 d){}",
"function g(uint256 b)returns(uint256 e){}"});
set<string> expectation({"function f(uint256 a)returns(uint256 d);",
"function g(uint256 b)returns(uint256 e);"});
BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size());
BOOST_CHECK(expectation == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)),
getSourcePart(*contract.getDefinedFunctions().at(1))}));
@ -135,8 +135,8 @@ BOOST_AUTO_TEST_CASE(inheritance)
" event derivedEvent(uint indexed evtArgDerived); \n"
" }";
ContractDefinition const& contract = checkInterface(sourceCode);
set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i){}",
"function derivedFunction(bytes32 p)returns(bytes32 i){}"});
set<string> expectedFunctions({"function baseFunction(uint256 p)returns(uint256 i);",
"function derivedFunction(bytes32 p)returns(bytes32 i);"});
BOOST_REQUIRE_EQUAL(2, contract.getDefinedFunctions().size());
BOOST_CHECK(expectedFunctions == set<string>({getSourcePart(*contract.getDefinedFunctions().at(0)),
getSourcePart(*contract.getDefinedFunctions().at(1))}));

10
test/libwhisper/whisperTopic.cpp

@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(topic)
if (received.count(last))
continue;
received.insert(last);
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
cnote << "New message from:" << msg.from() << RLP(msg.payload()).toInt<unsigned>();
result += last;
}
this_thread::sleep_for(chrono::milliseconds(50));
@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE(forwarding)
{
Message msg = whost1->envelope(i).open(whost1->fullTopic(w));
unsigned last = RLP(msg.payload()).toInt<unsigned>();
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
cnote << "New message from:" << msg.from() << RLP(msg.payload()).toInt<unsigned>();
result = last;
}
this_thread::sleep_for(chrono::milliseconds(50));
@ -175,7 +175,7 @@ BOOST_AUTO_TEST_CASE(forwarding)
for (auto i: whost2->checkWatch(w))
{
Message msg = whost2->envelope(i).open(whost2->fullTopic(w));
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
cnote << "New message from:" << msg.from() << RLP(msg.payload()).toInt<unsigned>();
}
this_thread::sleep_for(chrono::milliseconds(50));
}
@ -239,7 +239,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding)
for (auto i: whost1->checkWatch(w))
{
Message msg = whost1->envelope(i).open(whost1->fullTopic(w));
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
cnote << "New message from:" << msg.from() << RLP(msg.payload()).toInt<unsigned>();
}
this_thread::sleep_for(chrono::milliseconds(50));
}
@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(asyncforwarding)
{
Message msg = wh->envelope(i).open(wh->fullTopic(w));
unsigned last = RLP(msg.payload()).toInt<unsigned>();
cnote << "New message from:" << msg.from().abridged() << RLP(msg.payload()).toInt<unsigned>();
cnote << "New message from:" << msg.from() << RLP(msg.payload()).toInt<unsigned>();
result = last;
}
this_thread::sleep_for(chrono::milliseconds(50));

Loading…
Cancel
Save