Browse Source

Merge remote-tracking branch 'up/develop' into deploydialog

cl-refactor
yann300 10 years ago
parent
commit
2d8d67d8c6
  1. 11
      CMakeLists.txt
  2. 9
      alethzero/Main.ui
  3. 24
      alethzero/MainWin.cpp
  4. 6
      alethzero/Transact.cpp
  5. 21
      eth/main.cpp
  6. 1
      ethconsole/CMakeLists.txt
  7. 26
      ethconsole/main.cpp
  8. 2
      exp/main.cpp
  9. 2
      libdevcore/Exceptions.h
  10. 31
      libdevcrypto/AES.cpp
  11. 60
      libdevcrypto/AES.h
  12. 59
      libdevcrypto/ECDHE.cpp
  13. 35
      libdevcrypto/ECDHE.h
  14. 1
      libethcore/Common.cpp
  15. 2
      libethcore/Ethash.cpp
  16. 1
      libethcore/Params.cpp
  17. 1
      libethcore/Params.h
  18. 4
      libethereum/BlockChain.cpp
  19. 10
      libethereum/BlockChain.h
  20. 4
      libethereum/CachedAddressState.cpp
  21. 2
      libethereum/CachedAddressState.h
  22. 6
      libethereum/Client.cpp
  23. 2
      libethereum/State.cpp
  24. 1
      libethereum/State.h
  25. 2
      libjsconsole/JSConsole.h
  26. 8
      libweb3jsonrpc/WebThreeStubServerBase.cpp
  27. 12
      test/libdevcrypto/AES.cpp

11
CMakeLists.txt

