Skip to content

Commit 1790959

Browse files
Merge pull request #4047 from OriginTrail/chore/version-to-8.2.0
v8.2.0 Mainnet Prerelease
2 parents 080d35e + 9dddf3e commit 1790959

File tree

18 files changed

+27367
-2877
lines changed

18 files changed

+27367
-2877
lines changed

ot-node.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class OTNode {
7474
await this.initializeProofing();
7575
await this.initializeClaimRewards();
7676
await this.initializeSyncService();
77-
await this.initializeBlazegraphHealthService();
7877

7978
this.logger.info('Node is up and running!');
8079
}
@@ -429,12 +428,6 @@ class OTNode {
429428
await syncService.initialize();
430429
}
431430

432-
async initializeBlazegraphHealthService() {
433-
const blazegraphHealthService = this.container.resolve('blazegraphHealthService');
434-
await blazegraphHealthService.initialize();
435-
this.logger.info('Blazegraph Health Service initialized successfully');
436-
}
437-
438431
stop(code = 0) {
439432
this.logger.info('Stopping node...');
440433
process.exit(code);

package-lock.json

Lines changed: 27165 additions & 2603 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "origintrail_node",
3-
"version": "8.1.1-rc.9",
3+
"version": "8.2.0",
44
"description": "OTNode V8",
55
"main": "index.js",
66
"type": "module",

src/commands/protocols/common/handle-protocol-message-command.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ class HandleProtocolMessageCommand extends Command {
2222
async execute(command) {
2323
const { remotePeerId, operationId, protocol, blockchain } = command.data;
2424

25-
this.operationIdService.updateOperationIdStatus(
26-
operationId,
27-
blockchain,
28-
this.operationStartEvent,
29-
);
25+
this.operationIdService.emitChangeEvent(this.operationStartEvent, operationId, blockchain);
3026

3127
try {
3228
const { messageType, messageData } = await this.prepareMessage(command.data);
@@ -38,11 +34,6 @@ class HandleProtocolMessageCommand extends Command {
3834
operationId,
3935
messageData,
4036
);
41-
await this.operationIdService.updateOperationIdStatus(
42-
operationId,
43-
blockchain,
44-
this.operationEndEvent,
45-
);
4637
} catch (error) {
4738
if (command.retries) {
4839
this.logger.warn(error.message);
@@ -122,7 +113,19 @@ class HandleProtocolMessageCommand extends Command {
122113
async handleError(errorMessage, command) {
123114
const { operationId, blockchain, remotePeerId, protocol } = command.data;
124115

125-
await super.handleError(operationId, blockchain, errorMessage, this.errorType, true);
116+
this.logger.error(`Command error (${this.errorType}): ${errorMessage}`);
117+
if (errorMessage !== null) {
118+
this.logger.debug(`Marking operation id ${operationId} as failed`);
119+
await this.operationIdService.removeOperationIdCache(operationId);
120+
}
121+
this.operationIdService.emitChangeEvent(
122+
this.errorType,
123+
operationId,
124+
blockchain,
125+
errorMessage,
126+
this.errorType,
127+
);
128+
126129
await this.networkModuleManager.sendMessageResponse(
127130
protocol,
128131
remotePeerId,

src/commands/protocols/finality/receiver/v1.0.0/v1-0-0-handle-finality-request-command.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ class HandleFinalityRequestCommand extends HandleProtocolMessageCommand {
3737
if (state) {
3838
ualWithState = `${ual}:${state}`;
3939
}
40-
await this.operationIdService.updateOperationIdStatus(
40+
41+
this.operationIdService.emitChangeEvent(
42+
OPERATION_ID_STATUS.FINALITY.PUBLISH_FINALITY_REMOTE_START,
4143
operationId,
4244
blockchain,
43-
OPERATION_ID_STATUS.FINALITY.PUBLISH_FINALITY_REMOTE_START,
4445
);
4546

4647
let response;
@@ -70,10 +71,10 @@ class HandleFinalityRequestCommand extends HandleProtocolMessageCommand {
7071
OPERATION_ID_STATUS.FINALITY.PUBLISH_FINALITY_END,
7172
OPERATION_ID_STATUS.COMPLETED,
7273
]);
73-
await this.operationIdService.updateOperationIdStatus(
74+
this.operationIdService.emitChangeEvent(
75+
OPERATION_ID_STATUS.FINALITY.PUBLISH_FINALITY_REMOTE_END,
7476
operationId,
7577
blockchain,
76-
OPERATION_ID_STATUS.FINALITY.PUBLISH_FINALITY_REMOTE_END,
7778
);
7879

7980
// eslint-disable-next-line no-param-reassign

src/commands/protocols/get/receiver/v1.0.0/v1-0-0-handle-batch-get-request-command.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class HandleBatchGetRequestCommand extends HandleProtocolMessageCommand {
3939
this.logger.startTimer(
4040
`HandleBatchGetRequestCommand [PREPARE]: ${operationId} ${uals.length}`,
4141
);
42-
await this.operationIdService.updateOperationIdStatus(
42+
await this.operationIdService.emitChangeEvent(
43+
this.operationStartEvent,
4344
operationId,
4445
blockchain,
45-
this.operationStartEvent,
4646
);
4747

4848
// Trim uals and tokenIds to the max limit of BATCH_GET_UAL_MAX_LIMIT
@@ -108,10 +108,10 @@ class HandleBatchGetRequestCommand extends HandleProtocolMessageCommand {
108108
);
109109

110110
if (assertions?.length) {
111-
await this.operationIdService.updateOperationIdStatus(
111+
await this.operationIdService.emitChangeEvent(
112+
this.operationEndEvent,
112113
operationId,
113114
blockchain,
114-
this.operationEndEvent,
115115
);
116116
}
117117

src/commands/protocols/get/receiver/v1.0.0/v1-0-0-handle-get-request-command.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand {
118118
blockchain,
119119
contract,
120120
knowledgeCollectionId,
121-
knowledgeAssetId,
122121
);
123122
promises.push(metadataPromise);
124123
}
@@ -161,7 +160,6 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand {
161160
blockchain,
162161
contract,
163162
knowledgeCollectionId,
164-
knowledgeAssetId,
165163
);
166164
promises.push(metadataPromise);
167165
}
@@ -174,10 +172,10 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand {
174172
};
175173

176174
if (assertion?.public?.length || assertion?.length) {
177-
await this.operationIdService.updateOperationIdStatus(
175+
await this.operationIdService.emitChangeEvent(
176+
this.operationEndEvent,
178177
operationId,
179178
blockchain,
180-
OPERATION_ID_STATUS.GET.GET_REMOTE_END,
181179
);
182180
}
183181

src/commands/protocols/get/sender/get-command.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ class GetCommand extends Command {
3939
errorMessage,
4040
errorType,
4141
);
42-
this.operationIdService.emitChangeEvent(OPERATION_ID_STATUS.GET.GET_FAILED, operationId);
42+
this.operationIdService.emitChangeEvent(
43+
OPERATION_ID_STATUS.GET.GET_FAILED,
44+
operationId,
45+
blockchain,
46+
);
4347
}
4448

4549
/**
@@ -150,10 +154,11 @@ class GetCommand extends Command {
150154
return Command.empty();
151155
}
152156
}
153-
await this.operationIdService.updateOperationIdStatus(
157+
158+
this.operationIdService.emitChangeEvent(
159+
OPERATION_ID_STATUS.GET.GET_VALIDATE_ASSET_END,
154160
operationId,
155161
blockchain,
156-
OPERATION_ID_STATUS.GET.GET_VALIDATE_ASSET_END,
157162
);
158163

159164
await this.operationIdService.updateOperationIdStatus(
@@ -258,10 +263,10 @@ class GetCommand extends Command {
258263
}
259264
this.logger.debug(`Could not find asset with UAL: ${ual} locally`);
260265

261-
await this.operationIdService.updateOperationIdStatus(
266+
await this.operationIdService.emitChangeEvent(
267+
OPERATION_ID_STATUS.GET.GET_LOCAL_END,
262268
operationId,
263269
blockchain,
264-
OPERATION_ID_STATUS.GET.GET_LOCAL_END,
265270
);
266271

267272
await this.operationIdService.updateOperationIdStatus(

src/commands/protocols/publish/publish-finalization-command.js

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ class PublishFinalizationCommand extends Command {
3232
const { txHash, blockNumber } = event;
3333
const { id, publishOperationId, merkleRoot, byteSize } = eventData;
3434
const { blockchain, contractAddress } = event;
35-
const operationId = await this.operationIdService.generateOperationId(
35+
const operationId = this.operationIdService.generateId();
36+
this.operationIdService.emitChangeEvent(
3637
OPERATION_ID_STATUS.PUBLISH_FINALIZATION.PUBLISH_FINALIZATION_START,
38+
operationId,
3739
blockchain,
3840
publishOperationId,
3941
);
@@ -103,10 +105,10 @@ class PublishFinalizationCommand extends Command {
103105
}
104106

105107
try {
106-
await this.operationIdService.updateOperationIdStatus(
108+
await this.operationIdService.emitChangeEvent(
109+
OPERATION_ID_STATUS.PUBLISH_FINALIZATION.PUBLISH_FINALIZATION_STORE_ASSERTION_START,
107110
operationId,
108111
blockchain,
109-
OPERATION_ID_STATUS.PUBLISH_FINALIZATION.PUBLISH_FINALIZATION_STORE_ASSERTION_START,
110112
);
111113

112114
const totalTriples = await this.tripleStoreService.insertKnowledgeCollection(
@@ -119,10 +121,10 @@ class PublishFinalizationCommand extends Command {
119121
await this.repositoryModuleManager.incrementInsertedTriples(totalTriples ?? 0);
120122
this.logger.info(`Number of triples added to the database +${totalTriples}`);
121123

122-
await this.operationIdService.updateOperationIdStatus(
124+
await this.operationIdService.emitChangeEvent(
125+
OPERATION_ID_STATUS.PUBLISH_FINALIZATION.PUBLISH_FINALIZATION_STORE_ASSERTION_END,
123126
operationId,
124127
blockchain,
125-
OPERATION_ID_STATUS.PUBLISH_FINALIZATION.PUBLISH_FINALIZATION_STORE_ASSERTION_END,
126128
);
127129

128130
const myPeerId = this.networkModuleManager.getPeerId().toB58String();
@@ -133,15 +135,9 @@ class PublishFinalizationCommand extends Command {
133135
publisherPeerId,
134136
);
135137

136-
await this.operationService.markOperationAsCompleted(
137-
operationId,
138-
blockchain,
139-
{
140-
completedNodes: 1,
141-
allNodesReplicatedData: true,
142-
},
143-
[...this.operationService.completedStatuses],
144-
);
138+
for (const status of this.operationService.completedStatuses) {
139+
this.operationIdService.emitChangeEvent(status, operationId, blockchain);
140+
}
145141
} else {
146142
const networkProtocols = this.operationService.getNetworkProtocols();
147143
const node = { id: publisherPeerId, protocol: networkProtocols[0] };
@@ -164,7 +160,8 @@ class PublishFinalizationCommand extends Command {
164160
);
165161
}
166162
} catch (e) {
167-
await this.handleError(operationId, blockchain, e.message, this.errorType, true);
163+
this.logger.error(`Command error (${this.errorType}): ${e.message}`);
164+
168165
this.operationIdService.emitChangeEvent(
169166
OPERATION_ID_STATUS.FAILED,
170167
operationId,
@@ -187,12 +184,14 @@ class PublishFinalizationCommand extends Command {
187184
) {
188185
try {
189186
if (merkleRoot !== cachedMerkleRoot) {
190-
await this.handleError(
187+
const errorMessage = `Invalid Merkle Root for Knowledge Collection: ${ual}. Received value from blockchain: ${merkleRoot}, Cached value from publish operation: ${cachedMerkleRoot}`;
188+
189+
this.logger.error(`Command error (${this.errorType}): ${errorMessage}`);
190+
191+
this.operationIdService.emitChangeEvent(
192+
OPERATION_ID_STATUS.FAILED,
191193
operationId,
192194
blockchain,
193-
`Invalid Merkle Root for Knowledge Collection: ${ual}. Received value from blockchain: ${merkleRoot}, Cached value from publish operation: ${cachedMerkleRoot}`,
194-
this.errorType,
195-
true,
196195
);
197196
}
198197

@@ -201,16 +200,24 @@ class PublishFinalizationCommand extends Command {
201200
);
202201

203202
if (byteSize.toString() !== calculatedAssertionSize.toString()) {
204-
await this.handleError(
203+
const errorMessage = `Invalid Assertion Size for Knowledge Collection: ${ual}. Received value from blockchain: ${byteSize}, Calculated value: ${calculatedAssertionSize}`;
204+
205+
this.logger.error(`Command error (${this.errorType}): ${errorMessage}`);
206+
207+
this.operationIdService.emitChangeEvent(
208+
OPERATION_ID_STATUS.FAILED,
205209
operationId,
206210
blockchain,
207-
`Invalid Assertion Size for Knowledge Collection: ${ual}. Received value from blockchain: ${byteSize}, Calculated value: ${calculatedAssertionSize}`,
208-
this.errorType,
209-
true,
210211
);
211212
}
212213
} catch (e) {
213-
await this.handleError(operationId, blockchain, e.message, this.errorType, true);
214+
this.logger.error(`Command error (${this.errorType}): ${e.message}`);
215+
216+
this.operationIdService.emitChangeEvent(
217+
OPERATION_ID_STATUS.FAILED,
218+
operationId,
219+
blockchain,
220+
);
214221
throw e;
215222
}
216223
}

src/commands/protocols/publish/receiver/v1.0.0/v1-0-0-handle-store-request-command.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class HandleStoreRequestCommand extends HandleProtocolMessageCommand {
2929
async prepareMessage(commandData) {
3030
const { blockchain, operationId, datasetRoot, remotePeerId, isOperationV0 } = commandData;
3131

32-
await this.operationIdService.updateOperationIdStatus(
32+
await this.operationIdService.emitChangeEvent(
33+
OPERATION_ID_STATUS.PUBLISH.PUBLISH_VALIDATE_ASSET_REMOTE_START,
3334
operationId,
3435
blockchain,
35-
OPERATION_ID_STATUS.PUBLISH.PUBLISH_VALIDATE_ASSET_REMOTE_START,
3636
);
3737

3838
const { dataset } = await this.operationIdService.getCachedOperationIdData(operationId);
@@ -45,20 +45,20 @@ class HandleStoreRequestCommand extends HandleProtocolMessageCommand {
4545
isOperationV0,
4646
);
4747

48-
await this.operationIdService.updateOperationIdStatus(
48+
await this.operationIdService.emitChangeEvent(
49+
OPERATION_ID_STATUS.PUBLISH.PUBLISH_VALIDATE_ASSET_REMOTE_END,
4950
operationId,
5051
blockchain,
51-
OPERATION_ID_STATUS.PUBLISH.PUBLISH_VALIDATE_ASSET_REMOTE_END,
5252
);
5353

5454
if (validationResult.messageType === NETWORK_MESSAGE_TYPES.RESPONSES.NACK) {
5555
return validationResult;
5656
}
5757

58-
await this.operationIdService.updateOperationIdStatus(
58+
await this.operationIdService.emitChangeEvent(
59+
OPERATION_ID_STATUS.PUBLISH.PUBLISH_LOCAL_STORE_REMOTE_CACHE_DATASET_START,
5960
operationId,
6061
blockchain,
61-
OPERATION_ID_STATUS.PUBLISH.PUBLISH_LOCAL_STORE_REMOTE_CACHE_DATASET_START,
6262
);
6363
if (isOperationV0) {
6464
const { contract, tokenId } = commandData;
@@ -72,20 +72,20 @@ class HandleStoreRequestCommand extends HandleProtocolMessageCommand {
7272
remotePeerId,
7373
);
7474
}
75-
await this.operationIdService.updateOperationIdStatus(
75+
await this.operationIdService.emitChangeEvent(
76+
OPERATION_ID_STATUS.PUBLISH.PUBLISH_LOCAL_STORE_REMOTE_CACHE_DATASET_END,
7677
operationId,
7778
blockchain,
78-
OPERATION_ID_STATUS.PUBLISH.PUBLISH_LOCAL_STORE_REMOTE_CACHE_DATASET_END,
7979
);
8080

8181
const identityId = await this.blockchainModuleManager.getIdentityId(blockchain);
8282

8383
const { v, r, s, vs } = await this.signatureService.signMessage(blockchain, datasetRoot);
8484

85-
await this.operationIdService.updateOperationIdStatus(
85+
await this.operationIdService.emitChangeEvent(
86+
OPERATION_ID_STATUS.PUBLISH.PUBLISH_VALIDATE_ASSET_REMOTE_END,
8687
operationId,
8788
blockchain,
88-
OPERATION_ID_STATUS.PUBLISH.PUBLISH_VALIDATE_ASSET_REMOTE_END,
8989
);
9090

9191
return {

0 commit comments

Comments
 (0)