aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MemTrie.cpp14
-rw-r--r--MemTrie.h2
-rw-r--r--TestHelper.cpp6
-rw-r--r--TestHelper.h5
-rw-r--r--TrieHash.cpp13
-rw-r--r--TrieHash.h2
-rw-r--r--crypto.cpp5
-rw-r--r--dagger.cpp3
-rw-r--r--fork.cpp3
-rw-r--r--genesis.cpp3
-rw-r--r--hexPrefix.cpp3
-rw-r--r--main.cpp3
-rw-r--r--network.cpp3
-rw-r--r--peer.cpp4
-rw-r--r--rlp.cpp18
-rw-r--r--state.cpp3
-rw-r--r--trie.cpp23
-rw-r--r--txTest.cpp9
-rw-r--r--vm.cpp13
19 files changed, 79 insertions, 56 deletions
diff --git a/MemTrie.cpp b/MemTrie.cpp
index 5c819ffb..b5d875ac 100644
--- a/MemTrie.cpp
+++ b/MemTrie.cpp
@@ -25,9 +25,10 @@
#include <libethcore/SHA3.h>
#include <libethcore/CommonEth.h>
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
-namespace eth
+namespace dev
{
#define ENABLE_DEBUG_PRINT 0
@@ -54,7 +55,7 @@ public:
#endif
/// 256-bit hash of the node - this is a SHA-3/256 hash of the RLP of the node.
- h256 hash256() const { RLPStream s; makeRLP(s); return eth::sha3(s.out()); }
+ h256 hash256() const { RLPStream s; makeRLP(s); return dev::eth::sha3(s.out()); }
bytes rlp() const { RLPStream s; makeRLP(s); return s.out(); }
void mark() { m_hash256 = h256(); }
@@ -199,7 +200,7 @@ void MemTrieNode::putRLP(RLPStream& _parentStream) const
if (s.out().size() < 32)
_parentStream.APPEND_CHILD(s.out());
else
- _parentStream << eth::sha3(s.out());
+ _parentStream << dev::eth::sha3(s.out());
}
void TrieBranchNode::makeRLP(RLPStream& _intoStream) const
@@ -228,7 +229,7 @@ void TrieInfixNode::makeRLP(RLPStream& _intoStream) const
MemTrieNode* MemTrieNode::newBranch(bytesConstRef _k1, std::string const& _v1, bytesConstRef _k2, std::string const& _v2)
{
- uint prefix = commonPrefix(_k1, _k2);
+ unsigned prefix = commonPrefix(_k1, _k2);
MemTrieNode* ret;
if (_k1.size() == prefix)
@@ -347,7 +348,7 @@ MemTrieNode* TrieInfixNode::insert(bytesConstRef _key, std::string const& _value
}
else
{
- uint prefix = commonPrefix(_key, m_ext);
+ unsigned prefix = commonPrefix(_key, m_ext);
if (prefix)
{
// one infix becomes two infixes, then insert into the second
@@ -478,3 +479,4 @@ void MemTrie::remove(std::string const& _key)
}
}
+
diff --git a/MemTrie.h b/MemTrie.h
index 8c90f2f3..66669653 100644
--- a/MemTrie.h
+++ b/MemTrie.h
@@ -24,7 +24,7 @@
#include <libethential/Common.h>
#include <libethential/FixedHash.h>
-namespace eth
+namespace dev
{
class MemTrieNode;
diff --git a/TestHelper.cpp b/TestHelper.cpp
index 06f188a8..02a883db 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -19,11 +19,14 @@
* @date 2014
*/
+#include "TestHelper.h"
+
#include <thread>
#include <chrono>
#include <libethereum/Client.h>
-#include "TestHelper.h"
+namespace dev
+{
namespace eth
{
@@ -47,3 +50,4 @@ void connectClients(Client& c1, Client& c2)
}
}
+}
diff --git a/TestHelper.h b/TestHelper.h
index 748373ba..d6924a17 100644
--- a/TestHelper.h
+++ b/TestHelper.h
@@ -21,10 +21,15 @@
#pragma once
+namespace dev
+{
namespace eth
{
+class Client;
+
void mine(Client& c, int numBlocks);
void connectClients(Client& c1, Client& c2);
}
+}
diff --git a/TrieHash.cpp b/TrieHash.cpp
index 8f4161a1..b2ebce73 100644
--- a/TrieHash.cpp
+++ b/TrieHash.cpp
@@ -25,9 +25,10 @@
#include <libethcore/SHA3.h>
#include <libethcore/CommonEth.h>
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
-namespace eth
+namespace dev
{
/*/
@@ -67,12 +68,12 @@ void hash256rlp(HexMap const& _s, HexMap::const_iterator _begin, HexMap::const_i
{
// find the number of common prefix nibbles shared
// i.e. the minimum number of nibbles shared at the beginning between the first hex string and each successive.
- uint sharedPre = (uint)-1;
- uint c = 0;
+ unsigned sharedPre = (unsigned)-1;
+ unsigned c = 0;
for (auto i = std::next(_begin); i != _end && sharedPre; ++i, ++c)
{
- uint x = std::min(sharedPre, std::min((uint)_begin->first.size(), (uint)i->first.size()));
- uint shared = _preLen;
+ unsigned x = std::min(sharedPre, std::min((unsigned)_begin->first.size(), (unsigned)i->first.size()));
+ unsigned shared = _preLen;
for (; shared < x && _begin->first[shared] == i->first[shared]; ++shared) {}
sharedPre = std::min(shared, sharedPre);
}
diff --git a/TrieHash.h b/TrieHash.h
index 391c4263..4d86c4db 100644
--- a/TrieHash.h
+++ b/TrieHash.h
@@ -24,7 +24,7 @@
#include <libethential/Common.h>
#include <libethential/FixedHash.h>
-namespace eth
+namespace dev
{
bytes rlp256(StringMap const& _s);
diff --git a/crypto.cpp b/crypto.cpp
index c39de78d..2e4ffa05 100644
--- a/crypto.cpp
+++ b/crypto.cpp
@@ -29,7 +29,8 @@
#include <boost/test/unit_test.hpp>
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
BOOST_AUTO_TEST_CASE(crypto_tests)
@@ -145,7 +146,7 @@ int cryptoTest()
int ret = secp256k1_ecdsa_recover_compact((byte const*)hmsg.data(), (int)hmsg.size(), (byte const*)sig64.data(), pubkey.data(), &pubkeylen, 0, (int)t.vrs.v - 27);
pubkey.resize(pubkeylen);
cout << "RECPUB: " << dec << ret << " " << pubkeylen << " " << toHex(pubkey) << endl;
- cout << "SENDER: " << hex << toAddress(eth::sha3(bytesConstRef(&pubkey).cropped(1))) << dec << endl;
+ cout << "SENDER: " << hex << toAddress(dev::eth::sha3(bytesConstRef(&pubkey).cropped(1))) << dec << endl;
}
#endif
return 0;
diff --git a/dagger.cpp b/dagger.cpp
index 4f65b47a..fd60a8ef 100644
--- a/dagger.cpp
+++ b/dagger.cpp
@@ -25,7 +25,8 @@
#include <libethcore/Dagger.h>
using namespace std;
using namespace std::chrono;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
int daggerTest()
{
diff --git a/fork.cpp b/fork.cpp
index f0edb702..1cdb8822 100644
--- a/fork.cpp
+++ b/fork.cpp
@@ -27,7 +27,8 @@
#include <libethereum/EthereumHost.h>
#include "TestHelper.h"
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
// Disabled since tests shouldn't block. Need a short cut to avoid real mining.
/*
diff --git a/genesis.cpp b/genesis.cpp
index 441826e7..be6655ab 100644
--- a/genesis.cpp
+++ b/genesis.cpp
@@ -28,7 +28,8 @@
#include <boost/test/unit_test.hpp>
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
namespace js = json_spirit;
diff --git a/hexPrefix.cpp b/hexPrefix.cpp
index 5ea67092..7dbe80a5 100644
--- a/hexPrefix.cpp
+++ b/hexPrefix.cpp
@@ -27,7 +27,8 @@
#include <boost/test/unit_test.hpp>
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
namespace js = json_spirit;
BOOST_AUTO_TEST_CASE(hexPrefix_test)
diff --git a/main.cpp b/main.cpp
index 1497f298..08142095 100644
--- a/main.cpp
+++ b/main.cpp
@@ -38,7 +38,8 @@ int peerTest(int argc, char** argv);
#include <libethential/Log.h>
#include <libethcore/BlockInfo.h>
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
BOOST_AUTO_TEST_CASE(basic_tests)
{
diff --git a/network.cpp b/network.cpp
index 978d6893..acdd649d 100644
--- a/network.cpp
+++ b/network.cpp
@@ -27,7 +27,8 @@
#include <libethereum/EthereumHost.h>
#include "TestHelper.h"
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
// Disabled since tests shouldn't block (not the worst offender, but timeout should be reduced anyway).
/*
diff --git a/peer.cpp b/peer.cpp
index f903d042..821aab51 100644
--- a/peer.cpp
+++ b/peer.cpp
@@ -24,8 +24,8 @@
#include <thread>
#include <libp2p/Host.h>
using namespace std;
-using namespace eth;
-using namespace p2p;
+using namespace dev;
+using namespace dev::p2p;
int peerTest(int argc, char** argv)
{
diff --git a/rlp.cpp b/rlp.cpp
index 548be8d9..963d6109 100644
--- a/rlp.cpp
+++ b/rlp.cpp
@@ -30,10 +30,10 @@
#include <algorithm>
using namespace std;
-using namespace eth;
+using namespace dev;
namespace js = json_spirit;
-namespace eth
+namespace dev
{
namespace test
{
@@ -116,7 +116,7 @@ namespace eth
BOOST_CHECK( !u.isData() );
js::mArray& arr = v.get_array();
BOOST_CHECK( u.itemCount() == arr.size() );
- uint i;
+ unsigned i;
for( i = 0; i < arr.size(); i++ )
{
RLP item = u[i];
@@ -137,16 +137,16 @@ BOOST_AUTO_TEST_CASE(rlp_encoding_test)
{
cnote << "Testing RLP Encoding...";
js::mValue v;
- eth::test::getRLPTestCases(v);
+ dev::test::getRLPTestCases(v);
for (auto& i: v.get_obj())
{
js::mObject& o = i.second.get_obj();
cnote << i.first;
- eth::test::checkRLPTestCase(o);
+ dev::test::checkRLPTestCase(o);
RLPStream s;
- eth::test::buildRLP(o["in"], s);
+ dev::test::buildRLP(o["in"], s);
std::string expectedText(o["out"].get_str());
std::transform(expectedText.begin(), expectedText.end(), expectedText.begin(), ::tolower );
@@ -173,19 +173,19 @@ BOOST_AUTO_TEST_CASE(rlp_decoding_test)
// and then compare the output structure to the json of the
// input object.
js::mValue v;
- eth::test::getRLPTestCases(v);
+ dev::test::getRLPTestCases(v);
for (auto& i: v.get_obj())
{
js::mObject& o = i.second.get_obj();
cnote << i.first;
- eth::test::checkRLPTestCase(o);
+ dev::test::checkRLPTestCase(o);
js::mValue& inputData = o["in"];
bytes payloadToDecode = fromHex(o["out"].get_str());
RLP payload(payloadToDecode);
- eth::test::checkRLPAgainstJson(inputData, payload);
+ dev::test::checkRLPAgainstJson(inputData, payload);
}
}
diff --git a/state.cpp b/state.cpp
index 8d82b0c2..99ce3095 100644
--- a/state.cpp
+++ b/state.cpp
@@ -26,7 +26,8 @@
#include <libethereum/State.h>
#include <libethereum/Defaults.h>
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
int stateTest()
{
diff --git a/trie.cpp b/trie.cpp
index b28be8b1..4ddf30a6 100644
--- a/trie.cpp
+++ b/trie.cpp
@@ -29,22 +29,23 @@
#include <boost/test/unit_test.hpp>
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
namespace js = json_spirit;
-namespace eth
-{
- namespace test
- {
- static unsigned fac(unsigned _i)
- {
- return _i > 2 ? _i * fac(_i - 1) : _i;
- }
+namespace dev
+{
+namespace test
+{
- }
+static unsigned fac(unsigned _i)
+{
+ return _i > 2 ? _i * fac(_i - 1) : _i;
}
+}
+}
BOOST_AUTO_TEST_CASE(trie_tests)
{
@@ -66,7 +67,7 @@ BOOST_AUTO_TEST_CASE(trie_tests)
if (!ss.back().second.find("0x"))
ss.back().second = asString(fromHex(ss.back().second.substr(2)));
}
- for (unsigned j = 0; j < min(1000u, eth::test::fac((unsigned)ss.size())); ++j)
+ for (unsigned j = 0; j < min(1000u, dev::test::fac((unsigned)ss.size())); ++j)
{
next_permutation(ss.begin(), ss.end());
MemoryDB m;
diff --git a/txTest.cpp b/txTest.cpp
index 314cf964..cc78c26a 100644
--- a/txTest.cpp
+++ b/txTest.cpp
@@ -27,7 +27,8 @@
#include <libethereum/EthereumHost.h>
#include "TestHelper.h"
using namespace std;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
// Disabled since tests shouldn't block. Need a short cut to avoid real mining.
/*
@@ -46,7 +47,7 @@ BOOST_AUTO_TEST_CASE(mine_local_simple_tx)
//send c2 some eth from c1
auto txAmount = c1bal / 2u;
auto gasPrice = 10 * szabo;
- auto gas = eth::c_callGas;
+ auto gas = dev::eth::c_callGas;
c1.transact(kp1.secret(), txAmount, kp2.address(), bytes(), gas, gasPrice);
//mine some more to include the transaction on chain
@@ -74,7 +75,7 @@ BOOST_AUTO_TEST_CASE(mine_and_send_to_peer)
//send c2 some eth from c1
auto txAmount = c1bal / 2u;
auto gasPrice = 10 * szabo;
- auto gas = eth::c_callGas;
+ auto gas = dev::eth::c_callGas;
c1.transact(kp1.secret(), txAmount, kp2.address(), bytes(), gas, gasPrice);
//mine some more to include the transaction on chain
@@ -105,7 +106,7 @@ BOOST_AUTO_TEST_CASE(mine_and_send_to_peer_fee_check)
//send c2 some eth from c1
auto txAmount = c1StartBalance / 2u;
auto gasPrice = 10 * szabo;
- auto gas = eth::c_callGas;
+ auto gas = dev::eth::c_callGas;
c1.transact(kp1.secret(), txAmount, c2.address(), bytes(), gas, gasPrice);
//mine some more, this time with second client (so he can get fees from first client's tx)
diff --git a/vm.cpp b/vm.cpp
index 0647849a..2b75f0b3 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -33,9 +33,10 @@
using namespace std;
using namespace json_spirit;
-using namespace eth;
+using namespace dev;
+using namespace dev::eth;
-namespace eth { namespace test {
+namespace dev { namespace test {
class FakeExtVM: public ExtVMFace
{
@@ -387,7 +388,7 @@ void doTests(json_spirit::mValue& v, bool _fillin)
BOOST_REQUIRE(o.count("exec") > 0);
VM vm;
- eth::test::FakeExtVM fev;
+ dev::test::FakeExtVM fev;
fev.importEnv(o["env"].get_obj());
fev.importState(o["pre"].get_obj());
@@ -419,7 +420,7 @@ void doTests(json_spirit::mValue& v, bool _fillin)
BOOST_REQUIRE(o.count("out") > 0);
BOOST_REQUIRE(o.count("gas") > 0);
- eth::test::FakeExtVM test;
+ dev::test::FakeExtVM test;
test.importState(o["post"].get_obj());
test.importCallCreates(o["callcreates"].get_array());
int i = 0;
@@ -481,7 +482,7 @@ BOOST_AUTO_TEST_CASE(vm_tests)
string s = asString(contents("../../../cpp-ethereum/test/vmtests.json"));
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'vmtests.json' is empty.");
json_spirit::read_string(s, v);
- eth::test::doTests(v, true);
+ dev::test::doTests(v, true);
writeFile("../../../tests/vmtests.json", asBytes(json_spirit::write_string(v, true)));
}
/* catch (std::exception const& e)
@@ -496,7 +497,7 @@ BOOST_AUTO_TEST_CASE(vm_tests)
string s = asString(contents("../../../tests/vmtests.json"));
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'vmtests.json' is empty. Have you cloned the 'tests' repo branch develop?");
json_spirit::read_string(s, v);
- eth::test::doTests(v, false);
+ dev::test::doTests(v, false);
}
catch (std::exception const& e)
{