Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ java -server -Xmx6g -jar blazegraph.jar

It's highly recommended to use a larger heap size (6GB or 8GB), as the DKG node will require a lot of memory.

Make sure that you have a MySQL instance up and running on the default port 3306, and that the password matches one in .env (REPOSITORY_PASSWORD). This is crucial, otherwise the nodes won't be able to start.
Ensure your MySQL instance is running on port 3306 with the password matching REPOSITORY_PASSWORD in your .env file. Additionally, set up Redis on its default port 6379. Both are required for the nodes to start properly.

Then, depending on the OS, use one of the scripts in order to run the local network with provided number of nodes (minimal amount of nodes should be 6):

Expand Down
10 changes: 2 additions & 8 deletions ot-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import { createRequire } from 'module';
import { execSync } from 'child_process';
import DependencyInjection from './src/service/dependency-injection.js';
import Logger from './src/logger/logger.js';
import {
MIN_NODE_VERSION,
PARANET_ACCESS_POLICY,
NODE_ENVIRONMENTS,
} from './src/constants/constants.js';
import { MIN_NODE_VERSION, PARANET_ACCESS_POLICY } from './src/constants/constants.js';
import FileService from './src/service/file-service.js';
import OtnodeUpdateCommand from './src/commands/common/otnode-update-command.js';
import OtAutoUpdater from './src/modules/auto-updater/implementation/ot-auto-updater.js';
Expand Down Expand Up @@ -76,9 +72,7 @@ class OTNode {
await this.startNetworkModule();
this.resumeCommandExecutor();
await this.initializeProofing();
if (process.env.NODE_ENV !== NODE_ENVIRONMENTS.MAINNET) {
await this.initializeClaimRewards();
}
await this.initializeClaimRewards();
await this.initializeSyncService();
await this.initializeBlazegraphHealthService();

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origintrail_node",
"version": "8.1.1-rc.4",
"version": "8.1.1-rc.5",
"description": "OTNode V8",
"main": "index.js",
"type": "module",
Expand Down
14 changes: 3 additions & 11 deletions src/commands/paranet/paranet-sync-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ class ParanetSyncCommand extends Command {

// TODO: Fix logs? Use word 'Knowledge Collection' or 'Collection' instead of 'Asset'.
async execute(command) {
const { blockchain, operationId, paranetUAL, paranetId, paranetMetadata } = command.data;

const paranetNodesAccessPolicy =
PARANET_NODES_ACCESS_POLICIES[paranetMetadata.nodesAccessPolicy];
const { blockchain, operationId, paranetUAL, paranetId, nodesAccessPolicy } = command.data;
const paranetNodesAccessPolicy = PARANET_NODES_ACCESS_POLICIES[nodesAccessPolicy];

this.logger.info(
`Paranet sync: Starting paranet sync for paranet: ${paranetUAL} (${paranetId}), operation ID: ${operationId}, access policy ${paranetNodesAccessPolicy}`,
Expand Down Expand Up @@ -107,13 +105,7 @@ class ParanetSyncCommand extends Command {

const syncResults = await Promise.all(
syncBatch.map(({ ual }) =>
this.syncKc(
paranetUAL,
ual,
paranetId,
paranetMetadata.nodesAccessPolicy,
operationId,
),
this.syncKc(paranetUAL, ual, paranetId, nodesAccessPolicy, operationId),
),
);

Expand Down
4 changes: 2 additions & 2 deletions src/commands/paranet/start-paranet-sync-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class StartParanetSyncCommands extends Command {
knowledgeCollectionId,
knowledgeAssetId,
);
const paranetMetadata = await this.blockchainModuleManager.getParanetMetadata(
const nodesAccessPolicy = await this.blockchainModuleManager.getNodesAccessPolicy(
blockchain,
paranetId,
);
Expand All @@ -52,7 +52,7 @@ class StartParanetSyncCommands extends Command {
knowledgeAssetId,
paranetUAL,
paranetId,
paranetMetadata,
nodesAccessPolicy,
operationId,
};

Expand Down
62 changes: 50 additions & 12 deletions src/service/proofing-service.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { kcTools } from 'assertion-tools';
import { setTimeout } from 'timers/promises';
import {
PROOFING_INTERVAL,
REORG_PROOFING_BUFFER,
PRIVATE_HASH_SUBJECT_PREFIX,
CHUNK_SIZE,
OPERATION_ID_STATUS,
TRIPLES_VISIBILITY,
PROOFING_MAX_ATTEMPTS,
} from '../constants/constants.js';

class ProofingService {
Expand Down Expand Up @@ -359,21 +363,55 @@ class ProofingService {
}

async fetchAndProcessAssertion(blockchainId, ual, latestChallenge) {
const { contract, knowledgeCollectionId } = this.ualService.resolveUAL(ual);
const tokenIds = await this.blockchainModuleManager.getKnowledgeAssetsRange(
blockchainId,
contract,
knowledgeCollectionId,
let attempt = 0;
let getResult;
const getOperationId = await this.operationIdService.generateOperationId(
OPERATION_ID_STATUS.GET.GET_START,
);

const assertion = await this.tripleStoreService.getAssertion(
blockchainId,
contract,
knowledgeCollectionId,
null,
tokenIds,
'0',
await this.commandExecutor.add({
name: 'getCommand',
sequence: [],
delay: 0,
data: {
operationId: getOperationId,
blockchain: blockchainId,
contract: latestChallenge.contractAddress.toLowerCase(),
knowledgeCollectionId: latestChallenge.knowledgeCollectionId, // latestChallenge.knowledgeCollectionId,
state: 0,
ual,
contentType: TRIPLES_VISIBILITY.PUBLIC,
},
transactional: false,
});

do {
// eslint-disable-next-line no-await-in-loop
await setTimeout(500);
// eslint-disable-next-line no-await-in-loop
getResult = await this.operationIdService.getOperationIdRecord(getOperationId);
attempt += 1;
} while (
attempt < PROOFING_MAX_ATTEMPTS &&
getResult?.status !== OPERATION_ID_STATUS.FAILED &&
getResult?.status !== OPERATION_ID_STATUS.COMPLETED
);

if (getResult?.status !== OPERATION_ID_STATUS.COMPLETED) {
// We need to stop here and retry later
throw new Error(
`[PROOFING] Unable to Proofing GET Knowledge Collection for proof Id: ${
latestChallenge.knowledgeCollectionId
}, for contract: ${latestChallenge.contractAddress}, state index: ${
latestChallenge.stateIndex
}, blockchain: ${blockchainId}, GET result: ${JSON.stringify(getResult)}`,
);
}

const { assertion } = await this.operationIdService.getCachedOperationIdData(
getOperationId,
);

this.logger.debug(
`[PROOFING] Proofing GET: ${assertion.public.length} nquads found for asset with ual: ${ual}`,
);
Expand Down
Loading