diff --git a/package-lock.json b/package-lock.json index cff48e98d..d4042a52b 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", 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, 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 = {}; 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, {