Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/beacon-node/src/network/reqresp/rateLimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const rateLimitQuotas: (fork: ForkName, config: BeaconConfig) => Record<R
),
},
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: {
byPeer: {quota: config.MAX_REQUEST_BLOCKS_DENEB, quotaTimeMs: 10_000},
byPeer: {quota: config.MAX_REQUEST_PAYLOADS, quotaTimeMs: 10_000},
getRequestCount: getRequestCountFn(
fork,
config,
Expand Down
19 changes: 19 additions & 0 deletions packages/beacon-node/test/unit/network/reqresp/rateLimit.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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);
Comment thread
nflaig marked this conversation as resolved.
Resolved
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);
});
});
Loading