@ -44,6 +44,7 @@ option(NOBOOST "No use of boost macros in test functions" OFF)
option(EVMJIT "Build just-in-time compiler for EVM code (requires LLVM)" OFF)
option(ETHASHCL "Build in support for GPU mining via OpenCL" ON)
option(JSCONSOLE "Build in javascript console" ON)
option(FRONTIER "Build for Frontier network" OFF)
# propagates CMake configuration options to the compiler
function(configureProject)
@ -87,6 +88,10 @@ function(configureProject)
add_definitions(-DNOBOOST)
endif()
if (FRONTIER)
add_definitions(-DETH_FRONTIER)
endif()
add_definitions(-DETH_TRUE)
endfunction()
@ -207,6 +212,7 @@ eth_format_option(TOOLS)
eth_format_option(ETHKEY)
eth_format_option(ETHASHCL)
eth_format_option(JSCONSOLE)
eth_format_option(FRONTIER)
eth_format_option_on_decent_platform(SERPENT)
if (JSCONSOLE)
@ -321,6 +327,7 @@ message("-- FATDB Full database exploring ${FATDB}")
message("-- JSONRPC JSON-RPC support ${JSONRPC}")
message("-- USENPM Javascript source building ${USENPM}")
message("-- ROCKSDB Prefer rocksdb to leveldb ${ROCKSDB}")
message("-- FRONTIER Default to the Frontier network ${FRONTIER}")
message("------------------------------------------------------------- components")
message("-- MINER Build miner ${MINER}")
message("-- ETHKEY Build wallet tools ${ETHKEY}")
@ -329,9 +336,9 @@ message("-- SOLIDITY Build Solidity language components ${SOLIDITY
message("-- SERPENT Build Serpent language components ${SERPENT}")
message("-- GUI Build GUI components ${GUI}")
message("-- TESTS Build tests ${TESTS}")
message("-- ETHASHCL Build OpenCL components (experimental!) ${ETHASHCL}")
message("-- ETHASHCL Build OpenCL components ${ETHASHCL}")
message("-- JSCONSOLE Build with javascript console ${JSCONSOLE}")
message("-- EVMJIT Build LLVM-based JIT EVM (experimental!) ${EVMJIT}")
message("-- EVMJIT Build LLVM-based JIT EVM ${EVMJIT}")
message("------------------------------------------------------------------------")
message("")

9
alethzero/Main.ui

@ -151,6 +151,7 @@
<addaction name="dropPeers"/>
<addaction name="net"/>
<addaction name="connect"/>
<addaction name="hermitMode"/>
</widget>
<widget class="QMenu" name="menu_Tools">
<property name="title">
@ -1810,6 +1811,14 @@ font-size: 14pt</string>
<string>&amp;Rewind Chain...</string>
</property>
</action>
<action name="hermitMode">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Hermit Mode</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

24
alethzero/MainWin.cpp

@ -137,6 +137,17 @@ Main::Main(QWidget *parent) :
setWindowFlags(Qt::Window);
ui->setupUi(this);
for (int i = 1; i < qApp->arguments().size(); ++i)
{
QString arg = qApp->arguments()[i];
if (arg == "--frontier")
resetNetwork(eth::Network::Frontier);
else if (arg == "--olympic")
resetNetwork(eth::Network::Olympic);
else if (arg == "--genesis-json" && i + 1 < qApp->arguments().size())
CanonBlockChain<Ethash>::setGenesis(contentsString(qApp->arguments()[++i].toStdString()));
}
if (c_network == eth::Network::Olympic)
setWindowTitle("AlethZero Olympic");
else if (c_network == eth::Network::Frontier)
@ -385,8 +396,8 @@ NetworkPreferences Main::netPrefs() const
else
ret = NetworkPreferences(listenIP, ui->port->value(), ui->upnp->isChecked());
ret.discovery = m_privateChain.isEmpty();
ret.pin = m_privateChain.isEmpty();
ret.discovery = m_privateChain.isEmpty() && !ui->hermitMode->isChecked();
ret.pin = m_privateChain.isEmpty() || ui->hermitMode->isChecked();
return ret;
}
@ -423,6 +434,7 @@ void Main::installWatches()
{
auto newBlockId = installWatch(ChainChangedFilter, [=](LocalisedLogEntries const&){
onNewBlock();
onNewPending();
});
auto newPendingId = installWatch(PendingChangedFilter, [=](LocalisedLogEntries const&){
onNewPending();
@ -756,6 +768,7 @@ void Main::writeSettings()
s.setValue("askPrice", QString::fromStdString(toString(static_cast<TrivialGasPricer*>(ethereum()->gasPricer().get())->ask())));
s.setValue("bidPrice", QString::fromStdString(toString(static_cast<TrivialGasPricer*>(ethereum()->gasPricer().get())->bid())));
s.setValue("upnp", ui->upnp->isChecked());
s.setValue("hermitMode", ui->hermitMode->isChecked());
s.setValue("forceAddress", ui->forcePublicIP->text());
s.setValue("forceMining", ui->forceMining->isChecked());
s.setValue("turboMining", ui->turboMining->isChecked());
@ -868,6 +881,7 @@ void Main::readSettings(bool _skipGeometry)
ui->upnp->setChecked(s.value("upnp", true).toBool());
ui->forcePublicIP->setText(s.value("forceAddress", "").toString());
ui->dropPeers->setChecked(false);
ui->hermitMode->setChecked(s.value("hermitMode", true).toBool());
ui->forceMining->setChecked(s.value("forceMining", false).toBool());
on_forceMining_triggered();
ui->turboMining->setChecked(s.value("turboMining", false).toBool());
@ -1326,7 +1340,9 @@ void Main::refreshAccounts()
bool showContract = ui->showContracts->isChecked();
bool showBasic = ui->showBasic->isChecked();
bool onlyNamed = ui->onlyNamed->isChecked();
for (auto const& i: ethereum()->addresses())
auto as = ethereum()->addresses();
sort(as.begin(), as.end());
for (auto const& i: as)
{
bool isContract = (ethereum()->codeHashAt(i) != EmptySHA3);
if (!((showContract && isContract) || (showBasic && !isContract)))
@ -1353,7 +1369,7 @@ void Main::refreshBlockCount()
syncStatus += QString(": %1/%2").arg(sync.blocksReceived).arg(sync.blocksTotal);
ui->syncStatus->setText(syncStatus);
ui->chainStatus->setText(QString("%3 importing %4 ready %5 verifying %6 unverified %7 future %8 unknown %9 bad %1 #%2")
.arg(m_privateChain.size() ? "[" + m_privateChain + "] " : "testnet").arg(d.number).arg(b.importing).arg(b.verified).arg(b.verifying).arg(b.unverified).arg(b.future).arg(b.unknown).arg(b.bad));
.arg(m_privateChain.size() ? "[" + m_privateChain + "] " : c_network == eth::Network::Olympic ? "Olympic" : "Frontier").arg(d.number).arg(b.importing).arg(b.verified).arg(b.verifying).arg(b.unverified).arg(b.future).arg(b.unknown).arg(b.bad));
}
void Main::on_turboMining_triggered()

6
alethzero/Transact.cpp

@ -150,7 +150,7 @@ void Transact::updateFee()
ok = true;
break;
}
ui->send->setEnabled(ok);
// ui->send->setEnabled(ok);
QPalette p = ui->total->palette();
p.setColor(QPalette::WindowText, QColor(ok ? 0x00 : 0x80, 0x00, 0x00));
ui->total->setPalette(p);
@ -319,7 +319,7 @@ void Transact::rejigData()
auto bail = [&](QString he) {
m_allGood = false;
ui->send->setEnabled(false);
// ui->send->setEnabled(false);
ui->code->setHtml(he + htmlInfo);
};
@ -402,7 +402,7 @@ void Transact::rejigData()
updateFee();
ui->code->setHtml(htmlInfo);
ui->send->setEnabled(m_allGood);
// ui->send->setEnabled(m_allGood);
}
Secret Transact::findSecret(u256 _totalReq) const

