Unverified Commit 24d705dd authored by kladko's avatar kladko

SKALE-3481-NIGHTLY

parent 40b0336f
...@@ -79,14 +79,12 @@ string TestUtils::convertDecToHex(string dec, int numBytes) { ...@@ -79,14 +79,12 @@ string TestUtils::convertDecToHex(string dec, int numBytes) {
mpz_t num; mpz_t num;
mpz_init(num); mpz_init(num);
mpz_set_str(num, dec.c_str(), 10); mpz_set_str(num, dec.c_str(), 10);
vector<char> tmp(mpz_sizeinbase(num, 16) + 2, 0); vector<char> tmp(mpz_sizeinbase(num, 16) + 2, 0);
char *hex = mpz_get_str(tmp.data(), 16, num); char *hex = mpz_get_str(tmp.data(), 16, num);
string result = hex; string result = hex;
int n_zeroes = numBytes * 2 - result.length(); int n_zeroes = numBytes * 2 - result.length();
result.insert(0, n_zeroes, '0'); result.insert(0, n_zeroes, '0');
mpz_clear(num);
return result; return result;
} }
...@@ -180,7 +178,7 @@ void TestUtils::sendRPCRequest() { ...@@ -180,7 +178,7 @@ void TestUtils::sendRPCRequest() {
usleep(100000); usleep(100000);
ethKeys[i] = c.generateECDSAKey(); ethKeys[i] = c.generateECDSAKey();
for (int i2 = 0; i2 < 10000; i2++) { for (int i2 = 0; i2 < 3; i2++) {
auto keyName = ethKeys[i]["keyName"].asString(); auto keyName = ethKeys[i]["keyName"].asString();
Json::Value sig = c.ecdsaSignMessageHash(16, keyName, SAMPLE_HASH); Json::Value sig = c.ecdsaSignMessageHash(16, keyName, SAMPLE_HASH);
CHECK_STATE(sig["status"].asInt() == 0); CHECK_STATE(sig["status"].asInt() == 0);
...@@ -193,15 +191,20 @@ void TestUtils::sendRPCRequest() { ...@@ -193,15 +191,20 @@ void TestUtils::sendRPCRequest() {
auto response = c.generateDKGPoly(polyName, t); auto response = c.generateDKGPoly(polyName, t);
CHECK_STATE(response["status"] == 0); CHECK_STATE(response["status"] == 0);
polyNames[i] = polyName; polyNames[i] = polyName;
for (int i3 = 0; i3 < 3; i3++) {
verifVects[i] = c.getVerificationVector(polyName, t, n); verifVects[i] = c.getVerificationVector(polyName, t, n);
CHECK_STATE(verifVects[i]["status"] == 0); CHECK_STATE(verifVects[i]["status"] == 0);
}
pubEthKeys.append(ethKeys[i]["publicKey"]); pubEthKeys.append(ethKeys[i]["publicKey"]);
} }
for (uint8_t i = 0; i < n; i++) { for (uint8_t i = 0; i < n; i++) {
usleep(100000); usleep(100000);
for (int i4 = 0; i4 < 1; i4++) {
secretShares[i] = c.getSecretShare(polyNames[i], pubEthKeys, t, n); secretShares[i] = c.getSecretShare(polyNames[i], pubEthKeys, t, n);
}
for (uint8_t k = 0; k < t; k++) { for (uint8_t k = 0; k < t; k++) {
for (uint8_t j = 0; j < 4; j++) { for (uint8_t j = 0; j < 4; j++) {
string pubShare = verifVects[i]["verificationVector"][k][j].asString(); string pubShare = verifVects[i]["verificationVector"][k][j].asString();
...@@ -217,9 +220,12 @@ void TestUtils::sendRPCRequest() { ...@@ -217,9 +220,12 @@ void TestUtils::sendRPCRequest() {
string secretShare = secretShares[i]["secretShare"].asString().substr(192 * j, 192); string secretShare = secretShares[i]["secretShare"].asString().substr(192 * j, 192);
secShares[i] += secretShares[j]["secretShare"].asString().substr(192 * i, 192); secShares[i] += secretShares[j]["secretShare"].asString().substr(192 * i, 192);
usleep(100000); usleep(100000);
Json::Value verif = c.dkgVerification(pubShares[i], ethKeys[j]["keyName"].asString(), secretShare, t, n, j); for (int i5 = 0; i5 < 1; i5++) {
Json::Value verif = c.dkgVerification(pubShares[i], ethKeys[j]["keyName"].asString(), secretShare, t, n,
j);
CHECK_STATE(verif["status"] == 0); CHECK_STATE(verif["status"] == 0);
} }
}
BLSSigShareSet sigShareSet(t, n); BLSSigShareSet sigShareSet(t, n);
...@@ -238,8 +244,13 @@ void TestUtils::sendRPCRequest() { ...@@ -238,8 +244,13 @@ void TestUtils::sendRPCRequest() {
publicShares["publicShares"][i] = pubShares[i]; publicShares["publicShares"][i] = pubShares[i];
} }
Json::Value blsPublicKeys;
for (int i6 = 0; i6 < 10000; i6++) {
Json::Value blsPublicKeys = c.calculateAllBLSPublicKeys(publicShares, t, n); Json::Value blsPublicKeys = c.calculateAllBLSPublicKeys(publicShares, t, n);
CHECK_STATE(blsPublicKeys["status"] == 0); CHECK_STATE(blsPublicKeys["status"] == 0);
}
for (int i = 0; i < t; i++) { for (int i = 0; i < t; i++) {
string endName = polyNames[i].substr(4); string endName = polyNames[i].substr(4);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<ProdID>0</ProdID> <ProdID>0</ProdID>
<ISVSVN>1</ISVSVN> <ISVSVN>1</ISVSVN>
<StackMaxSize>0x100000</StackMaxSize> <StackMaxSize>0x100000</StackMaxSize>
<HeapMaxSize>0x20000</HeapMaxSize> <HeapMaxSize>0x100000</HeapMaxSize>
<TCSNum>16</TCSNum> <TCSNum>16</TCSNum>
<TCSMaxNum>16</TCSMaxNum> <TCSMaxNum>16</TCSMaxNum>
<TCSMinPool>16</TCSMinPool> <TCSMinPool>16</TCSMinPool>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment