From c422cccc3690881a61ccd4d2193f99d47eb08906 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Tue, 7 Jul 2026 09:23:07 +0100 Subject: [PATCH 1/3] fix: use payload request limit for envelope range quota (cherry picked from commit 88b8052971c63feedb932269a632d8de09f95157) --- .../beacon-node/src/network/reqresp/rateLimit.ts | 2 +- .../test/unit/network/reqresp/rateLimit.test.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 packages/beacon-node/test/unit/network/reqresp/rateLimit.test.ts diff --git a/packages/beacon-node/src/network/reqresp/rateLimit.ts b/packages/beacon-node/src/network/reqresp/rateLimit.ts index fc5d4e626625..ad0c3c76d4df 100644 --- a/packages/beacon-node/src/network/reqresp/rateLimit.ts +++ b/packages/beacon-node/src/network/reqresp/rateLimit.ts @@ -87,7 +87,7 @@ export const rateLimitQuotas: (fork: ForkName, config: BeaconConfig) => Record { + it("uses MAX_REQUEST_PAYLOADS for ExecutionPayloadEnvelopesByRange", () => { + const config = createBeaconConfig(getConfig(ForkName.gloas), ZERO_HASH); + const quotas = rateLimitQuotas(ForkName.gloas, config); + + expect(quotas[ReqRespMethod.ExecutionPayloadEnvelopesByRange].byPeer?.quota).toBe(config.MAX_REQUEST_PAYLOADS); + }); +}); From aa47829c6194f5a010ff07e1e118109264cb22b2 Mon Sep 17 00:00:00 2001 From: NC <17676176+ensi321@users.noreply.github.com> Date: Fri, 24 Jul 2026 20:32:31 -0700 Subject: [PATCH 2/3] test: override MAX_REQUEST_PAYLOADS so regression test distinguishes the two limits MAX_REQUEST_PAYLOADS and MAX_REQUEST_BLOCKS_DENEB both default to 128, so the test also passed against the previous implementation using the block limit. Verified the test now fails when the quota reads MAX_REQUEST_BLOCKS_DENEB and passes with the fix. Co-Authored-By: Claude Fable 5 --- .../beacon-node/test/unit/network/reqresp/rateLimit.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/beacon-node/test/unit/network/reqresp/rateLimit.test.ts b/packages/beacon-node/test/unit/network/reqresp/rateLimit.test.ts index ff799c1d1ca9..b27c2795402d 100644 --- a/packages/beacon-node/test/unit/network/reqresp/rateLimit.test.ts +++ b/packages/beacon-node/test/unit/network/reqresp/rateLimit.test.ts @@ -8,9 +8,12 @@ import {ReqRespMethod} from "../../../../src/network/reqresp/types.js"; describe("network / reqresp / rateLimitQuotas", () => { it("uses MAX_REQUEST_PAYLOADS for ExecutionPayloadEnvelopesByRange", () => { - const config = createBeaconConfig(getConfig(ForkName.gloas), ZERO_HASH); + // Override MAX_REQUEST_PAYLOADS to differ from MAX_REQUEST_BLOCKS_DENEB (both default to 128), + // otherwise this test cannot distinguish the two limits + const config = createBeaconConfig({...getConfig(ForkName.gloas), MAX_REQUEST_PAYLOADS: 64}, ZERO_HASH); const quotas = rateLimitQuotas(ForkName.gloas, config); + expect(config.MAX_REQUEST_PAYLOADS).not.toBe(config.MAX_REQUEST_BLOCKS_DENEB); expect(quotas[ReqRespMethod.ExecutionPayloadEnvelopesByRange].byPeer?.quota).toBe(config.MAX_REQUEST_PAYLOADS); }); }); From 1e0bca02d4733fdac18b253307a41870a5c89c55 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Tue, 4 Aug 2026 10:16:57 +0100 Subject: [PATCH 3/3] yeet test --- .../unit/network/reqresp/rateLimit.test.ts | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 packages/beacon-node/test/unit/network/reqresp/rateLimit.test.ts diff --git a/packages/beacon-node/test/unit/network/reqresp/rateLimit.test.ts b/packages/beacon-node/test/unit/network/reqresp/rateLimit.test.ts deleted file mode 100644 index b27c2795402d..000000000000 --- a/packages/beacon-node/test/unit/network/reqresp/rateLimit.test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {describe, expect, it} from "vitest"; -import {createBeaconConfig} from "@lodestar/config"; -import {getConfig} from "@lodestar/config/test-utils"; -import {ForkName} from "@lodestar/params"; -import {ZERO_HASH} from "../../../../src/constants/index.js"; -import {rateLimitQuotas} from "../../../../src/network/reqresp/rateLimit.js"; -import {ReqRespMethod} from "../../../../src/network/reqresp/types.js"; - -describe("network / reqresp / rateLimitQuotas", () => { - it("uses MAX_REQUEST_PAYLOADS for ExecutionPayloadEnvelopesByRange", () => { - // Override MAX_REQUEST_PAYLOADS to differ from MAX_REQUEST_BLOCKS_DENEB (both default to 128), - // otherwise this test cannot distinguish the two limits - const config = createBeaconConfig({...getConfig(ForkName.gloas), MAX_REQUEST_PAYLOADS: 64}, ZERO_HASH); - const quotas = rateLimitQuotas(ForkName.gloas, config); - - expect(config.MAX_REQUEST_PAYLOADS).not.toBe(config.MAX_REQUEST_BLOCKS_DENEB); - expect(quotas[ReqRespMethod.ExecutionPayloadEnvelopesByRange].byPeer?.quota).toBe(config.MAX_REQUEST_PAYLOADS); - }); -});