Skip to content

Commit

Permalink
Merge pull request #3214 from OriginTrail/v6/prerelease/mainnet
Browse files Browse the repository at this point in the history
OriginTrail Mainnet Release v6.4.0
  • Loading branch information
NZT48 authored Jun 13, 2024
2 parents 06edd66 + d5d5eb4 commit 3318eb4
Show file tree
Hide file tree
Showing 29 changed files with 10,977 additions and 7,553 deletions.
15 changes: 15 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "info",
"assetSync": {
"syncParanets": []
},
"auth": {
"ipBasedAuthEnabled": true,
"tokenBasedAuthEnabled": false,
Expand Down Expand Up @@ -317,6 +320,9 @@
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"assetSync": {
"syncParanets": []
},
"auth": {
"ipBasedAuthEnabled": true,
"tokenBasedAuthEnabled": false,
Expand Down Expand Up @@ -488,6 +494,9 @@
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"assetSync": {
"syncParanets": []
},
"auth": {
"ipBasedAuthEnabled": true,
"tokenBasedAuthEnabled": false,
Expand Down Expand Up @@ -659,6 +668,9 @@
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"assetSync": {
"syncParanets": []
},
"auth": {
"ipBasedAuthEnabled": true,
"tokenBasedAuthEnabled": false,
Expand Down Expand Up @@ -830,6 +842,9 @@
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"assetSync": {
"syncParanets": []
},
"auth": {
"ipBasedAuthEnabled": true,
"tokenBasedAuthEnabled": false,
Expand Down
52 changes: 52 additions & 0 deletions ot-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class OTNode {
this.initializeEventEmitter();

await this.initializeModules();
await this.initializeParanets();

await MigrationExecutor.executeRemoveServiceAgreementsForChiadoMigration(
this.container,
Expand Down Expand Up @@ -341,6 +342,57 @@ class OTNode {
await autoUpdaterCommand.execute();
}

async initializeParanets() {
const blockchainModuleManager = this.container.resolve('blockchainModuleManager');
const tripleStoreService = this.container.resolve('tripleStoreService');
const tripleStoreModuleManager = this.container.resolve('tripleStoreModuleManager');
const paranetService = this.container.resolve('paranetService');
const ualService = this.container.resolve('ualService');
const validParanets = [];

// eslint-disable-next-line no-unsafe-optional-chaining
for (const paranetUAL of this.config.assetSync?.syncParanets) {
if (!ualService.isUAL(paranetUAL)) {
this.logger.warn(
`Unable to initialize Paranet with id ${paranetUAL} because of invalid UAL format`,
);
} else {
const { blockchain, contract, tokenId } = ualService.resolveUAL(paranetUAL);
if (!blockchainModuleManager.getImplementationNames().includes(blockchain)) {
this.logger.warn(
`Unable to initialize Paranet with id ${paranetUAL} because of unsupported blockchain implementation`,
);
} else {
const paranetId = paranetService.constructParanetId(
blockchain,
contract,
tokenId,
);
// eslint-disable-next-line no-await-in-loop
const paranetExists = await blockchainModuleManager.paranetExists(
blockchain,
paranetId,
);
if (!paranetExists) {
this.logger.warn(
`Unable to initialize Paranet with id ${paranetUAL} because it doesn't exist`,
);
} else {
validParanets.push(paranetUAL);
const repository = paranetService.getParanetRepositoryName(paranetUAL);
// eslint-disable-next-line no-await-in-loop
await tripleStoreModuleManager.initializeParanetRepository(repository);
// eslint-disable-next-line no-await-in-loop
await paranetService.initializeParanetRecord(blockchain, paranetId);
}
}
}
}

this.config.assetSync.syncParanets = validParanets;
tripleStoreService.initializeRepositories();
}

stop(code = 0) {
this.logger.info('Stopping node...');
process.exit(code);
Expand Down
Loading

0 comments on commit 3318eb4

Please sign in to comment.