21
eth/main.cpp

@ -124,10 +124,13 @@ void help()
<< " --olympic Use the Olympic (0.9) protocol." << endl
<< " --frontier Use the Frontier (1.0) protocol." << endl
<< " --private <name> Use a private chain." << endl
<< " --genesis-json <file> Import the genesis block information from the given json file." << endl
<< endl
<< " -o,--mode <full/peer> Start a full node or a peer node (default: full)." << endl
#if ETH_JSCONSOLE || !ETH_TRUE
<< " -i,--interactive Enter interactive mode (default: non-interactive)." << endl
#endif
<< endl
#if ETH_JSONRPC || !ETH_TRUE
<< " -j,--json-rpc Enable JSON-RPC server (default: off)." << endl
<< " --json-rpc-port <n> Specify JSON-RPC server port (implies '-j', default: " << SensibleHttpPort << ")." << endl
@ -136,7 +139,7 @@ void help()
<< " -K,--kill First kill the blockchain." << endl
<< " -R,--rebuild Rebuild the blockchain from the existing database." << endl
<< " --rescue Attempt to rescue a corrupt database." << endl
<< " --genesis-json <file> Import the genesis block information from the given json file." << endl
<< endl
<< " -s,--import-secret <secret> Import a secret key into the key store and use as the default." << endl
<< " -S,--import-session-secret <secret> Import a secret key into the key store and use as the default for this session only." << endl
<< " --sign-key <address> Sign all transactions with the key of the given address." << endl
@ -1085,7 +1088,7 @@ int main(int argc, char** argv)
NodeMode nodeMode = NodeMode::Full;
bool interactive = false;
#if ETH_JSONRPC || !ETH_TRUE
int jsonrpc = -1;
int jsonRPCURL = -1;
#endif
string jsonAdmin;
string genesisJSON;
@ -1434,9 +1437,9 @@ int main(int argc, char** argv)
interactive = true;
#if ETH_JSONRPC || !ETH_TRUE
else if ((arg == "-j" || arg == "--json-rpc"))
jsonrpc = jsonrpc == -1 ? SensibleHttpPort : jsonrpc;
jsonRPCURL = jsonRPCURL == -1 ? SensibleHttpPort : jsonRPCURL;
else if (arg == "--json-rpc-port" && i + 1 < argc)
jsonrpc = atoi(argv[++i]);
jsonRPCURL = atoi(argv[++i]);
else if (arg == "--json-admin" && i + 1 < argc)
jsonAdmin = argv[++i];
#endif
@ -1743,15 +1746,15 @@ int main(int argc, char** argv)
else
cout << "Networking disabled. To start, use netstart or pass -b or a remote host." << endl;
if (useConsole && jsonrpc == -1)
jsonrpc = SensibleHttpPort;
if (useConsole && jsonRPCURL == -1)
jsonRPCURL = SensibleHttpPort;
#if ETH_JSONRPC || !ETH_TRUE
shared_ptr<dev::WebThreeStubServer> jsonrpcServer;
unique_ptr<jsonrpc::AbstractServerConnector> jsonrpcConnector;
if (jsonrpc > -1)
if (jsonRPCURL > -1)
{
jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads));
jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::HttpServer(jsonRPCURL, "", "", SensibleHttpThreads));
jsonrpcServer = make_shared<dev::WebThreeStubServer>(*jsonrpcConnector.get(), web3, make_shared<SimpleAccountHolder>([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector<KeyPair>(), keyManager, *gasPricer);
jsonrpcServer->setMiningBenefactorChanger([&](Address const& a) { beneficiary = a; });
jsonrpcServer->StartListening();
@ -1760,6 +1763,8 @@ int main(int argc, char** argv)
else
jsonrpcServer->addSession(jsonAdmin, SessionPermissions{{Priviledge::Admin}});
cout << "JSONRPC Admin Session Key: " << jsonAdmin << endl;
writeFile(getDataDir("web3") + "/session.key", jsonAdmin);
writeFile(getDataDir("web3") + "/session.url", "http://localhost:" + toString(jsonRPCURL));
}
#endif

1
ethconsole/CMakeLists.txt

@ -20,6 +20,7 @@ if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW)
eth_copy_dlls(${EXECUTABLE} CURL_DLLS)
endif()
target_link_libraries(${EXECUTABLE} jsconsole)
target_link_libraries(${EXECUTABLE} devcore)
if (APPLE)
install(TARGETS ${EXECUTABLE} DESTINATION bin)

26
ethconsole/main.cpp

@ -20,6 +20,7 @@
*/
#include <string>
#include <libdevcore/FileSystem.h>
#include <libjsconsole/JSRemoteConsole.h>
using namespace std;
using namespace dev;
@ -27,13 +28,30 @@ using namespace dev::eth;
int main(int argc, char** argv)
{
string remote;
if (argc == 1)
string remote = contentsString(getDataDir("web3") + "/session.url");
if (remote.empty())
remote = "http://localhost:8545";
else if (argc == 2)
remote = argv[1];
string sessionKey = contentsString(getDataDir("web3") + "/session.key");
for (int i = 1; i < argc; ++i)
{
string arg = argv[i];
if (arg == "--url" && i + 1 < argc)
remote = argv[++i];
else if (arg == "--session-key" && i + 1 < argc)
sessionKey = argv[++i];
else
{
cerr << "Invalid argument: " << arg << endl;
exit(-1);
}
}
JSRemoteConsole console(remote);
if (!sessionKey.empty())
console.eval("web3.admin.setSessionKey('" + sessionKey + "')");
while (true)
console.readExpression();

2
exp/main.cpp

@ -284,7 +284,6 @@ int main()
return 0;
}
#elif 1
int main()
{
bytes tx = fromHex("f84c01028332dcd58004801ba024843272ee176277535489859cbd275686023fe64aabd158b6fcdf2ae6a1ab6ba02f252a5016a48e5ec8d17aefaf4324d29b9e123fa623dc5a60539b3ad3610c95");
@ -297,7 +296,6 @@ int main()
cnote << toAddress(p);
cnote << t.sender();
}
#elif 0
void mine(State& s, BlockChain const& _bc, SealEngineFace* _se)
{

2
libdevcore/Exceptions.h

@ -76,4 +76,6 @@ using errinfo_hash256 = boost::error_info<struct tag_hash, h256>;
using errinfo_required_h256 = boost::error_info<struct tag_required_h256, h256>;
using errinfo_got_h256 = boost::error_info<struct tag_get_h256, h256>;
using Hash256RequirementError = boost::tuple<errinfo_required_h256, errinfo_got_h256>;
using errinfo_extraData = boost::error_info<struct tag_extraData, bytes>;
}

31
libdevcrypto/AES.cpp

@ -25,39 +25,8 @@
using namespace std;
using namespace dev;
using namespace dev::crypto;
using namespace dev::crypto::aes;
using namespace CryptoPP;
struct aes::Aes128Ctr
{
Aes128Ctr(h128 _k)
{
mode.SetKeyWithIV(_k.data(), sizeof(h128), Nonce::get().data());
}
CTR_Mode<AES>::Encryption mode;
};
Stream::Stream(StreamType, h128 _ckey):
m_cSecret(_ckey)
{
cryptor = new Aes128Ctr(_ckey);
}
Stream::~Stream()
{
delete cryptor;
}
void Stream::update(bytesRef)
{
}
size_t Stream::streamOut(bytes&)
{
return 0;
}
bytes dev::aesDecrypt(bytesConstRef _ivCipher, std::string const& _password, unsigned _rounds, bytesConstRef _salt)
{
bytes pw = asBytes(_password);

60
libdevcrypto/AES.h

@ -24,70 +24,10 @@
#pragma once
#include <atomic>
#include "Common.h"
namespace dev
{
namespace crypto
{
namespace aes
{
struct Aes128Ctr;
enum StreamType { Encrypt, Decrypt };
/**
* @brief Encrypted stream
*/
class Stream
{
public:
// streamtype maybe irrelevant w/ctr
Stream(StreamType _t, h128 _ckey);
~Stream();
virtual void update(bytesRef io_bytes);
/// Move ciphertext to _bytes.
virtual size_t streamOut(bytes& o_bytes);
private:
Stream(Stream const&) = delete;
Stream& operator=(Stream const&) = delete;
h128 m_cSecret;
bytes m_text;
Aes128Ctr* cryptor;
};
/**
* @brief Encrypted stream with inband SHA3 mac at specific interval.
*/
class AuthenticatedStream: public Stream
{
public:
AuthenticatedStream(StreamType _t, h128 _ckey, h128 _mackey, unsigned _interval): Stream(_t, _ckey), m_macSecret(_mackey) { m_macInterval = _interval; }
AuthenticatedStream(StreamType _t, Secret const& _s, unsigned _interval): Stream(_t, h128(_s)), m_macSecret(FixedHash<16>((byte const*)_s.data()+16,h128::ConstructFromPointer)) { m_macInterval = _interval; }
/// Adjust mac interval. Next mac will be xored with value.
void adjustInterval(unsigned _interval) { m_macInterval = _interval; }
unsigned getMacInterval() { return m_macInterval;}
private:
AuthenticatedStream(AuthenticatedStream const&) = delete;
AuthenticatedStream& operator=(AuthenticatedStream const&) = delete;
std::atomic<unsigned> m_macInterval;
h128 m_macSecret;
};
}
}
bytes aesDecrypt(bytesConstRef _cipher, std::string const& _password, unsigned _rounds = 2000, bytesConstRef _salt = bytesConstRef());

59
libdevcrypto/ECDHE.cpp

@ -44,62 +44,3 @@ void ECDHE::agree(Public const& _remote, Secret& o_sharedSecret) const
s_secp256k1.agree(m_ephemeral.sec(), m_remoteEphemeral, o_sharedSecret);
}
void ECDHEKeyExchange::agree(Public const& _remoteEphemeral)
{
s_secp256k1.agree(m_ephemeral.sec(), _remoteEphemeral, m_ephemeralSecret);
}
void ECDHEKeyExchange::exchange(bytes& o_exchange)
{
if (!m_ephemeralSecret)
// didn't agree on public remote
BOOST_THROW_EXCEPTION(InvalidState());
// The key exchange payload is in two parts and is encrypted
// using ephemeral keypair.
//
// The first part is the 'prefix' which is a zero-knowledge proof
// allowing the remote to resume or emplace a previous session.
// If a session previously exists:
// prefix is sha3(token) // todo: ephemeral entropy from both sides
// If a session doesn't exist:
// prefix is sha3(m_ephemeralSecret)
//
// The second part is encrypted using the public key which relates to the prefix.
Public encpk = m_known.first ? m_known.first : m_remoteEphemeral;
bytes exchange(encpk.asBytes());
// This is the public key which we would like the remote to use,
// which maybe different than the previously-known public key.
//
// Here we should pick an appropriate alias or generate a new one,
// but for now, we use static alias passed to constructor.
//
Public p = toPublic(m_alias.m_secret);
exchange.resize(exchange.size() + sizeof(p));
memcpy(&exchange[exchange.size() - sizeof(p)], p.data(), sizeof(p));
// protocol parameters; should be fixed size
bytes v(1, 0x80);
exchange.resize(exchange.size() + v.size());
memcpy(&exchange[exchange.size() - v.size()], v.data(), v.size());
h256 auth;
sha3mac(m_alias.m_secret.ref(), m_ephemeralSecret.ref(), auth.ref());
Signature sig = s_secp256k1.sign(m_alias.m_secret, auth);
exchange.resize(exchange.size() + sizeof(sig));
memcpy(&exchange[exchange.size() - sizeof(sig)], sig.data(), sizeof(sig));
aes::AuthenticatedStream aes(aes::Encrypt, m_ephemeralSecret, 0);
h256 prefix(sha3(m_known.second ? m_known.second : (h256)m_remoteEphemeral));
aes.update(prefix.ref());
s_secp256k1.encrypt(encpk, exchange);
aes.update(&exchange);
aes.streamOut(o_exchange);
}

35
libdevcrypto/ECDHE.h

@ -38,7 +38,6 @@ using AliasSession = std::pair<Public,h256>;
*/
class Alias
{
friend class ECDHEKeyExchange; // todo: remove
public:
Alias(Secret _s): m_secret(_s) {};
@ -77,40 +76,6 @@ protected:
mutable Public m_remoteEphemeral; ///< Public key of remote; parameter. Set once when agree is called, otherwise immutable.
};
/**
* @brief Secure exchange of static keys.
* Key exchange is encrypted with public key of remote and then encrypted by block cipher. For a blind remote the ecdhe public key is used to encrypt exchange, and for a known remote the known public key is used. The block cipher key is derived from ecdhe shared secret.
*
* Usage: Agree -> Exchange -> Authenticate
*/
class ECDHEKeyExchange: private ECDHE
{
public:
/// Exchange with unknown remote (pass public key for ingress exchange)
ECDHEKeyExchange(Alias& _k): m_alias(_k) {}
/// Exchange with known remote
ECDHEKeyExchange(Alias& _k, AliasSession _known): m_alias(_k), m_known(_known) {}
/// Provide public key for dh agreement to generate shared secret.
void agree(Public const& _remoteEphemeral);
/// @returns encrypted payload of key exchange
void exchange(bytes& o_exchange);
/// Decrypt payload, check mac, check trust, decrypt exchange, authenticate exchange, verify version, verify signature, and if no failure occurs, update or creats trust and derive session-shared-secret.
bool authenticate(bytes _exchangeIn);
private:
Secret m_ephemeralSecret;
Alias m_alias;
AliasSession m_known;
Secret m_sharedAliasSecret;
FixedHash<16> m_sharedC;
FixedHash<16> m_sharedM;
};
}
}

