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
d09a4f4c
Unverified
Commit
d09a4f4c
authored
Jan 14, 2021
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug/SKALE-3751-enable-zeromq
parent
7483a230
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
2 deletions
+52
-2
ZMQClient.cpp
ZMQClient.cpp
+5
-0
ZMQMessage.cpp
ZMQMessage.cpp
+7
-0
ZMQServer.cpp
ZMQServer.cpp
+1
-1
testw.cpp
testw.cpp
+34
-0
testw.h
testw.h
+3
-0
testw.py
testw.py
+2
-1
No files found.
ZMQClient.cpp
View file @
d09a4f4c
...
...
@@ -42,6 +42,11 @@ shared_ptr <ZMQMessage> ZMQClient::doRequestReply(Json::Value &_req) {
string
ZMQClient
::
doZmqRequestReply
(
string
&
_req
)
{
stringstream
request
;
if
(
!
clientSocket
)
reconnect
();
CHECK_STATE
(
clientSocket
);
s_send
(
*
clientSocket
,
_req
);
while
(
true
)
{
...
...
ZMQMessage.cpp
View file @
d09a4f4c
...
...
@@ -48,6 +48,7 @@ string ZMQMessage::getStringRapid(const char *_name) {
shared_ptr
<
ZMQMessage
>
ZMQMessage
::
parse
(
vector
<
uint8_t
>
&
_msg
,
bool
_isRequest
)
{
return
parse
((
const
char
*
)
_msg
.
data
(),
_msg
.
size
(),
_isRequest
);
}
...
...
@@ -62,15 +63,21 @@ shared_ptr <ZMQMessage> ZMQMessage::parse(const char* _msg,
auto
d
=
make_shared
<
rapidjson
::
Document
>
();
d
->
Parse
(
_msg
);
CHECK_STATE
(
!
d
->
HasParseError
());
CHECK_STATE
(
d
->
IsObject
())
CHECK_STATE
(
d
->
HasMember
(
"type"
));
CHECK_STATE
((
*
d
)[
"type"
].
IsString
());
string
type
=
(
*
d
)[
"type"
].
GetString
();
shared_ptr
<
ZMQMessage
>
result
;
if
(
_isRequest
)
{
...
...
ZMQServer.cpp
View file @
d09a4f4c
...
...
@@ -43,7 +43,7 @@ void ZMQServer::run() {
spdlog
::
info
(
"Starting zmq server ..."
);
try
{
frontend_
.
bind
(
"tcp://*:"
+
to_string
(
BASE_PORT
+
4
));
frontend_
.
bind
(
"tcp://*:"
+
to_string
(
BASE_PORT
+
5
));
}
catch
(...)
{
spdlog
::
error
(
"Server task could not bind to port:{}"
,
port
);
exit
(
-
100
);
...
...
testw.cpp
View file @
d09a4f4c
...
...
@@ -57,6 +57,7 @@
#include "SGXRegistrationServer.h"
#include "SGXWalletServer.h"
#include "ZMQClient.h"
#include "sgxwallet.h"
#include "TestUtils.h"
#include "testw.h"
...
...
@@ -1123,5 +1124,38 @@ TEST_CASE_METHOD(TestFixtureNoReset, "Second run", "[second-run]") {
}
TEST_CASE_METHOD
(
TestFixtureNoReset
,
"ZMQ-ecdsa"
,
"[zmq-ecdsa-run]"
)
{
HttpClient
htp
(
RPC_ENDPOINT
);
StubClient
c
(
htp
,
JSONRPC_CLIENT_V2
);
string
ip
=
ZMQ_IP
;
ZMQClient
client
(
ip
,
ZMQ_PORT
);
string
keyName
=
""
;
try
{
PRINT_SRC_LINE
keyName
=
genECDSAKeyAPI
(
c
);
PRINT_SRC_LINE
}
catch
(
Exception
&
e
)
{
cerr
<<
e
.
what
()
<<
endl
;
throw
;
}
try
{
PRINT_SRC_LINE
auto
sig
=
client
.
ecdsaSignMessageHash
(
16
,
keyName
,
SAMPLE_HASH
);
REQUIRE
(
sig
.
size
()
>
10
);
}
catch
(
JsonRpcException
&
e
)
{
cerr
<<
e
.
what
()
<<
endl
;
throw
;
}
}
TEST_CASE_METHOD
(
TestFixtureNoResetFromBackup
,
"Backup restore"
,
"[backup-restore]"
)
{
}
testw.h
View file @
d09a4f4c
...
...
@@ -33,6 +33,9 @@
#define SAMPLE_POLY_NAME "POLY:SCHAIN_ID:1:NODE_ID:1:DKG_ID:1"
#define RPC_ENDPOINT "http://localhost:1029"
#define ZMQ_IP "127.0.0.1"
#define ZMQ_PORT 1031
#define SAMPLE_PUBLIC_KEY_B "c0152c48bf640449236036075d65898fded1e242c00acb45519ad5f788ea7cbf9a5df1559e7fc87932eee5478b1b9023de19df654395574a690843988c3ff475"
#define SAMPLE_DKG_PUB_KEY_1 "505f55a38f9c064da744f217d1cb993a17705e9839801958cda7c884e08ab4dad7fd8d22953d3ac7f0913de24fd67d7ed36741141b8a3da152d7ba954b0f14e2"
...
...
testw.py
View file @
d09a4f4c
...
...
@@ -28,7 +28,8 @@ username = getpass.getuser()
topDir
=
os
.
getcwd
()
+
"/sgxwallet"
print
(
"Top directory is:"
+
topDir
)
testList
=
[
"[first-run]"
,
testList
=
[
"[zmq-ecdsa-run]"
,
"[first-run]"
,
"[second-run]"
,
"[many-threads-crypto]"
,
"[many-threads-crypto-v2]"
,
...
...
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