From ce9aa8a74367448b0055e6f6f94c36152988f596 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Mon, 16 Dec 2024 10:21:18 +0100 Subject: [PATCH 1/7] Add onchain validation for get --- .../v1.0.0/v1-0-0-get-request-command.js | 33 ++++++++++++------- src/service/validation-service.js | 32 +++++++++++++++--- 2 files changed, 48 insertions(+), 17 deletions(-) diff --git a/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js b/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js index 9a453f5e5..996d450dd 100644 --- a/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js +++ b/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js @@ -62,20 +62,29 @@ class GetRequestCommand extends ProtocolRequestCommand { } async handleAck(command, responseData) { + const { blockchain, contract, knowledgeCollectionId, knowledgeAssetId } = command.data; if (responseData?.assertion) { - // TODO: Add this validation - try { - await this.validationService.validateDatasetOnBlockchain( - command.data.knowledgeCollectionId, - responseData.assertion, - command.data.blockchain, - ); - } catch (e) { - return this.handleNack(command, { - errorMessage: e.message, - }); + // Only whole collection can be validated not particular KA + if (!knowledgeAssetId) { + try { + const isValid = await this.validationService.validateDatasetOnBlockchain( + responseData.assertion, + blockchain, + contract, + knowledgeCollectionId, + ); + if (!isValid) { + return this.handleNack(command, { + errorMessage: + "Merkle root of received assertion doesn't match on chain merkle root", + }); + } + } catch (e) { + return this.handleNack(command, { + errorMessage: e.message, + }); + } } - await this.operationService.processResponse( command, OPERATION_REQUEST_STATUS.COMPLETED, diff --git a/src/service/validation-service.js b/src/service/validation-service.js index 743d49c4b..35cd20d6a 100644 --- a/src/service/validation-service.js +++ b/src/service/validation-service.js @@ -38,15 +38,37 @@ class ValidationService { this.logger.info(`Assertion integrity validated! AssertionId: ${assertionId}`); } - async validateDatasetRootOnBlockchain(knowledgeCollectionId, assertionId, blockchain) { - // TODO: call contract TO DO, dont return anything or return true - return { knowledgeCollectionId, assertionId, blockchain }; + async validateDatasetRootOnBlockchain( + assertionId, + blockchain, + assetStorageContractAddress, + knowledgeCollectionId, + ) { + const blockchainAssertionRoot = + await this.blockchainModuleManager.getKnowledgeCollectionLatestMerkleRoot( + blockchain, + assetStorageContractAddress, + knowledgeCollectionId, + ); + + return assertionId === blockchainAssertionRoot; } - async validateDatasetOnBlockchain(knowledgeCollectionId, assertion, blockchain) { + // Used to validate assertion node received through network get + async validateDatasetOnBlockchain( + assertion, + blockchain, + assetStorageContractAddress, + knowledgeCollectionId, + ) { const assertionId = await this.validationModuleManager.calculateRoot(assertion); - await this.validateDatasetRootOnBlockchain(knowledgeCollectionId, assertionId, blockchain); + return this.validateDatasetRootOnBlockchain( + assertionId, + blockchain, + assetStorageContractAddress, + knowledgeCollectionId, + ); } async validateDatasetRoot(dataset, datasetRoot) { From 5f09df810dd4ec59c2d1bf57bea612afd1b2ccc6 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Mon, 16 Dec 2024 10:54:44 +0100 Subject: [PATCH 2/7] Return assertion sorted and in fields --- .../get/sender/get-find-shard-command.js | 2 +- .../implementation/ot-triple-store.js | 43 +++++++++++-------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/commands/protocols/get/sender/get-find-shard-command.js b/src/commands/protocols/get/sender/get-find-shard-command.js index f3f0e5842..2f640afbb 100644 --- a/src/commands/protocols/get/sender/get-find-shard-command.js +++ b/src/commands/protocols/get/sender/get-find-shard-command.js @@ -22,7 +22,7 @@ class GetFindShardCommand extends FindShardCommand { getOperationCommandSequence(nodePartOfShard, commandData) { const sequence = []; if (nodePartOfShard) { - sequence.push('localGetCommand'); + // sequence.push('localGetCommand'); } sequence.push('networkGetCommand'); diff --git a/src/modules/triple-store/implementation/ot-triple-store.js b/src/modules/triple-store/implementation/ot-triple-store.js index 2051af4f3..1b5dd5982 100644 --- a/src/modules/triple-store/implementation/ot-triple-store.js +++ b/src/modules/triple-store/implementation/ot-triple-store.js @@ -291,20 +291,27 @@ class OtTripleStore { await this.queryVoid(repository, query); } - async getKnowledgeCollectionNamedGraphs(repository, ual, visibility, sort) { - let visibilityFilter; - switch (visibility) { - case TRIPLES_VISIBILITY.PUBLIC: - case TRIPLES_VISIBILITY.PRIVATE: - visibilityFilter = `&& STRENDS(STR(?g), "${visibility}")`; - break; - case TRIPLES_VISIBILITY.ALL: - visibilityFilter = ''; - break; - default: - throw new Error(`Unsupported visibility: ${visibility}`); + async getKnowledgeCollectionNamedGraphs(repository, ual, visibility, sort = true) { + const assertion = {}; + if (visibility === TRIPLES_VISIBILITY.PUBLIC || visibility === TRIPLES_VISIBILITY.ALL) { + const query = ` + PREFIX schema: <${SCHEMA_CONTEXT}> + CONSTRUCT { ?s ?p ?o . } + WHERE { + GRAPH ?g { + ?s ?p ?o . + } + FILTER( + STRSTARTS(STR(?g), "${ual}/") + && STRENDS(STR(?g), "${TRIPLES_VISIBILITY.PUBLIC}") + ) + } + ${sort ? 'ORDER BY ?g ?s ?p ?o' : ''} + `; + assertion.public = await this.construct(repository, query); } - const query = ` + if (visibility === TRIPLES_VISIBILITY.PRIVATE || visibility === TRIPLES_VISIBILITY.ALL) { + const query = ` PREFIX schema: <${SCHEMA_CONTEXT}> CONSTRUCT { ?s ?p ?o . } WHERE { @@ -313,13 +320,15 @@ class OtTripleStore { } FILTER( STRSTARTS(STR(?g), "${ual}/") - ${visibilityFilter} + && STRENDS(STR(?g), "${TRIPLES_VISIBILITY.PRIVATE}") ) } - ${sort ? 'ORDER BY ?s' : ''} - `; + ${sort ? 'ORDER BY ?g ?s ?p ?o' : ''} + `; + assertion.private = await this.construct(repository, query); + } - return this.construct(repository, query); + return assertion; } async knowledgeCollectionNamedGraphsExist(repository, ual) { From ac61cc38bef0f2674ef40c39036243969953e911 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Mon, 16 Dec 2024 12:00:22 +0100 Subject: [PATCH 3/7] wip --- .../v1.0.0/v1-0-0-handle-get-request-command.js | 4 ++-- .../get/sender/v1.0.0/v1-0-0-get-request-command.js | 4 +++- src/service/triple-store-service.js | 12 +++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/commands/protocols/get/receiver/v1.0.0/v1-0-0-handle-get-request-command.js b/src/commands/protocols/get/receiver/v1.0.0/v1-0-0-handle-get-request-command.js index 173b42767..14c7e09b6 100644 --- a/src/commands/protocols/get/receiver/v1.0.0/v1-0-0-handle-get-request-command.js +++ b/src/commands/protocols/get/receiver/v1.0.0/v1-0-0-handle-get-request-command.js @@ -149,7 +149,7 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand { ...(includeMetadata && metadata && { metadata }), }; - if (assertion.length) { + if (assertion?.public?.length) { await this.operationIdService.updateOperationIdStatus( operationId, blockchain, @@ -157,7 +157,7 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand { ); } - return assertion.length + return assertion?.public?.length ? { messageType: NETWORK_MESSAGE_TYPES.RESPONSES.ACK, messageData: responseData } : { messageType: NETWORK_MESSAGE_TYPES.RESPONSES.NACK, diff --git a/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js b/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js index 996d450dd..53d9f2ff0 100644 --- a/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js +++ b/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js @@ -63,7 +63,7 @@ class GetRequestCommand extends ProtocolRequestCommand { async handleAck(command, responseData) { const { blockchain, contract, knowledgeCollectionId, knowledgeAssetId } = command.data; - if (responseData?.assertion) { + if (responseData?.assertion?.public) { // Only whole collection can be validated not particular KA if (!knowledgeAssetId) { try { @@ -84,6 +84,8 @@ class GetRequestCommand extends ProtocolRequestCommand { errorMessage: e.message, }); } + + // TODO: Validate private part } await this.operationService.processResponse( command, diff --git a/src/service/triple-store-service.js b/src/service/triple-store-service.js index 0cc782a75..b95e7feb9 100644 --- a/src/service/triple-store-service.js +++ b/src/service/triple-store-service.js @@ -342,18 +342,24 @@ class TripleStoreService { visibility, ); } + if (nquads?.public) { + nquads.public = nquads.public.split('\n').filter((line) => line !== ''); + } + if (nquads?.private) { + nquads.private = nquads.private.split('\n').filter((line) => line !== ''); + } - nquads = nquads.split('\n').filter((line) => line !== ''); + const numberOfnquads = (nquads?.public?.length ?? 0) + (nquads?.private?.length ?? 0); this.logger.debug( `Assertion: ${ual} ${ - nquads.length ? '' : 'is not' + numberOfnquads ? '' : 'is not' } found in the Triple Store's ${repository} repository.`, ); if (nquads.length) { this.logger.debug( - `Number of n-quads retrieved from the Triple Store's ${repository} repository: ${nquads.length}.`, + `Number of n-quads retrieved from the Triple Store's ${repository} repository: ${numberOfnquads}.`, ); } From df14f91c97cd8611da9b9e0d1520de741d465b27 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Mon, 16 Dec 2024 13:07:22 +0100 Subject: [PATCH 4/7] Add public assertion validation --- .../get/sender/get-find-shard-command.js | 2 +- .../protocols/get/sender/local-get-command.js | 2 +- .../v1.0.0/v1-0-0-get-request-command.js | 2 +- .../implementation/ot-triple-store.js | 58 +++++++++++-------- 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/src/commands/protocols/get/sender/get-find-shard-command.js b/src/commands/protocols/get/sender/get-find-shard-command.js index 2f640afbb..f3f0e5842 100644 --- a/src/commands/protocols/get/sender/get-find-shard-command.js +++ b/src/commands/protocols/get/sender/get-find-shard-command.js @@ -22,7 +22,7 @@ class GetFindShardCommand extends FindShardCommand { getOperationCommandSequence(nodePartOfShard, commandData) { const sequence = []; if (nodePartOfShard) { - // sequence.push('localGetCommand'); + sequence.push('localGetCommand'); } sequence.push('networkGetCommand'); diff --git a/src/commands/protocols/get/sender/local-get-command.js b/src/commands/protocols/get/sender/local-get-command.js index 0e501025f..3060c0f98 100644 --- a/src/commands/protocols/get/sender/local-get-command.js +++ b/src/commands/protocols/get/sender/local-get-command.js @@ -137,7 +137,7 @@ class LocalGetCommand extends Command { assertion, ...(includeMetadata && metadata && { metadata }), }; - if (assertion.length) { + if (assertion?.public?.length || assertion?.private?.length) { await this.operationService.markOperationAsCompleted( operationId, blockchain, diff --git a/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js b/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js index 53d9f2ff0..8eff1361a 100644 --- a/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js +++ b/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js @@ -68,7 +68,7 @@ class GetRequestCommand extends ProtocolRequestCommand { if (!knowledgeAssetId) { try { const isValid = await this.validationService.validateDatasetOnBlockchain( - responseData.assertion, + responseData.assertion.public, blockchain, contract, knowledgeCollectionId, diff --git a/src/modules/triple-store/implementation/ot-triple-store.js b/src/modules/triple-store/implementation/ot-triple-store.js index 1b5dd5982..66d90fb03 100644 --- a/src/modules/triple-store/implementation/ot-triple-store.js +++ b/src/modules/triple-store/implementation/ot-triple-store.js @@ -291,40 +291,52 @@ class OtTripleStore { await this.queryVoid(repository, query); } - async getKnowledgeCollectionNamedGraphs(repository, ual, visibility, sort = true) { + async getKnowledgeCollectionNamedGraphs(repository, ual, visibility) { const assertion = {}; if (visibility === TRIPLES_VISIBILITY.PUBLIC || visibility === TRIPLES_VISIBILITY.ALL) { const query = ` - PREFIX schema: <${SCHEMA_CONTEXT}> - CONSTRUCT { ?s ?p ?o . } + PREFIX schema: + CONSTRUCT { + ?s ?p ?o . + } WHERE { - GRAPH ?g { - ?s ?p ?o . + { + SELECT ?s ?p ?o ?g + WHERE { + GRAPH ?g { + ?s ?p ?o . + } + FILTER ( + STRSTARTS(STR(?g), "${ual}") + && STRENDS(STR(?g), "${TRIPLES_VISIBILITY.PUBLIC}") + ) + } + ORDER BY ?g ?s ?p ?o } - FILTER( - STRSTARTS(STR(?g), "${ual}/") - && STRENDS(STR(?g), "${TRIPLES_VISIBILITY.PUBLIC}") - ) - } - ${sort ? 'ORDER BY ?g ?s ?p ?o' : ''} - `; + }`; assertion.public = await this.construct(repository, query); } if (visibility === TRIPLES_VISIBILITY.PRIVATE || visibility === TRIPLES_VISIBILITY.ALL) { const query = ` - PREFIX schema: <${SCHEMA_CONTEXT}> - CONSTRUCT { ?s ?p ?o . } - WHERE { - GRAPH ?g { + PREFIX schema: + CONSTRUCT { ?s ?p ?o . } - FILTER( - STRSTARTS(STR(?g), "${ual}/") - && STRENDS(STR(?g), "${TRIPLES_VISIBILITY.PRIVATE}") - ) - } - ${sort ? 'ORDER BY ?g ?s ?p ?o' : ''} - `; + WHERE { + { + SELECT ?s ?p ?o ?g + WHERE { + GRAPH ?g { + ?s ?p ?o . + } + FILTER ( + STRSTARTS(STR(?g), "${ual}") + && STRENDS(STR(?g), "${TRIPLES_VISIBILITY.PRIVATE}") + ) + } + ORDER BY ?g ?s ?p ?o + } + }`; assertion.private = await this.construct(repository, query); } From 5f84fa7a2edff4f7de8a03e866ee5be1478a8135 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Mon, 16 Dec 2024 13:40:02 +0100 Subject: [PATCH 5/7] Add private root validation --- .../v1.0.0/v1-0-0-get-request-command.js | 15 ++++---- .../sender/publish-validate-asset-command.js | 14 ++------ src/service/validation-service.js | 36 +++++++++++++++---- 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js b/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js index 8eff1361a..c46a393dd 100644 --- a/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js +++ b/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js @@ -67,25 +67,22 @@ class GetRequestCommand extends ProtocolRequestCommand { // Only whole collection can be validated not particular KA if (!knowledgeAssetId) { try { - const isValid = await this.validationService.validateDatasetOnBlockchain( + await this.validationService.validateDatasetOnBlockchain( responseData.assertion.public, blockchain, contract, knowledgeCollectionId, ); - if (!isValid) { - return this.handleNack(command, { - errorMessage: - "Merkle root of received assertion doesn't match on chain merkle root", - }); - } + if (responseData.assertion?.private?.length) + await this.validationService.validatePrivateMerkleRoot( + responseData.assertion.public, + responseData.assertion.private, + ); } catch (e) { return this.handleNack(command, { errorMessage: e.message, }); } - - // TODO: Validate private part } await this.operationService.processResponse( command, diff --git a/src/commands/protocols/publish/sender/publish-validate-asset-command.js b/src/commands/protocols/publish/sender/publish-validate-asset-command.js index d6e1fa84c..bfdce4339 100644 --- a/src/commands/protocols/publish/sender/publish-validate-asset-command.js +++ b/src/commands/protocols/publish/sender/publish-validate-asset-command.js @@ -5,7 +5,6 @@ import { ERROR_TYPE, LOCAL_STORE_TYPES, PARANET_ACCESS_POLICY, - PRIVATE_ASSERTION_PREDICATE, } from '../../../../constants/constants.js'; class PublishValidateAssetCommand extends ValidateAssetCommand { @@ -62,18 +61,11 @@ class PublishValidateAssetCommand extends ValidateAssetCommand { ); await this.validationService.validateDatasetRoot(cachedData.dataset.public, datasetRoot); - const privateAssertionTriple = cachedData.dataset.public.find((triple) => - triple.includes(PRIVATE_ASSERTION_PREDICATE), - ); - - if (privateAssertionTriple) { - const privateAssertionRoot = privateAssertionTriple.split(' ')[2].slice(1, -1); - - await this.validationService.validateDatasetRoot( + if (cachedData.dataset?.private?.length) + await this.validationService.validatePrivateMerkleRoot( + cachedData.dataset.public, cachedData.dataset.private, - privateAssertionRoot, ); - } this.operationIdService.emitChangeEvent( OPERATION_ID_STATUS.PUBLISH.PUBLISH_VALIDATE_DATASET_ROOT_END, diff --git a/src/service/validation-service.js b/src/service/validation-service.js index 35cd20d6a..582ec1773 100644 --- a/src/service/validation-service.js +++ b/src/service/validation-service.js @@ -1,4 +1,4 @@ -import { ZERO_ADDRESS } from '../constants/constants.js'; +import { ZERO_ADDRESS, PRIVATE_ASSERTION_PREDICATE } from '../constants/constants.js'; class ValidationService { constructor(ctx) { @@ -39,7 +39,7 @@ class ValidationService { } async validateDatasetRootOnBlockchain( - assertionId, + knowledgeCollectionMerkleRoot, blockchain, assetStorageContractAddress, knowledgeCollectionId, @@ -51,7 +51,11 @@ class ValidationService { knowledgeCollectionId, ); - return assertionId === blockchainAssertionRoot; + if (knowledgeCollectionMerkleRoot !== blockchainAssertionRoot) { + throw new Error( + `Merkle Root validation failed. Merkle Root on chain: ${blockchainAssertionRoot}; Calculated Merkle Root: ${knowledgeCollectionMerkleRoot}`, + ); + } } // Used to validate assertion node received through network get @@ -61,10 +65,12 @@ class ValidationService { assetStorageContractAddress, knowledgeCollectionId, ) { - const assertionId = await this.validationModuleManager.calculateRoot(assertion); + const knowledgeCollectionMerkleRoot = await this.validationModuleManager.calculateRoot( + assertion, + ); - return this.validateDatasetRootOnBlockchain( - assertionId, + await this.validateDatasetRootOnBlockchain( + knowledgeCollectionMerkleRoot, blockchain, assetStorageContractAddress, knowledgeCollectionId, @@ -80,6 +86,24 @@ class ValidationService { ); } } + + async validatePrivateMerkleRoot(publicAssertion, privateAssertion) { + const privateAssertionTriple = publicAssertion.find((triple) => + triple.includes(PRIVATE_ASSERTION_PREDICATE), + ); + + if (privateAssertionTriple) { + const privateAssertionRoot = privateAssertionTriple.split(' ')[2].slice(1, -1); + + await this.validationService.validateDatasetRoot( + privateAssertion, + privateAssertionRoot, + ); + } + throw new Error( + `Merkle Root validation failed. Private Merkle Root not present in public assertion.`, + ); + } } export default ValidationService; From ec30d04c67c7f3f95b2328f770c881bd4c33d0a1 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Mon, 16 Dec 2024 13:57:00 +0100 Subject: [PATCH 6/7] Updated publish validation --- ...blish-validate-asset-blockchain-command.js | 36 +++++-------------- src/service/validation-service.js | 10 +++--- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/commands/protocols/publish/sender/publish-validate-asset-blockchain-command.js b/src/commands/protocols/publish/sender/publish-validate-asset-blockchain-command.js index c51f6247c..808629850 100644 --- a/src/commands/protocols/publish/sender/publish-validate-asset-blockchain-command.js +++ b/src/commands/protocols/publish/sender/publish-validate-asset-blockchain-command.js @@ -1,11 +1,11 @@ import ValidateAssetCommand from '../../../common/validate-asset-command.js'; -import Command from '../../../command.js'; -import { OPERATION_ID_STATUS, ZERO_BYTES32 } from '../../../../constants/constants.js'; +import { OPERATION_ID_STATUS } from '../../../../constants/constants.js'; class PublishValidateAssetBlockchainCommand extends ValidateAssetCommand { constructor(ctx) { super(ctx); this.operationService = ctx.publishService; + this.validationService = ctx.validationService; } async handleError(operationId, blockchain, errorMessage, errorType) { @@ -29,37 +29,17 @@ class PublishValidateAssetBlockchainCommand extends ValidateAssetCommand { blockchain, OPERATION_ID_STATUS.VALIDATE_ASSET_BLOCKCHAIN_START, ); - - const blockchainAssertionId = - await this.blockchainModuleManager.getKnowledgeCollectionMerkleRoot( - blockchain, - contract, - tokenId, - ); - if (!blockchainAssertionId || blockchainAssertionId === ZERO_BYTES32) { - return Command.retry(); - } - - const { dataset: cachedData } = await this.operationIdService.getCachedOperationIdData( - operationId, - ); const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); this.logger.debug( `Validating asset's public assertion with id: ${datasetRoot} ual: ${ual}`, ); - if (blockchainAssertionId !== datasetRoot) { - await this.handleError( - operationId, - blockchain, - `Invalid assertion id for asset ${ual}. Received value from blockchain: ${blockchainAssertionId}, received value from request: ${datasetRoot}`, - this.errorType, - true, - ); - return Command.empty(); - } - - await this.validationService.validateDatasetRoot(cachedData, datasetRoot); + await this.validationService.validateDatasetRootOnBlockchain( + datasetRoot, + blockchain, + contract, + tokenId, + ); await this.operationIdService.updateOperationIdStatus( operationId, diff --git a/src/service/validation-service.js b/src/service/validation-service.js index 582ec1773..286f483ca 100644 --- a/src/service/validation-service.js +++ b/src/service/validation-service.js @@ -95,14 +95,12 @@ class ValidationService { if (privateAssertionTriple) { const privateAssertionRoot = privateAssertionTriple.split(' ')[2].slice(1, -1); - await this.validationService.validateDatasetRoot( - privateAssertion, - privateAssertionRoot, + await this.validateDatasetRoot(privateAssertion, privateAssertionRoot); + } else { + throw new Error( + `Merkle Root validation failed. Private Merkle Root not present in public assertion.`, ); } - throw new Error( - `Merkle Root validation failed. Private Merkle Root not present in public assertion.`, - ); } } From a1dbbbc89f46cca90b9686475b771c8e01ba0842 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Mon, 16 Dec 2024 13:58:52 +0100 Subject: [PATCH 7/7] Add comment --- .../protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js b/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js index c46a393dd..786001ab3 100644 --- a/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js +++ b/src/commands/protocols/get/sender/v1.0.0/v1-0-0-get-request-command.js @@ -73,6 +73,8 @@ class GetRequestCommand extends ProtocolRequestCommand { contract, knowledgeCollectionId, ); + + // This is added as support when get starts supporting private for curated paranet if (responseData.assertion?.private?.length) await this.validationService.validatePrivateMerkleRoot( responseData.assertion.public,