Skip to content

feat: blockchain rpc http transport config#5420

Open
gacevicljubisa wants to merge 3 commits intomasterfrom
feat/blockchain-rpc-http-transport-config
Open

feat: blockchain rpc http transport config#5420
gacevicljubisa wants to merge 3 commits intomasterfrom
feat/blockchain-rpc-http-transport-config

Conversation

@gacevicljubisa
Copy link
Copy Markdown
Member

@gacevicljubisa gacevicljubisa commented Apr 1, 2026

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

Problem

The blockchain RPC client used Go's default HTTP transport with no tuning. When RPC endpoints sit behind a load balancer (e.g. HAProxy with timeout http-keep-alive 5s), idle connections are silently dropped, causing intermittent EOF errors on the next request.

Solution

Expose HTTP transport knobs as CLI flags and wire them into a custom http.Client passed to the RPC dialer via rpc.WithHTTPClient.

New flags with recommended defaults:

Flag Default Purpose
--blockchain-rpc-dial-timeout 30s TCP connection establishment
--blockchain-rpc-tls-timeout 10s TLS handshake
--blockchain-rpc-idle-timeout 90s Idle connection pool lifetime
--blockchain-rpc-keepalive 30s TCP keepalive interval

Setting idle-timeout below the load balancer's keep-alive timeout
prevents reuse of connections that have already been silently closed.

Config

Both flat and nested YAML are supported. If both are present, nested
takes precedence and a warning is logged. CLI flags always win.

blockchain-rpc:
  endpoint: https://rpc.gnosischain.com/
  dial-timeout: 5s
  tls-timeout: 10s
  idle-timeout: 4s
  keepalive: 30s

CheckUnknownParams now accepts dotted config keys so nested YAML
does not trigger the unknown parameter error.

Closes #5404

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

AI Disclosure

  • This PR contains code that has been generated by an LLM.
  • I have reviewed the AI generated code thoroughly.
  • I possess the technical expertise to responsibly review the code generated in this PR.

@gacevicljubisa gacevicljubisa marked this pull request as ready for review April 1, 2026 13:11
Copy link
Copy Markdown
Contributor

@akrem-chabchoub akrem-chabchoub left a comment

Choose a reason for hiding this comment

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

We should update the docker-compose.yaml with new flags.

if cmd.Flags().Lookup(v) == nil {
// Accept both the exact flag name and the dotted form used by nested
// YAML (e.g. "blockchain-rpc.endpoint" maps to "--blockchain-rpc-endpoint").
if cmd.Flags().Lookup(v) == nil && cmd.Flags().Lookup(strings.ReplaceAll(v, ".", "-")) == nil {
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.

why is this needed?

Copy link
Copy Markdown
Contributor

@acud acud left a comment

Choose a reason for hiding this comment

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

lgtm

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.

feat: add HTTP client configuration for blockchain RPC endpoint

3 participants