Browse Source

AlephZero renamed AlethZero and moved to cmake project.

Other minor changes.
cl-refactor
Gav Wood 11 years ago
parent
commit
2a53d5f751
  1. 3
      CMakeLists.txt
  2. 16
      alethzero/CMakeLists.txt
  3. 4
      alethzero/Main.ui
  4. 53
      alethzero/MainWin.cpp
  5. 0
      alethzero/MainWin.h
  6. 0
      alethzero/alephzero.pro
  7. 0
      alethzero/main.cpp
  8. 2
      eth/main.cpp
  9. 2
      libethereum/AddressState.cpp
  10. 2
      libethereum/AddressState.h
  11. 4
      libethereum/BlockChain.cpp
  12. 2
      libethereum/BlockChain.h
  13. 2
      libethereum/BlockInfo.h
  14. 2
      libethereum/Client.cpp
  15. 2
      libethereum/Client.h
  16. 42
      libethereum/Common.cpp
  17. 4
      libethereum/Common.h
  18. 2
      libethereum/MemTrie.cpp
  19. 2
      libethereum/MemTrie.h
  20. 2
      libethereum/PeerNetwork.cpp
  21. 2
      libethereum/PeerNetwork.h
  22. 2
      libethereum/RLP.cpp
  23. 2
      libethereum/RLP.h
  24. 2
      libethereum/State.cpp
  25. 2
      libethereum/State.h
  26. 2
      libethereum/Transaction.cpp
  27. 2
      libethereum/Transaction.h
  28. 2
      libethereum/TransactionQueue.cpp
  29. 2
      libethereum/TransactionQueue.h
  30. 2
      libethereum/TrieCommon.cpp
  31. 2
      libethereum/TrieCommon.h
  32. 2
      libethereum/TrieDB.cpp
  33. 2
      libethereum/TrieDB.h
  34. 2
      libethereum/TrieHash.cpp
  35. 2
      libethereum/TrieHash.h
  36. 2
      test/crypto.cpp
  37. 2
      test/dagger.cpp
  38. 2
      test/hexPrefix.cpp
  39. 2
      test/main.cpp
  40. 2
      test/peer.cpp
  41. 2
      test/rlp.cpp
  42. 2
      test/state.cpp
  43. 2
      test/trie.cpp

3
CMakeLists.txt

@ -1,6 +1,8 @@
project(ethereum)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_AUTOMOC ON)
cmake_policy(SET CMP0015 NEW)
# Initialize CXXFLAGS.
@ -74,3 +76,4 @@ add_subdirectory(secp256k1)
add_subdirectory(libethereum)
add_subdirectory(test)
add_subdirectory(eth)
add_subdirectory(alethzero)

16
alethzero/CMakeLists.txt

@ -0,0 +1,16 @@
cmake_policy(SET CMP0015 NEW)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
aux_source_directory(. SRC_LIST)
include_directories(..)
link_directories(../libethereum)
find_package(Qt5Widgets REQUIRED)
add_executable(alethzero Main.ui ${SRC_LIST})
qt5_wrap_ui(ui_Main.h Main.ui)
qt5_use_modules(alethzero Widgets Network )
target_link_libraries(alethzero ethereum)

4
alephzero/Main.ui → alethzero/Main.ui

@ -6,12 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>978</width>
<width>991</width>
<height>556</height>
</rect>
</property>
<property name="windowTitle">
<string>AlephZero Ethereum Client</string>
<string>AlethZero Ethereum Client</string>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>

53
alephzero/MainWin.cpp → alethzero/MainWin.cpp

