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
23fdca39
Unverified
Commit
23fdca39
authored
Aug 02, 2021
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-4262 add more logs
parent
11917044
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
docker-compose.yml
run_sgx_sim/docker-compose.yml
+1
-1
ReqMessage.cpp
zmq_src/ReqMessage.cpp
+14
-0
No files found.
run_sgx_sim/docker-compose.yml
View file @
23fdca39
version
:
'
3'
version
:
'
3'
services
:
services
:
sgxwallet
:
sgxwallet
:
image
:
skalenetwork/sgxwallet_sim:
develop-latest
image
:
skalenetwork/sgxwallet_sim:
119170448fe6ebece3782ed7e17bdd563ce9b6a5
restart
:
unless-stopped
restart
:
unless-stopped
ports
:
ports
:
-
"
1026:1026"
-
"
1026:1026"
...
...
zmq_src/ReqMessage.cpp
View file @
23fdca39
...
@@ -26,12 +26,14 @@
...
@@ -26,12 +26,14 @@
#include "ReqMessage.h"
#include "ReqMessage.h"
#include "third_party/spdlog/spdlog.h"
Json
::
Value
ECDSASignReqMessage
::
process
()
{
Json
::
Value
ECDSASignReqMessage
::
process
()
{
auto
base
=
getInt64Rapid
(
"base"
);
auto
base
=
getInt64Rapid
(
"base"
);
auto
keyName
=
getStringRapid
(
"keyName"
);
auto
keyName
=
getStringRapid
(
"keyName"
);
auto
hash
=
getStringRapid
(
"messageHash"
);
auto
hash
=
getStringRapid
(
"messageHash"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
)))
{
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
keyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
auto
result
=
SGXWalletServer
::
ecdsaSignMessageHashImpl
(
base
,
keyName
,
hash
);
auto
result
=
SGXWalletServer
::
ecdsaSignMessageHashImpl
(
base
,
keyName
,
hash
);
...
@@ -45,6 +47,7 @@ Json::Value BLSSignReqMessage::process() {
...
@@ -45,6 +47,7 @@ Json::Value BLSSignReqMessage::process() {
auto
t
=
getInt64Rapid
(
"t"
);
auto
t
=
getInt64Rapid
(
"t"
);
auto
n
=
getInt64Rapid
(
"n"
);
auto
n
=
getInt64Rapid
(
"n"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
)))
{
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
keyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
auto
result
=
SGXWalletServer
::
blsSignMessageHashImpl
(
keyName
,
hash
,
t
,
n
);
auto
result
=
SGXWalletServer
::
blsSignMessageHashImpl
(
keyName
,
hash
,
t
,
n
);
...
@@ -57,6 +60,7 @@ Json::Value importBLSReqMessage::process() {
...
@@ -57,6 +60,7 @@ Json::Value importBLSReqMessage::process() {
auto
keyShare
=
getStringRapid
(
"keyShare"
);
auto
keyShare
=
getStringRapid
(
"keyShare"
);
auto
result
=
SGXWalletServer
::
importBLSKeyShareImpl
(
keyShare
,
keyName
);
auto
result
=
SGXWalletServer
::
importBLSKeyShareImpl
(
keyShare
,
keyName
);
if
(
checkKeyOwnership
&&
result
[
"status"
]
==
0
)
{
if
(
checkKeyOwnership
&&
result
[
"status"
]
==
0
)
{
spdlog
::
info
(
"Cert {} creates key {}"
,
getStringRapid
(
"cert"
),
keyName
);
auto
cert
=
getStringRapid
(
"cert"
);
auto
cert
=
getStringRapid
(
"cert"
);
addKeyByOwner
(
keyName
,
cert
);
addKeyByOwner
(
keyName
,
cert
);
}
}
...
@@ -90,6 +94,7 @@ Json::Value generateECDSAReqMessage::process() {
...
@@ -90,6 +94,7 @@ Json::Value generateECDSAReqMessage::process() {
Json
::
Value
getPublicECDSAReqMessage
::
process
()
{
Json
::
Value
getPublicECDSAReqMessage
::
process
()
{
auto
keyName
=
getStringRapid
(
"keyName"
);
auto
keyName
=
getStringRapid
(
"keyName"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
)))
{
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
keyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
keyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
auto
result
=
SGXWalletServer
::
getPublicECDSAKeyImpl
(
keyName
);
auto
result
=
SGXWalletServer
::
getPublicECDSAKeyImpl
(
keyName
);
...
@@ -103,6 +108,7 @@ Json::Value generateDKGPolyReqMessage::process() {
...
@@ -103,6 +108,7 @@ Json::Value generateDKGPolyReqMessage::process() {
auto
result
=
SGXWalletServer
::
generateDKGPolyImpl
(
polyName
,
t
);
auto
result
=
SGXWalletServer
::
generateDKGPolyImpl
(
polyName
,
t
);
if
(
checkKeyOwnership
&&
result
[
"status"
]
==
0
)
{
if
(
checkKeyOwnership
&&
result
[
"status"
]
==
0
)
{
auto
cert
=
getStringRapid
(
"cert"
);
auto
cert
=
getStringRapid
(
"cert"
);
spdlog
::
info
(
"Cert {} creates key {}"
,
cert
,
polyName
);
addKeyByOwner
(
polyName
,
cert
);
addKeyByOwner
(
polyName
,
cert
);
}
}
result
[
"type"
]
=
ZMQMessage
::
GENERATE_DKG_POLY_RSP
;
result
[
"type"
]
=
ZMQMessage
::
GENERATE_DKG_POLY_RSP
;
...
@@ -112,6 +118,7 @@ Json::Value generateDKGPolyReqMessage::process() {
...
@@ -112,6 +118,7 @@ Json::Value generateDKGPolyReqMessage::process() {
Json
::
Value
getVerificationVectorReqMessage
::
process
()
{
Json
::
Value
getVerificationVectorReqMessage
::
process
()
{
auto
polyName
=
getStringRapid
(
"polyName"
);
auto
polyName
=
getStringRapid
(
"polyName"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
polyName
,
getStringRapid
(
"cert"
)))
{
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
polyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
polyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
auto
t
=
getInt64Rapid
(
"t"
);
auto
t
=
getInt64Rapid
(
"t"
);
...
@@ -126,6 +133,7 @@ Json::Value getSecretShareReqMessage::process() {
...
@@ -126,6 +133,7 @@ Json::Value getSecretShareReqMessage::process() {
auto
n
=
getInt64Rapid
(
"n"
);
auto
n
=
getInt64Rapid
(
"n"
);
auto
pubKeys
=
getJsonValueRapid
(
"publicKeys"
);
auto
pubKeys
=
getJsonValueRapid
(
"publicKeys"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
polyName
,
getStringRapid
(
"cert"
)))
{
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
polyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
polyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
auto
result
=
SGXWalletServer
::
getSecretShareV2Impl
(
polyName
,
pubKeys
,
t
,
n
);
auto
result
=
SGXWalletServer
::
getSecretShareV2Impl
(
polyName
,
pubKeys
,
t
,
n
);
...
@@ -141,6 +149,7 @@ Json::Value dkgVerificationReqMessage::process() {
...
@@ -141,6 +149,7 @@ Json::Value dkgVerificationReqMessage::process() {
auto
pubShares
=
getStringRapid
(
"publicShares"
);
auto
pubShares
=
getStringRapid
(
"publicShares"
);
auto
secretShare
=
getStringRapid
(
"secretShare"
);
auto
secretShare
=
getStringRapid
(
"secretShare"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
ethKeyName
,
getStringRapid
(
"cert"
)))
{
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
ethKeyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
ethKeyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
auto
result
=
SGXWalletServer
::
dkgVerificationV2Impl
(
pubShares
,
ethKeyName
,
secretShare
,
t
,
n
,
idx
);
auto
result
=
SGXWalletServer
::
dkgVerificationV2Impl
(
pubShares
,
ethKeyName
,
secretShare
,
t
,
n
,
idx
);
...
@@ -156,10 +165,12 @@ Json::Value createBLSPrivateKeyReqMessage::process() {
...
@@ -156,10 +165,12 @@ Json::Value createBLSPrivateKeyReqMessage::process() {
auto
t
=
getInt64Rapid
(
"t"
);
auto
t
=
getInt64Rapid
(
"t"
);
auto
n
=
getInt64Rapid
(
"n"
);
auto
n
=
getInt64Rapid
(
"n"
);
if
(
checkKeyOwnership
&&
(
!
isKeyByOwner
(
ethKeyName
,
getStringRapid
(
"cert"
))
||
!
isKeyByOwner
(
polyName
,
getStringRapid
(
"cert"
))))
{
if
(
checkKeyOwnership
&&
(
!
isKeyByOwner
(
ethKeyName
,
getStringRapid
(
"cert"
))
||
!
isKeyByOwner
(
polyName
,
getStringRapid
(
"cert"
))))
{
spdlog
::
error
(
"Cert {} try to access keys {} {} which do not belong to it"
,
getStringRapid
(
"cert"
),
ethKeyName
,
polyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
auto
result
=
SGXWalletServer
::
createBLSPrivateKeyV2Impl
(
blsKeyName
,
ethKeyName
,
polyName
,
secretShare
,
t
,
n
);
auto
result
=
SGXWalletServer
::
createBLSPrivateKeyV2Impl
(
blsKeyName
,
ethKeyName
,
polyName
,
secretShare
,
t
,
n
);
if
(
checkKeyOwnership
&&
result
[
"status"
]
==
0
)
{
if
(
checkKeyOwnership
&&
result
[
"status"
]
==
0
)
{
spdlog
::
info
(
"Cert {} creates key {}"
,
getStringRapid
(
"cert"
),
blsKeyName
);
addKeyByOwner
(
blsKeyName
,
getStringRapid
(
"cert"
));
addKeyByOwner
(
blsKeyName
,
getStringRapid
(
"cert"
));
}
}
result
[
"type"
]
=
ZMQMessage
::
CREATE_BLS_PRIVATE_RSP
;
result
[
"type"
]
=
ZMQMessage
::
CREATE_BLS_PRIVATE_RSP
;
...
@@ -169,6 +180,7 @@ Json::Value createBLSPrivateKeyReqMessage::process() {
...
@@ -169,6 +180,7 @@ Json::Value createBLSPrivateKeyReqMessage::process() {
Json
::
Value
getBLSPublicReqMessage
::
process
()
{
Json
::
Value
getBLSPublicReqMessage
::
process
()
{
auto
blsKeyName
=
getStringRapid
(
"blsKeyName"
);
auto
blsKeyName
=
getStringRapid
(
"blsKeyName"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
blsKeyName
,
getStringRapid
(
"cert"
)))
{
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
blsKeyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
blsKeyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
auto
result
=
SGXWalletServer
::
getBLSPublicKeyShareImpl
(
blsKeyName
);
auto
result
=
SGXWalletServer
::
getBLSPublicKeyShareImpl
(
blsKeyName
);
...
@@ -191,6 +203,7 @@ Json::Value complaintResponseReqMessage::process() {
...
@@ -191,6 +203,7 @@ Json::Value complaintResponseReqMessage::process() {
auto
n
=
getInt64Rapid
(
"n"
);
auto
n
=
getInt64Rapid
(
"n"
);
auto
idx
=
getInt64Rapid
(
"ind"
);
auto
idx
=
getInt64Rapid
(
"ind"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
polyName
,
getStringRapid
(
"cert"
)))
{
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
polyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
polyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
auto
result
=
SGXWalletServer
::
complaintResponseImpl
(
polyName
,
t
,
n
,
idx
);
auto
result
=
SGXWalletServer
::
complaintResponseImpl
(
polyName
,
t
,
n
,
idx
);
...
@@ -227,6 +240,7 @@ Json::Value getServerVersionReqMessage::process() {
...
@@ -227,6 +240,7 @@ Json::Value getServerVersionReqMessage::process() {
Json
::
Value
deleteBLSKeyReqMessage
::
process
()
{
Json
::
Value
deleteBLSKeyReqMessage
::
process
()
{
auto
blsKeyName
=
getStringRapid
(
"blsKeyName"
);
auto
blsKeyName
=
getStringRapid
(
"blsKeyName"
);
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
blsKeyName
,
getStringRapid
(
"cert"
)))
{
if
(
checkKeyOwnership
&&
!
isKeyByOwner
(
blsKeyName
,
getStringRapid
(
"cert"
)))
{
spdlog
::
error
(
"Cert {} try to access key {} which does not belong to it"
,
getStringRapid
(
"cert"
),
blsKeyName
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
throw
std
::
invalid_argument
(
"Only owner of the key can access it"
);
}
}
auto
result
=
SGXWalletServer
::
deleteBlsKeyImpl
(
blsKeyName
);
auto
result
=
SGXWalletServer
::
deleteBlsKeyImpl
(
blsKeyName
);
...
...
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