Skip to content

Backport release/v6.6: fix(p2p): make the inbound accept rate configurable and raise its default - #3939

Merged
masih merged 1 commit into
release/v6.6from
backport-3899-to-release/v6.6
Aug 18, 2026
Merged

Backport release/v6.6: fix(p2p): make the inbound accept rate configurable and raise its default#3939
masih merged 1 commit into
release/v6.6from
backport-3899-to-release/v6.6

Conversation

@bdchatham

Copy link
Copy Markdown
Contributor

Backport of #3899 to release/v6.6. Done by hand — see below.

Why this is manual

The UCI backport action refused it:

Backport failed because this pull request contains merge commits.

#3899 was updated by merging main in to resolve conflicts, and the action cherry-picks a PR's commits individually. Configuring merge_commits: skip would have been the wrong fix, since that merge commit is where the conflict resolution lives.

Cherry-picking the squash (d17806f6c) directly also does not work cleanly: it mis-aligns createRouter, splicing main's signature and return shape into this branch's body while marking only part of the damage. So the three affected files were reconstructed from the release/v6.6 side instead of patched out of a bad merge. config.go, toml.go, and the three config test files applied cleanly and are unmodified from the source commit.

The resolution is the inverse of the one on main

#3922 — which unwraps MaxDialRate/MaxAcceptRate from Option[rate.Limit] to plain rate.Limit — is on main only. So this branch keeps the Option form:

main here
field MaxAcceptRate rate.Limit MaxAcceptRate utils.Option[rate.Limit]
setup.go MaxAcceptRate: acceptRate MaxAcceptRate: utils.Some(acceptRate)
routeroptions_test.go Validate-based rewrite #3899's original fallback test

pacingRate and p2pRouterOptions are introduced by #3899 itself rather than pre-existing main drift, so both come across. createRouter here keeps its own signature — p2pMetrics first, three return values — and just calls p2pRouterOptions.

One difference that is load-bearing

On main, dropping #3899's raised package-level fallback was safe because #3922 added a Validate() guard rejecting a zero rate, so a construction site that forgets the field fails loudly.

This branch has no such guard. So maxAcceptRate() keeps .Or(rate.Every(10 * time.Millisecond)). Without it, an unset field silently inherits the old 1/s and the backport ships no behaviour change at all.

Verification

  • gofmt -s and go vet clean
  • ./sei-tendermint/config/... and ./sei-tendermint/internal/p2p/ green
  • TestP2PRouterOptions_PacingAndBudgetWiring (7 subtests) and TestRouterOptionsPacingDefaults pass
  • ./sei-tendermint/node/ has 3 failures — TestNodeStartStop, TestNodeRestartEventAllowsRecreate, TestNodeSetPrivValTCP — which I confirmed are identical on pristine release/v6.6, not introduced here

Why it matters for v6.6

The seeds run v6.6.0. Their inbound accept limiter is pinned at 1/s with no way to reach it from config, so the kernel completes handshakes into the listen backlog faster than the loop drains it and arriving peers time out — a node that accepts TCP and then says nothing. That is the observed state of all three prod-cell seeds.

Paired with sei-config v0.0.26, which carries the accept-interval key through the config schema.

🤖 Generated with Claude Code

…ault (#3899)

Manual backport of #3899 (squash d17806f) to release/v6.6. The UCI action
refused it — the source PR carries a merge commit, from when main was merged in
to resolve conflicts — and cherry-picking the squash directly mis-aligned
createRouter, splicing main's signature into this branch's body. So the three
affected files were reconstructed from the release/v6.6 side rather than patched
out of a bad merge.

The resolution is the INVERSE of the one taken on main. #3922 (which unwraps
MaxDialRate/MaxAcceptRate from Option[rate.Limit] to plain rate.Limit) is on main
only, so this branch keeps the Option form:

- RouterOptions.MaxAcceptRate stays utils.Option[rate.Limit].
- setup.go wraps: MaxDialRate/MaxAcceptRate: utils.Some(dialRate/acceptRate).
- setup_test.go asserts utils.Some(...) on both rates.
- routeroptions_test.go is #3899's original fallback-based test, not the
  Validate-based rewrite that main's version needed.

One difference is load-bearing rather than cosmetic. On main, dropping #3899's
raised package-level fallback was safe because #3922 added a Validate() guard
rejecting a zero rate, so a construction site that forgets the field fails loudly.
This branch has no such guard, so maxAcceptRate() keeps
.Or(rate.Every(10 * time.Millisecond)) — without it an unset field silently
inherits 1/s and the backport ships nothing.

pacingRate and p2pRouterOptions are introduced by #3899 itself, not pre-existing
main drift, so both come across; createRouter here keeps its own signature
(p2pMetrics first, 3 return values) and just calls p2pRouterOptions.

Verified: gofmt -s and go vet clean; ./sei-tendermint/config/... and
./sei-tendermint/internal/p2p/ green; TestP2PRouterOptions_PacingAndBudgetWiring
and TestRouterOptionsPacingDefaults pass. ./sei-tendermint/node/ has 3 failures
(TestNodeStartStop, TestNodeRestartEventAllowsRecreate, TestNodeSetPrivValTCP)
confirmed identical on pristine release/v6.6.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 17, 2026, 4:28 PM

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.41176% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.13%. Comparing base (bb738bc) to head (36705fa).

Files with missing lines Patch % Lines
sei-tendermint/node/setup.go 73.07% 3 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##           release/v6.6    #3939      +/-   ##
================================================
- Coverage         59.00%   58.13%   -0.88%     
================================================
  Files              2225     2151      -74     
  Lines            183577   175032    -8545     
================================================
- Hits             108320   101749    -6571     
+ Misses            65511    64238    -1273     
+ Partials           9746     9045     -701     
Flag Coverage Δ
sei-chain-pr 72.01% <79.41%> (?)
sei-db 70.41% <ø> (ø)
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/config/config.go 74.94% <100.00%> (+0.35%) ⬆️
sei-tendermint/config/toml.go 55.00% <ø> (ø)
sei-tendermint/internal/p2p/routeroptions.go 81.25% <100.00%> (ø)
sei-tendermint/node/setup.go 70.03% <73.07%> (+0.89%) ⬆️

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

@cursor

cursor Bot commented Aug 17, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches core P2P connection acceptance pacing and defaults; mis-tuned accept-interval can still starve inbound peers, but changes are narrowly scoped with validation and tests.

Overview
Fixes inbound peer acquisition by making the P2P accept-loop rate operator-tunable and raising the effective default from ~1/s to ~100/s (default accept-interval 10ms).

Adds accept-interval to [p2p] (documented in config.toml; dial-interval stays parse-only, not in the template). Config.ValidateBasic now validates [p2p], including non-negative dial-interval / accept-interval; 0 disables the accept limiter (rate.Inf). Node startup maps both intervals into RouterOptions via new pacingRate / p2pRouterOptions (including MaxAcceptRate), with errors on negative values even when validation was skipped on deploy.

maxAcceptRate() fallback when unset is 10ms (load-bearing on this branch without main’s zero-rate guard). Tests cover template presence, viper compat for older configs, and router wiring.

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

@masih
masih merged commit 851cc6e into release/v6.6 Aug 18, 2026
64 of 68 checks passed
@masih
masih deleted the backport-3899-to-release/v6.6 branch August 18, 2026 17: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.

2 participants