From 43e3649b919ea0e66513ed3bba06e3030ba7e42e Mon Sep 17 00:00:00 2001 From: Djordje Kovacevic Date: Tue, 16 Apr 2024 10:21:35 +0200 Subject: [PATCH 01/82] Added sync commands for paranets --- config/config.json | 15 ++ ot-node.js | 28 +++ src/commands/paranet/paranet-sync-command.js | 206 ++++++++++++++++++ .../paranet/start-paranet-sync-commands.js | 69 ++++++ src/constants/constants.js | 6 + .../implementation/ot-triple-store.js | 6 +- .../triple-store-module-manager.js | 4 + src/service/paranet-id-service.js | 14 ++ src/service/triple-store-service.js | 8 + 9 files changed, 355 insertions(+), 1 deletion(-) create mode 100644 src/commands/paranet/paranet-sync-command.js create mode 100644 src/commands/paranet/start-paranet-sync-commands.js create mode 100644 src/service/paranet-id-service.js diff --git a/config/config.json b/config/config.json index 7b3b4121e0..9b1d8b10a8 100644 --- a/config/config.json +++ b/config/config.json @@ -159,6 +159,9 @@ "commandExecutorVerboseLoggingEnabled": false, "appDataPath": "data", "logLevel": "info", + "assetSync": { + "syncParanets": [] + }, "auth": { "ipBasedAuthEnabled": true, "tokenBasedAuthEnabled": false, @@ -317,6 +320,9 @@ "commandExecutorVerboseLoggingEnabled": false, "appDataPath": "data", "logLevel": "trace", + "assetSync": { + "syncParanets": [] + }, "auth": { "ipBasedAuthEnabled": true, "tokenBasedAuthEnabled": false, @@ -488,6 +494,9 @@ "commandExecutorVerboseLoggingEnabled": false, "appDataPath": "data", "logLevel": "trace", + "assetSync": { + "syncParanets": [] + }, "auth": { "ipBasedAuthEnabled": true, "tokenBasedAuthEnabled": false, @@ -659,6 +668,9 @@ "commandExecutorVerboseLoggingEnabled": false, "appDataPath": "data", "logLevel": "trace", + "assetSync": { + "syncParanets": [] + }, "auth": { "ipBasedAuthEnabled": true, "tokenBasedAuthEnabled": false, @@ -830,6 +842,9 @@ "commandExecutorVerboseLoggingEnabled": false, "appDataPath": "data", "logLevel": "trace", + "assetSync": { + "syncParanets": [] + }, "auth": { "ipBasedAuthEnabled": true, "tokenBasedAuthEnabled": false, diff --git a/ot-node.js b/ot-node.js index 06a00c7bab..a1be1cd700 100644 --- a/ot-node.js +++ b/ot-node.js @@ -341,6 +341,34 @@ class OTNode { await autoUpdaterCommand.execute(); } + initializeParanets() { + const paranetIdService = this.container.resolve('paranetIdService'); + const blockchainModuleManager = this.container.resolve('blockchainModuleManager'); + const tripleStoreService = this.container.resolve('tripleStoreService'); + const tripleStoreModuleManager = this.container.resolve('tripleStoreModuleManager'); + const invalidParanets = []; + const validParanets = []; + this.config.assetSync?.syncParanets.forEach((paranetId) => { + if (!paranetIdService.isUAL(paranetId)) { + invalidParanets.push(paranetId); + this.logger.warn(''); + } else { + const { blockchainId } = paranetIdService.resolveUAL(paranetId); + if (!blockchainModuleManager.getImplementationNames().includes(blockchainId)) { + invalidParanets.push(paranetId); + this.logger.warn(''); + } else { + validParanets.push(paranetId); + const repository = paranetIdService.getParanetRepositoryName(paranetId); + tripleStoreModuleManager.initializeRepository(repository); + } + } + }); + this.config.assetSync.syncParanets = validParanets; + + tripleStoreService.initializeRepositories(); + } + stop(code = 0) { this.logger.info('Stopping node...'); process.exit(code); diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js new file mode 100644 index 0000000000..193a398df4 --- /dev/null +++ b/src/commands/paranet/paranet-sync-command.js @@ -0,0 +1,206 @@ +import Command from '../command.js'; +import { ERROR_TYPE, PARANET_SYNC_FREQUENCY_MILLS } from '../../constants/constants.js'; + +class StartParanetSyncCommands extends Command { + constructor(ctx) { + super(ctx); + this.commandExecutor = ctx.commandExecutor; + this.blockchainModuleManager = ctx.blockchainModuleManager; + this.tripleStoreService = ctx.tripleStoreService; + + this.errorType = ERROR_TYPE.PARANET.PARANET_SYNC_ERROR; + } + + async execute(command) { + const { operationId, paranetId } = command.data; + + this.logger.info( + `Paranet sync: Starting paranet sync command for ${paranetId} with operation id: ${operationId}`, + ); + + // get missed token ids for paranet + + // schedule get commands for each asset + + // store in paranet repository + + return Command.repeat(); + } + + // async syncAsset(tokenId, blockchain, contract) { + // const assertionIds = await this.blockchainModuleManager.getLatestAssertionId( + // blockchain, + // contract, + // tokenId, + // ); + // + // // eslint-disable-next-line for-direction + // for (let stateIndex = assertionIds.length - 1; stateIndex < 0; stateIndex -= 1) { + // try { + // // if ( + // // await this.repositoryModuleManager.isStateSynced( + // // blockchain, + // // contract, + // // tokenId, + // // stateIndex, + // // ) + // // ) { + // // this.logger.trace( + // // `ASSET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} already synced blockchain: ${blockchain}`, + // // ); + // // await this.repositoryModuleManager.updateAssetSyncRecord( + // // blockchain, + // // contract, + // // tokenId, + // // stateIndex, + // // ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, + // // true, + // // ); + // // continue; + // // } + // + // const statePresentInParanetRepository = await this.tripleStoreService.assetExists( + // paranet, + // tokenId, + // stateIndex, + // assertionIds, + // ); + // + // if (await this.isStatePresentInRepository(tokenId, stateIndex, assertionIds)) { + // this.logger.trace( + // `ASSET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} found in triple store blockchain: ${blockchain}`, + // ); + // await this.repositoryModuleManager.createAssetSyncRecord( + // blockchain, + // contract, + // tokenId, + // stateIndex, + // ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, + // true, + // ); + // continue; + // } + // + // const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); + // this.logger.debug( + // `ASSET_SYNC: Fetching state index: ${stateIndex + 1} of ${ + // assertionIds.length + // } for asset with ual: ${ual}. blockchain: ${blockchain}`, + // ); + // const assertionId = assertionIds[stateIndex]; + // + // const operationId = await this.operationIdService.generateOperationId( + // OPERATION_ID_STATUS.GET.GET_START, + // ); + // + // await Promise.all([ + // this.operationIdService.updateOperationIdStatus( + // operationId, + // blockchain, + // OPERATION_ID_STATUS.GET.GET_INIT_START, + // ), + // + // this.repositoryModuleManager.createAssetSyncRecord( + // blockchain, + // contract, + // tokenId, + // stateIndex, + // ASSET_SYNC_PARAMETERS.STATUS.IN_PROGRESS, + // ), + // + // this.repositoryModuleManager.createOperationRecord( + // this.getService.getOperationName(), + // operationId, + // OPERATION_STATUS.IN_PROGRESS, + // ), + // ]); + // + // const hashFunctionId = CONTENT_ASSET_HASH_FUNCTION_ID; + // + // this.logger.debug( + // `ASSET_SYNC: Get for ${ual} with operation id ${operationId} initiated. blockchain: ${blockchain}`, + // ); + // + // await this.commandExecutor.add({ + // name: 'networkGetCommand', + // sequence: [], + // delay: 0, + // data: { + // operationId, + // id: ual, + // blockchain, + // contract, + // tokenId, + // state: assertionId, + // hashFunctionId, + // assertionId, + // assetSync: true, + // stateIndex, + // assetSyncInsertedByCommand: true, + // }, + // transactional: false, + // }); + // + // await this.operationIdService.updateOperationIdStatus( + // operationId, + // blockchain, + // OPERATION_ID_STATUS.GET.GET_INIT_END, + // ); + // + // let attempt = 0; + // let getResult; + // do { + // await setTimeout(ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_INTERVAL_MILLIS); + // + // getResult = await this.operationIdService.getOperationIdRecord(operationId); + // attempt += 1; + // } while ( + // attempt < ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_MAX_ATTEMPTS && + // getResult?.status !== OPERATION_ID_STATUS.FAILED && + // getResult?.status !== OPERATION_ID_STATUS.COMPLETED + // ); + // } catch (error) { + // this.logger.warn( + // `ASSET_SYNC: Unable to sync tokenId: ${tokenId}, for contract: ${contract} state index: ${stateIndex} blockchain: ${blockchain}, error: ${error}`, + // ); + // await this.repositoryModuleManager.updateAssetSyncRecord( + // blockchain, + // contract, + // tokenId, + // stateIndex, + // ASSET_SYNC_PARAMETERS.STATUS.FAILED, + // true, + // ); + // } + // } + // } + + /** + * Recover system from failure + * @param command + * @param error + */ + async recover(command) { + this.logger.warn(`Failed to execute ${command.name}. Error: ${command.message}`); + + return Command.repeat(); + } + + /** + * Builds default paranetSyncCommands + * @param map + * @returns {{add, data: *, delay: *, deadline: *}} + */ + default(map) { + const command = { + name: 'paranetSyncCommands', + data: {}, + transactional: false, + period: PARANET_SYNC_FREQUENCY_MILLS, + }; + Object.assign(command, map); + return command; + } +} + +export default StartParanetSyncCommands; diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js new file mode 100644 index 0000000000..b37f69535d --- /dev/null +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -0,0 +1,69 @@ +import Command from '../command.js'; +import { ERROR_TYPE, PARANET_SYNC_FREQUENCY_MILLS } from '../../constants/constants.js'; + +class StartParanetSyncCommands extends Command { + constructor(ctx) { + super(ctx); + this.commandExecutor = ctx.commandExecutor; + this.blockchainModuleManager = ctx.blockchainModuleManager; + + this.errorType = ERROR_TYPE.PARANET.START_PARANET_SYNC_ERROR; + } + + async execute() { + const operationId = this.operationIdService.generateId(); + + this.logger.info( + `Paranet sync: Starting Paranet sync command for operation id: ${operationId}`, + ); + + await this.commandExecutor.delete('paranetSyncCommand'); + + await Promise.all( + this.config.assetSync?.syncParanets.map(async (paranetId) => { + // validate paranet id before scheduling paranet sync command + + const commandData = { + paranetId, + operationId, + }; + + return this.commandExecutor.add({ + name: 'paranetSyncCommand', + data: commandData, + period: PARANET_SYNC_FREQUENCY_MILLS, + }); + }), + ); + + return Command.empty(); + } + + /** + * Recover system from failure + * @param command + * @param error + */ + async recover(command) { + this.logger.warn(`Failed to execute ${command.name}. Error: ${command.message}`); + + return Command.repeat(); + } + + /** + * Builds default startParanetSyncCommands + * @param map + * @returns {{add, data: *, delay: *, deadline: *}} + */ + default(map) { + const command = { + name: 'startParanetSyncCommands', + data: {}, + transactional: false, + }; + Object.assign(command, map); + return command; + } +} + +export default StartParanetSyncCommands; diff --git a/src/constants/constants.js b/src/constants/constants.js index be2b6d2da2..5764523a86 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -150,6 +150,8 @@ export const HIGH_TRAFFIC_OPERATIONS_NUMBER_PER_HOUR = 16000; export const SHARDING_TABLE_CHECK_COMMAND_FREQUENCY_MINUTES = 30; +export const PARANET_SYNC_FREQUENCY_MILLS = 5 * 1000; + export const SEND_TELEMETRY_COMMAND_FREQUENCY_MINUTES = 15; export const PEER_RECORD_UPDATE_DELAY = 30 * 60 * 1000; // 30 minutes @@ -352,6 +354,10 @@ export const ERROR_TYPE = { GET_BID_SUGGESTION: { UNSUPPORTED_BID_SUGGESTION_RANGE_ERROR: 'UnsupportedBidSuggestionRangeError', }, + PARANET: { + START_PARANET_SYNC_ERROR: 'StartParanetSyncError', + PARANET_SYNC_ERROR: 'ParanetSyncError', + }, }; export const OPERATION_ID_STATUS = { PENDING: 'PENDING', diff --git a/src/modules/triple-store/implementation/ot-triple-store.js b/src/modules/triple-store/implementation/ot-triple-store.js index 5e0866f182..0a58b4dbfe 100644 --- a/src/modules/triple-store/implementation/ot-triple-store.js +++ b/src/modules/triple-store/implementation/ot-triple-store.js @@ -19,10 +19,14 @@ class OtTripleStore { initializeRepositories() { for (const repository of Object.keys(this.repositories)) { - this.initializeSparqlEndpoints(repository); + this.initializeRepository(repository); } } + initializeRepository(repository) { + this.initializeSparqlEndpoints(repository); + } + initializeSparqlEndpoints() { throw Error('initializeSparqlEndpoints not implemented'); } diff --git a/src/modules/triple-store/triple-store-module-manager.js b/src/modules/triple-store/triple-store-module-manager.js index 11c46f1d6d..03365f8fa6 100644 --- a/src/modules/triple-store/triple-store-module-manager.js +++ b/src/modules/triple-store/triple-store-module-manager.js @@ -1,6 +1,10 @@ import BaseModuleManager from '../base-module-manager.js'; class TripleStoreModuleManager extends BaseModuleManager { + initializeRepository(repository) { + return this.getImplementation().module.initializeRepository(repository); + } + async insertAssetAssertionMetadata(implementationName, repository, assetNquads) { if (this.getImplementation(implementationName)) { return this.getImplementation(implementationName).module.insertAssetAssertionMetadata( diff --git a/src/service/paranet-id-service.js b/src/service/paranet-id-service.js new file mode 100644 index 0000000000..a21c8ae23e --- /dev/null +++ b/src/service/paranet-id-service.js @@ -0,0 +1,14 @@ +import UalService from './ual-service.js'; + +class ParanetIdService extends UalService { + getParanetRepositoryName(paranetId) { + if (this.isUAL(paranetId)) { + return paranetId.replace('/', '-'); + } + throw new Error( + `Unable to get Paranet repository name. Paranet id doesn't have correct format: ${paranetId}`, + ); + } +} + +export default ParanetIdService; diff --git a/src/service/triple-store-service.js b/src/service/triple-store-service.js index 787476ede5..5b6049c544 100644 --- a/src/service/triple-store-service.js +++ b/src/service/triple-store-service.js @@ -10,7 +10,10 @@ class TripleStoreService { this.tripleStoreModuleManager = ctx.tripleStoreModuleManager; this.ualService = ctx.ualService; this.dataService = ctx.dataService; + this.paranetIdService = ctx.paranetIdService; + } + initializeRepositories() { this.repositoryImplementations = {}; for (const implementationName of this.tripleStoreModuleManager.getImplementationNames()) { for (const repository in this.tripleStoreModuleManager.getImplementation( @@ -278,6 +281,11 @@ class TripleStoreService { ); } + async paranetAssetExists(paranetId, blockchain, contract, tokenId) { + const repository = this.paranetIdService.getParanetRepositoryName(paranetId); + return this.assetExists(repository, blockchain, contract, tokenId); + } + async insertAssetAssertionLink(repository, blockchain, contract, tokenId, assertionId) { const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); this.logger.info( From 23fb4d84a9a9300f3620b3a8f8799e8cb1cd6bc9 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Wed, 17 Apr 2024 12:06:44 +0200 Subject: [PATCH 02/82] Refactor syncAsset a bit --- src/commands/paranet/paranet-sync-command.js | 315 ++++++++++--------- 1 file changed, 163 insertions(+), 152 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 193a398df4..fabbc5ef3e 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -1,5 +1,7 @@ +/* eslint-disable no-unused-vars */ +/* eslint-disable no-await-in-loop */ import Command from '../command.js'; -import { ERROR_TYPE, PARANET_SYNC_FREQUENCY_MILLS } from '../../constants/constants.js'; +import { ERROR_TYPE, PARANET_SYNC_FREQUENCY_MILLS, OPERATION_ID_STATUS, CONTENT_ASSET_HASH_FUNCTION_ID } from '../../constants/constants.js'; class StartParanetSyncCommands extends Command { constructor(ctx) { @@ -12,168 +14,177 @@ class StartParanetSyncCommands extends Command { } async execute(command) { - const { operationId, paranetId } = command.data; + const { commandOperationId, paranetId } = command.data; this.logger.info( - `Paranet sync: Starting paranet sync command for ${paranetId} with operation id: ${operationId}`, + `Paranet sync: Starting paranet sync command for ${paranetId} with operation id: ${commandOperationId}`, ); // get missed token ids for paranet - // schedule get commands for each asset - // store in paranet repository + + // TODO: How do I get the params? + let blockchain = ''; + let contract = ''; + let tokenId = ''; + + const assertionIds = await this.blockchainModuleManager.getLatestAssertionId( + blockchain, + contract, + tokenId, + ); + + // Go through all except the last one + for (let stateIndex = assertionIds.length - 2; stateIndex > 0; stateIndex -= 1) { + // TODO: Also pass in where to which repo to move it + await this.syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex); + } + + // Then sync the last one, but put it in 'current' repo + return Command.repeat(); } - // async syncAsset(tokenId, blockchain, contract) { - // const assertionIds = await this.blockchainModuleManager.getLatestAssertionId( - // blockchain, - // contract, - // tokenId, - // ); - // - // // eslint-disable-next-line for-direction - // for (let stateIndex = assertionIds.length - 1; stateIndex < 0; stateIndex -= 1) { - // try { - // // if ( - // // await this.repositoryModuleManager.isStateSynced( - // // blockchain, - // // contract, - // // tokenId, - // // stateIndex, - // // ) - // // ) { - // // this.logger.trace( - // // `ASSET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} already synced blockchain: ${blockchain}`, - // // ); - // // await this.repositoryModuleManager.updateAssetSyncRecord( - // // blockchain, - // // contract, - // // tokenId, - // // stateIndex, - // // ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, - // // true, - // // ); - // // continue; - // // } - // - // const statePresentInParanetRepository = await this.tripleStoreService.assetExists( - // paranet, - // tokenId, - // stateIndex, - // assertionIds, - // ); - // - // if (await this.isStatePresentInRepository(tokenId, stateIndex, assertionIds)) { - // this.logger.trace( - // `ASSET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} found in triple store blockchain: ${blockchain}`, - // ); - // await this.repositoryModuleManager.createAssetSyncRecord( - // blockchain, - // contract, - // tokenId, - // stateIndex, - // ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, - // true, - // ); - // continue; - // } - // - // const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); - // this.logger.debug( - // `ASSET_SYNC: Fetching state index: ${stateIndex + 1} of ${ - // assertionIds.length - // } for asset with ual: ${ual}. blockchain: ${blockchain}`, - // ); - // const assertionId = assertionIds[stateIndex]; - // - // const operationId = await this.operationIdService.generateOperationId( - // OPERATION_ID_STATUS.GET.GET_START, - // ); - // - // await Promise.all([ - // this.operationIdService.updateOperationIdStatus( - // operationId, - // blockchain, - // OPERATION_ID_STATUS.GET.GET_INIT_START, - // ), - // - // this.repositoryModuleManager.createAssetSyncRecord( - // blockchain, - // contract, - // tokenId, - // stateIndex, - // ASSET_SYNC_PARAMETERS.STATUS.IN_PROGRESS, - // ), - // - // this.repositoryModuleManager.createOperationRecord( - // this.getService.getOperationName(), - // operationId, - // OPERATION_STATUS.IN_PROGRESS, - // ), - // ]); - // - // const hashFunctionId = CONTENT_ASSET_HASH_FUNCTION_ID; - // - // this.logger.debug( - // `ASSET_SYNC: Get for ${ual} with operation id ${operationId} initiated. blockchain: ${blockchain}`, - // ); - // - // await this.commandExecutor.add({ - // name: 'networkGetCommand', - // sequence: [], - // delay: 0, - // data: { - // operationId, - // id: ual, - // blockchain, - // contract, - // tokenId, - // state: assertionId, - // hashFunctionId, - // assertionId, - // assetSync: true, - // stateIndex, - // assetSyncInsertedByCommand: true, - // }, - // transactional: false, - // }); - // - // await this.operationIdService.updateOperationIdStatus( - // operationId, - // blockchain, - // OPERATION_ID_STATUS.GET.GET_INIT_END, - // ); - // - // let attempt = 0; - // let getResult; - // do { - // await setTimeout(ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_INTERVAL_MILLIS); - // - // getResult = await this.operationIdService.getOperationIdRecord(operationId); - // attempt += 1; - // } while ( - // attempt < ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_MAX_ATTEMPTS && - // getResult?.status !== OPERATION_ID_STATUS.FAILED && - // getResult?.status !== OPERATION_ID_STATUS.COMPLETED - // ); - // } catch (error) { - // this.logger.warn( - // `ASSET_SYNC: Unable to sync tokenId: ${tokenId}, for contract: ${contract} state index: ${stateIndex} blockchain: ${blockchain}, error: ${error}`, - // ); - // await this.repositoryModuleManager.updateAssetSyncRecord( - // blockchain, - // contract, - // tokenId, - // stateIndex, - // ASSET_SYNC_PARAMETERS.STATUS.FAILED, - // true, - // ); - // } - // } - // } + async syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex) { + try { + if ( + await this.repositoryModuleManager.isStateSynced( + blockchain, + contract, + tokenId, + stateIndex, + ) + ) { + this.logger.trace( + `ASSET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} already synced blockchain: ${blockchain}`, + ); + await this.repositoryModuleManager.updateAssetSyncRecord( + blockchain, + contract, + tokenId, + stateIndex, + ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, + true, + ); + return; + } + + const statePresentInParanetRepository = await this.tripleStoreService.assetExists( + paranetId, + tokenId, + stateIndex, + assertionIds, + ); + + if (statePresentInParanetRepository) { + this.logger.trace( + `ASSET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} found in triple store blockchain: ${blockchain}`, + ); + await this.repositoryModuleManager.createAssetSyncRecord( + blockchain, + contract, + tokenId, + stateIndex, + ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, + true, + ); + return; + } + + const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); + this.logger.debug( + `ASSET_SYNC: Fetching state index: ${stateIndex + 1} of ${ + assertionIds.length + } for asset with ual: ${ual}. blockchain: ${blockchain}`, + ); + const assertionId = assertionIds[stateIndex]; + + const operationId = await this.operationIdService.generateOperationId( + OPERATION_ID_STATUS.GET.GET_START, + ); + + await Promise.all([ + this.operationIdService.updateOperationIdStatus( + operationId, + blockchain, + OPERATION_ID_STATUS.GET.GET_INIT_START, + ), + + this.repositoryModuleManager.createAssetSyncRecord( + blockchain, + contract, + tokenId, + stateIndex, + ASSET_SYNC_PARAMETERS.STATUS.IN_PROGRESS, + ), + + this.repositoryModuleManager.createOperationRecord( + this.getService.getOperationName(), + operationId, + OPERATION_STATUS.IN_PROGRESS, + ), + ]); + + const hashFunctionId = CONTENT_ASSET_HASH_FUNCTION_ID; + + this.logger.debug( + `ASSET_SYNC: Get for ${ual} with operation id ${operationId} initiated. blockchain: ${blockchain}`, + ); + + await this.commandExecutor.add({ + name: 'networkGetCommand', + sequence: [], + delay: 0, + data: { + operationId, + id: ual, + blockchain, + contract, + tokenId, + state: assertionId, + hashFunctionId, + assertionId, + assetSync: true, + stateIndex, + assetSyncInsertedByCommand: true, + }, + transactional: false, + }); + + await this.operationIdService.updateOperationIdStatus( + operationId, + blockchain, + OPERATION_ID_STATUS.GET.GET_INIT_END, + ); + + let attempt = 0; + let getResult; + do { + await setTimeout(ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_INTERVAL_MILLIS); + + getResult = await this.operationIdService.getOperationIdRecord(operationId); + attempt += 1; + } while ( + attempt < ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_MAX_ATTEMPTS && + getResult?.status !== OPERATION_ID_STATUS.FAILED && + getResult?.status !== OPERATION_ID_STATUS.COMPLETED + ); + } catch (error) { + this.logger.warn( + `ASSET_SYNC: Unable to sync tokenId: ${tokenId}, for contract: ${contract} state index: ${stateIndex} blockchain: ${blockchain}, error: ${error}`, + ); + await this.repositoryModuleManager.updateAssetSyncRecord( + blockchain, + contract, + tokenId, + stateIndex, + ASSET_SYNC_PARAMETERS.STATUS.FAILED, + true, + ); + } + } /** * Recover system from failure From 3465d91726f8c94589f18dc79f3c55ba1ab900e5 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Wed, 17 Apr 2024 12:18:00 +0200 Subject: [PATCH 03/82] Add more comments, fix missing constants --- src/commands/paranet/paranet-sync-command.js | 27 +++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index fabbc5ef3e..2cf5ae8cbd 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -1,7 +1,7 @@ /* eslint-disable no-unused-vars */ /* eslint-disable no-await-in-loop */ import Command from '../command.js'; -import { ERROR_TYPE, PARANET_SYNC_FREQUENCY_MILLS, OPERATION_ID_STATUS, CONTENT_ASSET_HASH_FUNCTION_ID } from '../../constants/constants.js'; +import { ERROR_TYPE, PARANET_SYNC_FREQUENCY_MILLS, OPERATION_ID_STATUS, CONTENT_ASSET_HASH_FUNCTION_ID, SIMPLE_ASSET_SYNC_PARAMETERS } from '../../constants/constants.js'; class StartParanetSyncCommands extends Command { constructor(ctx) { @@ -24,7 +24,6 @@ class StartParanetSyncCommands extends Command { // schedule get commands for each asset // store in paranet repository - // TODO: How do I get the params? let blockchain = ''; let contract = ''; @@ -38,8 +37,8 @@ class StartParanetSyncCommands extends Command { // Go through all except the last one for (let stateIndex = assertionIds.length - 2; stateIndex > 0; stateIndex -= 1) { - // TODO: Also pass in where to which repo to move it - await this.syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex); + // TODO: Also pass in where to which repo to move it? + await this.syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId); } // Then sync the last one, but put it in 'current' repo @@ -47,7 +46,7 @@ class StartParanetSyncCommands extends Command { return Command.repeat(); } - async syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex) { + async syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId) { try { if ( await this.repositoryModuleManager.isStateSynced( @@ -65,7 +64,7 @@ class StartParanetSyncCommands extends Command { contract, tokenId, stateIndex, - ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, + SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, true, ); return; @@ -87,7 +86,7 @@ class StartParanetSyncCommands extends Command { contract, tokenId, stateIndex, - ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, + SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, true, ); return; @@ -117,13 +116,13 @@ class StartParanetSyncCommands extends Command { contract, tokenId, stateIndex, - ASSET_SYNC_PARAMETERS.STATUS.IN_PROGRESS, + SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.IN_PROGRESS, ), this.repositoryModuleManager.createOperationRecord( this.getService.getOperationName(), operationId, - OPERATION_STATUS.IN_PROGRESS, + OPERATION_ID_STATUS.IN_PROGRESS, ), ]); @@ -162,12 +161,16 @@ class StartParanetSyncCommands extends Command { let attempt = 0; let getResult; do { - await setTimeout(ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_INTERVAL_MILLIS); + await setTimeout(SIMPLE_ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_INTERVAL_MILLIS); getResult = await this.operationIdService.getOperationIdRecord(operationId); + if (getResult?.status === OPERATION_ID_STATUS.COMPLETED) { + // TODO: Move repos after? this.pendingStorageService.moveAndDeletePendingState()? this.tripleStoreService.moveAsset()? + } + attempt += 1; } while ( - attempt < ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_MAX_ATTEMPTS && + attempt < SIMPLE_ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_MAX_ATTEMPTS && getResult?.status !== OPERATION_ID_STATUS.FAILED && getResult?.status !== OPERATION_ID_STATUS.COMPLETED ); @@ -180,7 +183,7 @@ class StartParanetSyncCommands extends Command { contract, tokenId, stateIndex, - ASSET_SYNC_PARAMETERS.STATUS.FAILED, + SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.FAILED, true, ); } From 6061f5157f4090c86574dbc557a0a35ad984272a Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Wed, 17 Apr 2024 15:58:04 +0200 Subject: [PATCH 04/82] Retrieve some vars from the command itself --- src/commands/paranet/paranet-sync-command.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 2cf5ae8cbd..1ff2c69d73 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -14,7 +14,7 @@ class StartParanetSyncCommands extends Command { } async execute(command) { - const { commandOperationId, paranetId } = command.data; + const { commandOperationId, paranetId, blockchain, contract, tokenId } = command.data; this.logger.info( `Paranet sync: Starting paranet sync command for ${paranetId} with operation id: ${commandOperationId}`, @@ -24,11 +24,6 @@ class StartParanetSyncCommands extends Command { // schedule get commands for each asset // store in paranet repository - // TODO: How do I get the params? - let blockchain = ''; - let contract = ''; - let tokenId = ''; - const assertionIds = await this.blockchainModuleManager.getLatestAssertionId( blockchain, contract, From 38cee8c5b15f0c0d40eb94092c50b72e6cae708e Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Thu, 18 Apr 2024 13:48:51 +0200 Subject: [PATCH 05/82] Add additional params for get-service for parachain insertion --- src/commands/paranet/paranet-sync-command.js | 3 +++ src/service/get-service.js | 23 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 1ff2c69d73..9739f059ea 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -143,6 +143,9 @@ class StartParanetSyncCommands extends Command { assetSync: true, stateIndex, assetSyncInsertedByCommand: true, + paranetSync: true, + paranetId + // paranetRepo: 'currentHistory' }, transactional: false, }); diff --git a/src/service/get-service.js b/src/service/get-service.js index d9106d2d03..f2301f43de 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -41,6 +41,8 @@ class GetService extends OperationService { assertionId, assetSync, stateIndex, + parachainSync, + parachainId } = command.data; const keywordsStatuses = await this.getResponsesStatuses( @@ -80,9 +82,8 @@ class GetService extends OperationService { ); this.logResponsesSummary(completedNumber, failedNumber); + const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); if (assetSync) { - const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); - this.logger.debug( `ASSET_SYNC: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, ); @@ -96,7 +97,25 @@ class GetService extends OperationService { tokenId, keyword, ); + + if (parachainSync) { + this.logger.debug( + `PARACHAIN_ASSET_SYNC: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); + + // TODO: How to target the parachain repo? + await this.tripleStoreService.localStoreAsset( + TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, + assertionId, + responseData.nquads, + blockchain, + contract, + tokenId, + keyword, + ); + } } + } if ( From 6f8f280837e86b26341acd49c1e718141676c06c Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Thu, 18 Apr 2024 15:22:34 +0200 Subject: [PATCH 06/82] Fix parameter name --- src/service/get-service.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/service/get-service.js b/src/service/get-service.js index f2301f43de..c6d914ec1a 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -41,8 +41,8 @@ class GetService extends OperationService { assertionId, assetSync, stateIndex, - parachainSync, - parachainId + paranetSync, + paranetId } = command.data; const keywordsStatuses = await this.getResponsesStatuses( @@ -98,7 +98,7 @@ class GetService extends OperationService { keyword, ); - if (parachainSync) { + if (paranetSync) { this.logger.debug( `PARACHAIN_ASSET_SYNC: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, ); From f3629de551d70b44f708be933f03ac0b0c7a3e82 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 22 Apr 2024 11:23:48 +0200 Subject: [PATCH 07/82] Add more comments --- src/commands/paranet/paranet-sync-command.js | 7 ++----- src/service/get-service.js | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 9739f059ea..8543d9f8c3 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -160,18 +160,15 @@ class StartParanetSyncCommands extends Command { let getResult; do { await setTimeout(SIMPLE_ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_INTERVAL_MILLIS); - getResult = await this.operationIdService.getOperationIdRecord(operationId); - if (getResult?.status === OPERATION_ID_STATUS.COMPLETED) { - // TODO: Move repos after? this.pendingStorageService.moveAndDeletePendingState()? this.tripleStoreService.moveAsset()? - } - attempt += 1; } while ( attempt < SIMPLE_ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_MAX_ATTEMPTS && getResult?.status !== OPERATION_ID_STATUS.FAILED && getResult?.status !== OPERATION_ID_STATUS.COMPLETED ); + + // TODO: Move repos after? this.pendingStorageService.moveAndDeletePendingState()? this.tripleStoreService.moveAsset()? } catch (error) { this.logger.warn( `ASSET_SYNC: Unable to sync tokenId: ${tokenId}, for contract: ${contract} state index: ${stateIndex} blockchain: ${blockchain}, error: ${error}`, diff --git a/src/service/get-service.js b/src/service/get-service.js index c6d914ec1a..a092779974 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -113,6 +113,8 @@ class GetService extends OperationService { tokenId, keyword, ); + + // TODO: Move to history if needed? } } From f35a930091b273448ad62a89aaa25abe5cf27b8c Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 22 Apr 2024 14:59:21 +0200 Subject: [PATCH 08/82] Move asset if needed --- src/commands/paranet/paranet-sync-command.js | 10 ++++---- src/service/get-service.js | 27 +++++++++++++++----- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 8543d9f8c3..74a887ceea 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -32,16 +32,16 @@ class StartParanetSyncCommands extends Command { // Go through all except the last one for (let stateIndex = assertionIds.length - 2; stateIndex > 0; stateIndex -= 1) { - // TODO: Also pass in where to which repo to move it? - await this.syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId); + await this.syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId, 'currentHistory'); } // Then sync the last one, but put it in 'current' repo + await this.syncAsset(blockchain, contract, tokenId, assertionIds, assertionIds.length - 1, paranetId, null); return Command.repeat(); } - async syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId) { + async syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId, newRepoId) { try { if ( await this.repositoryModuleManager.isStateSynced( @@ -144,8 +144,8 @@ class StartParanetSyncCommands extends Command { stateIndex, assetSyncInsertedByCommand: true, paranetSync: true, - paranetId - // paranetRepo: 'currentHistory' + paranetId, + paranetRepoId: newRepoId }, transactional: false, }); diff --git a/src/service/get-service.js b/src/service/get-service.js index a092779974..ceef676c88 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -42,7 +42,8 @@ class GetService extends OperationService { assetSync, stateIndex, paranetSync, - paranetId + paranetId, + paranetRepoId, } = command.data; const keywordsStatuses = await this.getResponsesStatuses( @@ -102,10 +103,9 @@ class GetService extends OperationService { this.logger.debug( `PARACHAIN_ASSET_SYNC: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, ); - - // TODO: How to target the parachain repo? + await this.tripleStoreService.localStoreAsset( - TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, + paranetId + TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, // TODO: Work out the actual repo name assertionId, responseData.nquads, blockchain, @@ -114,10 +114,25 @@ class GetService extends OperationService { keyword, ); - // TODO: Move to history if needed? + if (paranetRepoId) { + const newRepoName = paranetId + paranetRepoId; + + this.logger.debug( + `PARACHAIN_ASSET_SYNC: Moving asset to repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); + + // Move to other repo if needed + await this.tripleStoreService.moveAsset( + newRepoName, // TODO: Work out the actual repo name + assertionId, + blockchain, + contract, + tokenId, + keyword, + ); + } } } - } if ( From 8caca6da31e230bcd8b7e67c772b3b98f71836b4 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 22 Apr 2024 15:26:42 +0200 Subject: [PATCH 09/82] Add more todos --- src/commands/paranet/paranet-sync-command.js | 2 +- src/commands/paranet/start-paranet-sync-commands.js | 1 + src/service/get-service.js | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 74a887ceea..4ed7fbd5ba 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -168,7 +168,7 @@ class StartParanetSyncCommands extends Command { getResult?.status !== OPERATION_ID_STATUS.COMPLETED ); - // TODO: Move repos after? this.pendingStorageService.moveAndDeletePendingState()? this.tripleStoreService.moveAsset()? + // TODO: If moving asset to different repo here, what is the 'keyword' parameter? } catch (error) { this.logger.warn( `ASSET_SYNC: Unable to sync tokenId: ${tokenId}, for contract: ${contract} state index: ${stateIndex} blockchain: ${blockchain}, error: ${error}`, diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index b37f69535d..f135750f43 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -26,6 +26,7 @@ class StartParanetSyncCommands extends Command { const commandData = { paranetId, operationId, + // TODO: Pass in blockchain, contract and token ID }; return this.commandExecutor.add({ diff --git a/src/service/get-service.js b/src/service/get-service.js index ceef676c88..360aa371fc 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -105,7 +105,7 @@ class GetService extends OperationService { ); await this.tripleStoreService.localStoreAsset( - paranetId + TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, // TODO: Work out the actual repo name + paranetId + TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, // TODO: Work out the actual repo name and create it if needed assertionId, responseData.nquads, blockchain, @@ -114,16 +114,16 @@ class GetService extends OperationService { keyword, ); + // Move to other repo, if needed if (paranetRepoId) { - const newRepoName = paranetId + paranetRepoId; + const newRepoName = paranetId + paranetRepoId; // TODO: Work out the actual repo name and create it if needed this.logger.debug( `PARACHAIN_ASSET_SYNC: Moving asset to repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, ); - // Move to other repo if needed await this.tripleStoreService.moveAsset( - newRepoName, // TODO: Work out the actual repo name + newRepoName, assertionId, blockchain, contract, From 12e9afa8ccb8b6473ad5cb489a51f90862a29325 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Wed, 24 Apr 2024 10:18:14 +0200 Subject: [PATCH 10/82] Check if UAL is valid before starting --- src/commands/paranet/start-paranet-sync-commands.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index f135750f43..db53f6e573 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -5,6 +5,7 @@ class StartParanetSyncCommands extends Command { constructor(ctx) { super(ctx); this.commandExecutor = ctx.commandExecutor; + this.ualService = ctx.ualService; this.blockchainModuleManager = ctx.blockchainModuleManager; this.errorType = ERROR_TYPE.PARANET.START_PARANET_SYNC_ERROR; @@ -21,12 +22,17 @@ class StartParanetSyncCommands extends Command { await Promise.all( this.config.assetSync?.syncParanets.map(async (paranetId) => { - // validate paranet id before scheduling paranet sync command + if (!this.ualService.isUal(paranetId)) { + this.logger.info( + `Paranet sync: paranetId ${paranetId} is not a valid UAL!`, + ); + return Command.empty(); + } const commandData = { paranetId, operationId, - // TODO: Pass in blockchain, contract and token ID + // TODO: Pass in token ID (for now, just a mock) }; return this.commandExecutor.add({ From 335e4d33e6f34e21d69eb33576c6096d90972e15 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Wed, 24 Apr 2024 10:53:38 +0200 Subject: [PATCH 11/82] Get blockchain and contract from ualService --- src/commands/paranet/paranet-sync-command.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 4ed7fbd5ba..c580787cfb 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -9,17 +9,20 @@ class StartParanetSyncCommands extends Command { this.commandExecutor = ctx.commandExecutor; this.blockchainModuleManager = ctx.blockchainModuleManager; this.tripleStoreService = ctx.tripleStoreService; + this.ualService = ctx.ualService; this.errorType = ERROR_TYPE.PARANET.PARANET_SYNC_ERROR; } async execute(command) { - const { commandOperationId, paranetId, blockchain, contract, tokenId } = command.data; + const { commandOperationId, paranetId, tokenId } = command.data; this.logger.info( `Paranet sync: Starting paranet sync command for ${paranetId} with operation id: ${commandOperationId}`, ); + const { blockchain, contract } = this.ualService.resolveUal(paranetId); + // get missed token ids for paranet // schedule get commands for each asset // store in paranet repository @@ -167,8 +170,6 @@ class StartParanetSyncCommands extends Command { getResult?.status !== OPERATION_ID_STATUS.FAILED && getResult?.status !== OPERATION_ID_STATUS.COMPLETED ); - - // TODO: If moving asset to different repo here, what is the 'keyword' parameter? } catch (error) { this.logger.warn( `ASSET_SYNC: Unable to sync tokenId: ${tokenId}, for contract: ${contract} state index: ${stateIndex} blockchain: ${blockchain}, error: ${error}`, From 35b3311e4c1cfb2a2b779574d88fd1b4515b0ed9 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Wed, 24 Apr 2024 12:26:37 +0200 Subject: [PATCH 12/82] Use paranetIdService to generate paranet repo name --- src/service/get-service.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/service/get-service.js b/src/service/get-service.js index 360aa371fc..f6e78e65a2 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -24,6 +24,7 @@ class GetService extends OperationService { this.ualService = ctx.ualService; this.tripleStoreService = ctx.tripleStoreService; this.blockchainModuleManager = ctx.blockchainModuleManager; + this.paranetIdService = ctx.paranetIdService; this.operationMutex = new Mutex(); } @@ -105,7 +106,7 @@ class GetService extends OperationService { ); await this.tripleStoreService.localStoreAsset( - paranetId + TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, // TODO: Work out the actual repo name and create it if needed + `${this.paranetIdService.getParanetRepositoryName(paranetId)}-${TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT}`, assertionId, responseData.nquads, blockchain, @@ -116,7 +117,7 @@ class GetService extends OperationService { // Move to other repo, if needed if (paranetRepoId) { - const newRepoName = paranetId + paranetRepoId; // TODO: Work out the actual repo name and create it if needed + const newRepoName = `${this.paranetIdService.getParanetRepositoryName(paranetId)}-${paranetRepoId}`; this.logger.debug( `PARACHAIN_ASSET_SYNC: Moving asset to repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, @@ -131,6 +132,9 @@ class GetService extends OperationService { keyword, ); } + + // Delete from existing repo, if needed + } } } From 49e193dc68a36e55a2759d9592627cd0151a42ff Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Wed, 24 Apr 2024 12:53:57 +0200 Subject: [PATCH 13/82] Move pre-latest asset and store newest in current --- src/commands/paranet/paranet-sync-command.js | 12 ++-- src/service/get-service.js | 63 +++++++++++++------- 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index c580787cfb..cb49232382 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -35,16 +35,16 @@ class StartParanetSyncCommands extends Command { // Go through all except the last one for (let stateIndex = assertionIds.length - 2; stateIndex > 0; stateIndex -= 1) { - await this.syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId, 'currentHistory'); + await this.syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId, 'currentHistory', false, stateIndex === assertionIds.length - 2); } - // Then sync the last one, but put it in 'current' repo - await this.syncAsset(blockchain, contract, tokenId, assertionIds, assertionIds.length - 1, paranetId, null); + // Then sync the last one, but put it in the current repo + await this.syncAsset(blockchain, contract, tokenId, assertionIds, assertionIds.length - 1, paranetId, null, false); return Command.repeat(); } - async syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId, newRepoId) { + async syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId, newRepoId, latestAsset, deleteFromEarlier) { try { if ( await this.repositoryModuleManager.isStateSynced( @@ -148,7 +148,9 @@ class StartParanetSyncCommands extends Command { assetSyncInsertedByCommand: true, paranetSync: true, paranetId, - paranetRepoId: newRepoId + paranetRepoId: newRepoId, + paranetLatestAsset: latestAsset, + paranetDeleteFromEarlier: deleteFromEarlier }, transactional: false, }); diff --git a/src/service/get-service.js b/src/service/get-service.js index f6e78e65a2..acbb54537b 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -45,6 +45,8 @@ class GetService extends OperationService { paranetSync, paranetId, paranetRepoId, + paranetLatestAsset, + paranetDeleteFromEarlier } = command.data; const keywordsStatuses = await this.getResponsesStatuses( @@ -105,36 +107,53 @@ class GetService extends OperationService { `PARACHAIN_ASSET_SYNC: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, ); - await this.tripleStoreService.localStoreAsset( - `${this.paranetIdService.getParanetRepositoryName(paranetId)}-${TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT}`, - assertionId, - responseData.nquads, - blockchain, - contract, - tokenId, - keyword, - ); - - // Move to other repo, if needed - if (paranetRepoId) { - const newRepoName = `${this.paranetIdService.getParanetRepositoryName(paranetId)}-${paranetRepoId}`; - - this.logger.debug( - `PARACHAIN_ASSET_SYNC: Moving asset to repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, - ); - - await this.tripleStoreService.moveAsset( - newRepoName, + if (paranetLatestAsset) { + await this.tripleStoreService.localStoreAsset( + `${this.paranetIdService.getParanetRepositoryName(paranetId)}-${TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT}`, assertionId, + responseData.nquads, blockchain, contract, tokenId, keyword, ); } + else if (paranetRepoId) { + const newRepoName = `${this.paranetIdService.getParanetRepositoryName(paranetId)}-${paranetRepoId}`; - // Delete from existing repo, if needed - + if (paranetDeleteFromEarlier) { + // This was the previous latest one, move it to currentHistory + this.logger.debug( + `PARACHAIN_ASSET_SYNC: Moving asset to repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); + + await this.tripleStoreService.moveAsset( + newRepoName, + assertionId, + blockchain, + contract, + tokenId, + keyword, + ); + } + else { + // This is one of the older assets, just update it + + this.logger.debug( + `PARACHAIN_ASSET_SYNC: Updating asset in repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); + + await this.tripleStoreService.localStoreAsset( + newRepoName, + assertionId, + responseData.nquads, + blockchain, + contract, + tokenId, + keyword, + ); + } + } } } } From 437c87f56eae822ed9ee4e105dbac4d8b3a9b712 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Wed, 24 Apr 2024 15:33:57 +0200 Subject: [PATCH 14/82] Add mock fetchTokenIdsForParanet() and iterate over the tokens --- .../paranet/start-paranet-sync-commands.js | 30 ++++++++++--------- .../blockchain-event-listener-service.js | 4 +++ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index db53f6e573..a8f8d820b1 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -19,29 +19,31 @@ class StartParanetSyncCommands extends Command { ); await this.commandExecutor.delete('paranetSyncCommand'); + + const promises = []; + this.config.assetSync?.syncParanets.forEach(async (paranetId) => { + if (!this.ualService.isUal(paranetId)) { + this.logger.info(`Paranet sync: paranetId ${paranetId} is not a valid UAL!`); + return Command.empty(); + } - await Promise.all( - this.config.assetSync?.syncParanets.map(async (paranetId) => { - if (!this.ualService.isUal(paranetId)) { - this.logger.info( - `Paranet sync: paranetId ${paranetId} is not a valid UAL!`, - ); - return Command.empty(); - } - + const tokenIds = this.blockchainModuleManager.fetchTokenIdsForParanet(paranetId); + tokenIds.forEach((tokenId) => { const commandData = { paranetId, operationId, - // TODO: Pass in token ID (for now, just a mock) + tokenId, }; - return this.commandExecutor.add({ + promises.append(this.commandExecutor.add({ name: 'paranetSyncCommand', data: commandData, period: PARANET_SYNC_FREQUENCY_MILLS, - }); - }), - ); + })); + }); + }); + + await Promise.all(promises); return Command.empty(); } diff --git a/src/service/blockchain-event-listener-service.js b/src/service/blockchain-event-listener-service.js index 62c230bd5d..8b9275812d 100644 --- a/src/service/blockchain-event-listener-service.js +++ b/src/service/blockchain-event-listener-service.js @@ -140,6 +140,10 @@ class BlockchainEventListenerService { ); } + fetchTokenIdsForParanet(paranetId) { + return ["test1", "test2"]; + } + listenOnBlockchainEvents(blockchainId) { const devEnvironment = process.env.NODE_ENV === NODE_ENVIRONMENTS.DEVELOPMENT || From ca8b503c0f716814fc30f2a16d0cb12bcd6d2bc2 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Fri, 26 Apr 2024 10:46:38 +0200 Subject: [PATCH 15/82] Add log msgs and remove invalidParanets --- ot-node.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ot-node.js b/ot-node.js index a1be1cd700..15e9337e2f 100644 --- a/ot-node.js +++ b/ot-node.js @@ -346,17 +346,14 @@ class OTNode { const blockchainModuleManager = this.container.resolve('blockchainModuleManager'); const tripleStoreService = this.container.resolve('tripleStoreService'); const tripleStoreModuleManager = this.container.resolve('tripleStoreModuleManager'); - const invalidParanets = []; const validParanets = []; this.config.assetSync?.syncParanets.forEach((paranetId) => { if (!paranetIdService.isUAL(paranetId)) { - invalidParanets.push(paranetId); - this.logger.warn(''); + this.logger.warn(`Unable to initialize Paranet with id ${paranetId} because of invalid UAL format`); } else { const { blockchainId } = paranetIdService.resolveUAL(paranetId); if (!blockchainModuleManager.getImplementationNames().includes(blockchainId)) { - invalidParanets.push(paranetId); - this.logger.warn(''); + this.logger.warn(`Unable to initialize Paranet with id ${paranetId} because of unsupported blockchain implementation`); } else { validParanets.push(paranetId); const repository = paranetIdService.getParanetRepositoryName(paranetId); From 3c4da4737b514e3078d79a76817dee9801c523e9 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Fri, 26 Apr 2024 10:49:14 +0200 Subject: [PATCH 16/82] Remove unnecessary comment --- src/commands/paranet/paranet-sync-command.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index cb49232382..1b776b32ae 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -22,11 +22,6 @@ class StartParanetSyncCommands extends Command { ); const { blockchain, contract } = this.ualService.resolveUal(paranetId); - - // get missed token ids for paranet - // schedule get commands for each asset - // store in paranet repository - const assertionIds = await this.blockchainModuleManager.getLatestAssertionId( blockchain, contract, From 3c62b9aeaf5b46d3f33688251ae5841967bb5b1d Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Fri, 26 Apr 2024 10:58:39 +0200 Subject: [PATCH 17/82] Fix log messages --- src/commands/paranet/paranet-sync-command.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 1b776b32ae..a79ff09585 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -18,7 +18,7 @@ class StartParanetSyncCommands extends Command { const { commandOperationId, paranetId, tokenId } = command.data; this.logger.info( - `Paranet sync: Starting paranet sync command for ${paranetId} with operation id: ${commandOperationId}`, + `Paranet sync: Starting paranet sync command for ${paranetId} with operation id: ${commandOperationId}, token id: ${tokenId}`, ); const { blockchain, contract } = this.ualService.resolveUal(paranetId); @@ -50,7 +50,7 @@ class StartParanetSyncCommands extends Command { ) ) { this.logger.trace( - `ASSET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} already synced blockchain: ${blockchain}`, + `PARANET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} already synced blockchain: ${blockchain}`, ); await this.repositoryModuleManager.updateAssetSyncRecord( blockchain, @@ -72,7 +72,7 @@ class StartParanetSyncCommands extends Command { if (statePresentInParanetRepository) { this.logger.trace( - `ASSET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} found in triple store blockchain: ${blockchain}`, + `PARANET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} found in triple store blockchain: ${blockchain}`, ); await this.repositoryModuleManager.createAssetSyncRecord( blockchain, @@ -87,7 +87,7 @@ class StartParanetSyncCommands extends Command { const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); this.logger.debug( - `ASSET_SYNC: Fetching state index: ${stateIndex + 1} of ${ + `PARANET_SYNC: Fetching state index: ${stateIndex + 1} of ${ assertionIds.length } for asset with ual: ${ual}. blockchain: ${blockchain}`, ); From 098099a6eeee895a3cf7d1830f704d4293aaef9a Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Fri, 26 Apr 2024 11:01:46 +0200 Subject: [PATCH 18/82] Rename newRepoId to paranetRepository --- src/commands/paranet/paranet-sync-command.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index a79ff09585..725829e1b5 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -39,7 +39,7 @@ class StartParanetSyncCommands extends Command { return Command.repeat(); } - async syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId, newRepoId, latestAsset, deleteFromEarlier) { + async syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId, paranetRepository, latestAsset, deleteFromEarlier) { try { if ( await this.repositoryModuleManager.isStateSynced( @@ -143,7 +143,7 @@ class StartParanetSyncCommands extends Command { assetSyncInsertedByCommand: true, paranetSync: true, paranetId, - paranetRepoId: newRepoId, + paranetRepoId: paranetRepository, paranetLatestAsset: latestAsset, paranetDeleteFromEarlier: deleteFromEarlier }, From a1ce8b3dd91ed1c2322261c845f3391749b04f67 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Fri, 26 Apr 2024 11:05:08 +0200 Subject: [PATCH 19/82] paranetAssetExists instead of assetExists --- src/commands/paranet/paranet-sync-command.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 725829e1b5..f8a865bab3 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -63,7 +63,7 @@ class StartParanetSyncCommands extends Command { return; } - const statePresentInParanetRepository = await this.tripleStoreService.assetExists( + const statePresentInParanetRepository = await this.tripleStoreService.paranetAssetExists( paranetId, tokenId, stateIndex, From 29005fc9bcc8cdb68df7a64456206dbb57c4a690 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Fri, 26 Apr 2024 13:18:32 +0200 Subject: [PATCH 20/82] Add paranets registry contract to constants --- src/constants/constants.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/constants.js b/src/constants/constants.js index 5764523a86..ea7ce80c47 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -672,6 +672,7 @@ export const CONTRACTS = { IDENTITY_STORAGE_CONTRACT: 'IdentityStorageContract', LOG2PLDSF_CONTRACT: 'Log2PLDSFContract', LINEAR_SUM_CONTRACT: 'LinearSumContract', + PARANETS_REGISTRY_CONTRACT: 'ParanetsRegistry' }; export const CONTRACT_EVENTS = { From ecf093739659d9c67002d245bf7d41a6d39822a5 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Fri, 26 Apr 2024 13:32:12 +0200 Subject: [PATCH 21/82] Add WIP fetchTokenIdsForParanet() implementation --- src/service/blockchain-event-listener-service.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/service/blockchain-event-listener-service.js b/src/service/blockchain-event-listener-service.js index 8b9275812d..1316d09d77 100644 --- a/src/service/blockchain-event-listener-service.js +++ b/src/service/blockchain-event-listener-service.js @@ -140,8 +140,18 @@ class BlockchainEventListenerService { ); } - fetchTokenIdsForParanet(paranetId) { - return ["test1", "test2"]; + async fetchTokenIdsForParanet(blockchainId, paranetId) { + const currentBlock = await this.blockchainModuleManager.getBlockNumber(blockchainId); + + // TODO: Iterate over events, how to pass in parameters? + const paranetKaEvents = await this.getContractEvents( + blockchainId, + CONTRACTS.PARANETS_REGISTRY_CONTRACT, + currentBlock, + CONTRACT_EVENTS., // TODO: What goes here? + ); + + await this.handleBlockchainEvents(paranetKaEvents, blockchainId); } listenOnBlockchainEvents(blockchainId) { From c6bfb8f8ec09ca62e106c5b138f1ae5d4e218b80 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 09:38:52 +0200 Subject: [PATCH 22/82] Add generic contract calls for paranet KAs --- src/modules/blockchain/blockchain-module-manager.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/modules/blockchain/blockchain-module-manager.js b/src/modules/blockchain/blockchain-module-manager.js index eccb49a396..2fe75031f9 100644 --- a/src/modules/blockchain/blockchain-module-manager.js +++ b/src/modules/blockchain/blockchain-module-manager.js @@ -261,6 +261,18 @@ class BlockchainModuleManager extends BaseModuleManager { ]); } + async getKnowledgeAssetsCount(blockchain, paranetId) { + return this.callImplementationFunction(blockchain, 'getKnowledgeAssetsCount', [paranetId]); + } + + async getKnowledgeAssetsWithPagination(blockchain, paranetId, offset, limit) { + return this.callImplementationFunction(blockchain, 'getKnowledgeAssetsWithPagination', [ + paranetId, + offset, + limit, + ]); + } + async getAssertionData(blockchain, assertionid) { return this.callImplementationFunction(blockchain, 'getAssertionData', [assertionid]); } From c3c569676dbd853730adf0683f5ec3c83c907890 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 09:41:56 +0200 Subject: [PATCH 23/82] Remove separate fetchTokenIdsForParanet command --- .../paranet/start-paranet-sync-commands.js | 17 ++++++++++------- .../blockchain-event-listener-service.js | 14 -------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index a8f8d820b1..459a925450 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -19,7 +19,7 @@ class StartParanetSyncCommands extends Command { ); await this.commandExecutor.delete('paranetSyncCommand'); - + const promises = []; this.config.assetSync?.syncParanets.forEach(async (paranetId) => { if (!this.ualService.isUal(paranetId)) { @@ -27,7 +27,8 @@ class StartParanetSyncCommands extends Command { return Command.empty(); } - const tokenIds = this.blockchainModuleManager.fetchTokenIdsForParanet(paranetId); + // TODO: Fetch token IDs here + const tokenIds = []; tokenIds.forEach((tokenId) => { const commandData = { paranetId, @@ -35,11 +36,13 @@ class StartParanetSyncCommands extends Command { tokenId, }; - promises.append(this.commandExecutor.add({ - name: 'paranetSyncCommand', - data: commandData, - period: PARANET_SYNC_FREQUENCY_MILLS, - })); + promises.append( + this.commandExecutor.add({ + name: 'paranetSyncCommand', + data: commandData, + period: PARANET_SYNC_FREQUENCY_MILLS, + }), + ); }); }); diff --git a/src/service/blockchain-event-listener-service.js b/src/service/blockchain-event-listener-service.js index 1316d09d77..62c230bd5d 100644 --- a/src/service/blockchain-event-listener-service.js +++ b/src/service/blockchain-event-listener-service.js @@ -140,20 +140,6 @@ class BlockchainEventListenerService { ); } - async fetchTokenIdsForParanet(blockchainId, paranetId) { - const currentBlock = await this.blockchainModuleManager.getBlockNumber(blockchainId); - - // TODO: Iterate over events, how to pass in parameters? - const paranetKaEvents = await this.getContractEvents( - blockchainId, - CONTRACTS.PARANETS_REGISTRY_CONTRACT, - currentBlock, - CONTRACT_EVENTS., // TODO: What goes here? - ); - - await this.handleBlockchainEvents(paranetKaEvents, blockchainId); - } - listenOnBlockchainEvents(blockchainId) { const devEnvironment = process.env.NODE_ENV === NODE_ENVIRONMENTS.DEVELOPMENT || From deed11d72851155ec06eb123bbd239c312230159 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 10:07:28 +0200 Subject: [PATCH 24/82] Add logic for fetching KAs to update --- .../paranet/start-paranet-sync-commands.js | 46 +++++++++++++------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index 459a925450..7ee60fcbe3 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -27,23 +27,39 @@ class StartParanetSyncCommands extends Command { return Command.empty(); } - // TODO: Fetch token IDs here - const tokenIds = []; - tokenIds.forEach((tokenId) => { - const commandData = { + const contractKaCount = this.blockchainModuleManager.getKnowledgeAssetsCount(paranetId); + const cachedKaCount = 0; // TODO: Fetch from db + + if (cachedKaCount === contractKaCount) return Command.empty(); + + const kaToUpdate = []; + for (let i = cachedKaCount; i <= contractKaCount; i += 50) { + const nextKaArray = this.blockchainModuleManager.getKnowledgeAssetsWithPagination( paranetId, - operationId, - tokenId, - }; - - promises.append( - this.commandExecutor.add({ - name: 'paranetSyncCommand', - data: commandData, - period: PARANET_SYNC_FREQUENCY_MILLS, - }), + i, + 50, ); - }); + if (!nextKaArray.length) break; + kaToUpdate.push(...nextKaArray); + } + + kaToUpdate + .map((ka) => ka.tokenId) + .forEach((tokenId) => { + const commandData = { + paranetId, + operationId, + tokenId, + }; + + promises.append( + this.commandExecutor.add({ + name: 'paranetSyncCommand', + data: commandData, + period: PARANET_SYNC_FREQUENCY_MILLS, + }), + ); + }); }); await Promise.all(promises); From 4a0b9a6c45c605987fe7631ff0dcdffed18b653b Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 10:40:02 +0200 Subject: [PATCH 25/82] Add Paranet model, migration and repo --- .../20240429083058-create-paranet.js | 37 +++++++++++++++++++ .../sequelize/models/paranet.js | 26 +++++++++++++ .../repositories/paranet-repository.js | 16 ++++++++ 3 files changed, 79 insertions(+) create mode 100644 src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js create mode 100644 src/modules/repository/implementation/sequelize/models/paranet.js create mode 100644 src/modules/repository/implementation/sequelize/repositories/paranet-repository.js diff --git a/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js b/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js new file mode 100644 index 0000000000..b2cfe5117b --- /dev/null +++ b/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js @@ -0,0 +1,37 @@ +'use strict'; +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.createTable('Paranets', { + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER + }, + name: { + type: Sequelize.STRING + }, + description: { + type: Sequelize.STRING + }, + paranetId: { + type: Sequelize.STRING + }, + kaCount: { + type: Sequelize.INTEGER + }, + createdAt: { + allowNull: false, + type: Sequelize.DATE + }, + updatedAt: { + allowNull: false, + type: Sequelize.DATE + } + }); + }, + async down(queryInterface, Sequelize) { + await queryInterface.dropTable('Paranets'); + } +}; \ No newline at end of file diff --git a/src/modules/repository/implementation/sequelize/models/paranet.js b/src/modules/repository/implementation/sequelize/models/paranet.js new file mode 100644 index 0000000000..a5b695169e --- /dev/null +++ b/src/modules/repository/implementation/sequelize/models/paranet.js @@ -0,0 +1,26 @@ +'use strict'; +const { + Model +} = require('sequelize'); +module.exports = (sequelize, DataTypes) => { + class Paranet extends Model { + /** + * Helper method for defining associations. + * This method is not a part of Sequelize lifecycle. + * The `models/index` file will call this method automatically. + */ + static associate(models) { + // define association here + } + } + Paranet.init({ + name: DataTypes.STRING, + description: DataTypes.STRING, + paranetId: DataTypes.STRING, + kaCount: DataTypes.INTEGER + }, { + sequelize, + modelName: 'Paranet', + }); + return Paranet; +}; \ No newline at end of file diff --git a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js new file mode 100644 index 0000000000..a2fcb6a98c --- /dev/null +++ b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js @@ -0,0 +1,16 @@ +class ParanetRepository { + constructor(models) { + this.sequelize = models.sequelize; + this.model = models.paranet; + } + + async getParanet(paranetId) { + return this.model.findOne({ + where: { + paranetId, + }, + }); + } +} + +export default ParanetRepository; From ce26a95492266058606fcdafe5c701899c809bfc Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 10:55:55 +0200 Subject: [PATCH 26/82] Add paranet repo to sequelize-repository and module manager --- .../implementation/sequelize/sequelize-repository.js | 2 ++ src/modules/repository/repository-module-manager.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/modules/repository/implementation/sequelize/sequelize-repository.js b/src/modules/repository/implementation/sequelize/sequelize-repository.js index aae1f1c648..7a8f4e10c5 100644 --- a/src/modules/repository/implementation/sequelize/sequelize-repository.js +++ b/src/modules/repository/implementation/sequelize/sequelize-repository.js @@ -8,6 +8,7 @@ import BlockchainEventRepository from './repositories/blockchain-event-repositor import BlockchainRepository from './repositories/blockchain-repository.js'; import CommandRepository from './repositories/command-repository.js'; import EventRepository from './repositories/event-repository.js'; +import ParanetRepository from './repositories/paranet-repository.js'; import OperationIdRepository from './repositories/operation-id-repository.js'; import OperationRepository from './repositories/operation-repository.js'; import OperationResponseRepository from './repositories/operation-response.js'; @@ -34,6 +35,7 @@ class SequelizeRepository { blockchain: new BlockchainRepository(this.models), command: new CommandRepository(this.models), event: new EventRepository(this.models), + paranet: new ParanetRepository(this.models), operation_id: new OperationIdRepository(this.models), operation: new OperationRepository(this.models), operation_response: new OperationResponseRepository(this.models), diff --git a/src/modules/repository/repository-module-manager.js b/src/modules/repository/repository-module-manager.js index 9aefcb5535..2586f18ed7 100644 --- a/src/modules/repository/repository-module-manager.js +++ b/src/modules/repository/repository-module-manager.js @@ -292,6 +292,10 @@ class RepositoryModuleManager extends BaseModuleManager { ); } + async getParanetById(paranetId) { + return this.getRepository('paranet').getParanet(paranetId); + } + async updateServiceAgreementRecord( blockchainId, contract, From df2ba83005256acf798b8d1730a0c3fdb2e29590 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 11:03:05 +0200 Subject: [PATCH 27/82] Retrieve kaCount from db in start-paranet-sync --- src/commands/paranet/start-paranet-sync-commands.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index 7ee60fcbe3..351b27442c 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -7,6 +7,7 @@ class StartParanetSyncCommands extends Command { this.commandExecutor = ctx.commandExecutor; this.ualService = ctx.ualService; this.blockchainModuleManager = ctx.blockchainModuleManager; + this.repositoryModuleManager = ctx.repositoryModuleManager; this.errorType = ERROR_TYPE.PARANET.START_PARANET_SYNC_ERROR; } @@ -28,7 +29,7 @@ class StartParanetSyncCommands extends Command { } const contractKaCount = this.blockchainModuleManager.getKnowledgeAssetsCount(paranetId); - const cachedKaCount = 0; // TODO: Fetch from db + const cachedKaCount = this.repositoryModuleManager.getParanetById(paranetId).kaCount; if (cachedKaCount === contractKaCount) return Command.empty(); @@ -43,6 +44,8 @@ class StartParanetSyncCommands extends Command { kaToUpdate.push(...nextKaArray); } + // TODO: Update the kaCount in DB + kaToUpdate .map((ka) => ka.tokenId) .forEach((tokenId) => { From 838c23fbb38f5cc50c6c91ad0bf7243ec333196c Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 12:20:23 +0200 Subject: [PATCH 28/82] Check for null --- src/commands/paranet/start-paranet-sync-commands.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index 351b27442c..f6e8bb9c2c 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -29,7 +29,8 @@ class StartParanetSyncCommands extends Command { } const contractKaCount = this.blockchainModuleManager.getKnowledgeAssetsCount(paranetId); - const cachedKaCount = this.repositoryModuleManager.getParanetById(paranetId).kaCount; + const cachedKaCount = + this.repositoryModuleManager.getParanetById(paranetId)?.kaCount ?? 0; if (cachedKaCount === contractKaCount) return Command.empty(); From e02e5c0a1d0fe3523bc85abefaff2e950ab417bf Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 13:14:04 +0200 Subject: [PATCH 29/82] Save kaCount to db and add awaits --- src/commands/paranet/start-paranet-sync-commands.js | 10 ++++++---- .../sequelize/repositories/paranet-repository.js | 11 +++++++++++ src/modules/repository/repository-module-manager.js | 4 ++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index f6e8bb9c2c..e6adebd4ae 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -28,9 +28,11 @@ class StartParanetSyncCommands extends Command { return Command.empty(); } - const contractKaCount = this.blockchainModuleManager.getKnowledgeAssetsCount(paranetId); + const contractKaCount = await this.blockchainModuleManager.getKnowledgeAssetsCount( + paranetId, + ); const cachedKaCount = - this.repositoryModuleManager.getParanetById(paranetId)?.kaCount ?? 0; + (await this.repositoryModuleManager.getParanetById(paranetId)?.kaCount) ?? 0; if (cachedKaCount === contractKaCount) return Command.empty(); @@ -45,8 +47,6 @@ class StartParanetSyncCommands extends Command { kaToUpdate.push(...nextKaArray); } - // TODO: Update the kaCount in DB - kaToUpdate .map((ka) => ka.tokenId) .forEach((tokenId) => { @@ -64,6 +64,8 @@ class StartParanetSyncCommands extends Command { }), ); }); + + await this.repositoryModuleManager.updateParanetKaCount(paranetId, contractKaCount); }); await Promise.all(promises); diff --git a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js index a2fcb6a98c..5bacf3595f 100644 --- a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js @@ -11,6 +11,17 @@ class ParanetRepository { }, }); } + + async updateParanetKaCount(paranetId, kaCount) { + await this.model.update( + { kaCount }, + { + where: { + paranetId, + }, + }, + ); + } } export default ParanetRepository; diff --git a/src/modules/repository/repository-module-manager.js b/src/modules/repository/repository-module-manager.js index 2586f18ed7..059fe46706 100644 --- a/src/modules/repository/repository-module-manager.js +++ b/src/modules/repository/repository-module-manager.js @@ -296,6 +296,10 @@ class RepositoryModuleManager extends BaseModuleManager { return this.getRepository('paranet').getParanet(paranetId); } + async updateParanetKaCount(paranetId, kaCount) { + return this.getRepository('paranet').updateParanetKaCount(paranetId, kaCount); + } + async updateServiceAgreementRecord( blockchainId, contract, From 73b60c3d5056e32c463eb187833a0cda2a2df10c Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 13:31:31 +0200 Subject: [PATCH 30/82] Use findOrCreate for getParanet to cover first call --- .../sequelize/repositories/paranet-repository.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js index 5bacf3595f..ccb5be0936 100644 --- a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js @@ -5,10 +5,14 @@ class ParanetRepository { } async getParanet(paranetId) { - return this.model.findOne({ + return this.model.findOrCreate({ where: { paranetId, }, + defaults: { + paranetId, + kaCount: 0, + }, }); } From 9afc322c74886855243663cabc4ff10ce529bd4f Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 13:45:07 +0200 Subject: [PATCH 31/82] Add logs to start-paranet-sync --- src/commands/paranet/start-paranet-sync-commands.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index e6adebd4ae..65b4cda5b4 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -34,7 +34,16 @@ class StartParanetSyncCommands extends Command { const cachedKaCount = (await this.repositoryModuleManager.getParanetById(paranetId)?.kaCount) ?? 0; - if (cachedKaCount === contractKaCount) return Command.empty(); + if (cachedKaCount === contractKaCount) { + this.logger.info( + `Paranet sync: KA count from contract and in DB is the same, nothing to sync!`, + ); + return Command.empty(); + } + + this.logger.info( + `Paranet sync: Syncing ${contractKaCount - cachedKaCount + 1} assets...`, + ); const kaToUpdate = []; for (let i = cachedKaCount; i <= contractKaCount; i += 50) { From 25a812904561fee607c79c892981ee2b9e7bb26e Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 14:19:57 +0200 Subject: [PATCH 32/82] Properly call getParanetById --- src/commands/paranet/start-paranet-sync-commands.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index 65b4cda5b4..0c297a9cdd 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -31,8 +31,7 @@ class StartParanetSyncCommands extends Command { const contractKaCount = await this.blockchainModuleManager.getKnowledgeAssetsCount( paranetId, ); - const cachedKaCount = - (await this.repositoryModuleManager.getParanetById(paranetId)?.kaCount) ?? 0; + const [cachedKaCount] = await this.repositoryModuleManager.getParanetById(paranetId); if (cachedKaCount === contractKaCount) { this.logger.info( From d499b8e8b1719234bd9d362d6113db2132c31667 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 14:59:41 +0200 Subject: [PATCH 33/82] Remove unneeded check in start-paranet-sync --- src/commands/paranet/start-paranet-sync-commands.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index 0c297a9cdd..213df0ee5f 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -23,11 +23,6 @@ class StartParanetSyncCommands extends Command { const promises = []; this.config.assetSync?.syncParanets.forEach(async (paranetId) => { - if (!this.ualService.isUal(paranetId)) { - this.logger.info(`Paranet sync: paranetId ${paranetId} is not a valid UAL!`); - return Command.empty(); - } - const contractKaCount = await this.blockchainModuleManager.getKnowledgeAssetsCount( paranetId, ); From 1de0a6dfcce6f8dd3edb9de70ded54b882b8734b Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 15:31:54 +0200 Subject: [PATCH 34/82] Rename function to getOrCreateParanet --- src/commands/paranet/start-paranet-sync-commands.js | 4 +++- .../sequelize/repositories/paranet-repository.js | 2 +- src/modules/repository/repository-module-manager.js | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index 213df0ee5f..bd02516866 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -26,7 +26,9 @@ class StartParanetSyncCommands extends Command { const contractKaCount = await this.blockchainModuleManager.getKnowledgeAssetsCount( paranetId, ); - const [cachedKaCount] = await this.repositoryModuleManager.getParanetById(paranetId); + const [cachedKaCount] = await this.repositoryModuleManager.getOrCreateParanetById( + paranetId, + ); if (cachedKaCount === contractKaCount) { this.logger.info( diff --git a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js index ccb5be0936..f27201f676 100644 --- a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js @@ -4,7 +4,7 @@ class ParanetRepository { this.model = models.paranet; } - async getParanet(paranetId) { + async getOrCreateParanet(paranetId) { return this.model.findOrCreate({ where: { paranetId, diff --git a/src/modules/repository/repository-module-manager.js b/src/modules/repository/repository-module-manager.js index 059fe46706..2bb9deafad 100644 --- a/src/modules/repository/repository-module-manager.js +++ b/src/modules/repository/repository-module-manager.js @@ -292,8 +292,8 @@ class RepositoryModuleManager extends BaseModuleManager { ); } - async getParanetById(paranetId) { - return this.getRepository('paranet').getParanet(paranetId); + async getOrCreateParanetById(paranetId) { + return this.getRepository('paranet').getOrCreateParanet(paranetId); } async updateParanetKaCount(paranetId, kaCount) { From dbfda6425c06a41b3ac46ab2e0dea5c765ee7222 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 15:33:56 +0200 Subject: [PATCH 35/82] Use TRIPLE_STORE_REPOSITORY from constants and reformat file --- src/commands/paranet/paranet-sync-command.js | 59 ++++++++++++++++---- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index f8a865bab3..4db57beb53 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -1,7 +1,14 @@ /* eslint-disable no-unused-vars */ /* eslint-disable no-await-in-loop */ import Command from '../command.js'; -import { ERROR_TYPE, PARANET_SYNC_FREQUENCY_MILLS, OPERATION_ID_STATUS, CONTENT_ASSET_HASH_FUNCTION_ID, SIMPLE_ASSET_SYNC_PARAMETERS } from '../../constants/constants.js'; +import { + ERROR_TYPE, + PARANET_SYNC_FREQUENCY_MILLS, + OPERATION_ID_STATUS, + CONTENT_ASSET_HASH_FUNCTION_ID, + SIMPLE_ASSET_SYNC_PARAMETERS, + TRIPLE_STORE_REPOSITORIES, +} from '../../constants/constants.js'; class StartParanetSyncCommands extends Command { constructor(ctx) { @@ -30,16 +37,45 @@ class StartParanetSyncCommands extends Command { // Go through all except the last one for (let stateIndex = assertionIds.length - 2; stateIndex > 0; stateIndex -= 1) { - await this.syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId, 'currentHistory', false, stateIndex === assertionIds.length - 2); + await this.syncAsset( + blockchain, + contract, + tokenId, + assertionIds, + stateIndex, + paranetId, + TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, + false, + stateIndex === assertionIds.length - 2, + ); } // Then sync the last one, but put it in the current repo - await this.syncAsset(blockchain, contract, tokenId, assertionIds, assertionIds.length - 1, paranetId, null, false); + await this.syncAsset( + blockchain, + contract, + tokenId, + assertionIds, + assertionIds.length - 1, + paranetId, + null, + false, + ); return Command.repeat(); } - async syncAsset(blockchain, contract, tokenId, assertionIds, stateIndex, paranetId, paranetRepository, latestAsset, deleteFromEarlier) { + async syncAsset( + blockchain, + contract, + tokenId, + assertionIds, + stateIndex, + paranetId, + paranetRepository, + latestAsset, + deleteFromEarlier, + ) { try { if ( await this.repositoryModuleManager.isStateSynced( @@ -63,12 +99,13 @@ class StartParanetSyncCommands extends Command { return; } - const statePresentInParanetRepository = await this.tripleStoreService.paranetAssetExists( - paranetId, - tokenId, - stateIndex, - assertionIds, - ); + const statePresentInParanetRepository = + await this.tripleStoreService.paranetAssetExists( + paranetId, + tokenId, + stateIndex, + assertionIds, + ); if (statePresentInParanetRepository) { this.logger.trace( @@ -145,7 +182,7 @@ class StartParanetSyncCommands extends Command { paranetId, paranetRepoId: paranetRepository, paranetLatestAsset: latestAsset, - paranetDeleteFromEarlier: deleteFromEarlier + paranetDeleteFromEarlier: deleteFromEarlier, }, transactional: false, }); From bb4aac6cba3184faa49a231d8d520f8ccf3df155 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 15:37:14 +0200 Subject: [PATCH 36/82] Move KA number (50) to constants --- src/commands/paranet/start-paranet-sync-commands.js | 10 +++++++--- src/constants/constants.js | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index bd02516866..b37f826c4f 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -1,5 +1,9 @@ import Command from '../command.js'; -import { ERROR_TYPE, PARANET_SYNC_FREQUENCY_MILLS } from '../../constants/constants.js'; +import { + ERROR_TYPE, + PARANET_SYNC_FREQUENCY_MILLS, + PARANET_SYNC_KA_COUNT, +} from '../../constants/constants.js'; class StartParanetSyncCommands extends Command { constructor(ctx) { @@ -42,11 +46,11 @@ class StartParanetSyncCommands extends Command { ); const kaToUpdate = []; - for (let i = cachedKaCount; i <= contractKaCount; i += 50) { + for (let i = cachedKaCount; i <= contractKaCount; i += PARANET_SYNC_KA_COUNT) { const nextKaArray = this.blockchainModuleManager.getKnowledgeAssetsWithPagination( paranetId, i, - 50, + PARANET_SYNC_KA_COUNT, ); if (!nextKaArray.length) break; kaToUpdate.push(...nextKaArray); diff --git a/src/constants/constants.js b/src/constants/constants.js index ea7ce80c47..de95ad5ff3 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -89,6 +89,8 @@ export const PEER_OFFLINE_LIMIT = 24 * 60 * 60 * 1000; export const CONTENT_ASSET_HASH_FUNCTION_ID = 1; +export const PARANET_SYNC_KA_COUNT = 50; + export const TRIPLE_STORE_REPOSITORIES = { PUBLIC_CURRENT: 'publicCurrent', PUBLIC_HISTORY: 'publicHistory', @@ -672,7 +674,7 @@ export const CONTRACTS = { IDENTITY_STORAGE_CONTRACT: 'IdentityStorageContract', LOG2PLDSF_CONTRACT: 'Log2PLDSFContract', LINEAR_SUM_CONTRACT: 'LinearSumContract', - PARANETS_REGISTRY_CONTRACT: 'ParanetsRegistry' + PARANETS_REGISTRY_CONTRACT: 'ParanetsRegistry', }; export const CONTRACT_EVENTS = { From 5f4597ba70635b8c49ce6e933fc3d762ae227ced Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Mon, 29 Apr 2024 16:01:29 +0200 Subject: [PATCH 37/82] Fix lint issues --- .../20240429083058-create-paranet.js | 69 +++++++++---------- .../sequelize/models/paranet.js | 51 +++++++------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js b/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js index b2cfe5117b..11f7e0990e 100644 --- a/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js +++ b/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js @@ -1,37 +1,36 @@ -'use strict'; /** @type {import('sequelize-cli').Migration} */ module.exports = { - async up(queryInterface, Sequelize) { - await queryInterface.createTable('Paranets', { - id: { - allowNull: false, - autoIncrement: true, - primaryKey: true, - type: Sequelize.INTEGER - }, - name: { - type: Sequelize.STRING - }, - description: { - type: Sequelize.STRING - }, - paranetId: { - type: Sequelize.STRING - }, - kaCount: { - type: Sequelize.INTEGER - }, - createdAt: { - allowNull: false, - type: Sequelize.DATE - }, - updatedAt: { - allowNull: false, - type: Sequelize.DATE - } - }); - }, - async down(queryInterface, Sequelize) { - await queryInterface.dropTable('Paranets'); - } -}; \ No newline at end of file + async up(queryInterface, Sequelize) { + await queryInterface.createTable('Paranets', { + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER, + }, + name: { + type: Sequelize.STRING, + }, + description: { + type: Sequelize.STRING, + }, + paranetId: { + type: Sequelize.STRING, + }, + kaCount: { + type: Sequelize.INTEGER, + }, + createdAt: { + allowNull: false, + type: Sequelize.DATE, + }, + updatedAt: { + allowNull: false, + type: Sequelize.DATE, + }, + }); + }, + async down(queryInterface) { + await queryInterface.dropTable('Paranets'); + }, +}; diff --git a/src/modules/repository/implementation/sequelize/models/paranet.js b/src/modules/repository/implementation/sequelize/models/paranet.js index a5b695169e..1855826fb6 100644 --- a/src/modules/repository/implementation/sequelize/models/paranet.js +++ b/src/modules/repository/implementation/sequelize/models/paranet.js @@ -1,26 +1,27 @@ -'use strict'; -const { - Model -} = require('sequelize'); -module.exports = (sequelize, DataTypes) => { - class Paranet extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate(models) { - // define association here +import { Model } from 'sequelize'; + +export default (sequelize, DataTypes) => { + class Paranet extends Model { + /** + * Helper method for defining associations. + * This method is not a part of Sequelize lifecycle. + * The `models/index` file will call this method automatically. + */ + static associate() { + // define association here + } } - } - Paranet.init({ - name: DataTypes.STRING, - description: DataTypes.STRING, - paranetId: DataTypes.STRING, - kaCount: DataTypes.INTEGER - }, { - sequelize, - modelName: 'Paranet', - }); - return Paranet; -}; \ No newline at end of file + Paranet.init( + { + name: DataTypes.STRING, + description: DataTypes.STRING, + paranetId: DataTypes.STRING, + kaCount: DataTypes.INTEGER, + }, + { + sequelize, + modelName: 'Paranet', + }, + ); + return Paranet; +}; From 32cdef153b4e948dae5c4795bfc637596bc8ef41 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Tue, 30 Apr 2024 10:44:14 +0200 Subject: [PATCH 38/82] Make startParanetSync schedule paranetSync commands for each paranet --- src/commands/paranet/paranet-sync-command.js | 97 +++++++++++++------ .../paranet/start-paranet-sync-commands.js | 62 +++--------- 2 files changed, 79 insertions(+), 80 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 4db57beb53..811adf490b 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -8,6 +8,7 @@ import { CONTENT_ASSET_HASH_FUNCTION_ID, SIMPLE_ASSET_SYNC_PARAMETERS, TRIPLE_STORE_REPOSITORIES, + PARANET_SYNC_KA_COUNT, } from '../../constants/constants.js'; class StartParanetSyncCommands extends Command { @@ -22,45 +23,83 @@ class StartParanetSyncCommands extends Command { } async execute(command) { - const { commandOperationId, paranetId, tokenId } = command.data; + const { commandOperationId, paranetId } = command.data; this.logger.info( - `Paranet sync: Starting paranet sync command for ${paranetId} with operation id: ${commandOperationId}, token id: ${tokenId}`, + `Paranet sync: Starting paranet sync for operation ID: ${commandOperationId}`, ); - const { blockchain, contract } = this.ualService.resolveUal(paranetId); - const assertionIds = await this.blockchainModuleManager.getLatestAssertionId( - blockchain, - contract, - tokenId, + const contractKaCount = await this.blockchainModuleManager.getKnowledgeAssetsCount( + paranetId, + ); + const [cachedKaCount] = await this.repositoryModuleManager.getOrCreateParanetById( + paranetId, ); - // Go through all except the last one - for (let stateIndex = assertionIds.length - 2; stateIndex > 0; stateIndex -= 1) { - await this.syncAsset( - blockchain, - contract, - tokenId, - assertionIds, - stateIndex, + if (cachedKaCount === contractKaCount) { + this.logger.info( + `Paranet sync: KA count from contract and in DB is the same, nothing to sync!`, + ); + return Command.empty(); + } + + this.logger.info(`Paranet sync: Syncing ${contractKaCount - cachedKaCount + 1} assets...`); + + const kaToUpdate = []; + for (let i = cachedKaCount; i <= contractKaCount; i += PARANET_SYNC_KA_COUNT) { + const nextKaArray = this.blockchainModuleManager.getKnowledgeAssetsWithPagination( paranetId, - TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, - false, - stateIndex === assertionIds.length - 2, + i, + PARANET_SYNC_KA_COUNT, ); + if (!nextKaArray.length) break; + kaToUpdate.push(...nextKaArray); } - // Then sync the last one, but put it in the current repo - await this.syncAsset( - blockchain, - contract, - tokenId, - assertionIds, - assertionIds.length - 1, - paranetId, - null, - false, - ); + kaToUpdate + .map((ka) => ka.tokenId) + .forEach(async (tokenId) => { + this.logger.info( + `Paranet sync: Syncing token id: ${tokenId} for ${paranetId} with operation id: ${commandOperationId}`, + ); + + const { blockchain, contract } = this.ualService.resolveUal(paranetId); + const assertionIds = await this.blockchainModuleManager.getLatestAssertionId( + blockchain, + contract, + tokenId, + ); + + // Go through all except the last one + for (let stateIndex = assertionIds.length - 2; stateIndex > 0; stateIndex -= 1) { + await this.syncAsset( + blockchain, + contract, + tokenId, + assertionIds, + stateIndex, + paranetId, + TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, + false, + stateIndex === assertionIds.length - 2, + ); + } + + // Then sync the last one, but put it in the current repo + await this.syncAsset( + blockchain, + contract, + tokenId, + assertionIds, + assertionIds.length - 1, + paranetId, + null, + false, + ); + }); + + // TODO: Save only successfull ones + await this.repositoryModuleManager.updateParanetKaCount(paranetId, contractKaCount); return Command.repeat(); } diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index b37f826c4f..2ac76558d1 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -1,9 +1,5 @@ import Command from '../command.js'; -import { - ERROR_TYPE, - PARANET_SYNC_FREQUENCY_MILLS, - PARANET_SYNC_KA_COUNT, -} from '../../constants/constants.js'; +import { ERROR_TYPE, PARANET_SYNC_FREQUENCY_MILLS } from '../../constants/constants.js'; class StartParanetSyncCommands extends Command { constructor(ctx) { @@ -27,54 +23,18 @@ class StartParanetSyncCommands extends Command { const promises = []; this.config.assetSync?.syncParanets.forEach(async (paranetId) => { - const contractKaCount = await this.blockchainModuleManager.getKnowledgeAssetsCount( + const commandData = { paranetId, + operationId, + }; + + promises.append( + this.commandExecutor.add({ + name: 'paranetSyncCommand', + data: commandData, + period: PARANET_SYNC_FREQUENCY_MILLS, + }), ); - const [cachedKaCount] = await this.repositoryModuleManager.getOrCreateParanetById( - paranetId, - ); - - if (cachedKaCount === contractKaCount) { - this.logger.info( - `Paranet sync: KA count from contract and in DB is the same, nothing to sync!`, - ); - return Command.empty(); - } - - this.logger.info( - `Paranet sync: Syncing ${contractKaCount - cachedKaCount + 1} assets...`, - ); - - const kaToUpdate = []; - for (let i = cachedKaCount; i <= contractKaCount; i += PARANET_SYNC_KA_COUNT) { - const nextKaArray = this.blockchainModuleManager.getKnowledgeAssetsWithPagination( - paranetId, - i, - PARANET_SYNC_KA_COUNT, - ); - if (!nextKaArray.length) break; - kaToUpdate.push(...nextKaArray); - } - - kaToUpdate - .map((ka) => ka.tokenId) - .forEach((tokenId) => { - const commandData = { - paranetId, - operationId, - tokenId, - }; - - promises.append( - this.commandExecutor.add({ - name: 'paranetSyncCommand', - data: commandData, - period: PARANET_SYNC_FREQUENCY_MILLS, - }), - ); - }); - - await this.repositoryModuleManager.updateParanetKaCount(paranetId, contractKaCount); }); await Promise.all(promises); From 3c90e3b437fe5a733ce29f2065c2ec078574bc58 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Tue, 30 Apr 2024 10:46:47 +0200 Subject: [PATCH 39/82] PARACHAIN -> PARANET in logs --- src/service/get-service.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/service/get-service.js b/src/service/get-service.js index acbb54537b..362e1b1af5 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -46,7 +46,7 @@ class GetService extends OperationService { paranetId, paranetRepoId, paranetLatestAsset, - paranetDeleteFromEarlier + paranetDeleteFromEarlier, } = command.data; const keywordsStatuses = await this.getResponsesStatuses( @@ -104,12 +104,14 @@ class GetService extends OperationService { if (paranetSync) { this.logger.debug( - `PARACHAIN_ASSET_SYNC: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + `PARANET_ASSET_SYNC: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, ); if (paranetLatestAsset) { await this.tripleStoreService.localStoreAsset( - `${this.paranetIdService.getParanetRepositoryName(paranetId)}-${TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT}`, + `${this.paranetIdService.getParanetRepositoryName(paranetId)}-${ + TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT + }`, assertionId, responseData.nquads, blockchain, @@ -117,16 +119,17 @@ class GetService extends OperationService { tokenId, keyword, ); - } - else if (paranetRepoId) { - const newRepoName = `${this.paranetIdService.getParanetRepositoryName(paranetId)}-${paranetRepoId}`; + } else if (paranetRepoId) { + const newRepoName = `${this.paranetIdService.getParanetRepositoryName( + paranetId, + )}-${paranetRepoId}`; if (paranetDeleteFromEarlier) { // This was the previous latest one, move it to currentHistory this.logger.debug( - `PARACHAIN_ASSET_SYNC: Moving asset to repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, - ); - + `PARANET_ASSET_SYNC: Moving asset to repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); + await this.tripleStoreService.moveAsset( newRepoName, assertionId, @@ -135,13 +138,12 @@ class GetService extends OperationService { tokenId, keyword, ); - } - else { + } else { // This is one of the older assets, just update it this.logger.debug( - `PARACHAIN_ASSET_SYNC: Updating asset in repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, - ); + `PARANET_ASSET_SYNC: Updating asset in repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); await this.tripleStoreService.localStoreAsset( newRepoName, From 3c7bfbda2768d587d3ba05d3c7a33574816875f8 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Tue, 30 Apr 2024 10:49:13 +0200 Subject: [PATCH 40/82] Add missing param to syncAsset --- src/commands/paranet/paranet-sync-command.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 811adf490b..a84174ba7b 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -95,6 +95,7 @@ class StartParanetSyncCommands extends Command { paranetId, null, false, + false, ); }); From c80d36ee04b5758b38530878c9a95534d79af884 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Tue, 30 Apr 2024 12:29:15 +0200 Subject: [PATCH 41/82] stateIndex >= 0 --- src/commands/paranet/paranet-sync-command.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index a84174ba7b..4709177bcd 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -71,7 +71,7 @@ class StartParanetSyncCommands extends Command { ); // Go through all except the last one - for (let stateIndex = assertionIds.length - 2; stateIndex > 0; stateIndex -= 1) { + for (let stateIndex = assertionIds.length - 2; stateIndex >= 0; stateIndex -= 1) { await this.syncAsset( blockchain, contract, @@ -99,7 +99,7 @@ class StartParanetSyncCommands extends Command { ); }); - // TODO: Save only successfull ones + // TODO: Save only successful ones await this.repositoryModuleManager.updateParanetKaCount(paranetId, contractKaCount); return Command.repeat(); From 9295b8e6ff56d406daba6f3a76456545a8bd9be2 Mon Sep 17 00:00:00 2001 From: Aleksa Savic Date: Tue, 30 Apr 2024 12:57:38 +0200 Subject: [PATCH 42/82] Use DI for ParanetIdService --- src/service/paranet-id-service.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/service/paranet-id-service.js b/src/service/paranet-id-service.js index a21c8ae23e..a2d54b3b35 100644 --- a/src/service/paranet-id-service.js +++ b/src/service/paranet-id-service.js @@ -1,8 +1,10 @@ -import UalService from './ual-service.js'; +class ParanetIdService { + constructor(ctx) { + this.ualService = ctx.ualService; + } -class ParanetIdService extends UalService { getParanetRepositoryName(paranetId) { - if (this.isUAL(paranetId)) { + if (this.ualService.isUAL(paranetId)) { return paranetId.replace('/', '-'); } throw new Error( From ea0e238abb06dcdb09b3f8f8e09ea71fcc4b1043 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Thu, 16 May 2024 02:18:12 +0200 Subject: [PATCH 43/82] Paranet improvments --- ot-node.js | 40 ++++-- src/commands/paranet/paranet-sync-command.js | 123 +++++++++--------- .../paranet/start-paranet-sync-commands.js | 4 +- .../blockchain/blockchain-module-manager.js | 16 ++- .../blockchain/implementation/web3-service.js | 35 +++++ .../20240429083058-create-paranet.js | 90 +++++++++---- .../sequelize/models/paranet.js | 62 +++++---- .../repositories/paranet-repository.js | 35 ++++- .../repository/repository-module-manager.js | 17 +++ src/service/paranet-service.js | 46 +++++++ 10 files changed, 339 insertions(+), 129 deletions(-) create mode 100644 src/service/paranet-service.js diff --git a/ot-node.js b/ot-node.js index 15e9337e2f..77e45ef6a5 100644 --- a/ot-node.js +++ b/ot-node.js @@ -341,23 +341,43 @@ class OTNode { await autoUpdaterCommand.execute(); } - initializeParanets() { + async initializeParanets() { const paranetIdService = this.container.resolve('paranetIdService'); 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 validParanets = []; - this.config.assetSync?.syncParanets.forEach((paranetId) => { - if (!paranetIdService.isUAL(paranetId)) { - this.logger.warn(`Unable to initialize Paranet with id ${paranetId} because of invalid UAL format`); + // Do this in promises + this.config.assetSync?.syncParanets.forEach(async (paranetUAL) => { + // Not this service + if (!paranetIdService.isUAL(paranetUAL)) { + this.logger.warn( + `Unable to initialize Paranet with id ${paranetUAL} because of invalid UAL format`, + ); } else { - const { blockchainId } = paranetIdService.resolveUAL(paranetId); - if (!blockchainModuleManager.getImplementationNames().includes(blockchainId)) { - this.logger.warn(`Unable to initialize Paranet with id ${paranetId} because of unsupported blockchain implementation`); + const { blockchain, contract, tokenId } = this.ualService.resolveUAL(paranetUAL); + if (!blockchainModuleManager.getImplementationNames().includes(blockchain)) { + this.logger.warn( + `Unable to initialize Paranet with id ${paranetUAL} because of unsupported blockchain implementation`, + ); } else { - validParanets.push(paranetId); - const repository = paranetIdService.getParanetRepositoryName(paranetId); - tripleStoreModuleManager.initializeRepository(repository); + const paranetId = paranetService.constructParanetId( + blockchain, + contract, + tokenId, + ); + const paranetExists = await blockchainModuleManager.paranetExists(paranetId); + if (!paranetExists) { + this.logger.warn( + `Unable to initialize Paranet with id ${paranetUAL} because it doesn't exist`, + ); + } else { + validParanets.push(paranetUAL); + const repository = paranetIdService.getParanetRepositoryName(paranetUAL); + tripleStoreModuleManager.initializeRepository(repository); + paranetService.initializeParanetRecord(blockchain, paranetId); + } } } }); diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 4709177bcd..eab250bcec 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -11,43 +11,54 @@ import { PARANET_SYNC_KA_COUNT, } from '../../constants/constants.js'; -class StartParanetSyncCommands extends Command { +class ParanetSyncCommand extends Command { constructor(ctx) { super(ctx); this.commandExecutor = ctx.commandExecutor; this.blockchainModuleManager = ctx.blockchainModuleManager; this.tripleStoreService = ctx.tripleStoreService; this.ualService = ctx.ualService; + this.paranetService = ctx.paranetService; this.errorType = ERROR_TYPE.PARANET.PARANET_SYNC_ERROR; } async execute(command) { - const { commandOperationId, paranetId } = command.data; + const { commandOperationId, paranetUAL } = command.data; + + const { blockchain, contract, tokenId } = this.ualService.resolveUAL(paranetUAL); + const paranetId = this.paranetService.constructParanetId(blockchain, contract, tokenId); this.logger.info( - `Paranet sync: Starting paranet sync for operation ID: ${commandOperationId}`, + `Paranet sync: Starting paranet sync for paranetId: ${paranetId}, operation ID: ${commandOperationId}`, ); const contractKaCount = await this.blockchainModuleManager.getKnowledgeAssetsCount( + blockchain, paranetId, ); - const [cachedKaCount] = await this.repositoryModuleManager.getOrCreateParanetById( + const [cachedKaCount] = await this.repositoryModuleManager.getKACount( paranetId, + blockchain, ); if (cachedKaCount === contractKaCount) { this.logger.info( - `Paranet sync: KA count from contract and in DB is the same, nothing to sync!`, + `Paranet sync: KA count from contract and in DB is the same, nothing to sync, for paranetId: ${paranetId}, operation ID: ${commandOperationId}!`, ); return Command.empty(); } - this.logger.info(`Paranet sync: Syncing ${contractKaCount - cachedKaCount + 1} assets...`); - + this.logger.info( + `Paranet sync: Syncing ${ + contractKaCount - cachedKaCount + 1 + } assets for paranetId: ${paranetId}, operation ID: ${commandOperationId}`, + ); + // TODO: Rename i, should it be cachedKaCount + 1 as cachedKaCount is already in, but count is index const kaToUpdate = []; for (let i = cachedKaCount; i <= contractKaCount; i += PARANET_SYNC_KA_COUNT) { const nextKaArray = this.blockchainModuleManager.getKnowledgeAssetsWithPagination( + blockchain, paranetId, i, PARANET_SYNC_KA_COUNT, @@ -55,32 +66,42 @@ class StartParanetSyncCommands extends Command { if (!nextKaArray.length) break; kaToUpdate.push(...nextKaArray); } - + // To this as batch of promises + // Wrapt it in try catch with retry kaToUpdate - .map((ka) => ka.tokenId) - .forEach(async (tokenId) => { + // It's array of keywords not tokenId + // .map((ka) => ka.tokenId) + .forEach(async (knowledgeAssetId) => { this.logger.info( - `Paranet sync: Syncing token id: ${tokenId} for ${paranetId} with operation id: ${commandOperationId}`, + `Paranet sync: Syncing token id: ${knowledgeAssetId} for ${paranetId} with operation id: ${commandOperationId}`, ); - const { blockchain, contract } = this.ualService.resolveUal(paranetId); + const { kaContract } = this.blockchainModuleManager.getKnowledgeAssetLocator( + blockchain, + knowledgeAssetId, + ); + + // Does this return unfainalized changes const assertionIds = await this.blockchainModuleManager.getLatestAssertionId( blockchain, - contract, + kaContract, tokenId, ); // Go through all except the last one + // TODO: Do it in promises as a batch for (let stateIndex = assertionIds.length - 2; stateIndex >= 0; stateIndex -= 1) { await this.syncAsset( blockchain, - contract, + kaContract, tokenId, assertionIds, stateIndex, paranetId, TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, false, + // It should never delete as it never was in storage + // But maybe will becouse this is unfainalized stateIndex === assertionIds.length - 2, ); } @@ -88,7 +109,7 @@ class StartParanetSyncCommands extends Command { // Then sync the last one, but put it in the current repo await this.syncAsset( blockchain, - contract, + kaContract, tokenId, assertionIds, assertionIds.length - 1, @@ -100,6 +121,7 @@ class StartParanetSyncCommands extends Command { }); // TODO: Save only successful ones + // Here is the problme if one missed count will be false and we will always try to get it again await this.repositoryModuleManager.updateParanetKaCount(paranetId, contractKaCount); return Command.repeat(); @@ -117,28 +139,6 @@ class StartParanetSyncCommands extends Command { deleteFromEarlier, ) { try { - if ( - await this.repositoryModuleManager.isStateSynced( - blockchain, - contract, - tokenId, - stateIndex, - ) - ) { - this.logger.trace( - `PARANET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} already synced blockchain: ${blockchain}`, - ); - await this.repositoryModuleManager.updateAssetSyncRecord( - blockchain, - contract, - tokenId, - stateIndex, - SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, - true, - ); - return; - } - const statePresentInParanetRepository = await this.tripleStoreService.paranetAssetExists( paranetId, @@ -151,14 +151,14 @@ class StartParanetSyncCommands extends Command { this.logger.trace( `PARANET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} found in triple store blockchain: ${blockchain}`, ); - await this.repositoryModuleManager.createAssetSyncRecord( - blockchain, - contract, - tokenId, - stateIndex, - SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, - true, - ); + // await this.repositoryModuleManager.createAssetSyncRecord( + // blockchain, + // contract, + // tokenId, + // stateIndex, + // SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, + // true, + // ); return; } @@ -181,13 +181,13 @@ class StartParanetSyncCommands extends Command { OPERATION_ID_STATUS.GET.GET_INIT_START, ), - this.repositoryModuleManager.createAssetSyncRecord( - blockchain, - contract, - tokenId, - stateIndex, - SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.IN_PROGRESS, - ), + // this.repositoryModuleManager.createAssetSyncRecord( + // blockchain, + // contract, + // tokenId, + // stateIndex, + // SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.IN_PROGRESS, + // ), this.repositoryModuleManager.createOperationRecord( this.getService.getOperationName(), @@ -236,6 +236,7 @@ class StartParanetSyncCommands extends Command { let attempt = 0; let getResult; do { + // TODO: Import timeout await setTimeout(SIMPLE_ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_INTERVAL_MILLIS); getResult = await this.operationIdService.getOperationIdRecord(operationId); attempt += 1; @@ -248,14 +249,14 @@ class StartParanetSyncCommands extends Command { this.logger.warn( `ASSET_SYNC: Unable to sync tokenId: ${tokenId}, for contract: ${contract} state index: ${stateIndex} blockchain: ${blockchain}, error: ${error}`, ); - await this.repositoryModuleManager.updateAssetSyncRecord( - blockchain, - contract, - tokenId, - stateIndex, - SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.FAILED, - true, - ); + // await this.repositoryModuleManager.updateAssetSyncRecord( + // blockchain, + // contract, + // tokenId, + // stateIndex, + // SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.FAILED, + // true, + // ); } } @@ -287,4 +288,4 @@ class StartParanetSyncCommands extends Command { } } -export default StartParanetSyncCommands; +export default ParanetSyncCommand; diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index 2ac76558d1..70fca31777 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -22,9 +22,9 @@ class StartParanetSyncCommands extends Command { await this.commandExecutor.delete('paranetSyncCommand'); const promises = []; - this.config.assetSync?.syncParanets.forEach(async (paranetId) => { + this.config.assetSync?.syncParanets.forEach(async (paranetUAL) => { const commandData = { - paranetId, + paranetUAL, operationId, }; diff --git a/src/modules/blockchain/blockchain-module-manager.js b/src/modules/blockchain/blockchain-module-manager.js index 2fe75031f9..60c5ac1c6b 100644 --- a/src/modules/blockchain/blockchain-module-manager.js +++ b/src/modules/blockchain/blockchain-module-manager.js @@ -465,9 +465,23 @@ class BlockchainModuleManager extends BaseModuleManager { return this.callImplementationFunction(blockchain, 'convertUint8ArrayToHex', [uint8Array]); } - getLinearSumParams(blockchain) { + async getLinearSumParams(blockchain) { return this.callImplementationFunction(blockchain, 'getLinearSumParams'); } + + async getParanetMetadata(blockchain, paranetId) { + return this.callImplementationFunction(blockchain, 'getParanetMetadata', [paranetId]); + } + + async getKnowledgeAssetLocator(blockchain, knowledgeAssetId) { + return this.callImplementationFunction(blockchain, 'getKnowledgeAssetLocator', [ + knowledgeAssetId, + ]); + } + + async paranetExists(blockchain, paranetId) { + return this.callImplementationFunction(blockchain, 'paranetExists', [paranetId]); + } } export default BlockchainModuleManager; diff --git a/src/modules/blockchain/implementation/web3-service.js b/src/modules/blockchain/implementation/web3-service.js index 265fb44a78..a8b3b88f35 100644 --- a/src/modules/blockchain/implementation/web3-service.js +++ b/src/modules/blockchain/implementation/web3-service.js @@ -56,6 +56,8 @@ const ABIs = { ServiceAgreementStorageProxy: require('dkg-evm-module/abi/ServiceAgreementStorageProxy.json'), UnfinalizedStateStorage: require('dkg-evm-module/abi/UnfinalizedStateStorage.json'), LinearSum: require('dkg-evm-module/abi/LinearSum.json'), + ParanetsRegistry: require('dkg-evm-module/abi/ParanetsRegistry.json'), + ParanetKnowledgeAssetsRegistry: require('dkg-evm-module/abi/ParanetKnowledgeAssetsRegistry.json'), }; const SCORING_FUNCTIONS = { @@ -1598,6 +1600,39 @@ class Web3Service { w2: Number(linearSumParams[3]), }; } + + async getKnowledgeAssetsCount(paranetId) { + return this.callContractFunction(this.ParanetsRegistry, 'getKnowledgeAssetsCount', [ + paranetId, + ]); + } + + async getKnowledgeAssetsWithPagination(paranetId, offset, limit) { + return this.callContractFunction( + this.ParanetsRegistry, + 'getKnowledgeAssetsWithPagination', + [paranetId, offset, limit], + ); + } + + async getParanetMetadata(paranetId) { + return this.callContractFunction(this.ParanetsRegistry, 'getParanetMetadata', [paranetId]); + } + + async getKnowledgeAssetLocator(knowledgeAssetId) { + const [knowledgeAssetStorageContract, tokenId] = await this.allContractFunction( + this.ParanetKnowledgeAssetsRegistry, + 'getKnowledgeAssetLocator', + [knowledgeAssetId], + ); + + const knowledgeAssetLocator = { knowledgeAssetStorageContract, tokenId }; + return knowledgeAssetLocator; + } + + async paranetExists(paranetId) { + return this.allContractFunction(this.ParanetsRegistry, 'paranetExists', [paranetId]); + } } export default Web3Service; diff --git a/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js b/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js index 11f7e0990e..2e15bfde93 100644 --- a/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js +++ b/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js @@ -1,36 +1,72 @@ /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - await queryInterface.createTable('Paranets', { - id: { - allowNull: false, - autoIncrement: true, - primaryKey: true, - type: Sequelize.INTEGER, + await queryInterface.createTable( + 'Paranet', + { + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER, + }, + name: { + type: Sequelize.STRING, + }, + blockchain_id: { + type: Sequelize.STRING, + primaryKey: true, + }, + description: { + type: Sequelize.STRING, + }, + paranet_id: { + type: Sequelize.STRING, + }, + ka_count: { + type: Sequelize.INTEGER, + }, + created_at: { + allowNull: false, + type: Sequelize.DATE, + }, + updated_at: { + allowNull: false, + type: Sequelize.DATE, + }, }, - name: { - type: Sequelize.STRING, + { + indexes: [ + { + // Composite index for optimal filtering on paranet_id and blockchain_id + name: 'idx_paranet_id_blockchain_id', + using: 'BTREE', // This is generally the default, but is specified here for clarity + fields: ['paranet_id', 'blockchain_id'], + }, + { + name: 'idx_name', + using: 'BTREE', // This is generally the default, but is specified here for clarity + fields: ['name'], + }, + ], }, - description: { - type: Sequelize.STRING, - }, - paranetId: { - type: Sequelize.STRING, - }, - kaCount: { - type: Sequelize.INTEGER, - }, - createdAt: { - allowNull: false, - type: Sequelize.DATE, - }, - updatedAt: { - allowNull: false, - type: Sequelize.DATE, - }, - }); + ); + + await queryInterface.sequelize.query(` + CREATE TRIGGER before_insert_paranet + BEFORE INSERT ON paranet + FOR EACH ROW + SET NEW.created_at = NOW(); + `); + + await queryInterface.sequelize.query(` + CREATE TRIGGER before_update_paranet + BEFORE UPDATE ON paranet + FOR EACH ROW + SET NEW.updated_at = NOW(); + `); }, async down(queryInterface) { - await queryInterface.dropTable('Paranets'); + await queryInterface.dropTable('Paranet'); }, }; diff --git a/src/modules/repository/implementation/sequelize/models/paranet.js b/src/modules/repository/implementation/sequelize/models/paranet.js index 1855826fb6..9e089e1d61 100644 --- a/src/modules/repository/implementation/sequelize/models/paranet.js +++ b/src/modules/repository/implementation/sequelize/models/paranet.js @@ -1,27 +1,45 @@ -import { Model } from 'sequelize'; - export default (sequelize, DataTypes) => { - class Paranet extends Model { - /** - * Helper method for defining associations. - * This method is not a part of Sequelize lifecycle. - * The `models/index` file will call this method automatically. - */ - static associate() { - // define association here - } - } - Paranet.init( + const paranet = sequelize.define( + 'paranet', { - name: DataTypes.STRING, - description: DataTypes.STRING, - paranetId: DataTypes.STRING, - kaCount: DataTypes.INTEGER, - }, - { - sequelize, - modelName: 'Paranet', + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: DataTypes.INTEGER, + }, + name: { + allowNull: false, + type: DataTypes.STRING, + }, + description: { + type: DataTypes.STRING, + }, + paranetId: { + allowNull: false, + type: DataTypes.STRING, + }, + kaCount: { + allowNull: false, + type: DataTypes.INTEGER, + }, + blockchainId: { + allowNull: false, + type: DataTypes.STRING, + }, + createdAt: { + allowNull: false, + type: DataTypes.DATE, + }, + updatedAt: { + allowNull: false, + type: DataTypes.DATE, + }, }, + { underscored: true }, ); - return Paranet; + paranet.associate = () => { + // associations can be defined here + }; + return paranet; }; diff --git a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js index f27201f676..9d9aee1dcc 100644 --- a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js @@ -4,28 +4,51 @@ class ParanetRepository { this.model = models.paranet; } - async getOrCreateParanet(paranetId) { - return this.model.findOrCreate({ - where: { + async createParanetRecord(name, description, paranetId, blockchainId) { + return this.model.create( + { + name, + description, paranetId, + kaCount: 0, + blockchainId, + }, + { + ignoreDuplicates: true, }, - defaults: { + ); + } + + async getParanet(paranetId, blockchainId) { + return this.model.findOne({ + where: { paranetId, - kaCount: 0, + blockchainId, }, }); } - async updateParanetKaCount(paranetId, kaCount) { + async updateParanetKaCount(paranetId, blockchain, kaCount) { await this.model.update( { kaCount }, { where: { paranetId, + blockchain, }, }, ); } + + async paranetExists(paranetId, blockchainId) { + const paranetRecord = await this.model.findOne({ + where: { + paranetId, + blockchainId, + }, + }); + return !!paranetRecord; + } } export default ParanetRepository; diff --git a/src/modules/repository/repository-module-manager.js b/src/modules/repository/repository-module-manager.js index 2bb9deafad..9207400e46 100644 --- a/src/modules/repository/repository-module-manager.js +++ b/src/modules/repository/repository-module-manager.js @@ -472,6 +472,23 @@ class RepositoryModuleManager extends BaseModuleManager { blockchainId, ); } + + async createParanetRecord(name, description, paranetId, blockchainId) { + this.getRepository('paranet').createParanetRecord( + name, + description, + paranetId, + blockchainId, + ); + } + + async paranetExists(paranetId, blockchainId) { + return this.getRepository('paranet').paranetExists(paranetId, blockchainId); + } + + async getParanet(paranetId, blockchainId) { + return this.getRepository('paranet').getParanet(paranetId, blockchainId); + } } export default RepositoryModuleManager; diff --git a/src/service/paranet-service.js b/src/service/paranet-service.js new file mode 100644 index 0000000000..5bc05adcf4 --- /dev/null +++ b/src/service/paranet-service.js @@ -0,0 +1,46 @@ +class ParanetService { + constructor(ctx) { + this.blockchainModuleManager = ctx.blockchainModuleManager; + this.repositoryModuleManager = ctx.repositoryModuleManager; + this.this.ualService = ctx.ualService; + } + + async initializeParanetRecord(blockchain, paranetId) { + const paranetMetadata = await this.blockchainModuleManager.getParanetMetadata( + blockchain, + paranetId, + ); + if (await this.repositoryModuleManager.paranetExists(paranetId, blockchain)) + await this.repositoryModuleManager.createParanetRecord( + paranetMetadata.name, + paranetMetadata.description, + paranetId, + blockchain, + ); + // TODO: Write proper Error msg + throw new Error( + `Unable to get Paranet repository name. Paranet id doesn't have correct format: ${paranetId}`, + ); + } + + constructParanetId(blockchain, contract, tokenId) { + const keyword = this.blockchainModuleManager.encodePacked( + blockchain, + ['address', 'uint256'], + [contract, tokenId], + ); + + return this.blockchainModuleManager.keccak256(blockchain, keyword); + } + + getParanetRepositoryName(paranetId) { + if (this.ualService.isUAL(paranetId)) { + return paranetId.replace('/', '-'); + } + throw new Error( + `Unable to get Paranet repository name. Paranet id doesn't have correct format: ${paranetId}`, + ); + } +} + +export default ParanetService; From 2a85feb2c4a0b12391b9e2b329875cb2c4890a5d Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Mon, 20 May 2024 14:08:56 +0800 Subject: [PATCH 44/82] Add sync on update --- .../blockchain/blockchain-module-manager.js | 4 ++ .../blockchain/implementation/web3-service.js | 8 ++- .../blockchain-event-listener-service.js | 50 ++++++++++++++++++- src/service/triple-store-service.js | 30 +++++++++++ 4 files changed, 90 insertions(+), 2 deletions(-) diff --git a/src/modules/blockchain/blockchain-module-manager.js b/src/modules/blockchain/blockchain-module-manager.js index 60c5ac1c6b..b7d574a82a 100644 --- a/src/modules/blockchain/blockchain-module-manager.js +++ b/src/modules/blockchain/blockchain-module-manager.js @@ -482,6 +482,10 @@ class BlockchainModuleManager extends BaseModuleManager { async paranetExists(blockchain, paranetId) { return this.callImplementationFunction(blockchain, 'paranetExists', [paranetId]); } + + async getParanetId(blockchain, knowledgeAssetId) { + return this.callImplementationFunction(blockchain, 'getParanetId', [knowledgeAssetId]); + } } export default BlockchainModuleManager; diff --git a/src/modules/blockchain/implementation/web3-service.js b/src/modules/blockchain/implementation/web3-service.js index a8b3b88f35..f5c683976e 100644 --- a/src/modules/blockchain/implementation/web3-service.js +++ b/src/modules/blockchain/implementation/web3-service.js @@ -1631,7 +1631,13 @@ class Web3Service { } async paranetExists(paranetId) { - return this.allContractFunction(this.ParanetsRegistry, 'paranetExists', [paranetId]); + return this.callContractFunction(this.ParanetsRegistry, 'paranetExists', [paranetId]); + } + + async getParanetId(knowledgeAssetId) { + return this.callContractFunction(this.ParanetKnowledgeAssetsRegistry, 'paranetExists', [ + knowledgeAssetId, + ]); } } diff --git a/src/service/blockchain-event-listener-service.js b/src/service/blockchain-event-listener-service.js index 62c230bd5d..ba800a74a1 100644 --- a/src/service/blockchain-event-listener-service.js +++ b/src/service/blockchain-event-listener-service.js @@ -547,7 +547,6 @@ class BlockchainEventListenerService { tokenId, )} with keyword: ${keyword}, assertion id: ${state}.`, ); - // eslint-disable-next-line no-await-in-loop await Promise.all([ this.pendingStorageService.moveAndDeletePendingState( @@ -575,6 +574,55 @@ class BlockchainEventListenerService { stateIndex, ), ]); + const knowledgeAssetId = this.blockchainModuleManager.encodePacked( + blockchain, + ['address', 'bytes32'], + [contract, tokenId], + ); + + // eslint-disable-next-line no-await-in-loop + const paranetId = await this.blockchainModuleManager.getParanetId( + blockchain, + knowledgeAssetId, + ); + // Chack if this asset is in paranet we are syncing + // eslint-disable-next-line no-await-in-loop + const paranetAssetExists = await this.tripleStoreService.paranetAssetExists( + paranetId, + blockchain, + contract, + tokenId, + ); + if (paranetAssetExists) { + const paranetRepositoryName = + this.paranetIdService.getParanetRepositoryName(paranetId); + // eslint-disable-next-line no-await-in-loop + const assertionIds = await this.blockchainModuleManager.getAssertionIds( + blockchain, + contract, + tokenId, + ); + // Delete old asset from paranet repository + // Missing assertionId for old asset, how to get + // Penultimat assertion id is one before update that needs to be delted + // eslint-disable-next-line no-await-in-loop + await this.tripleStoreService.deleteAssertion( + paranetRepositoryName, + assertionIds[assertionIds.length - 2], + ); + + // Insert in paranet registry + // eslint-disable-next-line no-await-in-loop + await this.tripleStoreService.moveAssetWithoutDelete( + TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, + paranetRepositoryName, + state, + blockchain, + contract, + tokenId, + keyword, + ); + } } } } diff --git a/src/service/triple-store-service.js b/src/service/triple-store-service.js index 5b6049c544..90dbed6bf5 100644 --- a/src/service/triple-store-service.js +++ b/src/service/triple-store-service.js @@ -121,6 +121,36 @@ class TripleStoreService { } } + async moveAssetWithoutDelete( + fromRepository, + toRepository, + assertionId, + blockchain, + contract, + tokenId, + keyword, + ) { + let assertion; + // Try-catch to prevent infinite processing loop when unexpected error is thrown while getting KA + try { + assertion = await this.getAssertion(fromRepository, assertionId); + } catch (e) { + this.logger.error(`Error while getting assertion for moving asset: ${e.message}`); + return; + } + + // copy metadata and assertion + await this.localStoreAsset( + toRepository, + assertionId, + assertion, + blockchain, + contract, + tokenId, + keyword, + ); + } + async insertAssetAssertionMetadata( repository, blockchain, From 0698c8f249b69f0a2a8987f77892d4399da8c441 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Thu, 23 May 2024 11:21:13 +0200 Subject: [PATCH 45/82] Update SQL migration for paranet table creation --- .../20240429083058-create-paranet.js | 108 ++++++------------ 1 file changed, 38 insertions(+), 70 deletions(-) diff --git a/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js b/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js index 2e15bfde93..4d4c42840d 100644 --- a/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js +++ b/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js @@ -1,72 +1,40 @@ -/** @type {import('sequelize-cli').Migration} */ -module.exports = { - async up(queryInterface, Sequelize) { - await queryInterface.createTable( - 'Paranet', - { - id: { - allowNull: false, - autoIncrement: true, - primaryKey: true, - type: Sequelize.INTEGER, - }, - name: { - type: Sequelize.STRING, - }, - blockchain_id: { - type: Sequelize.STRING, - primaryKey: true, - }, - description: { - type: Sequelize.STRING, - }, - paranet_id: { - type: Sequelize.STRING, - }, - ka_count: { - type: Sequelize.INTEGER, - }, - created_at: { - allowNull: false, - type: Sequelize.DATE, - }, - updated_at: { - allowNull: false, - type: Sequelize.DATE, - }, - }, - { - indexes: [ - { - // Composite index for optimal filtering on paranet_id and blockchain_id - name: 'idx_paranet_id_blockchain_id', - using: 'BTREE', // This is generally the default, but is specified here for clarity - fields: ['paranet_id', 'blockchain_id'], - }, - { - name: 'idx_name', - using: 'BTREE', // This is generally the default, but is specified here for clarity - fields: ['name'], - }, - ], - }, - ); - - await queryInterface.sequelize.query(` - CREATE TRIGGER before_insert_paranet - BEFORE INSERT ON paranet - FOR EACH ROW - SET NEW.created_at = NOW(); - `); +export const up = async ({ context: { queryInterface, Sequelize } }) => { + await queryInterface.createTable('Paranet', { + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER, + }, + name: { + type: Sequelize.STRING, + }, + blockchain_id: { + type: Sequelize.STRING, + primaryKey: true, + }, + description: { + type: Sequelize.STRING, + }, + paranet_id: { + type: Sequelize.STRING, + }, + ka_count: { + type: Sequelize.INTEGER, + }, + created_at: { + allowNull: false, + type: Sequelize.DATE, + defaultValue: Sequelize.literal('NOW()'), + }, + updated_at: { + allowNull: false, + type: Sequelize.DATE, + defaultValue: Sequelize.literal('NOW()'), + }, + }); +}; - await queryInterface.sequelize.query(` - CREATE TRIGGER before_update_paranet - BEFORE UPDATE ON paranet - FOR EACH ROW - SET NEW.updated_at = NOW(); - `); - }, - async down(queryInterface) { - await queryInterface.dropTable('Paranet'); - }, +export const down = async ({ context: { queryInterface } }) => { + await queryInterface.dropTable('Paranet'); }; From 0a7a2f4ca449800cbaded16b0bb84b92dd1a575f Mon Sep 17 00:00:00 2001 From: NZT48 Date: Thu, 23 May 2024 11:22:32 +0200 Subject: [PATCH 46/82] Temp commit to add dependecy on gh branc for dkg-evm-modul --- package-lock.json | 2699 ++------------------------------------------- package.json | 2 +- 2 files changed, 95 insertions(+), 2606 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3a18c9d491..f6376923b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "axios": "^1.6.0", "cors": "^2.8.5", "deep-extend": "^0.6.0", - "dkg-evm-module": "^4.2.3", + "dkg-evm-module": "github:OriginTrail/dkg-evm-module#feature/paranets", "dotenv": "^16.0.1", "ethers": "^5.7.2", "express": "^4.18.1", @@ -2597,6 +2597,8 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "optional": true, + "peer": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -2608,6 +2610,8 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "optional": true, + "peer": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -3946,6 +3950,7 @@ }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.1", + "devOptional": true, "license": "MIT", "engines": { "node": ">=6.0.0" @@ -3961,6 +3966,7 @@ }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.15", + "devOptional": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { @@ -5645,22 +5651,30 @@ "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "optional": true, + "peer": true }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "optional": true, + "peer": true }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "optional": true, + "peer": true }, "node_modules/@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "optional": true, + "peer": true }, "node_modules/@types/argparse": { "version": "1.0.38", @@ -6124,7 +6138,9 @@ "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "optional": true, + "peer": true }, "node_modules/argparse": { "version": "2.0.1", @@ -7567,7 +7583,9 @@ "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "optional": true, + "peer": true }, "node_modules/cross-fetch": { "version": "4.0.0", @@ -8569,1473 +8587,23 @@ }, "node_modules/diff": { "version": "4.0.2", + "devOptional": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, "node_modules/dkg-evm-module": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/dkg-evm-module/-/dkg-evm-module-4.2.3.tgz", - "integrity": "sha512-2BlIDHHle+Z0CuVinoejzVOAp+CO6gGENYDxRDiRfMEuexmPokqm3YJQPfqCmmmPZG6GO7mryJl7HLF6qNgt8w==", + "version": "4.3.0", + "resolved": "git+ssh://git@github.com/OriginTrail/dkg-evm-module.git#030a97416dd66e05a7a43145c05e7b9f43fac2a5", + "license": "Apache-2.0", "dependencies": { "@openzeppelin/contracts": "^4.9.3", - "@polkadot/api": "^10.1.4", - "@polkadot/keyring": "^11.1.1", - "@polkadot/util": "^11.1.1", - "@polkadot/util-crypto": "^11.1.1", "@prb/math": "^2.5.0", "dotenv": "^16.0.3", "hardhat": "^2.19.1", "hardhat-deploy": "^0.11.25", - "hardhat-deploy-ethers": "^0.3.0-beta.13", - "ts-node": "^10.9.1", - "typescript": "^4.9.4" - } - }, - "node_modules/dkg-evm-module/node_modules/@noble/hashes": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", - "integrity": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-10.11.2.tgz", - "integrity": "sha512-AorCZxCWCoTtdbl4DPUZh+ACe/pbLIS1BkdQY0AFJuZllm0x/yWzjgampcPd5jQAA/O3iKShRBkZqj6Mk9yG/A==", - "dependencies": { - "@polkadot/api-augment": "10.11.2", - "@polkadot/api-base": "10.11.2", - "@polkadot/api-derive": "10.11.2", - "@polkadot/keyring": "^12.6.2", - "@polkadot/rpc-augment": "10.11.2", - "@polkadot/rpc-core": "10.11.2", - "@polkadot/rpc-provider": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-augment": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/types-create": "10.11.2", - "@polkadot/types-known": "10.11.2", - "@polkadot/util": "^12.6.2", - "@polkadot/util-crypto": "^12.6.2", - "eventemitter3": "^5.0.1", - "rxjs": "^7.8.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-augment": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-10.11.2.tgz", - "integrity": "sha512-PTpnqpezc75qBqUtgrc0GYB8h9UHjfbHSRZamAbecIVAJ2/zc6CqtnldeaBlIu1IKTgBzi3FFtTyYu+ZGbNT2Q==", - "dependencies": { - "@polkadot/api-base": "10.11.2", - "@polkadot/rpc-augment": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-augment": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-augment/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-augment/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-augment/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-base": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/api-base/-/api-base-10.11.2.tgz", - "integrity": "sha512-4LIjaUfO9nOzilxo7XqzYKCNMtmUypdk8oHPdrRnSjKEsnK7vDsNi+979z2KXNXd2KFSCFHENmI523fYnMnReg==", - "dependencies": { - "@polkadot/rpc-core": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/util": "^12.6.2", - "rxjs": "^7.8.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-base/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-base/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-base/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-derive": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-10.11.2.tgz", - "integrity": "sha512-m3BQbPionkd1iSlknddxnL2hDtolPIsT+aRyrtn4zgMRPoLjHFmTmovvg8RaUyYofJtZeYrnjMw0mdxiSXx7eA==", - "dependencies": { - "@polkadot/api": "10.11.2", - "@polkadot/api-augment": "10.11.2", - "@polkadot/api-base": "10.11.2", - "@polkadot/rpc-core": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/util": "^12.6.2", - "@polkadot/util-crypto": "^12.6.2", - "rxjs": "^7.8.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-derive/node_modules/@noble/hashes": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", - "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-derive/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-derive/node_modules/@polkadot/util-crypto": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.2.tgz", - "integrity": "sha512-FEWI/dJ7wDMNN1WOzZAjQoIcCP/3vz3wvAp5QQm+lOrzOLj0iDmaIGIcBkz8HVm3ErfSe/uKP0KS4jgV/ib+Mg==", - "dependencies": { - "@noble/curves": "^1.3.0", - "@noble/hashes": "^1.3.3", - "@polkadot/networks": "12.6.2", - "@polkadot/util": "12.6.2", - "@polkadot/wasm-crypto": "^7.3.2", - "@polkadot/wasm-util": "^7.3.2", - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-randomvalues": "12.6.2", - "@scure/base": "^1.1.5", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-derive/node_modules/@polkadot/x-randomvalues": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.2.tgz", - "integrity": "sha512-Vr8uG7rH2IcNJwtyf5ebdODMcr0XjoCpUbI91Zv6AlKVYOGKZlKLYJHIwpTaKKB+7KPWyQrk4Mlym/rS7v9feg==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2", - "@polkadot/wasm-util": "*" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-derive/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-derive/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api-derive/node_modules/@scure/base": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", - "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api/node_modules/@noble/hashes": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", - "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api/node_modules/@polkadot/keyring": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.6.2.tgz", - "integrity": "sha512-O3Q7GVmRYm8q7HuB3S0+Yf/q/EB2egKRRU3fv9b3B7V+A52tKzA+vIwEmNVaD1g5FKW9oB97rmpggs0zaKFqHw==", - "dependencies": { - "@polkadot/util": "12.6.2", - "@polkadot/util-crypto": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2", - "@polkadot/util-crypto": "12.6.2" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api/node_modules/@polkadot/util-crypto": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.2.tgz", - "integrity": "sha512-FEWI/dJ7wDMNN1WOzZAjQoIcCP/3vz3wvAp5QQm+lOrzOLj0iDmaIGIcBkz8HVm3ErfSe/uKP0KS4jgV/ib+Mg==", - "dependencies": { - "@noble/curves": "^1.3.0", - "@noble/hashes": "^1.3.3", - "@polkadot/networks": "12.6.2", - "@polkadot/util": "12.6.2", - "@polkadot/wasm-crypto": "^7.3.2", - "@polkadot/wasm-util": "^7.3.2", - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-randomvalues": "12.6.2", - "@scure/base": "^1.1.5", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api/node_modules/@polkadot/x-randomvalues": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.2.tgz", - "integrity": "sha512-Vr8uG7rH2IcNJwtyf5ebdODMcr0XjoCpUbI91Zv6AlKVYOGKZlKLYJHIwpTaKKB+7KPWyQrk4Mlym/rS7v9feg==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2", - "@polkadot/wasm-util": "*" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/api/node_modules/@scure/base": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", - "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/keyring": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-11.1.3.tgz", - "integrity": "sha512-bzGz1cWDYK7MWhp0630W6KOwTC/wsvKKHBvWxReMT7iQwFHeLn5AemUOveqIPxF+esd/UfdN5aFDHApjYcyZsg==", - "dependencies": { - "@polkadot/util": "11.1.3", - "@polkadot/util-crypto": "11.1.3", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@polkadot/util": "11.1.3", - "@polkadot/util-crypto": "11.1.3" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/networks": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-12.6.2.tgz", - "integrity": "sha512-1oWtZm1IvPWqvMrldVH6NI2gBoCndl5GEwx7lAuQWGr7eNL+6Bdc5K3Z9T0MzFvDGoi2/CBqjX9dRKo39pDC/w==", - "dependencies": { - "@polkadot/util": "12.6.2", - "@substrate/ss58-registry": "^1.44.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/networks/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/networks/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/networks/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-augment": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-10.11.2.tgz", - "integrity": "sha512-9AhT0WW81/8jYbRcAC6PRmuxXqNhJje8OYiulBQHbG1DTCcjAfz+6VQBke9BwTStzPq7d526+yyBKD17O3zlAA==", - "dependencies": { - "@polkadot/rpc-core": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-augment/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-augment/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-augment/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-core": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-10.11.2.tgz", - "integrity": "sha512-Ot0CFLWx8sZhLZog20WDuniPA01Bk2StNDsdAQgcFKPwZw6ShPaZQCHuKLQK6I6DodOrem9FXX7c1hvoKJP5Ww==", - "dependencies": { - "@polkadot/rpc-augment": "10.11.2", - "@polkadot/rpc-provider": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/util": "^12.6.2", - "rxjs": "^7.8.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-core/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-core/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-core/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-provider": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-10.11.2.tgz", - "integrity": "sha512-he5jWMpDJp7e+vUzTZDzpkB7ps3H8psRally+/ZvZZScPvFEjfczT7I1WWY9h58s8+ImeVP/lkXjL9h/gUOt3Q==", - "dependencies": { - "@polkadot/keyring": "^12.6.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-support": "10.11.2", - "@polkadot/util": "^12.6.2", - "@polkadot/util-crypto": "^12.6.2", - "@polkadot/x-fetch": "^12.6.2", - "@polkadot/x-global": "^12.6.2", - "@polkadot/x-ws": "^12.6.2", - "eventemitter3": "^5.0.1", - "mock-socket": "^9.3.1", - "nock": "^13.4.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@substrate/connect": "0.7.35" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-provider/node_modules/@noble/hashes": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", - "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-provider/node_modules/@polkadot/keyring": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.6.2.tgz", - "integrity": "sha512-O3Q7GVmRYm8q7HuB3S0+Yf/q/EB2egKRRU3fv9b3B7V+A52tKzA+vIwEmNVaD1g5FKW9oB97rmpggs0zaKFqHw==", - "dependencies": { - "@polkadot/util": "12.6.2", - "@polkadot/util-crypto": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2", - "@polkadot/util-crypto": "12.6.2" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-provider/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-provider/node_modules/@polkadot/util-crypto": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.2.tgz", - "integrity": "sha512-FEWI/dJ7wDMNN1WOzZAjQoIcCP/3vz3wvAp5QQm+lOrzOLj0iDmaIGIcBkz8HVm3ErfSe/uKP0KS4jgV/ib+Mg==", - "dependencies": { - "@noble/curves": "^1.3.0", - "@noble/hashes": "^1.3.3", - "@polkadot/networks": "12.6.2", - "@polkadot/util": "12.6.2", - "@polkadot/wasm-crypto": "^7.3.2", - "@polkadot/wasm-util": "^7.3.2", - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-randomvalues": "12.6.2", - "@scure/base": "^1.1.5", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-provider/node_modules/@polkadot/x-randomvalues": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.2.tgz", - "integrity": "sha512-Vr8uG7rH2IcNJwtyf5ebdODMcr0XjoCpUbI91Zv6AlKVYOGKZlKLYJHIwpTaKKB+7KPWyQrk4Mlym/rS7v9feg==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2", - "@polkadot/wasm-util": "*" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-provider/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-provider/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/rpc-provider/node_modules/@scure/base": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", - "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-10.11.2.tgz", - "integrity": "sha512-d52j3xXni+C8GdYZVTSfu8ROAnzXFMlyRvXtor0PudUc8UQHOaC4+mYAkTBGA2gKdmL8MHSfRSbhcxHhsikY6Q==", - "dependencies": { - "@polkadot/keyring": "^12.6.2", - "@polkadot/types-augment": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/types-create": "10.11.2", - "@polkadot/util": "^12.6.2", - "@polkadot/util-crypto": "^12.6.2", - "rxjs": "^7.8.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-augment": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-10.11.2.tgz", - "integrity": "sha512-8eB8ew04wZiE5GnmFvEFW1euJWmF62SGxb1O+8wL3zoUtB9Xgo1vB6w6xbTrd+HLV6jNSeXXnbbF1BEUvi9cNg==", - "dependencies": { - "@polkadot/types": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-augment/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-augment/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-augment/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-codec": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-10.11.2.tgz", - "integrity": "sha512-3xjOQL+LOOMzYqlgP9ROL0FQnzU8lGflgYewzau7AsDlFziSEtb49a9BpYo6zil4koC+QB8zQ9OHGFumG08T8w==", - "dependencies": { - "@polkadot/util": "^12.6.2", - "@polkadot/x-bigint": "^12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-codec/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-codec/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-codec/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-create": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-create/-/types-create-10.11.2.tgz", - "integrity": "sha512-SJt23NxYvefRxVZZm6mT9ed1pR6FDoIGQ3xUpbjhTLfU2wuhpKjekMVorYQ6z/gK2JLMu2kV92Ardsz+6GX5XQ==", - "dependencies": { - "@polkadot/types-codec": "10.11.2", - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-create/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-create/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-create/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-known": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-10.11.2.tgz", - "integrity": "sha512-kbEIX7NUQFxpDB0FFGNyXX/odY7jbp56RGD+Z4A731fW2xh/DgAQrI994xTzuh0c0EqPE26oQm3kATSpseqo9w==", - "dependencies": { - "@polkadot/networks": "^12.6.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/types-create": "10.11.2", - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-known/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-known/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-known/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-support": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-support/-/types-support-10.11.2.tgz", - "integrity": "sha512-X11hoykFYv/3efg4coZy2hUOUc97JhjQMJLzDhHniFwGLlYU8MeLnPdCVGkXx0xDDjTo4/ptS1XpZ5HYcg+gRw==", - "dependencies": { - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-support/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-support/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types-support/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types/node_modules/@noble/hashes": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", - "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types/node_modules/@polkadot/keyring": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.6.2.tgz", - "integrity": "sha512-O3Q7GVmRYm8q7HuB3S0+Yf/q/EB2egKRRU3fv9b3B7V+A52tKzA+vIwEmNVaD1g5FKW9oB97rmpggs0zaKFqHw==", - "dependencies": { - "@polkadot/util": "12.6.2", - "@polkadot/util-crypto": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2", - "@polkadot/util-crypto": "12.6.2" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types/node_modules/@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "dependencies": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types/node_modules/@polkadot/util-crypto": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.2.tgz", - "integrity": "sha512-FEWI/dJ7wDMNN1WOzZAjQoIcCP/3vz3wvAp5QQm+lOrzOLj0iDmaIGIcBkz8HVm3ErfSe/uKP0KS4jgV/ib+Mg==", - "dependencies": { - "@noble/curves": "^1.3.0", - "@noble/hashes": "^1.3.3", - "@polkadot/networks": "12.6.2", - "@polkadot/util": "12.6.2", - "@polkadot/wasm-crypto": "^7.3.2", - "@polkadot/wasm-util": "^7.3.2", - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-randomvalues": "12.6.2", - "@scure/base": "^1.1.5", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types/node_modules/@polkadot/x-randomvalues": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.2.tgz", - "integrity": "sha512-Vr8uG7rH2IcNJwtyf5ebdODMcr0XjoCpUbI91Zv6AlKVYOGKZlKLYJHIwpTaKKB+7KPWyQrk4Mlym/rS7v9feg==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "12.6.2", - "@polkadot/wasm-util": "*" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types/node_modules/@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types/node_modules/@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/types/node_modules/@scure/base": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", - "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==", - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/util": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-11.1.3.tgz", - "integrity": "sha512-Gsqzv1/fSoypS5tnJkM+NJQeT7O4iYlSniubUJnaZVOKsIbueTS1bMQ1y3/h8ISxbKBtICW5cZ6zCej6Q/jC3w==", - "dependencies": { - "@polkadot/x-bigint": "11.1.3", - "@polkadot/x-global": "11.1.3", - "@polkadot/x-textdecoder": "11.1.3", - "@polkadot/x-textencoder": "11.1.3", - "@types/bn.js": "^5.1.1", - "bn.js": "^5.2.1", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/util-crypto": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-11.1.3.tgz", - "integrity": "sha512-hjH1y6jXQuceJ2NWx7+ei0sR4A7t844XwlNquPxZX3kQbQS+1t6tO4Eo3/95JhPsEaJOXduus02cYEF6gteEYQ==", - "dependencies": { - "@noble/hashes": "1.3.0", - "@noble/secp256k1": "1.7.1", - "@polkadot/networks": "11.1.3", - "@polkadot/util": "11.1.3", - "@polkadot/wasm-crypto": "^7.0.3", - "@polkadot/x-bigint": "11.1.3", - "@polkadot/x-randomvalues": "11.1.3", - "@scure/base": "1.1.1", - "tslib": "^2.5.0", - "tweetnacl": "^1.0.3" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "@polkadot/util": "11.1.3" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/util-crypto/node_modules/@polkadot/networks": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-11.1.3.tgz", - "integrity": "sha512-goLpX9SswAGGeh1jXB79wHEfWOF5rLIItMHYalujBmhQVxyAqbxP2tzQqPQXDLcnkWbgwkyYGLXaDD72GBqHZw==", - "dependencies": { - "@polkadot/util": "11.1.3", - "@substrate/ss58-registry": "^1.39.0", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/util-crypto/node_modules/@polkadot/x-bigint": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-11.1.3.tgz", - "integrity": "sha512-fRUUHfW9VFsXT7sLUUY7gSu8v+PvzNLRwvjnp+Ly8vFx9LTLuVGFCi+mpysuRTaPpqZZJlzBJ3fST7xTGh67Pg==", - "dependencies": { - "@polkadot/x-global": "11.1.3", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/util-crypto/node_modules/@polkadot/x-global": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-11.1.3.tgz", - "integrity": "sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg==", - "dependencies": { - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/util/node_modules/@polkadot/x-bigint": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-11.1.3.tgz", - "integrity": "sha512-fRUUHfW9VFsXT7sLUUY7gSu8v+PvzNLRwvjnp+Ly8vFx9LTLuVGFCi+mpysuRTaPpqZZJlzBJ3fST7xTGh67Pg==", - "dependencies": { - "@polkadot/x-global": "11.1.3", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/util/node_modules/@polkadot/x-global": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-11.1.3.tgz", - "integrity": "sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg==", - "dependencies": { - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/wasm-bridge": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-bridge/-/wasm-bridge-7.3.2.tgz", - "integrity": "sha512-AJEXChcf/nKXd5Q/YLEV5dXQMle3UNT7jcXYmIffZAo/KI394a+/24PaISyQjoNC0fkzS1Q8T5pnGGHmXiVz2g==", - "dependencies": { - "@polkadot/wasm-util": "7.3.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "*", - "@polkadot/x-randomvalues": "*" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/wasm-crypto": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-7.3.2.tgz", - "integrity": "sha512-+neIDLSJ6jjVXsjyZ5oLSv16oIpwp+PxFqTUaZdZDoA2EyFRQB8pP7+qLsMNk+WJuhuJ4qXil/7XiOnZYZ+wxw==", - "dependencies": { - "@polkadot/wasm-bridge": "7.3.2", - "@polkadot/wasm-crypto-asmjs": "7.3.2", - "@polkadot/wasm-crypto-init": "7.3.2", - "@polkadot/wasm-crypto-wasm": "7.3.2", - "@polkadot/wasm-util": "7.3.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "*", - "@polkadot/x-randomvalues": "*" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/wasm-crypto-asmjs": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.3.2.tgz", - "integrity": "sha512-QP5eiUqUFur/2UoF2KKKYJcesc71fXhQFLT3D4ZjG28Mfk2ZPI0QNRUfpcxVQmIUpV5USHg4geCBNuCYsMm20Q==", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "*" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/wasm-crypto-init": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.3.2.tgz", - "integrity": "sha512-FPq73zGmvZtnuJaFV44brze3Lkrki3b4PebxCy9Fplw8nTmisKo9Xxtfew08r0njyYh+uiJRAxPCXadkC9sc8g==", - "dependencies": { - "@polkadot/wasm-bridge": "7.3.2", - "@polkadot/wasm-crypto-asmjs": "7.3.2", - "@polkadot/wasm-crypto-wasm": "7.3.2", - "@polkadot/wasm-util": "7.3.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "*", - "@polkadot/x-randomvalues": "*" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/wasm-crypto-wasm": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.3.2.tgz", - "integrity": "sha512-15wd0EMv9IXs5Abp1ZKpKKAVyZPhATIAHfKsyoWCEFDLSOA0/K0QGOxzrAlsrdUkiKZOq7uzSIgIDgW8okx2Mw==", - "dependencies": { - "@polkadot/wasm-util": "7.3.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "*" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/wasm-util": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-util/-/wasm-util-7.3.2.tgz", - "integrity": "sha512-bmD+Dxo1lTZyZNxbyPE380wd82QsX+43mgCm40boyKrRppXEyQmWT98v/Poc7chLuskYb6X8IQ6lvvK2bGR4Tg==", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@polkadot/util": "*" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/x-bigint": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-12.6.2.tgz", - "integrity": "sha512-HSIk60uFPX4GOFZSnIF7VYJz7WZA7tpFJsne7SzxOooRwMTWEtw3fUpFy5cYYOeLh17/kHH1Y7SVcuxzVLc74Q==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/x-fetch": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-12.6.2.tgz", - "integrity": "sha512-8wM/Z9JJPWN1pzSpU7XxTI1ldj/AfC8hKioBlUahZ8gUiJaOF7K9XEFCrCDLis/A1BoOu7Ne6WMx/vsJJIbDWw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "node-fetch": "^3.3.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/x-global": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-12.6.2.tgz", - "integrity": "sha512-a8d6m+PW98jmsYDtAWp88qS4dl8DyqUBsd0S+WgyfSMtpEXu6v9nXDgPZgwF5xdDvXhm+P0ZfVkVTnIGrScb5g==", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/x-randomvalues": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-11.1.3.tgz", - "integrity": "sha512-kZjbRgxokMR9UTodZQKs6s3C/Q2YgeizcxpDCghM/VdvQUE8OVBGNzduF7SvBvQyg2Qbg8jMcSxXOY7UgcOWSg==", - "dependencies": { - "@polkadot/x-global": "11.1.3", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/x-randomvalues/node_modules/@polkadot/x-global": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-11.1.3.tgz", - "integrity": "sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg==", - "dependencies": { - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/x-textdecoder": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-11.1.3.tgz", - "integrity": "sha512-NhOjuXVfYRMw9l0VhCtZOtcWefZth58p5KpVOrFyJZd12fTsoMO5/746K7QoAjWRrLQTJ/LHCEKCtWww0LwVPw==", - "dependencies": { - "@polkadot/x-global": "11.1.3", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/x-textdecoder/node_modules/@polkadot/x-global": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-11.1.3.tgz", - "integrity": "sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg==", - "dependencies": { - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/x-textencoder": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-11.1.3.tgz", - "integrity": "sha512-7DmqjlPN8aQexLUKwoHeadihpUnW8hjpXEru+aEDxjgq9XIxPvb++NeBK+Mra9RzzZRuiT/K5z16HlwKN//ewg==", - "dependencies": { - "@polkadot/x-global": "11.1.3", - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/x-textencoder/node_modules/@polkadot/x-global": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-11.1.3.tgz", - "integrity": "sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg==", - "dependencies": { - "tslib": "^2.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/dkg-evm-module/node_modules/@polkadot/x-ws": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-12.6.2.tgz", - "integrity": "sha512-cGZWo7K5eRRQCRl2LrcyCYsrc3lRbTlixZh3AzgU8uX4wASVGRlNWi/Hf4TtHNe1ExCDmxabJzdIsABIfrr7xw==", - "dependencies": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2", - "ws": "^8.15.1" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/dkg-evm-module/node_modules/@substrate/connect": { - "version": "0.7.35", - "resolved": "https://registry.npmjs.org/@substrate/connect/-/connect-0.7.35.tgz", - "integrity": "sha512-Io8vkalbwaye+7yXfG1Nj52tOOoJln2bMlc7Q9Yy3vEWqZEVkgKmcPVzbwV0CWL3QD+KMPDA2Dnw/X7EdwgoLw==", - "hasInstallScript": true, - "optional": true, - "dependencies": { - "@substrate/connect-extension-protocol": "^1.0.1", - "smoldot": "2.0.7" + "hardhat-deploy-ethers": "^0.3.0-beta.13" } }, "node_modules/dkg.js": { @@ -15476,7 +14044,9 @@ "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "optional": true, + "peer": true }, "node_modules/match-all": { "version": "1.2.6", @@ -18902,15 +17472,6 @@ "node": ">=8.0.0" } }, - "node_modules/smoldot": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/smoldot/-/smoldot-2.0.7.tgz", - "integrity": "sha512-VAOBqEen6vises36/zgrmAT1GWk2qE3X8AGnO7lmQFdskbKx8EovnwS22rtPAG+Y1Rk23/S22kDJUdPANyPkBA==", - "optional": true, - "dependencies": { - "ws": "^8.8.1" - } - }, "node_modules/solc": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz", @@ -19773,6 +18334,8 @@ "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "optional": true, + "peer": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -19815,6 +18378,8 @@ "version": "8.3.2", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "optional": true, + "peer": true, "engines": { "node": ">=0.4.0" } @@ -20004,6 +18569,8 @@ "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "optional": true, + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -20302,7 +18869,9 @@ "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "optional": true, + "peer": true }, "node_modules/validate-iri": { "version": "1.0.1", @@ -21084,6 +19653,7 @@ "node_modules/ws": { "version": "8.16.0", "license": "MIT", + "optional": true, "engines": { "node": ">=10.0.0" }, @@ -21292,6 +19862,8 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "optional": true, + "peer": true, "engines": { "node": ">=6" } @@ -23491,6 +22063,8 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "optional": true, + "peer": true, "requires": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -23499,6 +22073,8 @@ "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "optional": true, + "peer": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -24299,14 +22875,16 @@ } }, "@jridgewell/resolve-uri": { - "version": "3.1.1" + "version": "3.1.1", + "devOptional": true }, "@jridgewell/set-array": { "version": "1.1.2", "dev": true }, "@jridgewell/sourcemap-codec": { - "version": "1.4.15" + "version": "1.4.15", + "devOptional": true }, "@jridgewell/trace-mapping": { "version": "0.3.22", @@ -25575,22 +24153,30 @@ "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "optional": true, + "peer": true }, "@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "optional": true, + "peer": true }, "@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "optional": true, + "peer": true }, "@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "optional": true, + "peer": true }, "@types/argparse": { "version": "1.0.38" @@ -25931,7 +24517,9 @@ "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "optional": true, + "peer": true }, "argparse": { "version": "2.0.1" @@ -26898,7 +25486,9 @@ "create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "optional": true, + "peer": true }, "cross-fetch": { "version": "4.0.0", @@ -27586,1124 +26176,19 @@ "dev": true }, "diff": { - "version": "4.0.2" + "version": "4.0.2", + "devOptional": true }, "dkg-evm-module": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/dkg-evm-module/-/dkg-evm-module-4.2.3.tgz", - "integrity": "sha512-2BlIDHHle+Z0CuVinoejzVOAp+CO6gGENYDxRDiRfMEuexmPokqm3YJQPfqCmmmPZG6GO7mryJl7HLF6qNgt8w==", + "version": "git+ssh://git@github.com/OriginTrail/dkg-evm-module.git#030a97416dd66e05a7a43145c05e7b9f43fac2a5", + "from": "dkg-evm-module@https://github.com/OriginTrail/dkg-evm-module.git#feature/paranets", "requires": { "@openzeppelin/contracts": "^4.9.3", - "@polkadot/api": "^10.1.4", - "@polkadot/keyring": "^11.1.1", - "@polkadot/util": "^11.1.1", - "@polkadot/util-crypto": "^11.1.1", "@prb/math": "^2.5.0", "dotenv": "^16.0.3", "hardhat": "^2.19.1", "hardhat-deploy": "^0.11.25", - "hardhat-deploy-ethers": "^0.3.0-beta.13", - "ts-node": "^10.9.1", - "typescript": "^4.9.4" - }, - "dependencies": { - "@noble/hashes": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz", - "integrity": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==" - }, - "@polkadot/api": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-10.11.2.tgz", - "integrity": "sha512-AorCZxCWCoTtdbl4DPUZh+ACe/pbLIS1BkdQY0AFJuZllm0x/yWzjgampcPd5jQAA/O3iKShRBkZqj6Mk9yG/A==", - "requires": { - "@polkadot/api-augment": "10.11.2", - "@polkadot/api-base": "10.11.2", - "@polkadot/api-derive": "10.11.2", - "@polkadot/keyring": "^12.6.2", - "@polkadot/rpc-augment": "10.11.2", - "@polkadot/rpc-core": "10.11.2", - "@polkadot/rpc-provider": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-augment": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/types-create": "10.11.2", - "@polkadot/types-known": "10.11.2", - "@polkadot/util": "^12.6.2", - "@polkadot/util-crypto": "^12.6.2", - "eventemitter3": "^5.0.1", - "rxjs": "^7.8.1", - "tslib": "^2.6.2" - }, - "dependencies": { - "@noble/hashes": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", - "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" - }, - "@polkadot/keyring": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.6.2.tgz", - "integrity": "sha512-O3Q7GVmRYm8q7HuB3S0+Yf/q/EB2egKRRU3fv9b3B7V+A52tKzA+vIwEmNVaD1g5FKW9oB97rmpggs0zaKFqHw==", - "requires": { - "@polkadot/util": "12.6.2", - "@polkadot/util-crypto": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/util-crypto": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.2.tgz", - "integrity": "sha512-FEWI/dJ7wDMNN1WOzZAjQoIcCP/3vz3wvAp5QQm+lOrzOLj0iDmaIGIcBkz8HVm3ErfSe/uKP0KS4jgV/ib+Mg==", - "requires": { - "@noble/curves": "^1.3.0", - "@noble/hashes": "^1.3.3", - "@polkadot/networks": "12.6.2", - "@polkadot/util": "12.6.2", - "@polkadot/wasm-crypto": "^7.3.2", - "@polkadot/wasm-util": "^7.3.2", - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-randomvalues": "12.6.2", - "@scure/base": "^1.1.5", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-randomvalues": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.2.tgz", - "integrity": "sha512-Vr8uG7rH2IcNJwtyf5ebdODMcr0XjoCpUbI91Zv6AlKVYOGKZlKLYJHIwpTaKKB+7KPWyQrk4Mlym/rS7v9feg==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@scure/base": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", - "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==" - } - } - }, - "@polkadot/api-augment": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/api-augment/-/api-augment-10.11.2.tgz", - "integrity": "sha512-PTpnqpezc75qBqUtgrc0GYB8h9UHjfbHSRZamAbecIVAJ2/zc6CqtnldeaBlIu1IKTgBzi3FFtTyYu+ZGbNT2Q==", - "requires": { - "@polkadot/api-base": "10.11.2", - "@polkadot/rpc-augment": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-augment": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "dependencies": { - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - } - } - }, - "@polkadot/api-base": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/api-base/-/api-base-10.11.2.tgz", - "integrity": "sha512-4LIjaUfO9nOzilxo7XqzYKCNMtmUypdk8oHPdrRnSjKEsnK7vDsNi+979z2KXNXd2KFSCFHENmI523fYnMnReg==", - "requires": { - "@polkadot/rpc-core": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/util": "^12.6.2", - "rxjs": "^7.8.1", - "tslib": "^2.6.2" - }, - "dependencies": { - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - } - } - }, - "@polkadot/api-derive": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-10.11.2.tgz", - "integrity": "sha512-m3BQbPionkd1iSlknddxnL2hDtolPIsT+aRyrtn4zgMRPoLjHFmTmovvg8RaUyYofJtZeYrnjMw0mdxiSXx7eA==", - "requires": { - "@polkadot/api": "10.11.2", - "@polkadot/api-augment": "10.11.2", - "@polkadot/api-base": "10.11.2", - "@polkadot/rpc-core": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/util": "^12.6.2", - "@polkadot/util-crypto": "^12.6.2", - "rxjs": "^7.8.1", - "tslib": "^2.6.2" - }, - "dependencies": { - "@noble/hashes": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", - "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" - }, - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/util-crypto": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.2.tgz", - "integrity": "sha512-FEWI/dJ7wDMNN1WOzZAjQoIcCP/3vz3wvAp5QQm+lOrzOLj0iDmaIGIcBkz8HVm3ErfSe/uKP0KS4jgV/ib+Mg==", - "requires": { - "@noble/curves": "^1.3.0", - "@noble/hashes": "^1.3.3", - "@polkadot/networks": "12.6.2", - "@polkadot/util": "12.6.2", - "@polkadot/wasm-crypto": "^7.3.2", - "@polkadot/wasm-util": "^7.3.2", - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-randomvalues": "12.6.2", - "@scure/base": "^1.1.5", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-randomvalues": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.2.tgz", - "integrity": "sha512-Vr8uG7rH2IcNJwtyf5ebdODMcr0XjoCpUbI91Zv6AlKVYOGKZlKLYJHIwpTaKKB+7KPWyQrk4Mlym/rS7v9feg==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@scure/base": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", - "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==" - } - } - }, - "@polkadot/keyring": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-11.1.3.tgz", - "integrity": "sha512-bzGz1cWDYK7MWhp0630W6KOwTC/wsvKKHBvWxReMT7iQwFHeLn5AemUOveqIPxF+esd/UfdN5aFDHApjYcyZsg==", - "requires": { - "@polkadot/util": "11.1.3", - "@polkadot/util-crypto": "11.1.3", - "tslib": "^2.5.0" - } - }, - "@polkadot/networks": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-12.6.2.tgz", - "integrity": "sha512-1oWtZm1IvPWqvMrldVH6NI2gBoCndl5GEwx7lAuQWGr7eNL+6Bdc5K3Z9T0MzFvDGoi2/CBqjX9dRKo39pDC/w==", - "requires": { - "@polkadot/util": "12.6.2", - "@substrate/ss58-registry": "^1.44.0", - "tslib": "^2.6.2" - }, - "dependencies": { - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - } - } - }, - "@polkadot/rpc-augment": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-augment/-/rpc-augment-10.11.2.tgz", - "integrity": "sha512-9AhT0WW81/8jYbRcAC6PRmuxXqNhJje8OYiulBQHbG1DTCcjAfz+6VQBke9BwTStzPq7d526+yyBKD17O3zlAA==", - "requires": { - "@polkadot/rpc-core": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "dependencies": { - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - } - } - }, - "@polkadot/rpc-core": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-10.11.2.tgz", - "integrity": "sha512-Ot0CFLWx8sZhLZog20WDuniPA01Bk2StNDsdAQgcFKPwZw6ShPaZQCHuKLQK6I6DodOrem9FXX7c1hvoKJP5Ww==", - "requires": { - "@polkadot/rpc-augment": "10.11.2", - "@polkadot/rpc-provider": "10.11.2", - "@polkadot/types": "10.11.2", - "@polkadot/util": "^12.6.2", - "rxjs": "^7.8.1", - "tslib": "^2.6.2" - }, - "dependencies": { - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - } - } - }, - "@polkadot/rpc-provider": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-10.11.2.tgz", - "integrity": "sha512-he5jWMpDJp7e+vUzTZDzpkB7ps3H8psRally+/ZvZZScPvFEjfczT7I1WWY9h58s8+ImeVP/lkXjL9h/gUOt3Q==", - "requires": { - "@polkadot/keyring": "^12.6.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-support": "10.11.2", - "@polkadot/util": "^12.6.2", - "@polkadot/util-crypto": "^12.6.2", - "@polkadot/x-fetch": "^12.6.2", - "@polkadot/x-global": "^12.6.2", - "@polkadot/x-ws": "^12.6.2", - "@substrate/connect": "0.7.35", - "eventemitter3": "^5.0.1", - "mock-socket": "^9.3.1", - "nock": "^13.4.0", - "tslib": "^2.6.2" - }, - "dependencies": { - "@noble/hashes": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", - "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" - }, - "@polkadot/keyring": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.6.2.tgz", - "integrity": "sha512-O3Q7GVmRYm8q7HuB3S0+Yf/q/EB2egKRRU3fv9b3B7V+A52tKzA+vIwEmNVaD1g5FKW9oB97rmpggs0zaKFqHw==", - "requires": { - "@polkadot/util": "12.6.2", - "@polkadot/util-crypto": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/util-crypto": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.2.tgz", - "integrity": "sha512-FEWI/dJ7wDMNN1WOzZAjQoIcCP/3vz3wvAp5QQm+lOrzOLj0iDmaIGIcBkz8HVm3ErfSe/uKP0KS4jgV/ib+Mg==", - "requires": { - "@noble/curves": "^1.3.0", - "@noble/hashes": "^1.3.3", - "@polkadot/networks": "12.6.2", - "@polkadot/util": "12.6.2", - "@polkadot/wasm-crypto": "^7.3.2", - "@polkadot/wasm-util": "^7.3.2", - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-randomvalues": "12.6.2", - "@scure/base": "^1.1.5", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-randomvalues": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.2.tgz", - "integrity": "sha512-Vr8uG7rH2IcNJwtyf5ebdODMcr0XjoCpUbI91Zv6AlKVYOGKZlKLYJHIwpTaKKB+7KPWyQrk4Mlym/rS7v9feg==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@scure/base": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", - "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==" - } - } - }, - "@polkadot/types": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-10.11.2.tgz", - "integrity": "sha512-d52j3xXni+C8GdYZVTSfu8ROAnzXFMlyRvXtor0PudUc8UQHOaC4+mYAkTBGA2gKdmL8MHSfRSbhcxHhsikY6Q==", - "requires": { - "@polkadot/keyring": "^12.6.2", - "@polkadot/types-augment": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/types-create": "10.11.2", - "@polkadot/util": "^12.6.2", - "@polkadot/util-crypto": "^12.6.2", - "rxjs": "^7.8.1", - "tslib": "^2.6.2" - }, - "dependencies": { - "@noble/hashes": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", - "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" - }, - "@polkadot/keyring": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-12.6.2.tgz", - "integrity": "sha512-O3Q7GVmRYm8q7HuB3S0+Yf/q/EB2egKRRU3fv9b3B7V+A52tKzA+vIwEmNVaD1g5FKW9oB97rmpggs0zaKFqHw==", - "requires": { - "@polkadot/util": "12.6.2", - "@polkadot/util-crypto": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/util-crypto": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-12.6.2.tgz", - "integrity": "sha512-FEWI/dJ7wDMNN1WOzZAjQoIcCP/3vz3wvAp5QQm+lOrzOLj0iDmaIGIcBkz8HVm3ErfSe/uKP0KS4jgV/ib+Mg==", - "requires": { - "@noble/curves": "^1.3.0", - "@noble/hashes": "^1.3.3", - "@polkadot/networks": "12.6.2", - "@polkadot/util": "12.6.2", - "@polkadot/wasm-crypto": "^7.3.2", - "@polkadot/wasm-util": "^7.3.2", - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-randomvalues": "12.6.2", - "@scure/base": "^1.1.5", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-randomvalues": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-12.6.2.tgz", - "integrity": "sha512-Vr8uG7rH2IcNJwtyf5ebdODMcr0XjoCpUbI91Zv6AlKVYOGKZlKLYJHIwpTaKKB+7KPWyQrk4Mlym/rS7v9feg==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@scure/base": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", - "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==" - } - } - }, - "@polkadot/types-augment": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-augment/-/types-augment-10.11.2.tgz", - "integrity": "sha512-8eB8ew04wZiE5GnmFvEFW1euJWmF62SGxb1O+8wL3zoUtB9Xgo1vB6w6xbTrd+HLV6jNSeXXnbbF1BEUvi9cNg==", - "requires": { - "@polkadot/types": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "dependencies": { - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - } - } - }, - "@polkadot/types-codec": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-codec/-/types-codec-10.11.2.tgz", - "integrity": "sha512-3xjOQL+LOOMzYqlgP9ROL0FQnzU8lGflgYewzau7AsDlFziSEtb49a9BpYo6zil4koC+QB8zQ9OHGFumG08T8w==", - "requires": { - "@polkadot/util": "^12.6.2", - "@polkadot/x-bigint": "^12.6.2", - "tslib": "^2.6.2" - }, - "dependencies": { - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - } - } - }, - "@polkadot/types-create": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-create/-/types-create-10.11.2.tgz", - "integrity": "sha512-SJt23NxYvefRxVZZm6mT9ed1pR6FDoIGQ3xUpbjhTLfU2wuhpKjekMVorYQ6z/gK2JLMu2kV92Ardsz+6GX5XQ==", - "requires": { - "@polkadot/types-codec": "10.11.2", - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "dependencies": { - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - } - } - }, - "@polkadot/types-known": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-10.11.2.tgz", - "integrity": "sha512-kbEIX7NUQFxpDB0FFGNyXX/odY7jbp56RGD+Z4A731fW2xh/DgAQrI994xTzuh0c0EqPE26oQm3kATSpseqo9w==", - "requires": { - "@polkadot/networks": "^12.6.2", - "@polkadot/types": "10.11.2", - "@polkadot/types-codec": "10.11.2", - "@polkadot/types-create": "10.11.2", - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "dependencies": { - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - } - } - }, - "@polkadot/types-support": { - "version": "10.11.2", - "resolved": "https://registry.npmjs.org/@polkadot/types-support/-/types-support-10.11.2.tgz", - "integrity": "sha512-X11hoykFYv/3efg4coZy2hUOUc97JhjQMJLzDhHniFwGLlYU8MeLnPdCVGkXx0xDDjTo4/ptS1XpZ5HYcg+gRw==", - "requires": { - "@polkadot/util": "^12.6.2", - "tslib": "^2.6.2" - }, - "dependencies": { - "@polkadot/util": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-12.6.2.tgz", - "integrity": "sha512-l8TubR7CLEY47240uki0TQzFvtnxFIO7uI/0GoWzpYD/O62EIAMRsuY01N4DuwgKq2ZWD59WhzsLYmA5K6ksdw==", - "requires": { - "@polkadot/x-bigint": "12.6.2", - "@polkadot/x-global": "12.6.2", - "@polkadot/x-textdecoder": "12.6.2", - "@polkadot/x-textencoder": "12.6.2", - "@types/bn.js": "^5.1.5", - "bn.js": "^5.2.1", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textdecoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-12.6.2.tgz", - "integrity": "sha512-M1Bir7tYvNappfpFWXOJcnxUhBUFWkUFIdJSyH0zs5LmFtFdbKAeiDXxSp2Swp5ddOZdZgPac294/o2TnQKN1w==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-textencoder": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-12.6.2.tgz", - "integrity": "sha512-4N+3UVCpI489tUJ6cv3uf0PjOHvgGp9Dl+SZRLgFGt9mvxnvpW/7+XBADRMtlG4xi5gaRK7bgl5bmY6OMDsNdw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - } - } - }, - "@polkadot/util": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-11.1.3.tgz", - "integrity": "sha512-Gsqzv1/fSoypS5tnJkM+NJQeT7O4iYlSniubUJnaZVOKsIbueTS1bMQ1y3/h8ISxbKBtICW5cZ6zCej6Q/jC3w==", - "requires": { - "@polkadot/x-bigint": "11.1.3", - "@polkadot/x-global": "11.1.3", - "@polkadot/x-textdecoder": "11.1.3", - "@polkadot/x-textencoder": "11.1.3", - "@types/bn.js": "^5.1.1", - "bn.js": "^5.2.1", - "tslib": "^2.5.0" - }, - "dependencies": { - "@polkadot/x-bigint": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-11.1.3.tgz", - "integrity": "sha512-fRUUHfW9VFsXT7sLUUY7gSu8v+PvzNLRwvjnp+Ly8vFx9LTLuVGFCi+mpysuRTaPpqZZJlzBJ3fST7xTGh67Pg==", - "requires": { - "@polkadot/x-global": "11.1.3", - "tslib": "^2.5.0" - } - }, - "@polkadot/x-global": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-11.1.3.tgz", - "integrity": "sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg==", - "requires": { - "tslib": "^2.5.0" - } - } - } - }, - "@polkadot/util-crypto": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-11.1.3.tgz", - "integrity": "sha512-hjH1y6jXQuceJ2NWx7+ei0sR4A7t844XwlNquPxZX3kQbQS+1t6tO4Eo3/95JhPsEaJOXduus02cYEF6gteEYQ==", - "requires": { - "@noble/hashes": "1.3.0", - "@noble/secp256k1": "1.7.1", - "@polkadot/networks": "11.1.3", - "@polkadot/util": "11.1.3", - "@polkadot/wasm-crypto": "^7.0.3", - "@polkadot/x-bigint": "11.1.3", - "@polkadot/x-randomvalues": "11.1.3", - "@scure/base": "1.1.1", - "tslib": "^2.5.0", - "tweetnacl": "^1.0.3" - }, - "dependencies": { - "@polkadot/networks": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-11.1.3.tgz", - "integrity": "sha512-goLpX9SswAGGeh1jXB79wHEfWOF5rLIItMHYalujBmhQVxyAqbxP2tzQqPQXDLcnkWbgwkyYGLXaDD72GBqHZw==", - "requires": { - "@polkadot/util": "11.1.3", - "@substrate/ss58-registry": "^1.39.0", - "tslib": "^2.5.0" - } - }, - "@polkadot/x-bigint": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-11.1.3.tgz", - "integrity": "sha512-fRUUHfW9VFsXT7sLUUY7gSu8v+PvzNLRwvjnp+Ly8vFx9LTLuVGFCi+mpysuRTaPpqZZJlzBJ3fST7xTGh67Pg==", - "requires": { - "@polkadot/x-global": "11.1.3", - "tslib": "^2.5.0" - } - }, - "@polkadot/x-global": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-11.1.3.tgz", - "integrity": "sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg==", - "requires": { - "tslib": "^2.5.0" - } - } - } - }, - "@polkadot/wasm-bridge": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-bridge/-/wasm-bridge-7.3.2.tgz", - "integrity": "sha512-AJEXChcf/nKXd5Q/YLEV5dXQMle3UNT7jcXYmIffZAo/KI394a+/24PaISyQjoNC0fkzS1Q8T5pnGGHmXiVz2g==", - "requires": { - "@polkadot/wasm-util": "7.3.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/wasm-crypto": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-7.3.2.tgz", - "integrity": "sha512-+neIDLSJ6jjVXsjyZ5oLSv16oIpwp+PxFqTUaZdZDoA2EyFRQB8pP7+qLsMNk+WJuhuJ4qXil/7XiOnZYZ+wxw==", - "requires": { - "@polkadot/wasm-bridge": "7.3.2", - "@polkadot/wasm-crypto-asmjs": "7.3.2", - "@polkadot/wasm-crypto-init": "7.3.2", - "@polkadot/wasm-crypto-wasm": "7.3.2", - "@polkadot/wasm-util": "7.3.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/wasm-crypto-asmjs": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.3.2.tgz", - "integrity": "sha512-QP5eiUqUFur/2UoF2KKKYJcesc71fXhQFLT3D4ZjG28Mfk2ZPI0QNRUfpcxVQmIUpV5USHg4geCBNuCYsMm20Q==", - "requires": { - "tslib": "^2.6.2" - } - }, - "@polkadot/wasm-crypto-init": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.3.2.tgz", - "integrity": "sha512-FPq73zGmvZtnuJaFV44brze3Lkrki3b4PebxCy9Fplw8nTmisKo9Xxtfew08r0njyYh+uiJRAxPCXadkC9sc8g==", - "requires": { - "@polkadot/wasm-bridge": "7.3.2", - "@polkadot/wasm-crypto-asmjs": "7.3.2", - "@polkadot/wasm-crypto-wasm": "7.3.2", - "@polkadot/wasm-util": "7.3.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/wasm-crypto-wasm": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.3.2.tgz", - "integrity": "sha512-15wd0EMv9IXs5Abp1ZKpKKAVyZPhATIAHfKsyoWCEFDLSOA0/K0QGOxzrAlsrdUkiKZOq7uzSIgIDgW8okx2Mw==", - "requires": { - "@polkadot/wasm-util": "7.3.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/wasm-util": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@polkadot/wasm-util/-/wasm-util-7.3.2.tgz", - "integrity": "sha512-bmD+Dxo1lTZyZNxbyPE380wd82QsX+43mgCm40boyKrRppXEyQmWT98v/Poc7chLuskYb6X8IQ6lvvK2bGR4Tg==", - "requires": { - "tslib": "^2.6.2" - } - }, - "@polkadot/x-bigint": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-12.6.2.tgz", - "integrity": "sha512-HSIk60uFPX4GOFZSnIF7VYJz7WZA7tpFJsne7SzxOooRwMTWEtw3fUpFy5cYYOeLh17/kHH1Y7SVcuxzVLc74Q==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-fetch": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-12.6.2.tgz", - "integrity": "sha512-8wM/Z9JJPWN1pzSpU7XxTI1ldj/AfC8hKioBlUahZ8gUiJaOF7K9XEFCrCDLis/A1BoOu7Ne6WMx/vsJJIbDWw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "node-fetch": "^3.3.2", - "tslib": "^2.6.2" - } - }, - "@polkadot/x-global": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-12.6.2.tgz", - "integrity": "sha512-a8d6m+PW98jmsYDtAWp88qS4dl8DyqUBsd0S+WgyfSMtpEXu6v9nXDgPZgwF5xdDvXhm+P0ZfVkVTnIGrScb5g==", - "requires": { - "tslib": "^2.6.2" - } - }, - "@polkadot/x-randomvalues": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-11.1.3.tgz", - "integrity": "sha512-kZjbRgxokMR9UTodZQKs6s3C/Q2YgeizcxpDCghM/VdvQUE8OVBGNzduF7SvBvQyg2Qbg8jMcSxXOY7UgcOWSg==", - "requires": { - "@polkadot/x-global": "11.1.3", - "tslib": "^2.5.0" - }, - "dependencies": { - "@polkadot/x-global": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-11.1.3.tgz", - "integrity": "sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg==", - "requires": { - "tslib": "^2.5.0" - } - } - } - }, - "@polkadot/x-textdecoder": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-11.1.3.tgz", - "integrity": "sha512-NhOjuXVfYRMw9l0VhCtZOtcWefZth58p5KpVOrFyJZd12fTsoMO5/746K7QoAjWRrLQTJ/LHCEKCtWww0LwVPw==", - "requires": { - "@polkadot/x-global": "11.1.3", - "tslib": "^2.5.0" - }, - "dependencies": { - "@polkadot/x-global": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-11.1.3.tgz", - "integrity": "sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg==", - "requires": { - "tslib": "^2.5.0" - } - } - } - }, - "@polkadot/x-textencoder": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-11.1.3.tgz", - "integrity": "sha512-7DmqjlPN8aQexLUKwoHeadihpUnW8hjpXEru+aEDxjgq9XIxPvb++NeBK+Mra9RzzZRuiT/K5z16HlwKN//ewg==", - "requires": { - "@polkadot/x-global": "11.1.3", - "tslib": "^2.5.0" - }, - "dependencies": { - "@polkadot/x-global": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-11.1.3.tgz", - "integrity": "sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg==", - "requires": { - "tslib": "^2.5.0" - } - } - } - }, - "@polkadot/x-ws": { - "version": "12.6.2", - "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-12.6.2.tgz", - "integrity": "sha512-cGZWo7K5eRRQCRl2LrcyCYsrc3lRbTlixZh3AzgU8uX4wASVGRlNWi/Hf4TtHNe1ExCDmxabJzdIsABIfrr7xw==", - "requires": { - "@polkadot/x-global": "12.6.2", - "tslib": "^2.6.2", - "ws": "^8.15.1" - } - }, - "@substrate/connect": { - "version": "0.7.35", - "resolved": "https://registry.npmjs.org/@substrate/connect/-/connect-0.7.35.tgz", - "integrity": "sha512-Io8vkalbwaye+7yXfG1Nj52tOOoJln2bMlc7Q9Yy3vEWqZEVkgKmcPVzbwV0CWL3QD+KMPDA2Dnw/X7EdwgoLw==", - "optional": true, - "requires": { - "@substrate/connect-extension-protocol": "^1.0.1", - "smoldot": "2.0.7" - } - } + "hardhat-deploy-ethers": "^0.3.0-beta.13" } }, "dkg.js": { @@ -32375,7 +29860,9 @@ "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "optional": true, + "peer": true }, "match-all": { "version": "1.2.6", @@ -34622,15 +32109,6 @@ "version": "1.6.6", "dev": true }, - "smoldot": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/smoldot/-/smoldot-2.0.7.tgz", - "integrity": "sha512-VAOBqEen6vises36/zgrmAT1GWk2qE3X8AGnO7lmQFdskbKx8EovnwS22rtPAG+Y1Rk23/S22kDJUdPANyPkBA==", - "optional": true, - "requires": { - "ws": "^8.8.1" - } - }, "solc": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz", @@ -35226,6 +32704,8 @@ "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "optional": true, + "peer": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -35245,7 +32725,9 @@ "acorn-walk": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", - "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==" + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "optional": true, + "peer": true } } }, @@ -35374,7 +32856,9 @@ "typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "optional": true, + "peer": true }, "uint8arrays": { "version": "3.1.1", @@ -35574,7 +33058,9 @@ "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "optional": true, + "peer": true }, "validate-iri": { "version": "1.0.1" @@ -36143,6 +33629,7 @@ }, "ws": { "version": "8.16.0", + "optional": true, "requires": {} }, "xhr": { @@ -36277,7 +33764,9 @@ "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "optional": true, + "peer": true }, "yocto-queue": { "version": "0.1.0" diff --git a/package.json b/package.json index 57fad629e8..40bbb07b82 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "axios": "^1.6.0", "cors": "^2.8.5", "deep-extend": "^0.6.0", - "dkg-evm-module": "^4.2.3", + "dkg-evm-module": "github:OriginTrail/dkg-evm-module#feature/paranets", "dotenv": "^16.0.1", "ethers": "^5.7.2", "express": "^4.18.1", From 0114a83ea6a3e16a5f2028b8b97aa9dc3b170492 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Thu, 23 May 2024 17:41:35 +0200 Subject: [PATCH 47/82] Remove duplicate paranet service --- ot-node.js | 5 ++--- src/service/blockchain-event-listener-service.js | 16 +++++++--------- src/service/get-service.js | 6 +++--- src/service/paranet-id-service.js | 16 ---------------- src/service/paranet-service.js | 2 +- src/service/triple-store-service.js | 4 ++-- 6 files changed, 15 insertions(+), 34 deletions(-) delete mode 100644 src/service/paranet-id-service.js diff --git a/ot-node.js b/ot-node.js index 77e45ef6a5..fe41e9c9b5 100644 --- a/ot-node.js +++ b/ot-node.js @@ -342,7 +342,6 @@ class OTNode { } async initializeParanets() { - const paranetIdService = this.container.resolve('paranetIdService'); const blockchainModuleManager = this.container.resolve('blockchainModuleManager'); const tripleStoreService = this.container.resolve('tripleStoreService'); const tripleStoreModuleManager = this.container.resolve('tripleStoreModuleManager'); @@ -351,7 +350,7 @@ class OTNode { // Do this in promises this.config.assetSync?.syncParanets.forEach(async (paranetUAL) => { // Not this service - if (!paranetIdService.isUAL(paranetUAL)) { + if (!paranetService.isUAL(paranetUAL)) { this.logger.warn( `Unable to initialize Paranet with id ${paranetUAL} because of invalid UAL format`, ); @@ -374,7 +373,7 @@ class OTNode { ); } else { validParanets.push(paranetUAL); - const repository = paranetIdService.getParanetRepositoryName(paranetUAL); + const repository = paranetService.getParanetRepositoryName(paranetUAL); tripleStoreModuleManager.initializeRepository(repository); paranetService.initializeParanetRecord(blockchain, paranetId); } diff --git a/src/service/blockchain-event-listener-service.js b/src/service/blockchain-event-listener-service.js index ba800a74a1..b5f787063c 100644 --- a/src/service/blockchain-event-listener-service.js +++ b/src/service/blockchain-event-listener-service.js @@ -28,6 +28,7 @@ class BlockchainEventListenerService { this.hashingService = ctx.hashingService; this.serviceAgreementService = ctx.serviceAgreementService; this.shardingTableService = ctx.shardingTableService; + this.paranetService = ctx.paranetService; this.eventGroupsBuffer = {}; } @@ -574,18 +575,15 @@ class BlockchainEventListenerService { stateIndex, ), ]); - const knowledgeAssetId = this.blockchainModuleManager.encodePacked( - blockchain, - ['address', 'bytes32'], - [contract, tokenId], - ); // eslint-disable-next-line no-await-in-loop - const paranetId = await this.blockchainModuleManager.getParanetId( + const paranetId = await this.paranetService.constructParanetId( blockchain, - knowledgeAssetId, + contract, + tokenId, ); - // Chack if this asset is in paranet we are syncing + + // Check if this asset is in paranet we are syncing // eslint-disable-next-line no-await-in-loop const paranetAssetExists = await this.tripleStoreService.paranetAssetExists( paranetId, @@ -595,7 +593,7 @@ class BlockchainEventListenerService { ); if (paranetAssetExists) { const paranetRepositoryName = - this.paranetIdService.getParanetRepositoryName(paranetId); + this.paranetService.getParanetRepositoryName(paranetId); // eslint-disable-next-line no-await-in-loop const assertionIds = await this.blockchainModuleManager.getAssertionIds( blockchain, diff --git a/src/service/get-service.js b/src/service/get-service.js index 362e1b1af5..53fbf626b1 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -24,7 +24,7 @@ class GetService extends OperationService { this.ualService = ctx.ualService; this.tripleStoreService = ctx.tripleStoreService; this.blockchainModuleManager = ctx.blockchainModuleManager; - this.paranetIdService = ctx.paranetIdService; + this.paranetService = ctx.paranetService; this.operationMutex = new Mutex(); } @@ -109,7 +109,7 @@ class GetService extends OperationService { if (paranetLatestAsset) { await this.tripleStoreService.localStoreAsset( - `${this.paranetIdService.getParanetRepositoryName(paranetId)}-${ + `${this.paranetService.getParanetRepositoryName(paranetId)}-${ TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT }`, assertionId, @@ -120,7 +120,7 @@ class GetService extends OperationService { keyword, ); } else if (paranetRepoId) { - const newRepoName = `${this.paranetIdService.getParanetRepositoryName( + const newRepoName = `${this.paranetService.getParanetRepositoryName( paranetId, )}-${paranetRepoId}`; diff --git a/src/service/paranet-id-service.js b/src/service/paranet-id-service.js deleted file mode 100644 index a2d54b3b35..0000000000 --- a/src/service/paranet-id-service.js +++ /dev/null @@ -1,16 +0,0 @@ -class ParanetIdService { - constructor(ctx) { - this.ualService = ctx.ualService; - } - - getParanetRepositoryName(paranetId) { - if (this.ualService.isUAL(paranetId)) { - return paranetId.replace('/', '-'); - } - throw new Error( - `Unable to get Paranet repository name. Paranet id doesn't have correct format: ${paranetId}`, - ); - } -} - -export default ParanetIdService; diff --git a/src/service/paranet-service.js b/src/service/paranet-service.js index 5bc05adcf4..b1dddf1767 100644 --- a/src/service/paranet-service.js +++ b/src/service/paranet-service.js @@ -2,7 +2,7 @@ class ParanetService { constructor(ctx) { this.blockchainModuleManager = ctx.blockchainModuleManager; this.repositoryModuleManager = ctx.repositoryModuleManager; - this.this.ualService = ctx.ualService; + this.ualService = ctx.ualService; } async initializeParanetRecord(blockchain, paranetId) { diff --git a/src/service/triple-store-service.js b/src/service/triple-store-service.js index 90dbed6bf5..b5bef03c7c 100644 --- a/src/service/triple-store-service.js +++ b/src/service/triple-store-service.js @@ -10,7 +10,7 @@ class TripleStoreService { this.tripleStoreModuleManager = ctx.tripleStoreModuleManager; this.ualService = ctx.ualService; this.dataService = ctx.dataService; - this.paranetIdService = ctx.paranetIdService; + this.paranetService = ctx.paranetService; } initializeRepositories() { @@ -312,7 +312,7 @@ class TripleStoreService { } async paranetAssetExists(paranetId, blockchain, contract, tokenId) { - const repository = this.paranetIdService.getParanetRepositoryName(paranetId); + const repository = this.paranetService.getParanetRepositoryName(paranetId); return this.assetExists(repository, blockchain, contract, tokenId); } From 3097456bbbb6d502be4335912333740e8c722216 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Thu, 23 May 2024 17:42:12 +0200 Subject: [PATCH 48/82] Remove wrong paranet method --- src/modules/blockchain/blockchain-module-manager.js | 4 ---- src/modules/blockchain/implementation/web3-service.js | 6 ------ 2 files changed, 10 deletions(-) diff --git a/src/modules/blockchain/blockchain-module-manager.js b/src/modules/blockchain/blockchain-module-manager.js index b7d574a82a..60c5ac1c6b 100644 --- a/src/modules/blockchain/blockchain-module-manager.js +++ b/src/modules/blockchain/blockchain-module-manager.js @@ -482,10 +482,6 @@ class BlockchainModuleManager extends BaseModuleManager { async paranetExists(blockchain, paranetId) { return this.callImplementationFunction(blockchain, 'paranetExists', [paranetId]); } - - async getParanetId(blockchain, knowledgeAssetId) { - return this.callImplementationFunction(blockchain, 'getParanetId', [knowledgeAssetId]); - } } export default BlockchainModuleManager; diff --git a/src/modules/blockchain/implementation/web3-service.js b/src/modules/blockchain/implementation/web3-service.js index f5c683976e..a3aba9fc39 100644 --- a/src/modules/blockchain/implementation/web3-service.js +++ b/src/modules/blockchain/implementation/web3-service.js @@ -1633,12 +1633,6 @@ class Web3Service { async paranetExists(paranetId) { return this.callContractFunction(this.ParanetsRegistry, 'paranetExists', [paranetId]); } - - async getParanetId(knowledgeAssetId) { - return this.callContractFunction(this.ParanetKnowledgeAssetsRegistry, 'paranetExists', [ - knowledgeAssetId, - ]); - } } export default Web3Service; From 2b702e05989500b73ee73b4c7425eeebdd25e598 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Thu, 23 May 2024 17:42:34 +0200 Subject: [PATCH 49/82] Lowercase Paranet db table --- .../sequelize/migrations/20240429083058-create-paranet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js b/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js index 4d4c42840d..186fd5ed88 100644 --- a/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js +++ b/src/modules/repository/implementation/sequelize/migrations/20240429083058-create-paranet.js @@ -1,5 +1,5 @@ export const up = async ({ context: { queryInterface, Sequelize } }) => { - await queryInterface.createTable('Paranet', { + await queryInterface.createTable('paranet', { id: { allowNull: false, autoIncrement: true, From f983cb11b37ddbc132e467adb893a3e44cc52453 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Thu, 23 May 2024 23:48:32 +0200 Subject: [PATCH 50/82] Setup paranet triple store repository initialization --- ot-node.js | 27 ++++++++++++------- package-lock.json | 2 +- .../blockchain/implementation/web3-service.js | 25 ++++++++++++----- .../implementation/ot-triple-store.js | 11 ++++++-- .../triple-store-module-manager.js | 4 +-- src/service/paranet-service.js | 12 +++++---- 6 files changed, 54 insertions(+), 27 deletions(-) diff --git a/ot-node.js b/ot-node.js index fe41e9c9b5..e85a2d6801 100644 --- a/ot-node.js +++ b/ot-node.js @@ -51,6 +51,7 @@ class OTNode { this.initializeEventEmitter(); await this.initializeModules(); + await this.initializeParanets(); await MigrationExecutor.executeRemoveServiceAgreementsForChiadoMigration( this.container, @@ -346,16 +347,17 @@ class OTNode { 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 = []; - // Do this in promises - this.config.assetSync?.syncParanets.forEach(async (paranetUAL) => { - // Not this service - if (!paranetService.isUAL(paranetUAL)) { + + // 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 } = this.ualService.resolveUAL(paranetUAL); + 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`, @@ -366,7 +368,11 @@ class OTNode { contract, tokenId, ); - const paranetExists = await blockchainModuleManager.paranetExists(paranetId); + // 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`, @@ -374,14 +380,15 @@ class OTNode { } else { validParanets.push(paranetUAL); const repository = paranetService.getParanetRepositoryName(paranetUAL); - tripleStoreModuleManager.initializeRepository(repository); - paranetService.initializeParanetRecord(blockchain, paranetId); + tripleStoreModuleManager.initializeParanetRepository(repository); + // eslint-disable-next-line no-await-in-loop + await paranetService.initializeParanetRecord(blockchain, paranetId); } } } - }); - this.config.assetSync.syncParanets = validParanets; + } + this.config.assetSync.syncParanets = validParanets; tripleStoreService.initializeRepositories(); } diff --git a/package-lock.json b/package-lock.json index f6376923b6..71370982ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26181,7 +26181,7 @@ }, "dkg-evm-module": { "version": "git+ssh://git@github.com/OriginTrail/dkg-evm-module.git#030a97416dd66e05a7a43145c05e7b9f43fac2a5", - "from": "dkg-evm-module@https://github.com/OriginTrail/dkg-evm-module.git#feature/paranets", + "from": "dkg-evm-module@github:OriginTrail/dkg-evm-module#feature/paranets", "requires": { "@openzeppelin/contracts": "^4.9.3", "@prb/math": "^2.5.0", diff --git a/src/modules/blockchain/implementation/web3-service.js b/src/modules/blockchain/implementation/web3-service.js index a3aba9fc39..9dc45651b6 100644 --- a/src/modules/blockchain/implementation/web3-service.js +++ b/src/modules/blockchain/implementation/web3-service.js @@ -1433,7 +1433,7 @@ class Web3Service { } keccak256(bytesLikeData) { - return ethers.keccak256(bytesLikeData); + return ethers.utils.keccak256(bytesLikeData); } sha256(bytesLikeData) { @@ -1602,26 +1602,32 @@ class Web3Service { } async getKnowledgeAssetsCount(paranetId) { - return this.callContractFunction(this.ParanetsRegistry, 'getKnowledgeAssetsCount', [ + return this.callContractFunction(this.ParanetsRegistryContract, 'getKnowledgeAssetsCount', [ paranetId, ]); } async getKnowledgeAssetsWithPagination(paranetId, offset, limit) { return this.callContractFunction( - this.ParanetsRegistry, + this.ParanetsRegistryContract, 'getKnowledgeAssetsWithPagination', [paranetId, offset, limit], + CONTRACTS.PARANETS_REGISTRY_CONTRACT, ); } async getParanetMetadata(paranetId) { - return this.callContractFunction(this.ParanetsRegistry, 'getParanetMetadata', [paranetId]); + return this.callContractFunction( + this.ParanetsRegistryContract, + 'getParanetMetadata', + [paranetId], + CONTRACTS.PARANETS_REGISTRY_CONTRACT, + ); } async getKnowledgeAssetLocator(knowledgeAssetId) { - const [knowledgeAssetStorageContract, tokenId] = await this.allContractFunction( - this.ParanetKnowledgeAssetsRegistry, + const [knowledgeAssetStorageContract, tokenId] = await this.callContractFunction( + this.ParanetKnowledgeAssetsRegistryContract, 'getKnowledgeAssetLocator', [knowledgeAssetId], ); @@ -1631,7 +1637,12 @@ class Web3Service { } async paranetExists(paranetId) { - return this.callContractFunction(this.ParanetsRegistry, 'paranetExists', [paranetId]); + return this.callContractFunction( + this.ParanetsRegistryContract, + 'paranetExists', + [paranetId], + CONTRACTS.PARANETS_REGISTRY_CONTRACT, + ); } } diff --git a/src/modules/triple-store/implementation/ot-triple-store.js b/src/modules/triple-store/implementation/ot-triple-store.js index 0a58b4dbfe..d3c7f3fab7 100644 --- a/src/modules/triple-store/implementation/ot-triple-store.js +++ b/src/modules/triple-store/implementation/ot-triple-store.js @@ -19,11 +19,18 @@ class OtTripleStore { initializeRepositories() { for (const repository of Object.keys(this.repositories)) { - this.initializeRepository(repository); + this.initializeSparqlEndpoints(repository); } } - initializeRepository(repository) { + initializeParanetRepository(repository) { + const publicCurrent = 'publicCurrent'; + this.repositories[repository] = { + url: this.repositories[publicCurrent].url, + name: repository, + username: this.repositories[publicCurrent].username, + password: this.repositories[publicCurrent].password, + }; this.initializeSparqlEndpoints(repository); } diff --git a/src/modules/triple-store/triple-store-module-manager.js b/src/modules/triple-store/triple-store-module-manager.js index 03365f8fa6..75a0d44ad8 100644 --- a/src/modules/triple-store/triple-store-module-manager.js +++ b/src/modules/triple-store/triple-store-module-manager.js @@ -1,8 +1,8 @@ import BaseModuleManager from '../base-module-manager.js'; class TripleStoreModuleManager extends BaseModuleManager { - initializeRepository(repository) { - return this.getImplementation().module.initializeRepository(repository); + initializeParanetRepository(repository) { + return this.getImplementation().module.initializeParanetRepository(repository); } async insertAssetAssertionMetadata(implementationName, repository, assetNquads) { diff --git a/src/service/paranet-service.js b/src/service/paranet-service.js index b1dddf1767..339b8d28ca 100644 --- a/src/service/paranet-service.js +++ b/src/service/paranet-service.js @@ -10,17 +10,19 @@ class ParanetService { blockchain, paranetId, ); - if (await this.repositoryModuleManager.paranetExists(paranetId, blockchain)) + if (!(await this.repositoryModuleManager.paranetExists(paranetId, blockchain))) { await this.repositoryModuleManager.createParanetRecord( paranetMetadata.name, paranetMetadata.description, paranetId, blockchain, ); - // TODO: Write proper Error msg - throw new Error( - `Unable to get Paranet repository name. Paranet id doesn't have correct format: ${paranetId}`, - ); + } else { + // TODO: Write proper Error msg + throw new Error( + `Unable to get Paranet repository name. Paranet id doesn't have correct format: ${paranetId}`, + ); + } } constructParanetId(blockchain, contract, tokenId) { From 0b68b32cffa6440e7599355092b425de7e11badb Mon Sep 17 00:00:00 2001 From: NZT48 Date: Thu, 23 May 2024 23:48:53 +0200 Subject: [PATCH 51/82] Set start paranet command to always start --- src/constants/constants.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/constants.js b/src/constants/constants.js index de95ad5ff3..a8d4c9c132 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -188,6 +188,7 @@ export const PERMANENT_COMMANDS = [ 'publishResponseCleanerCommand', 'updateCleanerCommand', 'updateResponseCleanerCommand', + 'startParanetSyncCommands', ]; export const MAX_COMMAND_DELAY_IN_MILLS = 14400 * 60 * 1000; // 10 days From 84a63bc53999bf400d668343eb3b19e9bc56237a Mon Sep 17 00:00:00 2001 From: NZT48 Date: Thu, 23 May 2024 23:49:07 +0200 Subject: [PATCH 52/82] Fix paranet db model --- .../repository/implementation/sequelize/models/paranet.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/modules/repository/implementation/sequelize/models/paranet.js b/src/modules/repository/implementation/sequelize/models/paranet.js index 9e089e1d61..1b01180145 100644 --- a/src/modules/repository/implementation/sequelize/models/paranet.js +++ b/src/modules/repository/implementation/sequelize/models/paranet.js @@ -3,36 +3,29 @@ export default (sequelize, DataTypes) => { 'paranet', { id: { - allowNull: false, autoIncrement: true, primaryKey: true, type: DataTypes.INTEGER, }, name: { - allowNull: false, type: DataTypes.STRING, }, description: { type: DataTypes.STRING, }, paranetId: { - allowNull: false, type: DataTypes.STRING, }, kaCount: { - allowNull: false, type: DataTypes.INTEGER, }, blockchainId: { - allowNull: false, type: DataTypes.STRING, }, createdAt: { - allowNull: false, type: DataTypes.DATE, }, updatedAt: { - allowNull: false, type: DataTypes.DATE, }, }, From 0d8534f6a137136f357c451b6f8dbd67442aa8e9 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Fri, 24 May 2024 15:32:52 +0800 Subject: [PATCH 53/82] Query improvment --- src/commands/query/query-command.js | 25 ++++++++++++++++++- .../v0/query-http-api-controller-v0.js | 4 +-- .../v0/request-schema/query-schema-v0.js | 3 +++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/commands/query/query-command.js b/src/commands/query/query-command.js index d75acf8dc0..82b6f1b1be 100644 --- a/src/commands/query/query-command.js +++ b/src/commands/query/query-command.js @@ -11,18 +11,21 @@ class QueryCommand extends Command { super(ctx); this.dataService = ctx.dataService; this.tripleStoreService = ctx.tripleStoreService; + this.paranetService = ctx.paranetService; this.errorType = ERROR_TYPE.QUERY.LOCAL_QUERY_ERROR; } async execute(command) { const { - query, queryType, operationId, repository = TRIPLE_STORE_REPOSITORIES.PRIVATE_CURRENT, + paranetUAL, } = command.data; + let { query } = command.data; + let data; await this.operationIdService.updateOperationIdStatus( @@ -30,6 +33,26 @@ class QueryCommand extends Command { null, OPERATION_ID_STATUS.QUERY.QUERY_START, ); + // check if it's federated query + const pattern = /SERVICE\s+<[^>]+>/g; + const matches = query.match(pattern); + if (matches) { + for (const paranetName in matches) { + // TODO: Is name gotten from paraneUAL of paranetName + const paranetRepositoryName = + this.paranetService.getParanetRepositoryByParanetName(paranetName); + if (!paranetRepositoryName) { + throw Error(`Query failed! Paranet with UAL: ${paranetName} doesn't exist`); + } + query = query.replace(paranetName, paranetRepositoryName); + } + } + if (paranetUAL) { + const paranetRepositoryName = this.paranetService.getParanetRepositoryName(paranetUAL); + if (!paranetRepositoryName) { + throw Error(`Query failed! Paranet with UAL: ${paranetUAL} doesn't exist`); + } + } try { switch (queryType) { case QUERY_TYPES.CONSTRUCT: { diff --git a/src/controllers/http-api/v0/query-http-api-controller-v0.js b/src/controllers/http-api/v0/query-http-api-controller-v0.js index 79e2455734..6a92af89f5 100644 --- a/src/controllers/http-api/v0/query-http-api-controller-v0.js +++ b/src/controllers/http-api/v0/query-http-api-controller-v0.js @@ -10,7 +10,7 @@ class QueryController extends BaseController { } async handleRequest(req, res) { - const { query, type: queryType } = req.body; + const { query, type: queryType, paranetUAL } = req.body; const operationId = await this.operationIdService.generateOperationId( OPERATION_ID_STATUS.QUERY.QUERY_INIT_START, @@ -30,7 +30,7 @@ class QueryController extends BaseController { name: 'queryCommand', sequence: [], delay: 0, - data: { query, queryType, repository: req.body.repository, operationId }, + data: { query, queryType, repository: req.body.repository, operationId, paranetUAL }, transactional: false, }); } diff --git a/src/controllers/http-api/v0/request-schema/query-schema-v0.js b/src/controllers/http-api/v0/request-schema/query-schema-v0.js index e245d7d87f..41cd1b5174 100644 --- a/src/controllers/http-api/v0/request-schema/query-schema-v0.js +++ b/src/controllers/http-api/v0/request-schema/query-schema-v0.js @@ -13,5 +13,8 @@ export default () => ({ repository: { enum: Object.values(TRIPLE_STORE_REPOSITORIES), }, + paranetUAL: { + type: 'string', + }, }, }); From 7437ef14dd4723647b8784a8da893f4b4e51c0fa Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 24 May 2024 13:08:56 +0200 Subject: [PATCH 54/82] Fix paranet repository initialization --- ot-node.js | 3 +- .../ot-blazegraph/ot-blazegraph.js | 29 ++++++++++--------- .../implementation/ot-triple-store.js | 7 ++++- src/service/paranet-service.js | 8 ++--- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/ot-node.js b/ot-node.js index e85a2d6801..5614b42e3d 100644 --- a/ot-node.js +++ b/ot-node.js @@ -380,7 +380,8 @@ class OTNode { } else { validParanets.push(paranetUAL); const repository = paranetService.getParanetRepositoryName(paranetUAL); - tripleStoreModuleManager.initializeParanetRepository(repository); + // 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); } diff --git a/src/modules/triple-store/implementation/ot-blazegraph/ot-blazegraph.js b/src/modules/triple-store/implementation/ot-blazegraph/ot-blazegraph.js index c89ab90af5..bf770bdede 100644 --- a/src/modules/triple-store/implementation/ot-blazegraph/ot-blazegraph.js +++ b/src/modules/triple-store/implementation/ot-blazegraph/ot-blazegraph.js @@ -9,23 +9,26 @@ class OtBlazegraph extends OtTripleStore { await Promise.all( Object.keys(this.repositories).map(async (repository) => { - const { url, name } = this.repositories[repository]; - - if (!(await this.repositoryExists(repository))) { - await axios.post( - `${url}/blazegraph/namespace`, - `com.bigdata.rdf.sail.truthMaintenance=false\ncom.bigdata.namespace.${name}.lex.com.bigdata.btree.BTree.branchingFactor=400\ncom.bigdata.rdf.store.AbstractTripleStore.textIndex=false\ncom.bigdata.rdf.store.AbstractTripleStore.justify=false\ncom.bigdata.namespace.${name}.spo.com.bigdata.btree.BTree.branchingFactor=1024\ncom.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers=false\ncom.bigdata.rdf.store.AbstractTripleStore.axiomsClass=com.bigdata.rdf.axioms.NoAxioms\ncom.bigdata.rdf.sail.namespace=${name}\ncom.bigdata.rdf.store.AbstractTripleStore.quads=true\ncom.bigdata.rdf.store.AbstractTripleStore.geoSpatial=false\ncom.bigdata.journal.Journal.groupCommit=false\ncom.bigdata.rdf.sail.isolatableIndices=false\n`, - { - headers: { - 'Content-Type': 'text/plain', - }, - }, - ); - } + await this.createRepository(repository); }), ); } + async createRepository(repository) { + const { url, name } = this.repositories[repository]; + if (!(await this.repositoryExists(repository))) { + await axios.post( + `${url}/blazegraph/namespace`, + `com.bigdata.rdf.sail.truthMaintenance=false\ncom.bigdata.namespace.${name}.lex.com.bigdata.btree.BTree.branchingFactor=400\ncom.bigdata.rdf.store.AbstractTripleStore.textIndex=false\ncom.bigdata.rdf.store.AbstractTripleStore.justify=false\ncom.bigdata.namespace.${name}.spo.com.bigdata.btree.BTree.branchingFactor=1024\ncom.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers=false\ncom.bigdata.rdf.store.AbstractTripleStore.axiomsClass=com.bigdata.rdf.axioms.NoAxioms\ncom.bigdata.rdf.sail.namespace=${name}\ncom.bigdata.rdf.store.AbstractTripleStore.quads=true\ncom.bigdata.rdf.store.AbstractTripleStore.geoSpatial=false\ncom.bigdata.journal.Journal.groupCommit=false\ncom.bigdata.rdf.sail.isolatableIndices=false\n`, + { + headers: { + 'Content-Type': 'text/plain', + }, + }, + ); + } + } + initializeSparqlEndpoints(repository) { const { url, name } = this.repositories[repository]; this.repositories[repository].sparqlEndpoint = `${url}/blazegraph/namespace/${name}/sparql`; diff --git a/src/modules/triple-store/implementation/ot-triple-store.js b/src/modules/triple-store/implementation/ot-triple-store.js index d3c7f3fab7..eaf63fa09b 100644 --- a/src/modules/triple-store/implementation/ot-triple-store.js +++ b/src/modules/triple-store/implementation/ot-triple-store.js @@ -23,7 +23,7 @@ class OtTripleStore { } } - initializeParanetRepository(repository) { + async initializeParanetRepository(repository) { const publicCurrent = 'publicCurrent'; this.repositories[repository] = { url: this.repositories[publicCurrent].url, @@ -32,6 +32,11 @@ class OtTripleStore { password: this.repositories[publicCurrent].password, }; this.initializeSparqlEndpoints(repository); + await this.createRepository(repository); + } + + async createRepository() { + throw Error('CreateRepository not implemented'); } initializeSparqlEndpoints() { diff --git a/src/service/paranet-service.js b/src/service/paranet-service.js index 339b8d28ca..f5cba821a0 100644 --- a/src/service/paranet-service.js +++ b/src/service/paranet-service.js @@ -17,11 +17,6 @@ class ParanetService { paranetId, blockchain, ); - } else { - // TODO: Write proper Error msg - throw new Error( - `Unable to get Paranet repository name. Paranet id doesn't have correct format: ${paranetId}`, - ); } } @@ -37,7 +32,8 @@ class ParanetService { getParanetRepositoryName(paranetId) { if (this.ualService.isUAL(paranetId)) { - return paranetId.replace('/', '-'); + // Replace : and / with - + return paranetId.replace(/[/:]/g, '-'); } throw new Error( `Unable to get Paranet repository name. Paranet id doesn't have correct format: ${paranetId}`, From ab7580f821fb3cfe519be77b78eb9f5a3d291cc0 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 24 May 2024 13:09:38 +0200 Subject: [PATCH 55/82] Implement get KA count for Paranet from local db --- .../sequelize/repositories/paranet-repository.js | 10 ++++++++++ src/modules/repository/repository-module-manager.js | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js index 9d9aee1dcc..da4f12deb8 100644 --- a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js @@ -49,6 +49,16 @@ class ParanetRepository { }); return !!paranetRecord; } + + async getParanetKnowledgeAssetsCount(paranetId, blockchainId) { + return this.model.findAll({ + attributes: ['ka_count'], + where: { + paranetId, + blockchainId, + }, + }); + } } export default ParanetRepository; diff --git a/src/modules/repository/repository-module-manager.js b/src/modules/repository/repository-module-manager.js index 9207400e46..b1b597015c 100644 --- a/src/modules/repository/repository-module-manager.js +++ b/src/modules/repository/repository-module-manager.js @@ -489,6 +489,13 @@ class RepositoryModuleManager extends BaseModuleManager { async getParanet(paranetId, blockchainId) { return this.getRepository('paranet').getParanet(paranetId, blockchainId); } + + async getParanetKnowledgeAssetsCount(paranetId, blockchainId) { + return this.getRepository('paranet').getParanetKnowledgeAssetsCount( + paranetId, + blockchainId, + ); + } } export default RepositoryModuleManager; From 0dc46c952b7fb1b5738181a8942ebf4b77d496bd Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 24 May 2024 13:10:07 +0200 Subject: [PATCH 56/82] Rename paranet blockchain functions --- .../blockchain/blockchain-module-manager.js | 22 ++++++++++--------- .../blockchain/implementation/web3-service.js | 15 ++++++++----- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/modules/blockchain/blockchain-module-manager.js b/src/modules/blockchain/blockchain-module-manager.js index 60c5ac1c6b..311e253385 100644 --- a/src/modules/blockchain/blockchain-module-manager.js +++ b/src/modules/blockchain/blockchain-module-manager.js @@ -261,18 +261,20 @@ class BlockchainModuleManager extends BaseModuleManager { ]); } - async getKnowledgeAssetsCount(blockchain, paranetId) { - return this.callImplementationFunction(blockchain, 'getKnowledgeAssetsCount', [paranetId]); - } - - async getKnowledgeAssetsWithPagination(blockchain, paranetId, offset, limit) { - return this.callImplementationFunction(blockchain, 'getKnowledgeAssetsWithPagination', [ + async getParanetKnowledgeAssetsCount(blockchain, paranetId) { + return this.callImplementationFunction(blockchain, 'getParanetKnowledgeAssetsCount', [ paranetId, - offset, - limit, ]); } + async getParanetKnowledgeAssetsWithPagination(blockchain, paranetId, offset, limit) { + return this.callImplementationFunction( + blockchain, + 'getParanetKnowledgeAssetsWithPagination', + [paranetId, offset, limit], + ); + } + async getAssertionData(blockchain, assertionid) { return this.callImplementationFunction(blockchain, 'getAssertionData', [assertionid]); } @@ -473,8 +475,8 @@ class BlockchainModuleManager extends BaseModuleManager { return this.callImplementationFunction(blockchain, 'getParanetMetadata', [paranetId]); } - async getKnowledgeAssetLocator(blockchain, knowledgeAssetId) { - return this.callImplementationFunction(blockchain, 'getKnowledgeAssetLocator', [ + async getParanetKnowledgeAssetLocator(blockchain, knowledgeAssetId) { + return this.callImplementationFunction(blockchain, 'getParanetKnowledgeAssetLocator', [ knowledgeAssetId, ]); } diff --git a/src/modules/blockchain/implementation/web3-service.js b/src/modules/blockchain/implementation/web3-service.js index 9dc45651b6..ccd5df4c53 100644 --- a/src/modules/blockchain/implementation/web3-service.js +++ b/src/modules/blockchain/implementation/web3-service.js @@ -1601,13 +1601,16 @@ class Web3Service { }; } - async getKnowledgeAssetsCount(paranetId) { - return this.callContractFunction(this.ParanetsRegistryContract, 'getKnowledgeAssetsCount', [ - paranetId, - ]); + async getParanetKnowledgeAssetsCount(paranetId) { + return this.callContractFunction( + this.ParanetsRegistryContract, + 'getKnowledgeAssetsCount', + [paranetId], + CONTRACTS.PARANETS_REGISTRY_CONTRACT, + ); } - async getKnowledgeAssetsWithPagination(paranetId, offset, limit) { + async getParanetKnowledgeAssetsWithPagination(paranetId, offset, limit) { return this.callContractFunction( this.ParanetsRegistryContract, 'getKnowledgeAssetsWithPagination', @@ -1625,7 +1628,7 @@ class Web3Service { ); } - async getKnowledgeAssetLocator(knowledgeAssetId) { + async getParanetKnowledgeAssetLocator(knowledgeAssetId) { const [knowledgeAssetStorageContract, tokenId] = await this.callContractFunction( this.ParanetKnowledgeAssetsRegistryContract, 'getKnowledgeAssetLocator', From d6b60f70f65f30805ef89053cd320edc240da7c8 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 24 May 2024 13:10:37 +0200 Subject: [PATCH 57/82] Fix paranet sync commands --- src/commands/paranet/paranet-sync-command.js | 41 ++++++++++--------- .../paranet/start-paranet-sync-commands.js | 2 +- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index eab250bcec..59af530605 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -19,64 +19,67 @@ class ParanetSyncCommand extends Command { this.tripleStoreService = ctx.tripleStoreService; this.ualService = ctx.ualService; this.paranetService = ctx.paranetService; + this.repositoryModuleManager = ctx.repositoryModuleManager; this.errorType = ERROR_TYPE.PARANET.PARANET_SYNC_ERROR; } async execute(command) { - const { commandOperationId, paranetUAL } = command.data; + const { operationId, paranetUAL } = command.data; const { blockchain, contract, tokenId } = this.ualService.resolveUAL(paranetUAL); const paranetId = this.paranetService.constructParanetId(blockchain, contract, tokenId); this.logger.info( - `Paranet sync: Starting paranet sync for paranetId: ${paranetId}, operation ID: ${commandOperationId}`, + `Paranet sync: Starting paranet sync for paranetId: ${paranetId}, operation ID: ${operationId}`, ); - const contractKaCount = await this.blockchainModuleManager.getKnowledgeAssetsCount( + let contractKaCount = await this.blockchainModuleManager.getParanetKnowledgeAssetsCount( blockchain, paranetId, ); - const [cachedKaCount] = await this.repositoryModuleManager.getKACount( - paranetId, - blockchain, - ); + contractKaCount = contractKaCount.toNumber(); + + const cachedKaCount = ( + await this.repositoryModuleManager.getParanetKnowledgeAssetsCount(paranetId, blockchain) + )[0].dataValues.ka_count; if (cachedKaCount === contractKaCount) { this.logger.info( - `Paranet sync: KA count from contract and in DB is the same, nothing to sync, for paranetId: ${paranetId}, operation ID: ${commandOperationId}!`, + `Paranet sync: KA count from contract and in DB is the same, nothing to sync, for paranetId: ${paranetId}, operation ID: ${operationId}!`, ); return Command.empty(); } this.logger.info( `Paranet sync: Syncing ${ - contractKaCount - cachedKaCount + 1 - } assets for paranetId: ${paranetId}, operation ID: ${commandOperationId}`, + contractKaCount - cachedKaCount + } assets for paranetId: ${paranetId}, operation ID: ${operationId}`, ); // TODO: Rename i, should it be cachedKaCount + 1 as cachedKaCount is already in, but count is index const kaToUpdate = []; for (let i = cachedKaCount; i <= contractKaCount; i += PARANET_SYNC_KA_COUNT) { - const nextKaArray = this.blockchainModuleManager.getKnowledgeAssetsWithPagination( - blockchain, - paranetId, - i, - PARANET_SYNC_KA_COUNT, - ); + const nextKaArray = + await this.blockchainModuleManager.getParanetKnowledgeAssetsWithPagination( + blockchain, + paranetId, + i, + PARANET_SYNC_KA_COUNT, + ); if (!nextKaArray.length) break; kaToUpdate.push(...nextKaArray); } // To this as batch of promises - // Wrapt it in try catch with retry + // Wrap it in try catch with retry kaToUpdate // It's array of keywords not tokenId // .map((ka) => ka.tokenId) .forEach(async (knowledgeAssetId) => { this.logger.info( - `Paranet sync: Syncing token id: ${knowledgeAssetId} for ${paranetId} with operation id: ${commandOperationId}`, + `Paranet sync: Syncing token id: ${knowledgeAssetId} for ${paranetId} with operation id: ${operationId}`, ); - const { kaContract } = this.blockchainModuleManager.getKnowledgeAssetLocator( + const { kaContract } = this.blockchainModuleManager.getParanetKnowledgeAssetLocator( blockchain, knowledgeAssetId, ); diff --git a/src/commands/paranet/start-paranet-sync-commands.js b/src/commands/paranet/start-paranet-sync-commands.js index 70fca31777..4a5ba78321 100644 --- a/src/commands/paranet/start-paranet-sync-commands.js +++ b/src/commands/paranet/start-paranet-sync-commands.js @@ -28,7 +28,7 @@ class StartParanetSyncCommands extends Command { operationId, }; - promises.append( + promises.push( this.commandExecutor.add({ name: 'paranetSyncCommand', data: commandData, From 33de523be38e911e1b032dfad0e25011655b8db2 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Mon, 27 May 2024 09:51:34 +0800 Subject: [PATCH 58/82] Add validation --- src/commands/query/query-command.js | 34 +++++++++++-------- .../v0/query-http-api-controller-v0.js | 4 +-- .../v0/request-schema/query-schema-v0.js | 5 +-- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/commands/query/query-command.js b/src/commands/query/query-command.js index 82b6f1b1be..b078558e35 100644 --- a/src/commands/query/query-command.js +++ b/src/commands/query/query-command.js @@ -21,7 +21,6 @@ class QueryCommand extends Command { queryType, operationId, repository = TRIPLE_STORE_REPOSITORIES.PRIVATE_CURRENT, - paranetUAL, } = command.data; let { query } = command.data; @@ -33,24 +32,18 @@ class QueryCommand extends Command { null, OPERATION_ID_STATUS.QUERY.QUERY_START, ); + this.validateRepositoryName(repository); // check if it's federated query const pattern = /SERVICE\s+<[^>]+>/g; const matches = query.match(pattern); if (matches) { - for (const paranetName in matches) { - // TODO: Is name gotten from paraneUAL of paranetName - const paranetRepositoryName = - this.paranetService.getParanetRepositoryByParanetName(paranetName); - if (!paranetRepositoryName) { - throw Error(`Query failed! Paranet with UAL: ${paranetName} doesn't exist`); - } - query = query.replace(paranetName, paranetRepositoryName); - } - } - if (paranetUAL) { - const paranetRepositoryName = this.paranetService.getParanetRepositoryName(paranetUAL); - if (!paranetRepositoryName) { - throw Error(`Query failed! Paranet with UAL: ${paranetUAL} doesn't exist`); + for (const repositoryInOriginalQuery in matches) { + const federatedQueryRepositoryName = + this.paranetService.getParanetRepositoryByParanetName( + repositoryInOriginalQuery, + ); + this.validateRepositoryName(federatedQueryRepositoryName); + query = query.replace(repositoryInOriginalQuery, federatedQueryRepositoryName); } } try { @@ -89,6 +82,17 @@ class QueryCommand extends Command { return Command.empty(); } + validateRepositoryName(repository) { + if ( + this.config.assetSync?.syncParanets.indexOf( + this.paranetService.getParanetRepositoryByParanetName(repository), + ) === -1 && + TRIPLE_STORE_REPOSITORIES.indexOf(repository) === -1 + ) { + throw Error(`Query failed! Repository with name: ${repository} doesn't exist`); + } + } + /** * Builds default getInitCommand * @param map diff --git a/src/controllers/http-api/v0/query-http-api-controller-v0.js b/src/controllers/http-api/v0/query-http-api-controller-v0.js index 6a92af89f5..79e2455734 100644 --- a/src/controllers/http-api/v0/query-http-api-controller-v0.js +++ b/src/controllers/http-api/v0/query-http-api-controller-v0.js @@ -10,7 +10,7 @@ class QueryController extends BaseController { } async handleRequest(req, res) { - const { query, type: queryType, paranetUAL } = req.body; + const { query, type: queryType } = req.body; const operationId = await this.operationIdService.generateOperationId( OPERATION_ID_STATUS.QUERY.QUERY_INIT_START, @@ -30,7 +30,7 @@ class QueryController extends BaseController { name: 'queryCommand', sequence: [], delay: 0, - data: { query, queryType, repository: req.body.repository, operationId, paranetUAL }, + data: { query, queryType, repository: req.body.repository, operationId }, transactional: false, }); } diff --git a/src/controllers/http-api/v0/request-schema/query-schema-v0.js b/src/controllers/http-api/v0/request-schema/query-schema-v0.js index 41cd1b5174..41f70f84f2 100644 --- a/src/controllers/http-api/v0/request-schema/query-schema-v0.js +++ b/src/controllers/http-api/v0/request-schema/query-schema-v0.js @@ -1,4 +1,4 @@ -import { QUERY_TYPES, TRIPLE_STORE_REPOSITORIES } from '../../../../constants/constants.js'; +import { QUERY_TYPES } from '../../../../constants/constants.js'; export default () => ({ type: 'object', @@ -11,9 +11,6 @@ export default () => ({ type: 'string', }, repository: { - enum: Object.values(TRIPLE_STORE_REPOSITORIES), - }, - paranetUAL: { type: 'string', }, }, From 6ee9a18e5c6941026a64a6c6c8609dbee0cca1bd Mon Sep 17 00:00:00 2001 From: NZT48 Date: Mon, 27 May 2024 09:37:53 +0200 Subject: [PATCH 59/82] Fix update KA count --- .../sequelize/repositories/paranet-repository.js | 6 +++--- src/modules/repository/repository-module-manager.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js index da4f12deb8..3f86f5904d 100644 --- a/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/paranet-repository.js @@ -28,13 +28,13 @@ class ParanetRepository { }); } - async updateParanetKaCount(paranetId, blockchain, kaCount) { - await this.model.update( + async updateParanetKaCount(paranetId, blockchainId, kaCount) { + return this.model.update( { kaCount }, { where: { paranetId, - blockchain, + blockchainId, }, }, ); diff --git a/src/modules/repository/repository-module-manager.js b/src/modules/repository/repository-module-manager.js index b1b597015c..9d01bf3eaf 100644 --- a/src/modules/repository/repository-module-manager.js +++ b/src/modules/repository/repository-module-manager.js @@ -296,8 +296,8 @@ class RepositoryModuleManager extends BaseModuleManager { return this.getRepository('paranet').getOrCreateParanet(paranetId); } - async updateParanetKaCount(paranetId, kaCount) { - return this.getRepository('paranet').updateParanetKaCount(paranetId, kaCount); + async updateParanetKaCount(paranetId, blockchainId, kaCount) { + return this.getRepository('paranet').updateParanetKaCount(paranetId, blockchainId, kaCount); } async updateServiceAgreementRecord( From fa847d174f91e6793e182cfa1ad7b8a443322e1b Mon Sep 17 00:00:00 2001 From: NZT48 Date: Mon, 27 May 2024 09:38:14 +0200 Subject: [PATCH 60/82] Fix paranet sync command --- src/commands/paranet/paranet-sync-command.js | 68 +++++++++++--------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 59af530605..c3cdafef66 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -1,5 +1,6 @@ /* eslint-disable no-unused-vars */ /* eslint-disable no-await-in-loop */ +import { setTimeout } from 'timers/promises'; import Command from '../command.js'; import { ERROR_TYPE, @@ -69,35 +70,33 @@ class ParanetSyncCommand extends Command { if (!nextKaArray.length) break; kaToUpdate.push(...nextKaArray); } - // To this as batch of promises - // Wrap it in try catch with retry - kaToUpdate - // It's array of keywords not tokenId - // .map((ka) => ka.tokenId) - .forEach(async (knowledgeAssetId) => { + + const promises = []; + // It's array of keywords not tokenId + // .map((ka) => ka.tokenId) + kaToUpdate.forEach((knowledgeAssetId) => { + promises.push(async () => { this.logger.info( `Paranet sync: Syncing token id: ${knowledgeAssetId} for ${paranetId} with operation id: ${operationId}`, ); - const { kaContract } = this.blockchainModuleManager.getParanetKnowledgeAssetLocator( - blockchain, - knowledgeAssetId, - ); + const { knowledgeAssetStorageContract, tokenId: kaTokenId } = + this.blockchainModuleManager.getParanetKnowledgeAssetLocator( + blockchain, + knowledgeAssetId, + ); - // Does this return unfainalized changes - const assertionIds = await this.blockchainModuleManager.getLatestAssertionId( + const assertionIds = await this.blockchainModuleManager.getAssertionIds( blockchain, - kaContract, - tokenId, + knowledgeAssetStorageContract, + kaTokenId, ); - // Go through all except the last one - // TODO: Do it in promises as a batch for (let stateIndex = assertionIds.length - 2; stateIndex >= 0; stateIndex -= 1) { await this.syncAsset( blockchain, - kaContract, - tokenId, + knowledgeAssetStorageContract, + kaTokenId, assertionIds, stateIndex, paranetId, @@ -112,21 +111,27 @@ class ParanetSyncCommand extends Command { // Then sync the last one, but put it in the current repo await this.syncAsset( blockchain, - kaContract, - tokenId, + knowledgeAssetStorageContract, + kaTokenId, assertionIds, assertionIds.length - 1, paranetId, - null, - false, + TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, + true, false, ); }); + }); - // TODO: Save only successful ones - // Here is the problme if one missed count will be false and we will always try to get it again - await this.repositoryModuleManager.updateParanetKaCount(paranetId, contractKaCount); + await Promise.all(promises); + // TODO: Save only successful ones + // Here is the problem if one missed count will be false and we will always try to get it again + await this.repositoryModuleManager.updateParanetKaCount( + paranetId, + blockchain, + contractKaCount, + ); return Command.repeat(); } @@ -145,9 +150,9 @@ class ParanetSyncCommand extends Command { const statePresentInParanetRepository = await this.tripleStoreService.paranetAssetExists( paranetId, + blockchain, + contract, tokenId, - stateIndex, - assertionIds, ); if (statePresentInParanetRepository) { @@ -167,7 +172,7 @@ class ParanetSyncCommand extends Command { const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); this.logger.debug( - `PARANET_SYNC: Fetching state index: ${stateIndex + 1} of ${ + `Paranet sync: Fetching state index: ${stateIndex + 1} of ${ assertionIds.length } for asset with ual: ${ual}. blockchain: ${blockchain}`, ); @@ -195,14 +200,14 @@ class ParanetSyncCommand extends Command { this.repositoryModuleManager.createOperationRecord( this.getService.getOperationName(), operationId, - OPERATION_ID_STATUS.IN_PROGRESS, + OPERATION_ID_STATUS.PENDING, ), ]); const hashFunctionId = CONTENT_ASSET_HASH_FUNCTION_ID; this.logger.debug( - `ASSET_SYNC: Get for ${ual} with operation id ${operationId} initiated. blockchain: ${blockchain}`, + `Paranet sync: Get for ${ual} with operation id ${operationId} initiated. blockchain: ${blockchain}`, ); await this.commandExecutor.add({ @@ -239,7 +244,6 @@ class ParanetSyncCommand extends Command { let attempt = 0; let getResult; do { - // TODO: Import timeout await setTimeout(SIMPLE_ASSET_SYNC_PARAMETERS.GET_RESULT_POLLING_INTERVAL_MILLIS); getResult = await this.operationIdService.getOperationIdRecord(operationId); attempt += 1; @@ -250,7 +254,7 @@ class ParanetSyncCommand extends Command { ); } catch (error) { this.logger.warn( - `ASSET_SYNC: Unable to sync tokenId: ${tokenId}, for contract: ${contract} state index: ${stateIndex} blockchain: ${blockchain}, error: ${error}`, + `Paranet sync: Unable to sync tokenId: ${tokenId}, for contract: ${contract} state index: ${stateIndex} blockchain: ${blockchain}, error: ${error}`, ); // await this.repositoryModuleManager.updateAssetSyncRecord( // blockchain, From 3db5ac82b3f69d74b54b57522f2dd7ab974dfc64 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Mon, 27 May 2024 13:07:50 +0200 Subject: [PATCH 61/82] Fix get paranet knowledge asset locator --- src/modules/blockchain/implementation/web3-service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/blockchain/implementation/web3-service.js b/src/modules/blockchain/implementation/web3-service.js index ccd5df4c53..7f5186747c 100644 --- a/src/modules/blockchain/implementation/web3-service.js +++ b/src/modules/blockchain/implementation/web3-service.js @@ -1629,12 +1629,12 @@ class Web3Service { } async getParanetKnowledgeAssetLocator(knowledgeAssetId) { - const [knowledgeAssetStorageContract, tokenId] = await this.callContractFunction( + const [knowledgeAssetStorageContract, kaTokenId] = await this.callContractFunction( this.ParanetKnowledgeAssetsRegistryContract, 'getKnowledgeAssetLocator', [knowledgeAssetId], ); - + const tokenId = kaTokenId.toNumber(); const knowledgeAssetLocator = { knowledgeAssetStorageContract, tokenId }; return knowledgeAssetLocator; } From 8f38cc757fd7fb8a869958960f4522306c1d5667 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Mon, 27 May 2024 13:08:38 +0200 Subject: [PATCH 62/82] Fix paranet exists check --- src/service/blockchain-event-listener-service.js | 1 - src/service/paranet-service.js | 2 +- src/service/triple-store-service.js | 5 +++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/service/blockchain-event-listener-service.js b/src/service/blockchain-event-listener-service.js index b5f787063c..7db60e7d83 100644 --- a/src/service/blockchain-event-listener-service.js +++ b/src/service/blockchain-event-listener-service.js @@ -586,7 +586,6 @@ class BlockchainEventListenerService { // Check if this asset is in paranet we are syncing // eslint-disable-next-line no-await-in-loop const paranetAssetExists = await this.tripleStoreService.paranetAssetExists( - paranetId, blockchain, contract, tokenId, diff --git a/src/service/paranet-service.js b/src/service/paranet-service.js index f5cba821a0..056e064256 100644 --- a/src/service/paranet-service.js +++ b/src/service/paranet-service.js @@ -36,7 +36,7 @@ class ParanetService { return paranetId.replace(/[/:]/g, '-'); } throw new Error( - `Unable to get Paranet repository name. Paranet id doesn't have correct format: ${paranetId}`, + `Unable to get Paranet repository name. Paranet id doesn't have UAL format: ${paranetId}`, ); } } diff --git a/src/service/triple-store-service.js b/src/service/triple-store-service.js index b5bef03c7c..350c33c629 100644 --- a/src/service/triple-store-service.js +++ b/src/service/triple-store-service.js @@ -311,8 +311,9 @@ class TripleStoreService { ); } - async paranetAssetExists(paranetId, blockchain, contract, tokenId) { - const repository = this.paranetService.getParanetRepositoryName(paranetId); + async paranetAssetExists(blockchain, contract, tokenId) { + const paranetUAL = this.ualService.deriveUAL(blockchain, contract, tokenId); + const repository = this.paranetService.getParanetRepositoryName(paranetUAL); return this.assetExists(repository, blockchain, contract, tokenId); } From 2ddc3ecaefbea51dee000aec854f30f2273f2661 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Mon, 27 May 2024 13:09:42 +0200 Subject: [PATCH 63/82] Fix promises for paranet syncing --- src/commands/paranet/paranet-sync-command.js | 81 ++++++++++--------- .../implementation/ot-triple-store.js | 2 + 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index c3cdafef66..0db46dcde9 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -75,52 +75,58 @@ class ParanetSyncCommand extends Command { // It's array of keywords not tokenId // .map((ka) => ka.tokenId) kaToUpdate.forEach((knowledgeAssetId) => { - promises.push(async () => { - this.logger.info( - `Paranet sync: Syncing token id: ${knowledgeAssetId} for ${paranetId} with operation id: ${operationId}`, - ); + promises.push( + (async () => { + this.logger.info( + `Paranet sync: Syncing token id: ${knowledgeAssetId} for ${paranetId} with operation id: ${operationId}`, + ); + + const { knowledgeAssetStorageContract, tokenId: kaTokenId } = + await this.blockchainModuleManager.getParanetKnowledgeAssetLocator( + blockchain, + knowledgeAssetId, + ); - const { knowledgeAssetStorageContract, tokenId: kaTokenId } = - this.blockchainModuleManager.getParanetKnowledgeAssetLocator( + const assertionIds = await this.blockchainModuleManager.getAssertionIds( blockchain, - knowledgeAssetId, + knowledgeAssetStorageContract, + kaTokenId, ); - const assertionIds = await this.blockchainModuleManager.getAssertionIds( - blockchain, - knowledgeAssetStorageContract, - kaTokenId, - ); - - for (let stateIndex = assertionIds.length - 2; stateIndex >= 0; stateIndex -= 1) { + for ( + let stateIndex = assertionIds.length - 2; + stateIndex >= 0; + stateIndex -= 1 + ) { + await this.syncAsset( + blockchain, + knowledgeAssetStorageContract, + kaTokenId, + assertionIds, + stateIndex, + paranetId, + TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, + false, + // It should never delete as it never was in storage + // But maybe will becouse this is unfainalized + stateIndex === assertionIds.length - 2, + ); + } + + // Then sync the last one, but put it in the current repo await this.syncAsset( blockchain, knowledgeAssetStorageContract, kaTokenId, assertionIds, - stateIndex, + assertionIds.length - 1, paranetId, - TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, + TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, + true, false, - // It should never delete as it never was in storage - // But maybe will becouse this is unfainalized - stateIndex === assertionIds.length - 2, ); - } - - // Then sync the last one, but put it in the current repo - await this.syncAsset( - blockchain, - knowledgeAssetStorageContract, - kaTokenId, - assertionIds, - assertionIds.length - 1, - paranetId, - TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, - true, - false, - ); - }); + })(), + ); // Immediately invoke the async function }); await Promise.all(promises); @@ -148,12 +154,7 @@ class ParanetSyncCommand extends Command { ) { try { const statePresentInParanetRepository = - await this.tripleStoreService.paranetAssetExists( - paranetId, - blockchain, - contract, - tokenId, - ); + await this.tripleStoreService.paranetAssetExists(blockchain, contract, tokenId); if (statePresentInParanetRepository) { this.logger.trace( diff --git a/src/modules/triple-store/implementation/ot-triple-store.js b/src/modules/triple-store/implementation/ot-triple-store.js index eaf63fa09b..f15649d437 100644 --- a/src/modules/triple-store/implementation/ot-triple-store.js +++ b/src/modules/triple-store/implementation/ot-triple-store.js @@ -32,6 +32,8 @@ class OtTripleStore { password: this.repositories[publicCurrent].password, }; this.initializeSparqlEndpoints(repository); + this.initializeContexts(); + await this.ensureConnections(); await this.createRepository(repository); } From ecadd66c58fd09c49a902986da0ce3cbc86127fe Mon Sep 17 00:00:00 2001 From: NZT48 Date: Mon, 27 May 2024 13:59:24 +0200 Subject: [PATCH 64/82] Fix check if paranet exists --- src/commands/paranet/paranet-sync-command.js | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 0db46dcde9..6cd799d613 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -20,6 +20,7 @@ class ParanetSyncCommand extends Command { this.tripleStoreService = ctx.tripleStoreService; this.ualService = ctx.ualService; this.paranetService = ctx.paranetService; + this.getService = ctx.getService; this.repositoryModuleManager = ctx.repositoryModuleManager; this.errorType = ERROR_TYPE.PARANET.PARANET_SYNC_ERROR; @@ -49,7 +50,7 @@ class ParanetSyncCommand extends Command { this.logger.info( `Paranet sync: KA count from contract and in DB is the same, nothing to sync, for paranetId: ${paranetId}, operation ID: ${operationId}!`, ); - return Command.empty(); + return Command.repeat(); } this.logger.info( @@ -105,6 +106,7 @@ class ParanetSyncCommand extends Command { assertionIds, stateIndex, paranetId, + tokenId, TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, false, // It should never delete as it never was in storage @@ -121,6 +123,7 @@ class ParanetSyncCommand extends Command { assertionIds, assertionIds.length - 1, paranetId, + tokenId, TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, true, false, @@ -133,11 +136,11 @@ class ParanetSyncCommand extends Command { // TODO: Save only successful ones // Here is the problem if one missed count will be false and we will always try to get it again - await this.repositoryModuleManager.updateParanetKaCount( - paranetId, - blockchain, - contractKaCount, - ); + // await this.repositoryModuleManager.updateParanetKaCount( + // paranetId, + // blockchain, + // contractKaCount, + // ); return Command.repeat(); } @@ -148,13 +151,18 @@ class ParanetSyncCommand extends Command { assertionIds, stateIndex, paranetId, + paranetTokenId, paranetRepository, latestAsset, deleteFromEarlier, ) { try { const statePresentInParanetRepository = - await this.tripleStoreService.paranetAssetExists(blockchain, contract, tokenId); + await this.tripleStoreService.paranetAssetExists( + blockchain, + contract, + paranetTokenId, + ); if (statePresentInParanetRepository) { this.logger.trace( From 7170578591953d52b14849887719dded821d31bc Mon Sep 17 00:00:00 2001 From: NZT48 Date: Mon, 27 May 2024 16:27:47 +0200 Subject: [PATCH 65/82] Fix typo and set operation status --- src/commands/paranet/paranet-sync-command.js | 3 ++- src/service/sharding-table-service.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 6cd799d613..016808e1ee 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -10,6 +10,7 @@ import { SIMPLE_ASSET_SYNC_PARAMETERS, TRIPLE_STORE_REPOSITORIES, PARANET_SYNC_KA_COUNT, + OPERATION_STATUS, } from '../../constants/constants.js'; class ParanetSyncCommand extends Command { @@ -209,7 +210,7 @@ class ParanetSyncCommand extends Command { this.repositoryModuleManager.createOperationRecord( this.getService.getOperationName(), operationId, - OPERATION_ID_STATUS.PENDING, + OPERATION_STATUS.IN_PROGRESS, ), ]); diff --git a/src/service/sharding-table-service.js b/src/service/sharding-table-service.js index aabec9b799..203417a3ab 100644 --- a/src/service/sharding-table-service.js +++ b/src/service/sharding-table-service.js @@ -128,7 +128,7 @@ class ShardingTableService { peers = peers.map((peer, index) => ({ ...peer.dataValues, index })); const keyHash = await this.hashingService.callHashFunction(hashFunctionId, key); - const soretedPeers = this.sortPeers( + const sortedPeers = this.sortPeers( blockchainId, keyHash, peers, @@ -136,7 +136,7 @@ class ShardingTableService { hashFunctionId, proximityScoreFunctionsPairId, ); - return soretedPeers; + return sortedPeers; } async sortPeers( From a28b15f8129108ea43e5a7470b9af791ffd53b41 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Tue, 28 May 2024 17:27:43 +0800 Subject: [PATCH 66/82] Remove assetSyncInsertedByCommand, it is never used --- src/commands/paranet/paranet-sync-command.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 016808e1ee..83eb5f6dd8 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -235,7 +235,6 @@ class ParanetSyncCommand extends Command { assertionId, assetSync: true, stateIndex, - assetSyncInsertedByCommand: true, paranetSync: true, paranetId, paranetRepoId: paranetRepository, From 6461ca4eea9996e613a980195f6b752de8ec248a Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Tue, 28 May 2024 17:29:05 +0800 Subject: [PATCH 67/82] Fix get arguments not propagating for paranet sync --- .../epoch-check/blockchain-epoch-check-command.js | 14 +++++++------- .../get/sender/get-schedule-messages-command.js | 5 +++++ test/bdd/steps/lib/local-blockchain.mjs | 6 +++--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js b/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js index baea3a9ec2..7dc2779b4d 100644 --- a/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js +++ b/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js @@ -431,13 +431,13 @@ class BlockchainEpochCheckCommand extends Command { transactional: false, }); } else { - await this.commandExecutor.add({ - name: 'simpleAssetSyncCommand', - sequence: ['submitCommitCommand'], - retries: COMMAND_RETRIES.SIMPLE_ASSET_SYNC, - data: commandData, - transactional: false, - }); + // await this.commandExecutor.add({ + // name: 'simpleAssetSyncCommand', + // sequence: ['submitCommitCommand'], + // retries: COMMAND_RETRIES.SIMPLE_ASSET_SYNC, + // data: commandData, + // transactional: false, + // }); } } diff --git a/src/commands/protocols/get/sender/get-schedule-messages-command.js b/src/commands/protocols/get/sender/get-schedule-messages-command.js index fdcaa750be..372d77839e 100644 --- a/src/commands/protocols/get/sender/get-schedule-messages-command.js +++ b/src/commands/protocols/get/sender/get-schedule-messages-command.js @@ -15,6 +15,11 @@ class GetScheduleMessagesCommand extends ProtocolScheduleMessagesCommand { ...super.getNextCommandData(command), state: command.data.state, assetSync: command.data.assetSync, + paranetSync: command.data.paranetSync, + paranetId: command.data.paranetId, + paranetRepoId: command.data.paranetRepoId, + paranetLatestAsset: command.data.paranetLatestAsset, + paranetDeleteFromEarlier: command.data.paranetDeleteFromEarlier, }; } diff --git a/test/bdd/steps/lib/local-blockchain.mjs b/test/bdd/steps/lib/local-blockchain.mjs index b686cec378..b142c1227d 100644 --- a/test/bdd/steps/lib/local-blockchain.mjs +++ b/test/bdd/steps/lib/local-blockchain.mjs @@ -22,9 +22,9 @@ const testParametersStorageParams = { proofWindowDurationPerc: 33, // 2 minutes updateCommitWindowDuration: 60, // 1 minute finalizationCommitsNumber: 3, - r0: 3, - r1: 5, - r2: 6, + r0: 1, + r1: 2, + r2: 3, }; /** * LocalBlockchain represent small wrapper around the Ganache. From ac242d036ebbfbdaaabc16f5190c86f6d83c213e Mon Sep 17 00:00:00 2001 From: NZT48 Date: Tue, 28 May 2024 20:43:54 +0200 Subject: [PATCH 68/82] Make asset sync work and store KA --- src/commands/paranet/paranet-sync-command.js | 2 +- src/service/get-service.js | 87 ++++++++++---------- 2 files changed, 44 insertions(+), 45 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 83eb5f6dd8..797cd26981 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -236,7 +236,7 @@ class ParanetSyncCommand extends Command { assetSync: true, stateIndex, paranetSync: true, - paranetId, + paranetId: paranetTokenId, paranetRepoId: paranetRepository, paranetLatestAsset: latestAsset, paranetDeleteFromEarlier: deleteFromEarlier, diff --git a/src/service/get-service.js b/src/service/get-service.js index 53fbf626b1..9f8d0fa634 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -89,7 +89,7 @@ class GetService extends OperationService { const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); if (assetSync) { this.logger.debug( - `ASSET_SYNC: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + `Asset sync: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, ); await this.tripleStoreService.localStoreAsset( @@ -101,60 +101,59 @@ class GetService extends OperationService { tokenId, keyword, ); + } - if (paranetSync) { - this.logger.debug( - `PARANET_ASSET_SYNC: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + if (paranetSync) { + this.logger.debug( + `Paranet sync: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); + const paranetUAL = this.ualService.deriveUAL(blockchain, contract, paranetId); + const paranetRepository = this.paranetService.getParanetRepositoryName(paranetUAL); + if (paranetLatestAsset) { + await this.tripleStoreService.localStoreAsset( + paranetRepository, + assertionId, + responseData.nquads, + blockchain, + contract, + tokenId, + keyword, ); + } else if (paranetRepoId) { + const newRepoName = `${this.paranetService.getParanetRepositoryName( + paranetId, + )}-${paranetRepoId}`; + + if (paranetDeleteFromEarlier) { + // This was the previous latest one, move it to currentHistory + this.logger.debug( + `Paranet sync: Moving asset to repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); - if (paranetLatestAsset) { - await this.tripleStoreService.localStoreAsset( - `${this.paranetService.getParanetRepositoryName(paranetId)}-${ - TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT - }`, + await this.tripleStoreService.moveAsset( + paranetRepository, assertionId, - responseData.nquads, blockchain, contract, tokenId, keyword, ); - } else if (paranetRepoId) { - const newRepoName = `${this.paranetService.getParanetRepositoryName( - paranetId, - )}-${paranetRepoId}`; - - if (paranetDeleteFromEarlier) { - // This was the previous latest one, move it to currentHistory - this.logger.debug( - `PARANET_ASSET_SYNC: Moving asset to repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, - ); - - await this.tripleStoreService.moveAsset( - newRepoName, - assertionId, - blockchain, - contract, - tokenId, - keyword, - ); - } else { - // This is one of the older assets, just update it + } else { + // This is one of the older assets, just update it - this.logger.debug( - `PARANET_ASSET_SYNC: Updating asset in repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, - ); + this.logger.debug( + `Paranet sync: Updating asset in repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); - await this.tripleStoreService.localStoreAsset( - newRepoName, - assertionId, - responseData.nquads, - blockchain, - contract, - tokenId, - keyword, - ); - } + await this.tripleStoreService.localStoreAsset( + paranetRepository, + assertionId, + responseData.nquads, + blockchain, + contract, + tokenId, + keyword, + ); } } } From d907627fddcef710b4a1a18336b4fbef7208163e Mon Sep 17 00:00:00 2001 From: NZT48 Date: Wed, 29 May 2024 00:00:32 +0200 Subject: [PATCH 69/82] Refactor get service for paranet sync --- src/commands/paranet/paranet-sync-command.js | 20 +---- .../sender/get-schedule-messages-command.js | 4 +- src/service/get-service.js | 74 +++++++------------ 3 files changed, 28 insertions(+), 70 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 797cd26981..3d4d02d329 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -169,14 +169,6 @@ class ParanetSyncCommand extends Command { this.logger.trace( `PARANET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} found in triple store blockchain: ${blockchain}`, ); - // await this.repositoryModuleManager.createAssetSyncRecord( - // blockchain, - // contract, - // tokenId, - // stateIndex, - // SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.COMPLETED, - // true, - // ); return; } @@ -199,14 +191,6 @@ class ParanetSyncCommand extends Command { OPERATION_ID_STATUS.GET.GET_INIT_START, ), - // this.repositoryModuleManager.createAssetSyncRecord( - // blockchain, - // contract, - // tokenId, - // stateIndex, - // SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.IN_PROGRESS, - // ), - this.repositoryModuleManager.createOperationRecord( this.getService.getOperationName(), operationId, @@ -236,10 +220,8 @@ class ParanetSyncCommand extends Command { assetSync: true, stateIndex, paranetSync: true, - paranetId: paranetTokenId, - paranetRepoId: paranetRepository, + paranetTokenId, paranetLatestAsset: latestAsset, - paranetDeleteFromEarlier: deleteFromEarlier, }, transactional: false, }); diff --git a/src/commands/protocols/get/sender/get-schedule-messages-command.js b/src/commands/protocols/get/sender/get-schedule-messages-command.js index 372d77839e..704bae3b56 100644 --- a/src/commands/protocols/get/sender/get-schedule-messages-command.js +++ b/src/commands/protocols/get/sender/get-schedule-messages-command.js @@ -16,10 +16,8 @@ class GetScheduleMessagesCommand extends ProtocolScheduleMessagesCommand { state: command.data.state, assetSync: command.data.assetSync, paranetSync: command.data.paranetSync, - paranetId: command.data.paranetId, - paranetRepoId: command.data.paranetRepoId, + paranetTokenId: command.data.paranetTokenId, paranetLatestAsset: command.data.paranetLatestAsset, - paranetDeleteFromEarlier: command.data.paranetDeleteFromEarlier, }; } diff --git a/src/service/get-service.js b/src/service/get-service.js index 9f8d0fa634..1f86a0f112 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -43,10 +43,8 @@ class GetService extends OperationService { assetSync, stateIndex, paranetSync, - paranetId, - paranetRepoId, + paranetTokenId, paranetLatestAsset, - paranetDeleteFromEarlier, } = command.data; const keywordsStatuses = await this.getResponsesStatuses( @@ -87,7 +85,19 @@ class GetService extends OperationService { this.logResponsesSummary(completedNumber, failedNumber); const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); - if (assetSync) { + + // Fetched old state - store it in public history repo + if (paranetSync && !paranetLatestAsset) { + await this.tripleStoreService.localStoreAsset( + TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, + assertionId, + responseData.nquads, + blockchain, + contract, + tokenId, + keyword, + ); + } else if (assetSync) { this.logger.debug( `Asset sync: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, ); @@ -101,15 +111,19 @@ class GetService extends OperationService { tokenId, keyword, ); - } - if (paranetSync) { - this.logger.debug( - `Paranet sync: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, - ); - const paranetUAL = this.ualService.deriveUAL(blockchain, contract, paranetId); - const paranetRepository = this.paranetService.getParanetRepositoryName(paranetUAL); - if (paranetLatestAsset) { + // Paranet sync for latest state + if (paranetSync) { + this.logger.debug( + `Paranet sync: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); + const paranetUAL = this.ualService.deriveUAL( + blockchain, + contract, + paranetTokenId, + ); + const paranetRepository = + this.paranetService.getParanetRepositoryName(paranetUAL); await this.tripleStoreService.localStoreAsset( paranetRepository, assertionId, @@ -119,42 +133,6 @@ class GetService extends OperationService { tokenId, keyword, ); - } else if (paranetRepoId) { - const newRepoName = `${this.paranetService.getParanetRepositoryName( - paranetId, - )}-${paranetRepoId}`; - - if (paranetDeleteFromEarlier) { - // This was the previous latest one, move it to currentHistory - this.logger.debug( - `Paranet sync: Moving asset to repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, - ); - - await this.tripleStoreService.moveAsset( - paranetRepository, - assertionId, - blockchain, - contract, - tokenId, - keyword, - ); - } else { - // This is one of the older assets, just update it - - this.logger.debug( - `Paranet sync: Updating asset in repo ${newRepoName}, with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, - ); - - await this.tripleStoreService.localStoreAsset( - paranetRepository, - assertionId, - responseData.nquads, - blockchain, - contract, - tokenId, - keyword, - ); - } } } } From 29bca57e1d28b7c2af885744095e57060f4cf0cc Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Wed, 29 May 2024 13:15:54 +0800 Subject: [PATCH 70/82] Add tracking of missed paranet KA to paranet sync command --- src/commands/paranet/paranet-sync-command.js | 70 +++++++++++++------ .../blockchain-epoch-check-command.js | 14 ++-- ...40529070000-create-missed-paranet-asset.js | 25 +++++++ .../sequelize/models/missed-paranet-asset.js | 29 ++++++++ .../missed-paranet-asset-repository.js | 36 ++++++++++ .../repository/repository-module-manager.js | 16 +++++ src/service/get-service.js | 3 + 7 files changed, 164 insertions(+), 29 deletions(-) create mode 100644 src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js create mode 100644 src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js create mode 100644 src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 3d4d02d329..917a632daf 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -47,7 +47,11 @@ class ParanetSyncCommand extends Command { await this.repositoryModuleManager.getParanetKnowledgeAssetsCount(paranetId, blockchain) )[0].dataValues.ka_count; - if (cachedKaCount === contractKaCount) { + const cachedMissedKaCount = ( + await this.repositoryModuleManager.getCountOfMissedAssetsOfParanet(paranetUAL) + )[0].dataValues.ka_count; + + if (cachedKaCount + cachedMissedKaCount === contractKaCount) { this.logger.info( `Paranet sync: KA count from contract and in DB is the same, nothing to sync, for paranetId: ${paranetId}, operation ID: ${operationId}!`, ); @@ -56,12 +60,16 @@ class ParanetSyncCommand extends Command { this.logger.info( `Paranet sync: Syncing ${ - contractKaCount - cachedKaCount + contractKaCount + cachedMissedKaCount - cachedKaCount } assets for paranetId: ${paranetId}, operation ID: ${operationId}`, ); // TODO: Rename i, should it be cachedKaCount + 1 as cachedKaCount is already in, but count is index const kaToUpdate = []; - for (let i = cachedKaCount; i <= contractKaCount; i += PARANET_SYNC_KA_COUNT) { + for ( + let i = contractKaCount + cachedMissedKaCount; + i <= contractKaCount; + i += PARANET_SYNC_KA_COUNT + ) { const nextKaArray = await this.blockchainModuleManager.getParanetKnowledgeAssetsWithPagination( blockchain, @@ -107,12 +115,13 @@ class ParanetSyncCommand extends Command { assertionIds, stateIndex, paranetId, - tokenId, + kaTokenId, TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, false, // It should never delete as it never was in storage // But maybe will becouse this is unfainalized stateIndex === assertionIds.length - 2, + paranetUAL, ); } @@ -124,24 +133,30 @@ class ParanetSyncCommand extends Command { assertionIds, assertionIds.length - 1, paranetId, - tokenId, + kaTokenId, TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, true, false, + paranetUAL, ); })(), ); // Immediately invoke the async function }); - await Promise.all(promises); + const promisesResolution = await Promise.all(promises); - // TODO: Save only successful ones - // Here is the problem if one missed count will be false and we will always try to get it again - // await this.repositoryModuleManager.updateParanetKaCount( - // paranetId, - // blockchain, - // contractKaCount, - // ); + const successfulCount = promisesResolution.reduce((count, value) => { + if (value === true) { + return count + 1; + } + return count; + }, 0); + + await this.repositoryModuleManager.updateParanetKaCount( + paranetId, + blockchain, + cachedKaCount + successfulCount, + ); return Command.repeat(); } @@ -156,7 +171,9 @@ class ParanetSyncCommand extends Command { paranetRepository, latestAsset, deleteFromEarlier, + paranetUAL, ) { + const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); try { const statePresentInParanetRepository = await this.tripleStoreService.paranetAssetExists( @@ -172,7 +189,6 @@ class ParanetSyncCommand extends Command { return; } - const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); this.logger.debug( `Paranet sync: Fetching state index: ${stateIndex + 1} of ${ assertionIds.length @@ -243,19 +259,29 @@ class ParanetSyncCommand extends Command { getResult?.status !== OPERATION_ID_STATUS.FAILED && getResult?.status !== OPERATION_ID_STATUS.COMPLETED ); + + if (getResult.status === OPERATION_ID_STATUS.FAILED) { + await this.repositoryModuleManager.createMissedParanetAssetRecord({ + blockchainId: blockchain, + ual, + paranetUal: paranetUAL, + }); + return false; + } } catch (error) { this.logger.warn( `Paranet sync: Unable to sync tokenId: ${tokenId}, for contract: ${contract} state index: ${stateIndex} blockchain: ${blockchain}, error: ${error}`, ); - // await this.repositoryModuleManager.updateAssetSyncRecord( - // blockchain, - // contract, - // tokenId, - // stateIndex, - // SIMPLE_ASSET_SYNC_PARAMETERS.STATUS.FAILED, - // true, - // ); + await this.repositoryModuleManager.createMissedParanetAssetRecord({ + blockchainId: blockchain, + ual, + paranetUal: paranetUAL, + }); + + return false; } + + return true; } /** diff --git a/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js b/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js index 7dc2779b4d..baea3a9ec2 100644 --- a/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js +++ b/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js @@ -431,13 +431,13 @@ class BlockchainEpochCheckCommand extends Command { transactional: false, }); } else { - // await this.commandExecutor.add({ - // name: 'simpleAssetSyncCommand', - // sequence: ['submitCommitCommand'], - // retries: COMMAND_RETRIES.SIMPLE_ASSET_SYNC, - // data: commandData, - // transactional: false, - // }); + await this.commandExecutor.add({ + name: 'simpleAssetSyncCommand', + sequence: ['submitCommitCommand'], + retries: COMMAND_RETRIES.SIMPLE_ASSET_SYNC, + data: commandData, + transactional: false, + }); } } diff --git a/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js b/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js new file mode 100644 index 0000000000..9f411129af --- /dev/null +++ b/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js @@ -0,0 +1,25 @@ +export const up = async ({ context: { queryInterface, Sequelize } }) => { + await queryInterface.createTable('missed_paranet_asset', { + id: { + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER, + }, + blockchainId: { + allowNull: false, + type: Sequelize.STRING, + }, + ual: { + allowNull: false, + type: Sequelize.STRING, + }, + paranetUal: { + allowNull: false, + type: Sequelize.STRING, + }, + }); +}; + +export const down = async ({ context: { queryInterface } }) => { + await queryInterface.dropTable('missed_paranet_asset'); +}; diff --git a/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js b/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js new file mode 100644 index 0000000000..3f43688541 --- /dev/null +++ b/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js @@ -0,0 +1,29 @@ +export default (sequelize, DataTypes) => { + const blockchain = sequelize.define( + 'missed_paranet_asset', + { + id: { + autoIncrement: true, + primaryKey: true, + type: DataTypes.INTEGER, + }, + blockchainId: { + allowNull: false, + type: DataTypes.STRING, + }, + ual: { + allowNull: false, + type: DataTypes.STRING, + }, + paranetUal: { + allowNull: false, + type: DataTypes.STRING, + }, + }, + { underscored: true }, + ); + blockchain.associate = () => { + // associations can be defined here + }; + return blockchain; +}; diff --git a/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js b/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js new file mode 100644 index 0000000000..ff3b1a5448 --- /dev/null +++ b/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js @@ -0,0 +1,36 @@ +class MissedParanetAssetRepository { + constructor(models) { + this.sequelize = models.sequelize; + this.model = models.operation_ids; + } + + async createMissedParanetAssetRecord(missedParanetAssset) { + return this.model.create(missedParanetAssset); + } + + async getMissedParanetAssetsRecords(blockchainId) { + return this.model.findOne({ + where: { + blockchainId, + }, + }); + } + + async removeMissedParanetAssetRecord(ual) { + await this.model.destroy({ + where: { + ual, + }, + }); + } + + async getCountOfMissedAssetsOfParanet(paranetUal) { + return this.model.count({ + where: { + paranetUal, + }, + }); + } +} + +export default MissedParanetAssetRepository; diff --git a/src/modules/repository/repository-module-manager.js b/src/modules/repository/repository-module-manager.js index 9d01bf3eaf..2f8f6ad3bc 100644 --- a/src/modules/repository/repository-module-manager.js +++ b/src/modules/repository/repository-module-manager.js @@ -496,6 +496,22 @@ class RepositoryModuleManager extends BaseModuleManager { blockchainId, ); } + + async createMissedParanetAssetRecord(missedParanetAssset) { + return this.getRepository('missed_paranet_asset').createMissedParanetAssetRecord( + missedParanetAssset, + ); + } + + async getMissedParanetAssetRecords(blockchainId) { + return this.getRepository('missed_paranet_asset').getMissedParanetAssetRecords( + blockchainId, + ); + } + + async removeMissedParanetAssetRecord(ual) { + return this.getRepository('missed_paranet_asset').removeMissedParanetAssetRecord(ual); + } } export default RepositoryModuleManager; diff --git a/src/service/get-service.js b/src/service/get-service.js index 1f86a0f112..442692b43b 100644 --- a/src/service/get-service.js +++ b/src/service/get-service.js @@ -88,6 +88,9 @@ class GetService extends OperationService { // Fetched old state - store it in public history repo if (paranetSync && !paranetLatestAsset) { + this.logger.debug( + `Paranet sync: ${responseData.nquads.length} nquads found for asset with ual: ${ual}, state index: ${stateIndex}, assertionId: ${assertionId}`, + ); await this.tripleStoreService.localStoreAsset( TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, assertionId, From 6abd37bb5a56320fc2090a63797e21dfbf579835 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Wed, 29 May 2024 13:56:30 +0800 Subject: [PATCH 71/82] Add missed asset syncing --- src/commands/paranet/paranet-sync-command.js | 102 +++++++++++++++++- ...40529070000-create-missed-paranet-asset.js | 4 + .../sequelize/models/missed-paranet-asset.js | 4 + .../missed-paranet-asset-repository.js | 14 ++- .../repository/repository-module-manager.js | 7 ++ 5 files changed, 125 insertions(+), 6 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 917a632daf..19e10d1679 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -53,15 +53,108 @@ class ParanetSyncCommand extends Command { if (cachedKaCount + cachedMissedKaCount === contractKaCount) { this.logger.info( - `Paranet sync: KA count from contract and in DB is the same, nothing to sync, for paranetId: ${paranetId}, operation ID: ${operationId}!`, + `Paranet sync: KA count from contract and in DB is the same, nothing new to sync, for paranetId: ${paranetId}, operation ID: ${operationId}!`, ); + if (cachedMissedKaCount > 0) { + this.logger.info( + `Paranet sync: Missed KA count is ${cachedMissedKaCount} syncing ${ + cachedKaCount > PARANET_SYNC_KA_COUNT + ? PARANET_SYNC_KA_COUNT + : cachedKaCount + } assets, for paranetId: ${paranetId}, operation ID: ${operationId}!`, + ); + const missedPararnetAssets = + await this.repositoryModuleManager.getMissedParanetAssetsRecords( + paranetUAL, + PARANET_SYNC_KA_COUNT, + ); + + const promises = []; + // It's array of keywords not tokenId + // .map((ka) => ka.tokenId) + missedPararnetAssets.forEach((missedPararnetAsset) => { + promises.push( + (async () => { + const { knowledgeAssetId } = missedPararnetAssets; + this.logger.info( + `Paranet sync: Syncing missed token id: ${knowledgeAssetId} for ${paranetId} with operation id: ${operationId}`, + ); + + const { knowledgeAssetStorageContract, tokenId: kaTokenId } = + await this.blockchainModuleManager.getParanetKnowledgeAssetLocator( + blockchain, + knowledgeAssetId, + ); + + const assertionIds = await this.blockchainModuleManager.getAssertionIds( + blockchain, + knowledgeAssetStorageContract, + kaTokenId, + ); + + for ( + let stateIndex = assertionIds.length - 2; + stateIndex >= 0; + stateIndex -= 1 + ) { + await this.syncAsset( + blockchain, + knowledgeAssetStorageContract, + kaTokenId, + assertionIds, + stateIndex, + paranetId, + kaTokenId, + TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, + false, + // It should never delete as it never was in storage + // But maybe will becouse this is unfainalized + stateIndex === assertionIds.length - 2, + paranetUAL, + ); + } + + // Then sync the last one, but put it in the current repo + await this.syncAsset( + blockchain, + knowledgeAssetStorageContract, + kaTokenId, + assertionIds, + assertionIds.length - 1, + paranetId, + kaTokenId, + TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, + true, + false, + paranetUAL, + ); + })(), + ); // Immediately invoke the async function + }); + + const promisesResolution = await Promise.all(promises); + + const successfulCount = promisesResolution.reduce((count, value) => { + if (value === true) { + return count + 1; + } + return count; + }, 0); + + await this.repositoryModuleManager.updateParanetKaCount( + paranetId, + blockchain, + cachedKaCount + successfulCount, + ); + return Command.repeat(); + } return Command.repeat(); } this.logger.info( `Paranet sync: Syncing ${ contractKaCount + cachedMissedKaCount - cachedKaCount - } assets for paranetId: ${paranetId}, operation ID: ${operationId}`, + } new assets for paranetId: ${paranetId}, operation ID: ${operationId}`, ); // TODO: Rename i, should it be cachedKaCount + 1 as cachedKaCount is already in, but count is index const kaToUpdate = []; @@ -122,6 +215,7 @@ class ParanetSyncCommand extends Command { // But maybe will becouse this is unfainalized stateIndex === assertionIds.length - 2, paranetUAL, + knowledgeAssetId, ); } @@ -138,6 +232,7 @@ class ParanetSyncCommand extends Command { true, false, paranetUAL, + knowledgeAssetId, ); })(), ); // Immediately invoke the async function @@ -172,6 +267,7 @@ class ParanetSyncCommand extends Command { latestAsset, deleteFromEarlier, paranetUAL, + knowledgeAssetId, ) { const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); try { @@ -265,6 +361,7 @@ class ParanetSyncCommand extends Command { blockchainId: blockchain, ual, paranetUal: paranetUAL, + knowledgeAssetId, }); return false; } @@ -276,6 +373,7 @@ class ParanetSyncCommand extends Command { blockchainId: blockchain, ual, paranetUal: paranetUAL, + knowledgeAssetId, }); return false; diff --git a/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js b/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js index 9f411129af..fdd09a5de1 100644 --- a/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js +++ b/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js @@ -17,6 +17,10 @@ export const up = async ({ context: { queryInterface, Sequelize } }) => { allowNull: false, type: Sequelize.STRING, }, + knowledgeAssetId: { + allowNull: false, + type: Sequelize.STRING, + }, }); }; diff --git a/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js b/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js index 3f43688541..af934c69ee 100644 --- a/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js +++ b/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js @@ -19,6 +19,10 @@ export default (sequelize, DataTypes) => { allowNull: false, type: DataTypes.STRING, }, + knowledgeAssetId: { + allowNull: false, + type: DataTypes.STRING, + }, }, { underscored: true }, ); diff --git a/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js b/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js index ff3b1a5448..6daab7c642 100644 --- a/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js @@ -8,12 +8,18 @@ class MissedParanetAssetRepository { return this.model.create(missedParanetAssset); } - async getMissedParanetAssetsRecords(blockchainId) { - return this.model.findOne({ + async getMissedParanetAssetsRecords(paranetUal, count = null) { + const queryOptions = { where: { - blockchainId, + paranetUal, }, - }); + }; + + if (count !== null) { + queryOptions.limit = count; + } + + return this.model.findAll(queryOptions); } async removeMissedParanetAssetRecord(ual) { diff --git a/src/modules/repository/repository-module-manager.js b/src/modules/repository/repository-module-manager.js index 2f8f6ad3bc..331f99c887 100644 --- a/src/modules/repository/repository-module-manager.js +++ b/src/modules/repository/repository-module-manager.js @@ -512,6 +512,13 @@ class RepositoryModuleManager extends BaseModuleManager { async removeMissedParanetAssetRecord(ual) { return this.getRepository('missed_paranet_asset').removeMissedParanetAssetRecord(ual); } + + async getMissedParanetAssetsRecords(paranetUal, count) { + return this.getRepository('missed_paranet_asset').getMissedParanetAssetsRecords( + paranetUal, + count, + ); + } } export default RepositoryModuleManager; From 0651265322c8a36bd7a7cae7f107c7c519356d61 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Wed, 29 May 2024 13:52:53 +0200 Subject: [PATCH 72/82] Fix missed paranet asset data model --- ...20240529070000-create-missed-paranet-asset.js | 16 +++++++++++++--- .../sequelize/models/missed-paranet-asset.js | 6 ++++++ .../missed-paranet-asset-repository.js | 6 +++--- .../sequelize/sequelize-repository.js | 2 ++ .../repository/repository-module-manager.js | 4 ++++ 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js b/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js index fdd09a5de1..938bfa739e 100644 --- a/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js +++ b/src/modules/repository/implementation/sequelize/migrations/20240529070000-create-missed-paranet-asset.js @@ -5,7 +5,7 @@ export const up = async ({ context: { queryInterface, Sequelize } }) => { primaryKey: true, type: Sequelize.INTEGER, }, - blockchainId: { + blockchain_id: { allowNull: false, type: Sequelize.STRING, }, @@ -13,14 +13,24 @@ export const up = async ({ context: { queryInterface, Sequelize } }) => { allowNull: false, type: Sequelize.STRING, }, - paranetUal: { + paranet_ual: { allowNull: false, type: Sequelize.STRING, }, - knowledgeAssetId: { + knowledge_asset_id: { allowNull: false, type: Sequelize.STRING, }, + created_at: { + allowNull: false, + type: Sequelize.DATE, + defaultValue: Sequelize.literal('NOW()'), + }, + updated_at: { + allowNull: false, + type: Sequelize.DATE, + defaultValue: Sequelize.literal('NOW()'), + }, }); }; diff --git a/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js b/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js index af934c69ee..0fb068266b 100644 --- a/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js +++ b/src/modules/repository/implementation/sequelize/models/missed-paranet-asset.js @@ -23,6 +23,12 @@ export default (sequelize, DataTypes) => { allowNull: false, type: DataTypes.STRING, }, + createdAt: { + type: DataTypes.DATE, + }, + updatedAt: { + type: DataTypes.DATE, + }, }, { underscored: true }, ); diff --git a/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js b/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js index 6daab7c642..30484391ec 100644 --- a/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/missed-paranet-asset-repository.js @@ -1,11 +1,11 @@ class MissedParanetAssetRepository { constructor(models) { this.sequelize = models.sequelize; - this.model = models.operation_ids; + this.model = models.missed_paranet_asset; } - async createMissedParanetAssetRecord(missedParanetAssset) { - return this.model.create(missedParanetAssset); + async createMissedParanetAssetRecord(missedParanetAsset) { + return this.model.create(missedParanetAsset); } async getMissedParanetAssetsRecords(paranetUal, count = null) { diff --git a/src/modules/repository/implementation/sequelize/sequelize-repository.js b/src/modules/repository/implementation/sequelize/sequelize-repository.js index 7a8f4e10c5..90ab1c7f54 100644 --- a/src/modules/repository/implementation/sequelize/sequelize-repository.js +++ b/src/modules/repository/implementation/sequelize/sequelize-repository.js @@ -16,6 +16,7 @@ import ServiceAgreementRepository from './repositories/service-agreement-reposit import ShardRepository from './repositories/shard-repository.js'; import TokenRepository from './repositories/token-repository.js'; import UserRepository from './repositories/user-repository.js'; +import MissedParanetAssetRepository from './repositories/missed-paranet-asset-repository.js'; const __dirname = fileURLToPath(new URL('.', import.meta.url)); @@ -36,6 +37,7 @@ class SequelizeRepository { command: new CommandRepository(this.models), event: new EventRepository(this.models), paranet: new ParanetRepository(this.models), + missed_paranet_asset: new MissedParanetAssetRepository(this.models), operation_id: new OperationIdRepository(this.models), operation: new OperationRepository(this.models), operation_response: new OperationResponseRepository(this.models), diff --git a/src/modules/repository/repository-module-manager.js b/src/modules/repository/repository-module-manager.js index 331f99c887..c6330d8f44 100644 --- a/src/modules/repository/repository-module-manager.js +++ b/src/modules/repository/repository-module-manager.js @@ -519,6 +519,10 @@ class RepositoryModuleManager extends BaseModuleManager { count, ); } + + async getCountOfMissedAssetsOfParanet(ual) { + return this.getRepository('missed_paranet_asset').getCountOfMissedAssetsOfParanet(ual); + } } export default RepositoryModuleManager; From 7fcfcd779820a11eaa7a0253608390e1250dcfa7 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Wed, 29 May 2024 13:54:20 +0200 Subject: [PATCH 73/82] Update paranet sync command to store missed assets --- src/commands/paranet/paranet-sync-command.js | 32 +++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 19e10d1679..880b7310f8 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -47,9 +47,8 @@ class ParanetSyncCommand extends Command { await this.repositoryModuleManager.getParanetKnowledgeAssetsCount(paranetId, blockchain) )[0].dataValues.ka_count; - const cachedMissedKaCount = ( - await this.repositoryModuleManager.getCountOfMissedAssetsOfParanet(paranetUAL) - )[0].dataValues.ka_count; + const cachedMissedKaCount = + await this.repositoryModuleManager.getCountOfMissedAssetsOfParanet(paranetUAL); if (cachedKaCount + cachedMissedKaCount === contractKaCount) { this.logger.info( @@ -72,10 +71,10 @@ class ParanetSyncCommand extends Command { const promises = []; // It's array of keywords not tokenId // .map((ka) => ka.tokenId) - missedPararnetAssets.forEach((missedPararnetAsset) => { + missedPararnetAssets.forEach((missedParanetAsset) => { promises.push( (async () => { - const { knowledgeAssetId } = missedPararnetAssets; + const { knowledgeAssetId } = missedParanetAsset; this.logger.info( `Paranet sync: Syncing missed token id: ${knowledgeAssetId} for ${paranetId} with operation id: ${operationId}`, ); @@ -104,7 +103,7 @@ class ParanetSyncCommand extends Command { assertionIds, stateIndex, paranetId, - kaTokenId, + tokenId, TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, false, // It should never delete as it never was in storage @@ -122,12 +121,14 @@ class ParanetSyncCommand extends Command { assertionIds, assertionIds.length - 1, paranetId, - kaTokenId, + tokenId, TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, true, false, paranetUAL, ); + + return true; })(), ); // Immediately invoke the async function }); @@ -135,7 +136,7 @@ class ParanetSyncCommand extends Command { const promisesResolution = await Promise.all(promises); const successfulCount = promisesResolution.reduce((count, value) => { - if (value === true) { + if (value) { return count + 1; } return count; @@ -159,7 +160,7 @@ class ParanetSyncCommand extends Command { // TODO: Rename i, should it be cachedKaCount + 1 as cachedKaCount is already in, but count is index const kaToUpdate = []; for ( - let i = contractKaCount + cachedMissedKaCount; + let i = cachedKaCount + cachedMissedKaCount; i <= contractKaCount; i += PARANET_SYNC_KA_COUNT ) { @@ -208,11 +209,11 @@ class ParanetSyncCommand extends Command { assertionIds, stateIndex, paranetId, - kaTokenId, + tokenId, TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY, false, // It should never delete as it never was in storage - // But maybe will becouse this is unfainalized + // But maybe will because this is not finalized stateIndex === assertionIds.length - 2, paranetUAL, knowledgeAssetId, @@ -227,13 +228,15 @@ class ParanetSyncCommand extends Command { assertionIds, assertionIds.length - 1, paranetId, - kaTokenId, + tokenId, TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, true, false, paranetUAL, knowledgeAssetId, ); + + return true; })(), ); // Immediately invoke the async function }); @@ -241,7 +244,7 @@ class ParanetSyncCommand extends Command { const promisesResolution = await Promise.all(promises); const successfulCount = promisesResolution.reduce((count, value) => { - if (value === true) { + if (value) { return count + 1; } return count; @@ -280,7 +283,7 @@ class ParanetSyncCommand extends Command { if (statePresentInParanetRepository) { this.logger.trace( - `PARANET_SYNC: StateIndex: ${stateIndex} for tokenId: ${tokenId} found in triple store blockchain: ${blockchain}`, + `Paranet sync: StateIndex: ${stateIndex} for tokenId: ${tokenId} found in triple store blockchain: ${blockchain}`, ); return; } @@ -302,7 +305,6 @@ class ParanetSyncCommand extends Command { blockchain, OPERATION_ID_STATUS.GET.GET_INIT_START, ), - this.repositoryModuleManager.createOperationRecord( this.getService.getOperationName(), operationId, From 3ce05ecf7ea8dd90bcfe1d643a888a660199c6b7 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 31 May 2024 09:53:30 +0200 Subject: [PATCH 74/82] Fix arguments for paranetAssetExists function --- src/commands/paranet/paranet-sync-command.js | 2 ++ src/service/triple-store-service.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/commands/paranet/paranet-sync-command.js b/src/commands/paranet/paranet-sync-command.js index 880b7310f8..a95b2ebb38 100644 --- a/src/commands/paranet/paranet-sync-command.js +++ b/src/commands/paranet/paranet-sync-command.js @@ -278,6 +278,8 @@ class ParanetSyncCommand extends Command { await this.tripleStoreService.paranetAssetExists( blockchain, contract, + tokenId, + contract, paranetTokenId, ); diff --git a/src/service/triple-store-service.js b/src/service/triple-store-service.js index 350c33c629..920d0ab7a3 100644 --- a/src/service/triple-store-service.js +++ b/src/service/triple-store-service.js @@ -311,10 +311,10 @@ class TripleStoreService { ); } - async paranetAssetExists(blockchain, contract, tokenId) { - const paranetUAL = this.ualService.deriveUAL(blockchain, contract, tokenId); + async paranetAssetExists(blockchain, kaContract, kaTokenId, paranetContract, paranetTokenId) { + const paranetUAL = this.ualService.deriveUAL(blockchain, paranetContract, paranetTokenId); const repository = this.paranetService.getParanetRepositoryName(paranetUAL); - return this.assetExists(repository, blockchain, contract, tokenId); + return this.assetExists(repository, blockchain, kaContract, kaTokenId); } async insertAssetAssertionLink(repository, blockchain, contract, tokenId, assertionId) { From de19398cdffe28ecf8d657bceb26e1a159fb0058 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 31 May 2024 09:54:07 +0200 Subject: [PATCH 75/82] Add function to construct paranet UAL --- src/service/paranet-service.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/service/paranet-service.js b/src/service/paranet-service.js index 056e064256..2313b61f46 100644 --- a/src/service/paranet-service.js +++ b/src/service/paranet-service.js @@ -30,6 +30,16 @@ class ParanetService { return this.blockchainModuleManager.keccak256(blockchain, keyword); } + constructKnowledgeAssetId(blockchain, contract, tokenId) { + const keyword = this.blockchainModuleManager.encodePacked( + blockchain, + ['address', 'uint256'], + [contract, tokenId], + ); + + return this.blockchainModuleManager.keccak256(blockchain, keyword); + } + getParanetRepositoryName(paranetId) { if (this.ualService.isUAL(paranetId)) { // Replace : and / with - From a684ab6a35c5d4f38b53c165737bf62b05cd50bb Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 31 May 2024 09:54:48 +0200 Subject: [PATCH 76/82] Add functions to check if KA is part of Paranet and find out which --- .../blockchain/blockchain-module-manager.js | 18 +++++++++++++ .../blockchain/implementation/web3-service.js | 27 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/modules/blockchain/blockchain-module-manager.js b/src/modules/blockchain/blockchain-module-manager.js index 311e253385..bfb87ab068 100644 --- a/src/modules/blockchain/blockchain-module-manager.js +++ b/src/modules/blockchain/blockchain-module-manager.js @@ -481,9 +481,27 @@ class BlockchainModuleManager extends BaseModuleManager { ]); } + async getKnowledgeAssetLocatorFromParanetId(blockchain, paranetId) { + return this.callImplementationFunction( + blockchain, + 'getKnowledgeAssetLocatorFromParanetId', + [paranetId], + ); + } + async paranetExists(blockchain, paranetId) { return this.callImplementationFunction(blockchain, 'paranetExists', [paranetId]); } + + async isParanetKnowledgeAsset(blockchain, knowledgeAssetId) { + return this.callImplementationFunction(blockchain, 'isParanetKnowledgeAsset', [ + knowledgeAssetId, + ]); + } + + async getParanetId(blockchain, knowledgeAssetId) { + return this.callImplementationFunction(blockchain, 'getParanetId', [knowledgeAssetId]); + } } export default BlockchainModuleManager; diff --git a/src/modules/blockchain/implementation/web3-service.js b/src/modules/blockchain/implementation/web3-service.js index 7f5186747c..242827db6e 100644 --- a/src/modules/blockchain/implementation/web3-service.js +++ b/src/modules/blockchain/implementation/web3-service.js @@ -1639,6 +1639,17 @@ class Web3Service { return knowledgeAssetLocator; } + async getKnowledgeAssetLocatorFromParanetId(paranetId) { + const [paranetKAStorageContract, paranetKATokenId] = await this.callContractFunction( + this.ParanetRegistryContract, + 'getKnowledgeAssetLocator', + [paranetId], + ); + const tokenId = paranetKATokenId.toNumber(); + const knowledgeAssetLocator = { paranetKAStorageContract, tokenId }; + return knowledgeAssetLocator; + } + async paranetExists(paranetId) { return this.callContractFunction( this.ParanetsRegistryContract, @@ -1647,6 +1658,22 @@ class Web3Service { CONTRACTS.PARANETS_REGISTRY_CONTRACT, ); } + + async getParanetId(knowledgeAssetId) { + return this.callContractFunction( + this.ParanetKnowledgeAssetsRegistryContract, + 'getParanetId', + [knowledgeAssetId], + ); + } + + async isParanetKnowledgeAsset(knowledgeAssetId) { + return this.callContractFunction( + this.ParanetKnowledgeAssetsRegistryContract, + 'isParanetKnowledgeAsset', + [knowledgeAssetId], + ); + } } export default Web3Service; From ced2eca44a78e3582f2d3409039d8bd4d6233d27 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 31 May 2024 10:02:16 +0200 Subject: [PATCH 77/82] Change update logic to handle paranet update with new missed asset record --- .../blockchain-event-listener-service.js | 61 ++++++++++--------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/src/service/blockchain-event-listener-service.js b/src/service/blockchain-event-listener-service.js index 7db60e7d83..c384209608 100644 --- a/src/service/blockchain-event-listener-service.js +++ b/src/service/blockchain-event-listener-service.js @@ -1,3 +1,4 @@ +/* eslint-disable no-await-in-loop */ import { setTimeout } from 'timers/promises'; import { CONTENT_ASSET_HASH_FUNCTION_ID, @@ -548,6 +549,7 @@ class BlockchainEventListenerService { tokenId, )} with keyword: ${keyword}, assertion id: ${state}.`, ); + // eslint-disable-next-line no-await-in-loop await Promise.all([ this.pendingStorageService.moveAndDeletePendingState( @@ -577,48 +579,49 @@ class BlockchainEventListenerService { ]); // eslint-disable-next-line no-await-in-loop - const paranetId = await this.paranetService.constructParanetId( + const knowledgeAssetId = await this.paranetService.constructKnowledgeAssetId( blockchain, contract, tokenId, ); - // Check if this asset is in paranet we are syncing // eslint-disable-next-line no-await-in-loop - const paranetAssetExists = await this.tripleStoreService.paranetAssetExists( - blockchain, - contract, - tokenId, - ); - if (paranetAssetExists) { - const paranetRepositoryName = - this.paranetService.getParanetRepositoryName(paranetId); + const paranetId = await this.blockchainModuleManager.getParanetId(knowledgeAssetId); + if (paranetId) { // eslint-disable-next-line no-await-in-loop - const assertionIds = await this.blockchainModuleManager.getAssertionIds( - blockchain, - contract, - tokenId, + const { + knowledgeAssetStorageContract: paranetKasContract, + tokenId: paranetTokenId, + } = await this.blockchainModuleManager.getKnowledgeAssetLocatorFromParanetId( + paranetId, ); - // Delete old asset from paranet repository - // Missing assertionId for old asset, how to get - // Penultimat assertion id is one before update that needs to be delted - // eslint-disable-next-line no-await-in-loop - await this.tripleStoreService.deleteAssertion( - paranetRepositoryName, - assertionIds[assertionIds.length - 2], + const paranetUAL = this.ualService.deriveUAL( + blockchain, + paranetKasContract, + paranetTokenId, ); - - // Insert in paranet registry - // eslint-disable-next-line no-await-in-loop - await this.tripleStoreService.moveAssetWithoutDelete( - TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT, - paranetRepositoryName, - state, + /* eslint-disable-next-line no-await-in-loop */ + const paranetAssetExists = await this.tripleStoreService.paranetAssetExists( blockchain, contract, tokenId, - keyword, + paranetKasContract, + paranetTokenId, ); + + if (paranetAssetExists) { + const kaUAL = this.ualService.deriveUAL(blockchain, contract, tokenId); + + // Create a record for missing Paranet KA + // Paranet sync command will get it from network + // eslint-disable-next-line no-await-in-loop + await this.repositoryModuleManager.createMissedParanetAssetRecord({ + blockchainId: blockchain, + ual: kaUAL, + paranetUal: paranetUAL, + knowledgeAssetId, + }); + } } } } From 8457cb2229d8d48ceda093a80dc0e21ee4df8be3 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 31 May 2024 10:03:05 +0200 Subject: [PATCH 78/82] Change update logic to handle paranet update with new missed asset record --- src/service/blockchain-event-listener-service.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/service/blockchain-event-listener-service.js b/src/service/blockchain-event-listener-service.js index c384209608..fdf8775582 100644 --- a/src/service/blockchain-event-listener-service.js +++ b/src/service/blockchain-event-listener-service.js @@ -1,4 +1,3 @@ -/* eslint-disable no-await-in-loop */ import { setTimeout } from 'timers/promises'; import { CONTENT_ASSET_HASH_FUNCTION_ID, @@ -588,10 +587,10 @@ class BlockchainEventListenerService { // eslint-disable-next-line no-await-in-loop const paranetId = await this.blockchainModuleManager.getParanetId(knowledgeAssetId); if (paranetId) { - // eslint-disable-next-line no-await-in-loop const { knowledgeAssetStorageContract: paranetKasContract, tokenId: paranetTokenId, + // eslint-disable-next-line no-await-in-loop } = await this.blockchainModuleManager.getKnowledgeAssetLocatorFromParanetId( paranetId, ); From 77266b4cc0fccb0ba3262494696ac088a640593e Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 31 May 2024 10:03:46 +0200 Subject: [PATCH 79/82] Update eslint disable comments --- src/service/blockchain-event-listener-service.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/service/blockchain-event-listener-service.js b/src/service/blockchain-event-listener-service.js index fdf8775582..85261852a5 100644 --- a/src/service/blockchain-event-listener-service.js +++ b/src/service/blockchain-event-listener-service.js @@ -599,7 +599,8 @@ class BlockchainEventListenerService { paranetKasContract, paranetTokenId, ); - /* eslint-disable-next-line no-await-in-loop */ + + // eslint-disable-next-line no-await-in-loop const paranetAssetExists = await this.tripleStoreService.paranetAssetExists( blockchain, contract, From 459087c216b35734986cadb400e8a35095df0024 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 31 May 2024 10:05:09 +0200 Subject: [PATCH 80/82] Restore local blockchain setup --- test/bdd/steps/lib/local-blockchain.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/bdd/steps/lib/local-blockchain.mjs b/test/bdd/steps/lib/local-blockchain.mjs index b142c1227d..b686cec378 100644 --- a/test/bdd/steps/lib/local-blockchain.mjs +++ b/test/bdd/steps/lib/local-blockchain.mjs @@ -22,9 +22,9 @@ const testParametersStorageParams = { proofWindowDurationPerc: 33, // 2 minutes updateCommitWindowDuration: 60, // 1 minute finalizationCommitsNumber: 3, - r0: 1, - r1: 2, - r2: 3, + r0: 3, + r1: 5, + r2: 6, }; /** * LocalBlockchain represent small wrapper around the Ganache. From 2d67f951a934536e4914982adfe98f69194a9582 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 31 May 2024 10:15:38 +0200 Subject: [PATCH 81/82] Bump version to 6.4.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 71370982ca..07103ed04b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "origintrail_node", - "version": "6.3.0", + "version": "6.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "origintrail_node", - "version": "6.3.0", + "version": "6.4.0", "license": "ISC", "dependencies": { "@comunica/query-sparql": "^2.4.3", diff --git a/package.json b/package.json index 40bbb07b82..6df62272d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "6.3.0", + "version": "6.4.0", "description": "OTNode V6", "main": "index.js", "type": "module", From 63f63f11295c5eb0f1d6a477062e821ce4781fb9 Mon Sep 17 00:00:00 2001 From: NZT48 Date: Fri, 31 May 2024 15:48:29 +0200 Subject: [PATCH 82/82] Increase paranet sync frequency to 5 min --- src/constants/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/constants.js b/src/constants/constants.js index a8d4c9c132..112a8a3767 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -152,7 +152,7 @@ export const HIGH_TRAFFIC_OPERATIONS_NUMBER_PER_HOUR = 16000; export const SHARDING_TABLE_CHECK_COMMAND_FREQUENCY_MINUTES = 30; -export const PARANET_SYNC_FREQUENCY_MILLS = 5 * 1000; +export const PARANET_SYNC_FREQUENCY_MILLS = 5 * 60 * 1000; export const SEND_TELEMETRY_COMMAND_FREQUENCY_MINUTES = 15;