Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
d752c1cd
Commit
d752c1cd
authored
7 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[fix]
#1190
Revoked identity inclusion in a block [test]
parent
8cd59be8
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!1220
Stable/ws2p v1.1 trymerge
,
!1208
Stable/ws2p v1.1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/integration/revoked_pubkey_replay.ts
+68
-0
68 additions, 0 deletions
test/integration/revoked_pubkey_replay.ts
test/integration/tools/toolbox.ts
+2
-2
2 additions, 2 deletions
test/integration/tools/toolbox.ts
test/integration/tools/user.js
+6
-4
6 additions, 4 deletions
test/integration/tools/user.js
with
76 additions
and
6 deletions
test/integration/revoked_pubkey_replay.ts
0 → 100644
+
68
−
0
View file @
d752c1cd
import
{
simpleNodeWith2Users
,
TestingServer
}
from
"
./tools/toolbox
"
const
_
=
require
(
'
underscore
'
)
const
user
=
require
(
'
./tools/user
'
)
describe
(
"
Revoked pubkey replay
"
,
function
()
{
const
now
=
1500000000
const
DONT_WAIT_FOR_BLOCKCHAIN_CHANGE
=
true
let
s1
:
TestingServer
,
cat
:
any
,
tic
:
any
const
conf
=
{
nbCores
:
1
,
sigQty
:
1
}
before
(
async
()
=>
{
const
res1
=
await
simpleNodeWith2Users
(
conf
)
s1
=
res1
.
s1
cat
=
res1
.
cat
tic
=
user
(
'
tic
'
,
{
pub
:
'
DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV
'
,
sec
:
'
468Q1XtTq7h84NorZdWBZFJrGkB18CbmbHr9tkp9snt5GiERP7ySs3wM8myLccbAAGejgMRC9rqnXuW3iAfZACm7
'
},
{
server
:
s1
})
await
s1
.
commit
({
time
:
now
})
await
s1
.
commit
({
time
:
now
})
// Create the tested identity « tic »
await
tic
.
createIdentity
()
})
it
(
'
should exist tic as pending identity
'
,
()
=>
s1
.
expect
(
'
/wot/lookup/tic
'
,
(
res
:
any
)
=>
{
res
.
should
.
have
.
property
(
'
results
'
).
length
(
1
)
res
.
results
[
0
].
should
.
have
.
property
(
'
uids
'
).
length
(
1
)
res
.
results
[
0
].
uids
[
0
].
should
.
have
.
property
(
'
uid
'
).
equal
(
'
tic
'
)
}))
it
(
'
should be able to make tic become a member
'
,
async
()
=>
{
await
tic
.
join
()
await
cat
.
cert
(
tic
)
await
s1
.
commit
()
await
s1
.
expect
(
'
/wot/members
'
,
(
res
:
any
)
=>
{
res
.
should
.
have
.
property
(
'
results
'
).
length
(
3
)
const
ticEntries
=
_
.
filter
(
res
.
results
,
(
entry
:
any
)
=>
entry
.
uid
===
'
tic
'
)
ticEntries
.
should
.
have
.
length
(
1
)
})
})
it
(
'
should be able to revoke tic
'
,
async
()
=>
{
await
tic
.
revoke
()
await
s1
.
expect
(
'
/wot/lookup/tic
'
,
(
res
:
any
)
=>
{
res
.
should
.
have
.
property
(
'
results
'
).
length
(
1
)
res
.
results
[
0
].
should
.
have
.
property
(
'
uids
'
).
length
(
1
)
res
.
results
[
0
].
uids
[
0
].
should
.
have
.
property
(
'
uid
'
).
equal
(
'
tic
'
)
res
.
results
[
0
].
uids
[
0
].
should
.
have
.
property
(
'
revocation_sig
'
).
not
.
equal
(
null
)
})
await
s1
.
commit
()
await
s1
.
expect
(
'
/wot/members
'
,
(
res
:
any
)
=>
{
res
.
should
.
have
.
property
(
'
results
'
).
length
(
2
)
const
ticEntries
=
_
.
filter
(
res
.
results
,
(
entry
:
any
)
=>
entry
.
uid
===
'
tic
'
)
ticEntries
.
should
.
have
.
length
(
0
)
})
})
it
(
'
should not try to include tic2 in a new block
'
,
async
()
=>
{
await
s1
.
commit
()
await
tic
.
join
()
const
block
=
await
s1
.
commit
(
null
,
DONT_WAIT_FOR_BLOCKCHAIN_CHANGE
)
block
.
should
.
have
.
property
(
'
joiners
'
).
length
(
0
)
})
after
(
async
()
=>
{
await
s1
.
closeCluster
()
})
})
This diff is collapsed.
Click to expand it.
test/integration/tools/toolbox.ts
+
2
−
2
View file @
d752c1cd
...
...
@@ -476,8 +476,8 @@ export class TestingServer {
return
until
(
this
.
server
,
type
,
count
);
}
async
commit
(
options
:
any
=
null
)
{
const
raw
=
await
commit
(
this
.
server
)(
options
);
async
commit
(
options
:
any
=
null
,
noWait
=
false
)
{
const
raw
=
await
commit
(
this
.
server
,
null
,
noWait
)(
options
);
return
JSON
.
parse
(
raw
);
}
...
...
This diff is collapsed.
Click to expand it.
test/integration/tools/user.js
+
6
−
4
View file @
d752c1cd
...
...
@@ -26,6 +26,7 @@ function User (uid, options, node) {
var
pub
,
sec
;
var
createdIdentity
=
""
;
that
.
node
=
node
;
that
.
uid
=
uid
// For sync code
if
(
options
.
pub
&&
options
.
sec
)
{
...
...
@@ -68,7 +69,7 @@ function User (uid, options, node) {
this
.
makeCert
=
(
user
,
fromServer
,
overrideProps
)
=>
co
(
function
*
()
{
const
lookup
=
yield
that
.
lookup
(
user
.
pub
,
fromServer
);
const
current
=
yield
node
.
server
.
BlockchainService
.
current
();
const
idty
=
lookup
.
results
[
0
].
uids
[
0
]
;
const
idty
=
_
.
filter
(
lookup
.
results
[
0
].
uids
,
(
uidEntry
)
=>
uidEntry
.
uid
===
user
.
uid
)
[
0
]
let
buid
=
current
?
ucp
.
format
.
buid
(
current
.
number
,
current
.
hash
)
:
ucp
.
format
.
buid
();
const
cert
=
{
"
version
"
:
constants
.
DOCUMENTS_VERSION
,
...
...
@@ -103,10 +104,11 @@ function User (uid, options, node) {
this
.
makeRevocation
=
(
givenLookupIdty
,
overrideProps
)
=>
co
(
function
*
()
{
const
res
=
givenLookupIdty
||
(
yield
that
.
lookup
(
pub
));
const
matchingResult
=
_
.
filter
(
res
.
results
[
0
].
uids
,
(
uidEntry
)
=>
uidEntry
.
uid
===
uid
)[
0
]
const
idty
=
{
uid
:
res
.
results
[
0
].
uids
[
0
]
.
uid
,
buid
:
res
.
results
[
0
].
uids
[
0
]
.
meta
.
timestamp
,
sig
:
res
.
results
[
0
].
uids
[
0
]
.
self
uid
:
matchingResult
.
uid
,
buid
:
matchingResult
.
meta
.
timestamp
,
sig
:
matchingResult
.
self
}
const
revocation
=
{
"
currency
"
:
node
.
server
.
conf
.
currency
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment