From 58d937eb809bf7fab71ab424e874155aa6381bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Tesa=C5=99?= Date: Sat, 25 Nov 2023 11:44:01 +0100 Subject: [PATCH] Remove max batch size --- packages/api/README.md | 5 ----- packages/api/config/signed-api.example.json | 3 +-- packages/api/src/handlers.ts | 9 ++------- packages/api/src/schema.ts | 1 - packages/e2e/src/signed-api/signed-api.json | 1 - 5 files changed, 3 insertions(+), 16 deletions(-) diff --git a/packages/api/README.md b/packages/api/README.md index b7361fe2..5d6ccda1 100644 --- a/packages/api/README.md +++ b/packages/api/README.md @@ -161,11 +161,6 @@ dashes. The delay in seconds for the endpoint. The endpoint will only serve data that is older than the delay. -#### `maxBatchSize` - -The maximum number of signed data entries that can be inserted in one batch. This is a safety measure to prevent -spamming theAPI with large payloads. The batch is rejected if it contains more entries than this value. - #### `cache` _(optional)_ Configures the cache for the API endpoints. diff --git a/packages/api/config/signed-api.example.json b/packages/api/config/signed-api.example.json index f7aa83c7..ead93b3c 100644 --- a/packages/api/config/signed-api.example.json +++ b/packages/api/config/signed-api.example.json @@ -9,6 +9,5 @@ "delaySeconds": 15 } ], - "allowedAirnodes": ["0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"], - "maxBatchSize": 10 + "allowedAirnodes": ["0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"] } diff --git a/packages/api/src/handlers.ts b/packages/api/src/handlers.ts index a0e02d4d..4d4f2f4b 100644 --- a/packages/api/src/handlers.ts +++ b/packages/api/src/handlers.ts @@ -1,5 +1,5 @@ import { go, goSync } from '@api3/promise-utils'; -import { isEmpty, isNil, omit, size } from 'lodash'; +import { isEmpty, isNil, omit } from 'lodash'; import { getConfig } from './config'; import { deriveBeaconId, recoverSignerAddress } from './evm'; @@ -26,7 +26,7 @@ export const batchInsertData = async (requestBody: unknown): Promise allowedAirnodes.includes(signedData.airnode)) @@ -38,11 +38,6 @@ export const batchInsertData = async (requestBody: unknown): Promise maxBatchSize) { - return generateErrorResponse(400, `Maximum batch size (${maxBatchSize}) exceeded`); - } - // Check whether any duplications exist if (!isBatchUnique(batchSignedData)) return generateErrorResponse(400, 'No duplications are allowed'); diff --git a/packages/api/src/schema.ts b/packages/api/src/schema.ts index b59dd52b..886ad7c8 100644 --- a/packages/api/src/schema.ts +++ b/packages/api/src/schema.ts @@ -33,7 +33,6 @@ export type Cache = z.infer; export const configSchema = z.strictObject({ endpoints: endpointsSchema, - maxBatchSize: z.number().nonnegative().int(), cache: cacheSchema.optional(), allowedAirnodes: allowedAirnodesSchema, }); diff --git a/packages/e2e/src/signed-api/signed-api.json b/packages/e2e/src/signed-api/signed-api.json index 573aac62..8c0af5e6 100644 --- a/packages/e2e/src/signed-api/signed-api.json +++ b/packages/e2e/src/signed-api/signed-api.json @@ -9,6 +9,5 @@ "delaySeconds": 10 } ], - "maxBatchSize": 10, "allowedAirnodes": ["0xbF3137b0a7574563a23a8fC8badC6537F98197CC"] }