SKALE-2892 add test

parent aabe2c23
......@@ -228,6 +228,14 @@ void TestUtils::sendRPCRequest() {
map <size_t, shared_ptr<BLSPublicKeyShare>> coeffs_pkeys_map;
Json::Value publicShares;
for (int i = 0; i < n; ++i) {
publicShares["publicShares"][i] = pubShares[i];
}
Json::Value blsPublicKeys = c.calculateAllBLSPublicKeys(publicShares, t, n);
CHECK_STATE(blsPublicKeys["status"] == 0);
for (int i = 0; i < t; i++) {
string endName = polyNames[i].substr(4);
string blsName = "BLS_KEY" + polyNames[i].substr(4);
......@@ -238,6 +246,10 @@ void TestUtils::sendRPCRequest() {
pubBLSKeys[i] = c.getBLSPublicKeyShare(blsName);
CHECK_STATE(pubBLSKeys[i]["status"] == 0);
std::cout << "HERE" << std::endl;
CHECK_STATE(pubBLSKeys[i]["result"]["blsPublicKeyShare"].asString() == blsPublicKeys["result"]["publicKeys"][i].asString());
string hash = SAMPLE_HASH;
blsSigShares[i] = c.blsSignMessageHash(blsName, hash, t, n);
CHECK_STATE(blsSigShares[i]["status"] == 0);
......
......@@ -6,6 +6,7 @@
#define JSONRPC_CPP_STUB_STUBCLIENT_H_
#include <jsonrpccpp/client.h>
#include <cassert>
class StubClient : public jsonrpc::Client
{
......@@ -156,6 +157,20 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value calculateAllBLSPublicKeys(const Json::Value& publicShares, int t, int n)
{
Json::Value p;
p["publicShares"] = publicShares["publicShares"];
p["t"] = t;
p["n"] = n;
Json::Value result = this->CallMethod("calculateAllBLSPublicKeys", p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value complaintResponse(const std::string& polyName, int ind)
{
Json::Value p;
......
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