Skip to content

Backport release/v6.7: Count only connected peers in /net_info n_peers - #4515

Merged
alexander-sei merged 2 commits into
release/v6.7from
backport-4500-to-release/v6.7
Oct 12, 2026
Merged

alexander-sei merged 2 commits into
release/v6.7from
backport-4500-to-release/v6.7

Conversation

@seidroid

@seidroid seidroid Bot commented Oct 9, 2026

Copy link
Copy Markdown

Backport of #4500 to release/v6.7.

`/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)
@cursor

cursor Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
RPC response semantics change for n_peers only; monitoring or scripts that assumed the old inflated count may need updating, but behavior now matches connected peers.

Overview
Fixes /net_info so n_peers reflects active connections (len(peerConnections)) instead of every known address from AllAddrs() (including PEX gossip).

The peers list is unchanged and still includes all known peer URLs; only the count semantics change. Comments on NetInfo now document that n_peers matches peer_connections, while peers can be larger.

Adds integration tests: connected-peer count on a hub topology, and a PEX case where peers can exceed n_peers when a node is address-known but not connected.

Reviewed by Cursor Bugbot for commit 840d724. Bugbot is set up for automated code reviews on this repo. Configure here.

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedOct 12, 2026, 2:28 PM

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.80%. Comparing base (206d3ce) to head (840d724).

Additional details and impacted files

Impacted file tree graph

@@               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     
Flag Coverage Δ
sei-chain-pr 32.90% <100.00%> (?)
sei-db 69.80% <ø> (ø)
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-tendermint/internal/rpc/core/net.go 68.42% <100.00%> (+18.42%) ⬆️

... and 100 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alexander-sei
alexander-sei enabled auto-merge (squash) October 12, 2026 14:26
@alexander-sei
alexander-sei merged commit 455235e into release/v6.7 Oct 12, 2026
72 checks passed
@alexander-sei
alexander-sei deleted the backport-4500-to-release/v6.7 branch October 12, 2026 14:45
masih pushed a commit that referenced this pull request Oct 16, 2026
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>
masih added a commit that referenced this pull request Oct 16, 2026
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants