dkg 1.1.1__py3-none-any.whl → 8.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. dkg/asset.py +589 -683
  2. dkg/constants.py +106 -45
  3. dkg/data/interfaces/AskStorage.json +366 -0
  4. dkg/data/interfaces/Chronos.json +202 -0
  5. dkg/data/interfaces/Hub.json +294 -2
  6. dkg/data/interfaces/IdentityStorage.json +400 -0
  7. dkg/data/interfaces/KnowledgeCollection.json +610 -0
  8. dkg/data/interfaces/KnowledgeCollectionStorage.json +2312 -0
  9. dkg/data/interfaces/Paranet.json +656 -135
  10. dkg/data/interfaces/ParanetIncentivesPoolFactory.json +18 -2
  11. dkg/data/interfaces/ParanetKnowledgeMinersRegistry.json +20 -4
  12. dkg/data/interfaces/{ParanetNeurowebIncentivesPool.json → ParanetNeuroIncentivesPool.json} +7 -7
  13. dkg/data/interfaces/ParanetsRegistry.json +844 -36
  14. dkg/data/interfaces/Token.json +146 -17
  15. dkg/dataclasses.py +11 -1
  16. dkg/exceptions.py +1 -0
  17. dkg/graph.py +55 -24
  18. dkg/main.py +18 -2
  19. dkg/network.py +2 -2
  20. dkg/node.py +7 -0
  21. dkg/paranet.py +336 -33
  22. dkg/providers/blockchain.py +23 -24
  23. dkg/providers/node_http.py +11 -9
  24. dkg/services/input_service.py +183 -0
  25. dkg/services/node_service.py +164 -0
  26. dkg/types/__init__.py +15 -3
  27. dkg/types/general.py +15 -8
  28. dkg/utils/blockchain_request.py +189 -64
  29. dkg/utils/knowledge_asset_tools.py +5 -0
  30. dkg/utils/knowledge_collection_tools.py +236 -0
  31. dkg/utils/merkle.py +1 -1
  32. dkg/utils/node_request.py +33 -33
  33. dkg/utils/rdf.py +10 -6
  34. dkg/utils/string_transformations.py +1 -0
  35. {dkg-1.1.1.dist-info → dkg-8.0.0.dist-info}/METADATA +36 -26
  36. dkg-8.0.0.dist-info/RECORD +56 -0
  37. {dkg-1.1.1.dist-info → dkg-8.0.0.dist-info}/WHEEL +1 -1
  38. dkg/data/interfaces/AssertionStorage.json +0 -229
  39. dkg/data/interfaces/ContentAsset.json +0 -801
  40. dkg/data/interfaces/ContentAssetStorage.json +0 -782
  41. dkg/data/interfaces/ServiceAgreementStorageProxy.json +0 -1314
  42. dkg/data/interfaces/UnfinalizedStateStorage.json +0 -171
  43. dkg-1.1.1.dist-info/RECORD +0 -52
  44. {dkg-1.1.1.dist-info → dkg-8.0.0.dist-info}/LICENSE +0 -0
  45. {dkg-1.1.1.dist-info → dkg-8.0.0.dist-info}/NOTICE +0 -0
dkg/constants.py CHANGED
@@ -1,3 +1,6 @@
1
+ from enum import Enum, auto
2
+ from dkg.types import AutoStrEnumUpperCase
3
+
1
4
  # Licensed to the Apache Software Foundation (ASF) under one
2
5
  # or more contributor license agreements. See the NOTICE file
3
6
  # distributed with this work for additional information
@@ -15,84 +18,128 @@
15
18
  # specific language governing permissions and limitations
16
19
  # under the License.
17
20
 
21
+ DEFAULT_CANON_ALGORITHM = "URDNA2015"
22
+ DEFAULT_RDF_FORMAT = "application/n-quads"
23
+
18
24
  PRIVATE_ASSERTION_PREDICATE = (
19
- "https://ontology.origintrail.io/dkg/1.0#privateAssertionID"
25
+ "https://ontology.origintrail.io/dkg/1.0#privateMerkleRoot"
26
+ )
27
+
28
+ PRIVATE_HASH_SUBJECT_PREFIX = "https://ontology.origintrail.io/dkg/1.0#metadata-hash:"
29
+
30
+ PRIVATE_RESOURCE_PREDICATE = (
31
+ "https://ontology.origintrail.io/dkg/1.0#representsPrivateResource"
20
32
  )
21
33
 
