feat(p2p): expose p2p connectivity (enabled + connected peer count) - #25178
Closed
spalladino wants to merge 1 commit into
Closed
feat(p2p): expose p2p connectivity (enabled + connected peer count)#25178spalladino wants to merge 1 commit into
spalladino wants to merge 1 commit into
Conversation
Adds `getP2PConnectivity()`, returning `{ enabled, connectedPeers }`, so downstream subsystems can tell
whether the libp2p stack is alive and how many peers it is talking to. Until now a node running with a dead
p2p stack (zero peers) looked identical to a healthy one from the outside.
- `P2PService` declares the method synchronously, matching its neighbouring `getPeers` / `getGossipMeshPeerCount`.
- `LibP2PService` returns `enabled: true` and counts peers reported as connected by the peer manager, so
dialing and cached peers are excluded.
- `DummyP2PService` (and the TXE dummy client) return `enabled: false` with zero peers, encoding "p2p is
disabled" for sandbox and single-node setups; consumers can treat disabled p2p as vacuously healthy instead
of as a stack with no peers.
- `P2PClient` forwards to the service, and `P2PApi` exposes it over JSON-RPC with a `P2PConnectivity` zod
schema, so the node API surfaces it too.
No behavior is gated on this yet; it is the foundation for gating slashing, proposing, and sendTx on p2p
connectivity in follow-up changes.
Part of A-1701.
This was referenced Aug 11, 2026
Contributor
Author
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.
Adds
getP2PConnectivity(), returning{ enabled, connectedPeers }, so downstream subsystems can tellwhether the libp2p stack is alive and how many peers it is talking to. Until now a node running with a dead
p2p stack (zero peers) looked identical to a healthy one from the outside.
P2PServicedeclares the method synchronously, matching its neighbouringgetPeers/getGossipMeshPeerCount.LibP2PServicereturnsenabled: trueand counts peers reported as connected by the peer manager, sodialing and cached peers are excluded.
DummyP2PService(and the TXE dummy client) returnenabled: falsewith zero peers, encoding "p2p isdisabled" for sandbox and single-node setups; consumers can treat disabled p2p as vacuously healthy instead
of as a stack with no peers.
P2PClientforwards to the service, andP2PApiexposes it over JSON-RPC with aP2PConnectivityzodschema, so the node API surfaces it too.
No behavior is gated on this yet; it is the foundation for gating slashing, proposing, and sendTx on p2p
connectivity in follow-up changes.
Part of A-1701.
Part of a stacked-PR chain (bottom → top) hardening the node against running with a dead p2p stack; each PR targets the branch below it and the bottom targets
merge-train/spartan-v5:GET /statussendTxwhen the node has no peers to propagate the tx