@ -10,7 +10,7 @@ using namespace eth;
Main::Main(QWidget *parent) :
QDialog(parent),
ui(new Ui::Main),
m_client("AlephZero/v0.1")
m_client("AlethZero/v0.1")
{
setWindowFlags(Qt::Window);
ui->setupUi(this);
@ -44,16 +44,22 @@ Main::~Main()
void Main::writeSettings()
{
QSettings s("ethereum", "alephzero");
QSettings s("ethereum", "alethzero");
QByteArray b;
b.resize(32);
memcpy(b.data(), &m_myKey, 32);
s.setValue("address", b);
// TODO: save peers - implement it in PeerNetwork though returning RLP bytes
/*for (uint i = 0; !s.value(QString("peer%1").arg(i)).isNull(); ++i)
{
s.value(QString("peer%1").arg(i)).toString();
}*/
}
void Main::readSettings()
{
QSettings s("ethereum", "alephzero");
QSettings s("ethereum", "alethzero");
QByteArray b = s.value("address").toByteArray();
if (b.isEmpty())
m_myKey = KeyPair::create();
@ -67,52 +73,13 @@ void Main::readSettings()
writeSettings();
// TODO: restore peers - implement it in PeerNetwork though giving RLP bytes
/*for (uint i = 0; !s.value(QString("peer%1").arg(i)).isNull(); ++i)
{
s.value(QString("peer%1").arg(i)).toString();
}*/
}
std::string formatBalance(u256 _b)
{
static const vector<pair<u256, string>> c_units =
{
{((((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000, "Uether"},
{((((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000, "Vether"},
{((((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000, "Dether"},
{(((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000, "Nether"},
{(((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000, "Yether"},
{(((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000, "Zether"},
{((u256(1000000000) * 1000000000) * 1000000000) * 1000000000, "Eether"},
{((u256(1000000000) * 1000000000) * 1000000000) * 1000000, "Pether"},
{((u256(1000000000) * 1000000000) * 1000000000) * 1000, "Tether"},
{(u256(1000000000) * 1000000000) * 1000000000, "Gether"},
{(u256(1000000000) * 1000000000) * 1000000, "Mether"},
{(u256(1000000000) * 1000000000) * 1000, "Kether"},
{u256(1000000000) * 1000000000, "ether"},
{u256(1000000000) * 1000000, "finney"},
{u256(1000000000) * 1000, "szabo"},
{u256(1000000000), "Gwei"},
{u256(1000000), "Mwei"},
{u256(1000), "Kwei"}
};
ostringstream ret;
if (_b > c_units[0].first * 10000)
{
ret << (_b / c_units[0].first) << " " << c_units[0].second;
return ret.str();
}
ret << setprecision(5);
for (auto const& i: c_units)
if (_b >= i.first * 100)
{
ret << (double(_b / (i.first / 1000)) / 1000.0) << " " << i.second;
return ret.str();
}
ret << _b << " wei";
return ret.str();
}
void Main::refresh()
{
m_client.lock();

0
alephzero/MainWin.h → alethzero/MainWin.h

0
alephzero/alephzero.pro → alethzero/alephzero.pro

0
alephzero/main.cpp → alethzero/main.cpp

2
eth/main.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/AddressState.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/AddressState.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

4
libethereum/BlockChain.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,
@ -76,7 +76,9 @@ BlockChain::BlockChain(std::string _path, bool _killExisting)
ldb::Options o;
o.create_if_missing = true;
auto s = ldb::DB::Open(o, _path + "/blocks", &m_db);
assert(m_db);
s = ldb::DB::Open(o, _path + "/details", &m_detailsDB);
assert(m_detailsDB);
// Initialise with the genesis as the last block on the longest chain.
m_genesisHash = BlockInfo::genesis().hash;

2
libethereum/BlockChain.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/BlockInfo.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/Client.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/Client.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

42
libethereum/Common.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,
@ -201,3 +201,43 @@ KeyPair KeyPair::create()
ret.m_address = toAddress(ret.m_secret);
return ret;
}
std::string eth::formatBalance(u256 _b)
{
static const vector<pair<u256, string>> c_units =
{
{((((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000, "Uether"},
{((((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000, "Vether"},
{((((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000, "Dether"},
{(((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000000, "Nether"},
{(((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000000, "Yether"},
{(((u256(1000000000) * 1000000000) * 1000000000) * 1000000000) * 1000, "Zether"},
{((u256(1000000000) * 1000000000) * 1000000000) * 1000000000, "Eether"},
{((u256(1000000000) * 1000000000) * 1000000000) * 1000000, "Pether"},
{((u256(1000000000) * 1000000000) * 1000000000) * 1000, "Tether"},
{(u256(1000000000) * 1000000000) * 1000000000, "Gether"},
{(u256(1000000000) * 1000000000) * 1000000, "Mether"},
{(u256(1000000000) * 1000000000) * 1000, "Kether"},
{u256(1000000000) * 1000000000, "ether"},
{u256(1000000000) * 1000000, "finney"},
{u256(1000000000) * 1000, "szabo"},
{u256(1000000000), "Gwei"},
{u256(1000000), "Mwei"},
{u256(1000), "Kwei"}
};
ostringstream ret;
if (_b > c_units[0].first * 10000)
{
ret << (_b / c_units[0].first) << " " << c_units[0].second;
return ret.str();
}
ret << setprecision(5);
for (auto const& i: c_units)
if (_b >= i.first * 100)
{
ret << (double(_b / (i.first / 1000)) / 1000.0) << " " << i.second;
return ret.str();
}
ret << _b << " wei";
return ret.str();
}

4
libethereum/Common.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,
@ -217,6 +217,8 @@ public:
/// User-friendly string representation of the amount _b in wei.
std::string formatBalance(u256 _b);
/// Converts arbitrary value to string representation using std::stringstream.
template <class _T>

2
libethereum/MemTrie.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/MemTrie.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/PeerNetwork.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/PeerNetwork.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/RLP.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/RLP.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/State.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/State.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/Transaction.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/Transaction.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/TransactionQueue.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/TransactionQueue.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/TrieCommon.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/TrieCommon.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/TrieDB.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/TrieDB.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/TrieHash.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
libethereum/TrieHash.h

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
test/crypto.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
test/dagger.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
test/hexPrefix.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
test/main.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
test/peer.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
test/rlp.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
test/state.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

2
test/trie.cpp

@ -3,7 +3,7 @@
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,

Loading…
Cancel
Save