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
2bbf07d4
Unverified
Commit
2bbf07d4
authored
Jun 16, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CMAKE file
parent
127f624c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
21 deletions
+26
-21
testw.cpp
testw.cpp
+26
-21
No files found.
testw.cpp
View file @
2bbf07d4
...
...
@@ -535,13 +535,8 @@ TEST_CASE_METHOD(TestFixture, "DKG AES encrypted secret shares test", "[dkg-aes-
void
doDKG
(
StubClient
&
c
,
int
n
,
int
t
)
{
TEST_CASE_METHOD
(
TestFixture
,
"DKG_BLS test"
,
"[dkg-bls]"
)
{
HttpClient
client
(
RPC_ENDPOINT
);
StubClient
c
(
client
,
JSONRPC_CLIENT_V2
);
int
n
=
16
,
t
=
16
;
Json
::
Value
ethKeys
[
n
];
Json
::
Value
verifVects
[
n
];
Json
::
Value
pubEthKeys
;
...
...
@@ -555,12 +550,12 @@ TEST_CASE_METHOD(TestFixture, "DKG_BLS test", "[dkg-bls]") {
int
dkgID
=
TestUtils
::
randGen
();
for
(
uint8_t
i
=
0
;
i
<
n
;
i
++
)
{
ethKeys
[
i
]
=
c
.
generateECDSAKey
();
REQUIR
E
(
ethKeys
[
i
][
"status"
]
==
0
);
CHECK_STAT
E
(
ethKeys
[
i
][
"status"
]
==
0
);
string
polyName
=
"POLY:SCHAIN_ID:"
+
to_string
(
schainID
)
+
":NODE_ID:"
+
to_string
(
i
)
+
":DKG_ID:"
+
to_string
(
dkgID
);
Json
::
Value
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
REQUIR
E
(
response
[
"status"
]
==
0
);
CHECK_STAT
E
(
response
[
"status"
]
==
0
);
polyNames
[
i
]
=
polyName
;
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
,
n
);
REQUIRE
(
verifVects
[
i
][
"status"
]
==
0
);
...
...
@@ -569,11 +564,11 @@ TEST_CASE_METHOD(TestFixture, "DKG_BLS test", "[dkg-bls]") {
for
(
uint8_t
i
=
0
;
i
<
n
;
i
++
)
{
secretShares
[
i
]
=
c
.
getSecretShare
(
polyNames
[
i
],
pubEthKeys
,
t
,
n
);
REQUIR
E
(
secretShares
[
i
][
"status"
]
==
0
);
CHECK_STAT
E
(
secretShares
[
i
][
"status"
]
==
0
);
for
(
uint8_t
k
=
0
;
k
<
t
;
k
++
)
{
for
(
uint8_t
j
=
0
;
j
<
4
;
j
++
)
{
string
pubShare
=
verifVects
[
i
][
"verificationVector"
][
k
][
j
].
asString
();
REQUIR
E
(
pubShare
.
length
()
>
60
);
CHECK_STAT
E
(
pubShare
.
length
()
>
60
);
pubShares
[
i
]
+=
TestUtils
::
convertDecToHex
(
pubShare
);
}
}
...
...
@@ -589,12 +584,12 @@ TEST_CASE_METHOD(TestFixture, "DKG_BLS test", "[dkg-bls]") {
for
(
int
j
=
0
;
j
<
n
;
j
++
)
{
string
secretShare
=
secretShares
[
i
][
"secretShare"
].
asString
().
substr
(
192
*
j
,
192
);
secShares
[
i
]
+=
secretShares
[
j
][
"secretShare"
].
asString
().
substr
(
192
*
i
,
192
);
Json
::
Value
respon
c
e
=
c
.
dkgVerification
(
pubShares
[
i
],
ethKeys
[
j
][
"keyName"
].
asString
(),
secretShare
,
t
,
n
,
j
);
REQUIRE
(
responc
e
[
"status"
]
==
0
);
Json
::
Value
respon
s
e
=
c
.
dkgVerification
(
pubShares
[
i
],
ethKeys
[
j
][
"keyName"
].
asString
(),
secretShare
,
t
,
n
,
j
);
CHECK_STATE
(
respons
e
[
"status"
]
==
0
);
bool
res
=
respon
c
e
[
"result"
].
asBool
();
REQUIR
E
(
res
);
bool
res
=
respon
s
e
[
"result"
].
asBool
();
CHECK_STAT
E
(
res
);
k
++
;
...
...
@@ -602,7 +597,7 @@ TEST_CASE_METHOD(TestFixture, "DKG_BLS test", "[dkg-bls]") {
Json
::
Value
wrongVerif
=
c
.
dkgVerification
(
pSharesBad
[
i
],
ethKeys
[
j
][
"keyName"
].
asString
(),
secretShare
,
t
,
n
,
j
);
res
=
wrongVerif
[
"result"
].
asBool
();
REQUIR
E
(
!
res
);
CHECK_STAT
E
(
!
res
);
}
BLSSigShareSet
sigShareSet
(
t
,
n
);
...
...
@@ -623,11 +618,11 @@ TEST_CASE_METHOD(TestFixture, "DKG_BLS test", "[dkg-bls]") {
string
secretShare
=
secretShares
[
i
][
"secretShare"
].
asString
();
auto
response
=
c
.
createBLSPrivateKey
(
blsName
,
ethKeys
[
i
][
"keyName"
].
asString
(),
polyNames
[
i
],
secShares
[
i
],
t
,
n
);
REQUIR
E
(
response
[
"status"
]
==
0
);
CHECK_STAT
E
(
response
[
"status"
]
==
0
);
pubBLSKeys
[
i
]
=
c
.
getBLSPublicKeyShare
(
blsName
);
REQUIR
E
(
pubBLSKeys
[
i
][
"status"
]
==
0
);
CHECK_STAT
E
(
pubBLSKeys
[
i
][
"status"
]
==
0
);
blsSigShares
[
i
]
=
c
.
blsSignMessageHash
(
blsName
,
hash
,
t
,
n
,
i
+
1
);
REQUIR
E
(
blsSigShares
[
i
][
"status"
]
==
0
);
CHECK_STAT
E
(
blsSigShares
[
i
][
"status"
]
==
0
);
shared_ptr
<
string
>
sig_share_ptr
=
make_shared
<
string
>
(
blsSigShares
[
i
][
"signatureShare"
].
asString
());
BLSSigShare
sig
(
sig_share_ptr
,
i
+
1
,
t
,
n
);
sigShareSet
.
addSigShare
(
make_shared
<
BLSSigShare
>
(
sig
));
...
...
@@ -637,7 +632,7 @@ TEST_CASE_METHOD(TestFixture, "DKG_BLS test", "[dkg-bls]") {
pubKeyVect
.
push_back
(
pubBLSKeys
[
i
][
"blsPublicKeyShare"
][
j
].
asString
());
}
BLSPublicKeyShare
pubKey
(
make_shared
<
vector
<
string
>>
(
pubKeyVect
),
t
,
n
);
REQUIR
E
(
pubKey
.
VerifySigWithHelper
(
hash_arr
,
make_shared
<
BLSSigShare
>
(
sig
),
t
,
n
));
CHECK_STAT
E
(
pubKey
.
VerifySigWithHelper
(
hash_arr
,
make_shared
<
BLSSigShare
>
(
sig
),
t
,
n
));
coeffsPubKeysMap
[
i
+
1
]
=
make_shared
<
BLSPublicKeyShare
>
(
pubKey
);
}
...
...
@@ -645,9 +640,19 @@ TEST_CASE_METHOD(TestFixture, "DKG_BLS test", "[dkg-bls]") {
shared_ptr
<
BLSSignature
>
commonSig
=
sigShareSet
.
merge
();
BLSPublicKey
common_public
(
make_shared
<
map
<
size_t
,
shared_ptr
<
BLSPublicKeyShare
>>
>
(
coeffsPubKeysMap
),
t
,
n
);
REQUIR
E
(
common_public
.
VerifySigWithHelper
(
hash_arr
,
commonSig
,
t
,
n
));
CHECK_STAT
E
(
common_public
.
VerifySigWithHelper
(
hash_arr
,
commonSig
,
t
,
n
));
}
TEST_CASE_METHOD
(
TestFixture
,
"DKG_BLS test"
,
"[dkg-bls]"
)
{
HttpClient
client
(
RPC_ENDPOINT
);
StubClient
c
(
client
,
JSONRPC_CLIENT_V2
);
doDKG
(
c
,
4
,
1
);
}
TEST_CASE_METHOD
(
TestFixture
,
"Get ServerStatus"
,
"[get-server-status]"
)
{
HttpClient
client
(
RPC_ENDPOINT
);
StubClient
c
(
client
,
JSONRPC_CLIENT_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