-
Notifications
You must be signed in to change notification settings - Fork 2
/
sequence_cognition_30.plantuml
117 lines (106 loc) · 3.28 KB
/
sequence_cognition_30.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
@startuml
box "Client"
actor "Client" as client
participant "Client dApp" as dapp
end box
box "Distributed Data"
entity "Pandora Contracts" as pandora
database "IPFS" as ipfs
end box
box "Workers"
collections "Worker Nodes" as workers
control "Keras/TensorFlow" as nn
collections "Validating Nodes" as validators
end box
entity "Cognition Contract" as cognition
== Validation ==
cognition -> pandora: validateResults
deactivate cognition
activate pandora
loop until validators found, with reducing reputation limit, but < N times
|||
ref over pandora: lottery
pandora -> pandora: selectValidators
pandora -->> cognition: initWithValidators
... mining transaction ...
pandora -[#blue]->> validators: newValidationJob
deactivate pandora
alt Validator timeout
pandora -[#red]->x validators: penalty
group repeat
end
else Validator active
activate validators
validators -> cognition: readData
cognition --> validators: < cognitive job info >
validators ->> ipfs: download
... downloading ...
ipfs -->> validators: < files >
validators -> nn: loadNetwork
activate nn
validators -> nn: getDetails
activate pandora
alt Validator accepts job
validators ->> pandora: jobAccepted(timeEstimation)
else Validator declined job
validators ->> pandora: jobDeclined
pandora -[#red]->x validators: penalty
group repeat
end
end
pandora -> pandora: updateValidators
deactivate validators
... mining transaction ...
pandora -[#blue]->> validators: startValidation
activate validators
deactivate pandora
par
validators ->> nn: compute
... computing ...
nn -->> validators: < results >
deactivate nn
else
ipfs <<- validators: download
activate ipfs
note right: downloading\ncomputation\nresults
... downloading ...
ipfs -->> validators: < files >
deactivate ipfs
end
validators -> validators: compareResults
validators ->> cognition: validationResults
deactivate validators
cognition -> pandora: validationResults
alt Validation didn't confirmed calculations
ref over pandora, workers, validators: Arbitrage
else Validator answer timeout
pandora -[#blue]->> validators: updateTimeEstimation
activate pandora
alt Validator responses
validators ->> pandora: updateTimeEstimation
pandora -[#red]->x validators: smallPenalty
else Validator does not response
pandora -[#red]->x validators: penalty
group repeat
end
end
deactivate pandora
else Validation confirmed original calculations
pandora -[#green]->>o pandora: makePaymentsAndMine
'cognition -[#green]->>o pandora: mine
'cognition -[#green]->>o pandora: pay(workers)
'cognition -[#green]->>o pandora: pay(validators)
'cognition -[#green]->>o pandora: pay(dataProvider)
'cognition -[#green]->>o pandora: pay(kernelProvider)
'cognition -[#green]->>o pandora: pay(researchWork)
... mine transactions ...
end
end
end
group if [Not all validators found / worked]
pandora -[#blue]->> dapp: jobCompleted\nPartialValidation
pandora -[#green]->>o client: partialPayout
pandora -[#green]->>o pandora: makePayments\n(exceptValidators)
end
|||
@enduml