Browse Source

Merge branch 'develop' into bugfix

cl-refactor
subtly 10 years ago
parent
commit
7bc9c8b0ef
  1. 2
      alethzero/MainWin.h
  2. 31
      docker/Dockerfile
  3. 1
      libdevcrypto/SHA3.cpp
  4. 2
      libdevcrypto/SHA3.h
  5. 2
      libethcore/BlockInfo.cpp
  6. 2
      libethereum/BlockChain.cpp
  7. 40
      libp2p/Host.cpp
  8. 4
      libp2p/Host.h
  9. 2
      libsolidity/Compiler.cpp
  10. 2
      test/solidityCompiler.cpp

2
alethzero/MainWin.h

@ -255,7 +255,7 @@ private:
QString m_logHistory;
bool m_logChanged = true;
std::unique_ptr<WebThreeStubServer> m_server;
QWebThreeConnector m_qwebConnector;
std::unique_ptr<WebThreeStubServer> m_server;
QWebThree* m_qweb = nullptr;
};

31
docker/Dockerfile

@ -4,17 +4,30 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -qy wget
RUN apt-get install -qy build-essential g++-4.8 automake libtool unzip git cmake
RUN apt-get install -qy libncurses5-dev libgmp-dev libgmp3-dev libboost-all-dev libleveldb-dev yasm libminiupnpc-dev
RUN apt-get install -qy qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev
# Ethereum dependencies
RUN apt-get install -qy build-essential g++-4.8 git cmake libboost-all-dev libcurl4-openssl-dev wget
RUN apt-get install -qy automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons
RUN mkdir /cryptopp562
RUN cd /cryptopp562 && wget http://www.cryptopp.com/cryptopp562.zip && unzip cryptopp562.zip
RUN cd /cryptopp562 && make -j $(cat /proc/cpuinfo | grep processor | wc -l) && make install
# NCurses based GUI (not optional though for a succesful compilation, see https://github.com/ethereum/cpp-ethereum/issues/452 )
RUN apt-get install -qy libncurses5-dev
# Qt-based GUI
# RUN apt-get install -qy qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev
# Cryptopp
RUN git clone --depth=1 https://github.com/mmoss/cryptopp.git
RUN cd cryptopp && scons --shared --prefix=/usr
# JSONRPC (version 0.2.1, see https://github.com/ethereum/cpp-ethereum/issues/453 )
RUN apt-get install -qy libjsoncpp-dev libargtable2-dev
RUN git clone --depth=1 --branch=0.2.1 https://github.com/cinemast/libjson-rpc-cpp.git
RUN mkdir -p libjson-rpc-cpp/build
RUN cd libjson-rpc-cpp/build && cmake .. && make && make install
# Build Ethereum (HEADLESS)
RUN git clone --depth=1 https://github.com/ethereum/cpp-ethereum
RUN mkdir cpp-ethereum/build
RUN cd cpp-ethereum/build && cmake .. -DCMAKE_BUILD_TYPE=Release && make -j $(cat /proc/cpuinfo | grep processor | wc -l) && make install
RUN mkdir -p cpp-ethereum/build
RUN cd cpp-ethereum/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DHEADLESS=1 && make -j $(cat /proc/cpuinfo | grep processor | wc -l) && make install
RUN ldconfig
ENTRYPOINT ["/usr/local/bin/eth"]

1
libdevcrypto/SHA3.cpp

@ -30,6 +30,7 @@ namespace dev
{
h256 EmptySHA3 = sha3(bytesConstRef());
h256 EmptyListSHA3 = sha3(RLPEmptyList);
std::string sha3(std::string const& _input, bool _hex)
{

2
libdevcrypto/SHA3.h

@ -58,6 +58,8 @@ inline h256 sha3(std::string const& _input) { return sha3(bytesConstRef(_input))
extern h256 EmptySHA3;
extern h256 EmptyListSHA3;
// Other crypto convenience routines
bytes aesDecrypt(bytesConstRef _cipher, std::string const& _password, unsigned _rounds = 2000, bytesConstRef _salt = bytesConstRef());

2
libethcore/BlockInfo.cpp

@ -56,8 +56,6 @@ h256 BlockInfo::headerHashWithoutNonce() const
return sha3(s.out());
}
auto static const c_sha3EmptyList = sha3(RLPEmptyList);
void BlockInfo::streamRLP(RLPStream& _s, bool _nonce) const
{
_s.appendList(_nonce ? 15 : 14)

2
libethereum/BlockChain.cpp

@ -103,7 +103,7 @@ bytes BlockChain::createGenesisBlock()
block.appendList(15)
// TODO: maybe make logbloom correct?
<< h256() << EmptySHA3 << h160() << stateRoot << EmptyTrie << EmptyTrie << LogBloom() << c_genesisDifficulty << 0 << 0 << 1000000 << 0 << (unsigned)0 << string() << sha3(bytes(1, 42));
<< h256() << EmptyListSHA3 << h160() << stateRoot << EmptyTrie << EmptyTrie << LogBloom() << c_genesisDifficulty << 0 << 0 << 1000000 << 0 << (unsigned)0 << string() << sha3(bytes(1, 42));
block.appendRaw(RLPEmptyList);
block.appendRaw(RLPEmptyList);
return block.out();

40
libp2p/Host.cpp

@ -62,8 +62,8 @@ Host::Host(std::string const& _clientVersion, NetworkPreferences const& _n, bool
m_clientVersion(_clientVersion),
m_netPrefs(_n),
m_ioService(new ba::io_service),
m_acceptor(*m_ioService),
m_socket(*m_ioService),
m_acceptor(new bi::tcp::acceptor(*m_ioService)),
m_socket(new bi::tcp::socket(*m_ioService)),
m_key(KeyPair::create())
{
populateAddresses();
@ -91,11 +91,11 @@ void Host::start()
bi::tcp::endpoint endpoint(bi::tcp::v4(), i ? 0 : m_netPrefs.listenPort);
try
{
m_acceptor.open(endpoint.protocol());
m_acceptor.set_option(ba::socket_base::reuse_address(true));
m_acceptor.bind(endpoint);
m_acceptor.listen();
m_listenPort = i ? m_acceptor.local_endpoint().port() : m_netPrefs.listenPort;
m_acceptor->open(endpoint.protocol());
m_acceptor->set_option(ba::socket_base::reuse_address(true));
m_acceptor->bind(endpoint);
m_acceptor->listen();
m_listenPort = i ? m_acceptor->local_endpoint().port() : m_netPrefs.listenPort;
break;
}
catch (...)
@ -105,7 +105,7 @@ void Host::start()
cwarn << "Couldn't start accepting connections on host. Something very wrong with network?\n" << boost::current_exception_diagnostic_information();
return;
}
m_acceptor.close();
m_acceptor->close();
continue;
}
}
@ -118,20 +118,24 @@ void Host::start()
void Host::stop()
{
// if there's no ioService, it means we've had quit() called - bomb out - we're not allowed in here.
if (!m_ioService)
return;
for (auto const& h: m_capabilities)
h.second->onStopping();
stopWorking();
if (m_acceptor.is_open())
if (m_acceptor->is_open())
{
if (m_accepting)
m_acceptor.cancel();
m_acceptor.close();
m_acceptor->cancel();
m_acceptor->close();
m_accepting = false;
}
if (m_socket.is_open())
m_socket.close();
if (m_socket->is_open())
m_socket->close();
disconnectPeers();
if (!!m_ioService)
@ -147,6 +151,8 @@ void Host::quit()
// such tasks may involve socket reads from Capabilities that maintain references
// to resources we're about to free.
stop();
m_acceptor.reset();
m_socket.reset();
m_ioService.reset();
// m_acceptor & m_socket are DANGEROUS now.
}
@ -463,18 +469,18 @@ void Host::ensureAccepting()
{
clog(NetConnect) << "Listening on local port " << m_listenPort << " (public: " << m_public << ")";
m_accepting = true;
m_acceptor.async_accept(m_socket, [=](boost::system::error_code ec)
m_acceptor->async_accept(*m_socket, [=](boost::system::error_code ec)
{
if (!ec)
{
try
{
try {
clog(NetConnect) << "Accepted connection from " << m_socket.remote_endpoint();
clog(NetConnect) << "Accepted connection from " << m_socket->remote_endpoint();
} catch (...){}
bi::address remoteAddress = m_socket.remote_endpoint().address();
bi::address remoteAddress = m_socket->remote_endpoint().address();
// Port defaults to 0 - we let the hello tell us which port the peer listens to
auto p = std::make_shared<Session>(this, std::move(m_socket), bi::tcp::endpoint(remoteAddress, 0));
auto p = std::make_shared<Session>(this, std::move(*m_socket), bi::tcp::endpoint(remoteAddress, 0));
p->start();
}
catch (Exception const& _e)

4
libp2p/Host.h

@ -214,8 +214,8 @@ private:
int m_listenPort = NetworkStopped; ///< What port are we listening on?
std::unique_ptr<ba::io_service> m_ioService; ///< IOService for network stuff.
bi::tcp::acceptor m_acceptor; ///< Listening acceptor.
bi::tcp::socket m_socket; ///< Listening socket.
std::unique_ptr<bi::tcp::acceptor> m_acceptor; ///< Listening acceptor.
std::unique_ptr<bi::tcp::socket> m_socket; ///< Listening socket.
UPnP* m_upnp = nullptr; ///< UPnP helper.
bi::tcp::endpoint m_public; ///< Our public listening endpoint.

2
libsolidity/Compiler.cpp

@ -336,9 +336,11 @@ void ExpressionCompiler::appendArithmeticOperatorCode(Token::Value _operator, Ty
append(eth::Instruction::MUL);
break;
case Token::DIV:
append(eth::Instruction::SWAP1);
append(isSigned ? eth::Instruction::SDIV : eth::Instruction::DIV);
break;
case Token::MOD:
append(eth::Instruction::SWAP1);
append(isSigned ? eth::Instruction::SMOD : eth::Instruction::MOD);
break;
default:

2
test/solidityCompiler.cpp

@ -193,7 +193,9 @@ BOOST_AUTO_TEST_CASE(arithmetics)
byte(eth::Instruction::SWAP1),
byte(eth::Instruction::SUB),
byte(eth::Instruction::ADD),
byte(eth::Instruction::SWAP1),
byte(eth::Instruction::MOD),
byte(eth::Instruction::SWAP1),
byte(eth::Instruction::DIV),
byte(eth::Instruction::MUL)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());

Loading…
Cancel
Save