Skip to content

feat(relay): add maxTotalEventsPerReq to cap aggregate events across filters#208

Open
Thunder-Blaze wants to merge 2 commits into
hoytech:masterfrom
Thunder-Blaze:feat/max-total-events-per-req
Open

feat(relay): add maxTotalEventsPerReq to cap aggregate events across filters#208
Thunder-Blaze wants to merge 2 commits into
hoytech:masterfrom
Thunder-Blaze:feat/max-total-events-per-req

Conversation

@Thunder-Blaze

@Thunder-Blaze Thunder-Blaze commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Description

  • maxFilterLimit caps the events returned by each individual filter (default 500), but a REQ with many filters can return maxReqFilterSize * maxFilterLimit events (e.g. 200 * 500 = 100,000). There's no aggregate cap.

  • This adds relay.maxTotalEventsPerReq (default 0 = unlimited). When set, the total events sent across all filters in a single REQ is capped. Once the limit is hit, remaining filters are skipped and a warning is logged. The client still receives a normal EOSE.

Issue

  • Listed in TODO file (rate limits section)

Testing

  • Builds and runs as expected
image

Custom tests

image

@hoytech hoytech left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, thanks! I wonder if we should put a default in, instead of unlimited? Can you maybe start a discussion in the TG channel about this? My instinct would be something like 2000 or so.

@Thunder-Blaze Thunder-Blaze force-pushed the feat/max-total-events-per-req branch from 08a4650 to 72b138c Compare April 23, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants