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.json b/package.json index 53b0c31e44..6ef9cfaab4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "8.1.2+beta.0", + "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 8a85c78795..2b0bfe7693 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, });