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
da0e2690
Commit
da0e2690
authored
7 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[fix]
#1063
When pulling sandboxes, also parse revocation documents
parent
dd6b0999
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/modules/crawler/lib/sandbox.ts
+30
-2
30 additions, 2 deletions
app/modules/crawler/lib/sandbox.ts
test/integration/identity-pulling.js
+7
-0
7 additions, 0 deletions
test/integration/identity-pulling.js
with
37 additions
and
2 deletions
app/modules/crawler/lib/sandbox.ts
+
30
−
2
View file @
da0e2690
...
@@ -47,6 +47,12 @@ export const pullSandboxToLocalServer = async (currency:string, fromHost:any, to
...
@@ -47,6 +47,12 @@ export const pullSandboxToLocalServer = async (currency:string, fromHost:any, to
await
submitIdentityToServer
(
idty
,
toServer
,
notify
,
logger
)
await
submitIdentityToServer
(
idty
,
toServer
,
notify
,
logger
)
}
}
for
(
let
i
=
0
;
i
<
docs
.
revocations
.
length
;
i
++
)
{
const
idty
=
docs
.
revocations
[
i
];
watcher
&&
watcher
.
writeStatus
(
'
Revocation
'
+
(
i
+
1
)
+
'
/
'
+
docs
.
revocations
.
length
)
await
submitRevocationToServer
(
idty
,
toServer
,
notify
,
logger
)
}
for
(
let
i
=
0
;
i
<
docs
.
certifications
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
docs
.
certifications
.
length
;
i
++
)
{
const
cert
=
docs
.
certifications
[
i
];
const
cert
=
docs
.
certifications
[
i
];
watcher
&&
watcher
.
writeStatus
(
'
Certification
'
+
(
i
+
1
)
+
'
/
'
+
docs
.
certifications
.
length
)
watcher
&&
watcher
.
writeStatus
(
'
Certification
'
+
(
i
+
1
)
+
'
/
'
+
docs
.
certifications
.
length
)
...
@@ -65,7 +71,8 @@ function getDocumentsTree(currency:string, res:any) {
...
@@ -65,7 +71,8 @@ function getDocumentsTree(currency:string, res:any) {
const
documents
:
any
=
{
const
documents
:
any
=
{
identities
:
[],
identities
:
[],
certifications
:
[],
certifications
:
[],
memberships
:
[]
memberships
:
[],
revocations
:
[]
}
}
for
(
const
idty
of
res
.
identities
)
{
for
(
const
idty
of
res
.
identities
)
{
const
identity
=
rawer
.
getOfficialIdentity
({
const
identity
=
rawer
.
getOfficialIdentity
({
...
@@ -75,6 +82,17 @@ function getDocumentsTree(currency:string, res:any) {
...
@@ -75,6 +82,17 @@ function getDocumentsTree(currency:string, res:any) {
buid
:
idty
.
meta
.
timestamp
,
buid
:
idty
.
meta
.
timestamp
,
sig
:
idty
.
sig
sig
:
idty
.
sig
})
})
if
(
idty
.
revocation_sig
)
{
const
revocation
=
rawer
.
getOfficialRevocation
({
currency
,
uid
:
idty
.
uid
,
issuer
:
idty
.
pubkey
,
buid
:
idty
.
meta
.
timestamp
,
sig
:
idty
.
sig
,
revocation
:
idty
.
revocation_sig
})
documents
.
revocations
.
push
(
revocation
)
}
documents
.
identities
.
push
(
identity
)
documents
.
identities
.
push
(
identity
)
for
(
const
cert
of
idty
.
pendingCerts
)
{
for
(
const
cert
of
idty
.
pendingCerts
)
{
const
certification
=
rawer
.
getOfficialCertification
({
const
certification
=
rawer
.
getOfficialCertification
({
...
@@ -136,7 +154,17 @@ async function submitIdentityToServer(idty:any, toServer:any, notify:boolean, lo
...
@@ -136,7 +154,17 @@ async function submitIdentityToServer(idty:any, toServer:any, notify:boolean, lo
try
{
try
{
const
obj
=
parsers
.
parseIdentity
.
syncWrite
(
idty
)
const
obj
=
parsers
.
parseIdentity
.
syncWrite
(
idty
)
await
toServer
.
writeIdentity
(
obj
,
notify
)
await
toServer
.
writeIdentity
(
obj
,
notify
)
logger
&&
logger
.
trace
(
'
Sandbox pulling: success with identity
\'
%s
\'
'
,
idty
.
uid
)
logger
&&
logger
.
trace
(
'
Sandbox pulling: success with identity
\'
%s
\'
'
,
obj
.
uid
)
}
catch
(
e
)
{
// Silent error
}
}
async
function
submitRevocationToServer
(
revocation
:
any
,
toServer
:
any
,
notify
:
boolean
,
logger
:
any
)
{
try
{
const
obj
=
parsers
.
parseRevocation
.
syncWrite
(
revocation
)
await
toServer
.
writeRevocation
(
obj
,
notify
)
logger
&&
logger
.
trace
(
'
Sandbox pulling: success with revocation
\'
%s
\'
'
,
obj
.
uid
)
}
catch
(
e
)
{
}
catch
(
e
)
{
// Silent error
// Silent error
}
}
...
...
This diff is collapsed.
Click to expand it.
test/integration/identity-pulling.js
+
7
−
0
View file @
da0e2690
...
@@ -64,6 +64,9 @@ describe("Identity pulling", function() {
...
@@ -64,6 +64,9 @@ describe("Identity pulling", function() {
// 1 certs for tic
// 1 certs for tic
yield
cat1
.
cert
(
tic2
,
s2
,
s2
);
yield
cat1
.
cert
(
tic2
,
s2
,
s2
);
// 0 certs for tuc
// 0 certs for tuc
// tic2 also revokes its pending identity
yield
tic2
.
revoke
()
}));
}));
it
(
'
toc should not be known of s1
'
,
()
=>
co
(
function
*
()
{
it
(
'
toc should not be known of s1
'
,
()
=>
co
(
function
*
()
{
...
@@ -118,21 +121,25 @@ describe("Identity pulling", function() {
...
@@ -118,21 +121,25 @@ describe("Identity pulling", function() {
assert
.
equal
(
json
.
identities
[
3
].
pubkey
,
'
HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd
'
)
assert
.
equal
(
json
.
identities
[
3
].
pubkey
,
'
HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd
'
)
assert
.
equal
(
json
.
identities
[
3
].
uid
,
'
cat
'
)
assert
.
equal
(
json
.
identities
[
3
].
uid
,
'
cat
'
)
assert
.
equal
(
json
.
identities
[
3
].
revocation_sig
,
null
)
assert
.
equal
(
json
.
identities
[
3
].
pendingCerts
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
3
].
pendingCerts
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
3
].
pendingMemberships
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
3
].
pendingMemberships
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
0
].
pubkey
,
'
2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc
'
)
assert
.
equal
(
json
.
identities
[
0
].
pubkey
,
'
2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc
'
)
assert
.
equal
(
json
.
identities
[
0
].
uid
,
'
tac
'
)
assert
.
equal
(
json
.
identities
[
0
].
uid
,
'
tac
'
)
assert
.
equal
(
json
.
identities
[
0
].
revocation_sig
,
null
)
assert
.
equal
(
json
.
identities
[
0
].
pendingCerts
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
0
].
pendingCerts
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
0
].
pendingMemberships
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
0
].
pendingMemberships
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
2
].
pubkey
,
'
DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV
'
)
assert
.
equal
(
json
.
identities
[
2
].
pubkey
,
'
DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV
'
)
assert
.
equal
(
json
.
identities
[
2
].
uid
,
'
tic
'
)
assert
.
equal
(
json
.
identities
[
2
].
uid
,
'
tic
'
)
assert
.
equal
(
json
.
identities
[
2
].
revocation_sig
,
'
AAFSisqkMb/2L4/YmZXQWoKYxnz/PW1c2wbux+ZRe8Iw8dxthPR4Iw+g+/JKA5nPE+C/lkX2YFrIikgUpZdlAA==
'
)
assert
.
equal
(
json
.
identities
[
2
].
pendingCerts
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
2
].
pendingCerts
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
2
].
pendingMemberships
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
2
].
pendingMemberships
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
1
].
pubkey
,
'
DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo
'
)
assert
.
equal
(
json
.
identities
[
1
].
pubkey
,
'
DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo
'
)
assert
.
equal
(
json
.
identities
[
1
].
uid
,
'
toc
'
)
assert
.
equal
(
json
.
identities
[
1
].
uid
,
'
toc
'
)
assert
.
equal
(
json
.
identities
[
1
].
revocation_sig
,
null
)
assert
.
equal
(
json
.
identities
[
1
].
pendingCerts
.
length
,
2
)
assert
.
equal
(
json
.
identities
[
1
].
pendingCerts
.
length
,
2
)
assert
.
equal
(
json
.
identities
[
1
].
pendingMemberships
.
length
,
1
)
assert
.
equal
(
json
.
identities
[
1
].
pendingMemberships
.
length
,
1
)
})
})
...
...
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