Skip to content

Allow timeout configuration for JSON-RPC requests - #923

Merged
m-Peter merged 1 commit into
mainfrom
mpeter/allow-rpc-request-timeout-configuration
Nov 20, 2025
Merged

Allow timeout configuration for JSON-RPC requests#923
m-Peter merged 1 commit into
mainfrom
mpeter/allow-rpc-request-timeout-configuration

Conversation

@m-Peter

@m-Peter m-Peter commented Nov 18, 2025

Copy link
Copy Markdown
Collaborator

Closes: #723

Description

Currently, the request timeout is hard-coded to 30 seconds, which is the default from Geth. However, for certain JSON-RPC calls, such as traces, we need a higher timeout. Setting the default to 120 seconds, and operators can tune this as they see fit.


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Summary by CodeRabbit

  • New Features
    • Added a configurable --rpc-request-timeout flag to control the maximum duration for RPC requests before timing out (default: 120 seconds), providing greater control over request handling behavior.

@coderabbitai

coderabbitai Bot commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes add a configurable JSON-RPC request timeout feature. A new RpcRequestTimeout field is added to the configuration structure, exposed via CLI flag --rpc-request-timeout with a 120-second default, and used to set the HTTP server's WriteTimeout instead of a hardcoded value.

Changes

Cohort / File(s) Summary
RPC Request Timeout Configuration
config/config.go, cmd/run/cmd.go, api/server.go
Added new public RpcRequestTimeout field (time.Duration) to Config struct with explanatory comment. Exposed via CLI flag --rpc-request-timeout (default 120s) in command initialization. Updated server initialization to use configurable timeout for HTTP WriteTimeout instead of fixed value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Straightforward configuration addition with consistent pattern across files
  • Additive changes with minimal logic modifications
  • CLI flag binding and struct field propagation follow existing patterns
  • Single responsibility: introduce new timeout configuration

Suggested labels

EVM

Suggested reviewers

  • peterargue
  • zhangpodhostnik
  • janezpodhostnik

Poem

🐰 Twitches nose with delight
Request timeouts now bend to your will,
A hundred and twenty seconds to thrill,
Configuration flows through config and CLI,
The gateway's pace operators can ply! ⏱️✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Allow timeout configuration for JSON-RPC requests' accurately and concisely describes the main change in the PR: making JSON-RPC request timeouts configurable instead of hard-coded.
Linked Issues check ✅ Passed The PR implements the objective from issue #723 by adding a new RpcRequestTimeout configuration field that allows operators to customize JSON-RPC request timeouts, replacing the hard-coded behavior.
Out of Scope Changes check ✅ Passed All changes are directly within scope: adding the RpcRequestTimeout field to the Config struct, introducing the --rpc-request-timeout flag, and updating the server to use the configurable timeout. No unrelated changes are present.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mpeter/allow-rpc-request-timeout-configuration

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad19290 and 624886a.

📒 Files selected for processing (3)
  • api/server.go (1 hunks)
  • cmd/run/cmd.go (1 hunks)
  • config/config.go (1 hunks)
🔇 Additional comments (2)
config/config.go (1)

127-129: LGTM!

The new RpcRequestTimeout field is well-documented and properly typed. The comment clearly explains its purpose for controlling JSON-RPC request timeout duration.

cmd/run/cmd.go (1)

294-294: LGTM! CLI flag is well-defined.

The --rpc-request-timeout flag is properly configured with a sensible default of 120 seconds and a clear description. The use of DurationVar allows operators to specify values like "2m" or "90s" naturally.

Note: While the flag definition is correct, validation of the value should be added in api/server.go to handle edge cases (e.g., very small or zero values). This has been flagged in a separate comment.

Comment thread api/server.go
@m-Peter
m-Peter merged commit b172ff9 into main Nov 20, 2025
2 checks passed
@m-Peter
m-Peter deleted the mpeter/allow-rpc-request-timeout-configuration branch November 20, 2025 08:18
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.

Allow configuration of http timeout values for JSON-RPC server

3 participants