Repository navigation
Backport release/v6.7: Count only connected peers in /net_info n_peers - #4515
Conversation
`/net_info` builds `n_peers` from `Router.AllAddrs()`, which merges the live connections with every address in the persistent and regular PEX tables. On pacific-1 that reports roughly 175-200 "peers" on nodes that are actually connected to around 45, which an operator running `max-connections = 31` took for a broken peer cap. CometBFT tooling and dashboards read `n_peers` as the connected-peer count. The known-peer semantics come from the Tendermint v0.35 fork (`PeerManager.Peers()` over the peer store); #2539 moved the source to the pool address maps, and #3037 switched it to `AllAddrs()` while moving `peer_connections` to live connections, which is why the two now disagree. `Environment.NetInfo` now sets `n_peers` to the number of connected peers, the same set as `peer_connections`. `peers` keeps listing every known address, because the rpcnode init script and the sei-infra state-sync and init scripts seed `persistent-peers` from `.peers[].url`. Limiting it to connected peers left those lists empty whenever the source node only had inbound peers without an `external-address`, which is what made the Chain Operation Test time out in the merge queue. Exposing the known-address count as a Prometheus metric is left to a follow-up. This is an RPC-only change with no consensus or state impact. `TestNetInfo_NPeersCountsConnectedPeers` and `TestNetInfo_PeersIncludesPexAddresses` both fail on main and pass here. --------- Co-authored-by: alexander-sei <alexanderh@seinetwork.io> (cherry picked from commit 8ab697f)
PR SummaryLow Risk Overview The Adds integration tests: connected-peer count on a hub topology, and a PEX case where Reviewed by Cursor Bugbot for commit 840d724. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
This clean backport of #4500 makes /net_info n_peers count connected peers (len(peerConnections)) rather than every known address. It adds tests for the connected-peer count and for PEX-learned addresses. The test helpers it relies on (MakeTestNetwork, TestNodeOptions.PexOnHandshake/SelfAddress/MaxConnected, TestNode.Connect) already exist on the target branch.
Findings: 0 blocking | 0 non-blocking | 0 posted inline
Blockers
- None at the file/PR level.
Non-blocking
- None at the file/PR level.
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v6.7 #4515 +/- ##
================================================
- Coverage 61.84% 60.80% -1.04%
================================================
Files 2168 2068 -100
Lines 188740 176780 -11960
================================================
- Hits 116727 107499 -9228
+ Misses 61159 59398 -1761
+ Partials 10854 9883 -971
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Systematic changelog re-generation for the v6.7.2 patch release. Adds the PRs merged to `release/v6.7` since the v6.7.1 changelog (#4481), as reported by `scripts/generate-changelog.sh release/v6.6 release/v6.7`. New in v6.7.2: - #4520 Backport `release/v6.7`: Export known peer address count as a Prometheus gauge - #4515 Backport `release/v6.7`: Count only connected peers in /net_info n_peers - #4508 Backport `release/v6.7`: Fix pruning issue in SS causing huge disk spike - #4507 Backport `release/v6.7`: Initialize app from last header when a frozen node restarts Shipped in v6.7.1, but merged after #4481 was generated, so the v6.7.1 changelog never listed them: - #4503 Backport `release/v6.7`: Refuse pinned write modes that disagree with persisted migration - #4502 Backport `release/v6.7`: Guard FlatKV rollback floor - #4499 Backport `release/v6.7`: Resolve composite iteration duplicates to memiavl, matching Read - #4489 Backport `release/v6.7`: Remove genesis export - #4486 Backport `release/v6.7`: Re-derive the composite write mode on rollback - #4485 Backport `release/v6.7`: Make the composite store flatKV and write mode atomic - #4474 Backport `release/v6.7`: Validate module names in the memiavl snapshot importer v6.7.1 release bookkeeping: - #4506 Backport `release/v6.7`: Update v6.7 change log in prep to cut v6.7.1 patch - #4482 Bump version to v6.7.1 in prep for patch release Only the `## v6.7` PR list changes, so the `backport release/v6.7` cherry-pick applies cleanly (simulated with `git merge-tree` against `origin/release/v6.7`). Co-authored-by: Cursor <cursoragent@cursor.com>
## Summary - Bump `version.json` from `v6.7.1` to `v6.7.2` for the patch release. - Merge after the `release/v6.7` backport of #4557 (the v6.7.2 changelog), so the release includes it. - New since v6.7.1: #4507, #4508, #4515 and #4520. All four are labeled `non-app-hash-breaking`, so moving from v6.7.1 to v6.7.2 should not need a coordinated validator switch. - Push `v6.7.2` by hand on this PR's merge commit once it has merged; the tagging ruleset stops `uci-release-publish` from creating it. ## Test plan - [x] `git diff --check` Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Masih H. Derkani <m@derkani.org>
Backport of #4500 to
release/v6.7.