Unverified Commit 4e9b5b75 authored by kladko's avatar kladko

Merge branch 'develop' into SKALE-1180-VERIFY-ECDSA

# Conflicts:
#	SGXWALLET_VERSION
parents ed0700ec 67e1dd47
......@@ -12,8 +12,20 @@ jobs:
- name: submodule update
run: git submodule update --init --recursive
- name: build
run: python3 scripts/docker_build.py ${GITHUB_REF##*/} Dockerfile sgxwallet ${GITHUB_SHA}
- name: push
run: python3 scripts/docker_push.py ${GITHUB_REF##*/} Dockerfile sgxwallet ${GITHUB_SHA}
run: python3 scripts/docker_build.py Dockerfile sgxwallet ${GITHUB_SHA}
- name: deploy docker image
if: contains(github.ref, 'develop') || contains(github.ref, 'beta') || contains(github.ref, 'master') || contains(github.ref, 'stable')
run : |
export BRANCH=${GITHUB_REF##*/}
echo "Branch $BRANCH"
export VERSION=$(cat VERSION)
echo "Version $VERSION"
export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION sgxwallet)
echo "::set-env name=VERSION::$VERSION"
echo "Version $VERSION"
export RELEASE=true
echo "::set-env name=RELEASE::$RELEASE"
bash ./scripts/build_image.sh Dockerfile
bash ./scripts/publish_image.sh Dockerfile
......@@ -15,7 +15,18 @@ jobs:
- name: submodule update
run: git submodule update --init --recursive
- name: Build the Docker image
run: docker build . --file DockerfileBase --tag skalenetwork/sgxwallet_base:latest
- name: push docker image
run: docker push skalenetwork/sgxwallet_base:latest
run: docker build . --file DockerfileBase --tag skalenetwork/sgxwallet_base:latest
- name: deploy docker image
if: contains(github.ref, 'develop') || contains(github.ref, 'beta') || contains(github.ref, 'master') || contains(github.ref, 'stable')
run : |
export BRANCH=${GITHUB_REF##*/}
echo "Branch $BRANCH"
export VERSION=$(cat VERSION)
echo "Version $VERSION"
export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION sgxwallet_base)
echo "::set-env name=VERSION::$VERSION"
echo "Version $VERSION"
export RELEASE=true
echo "::set-env name=RELEASE::$RELEASE"
bash ./scripts/build_image.sh DockerfileBase
bash ./scripts/publish_image.sh DockerfileBase
\ No newline at end of file
......@@ -3,6 +3,9 @@ on: [push]
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
steps:
- name: Check that /dev/urandom exists
run: ls /dev/urandom
......@@ -13,13 +16,45 @@ jobs:
- uses: actions/checkout@v1
- name: submodule update
run: git submodule update --init --recursive
- name: build
run: python3 scripts/docker_build.py ${GITHUB_REF##*/} DockerfileSimulation sgxwalletsim ${GITHUB_SHA}
- name: build container for release
run: |
export BRANCH=${GITHUB_REF##*/}
echo "Branch $BRANCH"
export VERSION=$(cat VERSION)
echo "Version $VERSION"
export VERSION=$(bash ./scripts/calculate_version.sh $BRANCH $VERSION sgxwalletsim)
echo "::set-env name=VERSION::$VERSION"
echo "Version $VERSION"
bash ./scripts/build_image.sh DockerfileSimulation
- name: build container for testing
run: python3 scripts/docker_build.py DockerfileSimulation sgxwalletsim ${GITHUB_SHA}
- name: test
run: python3 scripts/docker_test.py ${GITHUB_REF##*/} DockerfileSimulation sgxwalletsim ${GITHUB_SHA}
- name: push
run: python3 scripts/docker_push.py ${GITHUB_REF##*/} DockerfileSimulation sgxwalletsim ${GITHUB_SHA}
run: python3 scripts/docker_test.py ${GITHUB_REF##*/} DockerfileSimulation sgxwalletsim
- name: deploy docker image
if: contains(github.ref, 'develop') || contains(github.ref, 'beta') || contains(github.ref, 'master') || contains(github.ref, 'stable')
run : |
export BRANCH=${GITHUB_REF##*/}
echo "Branch $BRANCH"
export VERSION=${{env.VERSION}}
echo "::set-env name=VERSION::$VERSION"
echo "Version $VERSION"
export RELEASE=true
echo "::set-env name=RELEASE::$RELEASE"
bash ./scripts/publish_image.sh DockerfileSimulation
- name: Create Release
if: contains(github.ref, 'develop') || contains(github.ref, 'beta') || contains(github.ref, 'master') || contains(github.ref, 'stable')
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: |
Changes in this Release
- First Change
- Second Change
draft: false
prerelease: true
......@@ -151,8 +151,6 @@ bool hex2carray2(const char *_hex, uint64_t *_bin_len,
bool sign(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, size_t _n, size_t _signerIndex,
char *_sig) {
//cerr << "ENTER SIGN" << endl;
auto keyStr = make_shared<string>(_encryptedKeyHex);
auto hash = make_shared<array<uint8_t, 32>>();
......@@ -168,10 +166,7 @@ bool sign(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, size_t
auto keyShare = make_shared<BLSPrivateKeyShareSGX>(keyStr, _t, _n);
//cerr << "keyShare created" << endl;
// {
auto sigShare = keyShare->signWithHelperSGX(hash, _signerIndex);
// }
auto sigShareStr = sigShare->toString();
......@@ -184,16 +179,12 @@ bool sign(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, size_t
// auto sig_ptr = make_shared<string>(test_sig);
// strncpy(_sig, sig_ptr->c_str(), BUF_LEN);
//cerr<< "sig " << _sig <<endl;
return true;
}
bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, size_t _n, size_t _signerIndex,
char *_sig) {
//cerr << "ENTER SIGN" << endl;
auto keyStr = make_shared<string>(_encryptedKeyHex);
auto hash = make_shared<array<uint8_t, 32>>();
......@@ -208,10 +199,7 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
// auto keyShare = make_shared<BLSPrivateKeyShareSGX>(keyStr, _t, _n);
//
// //cerr << "keyShare created" << endl;
// // {
// auto sigShare = keyShare->signWithHelperSGX(hash, _signerIndex);
// // }
//
// auto sigShareStr = sigShare->toString();
//
......@@ -296,8 +284,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
// auto sig_ptr = make_shared<string>(test_sig);
// strncpy(_sig, sig_ptr->c_str(), BUF_LEN);
//cerr<< "sig " << _sig <<endl;
return true;
}
......@@ -320,7 +306,6 @@ char *encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key)
unsigned int encryptedLen = 0;
//status = trustedEncryptKey(eid, errStatus, errMsg, keyArray, encryptedKey, &encryptedLen);
status = trustedEncryptKeyAES(eid, errStatus, errMsg->data(), keyArray->data(), encryptedKey->data(), &encryptedLen);
spdlog::debug("errStatus is {}", *errStatus);
......@@ -373,4 +358,4 @@ char *decryptBLSKeyShareFromHex(int *errStatus, char *errMsg, const char *_encry
return plaintextKey;
}
\ No newline at end of file
}
#define SGXWALLET_VERSION "1.49.4"
\ No newline at end of file
#define SGXWALLET_VERSION "1.49.5"
......@@ -43,7 +43,6 @@
#include "Log.h"
void setFullOptions(int _printDebugInfo,
int _printTraceInfo, int _useHTTPS, int _autoconfirm, int _encryptKeys) {
if (_printDebugInfo)
......@@ -447,13 +446,11 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
shared_ptr <string> encr_poly_ptr = readFromDb(_polyName);
verifVector = get_verif_vect(encr_poly_ptr->c_str(), _t, _n);
//cerr << "verif vect size " << verifVector.size() << endl;
for (int i = 0; i < _t; i++) {
vector <string> cur_coef = verifVector.at(i);
for (int j = 0; j < 4; j++) {
result["verificationVector"][i][j] = cur_coef.at(j);
result["Verification Vector"][i][j] = cur_coef.at(j);
}
}
......@@ -462,7 +459,6 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
result["status"] = _e.status;
result["errorMessage"] = _e.errString;
result["verificationVector"] = "";
result["Verification Vector"] = "";
}
return result;
......@@ -499,7 +495,6 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J
result["secretShare"] = s;
} catch (SGXException &_e) {
//cerr << " err str " << _e.errString << endl;
result["status"] = _e.status;
result["errorMessage"] = _e.errString;
result["secretShare"] = "";
......@@ -616,7 +611,6 @@ Json::Value SGXWalletServer::getBLSPublicKeyShareImpl(const string &_blsKeyName)
vector <string> public_key_vect = GetBLSPubKey(encryptedKeyHex_ptr->c_str());
for (uint8_t i = 0; i < 4; i++) {
result["blsPublicKeyShare"][i] = public_key_vect.at(i);
result["BlsPublicKeyShare"][i] = public_key_vect.at(i);
}
} HANDLE_SGX_EXCEPTION(result)
......@@ -639,7 +633,6 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
result["share*G2"] = *shareG2_ptr;
result["dhKey"] = DHKey;
result["DHKey"] = DHKey;
} HANDLE_SGX_EXCEPTION(result)
......@@ -666,14 +659,12 @@ Json::Value SGXWalletServer::isPolyExistsImpl(const string &_polyName) {
INIT_RESULT(result)
result["IsExist"] = false;
result["exists"] = false;
try {
std::shared_ptr <std::string> poly_str_ptr = LevelDB::getLevelDb()->readString(_polyName);
if (poly_str_ptr != nullptr) {
result["IsExist"] = true;
result["exists"] = true;
}
} HANDLE_SGX_EXCEPTION(result)
......@@ -687,6 +678,15 @@ Json::Value SGXWalletServer::getServerStatusImpl() {
return result;
}
Json::Value SGXWalletServer::getServerVersionImpl() {
INIT_RESULT(result)
result["version"] = SGXWALLET_VERSION;
return result;
}
Json::Value SGXWalletServer::generateDKGPoly(const string &_polyName, int _t) {
LOCK(m)
......@@ -785,6 +785,11 @@ Json::Value SGXWalletServer::getServerStatus() {
return getServerStatusImpl();
}
Json::Value SGXWalletServer::getServerVersion() {
LOCK(m)
return getServerVersionImpl();
}
shared_ptr <string> SGXWalletServer::readFromDb(const string &name, const string &prefix) {
auto dataStr = LevelDB::getLevelDb()->readString(prefix + name);
......
......@@ -86,6 +86,8 @@ public:
virtual Json::Value getServerStatus();
virtual Json::Value getServerVersion();
static shared_ptr<string> readFromDb(const string &name, const string &prefix = "");
static void writeDataToDB(const string &Name, const string &value);
......@@ -135,6 +137,8 @@ public:
static Json::Value getServerStatusImpl();
static Json::Value getServerVersionImpl();
static void printDB();
static int initHttpServer();
......@@ -142,4 +146,4 @@ public:
static int initHttpsServer(bool _checkCerts);
};
#endif //SGXWALLET_SGXWALLETSERVER_HPP
\ No newline at end of file
#endif //SGXWALLET_SGXWALLETSERVER_HPP
......@@ -54,7 +54,6 @@
#include "BLSCrypto.h"
#include "ServerInit.h"
#include "SGXWalletServer.hpp"
#include "SGXWALLET_VERSION"
void initUserSpace() {
libff::init_alt_bn128_params();
......
......@@ -25,6 +25,7 @@
#define SGXWALLET_SERVERINIT_H
#include "stdint.h"
#include "SGXWALLET_VERSION"
#ifdef __cplusplus
#define EXTERNC extern "C"
......
1.49
\ No newline at end of file
......@@ -56,6 +56,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
this->bindAndAddMethod(jsonrpc::Procedure("isPolyExists", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "polyName",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::isPolyExistsI);
this->bindAndAddMethod(jsonrpc::Procedure("getServerStatus", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, NULL), &AbstractStubServer::getServerStatusI);
this->bindAndAddMethod(jsonrpc::Procedure("getServerVersion", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, NULL), &AbstractStubServer::getServerVersionI);
}
inline virtual void importBLSKeyShareI(const Json::Value &request, Json::Value &response)
......@@ -133,6 +134,12 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
response = this->getServerStatus();
}
inline virtual void getServerVersionI(const Json::Value &request, Json::Value &response)
{
(void)request;
response = this->getServerVersion();
}
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;
virtual Json::Value importECDSAKey(const std::string& key, const std::string& keyName) = 0;
......@@ -152,6 +159,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
virtual Json::Value isPolyExists(const std::string& polyName) = 0;
virtual Json::Value getServerStatus() = 0;
virtual Json::Value getServerVersion() = 0;
};
#endif //JSONRPC_CPP_STUB_ABSTRACTSTUBSERVER_H_
......@@ -38,22 +38,14 @@ fi
if [[ "$1" == "-t" ]]; then
echo "Test run requested"
#./testw [bls-key-encrypt]
./testw [bls-key-encrypt-decrypt]
./testw [bls-key-encrypt]
./testw [dkg-encr-sshares]
./testw [dkg-verify]
./testw [ecdsa]
./testw [test]
./testw [get-pub-ecdsa-key]
./testw [bls-dkg]
./testw [api]
./testw [get-server-status]
./testw [many-threads]
./testw [ecsa-api]
./testw [dkg-api]
./testw [is-poly
#./testw [bls-sign]
./testw [dkg-poly-exists]
./testw [aes-encrypt-decrypt]
./testw [get-server-version]
else
./sgxwallet $1 $2 $3 $4
fi
......
......@@ -133,10 +133,10 @@ os.chdir(topDir)
assert subprocess.call(["cp", "sgx_tgmp.h", TGMP_BUILD_DIR + "/include/sgx_tgmp.h"]) == 0
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)
#assert subprocess.call(["make", "SGX_SDK=" + SGX_SDK_DIR_SSL, "all", "test"]) == 0
assert subprocess.call(["make", "SGX_SDK=" + SGX_SDK_DIR_SSL, "all" ]) == 0
......
#!/usr/bin/env bash
set -e
DOCKERFILE=$1
: "${VERSION?Need to set VERSION}"
: "${BRANCH?Need to set BRANCH}"
NAME=sgx
REPO_NAME=skalenetwork/$NAME
IMAGE_NAME=$REPO_NAME:$VERSION
LATEST_IMAGE_NAME=$REPO_NAME:$BRANCH-latest
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Build image
echo "Building $IMAGE_NAME..."
docker build -f "${DIR}"/../"${DOCKERFILE}" -t "${IMAGE_NAME}" . || exit $?
docker tag "${IMAGE_NAME}" "${LATEST_IMAGE_NAME}"
echo "========================================================================================="
echo "Built $IMAGE_NAME"
\ No newline at end of file
#!/bin/bash
BRANCH=$1
VERSION=$2
CONTAINER=$3
if [ -z "$BRANCH" ]
then
echo "A branch is not set."
exit 1
fi
if [ -z "$VERSION" ]
then
echo "The base version is not set."
exit 1
fi
if [ -z "$CONTAINER" ]
then
echo "The base container is not set."
exit 1
fi
git fetch --tags
if [ "$BRANCH" = "master" ]
then
echo "$VERSION"
exit 0
fi
LABEL="develop"
if [ "$BRANCH" = "stable" ]
then
LABEL="stable"
elif [ "$BRANCH" = "beta" ]
then
LABEL="beta"
fi
for (( VERSION_NUMBER=0; ; VERSION_NUMBER++ ))
do
if [ "$VERSION" = "1.49" ] && [ "$VERSION_NUMBER" -le 4 ]
then
VERSION_NUMBER=4
fi
RESULT_VERSION="$CONTAINER.$VERSION-$LABEL.$VERSION_NUMBER"
if ! [ $(git tag -l ?$RESULT_VERSION) ]
then
echo "$RESULT_VERSION"
break
fi
done
......@@ -50,24 +50,17 @@ import sys, os, subprocess, time
os.chdir("..")
topDir = os.getcwd() + "/sgxwallet"
BRANCH = sys.argv[1]
DOCKER_FILE_NAME = sys.argv[2]
IMAGE_NAME = sys.argv[3]
COMMIT_HASH = sys.argv[4]
if (BRANCH == "develop"):
TAG_POSTFIX = "latest"
else:
TAG_POSTFIX = "latest_commit"
DOCKER_FILE_NAME = sys.argv[1]
IMAGE_NAME = sys.argv[2]
COMMIT_HASH = sys.argv[3]
TAG_POSTFIX = "latest_commit"
FULL_IMAGE_TAG = "skalenetwork/" + IMAGE_NAME + ":" + TAG_POSTFIX
COMMIT_HASH_TAG = "skalenetwork/" + IMAGE_NAME + ":" + COMMIT_HASH
print("Starting build for branch " + BRANCH, flush=True)
print("Starting build", flush=True)
assert subprocess.call(["pwd"]) == 0
assert subprocess.call(["docker", "build", topDir, "--file", topDir + "/" + DOCKER_FILE_NAME, "--tag",
FULL_IMAGE_TAG]) == 0
if (BRANCH == "develop"):
assert subprocess.call(["docker", "tag", FULL_IMAGE_TAG, COMMIT_HASH_TAG]) == 0
FULL_IMAGE_TAG]) == 0
\ No newline at end of file
#!/usr/bin/env python
# ------------------------------------------------------------------------------
# Bash script to build cpp-ethereum within TravisCI.
#
# The documentation for cpp-ethereum is hosted at http://cpp-ethereum.org
#
# ------------------------------------------------------------------------------
# This file is part of cpp-ethereum.
#
# cpp-ethereum is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cpp-ethereum is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>
#
# (c) 2016 cpp-ethereum contributors.
# ------------------------------------------------------------------------------
#
# Copyright (C) 2019-Present SKALE Labs
#
# This file is part of sgxwallet.
#
# sgxwallet is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# sgxwallet is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with sgxwallet. If not, see <https://www.gnu.org/licenses/>.
#
# @file docker_push.py
# @author Stan Kladko
# @date 2020
#
import sys, os, subprocess, time
os.chdir("..")
topDir = os.getcwd() + "/sgxwallet"
print("Starting build push")
print("Top directory is:" + topDir)
SCRIPTS_DIR = topDir + "/scripts"
BRANCH = sys.argv[1];
DOCKER_FILE_NAME = sys.argv[2];
IMAGE_NAME = sys.argv[3];
COMMIT_HASH = sys.argv[4]
if (BRANCH == "develop") :
TAG_POSTFIX = "latest";
else :
TAG_POSTFIX = "latest_commit"
FULL_IMAGE_NAME = "skalenetwork/" + IMAGE_NAME +":" + TAG_POSTFIX;
assert subprocess.call(["docker", "push", "skalenetwork/" + IMAGE_NAME]) == 0;
......@@ -24,21 +24,14 @@
import sys, os, subprocess, socket, time
os.chdir("..")
topDir = os.getcwd() + "/sgxwallet"
print("Starting containerb test")
print("Starting container test")
print("Top directory is:" + topDir)
SCRIPTS_DIR = topDir + "/scripts"
BRANCH = sys.argv[1];
DOCKER_FILE_NAME = sys.argv[2];
IMAGE_NAME = sys.argv[3];
COMMIT_HASH = sys.argv[4]
IMAGE_NAME = sys.argv[3]
if (BRANCH == "develop") :
TAG_POSTFIX = "latest";
......
#!/usr/bin/env bash
set -e
DOCKERFILE=$1
: "${VERSION?Need to set VERSION}"
: "${BRANCH?Need to set BRANCH}"
NAME=sgx
REPO_NAME=skalenetwork/$NAME
IMAGE_NAME=$REPO_NAME:$VERSION
LATEST_IMAGE_NAME=$REPO_NAME:$BRANCH-latest
: "${DOCKER_USERNAME?Need to set DOCKER_USERNAME}"
: "${DOCKER_PASSWORD?Need to set DOCKER_PASSWORD}"
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
docker push "$IMAGE_NAME" || exit $?
docker push "$LATEST_IMAGE_NAME" || exit $?
......@@ -179,7 +179,7 @@ int calc_secret_share(const char* decrypted_coeffs, char * s_share,
}
libff::alt_bn128_Fr secret_share = PolynomialValue(poly, libff::alt_bn128_Fr(ind), _t);
string cur_share = ConvertToString(secret_share, 16);//stringFromFr(secret_share);
string cur_share = ConvertToString(secret_share, 16);
int n_zeroes = 64 - cur_share.size();
cur_share.insert(0, n_zeroes, '0');
......
......@@ -667,8 +667,6 @@ void trustedGetEncryptedSecretShare(int *errStatus, char *errString, uint8_t *en
memset(pub_key_x, 0, BUF_LEN);
char pub_key_y[BUF_LEN];
memset(pub_key_y, 0, BUF_LEN);
//char *pub_key_x = (char *)calloc(1024, 1);
// char *pub_key_y = (char *)calloc(1024, 1);
uint32_t enc_len;
......
......@@ -249,16 +249,26 @@ class StubClient : public jsonrpc::Client
}
Json::Value getServerStatus()
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->CallMethod("getServerStatus",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value getServerStatus()
{
Json::Value p;
p = Json::nullValue;
Json::Value result = this->CallMethod("getServerStatus",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value getServerVersion() {
Json::Value p;
p = Json::nullValue;
Json::Value result = this->CallMethod("getServerVersion",p);
if (result.isObject())
return result;
else
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
};
......
......@@ -773,6 +773,13 @@ TEST_CASE_METHOD(TestFixture, "Get ServerStatus", "[get-server-status]") {
}
TEST_CASE_METHOD(TestFixture, "Get ServerVersion", "[get-server-version]") {
HttpClient client(RPC_ENDPOINT);
StubClient c(client, JSONRPC_CLIENT_V2);
REQUIRE(c.getServerVersion()["version"] == SGXWALLET_VERSION);
}
TEST_CASE_METHOD(TestFixtureHTTPS, "Cert request sign", "[cert-sign]") {
REQUIRE(SGXRegistrationServer::getServer() != nullptr);
......@@ -875,11 +882,11 @@ TEST_CASE_METHOD(TestFixture, "PolyExists test", "[dkg-poly-exists]") {
Json::Value polyExists = c.isPolyExists(polyName);
REQUIRE(polyExists["exists"].asBool());
REQUIRE(polyExists["IsExist"].asBool());
Json::Value polyDoesNotExist = c.isPolyExists("Vasya");
REQUIRE(!polyDoesNotExist["exists"].asBool());
REQUIRE(!polyDoesNotExist["IsExist"].asBool());
}
......
......@@ -37,6 +37,7 @@ print("Top directory is:" + topDir)
testList = [ "[cert-sign]",
"[get-server-status]",
"[get-server-version]",
"[ecdsa-key-gen]",
"[ecdsa-key-sig-gen]",
"[ecdsa-get-pub-key]",
......
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