diff --git a/config/config.json b/config/config.json index b516c06fb5..2902afdc26 100644 --- a/config/config.json +++ b/config/config.json @@ -162,7 +162,7 @@ } } }, - "maximumAssertionSizeInKb": 10000, + "maximumAssertionSizeInKb": 500000, "commandExecutorVerboseLoggingEnabled": false, "appDataPath": "data", "logLevel": "info", @@ -330,7 +330,7 @@ } } }, - "maximumAssertionSizeInKb": 10000, + "maximumAssertionSizeInKb": 500000, "commandExecutorVerboseLoggingEnabled": false, "appDataPath": "data", "logLevel": "trace", @@ -498,7 +498,7 @@ } } }, - "maximumAssertionSizeInKb": 10000, + "maximumAssertionSizeInKb": 500000, "commandExecutorVerboseLoggingEnabled": false, "appDataPath": "data", "logLevel": "trace", @@ -665,7 +665,7 @@ } } }, - "maximumAssertionSizeInKb": 10000, + "maximumAssertionSizeInKb": 500000, "commandExecutorVerboseLoggingEnabled": false, "appDataPath": "data", "logLevel": "trace", @@ -855,7 +855,7 @@ } } }, - "maximumAssertionSizeInKb": 10000, + "maximumAssertionSizeInKb": 500000, "commandExecutorVerboseLoggingEnabled": false, "appDataPath": "data", "logLevel": "trace", diff --git a/package-lock.json b/package-lock.json index 956f806abc..7fa412f56f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "origintrail_node", - "version": "8.1.1+beta.1", + "version": "8.1.3+beta.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "origintrail_node", - "version": "8.1.1+beta.1", + "version": "8.1.3+beta.0", "license": "ISC", "dependencies": { "@comunica/query-sparql": "^2.4.3", @@ -18,7 +18,7 @@ "@polkadot/util": "^10.1.7", "@polkadot/util-crypto": "^10.1.7", "app-root-path": "^3.1.0", - "assertion-tools": "^2.0.2", + "assertion-tools": "^2.2.0", "async": "^3.2.4", "async-mutex": "^0.3.2", "awilix": "^7.0.3", @@ -6143,8 +6143,9 @@ } }, "node_modules/assertion-tools": { - "version": "2.1.0", - "license": "ISC", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/assertion-tools/-/assertion-tools-2.2.0.tgz", + "integrity": "sha512-vLFJUG9VG7WIqdSUSWH3tRAO23yztWMwkbQ2nyFaQ97IWXCdny4TURMGvNMenWvCjMCj6uSPu4b2gzuCkfueyQ==", "dependencies": { "ethers": "^5.7.2", "jsonld": "^8.1.0", @@ -24886,7 +24887,9 @@ } }, "assertion-tools": { - "version": "2.1.0", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/assertion-tools/-/assertion-tools-2.2.0.tgz", + "integrity": "sha512-vLFJUG9VG7WIqdSUSWH3tRAO23yztWMwkbQ2nyFaQ97IWXCdny4TURMGvNMenWvCjMCj6uSPu4b2gzuCkfueyQ==", "requires": { "ethers": "^5.7.2", "jsonld": "^8.1.0", diff --git a/package.json b/package.json index 5402c69207..8464d4b3d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "8.1.1+beta.1", + "version": "8.1.3+beta.0", "description": "OTNode V8", "main": "index.js", "type": "module", @@ -73,7 +73,7 @@ "@polkadot/util": "^10.1.7", "@polkadot/util-crypto": "^10.1.7", "app-root-path": "^3.1.0", - "assertion-tools": "^2.0.2", + "assertion-tools": "^2.2.0", "async": "^3.2.4", "async-mutex": "^0.3.2", "awilix": "^7.0.3", diff --git a/src/constants/constants.js b/src/constants/constants.js index 4ec8f007ca..463beceff6 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -73,7 +73,7 @@ export const TRANSACTION_QUEUE_CONCURRENCY = 1; export const TRIPLE_STORE_CONNECT_RETRY_FREQUENCY = 10; -export const MAX_FILE_SIZE = 10000000; +export const MAX_FILE_SIZE = 524288000; export const GET_STATES = { LATEST: 'LATEST', FINALIZED: 'LATEST_FINALIZED' }; diff --git a/src/controllers/http-api/v0/local-store-http-api-controller-v0.js b/src/controllers/http-api/v0/local-store-http-api-controller-v0.js index a7a82d0064..51d20f6109 100644 --- a/src/controllers/http-api/v0/local-store-http-api-controller-v0.js +++ b/src/controllers/http-api/v0/local-store-http-api-controller-v0.js @@ -7,6 +7,7 @@ class LocalStoreController extends BaseController { this.commandExecutor = ctx.commandExecutor; this.operationIdService = ctx.operationIdService; this.dataService = ctx.dataService; + this.fileService = ctx.fileService; } async handleRequest(req, res) { @@ -23,8 +24,13 @@ class LocalStoreController extends BaseController { null, OPERATION_ID_STATUS.LOCAL_STORE.LOCAL_STORE_INIT_END, ); - - const assertions = req.body; + let assertions; + const { filePath } = req.body; + if (filePath) { + assertions = JSON.parse(await this.fileService.readFile(filePath)); + } else { + assertions = req.body; + } const cachedAssertions = { public: {}, diff --git a/src/controllers/http-api/v0/request-schema/local-store-schema-v0.js b/src/controllers/http-api/v0/request-schema/local-store-schema-v0.js index fc090858a4..39cded78f4 100644 --- a/src/controllers/http-api/v0/request-schema/local-store-schema-v0.js +++ b/src/controllers/http-api/v0/request-schema/local-store-schema-v0.js @@ -1,49 +1,82 @@ import { LOCAL_STORE_TYPES } from '../../../../constants/constants.js'; export default (argumentsObject) => ({ - type: 'array', + type: ['object', 'array'], items: { - type: 'object', - required: ['assertionId', 'assertion'], - properties: { - assertionId: { - type: 'string', - minLength: 66, - maxLength: 66, - }, - assertion: { - type: 'array', - items: { - type: 'string', + oneOf: [ + { + type: 'object', + required: ['assertionId', 'assertion'], + properties: { + assertionId: { + type: 'string', + minLength: 66, + maxLength: 66, + }, + assertion: { + type: 'array', + items: { + type: 'string', + }, + minItems: 1, + }, + blockchain: { + enum: argumentsObject.blockchainImplementationNames, + }, + contract: { + type: 'string', + minLength: 42, + maxLength: 42, + }, + tokenId: { + type: 'number', + minimum: 0, + }, + storeType: { + enum: [ + LOCAL_STORE_TYPES.TRIPLE, + LOCAL_STORE_TYPES.TRIPLE_PARANET, + LOCAL_STORE_TYPES.PENDING, + ], + }, + paranetUAL: { + type: 'string', + }, }, minItems: 1, + maxItems: 2, }, - blockchain: { - enum: argumentsObject.blockchainImplementationNames, - }, - contract: { - type: 'string', - minLength: 42, - maxLength: 42, - }, - tokenId: { - type: 'number', - minimum: 0, - }, - storeType: { - type: { - enum: [ - LOCAL_STORE_TYPES.TRIPLE, - LOCAL_STORE_TYPES.TRIPLE_PARANET, - LOCAL_STORE_TYPES.PENDING, - ], + { + type: 'object', + required: ['filePath'], + properties: { + filePath: { + type: 'string', + }, + paranetUAL: { + type: 'string', + }, + blockchain: { + enum: argumentsObject.blockchainImplementationNames, + }, + contract: { + type: 'string', + minLength: 42, + maxLength: 42, + }, + tokenId: { + type: 'number', + minimum: 0, + }, + storeType: { + enum: [ + LOCAL_STORE_TYPES.TRIPLE, + LOCAL_STORE_TYPES.TRIPLE_PARANET, + LOCAL_STORE_TYPES.PENDING, + ], + }, }, }, - paranetUAL: { - type: 'string', - }, - }, + ], }, - minItems: 1, - maxItems: 2, });