Skip to content

Commit

Permalink
Merge branch 'dev' into tickets
Browse files Browse the repository at this point in the history
  • Loading branch information
BelfordZ authored Dec 2, 2024
2 parents 527b7ba + d41612a commit 16a9d69
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"deepmerge": "^4.2.2",
"ethers": "^6.13.4",
"fastify": "4.12.0",
"log4js": "^6.3.0",
"log4js": "6.9.1",
"log4js-extend": "^0.2.1",
"minimist": "^1.2.0",
"neverthrow": "^6.0.0",
Expand Down
7 changes: 7 additions & 0 deletions src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,13 @@ export function registerRoutes(server: FastifyInstance<Server, IncomingMessage,
reply.send({ success: false, error: result.error })
return
}
if (payload.maxRecords > config.maxRecordsPerRequest) {
reply.send({
success: false,
error: `AccountBucket size has exceeded the max records allowed per request. Allowed: ${config.maxRecordsPerRequest}`,
})
return
}
const data = await AccountDataProvider.provideAccountDataRequest(payload)
// Logger.mainLogger.debug('Account Data result', data)
const res = Crypto.sign({
Expand Down
2 changes: 2 additions & 0 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export interface Config {
minSigRequired: number
requiredSecurityLevel: number
}
maxRecordsPerRequest: number // this is the equiavlent of the accountBucketSize config variable used by the validators to fetch records from the archiver
}

let config: Config = {
Expand Down Expand Up @@ -242,6 +243,7 @@ let config: Config = {
minSigRequired: 1,
requiredSecurityLevel: 5
}
maxRecordsPerRequest: 200,
}
// Override default config params from config file, env vars, and cli args
export async function overrideDefaultConfig(file: string): Promise<void> {
Expand Down

0 comments on commit 16a9d69

Please sign in to comment.