Skip to content

feat(evmrpc): configurable batch request limit and batch response size#3636

Open
amir-deris wants to merge 2 commits into
mainfrom
amir/plt-703-evmrpc-configure-batch-fields
Open

feat(evmrpc): configurable batch request limit and batch response size#3636
amir-deris wants to merge 2 commits into
mainfrom
amir/plt-703-evmrpc-configure-batch-fields

Conversation

@amir-deris

@amir-deris amir-deris commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Describe your changes and provide context

Adds two new EVM JSON-RPC config fields to bound the size of batched JSON-RPC calls (PLT-703):

  • evm.batch_request_limit — maximum number of requests allowed in a single JSON-RPC batch. Default 1000.
  • evm.batch_response_max_size — maximum number of bytes returned from a batched JSON-RPC call. Default 25MB (25 * 1000 * 1000).

Both apply to HTTP and WebSocket endpoints, and both can be set to 0 to disable the limit. The values are wired through to go-ethereum's batchItemLimit / batchResponseSizeLimit on the HTTP and WebSocket server configs in evmrpc/server.go.

Changes:

  • evmrpc/config/config.go — new Config fields, defaults, flag names, ReadConfig parsing, and app.toml template entries with documentation.
  • evmrpc/server.go — populate batchItemLimit / batchResponseSizeLimit for both the HTTP and WebSocket servers.

Testing performed to validate your change

  • evmrpc/config/config_test.go:
    • Added bad-type cases to TestReadConfig for both new fields.
    • Added TestReadConfigBatchLimits covering defaults flowing through and custom values (including 0 to disable) being parsed.
  • go test ./evmrpc/config/...

@amir-deris amir-deris self-assigned this Jun 24, 2026
@amir-deris amir-deris changed the title Added batch request limit and batch response size limit to config feat(evmrpc): configurable batch request limit and batch response size Jun 24, 2026
@cursor

cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Operational RPC hardening with conservative defaults; misconfiguration could reject large batches but does not change consensus or auth paths.

Overview
Adds configurable caps on JSON-RPC batch traffic for EVM HTTP and WebSocket: evm.batch_request_limit (default 1000 sub-requests per batch) and evm.batch_response_max_size (default 25MB). Either can be set to 0 to turn the limit off.

New fields are defined on EVM RPC config with app.toml template/docs, loaded via ReadConfig, and passed into go-ethereum’s SetBatchLimits through batchItemLimit / batchResponseSizeLimit on both HTTP and WS server setup in server.go.

Config tests cover bad types, defaults when unset, and custom values including 0 to disable.

Reviewed by Cursor Bugbot for commit a1ed39b. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 24, 2026, 4:35 PM

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 58.15%. Comparing base (197fe21) to head (a1ed39b).

Files with missing lines Patch % Lines
evmrpc/server.go 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3636      +/-   ##
==========================================
- Coverage   59.03%   58.15%   -0.88%     
==========================================
  Files        2252     2176      -76     
  Lines      185682   176902    -8780     
==========================================
- Hits       109625   102885    -6740     
+ Misses      66248    64930    -1318     
+ Partials     9809     9087     -722     
Flag Coverage Δ
sei-chain-pr 67.50% <91.66%> (?)
sei-db 70.41% <ø> (ø)
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
evmrpc/config/config.go 72.93% <100.00%> (+1.96%) ⬆️
evmrpc/server.go 88.78% <83.33%> (+0.26%) ⬆️

... and 78 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants