Unverified Commit 8ca3a0ca authored by Stan Kladko's avatar Stan Kladko Committed by GitHub

Merge pull request #21 from skalenetwork/enhancement/SKALE-1955-add-healthcheck

Enhancement/skale 1955 add healthcheck
parents 42227253 199cd7e9
......@@ -653,6 +653,14 @@ Json::Value MultG2Impl(const std::string& x){
return result;
}
Json::Value getServerStatusImpl() {
Json::Value result;
result["status"] = 0;
result["errorMessage"] = "";
return result;
}
Json::Value SGXWalletServer::generateDKGPoly(const std::string& polyName, int t){
std::cerr << "entered generateDKGPoly" << std::endl;
......@@ -735,10 +743,14 @@ Json::Value SGXWalletServer::ComplaintResponse(const std::string& polyName, int
}
Json::Value SGXWalletServer::MultG2(const std::string& x){
lock_guard<recursive_mutex> lock(m);
return MultG2Impl(x);
lock_guard<recursive_mutex> lock(m);
return MultG2Impl(x);
}
Json::Value SGXWalletServer::getServerStatus() {
lock_guard<recursive_mutex> lock(m);
return getServerStatusImpl();
}
shared_ptr<string> readFromDb(const string & name, const string & prefix) {
......
......@@ -60,6 +60,7 @@ public:
virtual Json::Value GetBLSPublicKeyShare(const std::string & BLSKeyName);
virtual Json::Value ComplaintResponse(const std::string& polyName, int ind);
virtual Json::Value MultG2(const std::string & x);
virtual Json::Value getServerStatus();
};
......@@ -86,5 +87,6 @@ Json::Value CreateBLSPrivateKeyImpl(const std::string & BLSKeyName, const std::s
Json::Value GetBLSPublicKeyShareImpl(const std::string & BLSKeyName);
Json::Value ComplaintResponseImpl(const std::string& polyName, int ind);
Json::Value MultG2Impl(const std::string & x);
Json::Value getServerStatusImpl();
#endif //SGXWALLET_SGXWALLETSERVER_HPP
\ No newline at end of file
......@@ -30,6 +30,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
this->bindAndAddMethod(jsonrpc::Procedure("ComplaintResponse", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "polyName",jsonrpc::JSON_STRING,"ind",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::ComplaintResponseI);
this->bindAndAddMethod(jsonrpc::Procedure("MultG2", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "x",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::MultG2I);
this->bindAndAddMethod(jsonrpc::Procedure("getServerStatus", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, NULL), &AbstractStubServer::getServerStatusI);
}
inline virtual void importBLSKeyShareI(const Json::Value &request, Json::Value &response)
......@@ -93,6 +94,11 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
{
response = this->MultG2(request["x"].asString());
}
inline virtual void getServerStatusI(const Json::Value &request, Json::Value &response)
{
(void)request;
response = this->getServerStatus();
}
virtual Json::Value importBLSKeyShare(const std::string& keyShare, const std::string& keyShareName, int t, int n, int index) = 0;
virtual Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash, int t, int n, int signerIndex ) = 0;
......@@ -110,6 +116,8 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
virtual Json::Value GetBLSPublicKeyShare(const std::string & BLSKeyName) = 0;
virtual Json::Value ComplaintResponse(const std::string& polyName, int ind) = 0;
virtual Json::Value MultG2(const std::string & x) = 0;
virtual Json::Value getServerStatus() = 0;
};
#endif //JSONRPC_CPP_STUB_ABSTRACTSTUBSERVER_H_
......@@ -60,7 +60,7 @@ print("Top directory is:" + topDir )
makeExecutable = subprocess.check_output(["which", "make"])
SCRIPTS_DIR = topDir + "/scripts"
SCRIPTS_DIR = topDir + "/scripts"
GMP_DIR = topDir + "/sgx-gmp"
SSL_DIR = topDir + "/intel-sgx-ssl"
SSL_SOURCE_DIR = SSL_DIR + "/openssl_source"
......@@ -115,7 +115,7 @@ assert subprocess.call(["bash","-c", "cmake -H. -Bbuild && cmake --build build -
os.chdir(SCRIPTS_DIR)
assert subprocess.call(["bash","-c", "./sgx_linux_x64_sdk_2.5.100.49891.bin --prefix=" + topDir + "/sgx-sdk-build"]) == 0
assert subprocess.call(["bash","-c", "./sgx_linux_x64_sdk_2.5.100.49891.bin --prefix=" + topDir + "/sgx-sdk-build"]) == 0
os.chdir(GMP_DIR);
......@@ -141,14 +141,14 @@ assert subprocess.call(["cp", "sgx_tgmp.h", TGMP_BUILD_DIR + "/include/sgx_tgmp.
os.chdir(SSL_DIR);
print "===>>> Downloading vanilla openssl source package"
print("===>>> Downloading vanilla openssl source package")
os.chdir(SSL_SOURCE_DIR);
assert subprocess.call(["wget", "https://www.openssl.org/source/openssl-1.1.1b.tar.gz"]) == 0
print "===>>> Making SSL project"
print("===>>> Making SSL project")
os.chdir(SSL_MAKE_DIR);
......
This diff is collapsed.
......@@ -955,4 +955,11 @@ TEST_CASE("API test", "[api_test]") {
sgx_destroy_enclave(eid);
}
TEST_CASE("getServerStatus test", "[getServerStatus_test]") {
init_all();
HttpClient client("http://localhost:1028");
StubClient c(client, JSONRPC_CLIENT_V2);
REQUIRE(c.getServerStatus()["status"] == 0);
sgx_destroy_enclave(eid);
}
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