From 5c90bd622c57e6f7ce26c331041dc24e849f337d Mon Sep 17 00:00:00 2001 From: brkagithub Date: Thu, 19 Dec 2024 17:46:34 +0100 Subject: [PATCH 1/4] remove validation for v6 cient --- src/commands/common/validate-asset-command.js | 23 ------------------- .../get/sender/get-validate-asset-command.js | 6 +---- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/commands/common/validate-asset-command.js b/src/commands/common/validate-asset-command.js index 8b801ebd6..d18179797 100644 --- a/src/commands/common/validate-asset-command.js +++ b/src/commands/common/validate-asset-command.js @@ -3,7 +3,6 @@ import { ERROR_TYPE, OPERATION_ID_STATUS, LOCAL_STORE_TYPES, - ZERO_BYTES32, PARANET_ACCESS_POLICY, } from '../../constants/constants.js'; @@ -39,15 +38,6 @@ class ValidateAssetCommand extends Command { OPERATION_ID_STATUS.VALIDATE_ASSET_START, ); - const blockchainAssertionId = - await this.blockchainModuleManager.getKnowledgeCollectionLatestMerkleRoot( - blockchain, - contract, - tokenId, - ); - if (!blockchainAssertionId || blockchainAssertionId === ZERO_BYTES32) { - return Command.retry(); - } // TODO: Validate number of triplets and other stuff we did before so it matches like we did it in v6 const cachedData = await this.operationIdService.getCachedOperationIdData(operationId); const ual = this.ualService.deriveUAL(blockchain, contract, tokenId); @@ -55,19 +45,6 @@ class ValidateAssetCommand extends Command { // backwards compatibility const cachedAssertion = cachedData.datasetRoot || cachedData.public.assertionId; const cachedDataset = cachedData.dataset || cachedData.public.assertion; - this.logger.info( - `Validating asset's public assertion with id: ${cachedAssertion} ual: ${ual}`, - ); - if (blockchainAssertionId !== cachedAssertion) { - await this.handleError( - operationId, - blockchain, - `Invalid assertion id for asset ${ual}. Received value from blockchain: ${blockchainAssertionId}, received value from request: ${cachedData.public.assertionId}`, - this.errorType, - true, - ); - return Command.empty(); - } // V0 backwards compatibility if (cachedData.private?.assertionId && cachedData.private?.assertion) { diff --git a/src/commands/protocols/get/sender/get-validate-asset-command.js b/src/commands/protocols/get/sender/get-validate-asset-command.js index 2da61a3de..0ec742cec 100644 --- a/src/commands/protocols/get/sender/get-validate-asset-command.js +++ b/src/commands/protocols/get/sender/get-validate-asset-command.js @@ -50,11 +50,7 @@ class GetValidateAssetCommand extends ValidateAssetCommand { ); // TODO: Update to validate knowledge asset index const isValidUal = isOperationV0 - ? await this.validationService.validateUalV6( - blockchain, - contract, - knowledgeCollectionId, - ) + ? true : await this.validationService.validateUal(blockchain, contract, knowledgeCollectionId); this.operationIdService.emitChangeEvent( OPERATION_ID_STATUS.GET.GET_VALIDATE_UAL_END, From 8948bcba7057b8c585a065c09cc9f3ac90bd9a29 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Thu, 19 Dec 2024 17:47:09 +0100 Subject: [PATCH 2/4] Add Ask ABI --- src/constants/constants.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/constants.js b/src/constants/constants.js index b1b021d04..6c9bd2198 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -270,6 +270,7 @@ export const ABIs = { ShardingTableStorage: require('dkg-evm-module/abi/ShardingTableStorage.json'), ParanetsRegistry: require('dkg-evm-module/abi/ParanetsRegistry.json'), ParanetKnowledgeAssetsRegistry: require('dkg-evm-module/abi/ParanetKnowledgeAssetsRegistry.json'), + Ask: require('dkg-evm-module/abi/Ask.json'), }; export const CONTRACT_FUNCTION_PRIORITY = {}; From dd3ba3e08f9ed1c928bb9e3493ba3a288b1f3b23 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Thu, 19 Dec 2024 18:07:35 +0100 Subject: [PATCH 3/4] Fix bid suggestion --- .../v0/bid-suggestion-http-api-controller-v0.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/controllers/http-api/v0/bid-suggestion-http-api-controller-v0.js b/src/controllers/http-api/v0/bid-suggestion-http-api-controller-v0.js index 3dbb8145b..9326b62fe 100644 --- a/src/controllers/http-api/v0/bid-suggestion-http-api-controller-v0.js +++ b/src/controllers/http-api/v0/bid-suggestion-http-api-controller-v0.js @@ -8,12 +8,14 @@ class BidSuggestionController extends BaseController { async handleRequest(req, res) { try { - const { blockchain, epochsNumber, assertionSize } = req.body; - const bidSuggestion = - (await this.blockchainModuleManager.getStakeWeightedAverageAsk(blockchain)) * - epochsNumber * - assertionSize; - this.returnResponse(res, 200, { bidSuggestion }); + const { blockchain, epochsNumber, assertionSize } = req.query; + const bidSuggestion = ( + await this.blockchainModuleManager.getStakeWeightedAverageAsk(blockchain) + ) + .mul(epochsNumber) + .mul(assertionSize); + const bidSuggestionString = bidSuggestion.toString(); + this.returnResponse(res, 200, { bidSuggestion: bidSuggestionString }); } catch (error) { this.logger.error(`Unable to get bid suggestion. Error: ${error}`); this.returnResponse(res, 500, { From 34e5c009952fc0a60e64684097a78c21080e7eba Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Thu, 19 Dec 2024 18:10:09 +0100 Subject: [PATCH 4/4] version bump --- 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 e179b9118..60d5917ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "origintrail_node", - "version": "8.0.0-sigma.5", + "version": "8.0.0-sigma.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "origintrail_node", - "version": "8.0.0-sigma.5", + "version": "8.0.0-sigma.6", "license": "ISC", "dependencies": { "@comunica/query-sparql": "^2.4.3", diff --git a/package.json b/package.json index e3cdc3933..ad8c77408 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "8.0.0-sigma.5", + "version": "8.0.0-sigma.6", "description": "OTNode V8", "main": "index.js", "type": "module",