Skip to content

eth, eth/fetcher, p2p: make tx arrival wait configurable via p2p.txarrivalwait - #2303

Draft
dkeysil wants to merge 1 commit into
0xPolygon:developfrom
dkeysil:dkeysil/configurable-txarrivalwait
Draft

eth, eth/fetcher, p2p: make tx arrival wait configurable via p2p.txarrivalwait#2303
dkeysil wants to merge 1 commit into
0xPolygon:developfrom
dkeysil:dkeysil/configurable-txarrivalwait

Conversation

@dkeysil

@dkeysil dkeysil commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The p2p.txarrivalwait config option (--txarrivalwait flag) is parsed and documented but has no effect: since the geth v1.14.13 merge it is no longer passed into the transaction fetcher, which uses the hardcoded txArriveTimeout (500ms) instead. This PR wires the configured value through node.Configeth/backendhandlerConfigNewTxFetcher, restoring the flag's documented behavior. The default is unchanged (500ms). A value of 0 requests announced transactions immediately; negative values clamp to 0.

Why it matters: on a mainnet full node (~250 peers) we measured that a significant share of newly observed pending transactions (roughly 30–65% depending on peer topology; eth/68 senders direct-broadcast bodies only to √N peers, and blob/large txs are announce-only) arrive via hash announcement + fetch. Each of those currently waits up to 500ms before the body is even requested. With txarrivalwait = "0s" the eth_fetcher_transaction_waiting_hashes gauge stays pinned at 0 and announced transactions are fetched after a single round-trip.

Executed tests

  • go test -race ./eth/fetcher/ — 144 tests pass, race clean.
  • New tests: TestTransactionFetcherCustomArrivalWait (250ms wait honored), TestTransactionFetcherZeroArrivalWait (immediate scheduling), TestTransactionFetcherNegativeArrivalWait (clamped to 0), TestTxArrivalWaitConfig (TOML → fillTimeDurationsbuildNodenode.Config plumbing, including the 500ms default).
  • go test ./internal/cli/server/ passes.
  • Ran for multiple hours on a production Polygon PoS mainnet full node with txarrivalwait = "0s": fetch-path deliveries (eth_fetcher_transaction_replies_in) continued at full rate (~115 tx/s of ~169 tx/s total intake), waiting_hashes at 0, node stable, no peer-drop or bandwidth regressions observed.

Rollout notes

Not consensus-affecting; no coordinated upgrade required. Backwards compatible: the default stays 500ms, so operators who never set the flag see no change. Operators who did set txarrivalwait should note it has been silently ignored since v1.5.0 and will now take effect. In ≤v1.4.x the value was clamped to [100ms, 500ms]; this PR deliberately allows 0 so latency-sensitive operators can fetch announced transactions immediately, trading a modest increase in fetch-request traffic.

…rivalwait

The p2p.txarrivalwait config option and --txarrivalwait flag existed but
were never wired into the transaction fetcher, which used the hardcoded
500ms txArriveTimeout since the v1.14.13 upstream merge. Plumb the value
from p2p.Config through the eth handler into NewTxFetcher.

A value of zero requests announced transactions immediately instead of
waiting for a potential broadcast; negative values are clamped to zero.
@dkeysil
dkeysil force-pushed the dkeysil/configurable-txarrivalwait branch from dbdf7af to 9332e19 Compare July 20, 2026 09:51
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
16.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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