-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsequence_witnessing.plantuml
76 lines (61 loc) · 1.63 KB
/
sequence_witnessing.plantuml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
@startuml
box "Client"
actor "Client" as client
participant "dApp" as dapp
end box
box "Third party"
control "Watcher" as watcher
end box
box "Smart contracts"
entity "Pandora" as pandora << (C,#ADD1B2) >>
entity "Cognitive\nJob\nContract" as job << (C,#ADD1B2) >>
entity "Worker\nContracts" as workerContracts << (C,#ADD1B2) >>
entity "Failed\nWorker\nContract" as failedContract << (C,#ADD1B2) >>
end box
box "Nodes"
collections "Worker\nNodes" as workers
participant "Failed\nWorker" as failedWorker
end box
== Relations ==
pandora --\\ job: 1 - to - many
job --\\ workerContracts: 1 - to - many
workerContracts //-- failedContract: one of
workers --\\ workerContracts: owner
failedWorker --\\ failedContract: owner
== Witnessing ==
activate job
workers -> job: reportProgress()
alt No internet connectivity
|||
failedWorker -->x failedContract
|||
else Crash or turned off
|||
failedWorker -> failedWorker
destroy failedWorker
|||
else Decided to keep silence
|||
failedWorker -->x]
|||
end
watcher -> job: reportWorkerFailure(failedWorker)
job -> job: check timeout
job -> failedContract: updateState(Offline)
job -> job: replaceWorker()
job -> pandora: penaltize(failedWorker)
activate pandora
deactivate job
pandora -> pandora: reduceStake(penalty)
pandora -> failedContract: updateState(InssufficientStake) if neccessary
pandora -> watcher: payReward()
deactivate pandora
== Restoring from failure ==
activate failedWorker
failedWorker -> failedContract: backOnline()
activate failedContract
deactivate failedWorker
failedContract -> failedContract: updateState(Idle)
deactivate failedContract
|||
@enduml