Skip to content

fix(builder): bound Flashbots relay requests with a 30s client timeout - #1340

Open
hermiondev wants to merge 1 commit into
alchemyplatform:mainfrom
hermiondev:fix/flashbots-client-timeout
Open

hermiondev wants to merge 1 commit into
alchemyplatform:mainfrom
hermiondev:fix/flashbots-client-timeout

Conversation

@hermiondev

Copy link
Copy Markdown

Problem

FlashbotsClient::new builds its HTTP client with reqwest::Client::new(), whose default is no timeout on requests. If the Flashbots relay (or a configured builder relay) accepts the TCP connection but stalls — overloaded relay, middlebox blackhole, hung LB — send_private_transaction and cancel_private_transaction never settle:

  • the sender task's submit/poll loop is pinned forever on one socket,
  • bundle submission for the whole builder halts silently (no error, no retry, no log),
  • cancels never land, leaving stuck transactions un-replaced.

Every other outbound HTTP path in this repo is already bounded — the provider uses a tower timeout layer (#1297, client_timeout_seconds), the healthcheck RPC calls use rpc_timeout (#1173), the tracer uses 10s (#730). The Flashbots sender was the last unbounded Client::new() in production code (grep -rn "Client::new()" crates/ → this line only).

Fix

Client::builder().timeout(Duration::from_secs(30)) on the Flashbots relay client. 30s matches the order of the other concrete bounds in the repo and is generous for eth_sendPrivateTransaction / cancel round-trips. On timeout reqwest returns a RequestTimedOut transport error, which the existing FlashbotsError::Transport arm already maps → normal retry/cancel semantics resume instead of a hang.

Verification

  • cargo check -p rundler-builder — Finished, 0 errors (rustc 1.92.0, repo pinned toolchain, request resolved from Cargo.lock reqwest 0.12.9).
  • cargo fmt -p rundler-builder -- --check — clean.
  • Single-file change, +8/−1, no behavior change on the success path.

FlashbotsClient used reqwest Client::new(), whose default is no
timeout. A stalled Flashbots relay hangs send_private_transaction /
cancel_private_transaction forever, pinning the sender task and
stalling the transaction pipeline. Every other outbound path in the
repo is already bounded (provider tower timeout alchemyplatform#1297, rpc_timeout,
tracer 10s); this was the last unbounded client.

Use Client::builder().timeout(30s), matching the repo's pattern of
concrete bounds on outbound HTTP.
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