Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
sgxwallet
Commits
091f6851
Unverified
Commit
091f6851
authored
Oct 02, 2020
by
Oleh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3334 fix complaintResponse function
parent
1c1c6383
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
16 deletions
+17
-16
SGXWalletServer.cpp
SGXWalletServer.cpp
+9
-10
SGXWalletServer.hpp
SGXWalletServer.hpp
+1
-1
abstractstubserver.h
abstractstubserver.h
+3
-3
stubclient.h
stubclient.h
+3
-1
testw.cpp
testw.cpp
+1
-1
No files found.
SGXWalletServer.cpp
View file @
091f6851
...
...
@@ -586,7 +586,7 @@ Json::Value SGXWalletServer::calculateAllBLSPublicKeysImpl(const Json::Value& pu
RETURN_SUCCESS
(
result
);
}
Json
::
Value
SGXWalletServer
::
complaintResponseImpl
(
const
string
&
_polyName
,
int
_ind
)
{
Json
::
Value
SGXWalletServer
::
complaintResponseImpl
(
const
string
&
_polyName
,
int
_
t
,
int
_n
,
int
_
ind
)
{
spdlog
::
info
(
"Entering {}"
,
__FUNCTION__
);
INIT_RESULT
(
result
)
...
...
@@ -614,13 +614,12 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
}
}
// TODO: delete dh keys
// for (int i = 0; i < _n; i++) {
// string name = _polyName + "_" + to_string(i) + ":";
// LevelDB::getLevelDb()->deleteDHDKGKey(name);
// string shareG2_name = "shareG2_" + _polyName + "_" + to_string(i) + ":";
// LevelDB::getLevelDb()->deleteKey(shareG2_name);
// }
for
(
int
i
=
0
;
i
<
_n
;
i
++
)
{
string
name
=
_polyName
+
"_"
+
to_string
(
i
)
+
":"
;
LevelDB
::
getLevelDb
()
->
deleteDHDKGKey
(
name
);
string
shareG2_name
=
"shareG2_"
+
_polyName
+
"_"
+
to_string
(
i
)
+
":"
;
LevelDB
::
getLevelDb
()
->
deleteKey
(
shareG2_name
);
}
LevelDB
::
getLevelDb
()
->
deleteKey
(
_polyName
);
string
encryptedSecretShareName
=
"encryptedSecretShare:"
+
_polyName
;
...
...
@@ -748,8 +747,8 @@ Json::Value SGXWalletServer::blsSignMessageHash(const string &_keyShareName, con
return
blsSignMessageHashImpl
(
_keyShareName
,
_messageHash
,
_t
,
_n
);
}
Json
::
Value
SGXWalletServer
::
complaintResponse
(
const
string
&
polyName
,
int
ind
)
{
return
complaintResponseImpl
(
polyName
,
ind
);
Json
::
Value
SGXWalletServer
::
complaintResponse
(
const
string
&
polyName
,
int
t
,
int
n
,
int
ind
)
{
return
complaintResponseImpl
(
polyName
,
t
,
n
,
ind
);
}
Json
::
Value
SGXWalletServer
::
multG2
(
const
string
&
x
)
{
...
...
SGXWalletServer.hpp
View file @
091f6851
...
...
@@ -76,7 +76,7 @@ public:
virtual
Json
::
Value
calculateAllBLSPublicKeys
(
const
Json
::
Value
&
publicShares
,
int
t
,
int
n
);
virtual
Json
::
Value
complaintResponse
(
const
string
&
polyName
,
int
ind
);
virtual
Json
::
Value
complaintResponse
(
const
string
&
polyName
,
int
t
,
int
n
,
int
ind
);
virtual
Json
::
Value
multG2
(
const
string
&
x
);
...
...
abstractstubserver.h
View file @
091f6851
...
...
@@ -50,7 +50,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"createBLSPrivateKey"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"blsKeyName"
,
jsonrpc
::
JSON_STRING
,
"ethKeyName"
,
jsonrpc
::
JSON_STRING
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
"secretShare"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
createBLSPrivateKeyI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"getBLSPublicKeyShare"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"blsKeyName"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
getBLSPublicKeyShareI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"calculateAllBLSPublicKeys"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"publicShares"
,
jsonrpc
::
JSON_ARRAY
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
calculateAllBLSPublicKeysI
);
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
(
"complaintResponse"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
"
t"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
"
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
(
"isPolyExists"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
isPolyExistsI
);
...
...
@@ -111,7 +111,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
}
inline
virtual
void
complaintResponseI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
response
=
this
->
complaintResponse
(
request
[
"polyName"
].
asString
(),
request
[
"ind"
].
asInt
());
response
=
this
->
complaintResponse
(
request
[
"polyName"
].
asString
(),
request
[
"
t"
].
asInt
(),
request
[
"n"
].
asInt
(),
request
[
"
ind"
].
asInt
());
}
inline
virtual
void
multG2I
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
...
...
@@ -152,7 +152,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
virtual
Json
::
Value
createBLSPrivateKey
(
const
std
::
string
&
blsKeyName
,
const
std
::
string
&
ethKeyName
,
const
std
::
string
&
polyName
,
const
std
::
string
&
SecretShare
,
int
t
,
int
n
)
=
0
;
virtual
Json
::
Value
getBLSPublicKeyShare
(
const
std
::
string
&
blsKeyName
)
=
0
;
virtual
Json
::
Value
calculateAllBLSPublicKeys
(
const
Json
::
Value
&
publicShares
,
int
t
,
int
n
)
=
0
;
virtual
Json
::
Value
complaintResponse
(
const
std
::
string
&
polyName
,
int
ind
)
=
0
;
virtual
Json
::
Value
complaintResponse
(
const
std
::
string
&
polyName
,
int
t
,
int
n
,
int
ind
)
=
0
;
virtual
Json
::
Value
multG2
(
const
std
::
string
&
x
)
=
0
;
virtual
Json
::
Value
isPolyExists
(
const
std
::
string
&
polyName
)
=
0
;
...
...
stubclient.h
View file @
091f6851
...
...
@@ -171,10 +171,12 @@ class StubClient : public jsonrpc::Client
throw
jsonrpc
::
JsonRpcException
(
jsonrpc
::
Errors
::
ERROR_CLIENT_INVALID_RESPONSE
,
result
.
toStyledString
());
}
Json
::
Value
complaintResponse
(
const
std
::
string
&
polyName
,
int
ind
)
Json
::
Value
complaintResponse
(
const
std
::
string
&
polyName
,
int
t
,
int
n
,
int
ind
)
{
Json
::
Value
p
;
p
[
"polyName"
]
=
polyName
;
p
[
"t"
]
=
t
;
p
[
"n"
]
=
n
;
p
[
"ind"
]
=
ind
;
Json
::
Value
result
=
this
->
CallMethod
(
"complaintResponse"
,
p
);
if
(
result
.
isObject
())
...
...
testw.cpp
View file @
091f6851
...
...
@@ -643,7 +643,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG test", "[aes-dkg]") {
REQUIRE
(
res
);
}
Json
::
Value
complaintResponse
=
c
.
complaintResponse
(
polyNames
[
1
],
0
);
Json
::
Value
complaintResponse
=
c
.
complaintResponse
(
polyNames
[
1
],
t
,
n
,
0
);
REQUIRE
(
complaintResponse
[
"status"
]
==
0
);
BLSSigShareSet
sigShareSet
(
t
,
n
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment