Unverified Commit 8d95c501 authored by kladko's avatar kladko

SKALE-3481-NIGHTLY

parent 359a1912
...@@ -545,6 +545,8 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string ...@@ -545,6 +545,8 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
shared_ptr <string> encryptedKeyHex_ptr = readFromDb(_ethKeyName); shared_ptr <string> encryptedKeyHex_ptr = readFromDb(_ethKeyName);
CHECK_STATE(encryptedKeyHex_ptr);
bool res = createBLSShare(_blsKeyName, _secretShare.c_str(), encryptedKeyHex_ptr->c_str()); bool res = createBLSShare(_blsKeyName, _secretShare.c_str(), encryptedKeyHex_ptr->c_str());
if (res) { if (res) {
spdlog::info("BLS KEY SHARE CREATED "); spdlog::info("BLS KEY SHARE CREATED ");
...@@ -552,6 +554,7 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string ...@@ -552,6 +554,7 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
throw SGXException(-122, "Error while creating BLS key share"); throw SGXException(-122, "Error while creating BLS key share");
} }
for (int i = 0; i < _n; i++) { for (int i = 0; i < _n; i++) {
string name = _polyName + "_" + to_string(i) + ":"; string name = _polyName + "_" + to_string(i) + ":";
LevelDB::getLevelDb()->deleteDHDKGKey(name); LevelDB::getLevelDb()->deleteDHDKGKey(name);
...@@ -560,6 +563,7 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string ...@@ -560,6 +563,7 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
} }
LevelDB::getLevelDb()->deleteKey(_polyName); LevelDB::getLevelDb()->deleteKey(_polyName);
string encryptedSecretShareName = "encryptedSecretShare:" + _polyName; string encryptedSecretShareName = "encryptedSecretShare:" + _polyName;
LevelDB::getLevelDb()->deleteKey(encryptedSecretShareName); LevelDB::getLevelDb()->deleteKey(encryptedSecretShareName);
...@@ -848,9 +852,9 @@ void SGXWalletServer::writeKeyShare(const string &_keyShareName, const string &_ ...@@ -848,9 +852,9 @@ void SGXWalletServer::writeKeyShare(const string &_keyShareName, const string &_
} }
void SGXWalletServer::writeDataToDB(const string &name, const string &value) { void SGXWalletServer::writeDataToDB(const string &name, const string &value) {
if (LevelDB::getLevelDb()->readString(name) != nullptr) { if (LevelDB::getLevelDb()->readString(name) != nullptr) {
throw SGXException(KEY_NAME_ALREADY_EXISTS, "Name already exists"); throw SGXException(KEY_NAME_ALREADY_EXISTS, "Name already exists");
} }
LevelDB::getLevelDb()->writeString(name, value); LevelDB::getLevelDb()->writeString(name, value);
} }
...@@ -247,7 +247,7 @@ void TestUtils::sendRPCRequest() { ...@@ -247,7 +247,7 @@ void TestUtils::sendRPCRequest() {
Json::Value blsPublicKeys; Json::Value blsPublicKeys;
for (int i6 = 0; i6 < 2; i6++) { for (int i6 = 0; i6 < 1; i6++) {
blsPublicKeys = c.calculateAllBLSPublicKeys(publicShares, t, n); blsPublicKeys = c.calculateAllBLSPublicKeys(publicShares, t, n);
CHECK_STATE(blsPublicKeys["status"] == 0); CHECK_STATE(blsPublicKeys["status"] == 0);
} }
...@@ -257,9 +257,14 @@ void TestUtils::sendRPCRequest() { ...@@ -257,9 +257,14 @@ void TestUtils::sendRPCRequest() {
string blsName = "BLS_KEY" + polyNames[i].substr(4); string blsName = "BLS_KEY" + polyNames[i].substr(4);
string secretShare = secretShares[i]["secretShare"].asString(); string secretShare = secretShares[i]["secretShare"].asString();
auto response = c.createBLSPrivateKey(blsName, ethKeys[i]["keyName"].asString(), polyNames[i], secShares[i], t, n);
auto response = c.createBLSPrivateKey(blsName, ethKeys[i]["keyName"].asString(), polyNames[i], secShares[i],
t, n);
CHECK_STATE(response["status"] == 0); CHECK_STATE(response["status"] == 0);
pubBLSKeys[i] = c.getBLSPublicKeyShare(blsName);
for (int i7 = 0; i7 < 10000; i7++) {
pubBLSKeys[i] = c.getBLSPublicKeyShare(blsName);
}
CHECK_STATE(pubBLSKeys[i]["status"] == 0); CHECK_STATE(pubBLSKeys[i]["status"] == 0);
libff::alt_bn128_G2 publicKey(libff::alt_bn128_Fq2(libff::alt_bn128_Fq(pubBLSKeys[i]["blsPublicKeyShare"][0].asCString()), libff::alt_bn128_G2 publicKey(libff::alt_bn128_Fq2(libff::alt_bn128_Fq(pubBLSKeys[i]["blsPublicKeyShare"][0].asCString()),
......
<EnclaveConfiguration> <EnclaveConfiguration>
<ProdID>0</ProdID> <ProdID>0</ProdID>
<ISVSVN>1</ISVSVN> <ISVSVN>1</ISVSVN>
<StackMaxSize>0x100000</StackMaxSize> <StackMaxSize>0x200000</StackMaxSize>
<HeapMaxSize>0x200000</HeapMaxSize> <HeapMaxSize>0x200000</HeapMaxSize>
<TCSNum>16</TCSNum> <TCSNum>16</TCSNum>
<TCSMaxNum>16</TCSMaxNum> <TCSMaxNum>16</TCSMaxNum>
......
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