Skip to content

Reduced number of addresses per NodeID in peermanager to 1#2990

Merged
pompon0 merged 8 commits intomainfrom
gprusak-less-addrs
Mar 2, 2026
Merged

Reduced number of addresses per NodeID in peermanager to 1#2990
pompon0 merged 8 commits intomainfrom
gprusak-less-addrs

Conversation

@pompon0
Copy link
Contributor

@pompon0 pompon0 commented Feb 27, 2026

With 6.3 upgrade, invalid/outdated addresses are no longer gossiped by honest nodes (malicious nodes can poison the addresses buffer anyway). With that we can simplify the logic to handle just 1 address per peer. I've also added an additional mechanism to prefer public ips over private ips, to account for nodes gossiping private addresses (that they have configured as persistent peers for example).

@github-actions
Copy link

github-actions bot commented Feb 27, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMar 2, 2026, 2:37 PM

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 89.06250% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.98%. Comparing base (62f5b59) to head (2ab2816).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
sei-tendermint/internal/p2p/peermanager.go 64.70% 4 Missing and 2 partials ⚠️
sei-tendermint/internal/p2p/router.go 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2990       +/-   ##
===========================================
+ Coverage   58.23%   71.98%   +13.74%     
===========================================
  Files        2113       22     -2091     
  Lines      173747     1942   -171805     
===========================================
- Hits       101189     1398    -99791     
+ Misses      63541      444    -63097     
+ Partials     9017      100     -8917     
Flag Coverage Δ
sei-chain-pr 72.34% <89.06%> (?)
sei-db 70.41% <ø> (ø)

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

Files with missing lines Coverage Δ
sei-tendermint/internal/p2p/address.go 91.52% <100.00%> (+0.78%) ⬆️
sei-tendermint/internal/p2p/peermanager_pool.go 100.00% <100.00%> (+1.68%) ⬆️
sei-tendermint/internal/p2p/router.go 83.05% <50.00%> (-0.85%) ⬇️
sei-tendermint/internal/p2p/peermanager.go 77.29% <64.70%> (-8.27%) ⬇️

... and 2092 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.

if _, ok := peerAddrs.addrs[addr]; ok {
peerAddrs.fails[addr] = now
if peerAddr, ok := p.addrs[addr.NodeID]; ok && peerAddr.addr == addr {
peerAddr.lastFail = utils.Some(time.Now())

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
p.addrs[pa.addr.NodeID] = pa
return nil
}
// Otherwise, do not replace
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, what if my legitimate peer is moving to a new data center and i do want to replace it? I need to shut down the old one and wait for the address to be valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can start a new node, then shut down the old node and wait for the network to prune the old address in favor of the new one. If you change the addresses regularly, you are most likely to use DNS anyway. There is little incentive to reuse node keys - persistent peers configuration requires people to configure the new address manually anyway.

return nil
}
}
// If the new address is public, find a private address to prune.
Copy link
Contributor

Choose a reason for hiding this comment

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

could it be the private address is actually a high staked validator I don't want to lose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there is ANY peer address that you don't want to lose for ANY reason, then you should put it in persistent peers list. And the peer should add you to the unconditional list, otherwise there is no guarantee that it will have capacity for you.

@pompon0 pompon0 enabled auto-merge (squash) March 2, 2026 14:36
@pompon0 pompon0 merged commit f021f7b into main Mar 2, 2026
35 checks passed
@pompon0 pompon0 deleted the gprusak-less-addrs branch March 2, 2026 14:52
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.

3 participants