p2p design improvements and bug fixes#152
Merged
mateeullahmalik merged 1 commit intomasterfrom Sep 4, 2025
Merged
Conversation
f8dda5b to
40f27a0
Compare
j-rafique
approved these changes
Sep 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P2P: Make hot path fast & resilient — pooled TCP, dynamic deadlines, chunked BatchStore, smarter health/bans
Summary
This PR hardens and speeds up the P2P stack without changing the wire protocol. The hot path no longer wastes RPCs or times out on heavy payloads, connections are responsibly reused, and node health is managed by a sober background loop (not by request-time heuristics).
Headline changes
bech32@host:portfor invariant identity.connWrapperserializes whole-RPC I/O (prevents cross-talk on pooled sockets).NoDelay(low latency) + server-side TCP keepalive (detect half-open).BatchStoreDataBatchStoreData: 90s,BatchGetValues: 90s,Find*/StoreData: 5–15s.replication_infoand seeds routing table.encode/decode; responders compress batch GETs.Key Changes (by area)
Networking / I/O
Network.Call)writeDeadline = base + size/throughputFloor + cushion.Batch store
Health & bans
Activeflip.Bootstrap
replication_infoand seed routing.Performance & Reliability Impact
TCP_NODELAY, pooled conns, and no-reopen on server timeouts.Backward Compatibility
Configuration Knobs
BatchStoreDatatimeout: 90s (execTimeouts map).Risks & Mitigations
Rollback: revert timeout map and chunker; server read timeout remains safe even when reduced.
Testing Performed
Observability
Activeflips; last_seen updates.Checklist