34
+ CHUNK_BYTE_SIZE = 32
35
+
36
+ MAX_FILE_SIZE = 10000000
37
+
38
+
39
+ class DefaultParameters(Enum):
40
+ ENVIRONMENT: str = "mainnet"
41
+ PORT: int = 8900
42
+ FREQUENCY: int = 5
43
+ MAX_NUMBER_OF_RETRIES: int = 5
44
+ HASH_FUNCTION_ID: int = 1
45
+ MIN_NUMBER_OF_FINALIZATION_CONFIRMATION: int = 3
46
+ IMMUTABLE: bool = False
47
+ VALIDATE: bool = True
48
+ OUTPUT_FORMAT: str = "JSON-LD"
49
+ STATE: None = None
50
+ INCLUDE_METADATA: bool = False
51
+ CONTENT_TYPE: str = "all"
52
+ HANDLE_NOT_MINED_ERROR: bool = False
53
+ SIMULATE_TXS: bool = False
54
+ FORCE_REPLACE_TXS: bool = False
55
+ GAS_LIMIT_MULTIPLIER: int = 1
56
+ PARANET_UAL: None = None
57
+ GET_SUBJECT_UAL: bool = False
58
+ REPOSITORY: str = "dkg"
59
+
60
+
61
+ class OutputTypes(Enum):
62
+ NQUADS: str = "N-QUADS"
63
+ JSONLD: str = "JSON-LD"
64
+
65
+
66
+ class Environments(Enum):
67
+ DEVELOPMENT: str = "development"
68
+ DEVNET: str = "devnet"
69
+ TESTNET: str = "testnet"
70
+ MAINNET: str = "mainnet"
71
+
72
+
73
+ class BlockchainIds(Enum):
74
+ HARDHAT_1: str = "hardhat1:31337"
75
+ HARDHAT_2: str = "hardhat2:31337"
76
+ BASE_DEVNET: str = "base:84532"
77
+ GNOSIS_DEVNET: str = "gnosis:10200"
78
+ NEUROWEB_DEVNET: str = "otp:2160"
79
+ BASE_TESTNET: str = "base:84532"
80
+ GNOSIS_TESTNET: str = "gnosis:10200"
81
+ NEUROWEB_TESTNET: str = "otp:20430"
82
+ BASE_MAINNET: str = "base:8453"
83
+ GNOSIS_MAINNET: str = "gnosis:100"
84
+ NEUROWEB_MAINNET: str = "otp:2043"
85
+
86
+
87
+ class OperationStatuses(str, Enum):
88
+ PENDING = "PENDING"
89
+ COMPLETED = "COMPLETED"
90
+ FAILED = "FAILED"
91
+
92
+
93
+ ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"
22
94
  BLOCKCHAINS = {
23
95
  "development": {
24
- "hardhat1:31337": {
96
+ "hardhat1:31337": {
25
97
  "hub": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
26
98
  "rpc": "http://localhost:8545",
27
99
  },
28
- "hardhat2:31337": {
100
+ "hardhat2:31337": {
29
101
  "hub": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
30
102
  "rpc": "http://localhost:9545",
31
103
  },
32
104
  },
33
105
  "devnet": {
34
- "otp:2160": {
35
- "hub": "0x833048F6e6BEa78E0AAdedeCd2Dc2231dda443FB",
36
- "rpc": "https://lofar-tm-rpc.origin-trail.network",
37
- },
38
- "gnosis:10200": {
39
- "hub": "0xD2bA102A0b11944d00180eE8136208ccF87bC39A",
40
- "rpc": "https://rpc.chiadochain.net",
41
- "gas_price_oracle": "https://blockscout.chiadochain.net/api/v1/gas-price-oracle",
42
- },
43
106
  "base:84532": {
44
- "hub": "0x6C861Cb69300C34DfeF674F7C00E734e840C29C0",
107
+ "hub": "0xE043daF4cC8ae2c720ef95fc82574a37a429c40A",
45
108
  "rpc": "https://sepolia.base.org",
46
109
  }
47
110
  },
48
111
  "testnet": {
49
- "otp:20430": {
50
- "hub": "0xBbfF7Ea6b2Addc1f38A0798329e12C08f03750A6",
51
- "rpc": "https://lofar-testnet.origin-trail.network",
112
+ "base:84532": {
113
+ "hub": "0xf21CE8f8b01548D97DCFb36869f1ccB0814a4e05",
114
+ "rpc": "https://sepolia.base.org",
52
115
  },
53
116
  "gnosis:10200": {
54
- "hub": "0xC06210312C9217A0EdF67453618F5eB96668679A",
117
+ "hub": "0x2c08AC4B630c009F709521e56Ac385A6af70650f",
55
118
  "rpc": "https://rpc.chiadochain.net",
56
- "gas_price_oracle": "https://blockscout.chiadochain.net/api/v1/gas-price-oracle",
57
119
  },
58
- "base:84532": {
59
- "hub": "0x144eDa5cbf8926327cb2cceef168A121F0E4A299",
60
- "rpc": "https://sepolia.base.org",
61
- }
120
+ "otp:20430": {
121
+ "hub": "0xd7d073b560412c6A7F33dD670d323D01061E5DEb",
122
+ "rpc": "https://lofar-testnet.origin-trail.network",
123
+ },
62
124
  },
63
125
  "mainnet": {
64
- "otp:2043": {
65
- "hub": "0x5fA7916c48Fe6D5F1738d12Ad234b78c90B4cAdA",
66
- "rpc": "https://astrosat-parachain-rpc.origin-trail.network",
126
+ "base:8453": {
127
+ "hub": "0x99Aa571fD5e681c2D27ee08A7b7989DB02541d13",
128
+ "rpc": "https://mainnet.base.org",
67
129
  },
68
130
  "gnosis:100": {
69
- "hub": "0xbEF14fc04F870c2dD65c13Df4faB6ba01A9c746b",
131
+ "hub": "0x882D0BF07F956b1b94BBfe9E77F47c6fc7D4EC8f",
70
132
  "rpc": "https://rpc.gnosischain.com/",
71
- "gas_price_oracle": [
72
- "https://api.gnosisscan.io/api?module=proxy&action=eth_gasPrice",
73
- "https://blockscout.com/xdai/mainnet/api/v1/gas-price-oracle",
74
- ],
75
133
  },
76
- "base:8453": {
77
- "hub": "0xaBfcf2ad1718828E7D3ec20435b0d0b5EAfbDf2c",
78
- "rpc": "https://mainnet.base.org",
134
+ "otp:2043": {
135
+ "hub": "0x0957e25BD33034948abc28204ddA54b6E1142D6F",
136
+ "rpc": "https://astrosat-parachain-rpc.origin-trail.network",
79
137
  },
80
138
  },
81
139
  }
82
140
 
83
- DEFAULT_GAS_PRICE_GWEI = {
84
- "otp": 1,
85
- "gnosis": 20,
86
- "base": 20,
87
- }
88
-
89
- DEFAULT_HASH_FUNCTION_ID = 1
90
141
  DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS = {
91
- "development": {
92
- "hardhat1:31337": 2,
93
- "hardhat2:31337": 2,
94
- "otp:2043": 2
95
- },
142
+ "development": {"hardhat1:31337": 2, "hardhat2:31337": 2, "otp:2043": 2},
96
143
  "devnet": {
97
144
  "otp:2160": 2,
98
145
  "gnosis:10200": 2,
@@ -112,3 +159,17 @@ DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS = {
112
159
 
113
160
  PRIVATE_HISTORICAL_REPOSITORY = "privateHistory"
114
161
  PRIVATE_CURRENT_REPOSITORY = "privateCurrent"
162
+
163
+
164
+ class Operations(Enum):
165
+ PUBLISH = "publish"
166
+ GET = "get"
167
+ QUERY = "query"
168
+ PUBLISH_PARANET = "publishParanet"
169
+ FINALITY = "finality"
170
+
171
+
172
+ class Status(AutoStrEnumUpperCase):
173
+ ERROR = auto()
174
+ NOT_FINALIZED = auto()
175
+ FINALIZED = auto()
@@ -0,0 +1,366 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "address",
6
+ "name": "hubAddress",
7
+ "type": "address"
8
+ }
9
+ ],
10
+ "stateMutability": "nonpayable",
11
+ "type": "constructor"
12
+ },
13
+ {
14
+ "inputs": [
15
+ {
16
+ "internalType": "string",
17
+ "name": "msg",
18
+ "type": "string"
19
+ }
20
+ ],
21
+ "name": "UnauthorizedAccess",
22
+ "type": "error"
23
+ },
24
+ {
25
+ "inputs": [],
26
+ "name": "ZeroAddressHub",
27
+ "type": "error"
28
+ },
29
+ {
30
+ "inputs": [
31
+ {
32
+ "internalType": "uint96",
33
+ "name": "amount",
34
+ "type": "uint96"
35
+ }
36
+ ],
37
+ "name": "decreaseTotalActiveStake",
38
+ "outputs": [],
39
+ "stateMutability": "nonpayable",
40
+ "type": "function"
41
+ },
42
+ {
43
+ "inputs": [
44
+ {
45
+ "internalType": "uint256",
46
+ "name": "amount",
47
+ "type": "uint256"
48
+ }
49
+ ],
50
+ "name": "decreaseWeightedActiveAskSum",
51
+ "outputs": [],
52
+ "stateMutability": "nonpayable",
53
+ "type": "function"
54
+ },
55
+ {
56
+ "inputs": [],
57
+ "name": "getAskBounds",
58
+ "outputs": [
59
+ {
60
+ "internalType": "uint256",
61
+ "name": "",
62
+ "type": "uint256"
63
+ },
64
+ {
65
+ "internalType": "uint256",
66
+ "name": "",
67
+ "type": "uint256"
68
+ }
69
+ ],
70
+ "stateMutability": "view",
71
+ "type": "function"
72
+ },
73
+ {
74
+ "inputs": [],
75
+ "name": "getAskLowerBound",
76
+ "outputs": [
77
+ {
78
+ "internalType": "uint256",
79
+ "name": "",
80
+ "type": "uint256"
81
+ }
82
+ ],
83
+ "stateMutability": "view",
84
+ "type": "function"
85
+ },
86
+ {
87
+ "inputs": [],
88
+ "name": "getAskUpperBound",
89
+ "outputs": [
90
+ {
91
+ "internalType": "uint256",
92
+ "name": "",
93
+ "type": "uint256"
94
+ }
95
+ ],
96
+ "stateMutability": "view",
97
+ "type": "function"
98
+ },
99
+ {
100
+ "inputs": [],
101
+ "name": "getPrevPricePerKbEpoch",
102
+ "outputs": [
103
+ {
104
+ "internalType": "uint256",
105
+ "name": "",
106
+ "type": "uint256"
107
+ }
108
+ ],
109
+ "stateMutability": "view",
110
+ "type": "function"
111
+ },
112
+ {
113
+ "inputs": [],
114
+ "name": "getPrevStakeWeightedAverageAsk",
115
+ "outputs": [
116
+ {
117
+ "internalType": "uint256",
118
+ "name": "",
119
+ "type": "uint256"
120
+ }
121
+ ],
122
+ "stateMutability": "view",
123
+ "type": "function"
124
+ },
125
+ {
126
+ "inputs": [],
127
+ "name": "getPricePerKbEpoch",
128
+ "outputs": [
129
+ {
130
+ "internalType": "uint256",
131
+ "name": "",
132
+ "type": "uint256"
133
+ }
134
+ ],
135
+ "stateMutability": "view",
136
+ "type": "function"
137
+ },
138
+ {
139
+ "inputs": [],
140
+ "name": "getStakeWeightedAverageAsk",
141
+ "outputs": [
142
+ {
143
+ "internalType": "uint256",
144
+ "name": "",
145
+ "type": "uint256"
146
+ }
147
+ ],
148
+ "stateMutability": "view",
149
+ "type": "function"
150
+ },
151
+ {
152
+ "inputs": [],
153
+ "name": "hub",
154
+ "outputs": [
155
+ {
156
+ "internalType": "contract Hub",
157
+ "name": "",
158
+ "type": "address"
159
+ }
160
+ ],
161
+ "stateMutability": "view",
162
+ "type": "function"
163
+ },
164
+ {
165
+ "inputs": [
166
+ {
167
+ "internalType": "uint96",
168
+ "name": "amount",
169
+ "type": "uint96"
170
+ }
171
+ ],
172
+ "name": "increaseTotalActiveStake",
173
+ "outputs": [],
174
+ "stateMutability": "nonpayable",
175
+ "type": "function"
176
+ },
177
+ {
178
+ "inputs": [
179
+ {
180
+ "internalType": "uint256",
181
+ "name": "amount",
182
+ "type": "uint256"
183
+ }
184
+ ],
185
+ "name": "increaseWeightedActiveAskSum",
186
+ "outputs": [],
187
+ "stateMutability": "nonpayable",
188
+ "type": "function"
189
+ },
190
+ {
191
+ "inputs": [],
192
+ "name": "initialize",
193
+ "outputs": [],
194
+ "stateMutability": "nonpayable",
195
+ "type": "function"
196
+ },
197
+ {
198
+ "inputs": [],
199
+ "name": "name",
200
+ "outputs": [
201
+ {
202
+ "internalType": "string",
203
+ "name": "",
204
+ "type": "string"
205
+ }
206
+ ],
207
+ "stateMutability": "pure",
208
+ "type": "function"
209
+ },
210
+ {
211
+ "inputs": [],
212
+ "name": "parametersStorage",
213
+ "outputs": [
214
+ {
215
+ "internalType": "contract ParametersStorage",
216
+ "name": "",
217
+ "type": "address"
218
+ }
219
+ ],
220
+ "stateMutability": "view",
221
+ "type": "function"
222
+ },
223
+ {
224
+ "inputs": [],
225
+ "name": "prevTotalActiveStake",
226
+ "outputs": [
227
+ {
228
+ "internalType": "uint96",
229
+ "name": "",
230
+ "type": "uint96"
231
+ }
232
+ ],
233
+ "stateMutability": "view",
234
+ "type": "function"
235
+ },
236
+ {
237
+ "inputs": [],
238
+ "name": "prevWeightedActiveAskSum",
239
+ "outputs": [
240
+ {
241
+ "internalType": "uint256",
242
+ "name": "",
243
+ "type": "uint256"
244
+ }
245
+ ],
246
+ "stateMutability": "view",
247
+ "type": "function"
248
+ },
249
+ {
250
+ "inputs": [
251
+ {
252
+ "internalType": "uint96",
253
+ "name": "_prevTotalActiveStake",
254
+ "type": "uint96"
255
+ }
256
+ ],
257
+ "name": "setPrevTotalActiveStake",
258
+ "outputs": [],
259
+ "stateMutability": "nonpayable",
260
+ "type": "function"
261
+ },
262
+ {
263
+ "inputs": [
264
+ {
265
+ "internalType": "uint256",
266
+ "name": "_prevWeightedActiveAskSum",
267
+ "type": "uint256"
268
+ }
269
+ ],
270
+ "name": "setPrevWeightedActiveAskSum",
271
+ "outputs": [],
272
+ "stateMutability": "nonpayable",
273
+ "type": "function"
274
+ },
275
+ {
276
+ "inputs": [
277
+ {
278
+ "internalType": "bool",
279
+ "name": "_status",
280
+ "type": "bool"
281
+ }
282
+ ],
283
+ "name": "setStatus",
284
+ "outputs": [],
285
+ "stateMutability": "nonpayable",
286
+ "type": "function"
287
+ },
288
+ {
289
+ "inputs": [
290
+ {
291
+ "internalType": "uint96",
292
+ "name": "_totalActiveStake",
293
+ "type": "uint96"
294
+ }
295
+ ],
296
+ "name": "setTotalActiveStake",
297
+ "outputs": [],
298
+ "stateMutability": "nonpayable",
299
+ "type": "function"
300
+ },
301
+ {
302
+ "inputs": [
303
+ {
304
+ "internalType": "uint256",
305
+ "name": "_weightedActiveAskSum",
306
+ "type": "uint256"
307
+ }
308
+ ],
309
+ "name": "setWeightedActiveAskSum",
310
+ "outputs": [],
311
+ "stateMutability": "nonpayable",
312
+ "type": "function"
313
+ },
314
+ {
315
+ "inputs": [],
316
+ "name": "status",
317
+ "outputs": [
318
+ {
319
+ "internalType": "bool",
320
+ "name": "",
321
+ "type": "bool"
322
+ }
323
+ ],
324
+ "stateMutability": "view",
325
+ "type": "function"
326
+ },
327
+ {
328
+ "inputs": [],
329
+ "name": "totalActiveStake",
330
+ "outputs": [
331
+ {
332
+ "internalType": "uint96",
333
+ "name": "",
334
+ "type": "uint96"
335
+ }
336
+ ],
337
+ "stateMutability": "view",
338
+ "type": "function"
339
+ },
340
+ {
341
+ "inputs": [],
342
+ "name": "version",
343
+ "outputs": [
344
+ {
345
+ "internalType": "string",
346
+ "name": "",
347
+ "type": "string"
348
+ }
349
+ ],
350
+ "stateMutability": "pure",
351
+ "type": "function"
352
+ },
353
+ {
354
+ "inputs": [],
355
+ "name": "weightedActiveAskSum",
356
+ "outputs": [
357
+ {
358
+ "internalType": "uint256",
359
+ "name": "",
360
+ "type": "uint256"
361
+ }
362
+ ],
363
+ "stateMutability": "view",
364
+ "type": "function"
365
+ }
366
+ ]