1
libethcore/Common.cpp

@ -66,6 +66,7 @@ Network resetNetwork(Network _n)
c_minimumDifficulty = 131072;
c_difficultyBoundDivisor = 2048;
c_durationLimit = c_network == Network::Turbo ? 2 : c_network == Network::Olympic ? 8 : 12;
c_blockReward = c_network == Network::Olympic ? (1500 * finney) : (5 * ether);
return _n;
}

2
libethcore/Ethash.cpp

@ -98,7 +98,7 @@ void Ethash::BlockHeaderRaw::populateFromHeader(RLP const& _header, Strictness _
BOOST_THROW_EXCEPTION(InvalidGasLimit() << RequirementError(bigint(c_minGasLimit), bigint(m_gasLimit)) );
if (m_number && m_extraData.size() > c_maximumExtraDataSize)
BOOST_THROW_EXCEPTION(ExtraDataTooBig() << RequirementError(bigint(c_maximumExtraDataSize), bigint(m_extraData.size())));
BOOST_THROW_EXCEPTION(ExtraDataTooBig() << RequirementError(bigint(c_maximumExtraDataSize), bigint(m_extraData.size())) << errinfo_extraData(m_extraData));
}
}

1
libethcore/Params.cpp

@ -35,6 +35,7 @@ u256 c_gasLimitBoundDivisor;
u256 c_minimumDifficulty;
u256 c_difficultyBoundDivisor;
u256 c_durationLimit;
u256 c_blockReward;
//--- END: AUTOGENERATED FROM /feeStructure.json
}

1
libethcore/Params.h

@ -35,6 +35,7 @@ extern u256 c_minimumDifficulty;
extern u256 c_difficultyBoundDivisor;
extern u256 c_durationLimit;
extern u256 c_maximumExtraDataSize;
extern u256 c_blockReward;
//--- END: AUTOGENERATED FROM /feeStructure.json
}

4
libethereum/BlockChain.cpp

@ -620,6 +620,10 @@ ImportRoute BlockChain::import(VerifiedBlockRef const& _block, OverlayDB const&
{
ex << errinfo_now(time(0));
ex << errinfo_block(_block.block.toBytes());
// only populate extraData if we actually managed to extract it. otherwise,
// we might be clobbering the existing one.
if (!_block.info.extraData().empty())
ex << errinfo_extraData(_block.info.extraData());
throw;
}
#endif

10
libethereum/BlockChain.h

@ -419,6 +419,9 @@ public:
ex << errinfo_phase(1);
ex << errinfo_now(time(0));
ex << errinfo_block(_block.toBytes());
// only populate extraData if we actually managed to extract it. otherwise,
// we might be clobbering the existing one.
if (!h.extraData().empty())
ex << errinfo_extraData(h.extraData());
if (_onBad)
_onBad(ex);
@ -441,6 +444,9 @@ public:
ex << errinfo_uncleIndex(i);
ex << errinfo_now(time(0));
ex << errinfo_block(_block.toBytes());
// only populate extraData if we actually managed to extract it. otherwise,
// we might be clobbering the existing one.
if (!h.extraData().empty())
ex << errinfo_extraData(h.extraData());
if (_onBad)
_onBad(ex);
@ -463,6 +469,10 @@ public:
ex << errinfo_transactionIndex(i);
ex << errinfo_transaction(d.toBytes());
ex << errinfo_block(_block.toBytes());
// only populate extraData if we actually managed to extract it. otherwise,
// we might be clobbering the existing one.
if (!h.extraData().empty())
ex << errinfo_extraData(h.extraData());
if (_onBad)
_onBad(ex);
throw;

4
libethereum/CachedAddressState.cpp

@ -52,9 +52,9 @@ bytes CachedAddressState::code() const
return h == EmptySHA3 ? bytes() : asBytes(m_o->lookup(h));
}
std::unordered_map<u256, u256> CachedAddressState::storage() const
std::map<u256, u256> CachedAddressState::storage() const
{
std::unordered_map<u256, u256> ret;
std::map<u256, u256> ret;
if (m_r)
{
SecureTrieDB<h256, OverlayDB> memdb(const_cast<OverlayDB*>(m_o), m_r[2].toHash<h256>()); // promise we won't alter the overlay! :)

2
libethereum/CachedAddressState.h

@ -47,7 +47,7 @@ public:
bytes code() const;
// TODO: DEPRECATE.
std::unordered_map<u256, u256> storage() const;
std::map<u256, u256> storage() const;
AccountDiff diff(CachedAddressState const& _c);

6
libethereum/Client.cpp

@ -219,10 +219,10 @@ void Client::onBadBlock(Exception& _ex) const
}
if (bytes const* ed = boost::get_error_info<errinfo_extraData>(_ex))
{
RLP r(*ed);
report["hints"]["extraData"] = toHex(*ed);
try
{
RLP r(*ed);
if (r[0].toInt<int>() == 0)
report["hints"]["minerVersion"] = r[1].toString();
}
@ -464,7 +464,9 @@ void Client::setShouldPrecomputeDAG(bool _precompute)
void Client::setTurboMining(bool _enable)
{
m_turboMining = _enable;
sealEngine()->setSealer("opencl");
#if ETH_ETHASHCL || !ETH_TRUE
sealEngine()->setSealer(_enable ? "opencl" : "cpu");
#endif
if (isMining())
startMining();
}

2
libethereum/State.cpp

@ -31,6 +31,7 @@
#include <libdevcore/TrieHash.h>
#include <libevmcore/Instruction.h>
#include <libethcore/Exceptions.h>
#include <libethcore/Params.h>
#include <libevm/VMFactory.h>
#include "BlockChain.h"
#include "Defaults.h"
@ -47,7 +48,6 @@ namespace fs = boost::filesystem;
#define ctrace clog(StateTrace)
#define ETH_TIMED_ENACTMENTS 0
static const u256 c_blockReward = c_network == Network::Olympic ? (1500 * finney) : (5 * ether);
static const unsigned c_maxSyncTransactions = 256;
const char* StateSafeExceptions::name() { return EthViolet "" EthBlue ""; }

1
libethereum/State.h

@ -52,7 +52,6 @@ using errinfo_uncleNumber = boost::error_info<struct tag_uncleNumber, u256>;
using errinfo_unclesExcluded = boost::error_info<struct tag_unclesExcluded, h256Hash>;
using errinfo_block = boost::error_info<struct tag_block, bytes>;
using errinfo_now = boost::error_info<struct tag_now, unsigned>;
using errinfo_extraData = boost::error_info<struct tag_extraData, bytes>;
using errinfo_transactionIndex = boost::error_info<struct tag_transactionIndex, unsigned>;

2
libjsconsole/JSConsole.h

@ -92,6 +92,8 @@ public:
}
}
void eval(std::string const& _expression) { m_engine.eval(_expression.c_str()); }
protected:
Engine m_engine;
Printer m_printer;

