Skip to content

feat: add per-method RPC timeout configuration#110

Open
KENILSHAHH wants to merge 1 commit intomegaeth-labs:mainfrom
KENILSHAHH:kenil/feat/per-method-rpc-timeouts
Open

feat: add per-method RPC timeout configuration#110
KENILSHAHH wants to merge 1 commit intomegaeth-labs:mainfrom
KENILSHAHH:kenil/feat/per-method-rpc-timeouts

Conversation

@KENILSHAHH
Copy link
Copy Markdown

Summary

  • Previously all RPC calls shared no timeout, making it impossible to balance
    the tradeoff between witness fetches (which can legitimately take several
    seconds on heavy blocks) and block/header fetches (which should return in
    milliseconds). A single tight timeout caused false witness failures; a single
    loose one left workers hanging on stuck block fetches.
  • Add block_timeout, witness_timeout, and code_timeout fields
    (Option<Duration>) to RpcClientConfig with corresponding with_* builder
    methods. All default to None — fully backwards compatible.
  • Add a private apply_timeout helper on RpcClient that wraps any future with
    tokio::time::timeout when a timeout is set, and passes through with zero
    overhead when None.
  • Apply code_timeout to get_code, block_timeout to get_block_unchecked /
    get_latest_block_number / get_header / get_transaction_by_hash, and
    witness_timeout to fetch_witness_from_provider (covers both primary and
    Cloudflare fallback paths).
  • Expose --block-timeout-secs, --witness-timeout-secs, --code-timeout-secs
    CLI flags (and STATELESS_VALIDATOR_*_TIMEOUT_SECS env vars) in the
    stateless-validator binary so operators can tune timeouts at deploy time
    without recompiling.

@KENILSHAHH KENILSHAHH requested a review from flyq as a code owner March 31, 2026 06:15
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.

1 participant