Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
olehnikolaiev committed Feb 22, 2024
1 parent b451dfe commit 58f555f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion TestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ void TestUtils::doDKGV2(StubClient &c, int n, int t,
CHECK_STATE(pubBLSKeys[i]["status"] == 0);
}

for (int i = 0; i < t; i++) {
for (int i = 0; i < n; i++) {
vector<string> pubKeyVect;
for (uint8_t j = 0; j < 4; j++) {
pubKeyVect.push_back(pubBLSKeys[i]["blsPublicKeyShare"][j].asString());
Expand All @@ -802,6 +802,27 @@ void TestUtils::doDKGV2(StubClient &c, int n, int t,
pubKeyShares[i + 1] = make_shared<BLSPublicKeyShare>(pubKey);
}

Json::Value publicSharesJson;
for (int i = 0; i < n; ++i) {
publicSharesJson["publicShares"][i] = pubShares[i];
}

auto allPubKeysJson = c.calculateAllBLSPublicKeys(publicSharesJson, t, n);
std::vector<BLSPublicKeyShare> allPubKeysFromServer(n);
for (int i = 0; i < n; i++) {
vector<string> pubKeyVect;
for (uint8_t j = 0; j < 4; j++) {
pubKeyVect.push_back(allPubKeysJson[i][j].asString());
}
BLSPublicKeyShare pubKey(make_shared<vector<string>>(pubKeyVect), t, n);

allPubKeysFromServer[i] = make_shared<BLSPublicKeyShare>(pubKey);
}

for (size_t i = 0; i < n; ++i) {
BOOST_REQUIRE( allPubKeysFromServer[i] == pubKeyShares[i + 1] );
}

// create pub key

BLSPublicKey blsPublicKey(
Expand Down

0 comments on commit 58f555f

Please sign in to comment.