8
libweb3jsonrpc/WebThreeStubServerBase.cpp

@ -671,8 +671,8 @@ Json::Value WebThreeStubServerBase::eth_getFilterChanges(string const& _filterId
{
int id = jsToInt(_filterId);
auto entries = client()->checkWatch(id);
if (entries.size())
cnote << "FIRING WATCH" << id << entries.size();
// if (entries.size())
// cnote << "FIRING WATCH" << id << entries.size();
return toJson(entries);
}
catch (...)
@ -687,8 +687,8 @@ Json::Value WebThreeStubServerBase::eth_getFilterChangesEx(string const& _filter
{
int id = jsToInt(_filterId);
auto entries = client()->checkWatch(id);
if (entries.size())
cnote << "FIRING WATCH" << id << entries.size();
// if (entries.size())
// cnote << "FIRING WATCH" << id << entries.size();
return toJsonByBlock(entries);
}
catch (...)

12
test/libdevcrypto/AES.cpp

@ -75,18 +75,6 @@ BOOST_AUTO_TEST_CASE(AesDecryptFailInvalidSeed2)
bytes seed = fromHex("000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f");
BOOST_CHECK(bytes() == aesDecrypt(&seed, "test"));
}
BOOST_AUTO_TEST_CASE(AuthenticatedStreamConstructor)
{
cout << "AuthenticatedStreamConstructor" << endl;
Secret const sec(dev::sha3("test"));
crypto::aes::AuthenticatedStream as(crypto::aes::Encrypt, sec, 0);
BOOST_CHECK(as.getMacInterval() == 0);
as.adjustInterval(1);
BOOST_CHECK(as.getMacInterval() == 1);
crypto::aes::AuthenticatedStream as_mac(crypto::aes::Encrypt, h128(), h128(), 42);
BOOST_CHECK(as_mac.getMacInterval() == 42);
}
BOOST_AUTO_TEST_SUITE_END()

Loading…
Cancel
Save