Skip to content

fix(p2p): honor configured transport timeouts - #48

Open
0xrukimedo wants to merge 1 commit into
developfrom
vbhattac/p2p-transport-timeouts
Open

0xrukimedo wants to merge 1 commit into
developfrom
vbhattac/p2p-transport-timeouts

Conversation

@0xrukimedo

@0xrukimedo 0xrukimedo commented Oct 2, 2026 •

Copy link
Copy Markdown

Summary

Wire existing handshake_timeout and dial_timeout config fields into the production P2P transport. They were previously ignored in favor of hard-coded 3s/1s deadlines. Reject non-positive values; retain direct-constructor defaults.

No new config keys, dependency or wire-format changes. This enables timeout tuning, not faster gossip or guaranteed throughput.

Executed tests

  • Affected config/P2P/node packages passed under -race; new validation, wiring and stalled-handshake tests passed 10 repeats.
  • Negative control fails on the old code; Diffguard mutation tests passed (10/10 killed).
  • Scoped lint: 0 issues. Build, module verification and diff checks passed.
  • Security scan: branch and unchanged base both report 7 symbol-level advisories in existing grpc/go-ethereum dependencies. Remediation remains a separate release gate.
  • No network-performance or canary-soak claim.

Rollout notes

  • Audit configs before upgrading: configured/default 20s handshake and 3s dial now take effect. Explicitly set 3s/1s to preserve prior runtime behavior. The separate Amoy trial in 0xPolygon/pos-ops#1035 instead uses a 10s handshake timeout and retains the configured 3s dial timeout.
  • Handshake timeout applies per phase. Longer deadlines retain incomplete connections/resources longer; zero/negative values now fail validation.
  • Requires a rebuilt consumer (build: pin CometBFT with configurable P2P timeouts heimdall-v2#658). No hardfork required, but connectivity can affect consensus participation: canary first, retain rollback binary.

Wire the configured TCP dial and per-phase handshake deadlines into the production transport. Reject non-positive values and test defaults, overrides, legacy timings, and stalled handshakes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The configuration is correctly validated and wired, with focused tests covering defaults and runtime behavior.

Review effort: Balanced
Findings: None

What changed in this PR

Wires configured P2P dial and handshake timeouts into production transport while preserving constructor defaults and validating configuration.

Changes:

  • Adds transport timeout options and applies them during node setup.
  • Rejects non-positive configured timeouts.
  • Adds validation, wiring, default, and handshake-deadline tests.
File Description
p2p/​transport.go Adds dial and handshake timeout options.
p2p/​transport_timeouts_test.go Tests defaults, options, and handshake deadlines.
node/​setup.go Applies configured timeouts to the transport.
node/​transport_timeouts_test.go Verifies configuration wiring.
config/​config.go Validates positive timeout values.
config/​p2p_timeouts_test.go Tests timeout validation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@0xrukimedo

Copy link
Copy Markdown
Author

@claude review

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.

2 participants