Work in progress on Visual Studio 2013 compile fixes. Libethereum compiles again but not sorted out linking dependencies yet.

This commit is contained in:
Tim Hughes 2014-02-11 19:13:31 +00:00
parent 8aeece1eb5
commit 7a1f75ddbf
6 changed files with 32 additions and 23 deletions

View File

@ -92,7 +92,6 @@
<AdditionalIncludeDirectories>../libethereum</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>../libethereum</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<OpenMPSupport>true</OpenMPSupport> <OpenMPSupport>true</OpenMPSupport>
<DisableSpecificWarnings>4351</DisableSpecificWarnings> <DisableSpecificWarnings>4351</DisableSpecificWarnings>
</ClCompile> </ClCompile>
@ -100,6 +99,7 @@
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<LargeAddressAware>true</LargeAddressAware> <LargeAddressAware>true</LargeAddressAware>
<AdditionalLibraryDirectories>../../boost_1_55_0/stage/x86</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -111,13 +111,12 @@
<AdditionalIncludeDirectories>../libethereum</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>../libethereum</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<OpenMPSupport>true</OpenMPSupport>
<DisableSpecificWarnings>4351</DisableSpecificWarnings> <DisableSpecificWarnings>4351</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>../../boost_1_55_0/stage/x64</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -132,7 +131,6 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<OpenMPSupport>true</OpenMPSupport> <OpenMPSupport>true</OpenMPSupport>
<DisableSpecificWarnings>4351</DisableSpecificWarnings> <DisableSpecificWarnings>4351</DisableSpecificWarnings>
</ClCompile> </ClCompile>
@ -142,6 +140,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<LargeAddressAware>true</LargeAddressAware> <LargeAddressAware>true</LargeAddressAware>
<AdditionalLibraryDirectories>../../boost_1_55_0/stage/x86</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -156,7 +155,6 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<OpenMPSupport>true</OpenMPSupport> <OpenMPSupport>true</OpenMPSupport>
<DisableSpecificWarnings>4351</DisableSpecificWarnings> <DisableSpecificWarnings>4351</DisableSpecificWarnings>
</ClCompile> </ClCompile>
@ -165,6 +163,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>../../boost_1_55_0/stage/x64</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
@ -176,7 +175,14 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="crypto.cpp" />
<ClCompile Include="dagger.cpp" />
<ClCompile Include="hexPrefix.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
<ClCompile Include="peer.cpp" />
<ClCompile Include="rlp.cpp" />
<ClCompile Include="state.cpp" />
<ClCompile Include="trie.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -87,7 +87,7 @@ int cryptoTest()
ret = secp256k1_ecdsa_pubkey_create(pubkey.data(), &pubkeylen, privkey.data(), 1); ret = secp256k1_ecdsa_pubkey_create(pubkey.data(), &pubkeylen, privkey.data(), 1);
pubkey.resize(pubkeylen); pubkey.resize(pubkeylen);
int good = secp256k1_ecdsa_pubkey_verify(pubkey.data(), pubkey.size()); int good = secp256k1_ecdsa_pubkey_verify(pubkey.data(), (int)pubkey.size());
cout << "PUB: " << dec << ret << " " << pubkeylen << " " << asHex(pubkey) << (good ? " GOOD" : " BAD") << endl; cout << "PUB: " << dec << ret << " " << pubkeylen << " " << asHex(pubkey) << (good ? " GOOD" : " BAD") << endl;
} }
@ -99,12 +99,12 @@ int cryptoTest()
cout << asHex(hmsg) << endl; cout << asHex(hmsg) << endl;
cout << asHex(privkey) << endl; cout << asHex(privkey) << endl;
cout << hex << nonce << dec << endl; cout << hex << nonce << dec << endl;
int ret = secp256k1_ecdsa_sign_compact((byte const*)hmsg.data(), hmsg.size(), sig.data(), privkey.data(), (byte const*)&nonce, &v); int ret = secp256k1_ecdsa_sign_compact((byte const*)hmsg.data(), (int)hmsg.size(), sig.data(), privkey.data(), (byte const*)&nonce, &v);
cout << "MYSIG: " << dec << ret << " " << sig.size() << " " << asHex(sig) << " " << v << endl; cout << "MYSIG: " << dec << ret << " " << sig.size() << " " << asHex(sig) << " " << v << endl;
bytes pubkey(65); bytes pubkey(65);
int pubkeylen = 65; int pubkeylen = 65;
ret = secp256k1_ecdsa_recover_compact((byte const*)hmsg.data(), hmsg.size(), (byte const*)sig.data(), pubkey.data(), &pubkeylen, 0, v); ret = secp256k1_ecdsa_recover_compact((byte const*)hmsg.data(), (int)hmsg.size(), (byte const*)sig.data(), pubkey.data(), &pubkeylen, 0, v);
pubkey.resize(pubkeylen); pubkey.resize(pubkeylen);
cout << "MYREC: " << dec << ret << " " << pubkeylen << " " << asHex(pubkey) << endl; cout << "MYREC: " << dec << ret << " " << pubkeylen << " " << asHex(pubkey) << endl;
} }
@ -112,7 +112,7 @@ int cryptoTest()
{ {
bytes pubkey(65); bytes pubkey(65);
int pubkeylen = 65; int pubkeylen = 65;
int ret = secp256k1_ecdsa_recover_compact((byte const*)hmsg.data(), hmsg.size(), (byte const*)sig64.data(), pubkey.data(), &pubkeylen, 0, (int)t.vrs.v - 27); 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); pubkey.resize(pubkeylen);
cout << "RECPUB: " << dec << ret << " " << pubkeylen << " " << asHex(pubkey) << endl; cout << "RECPUB: " << dec << ret << " " << pubkeylen << " " << asHex(pubkey) << endl;
cout << "SENDER: " << hex << low160(eth::sha3(bytesConstRef(&pubkey).cropped(1))) << dec << endl; cout << "SENDER: " << hex << low160(eth::sha3(bytesConstRef(&pubkey).cropped(1))) << dec << endl;

View File

@ -30,19 +30,17 @@ int daggerTest()
{ {
// Test dagger // Test dagger
{ {
Dagger d;
auto s = steady_clock::now(); auto s = steady_clock::now();
cout << hex << d.eval((h256)1, (h256)0); cout << hex << Dagger().eval((h256)1, (h256)0);
cout << " " << dec << duration_cast<milliseconds>(steady_clock::now() - s).count() << " ms" << endl; cout << " " << dec << duration_cast<milliseconds>(steady_clock::now() - s).count() << " ms" << endl;
cout << hex << d.eval((h256)1, (h256)1); cout << hex << Dagger().eval((h256)1, (h256)1);
cout << " " << dec << duration_cast<milliseconds>(steady_clock::now() - s).count() << " ms" << endl; cout << " " << dec << duration_cast<milliseconds>(steady_clock::now() - s).count() << " ms" << endl;
} }
{ {
Dagger d;
auto s = steady_clock::now(); auto s = steady_clock::now();
cout << hex << d.eval((h256)1, (h256)0); cout << hex << Dagger().eval((h256)1, (h256)0);
cout << " " << dec << duration_cast<milliseconds>(steady_clock::now() - s).count() << " ms" << endl; cout << " " << dec << duration_cast<milliseconds>(steady_clock::now() - s).count() << " ms" << endl;
cout << hex << d.eval((h256)1, (h256)1); cout << hex << Dagger().eval((h256)1, (h256)1);
cout << " " << dec << duration_cast<milliseconds>(steady_clock::now() - s).count() << " ms" << endl; cout << " " << dec << duration_cast<milliseconds>(steady_clock::now() - s).count() << " ms" << endl;
} }
return 0; return 0;

View File

@ -34,7 +34,7 @@ int peerTest(int argc, char** argv);
#include <BlockInfo.h> #include <BlockInfo.h>
using namespace eth; using namespace eth;
int main(int argc, char** argv) int main(int, char**)
{ {
/* RLPStream s; /* RLPStream s;
BlockInfo::genesis().fillStream(s, false); BlockInfo::genesis().fillStream(s, false);

View File

@ -38,11 +38,11 @@ int peerTest(int argc, char** argv)
{ {
string arg = argv[i]; string arg = argv[i];
if (arg == "-l" && i + 1 < argc) if (arg == "-l" && i + 1 < argc)
listenPort = atoi(argv[++i]); listenPort = (short)atoi(argv[++i]);
else if (arg == "-r" && i + 1 < argc) else if (arg == "-r" && i + 1 < argc)
remoteHost = argv[++i]; remoteHost = argv[++i];
else if (arg == "-p" && i + 1 < argc) else if (arg == "-p" && i + 1 < argc)
remotePort = atoi(argv[++i]); remotePort = (short)atoi(argv[++i]);
else else
remoteHost = argv[i]; remoteHost = argv[i];
} }

View File

@ -27,6 +27,11 @@
using namespace std; using namespace std;
using namespace eth; using namespace eth;
inline h256 stringMapHash256(StringMap const& _s)
{
return hash256(_s);
}
int trieTest() int trieTest()
{ {
{ {
@ -42,13 +47,13 @@ int trieTest()
cout << t; cout << t;
cout << m; cout << m;
cout << t.root() << endl; cout << t.root() << endl;
cout << hash256({{"test", "test"}}) << endl; cout << stringMapHash256({{"test", "test"}}) << endl;
t.insert(string("tesa"), string("testy")); t.insert(string("tesa"), string("testy"));
cout << t; cout << t;
cout << m; cout << m;
cout << t.root() << endl; cout << t.root() << endl;
cout << hash256({{"test", "test"}, {"te", "testy"}}) << endl; cout << stringMapHash256({{"test", "test"}, {"te", "testy"}}) << endl;
cout << t.at(string("test")) << endl; cout << t.at(string("test")) << endl;
cout << t.at(string("te")) << endl; cout << t.at(string("te")) << endl;
cout << t.at(string("t")) << endl; cout << t.at(string("t")) << endl;
@ -56,7 +61,7 @@ int trieTest()
t.remove(string("te")); t.remove(string("te"));
cout << m; cout << m;
cout << t.root() << endl; cout << t.root() << endl;
cout << hash256({{"test", "test"}}) << endl; cout << stringMapHash256({{"test", "test"}}) << endl;
t.remove(string("test")); t.remove(string("test"));
cout << m; cout << m;
@ -72,7 +77,7 @@ int trieTest()
cout << t; cout << t;
cout << m; cout << m;
cout << t.root() << endl; cout << t.root() << endl;
cout << hash256({{"b", "B"}, {"a", "A"}}) << endl; cout << stringMapHash256({{"b", "B"}, {"a", "A"}}) << endl;
cout << RLP(rlp256({{"b", "B"}, {"a", "A"}})) << endl; cout << RLP(rlp256({{"b", "B"}, {"a", "A"}})) << endl;
} }
{ {
@ -89,7 +94,7 @@ int trieTest()
cout << RLP(t.rlp()) << endl; cout << RLP(t.rlp()) << endl;
} }
{ {
cout << hex << hash256({{"dog", "puppy"}, {"doe", "reindeer"}}) << endl; cout << hex << stringMapHash256({{"dog", "puppy"}, {"doe", "reindeer"}}) << endl;
MemTrie t; MemTrie t;
t.insert("dog", "puppy"); t.insert("dog", "puppy");
t.insert("doe", "reindeer"); t.insert("doe", "reindeer");