Skip to content

Commit e683d8f

Browse files
committed
chore: updated SEND_RAW_TRANSACTION_SIZE_LIMIT to bump the limit to 130KB
Signed-off-by: Logan Nguyen <[email protected]>
1 parent cc7944e commit e683d8f

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

packages/config-service/src/services/globalConfig.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ const _CONFIG = {
656656
envName: 'SEND_RAW_TRANSACTION_SIZE_LIMIT',
657657
type: 'number',
658658
required: false,
659-
defaultValue: 131072,
659+
defaultValue: 133120, // 130 KB
660660
},
661661
SERVER_HOST: {
662662
envName: 'SERVER_HOST',

packages/relay/src/lib/errors/JsonRpcError.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export const predefined = {
279279
code: -32001,
280280
message: 'Filter not found',
281281
}),
282-
TRANSACTION_SIZE_TOO_BIG: (actualSize: number, expectedSize: number) =>
282+
TRANSACTION_SIZE_LIMIT_EXCEEDED: (actualSize: number, expectedSize: number) =>
283283
new JsonRpcError({
284284
code: -32201,
285285
message: `Oversized data: transaction size ${actualSize}, transaction limit ${expectedSize}`,

packages/relay/src/lib/precheck.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,10 @@ export class Precheck {
326326
* @throws {JsonRpcError} If the transaction size exceeds the configured limit.
327327
*/
328328
transactionSize(tx: Transaction): void {
329-
const totalRawTransactionSizeInBytes = (tx.serialized.length - 2) / 2;
329+
const totalRawTransactionSizeInBytes = tx.serialized.replace('0x', '').length / 2;
330330
const transactionSizeLimit = constants.SEND_RAW_TRANSACTION_SIZE_LIMIT;
331331
if (totalRawTransactionSizeInBytes > transactionSizeLimit) {
332-
throw predefined.TRANSACTION_SIZE_TOO_BIG(totalRawTransactionSizeInBytes, transactionSizeLimit);
332+
throw predefined.TRANSACTION_SIZE_LIMIT_EXCEEDED(totalRawTransactionSizeInBytes, transactionSizeLimit);
333333
}
334334
}
335335

packages/relay/tests/lib/precheck.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ describe('Precheck', async function () {
689689
expect('Transaction should have been rejected');
690690
} catch (error) {
691691
expect(error).to.be.an.instanceOf(JsonRpcError);
692-
const expectedError = predefined.TRANSACTION_SIZE_TOO_BIG(
692+
const expectedError = predefined.TRANSACTION_SIZE_LIMIT_EXCEEDED(
693693
(tx.serialized.length - 2) / 2,
694694
constants.SEND_RAW_TRANSACTION_SIZE_LIMIT,
695695
);

packages/server/tests/acceptance/rpc_batch1.spec.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,10 @@ describe('@api-batch-1 RPC Server Acceptance Tests', function () {
14231423
};
14241424

14251425
const signedTx = await accounts[1].wallet.signTransaction(transaction);
1426-
const error = predefined.TRANSACTION_SIZE_TOO_BIG(132320, ConfigService.get('SEND_RAW_TRANSACTION_SIZE_LIMIT'));
1426+
const error = predefined.TRANSACTION_SIZE_LIMIT_EXCEEDED(
1427+
132320,
1428+
ConfigService.get('SEND_RAW_TRANSACTION_SIZE_LIMIT'),
1429+
);
14271430

14281431
await Assertions.assertPredefinedRpcError(error, sendRawTransaction, true, relay, [signedTx, requestDetails]);
14291432
});

0 commit comments

Comments
 (0)