Skip to content

fix(blocksync): prevent maxPeerHeight poisoning - #5803

Merged
aljo242 merged 1 commit into
mainfrom
fix/blocksync-maxpeerheight
Apr 22, 2026
Merged

aljo242 merged 1 commit into
mainfrom
fix/blocksync-maxpeerheight

Conversation

@vladjdk

@vladjdk vladjdk commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Cherry-picks berachain/cometbft#40 (@fridrik01) into upstream blocksync/. Fixes a deadlock where a malicious peer can poison maxPeerHeight with an inflated base/height that no peer can serve, stalling IsCaughtUp forever.

Taken from commit 1 of the PR rather than the final state, which keeps the base > height ban and PopRequest recompute that commit 2 stripped back out.

@vladjdk
vladjdk requested a review from a team as a code owner April 21, 2026 20:44
@github-actions

Copy link
Copy Markdown

🔒 WARNING: unsigned commits detected

This pull request contains 1 commit(s) without a verified signature.

How to fix:

  1. Set up commit signing (GPG or SSH).
  2. Amend/rebase so every commit in this PR is verified-signed.
  3. Push the updated branch and open a new PR, or ask a maintainer to reopen once fixed.

Docs: https://docs.github.com/authentication/managing-commit-signature-verification

Unsigned commits:

  • a37f303 — fix(blocksync): prevent maxPeerHeight poisoning by peers with inflated base

@vladjdk vladjdk added the backport-to-v0.39.x Tell Mergify to backport the PR to v0.39.x label Apr 21, 2026
@vladjdk

vladjdk commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator Author

Kept unsigned commit to preserve authorship

@vladjdk vladjdk added the backport-to-v0.38.x Tell Mergify to backport the PR to v0.38.x label Apr 21, 2026
@greptile-apps

greptile-apps Bot commented Apr 21, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a deadlock where a malicious peer can poison maxPeerHeight by reporting a base/height pair that no real peer can serve, causing IsCaughtUp to stall forever. Two defences are added: (1) peers whose base > height are immediately banned in SetPeerRange, and (2) updateMaxPeerHeight now skips any peer whose base > pool.height, re-admitting them as pool.height advances via a new updateMaxPeerHeight call in PopRequest.

Confidence Score: 4/5

Safe to merge; the fix correctly prevents maxPeerHeight poisoning with two small P2 follow-ups worth addressing.

Both remaining findings are P2: a narrow height-0 bypass in updateMaxPeerHeight (irrelevant in practice since CometBFT starts at height 1) and an inconsistency between TestBlockPoolBasic and TestBlockPoolTimeout in how peer bases are set. Neither affects correctness of the primary fix.

Minor follow-up in blocksync/pool.go (height-0 guard) and blocksync/pool_test.go (TestBlockPoolBasic base inconsistency).

Important Files Changed

Filename Overview
blocksync/pool.go Adds base > height ban in SetPeerRange and a peer.base > pool.height guard in updateMaxPeerHeight to prevent maxPeerHeight poisoning; PopRequest now calls updateMaxPeerHeight to re-admit peers as the pool height advances. Logic is correct with a minor edge case at pool.height==0.
blocksync/pool_test.go Adds two targeted unit tests for the new banning and maxPeerHeight refresh behavior; fixes TestBlockPoolTimeout to use uniform bases. TestBlockPoolBasic is not updated consistently and will now exercise single-peer bootstrap at startup.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[SetPeerRange called] --> B{base > height?}
    B -- Yes --> C[removePeer + banPeer, return]
    B -- No --> D[Update peer record or add new peer]
    D --> E[updateMaxPeerHeight]
    E --> F{For each peer: base > pool.height?}
    F -- Yes --> G[Skip peer - malicious/pruned exclusion]
    F -- No --> H[Candidate for maxPeerHeight]
    H --> I[pool.maxPeerHeight = max eligible height]
    J[PopRequest called] --> K[Delete requester, pool.height++]
    K --> L[updateMaxPeerHeight - re-admits peers whose base <= new height]
    L --> F
    M[IsCaughtUp] --> N{pool.height >= maxPeerHeight - 1?}
    N -- Yes --> O[true: switch to consensus]
    N -- No --> P[false: keep syncing]
Loading

Comments Outside Diff (1)

  1. blocksync/pool_test.go, line 130-136 (link)

    P2 TestBlockPoolBasic not updated to match TestBlockPoolTimeout fix

    TestBlockPoolTimeout was updated to force base = start for every peer so that all peers contribute to maxPeerHeight at startup, but TestBlockPoolBasic still passes peer.base directly. makePeers generates bases as start + i (42, 43, …, 51), so peers 1–9 all have base > pool.height (42) at startup and are filtered out of maxPeerHeight by the new updateMaxPeerHeight logic. The test still passes because pool.height advances one block at a time, unlocking each pruned peer, but the test now exercises different behavior than intended (single-peer bootstrap instead of ten-peer parallel sync). Consider applying the same start base override here for consistency and test fidelity.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: blocksync/pool_test.go
    Line: 130-136
    
    Comment:
    **`TestBlockPoolBasic` not updated to match `TestBlockPoolTimeout` fix**
    
    `TestBlockPoolTimeout` was updated to force `base = start` for every peer so that all peers contribute to `maxPeerHeight` at startup, but `TestBlockPoolBasic` still passes `peer.base` directly. `makePeers` generates bases as `start + i` (42, 43, …, 51), so peers 1–9 all have `base > pool.height (42)` at startup and are filtered out of `maxPeerHeight` by the new `updateMaxPeerHeight` logic. The test still passes because pool.height advances one block at a time, unlocking each pruned peer, but the test now exercises different behavior than intended (single-peer bootstrap instead of ten-peer parallel sync). Consider applying the same `start` base override here for consistency and test fidelity.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: blocksync/pool.go
Line: 474-479

Comment:
**`pool.height > 0` guard creates a height-0 bypass**

When `pool.height == 0`, the guard short-circuits the entire filter, so any peer with an inflated `base`/`height` still contributes to `maxPeerHeight`. In practice CometBFT block heights start at 1, so this is unlikely to be exploited, but the intent is unclear. A new node that starts syncing from genesis (`height=0`) would have no protection until the first `PopRequest` increments `pool.height` to 1. Consider removing the guard entirely — the filter `peer.base > pool.height` already handles the zero case correctly, since a peer with `base > 0` genuinely cannot serve block 0.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: blocksync/pool_test.go
Line: 130-136

Comment:
**`TestBlockPoolBasic` not updated to match `TestBlockPoolTimeout` fix**

`TestBlockPoolTimeout` was updated to force `base = start` for every peer so that all peers contribute to `maxPeerHeight` at startup, but `TestBlockPoolBasic` still passes `peer.base` directly. `makePeers` generates bases as `start + i` (42, 43, …, 51), so peers 1–9 all have `base > pool.height (42)` at startup and are filtered out of `maxPeerHeight` by the new `updateMaxPeerHeight` logic. The test still passes because pool.height advances one block at a time, unlocking each pruned peer, but the test now exercises different behavior than intended (single-peer bootstrap instead of ten-peer parallel sync). Consider applying the same `start` base override here for consistency and test fidelity.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(blocksync): prevent maxPeerHeight po..." | Re-trigger Greptile

Comment thread blocksync/pool.go Resolved
Comment thread blocksync/pool.go
func (pool *BlockPool) updateMaxPeerHeight() {
var max int64
for _, peer := range pool.peers {
if pool.height > 0 && peer.base > pool.height {

@yihuang yihuang Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We validate the peer.base here but take the peer.height as the max.
What if the malicious peer report a normal base but a very high height, is that a problem?

EDIT: on a second thought, I think the PR do works, because when we sync to the non-exist height, we'll eventually remove that peer and reset the pool.maxPeerHeight.

@aljo242
aljo242 merged commit a7e53f0 into main Apr 22, 2026
34 checks passed
mergify Bot added a commit that referenced this pull request Apr 22, 2026
Cherry-picks
[berachain#40](berachain#40)
(@fridrik01) into upstream blocksync/. Fixes a deadlock where a
malicious peer can poison maxPeerHeight with an inflated base/height
that no peer can serve, stalling IsCaughtUp forever.

Taken from commit 1 of the PR rather than the final state, which keeps
the base > height ban and PopRequest recompute that commit 2 stripped
back out.<hr>This is an automatic backport of pull request #5803 done by
[Mergify](https://mergify.com).

Co-authored-by: Vlad J <[email protected]>
vladjdk added a commit that referenced this pull request Apr 22, 2026
Cherry-picks
[berachain#40](berachain#40)
(@fridrik01) into upstream blocksync/. Fixes a deadlock where a
malicious peer can poison maxPeerHeight with an inflated base/height
that no peer can serve, stalling IsCaughtUp forever.

Taken from commit 1 of the PR rather than the final state, which keeps
the base > height ban and PopRequest recompute that commit 2 stripped
back out.<hr>This is an automatic backport of pull request #5803 done by
[Mergify](https://mergify.com).
peternose pushed a commit to oasisprotocol/cometbft that referenced this pull request May 19, 2026
JayT106 added a commit to crypto-org-chain/cometbft that referenced this pull request May 27, 2026
* fix(blocksync): prevent maxPeerHeight poisoning (cometbft#5803)

(cherry picked from commit a7e53f0)

* chore(execution, state): height validation (cometbft#5804)

Improves height validation in state and execution.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 4c067e2)

* fix(lp2p): reactor panic recovery (backport cometbft#5816) (cometbft#5817)

Closes STACK-2679

---

#### PR checklist

- [x] Tests written/updated
- [x] Changelog entry added in `CHANGELOG.md`
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
<hr>This is an automatic backport of pull request cometbft#5816 done by
[Mergify](https://mergify.com).

Co-authored-by: Dmitry S <[email protected]>

* build(deps): Bump github.com/Masterminds/semver/v3 from 3.4.0 to 3.5.0 (backport cometbft#5823) (cometbft#5824)

Bumps
[github.com/Masterminds/semver/v3](https://github.com/Masterminds/semver)
from 3.4.0 to 3.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/Masterminds/semver/releases">github.com/Masterminds/semver/v3's
releases</a>.</em></p>
<blockquote>
<h2>v3.5.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Adding more prerelease tests by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/273">Masterminds/semver#273</a></li>
<li>Update constraint error messages by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/278">Masterminds/semver#278</a></li>
<li>Fix edge cases by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/279">Masterminds/semver#279</a></li>
<li>Adding some checks in by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/280">Masterminds/semver#280</a></li>
<li>Updating deps by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/281">Masterminds/semver#281</a></li>
<li>Bump github/codeql-action from 4.35.1 to 4.35.2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/Masterminds/semver/pull/282">Masterminds/semver#282</a></li>
<li>Bump actions/cache from 4.2.3 to 5.0.5 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/Masterminds/semver/pull/283">Masterminds/semver#283</a></li>
<li>Bump golangci/golangci-lint-action from 7.0.1 to 9.2.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/Masterminds/semver/pull/284">Masterminds/semver#284</a></li>
<li>Updating gitignore for devcontainers by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/286">Masterminds/semver#286</a></li>
<li>Fixing some quality issues by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/287">Masterminds/semver#287</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
made their first contribution in <a
href="https://redirect.github.com/Masterminds/semver/pull/282">Masterminds/semver#282</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/Masterminds/semver/compare/v3.4.0...v3.5.0">https://github.com/Masterminds/semver/compare/v3.4.0...v3.5.0</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/Masterminds/semver/blob/master/CHANGELOG.md">github.com/Masterminds/semver/v3's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/Masterminds/semver/commit/8b89c86cb53c57cfd5d07c13de12bc4d78954e99"><code>8b89c86</code></a>
Merge pull request <a
href="https://redirect.github.com/Masterminds/semver/issues/287">#287</a>
from mattfarina/fix-da-issues</li>
<li><a
href="https://github.com/Masterminds/semver/commit/29d51d0ea4bffe39173673685d0dd312447d74a7"><code>29d51d0</code></a>
Fixing some quality issues</li>
<li><a
href="https://github.com/Masterminds/semver/commit/87f651dbe2f616342d6408b997ad7116ba72ddf3"><code>87f651d</code></a>
Merge pull request <a
href="https://redirect.github.com/Masterminds/semver/issues/286">#286</a>
from mattfarina/update-devcontainer</li>
<li><a
href="https://github.com/Masterminds/semver/commit/158a6852a7e66d99594653227d3e8c3dc6d160ca"><code>158a685</code></a>
Updating gitignore for devcontainers</li>
<li><a
href="https://github.com/Masterminds/semver/commit/7e83c080cfb4455752c654805b189274a10890ab"><code>7e83c08</code></a>
Merge pull request <a
href="https://redirect.github.com/Masterminds/semver/issues/284">#284</a>
from Masterminds/dependabot/github_actions/golangci/g...</li>
<li><a
href="https://github.com/Masterminds/semver/commit/697e27f32e7419eb896e7d3ec680c65fc673166b"><code>697e27f</code></a>
Merge pull request <a
href="https://redirect.github.com/Masterminds/semver/issues/283">#283</a>
from Masterminds/dependabot/github_actions/actions/ca...</li>
<li><a
href="https://github.com/Masterminds/semver/commit/1591f8e3806198f60fa4dcaf2751bfc805c7740d"><code>1591f8e</code></a>
Merge pull request <a
href="https://redirect.github.com/Masterminds/semver/issues/282">#282</a>
from Masterminds/dependabot/github_actions/github/cod...</li>
<li><a
href="https://github.com/Masterminds/semver/commit/3f5ff1737a28437e536d3ec54e41919577748ae6"><code>3f5ff17</code></a>
Bump golangci/golangci-lint-action from 7.0.1 to 9.2.0</li>
<li><a
href="https://github.com/Masterminds/semver/commit/04baa3376047b6d5e79ffcc60f69332dd3e26c85"><code>04baa33</code></a>
Bump actions/cache from 4.2.3 to 5.0.5</li>
<li><a
href="https://github.com/Masterminds/semver/commit/45939fec77cd7d07d586b823284d11423028e9c2"><code>45939fe</code></a>
Bump github/codeql-action from 4.35.1 to 4.35.2</li>
<li>Additional commits viewable in <a
href="https://github.com/Masterminds/semver/compare/v3.4.0...v3.5.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/Masterminds/semver/v3&package-manager=go_modules&previous-version=3.4.0&new-version=3.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details><hr>This is an automatic backport of pull request cometbft#5823 done
by [Mergify](https://mergify.com).

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): Bump github.com/Masterminds/semver/v3 from 3.4.0 to 3.5.0 (backport cometbft#5823) (cometbft#5824)

Bumps
[github.com/Masterminds/semver/v3](https://github.com/Masterminds/semver)
from 3.4.0 to 3.5.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/Masterminds/semver/releases">github.com/Masterminds/semver/v3's
releases</a>.</em></p>
<blockquote>
<h2>v3.5.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Adding more prerelease tests by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/273">Masterminds/semver#273</a></li>
<li>Update constraint error messages by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/278">Masterminds/semver#278</a></li>
<li>Fix edge cases by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/279">Masterminds/semver#279</a></li>
<li>Adding some checks in by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/280">Masterminds/semver#280</a></li>
<li>Updating deps by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/281">Masterminds/semver#281</a></li>
<li>Bump github/codeql-action from 4.35.1 to 4.35.2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/Masterminds/semver/pull/282">Masterminds/semver#282</a></li>
<li>Bump actions/cache from 4.2.3 to 5.0.5 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/Masterminds/semver/pull/283">Masterminds/semver#283</a></li>
<li>Bump golangci/golangci-lint-action from 7.0.1 to 9.2.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
in <a
href="https://redirect.github.com/Masterminds/semver/pull/284">Masterminds/semver#284</a></li>
<li>Updating gitignore for devcontainers by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/286">Masterminds/semver#286</a></li>
<li>Fixing some quality issues by <a
href="https://github.com/mattfarina"><code>@​mattfarina</code></a> in <a
href="https://redirect.github.com/Masterminds/semver/pull/287">Masterminds/semver#287</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot]
made their first contribution in <a
href="https://redirect.github.com/Masterminds/semver/pull/282">Masterminds/semver#282</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/Masterminds/semver/compare/v3.4.0...v3.5.0">https://github.com/Masterminds/semver/compare/v3.4.0...v3.5.0</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/Masterminds/semver/blob/master/CHANGELOG.md">github.com/Masterminds/semver/v3's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/Masterminds/semver/commit/8b89c86cb53c57cfd5d07c13de12bc4d78954e99"><code>8b89c86</code></a>
Merge pull request <a
href="https://redirect.github.com/Masterminds/semver/issues/287">#287</a>
from mattfarina/fix-da-issues</li>
<li><a
href="https://github.com/Masterminds/semver/commit/29d51d0ea4bffe39173673685d0dd312447d74a7"><code>29d51d0</code></a>
Fixing some quality issues</li>
<li><a
href="https://github.com/Masterminds/semver/commit/87f651dbe2f616342d6408b997ad7116ba72ddf3"><code>87f651d</code></a>
Merge pull request <a
href="https://redirect.github.com/Masterminds/semver/issues/286">#286</a>
from mattfarina/update-devcontainer</li>
<li><a
href="https://github.com/Masterminds/semver/commit/158a6852a7e66d99594653227d3e8c3dc6d160ca"><code>158a685</code></a>
Updating gitignore for devcontainers</li>
<li><a
href="https://github.com/Masterminds/semver/commit/7e83c080cfb4455752c654805b189274a10890ab"><code>7e83c08</code></a>
Merge pull request <a
href="https://redirect.github.com/Masterminds/semver/issues/284">#284</a>
from Masterminds/dependabot/github_actions/golangci/g...</li>
<li><a
href="https://github.com/Masterminds/semver/commit/697e27f32e7419eb896e7d3ec680c65fc673166b"><code>697e27f</code></a>
Merge pull request <a
href="https://redirect.github.com/Masterminds/semver/issues/283">#283</a>
from Masterminds/dependabot/github_actions/actions/ca...</li>
<li><a
href="https://github.com/Masterminds/semver/commit/1591f8e3806198f60fa4dcaf2751bfc805c7740d"><code>1591f8e</code></a>
Merge pull request <a
href="https://redirect.github.com/Masterminds/semver/issues/282">#282</a>
from Masterminds/dependabot/github_actions/github/cod...</li>
<li><a
href="https://github.com/Masterminds/semver/commit/3f5ff1737a28437e536d3ec54e41919577748ae6"><code>3f5ff17</code></a>
Bump golangci/golangci-lint-action from 7.0.1 to 9.2.0</li>
<li><a
href="https://github.com/Masterminds/semver/commit/04baa3376047b6d5e79ffcc60f69332dd3e26c85"><code>04baa33</code></a>
Bump actions/cache from 4.2.3 to 5.0.5</li>
<li><a
href="https://github.com/Masterminds/semver/commit/45939fec77cd7d07d586b823284d11423028e9c2"><code>45939fe</code></a>
Bump github/codeql-action from 4.35.1 to 4.35.2</li>
<li>Additional commits viewable in <a
href="https://github.com/Masterminds/semver/compare/v3.4.0...v3.5.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/Masterminds/semver/v3&package-manager=go_modules&previous-version=3.4.0&new-version=3.5.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details><hr>This is an automatic backport of pull request cometbft#5823 done
by [Mergify](https://mergify.com).

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(light): stop witness comparison after divergence checks (backport cometbft#5820) (cometbft#5825)

Return immediately when a witness reports conflicting headers or
proposer-priority divergence so the detector cannot treat a mismatch as
a valid match. Add a detector test that keeps header hashes equal while
diverging proposer priorities to verify ErrProposerPrioritiesDiverge is
returned.

---

#### PR checklist

- [x] Tests written/updated
- [x] Changelog entry added in `CHANGELOG.md`
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments
<hr>This is an automatic backport of pull request cometbft#5820 done by
[Mergify](https://mergify.com).

Co-authored-by: JayT106 <[email protected]>
Co-authored-by: Matt Acciai <[email protected]>

* perf(consensus): skip fsync for unsigned internal messages (block parts) (cometbft#5695)

## Summary

- Skip `fsync` (`WriteSync`) for `BlockPartMessage` in the consensus
WAL's `receiveRoutine`, using buffered `Write` instead
- Only signed messages (`VoteMessage`, `ProposalMessage`) retain
`WriteSync` for double-signing prevention
- Adds explicit type-switch with `default: panic` to prevent future
signed message types from silently bypassing fsync
- Replaces stale TODO in `replay_test.go` with documentation of the
selective-fsync approach

## Safety analysis

**Why signed messages MUST keep `WriteSync`:**
- Pre-sign `FlushAndSync` ensures WAL replay reaches the same
deterministic state
- Post-sign `WriteSync` ensures the signed message is durable before
`handleMsg` processes/broadcasts it
- Without this, crash-replay could re-sign a different vote →
equivocation

**Why `BlockPartMessage` can safely use `Write`:**
1. Block parts are unsigned data chunks derived from the proposal block
2. On crash: proposal exists (fsynced), some block parts may be missing
→ round times out → consensus proceeds
3. The periodic 2-second WAL flush (`processFlushTicks`) eventually
flushes them
4. Any subsequent `WriteSync` (vote) or `FlushAndSync` (pre-sign) also
flushes buffered block parts
5. `EndHeightMessage` uses `WriteSync`, which flushes ALL buffered
writes before the end marker

**Defensive measures:**
- Explicit `case *BlockPartMessage` (not `default`) ensures new message
types panic rather than silently bypassing fsync
- `default: panic("unexpected internal message type")` with SAFETY
comment for future maintainers
- WAL `Write` failure panics (matches `WriteSync` behavior) since write
errors indicate disk failure

## Benchmark results (Apple M1 Max SSD)

```
BenchmarkWALWrite-10          ~1μs/op     1680 B/op    13 allocs/op
BenchmarkWALWriteSync-10      ~4.4ms/op   1680 B/op    13 allocs/op

BenchmarkWALRoundSimulation/AllWriteSync-10       ~233ms/round
BenchmarkWALRoundSimulation/SelectiveFsync-10     ~9.3ms/round  (~25x faster)
```

---

#### PR checklist

- [x] Tests written/updated
- [x] Changelog entry added in `CHANGELOG.md`
- [x] Updated relevant documentation (`docs/` or `spec/`) and code
comments

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Dmitry S <[email protected]>
(cherry picked from commit 62a15e7)

* fix(abci): prevent panic on unlock in socket server panic recovery (cometbft#5593)

---

#### PR checklist
Fix a bug in handleRequests where the panic recovery defer function
would attempt to unlock appMtx even when the lock was never acquired.
- [x] Tests written/updated
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments

---------

Co-authored-by: Alex | Cosmos Labs <[email protected]>
Co-authored-by: Dmitry S <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 320e79e)

* changelog

* changelog

* chore(v0.39.2): restore Krakatoa app mempool and finalize changelog (cometbft#5827)

## Summary
- Cherry-pick Krakatoa restoration commit `f4a9ba936` into
`chore/0.39.2-prep`, restoring app mempool/reactor flow and related
ABCI/proxy/config wiring.
- Reintroduce app-mempool e2e fixtures and proto/generated ABCI updates
required for the restored flow.
- Finalize `v0.39.2` release notes in `CHANGELOG.md` while keeping
existing backport entries (`cometbft#5803`, `cometbft#5804`, `cometbft#5816`, `cometbft#5820`, `cometbft#5823`).

## Test plan
- [x] `go test ./abci/... ./mempool/... ./proxy/... ./config/...`
- [x] `make proto-gen`
- [x] `make proto-lint`

---------

Co-authored-by: Dmitry S <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Eric Warehime <[email protected]>
Co-authored-by: mattac21 <[email protected]>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix(mempool): allow CheckTx retries (backport cometbft#5802) (cometbft#5832)

Backport cometbft#5802

Closes STACK-2402

* fix(mempool): allow CheckTx retries (backport cometbft#5802) #2 (cometbft#5833)

---

#### PR checklist

- [ ] Tests written/updated
- [ ] Changelog entry added in `CHANGELOG.md`
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments

* build(deps): Bump github.com/lib/pq from 1.11.2 to 1.12.0 (backport cometbft#5713) (cometbft#5723)

Bumps [github.com/lib/pq](https://github.com/lib/pq) from 1.11.2 to
1.12.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/lib/pq/releases">github.com/lib/pq's
releases</a>.</em></p>
<blockquote>
<h2>v1.12.0</h2>
<ul>
<li>
<p>The next release may change the default sslmode from
<code>require</code> to <code>prefer</code>. See <a
href="https://redirect.github.com/lib/pq/issues/1271">#1271</a> for
details.</p>
</li>
<li>
<p><code>CopyIn()</code> and <code>CopyInToSchema()</code> have been
marked as deprecated. These are simple query builders and not needed for
<code>COPY [..] FROM STDIN</code> support (which is <em>not</em>
deprecated). (<a
href="https://redirect.github.com/lib/pq/issues/1279">#1279</a>)</p>
<pre><code>// Old
tx.Prepare(CopyIn(&quot;temp&quot;, &quot;num&quot;, &quot;text&quot;,
&quot;blob&quot;, &quot;nothing&quot;))
<p>// Replacement
tx.Prepare(<code>copy temp (num, text, blob, nothing) from stdin</code>)
</code></pre></p>
</li>
</ul>
<h3>Features</h3>
<ul>
<li>
<p>Support protocol 3.2, and the <code>min_protocol_version</code> and
<code>max_protocol_version</code> DSN parameters (<a
href="https://redirect.github.com/lib/pq/issues/1258">#1258</a>).</p>
</li>
<li>
<p>Support <code>sslmode=prefer</code> and <code>sslmode=allow</code>
(<a
href="https://redirect.github.com/lib/pq/issues/1270">#1270</a>).</p>
</li>
<li>
<p>Support <code>ssl_min_protocol_version</code> and
<code>ssl_max_protocol_version</code> (<a
href="https://redirect.github.com/lib/pq/issues/1277">#1277</a>).</p>
</li>
<li>
<p>Support connection service file to load connection details (<a
href="https://redirect.github.com/lib/pq/issues/1285">#1285</a>).</p>
</li>
<li>
<p>Support <code>sslrootcert=system</code> and use
<code>~/.postgresql/root.crt</code> as the default value of sslrootcert
(<a href="https://redirect.github.com/lib/pq/issues/1280">#1280</a>, <a
href="https://redirect.github.com/lib/pq/issues/1281">#1281</a>).</p>
</li>
<li>
<p>Add a new <code>pqerror</code> package with PostgreSQL error codes
(<a
href="https://redirect.github.com/lib/pq/issues/1275">#1275</a>).</p>
<p>For example, to test if an error is a UNIQUE constraint
violation:</p>
<pre><code>if pqErr, ok :=
errors.AsType[*pq.Error](https://github.com/lib/pq/blob/HEAD/err); ok
&amp;&amp; pqErr.Code == pqerror.UniqueViolation {
    log.Fatalf(&quot;email %q already exsts&quot;, email)
}
</code></pre>
<p>To make this a bit more convenient, it also adds a
<code>pq.As()</code> function:</p>
<pre><code>pqErr := pq.As(err, pqerror.UniqueViolation)
if pqErr != nil {
    log.Fatalf(&quot;email %q already exsts&quot;, email)
}
</code></pre>
</li>
</ul>
<h3>Fixes</h3>
<ul>
<li>
<p>Fix SSL key permission check to allow modes stricter than 0600/0640
(<a
href="https://redirect.github.com/lib/pq/issues/1265">#1265</a>).</p>
</li>
<li>
<p>Fix Hstore to work with binary parameters (<a
href="https://redirect.github.com/lib/pq/issues/1278">#1278</a>).</p>
</li>
<li>
<p>Clearer error when starting a new query while pq is still processing
another query (<a
href="https://redirect.github.com/lib/pq/issues/1272">#1272</a>).</p>
</li>
<li>
<p>Send intermediate CAs with client certificates, so they can be signed
by an intermediate CA (<a
href="https://redirect.github.com/lib/pq/issues/1267">#1267</a>).</p>
</li>
<li>
<p>Use <code>time.UTC</code> for UTC aliases such as
<code>Etc/UTC</code> (<a
href="https://redirect.github.com/lib/pq/issues/1283">#1283</a>).</p>
</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/lib/pq/blob/master/CHANGELOG.md">github.com/lib/pq's
changelog</a>.</em></p>
<blockquote>
<h2>v1.12.0 (2026-03-18)</h2>
<ul>
<li>
<p>The next release may change the default sslmode from
<code>require</code> to <code>prefer</code>.
See <a href="https://redirect.github.com/lib/pq/issues/1271">#1271</a>
for details.</p>
</li>
<li>
<p><code>CopyIn()</code> and <code>CopyInToSchema()</code> have been
marked as deprecated. These are
simple query builders and not needed for <code>COPY [..] FROM
STDIN</code> support (which
is <em>not</em> deprecated). (<a
href="https://redirect.github.com/lib/pq/issues/1279">#1279</a>)</p>
<pre><code>// Old
tx.Prepare(CopyIn(&quot;temp&quot;, &quot;num&quot;, &quot;text&quot;,
&quot;blob&quot;, &quot;nothing&quot;))
<p>// Replacement
tx.Prepare(<code>copy temp (num, text, blob, nothing) from stdin</code>)
</code></pre></p>
</li>
</ul>
<h3>Features</h3>
<ul>
<li>
<p>Support protocol 3.2, and the <code>min_protocol_version</code> and
<code>max_protocol_version</code> DSN parameters (<a
href="https://redirect.github.com/lib/pq/issues/1258">#1258</a>).</p>
</li>
<li>
<p>Support <code>sslmode=prefer</code> and <code>sslmode=allow</code>
(<a
href="https://redirect.github.com/lib/pq/issues/1270">#1270</a>).</p>
</li>
<li>
<p>Support <code>ssl_min_protocol_version</code> and
<code>ssl_max_protocol_version</code> (<a
href="https://redirect.github.com/lib/pq/issues/1277">#1277</a>).</p>
</li>
<li>
<p>Support connection service file to load connection details (<a
href="https://redirect.github.com/lib/pq/issues/1285">#1285</a>).</p>
</li>
<li>
<p>Support <code>sslrootcert=system</code> and use
<code>~/.postgresql/root.crt</code> as the default
value of sslrootcert (<a
href="https://redirect.github.com/lib/pq/issues/1280">#1280</a>, <a
href="https://redirect.github.com/lib/pq/issues/1281">#1281</a>).</p>
</li>
<li>
<p>Add a new <code>pqerror</code> package with PostgreSQL error codes
(<a
href="https://redirect.github.com/lib/pq/issues/1275">#1275</a>).</p>
<p>For example, to test if an error is a UNIQUE constraint
violation:</p>
<pre><code>if pqErr, ok :=
errors.AsType[*pq.Error](https://github.com/lib/pq/blob/master/err); ok
&amp;&amp; pqErr.Code == pqerror.UniqueViolation {
    log.Fatalf(&quot;email %q already exsts&quot;, email)
}
</code></pre>
<p>To make this a bit more convenient, it also adds a
<code>pq.As()</code> function:</p>
<pre><code>pqErr := pq.As(err, pqerror.UniqueViolation)
if pqErr != nil {
    log.Fatalf(&quot;email %q already exsts&quot;, email)
}
</code></pre>
</li>
</ul>
<h3>Fixes</h3>
<ul>
<li>
<p>Fix SSL key permission check to allow modes stricter than <a
href="https://redirect.github.com/0600/0640/issues/0600">0600/06400600</a>
(<a
href="https://redirect.github.com/lib/pq/issues/1265">#1265</a>).</p>
</li>
<li>
<p>Fix Hstore to work with binary parameters (<a
href="https://redirect.github.com/lib/pq/issues/1278">#1278</a>).</p>
</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/lib/pq/commit/42ab0ff7c4b1b585fa6cd216a12a126715b5af06"><code>42ab0ff</code></a>
Change default sslmode from &quot;require&quot; to
&quot;prefer&quot;</li>
<li><a
href="https://github.com/lib/pq/commit/6d40f13cfefe5ae4b489404b45114ba03224947a"><code>6d40f13</code></a>
Release v1.12.0</li>
<li><a
href="https://github.com/lib/pq/commit/386fc0e764f82951e9706dd8e618fc416fb5fb2c"><code>386fc0e</code></a>
Document NULL behaviour with COPY</li>
<li><a
href="https://github.com/lib/pq/commit/a62682e9083edee5ffe2d3904e80c30aaaa0877f"><code>a62682e</code></a>
Better staticcheck cache 2</li>
<li><a
href="https://github.com/lib/pq/commit/87ee06c600347478cfef07ad31b5ea617008aee7"><code>87ee06c</code></a>
Better staticcheck cache</li>
<li><a
href="https://github.com/lib/pq/commit/09624587cd3d4b69cd4a1a3b403b544ec0ddb2f7"><code>0962458</code></a>
Rewrite tests to use pqerror, pq.As()</li>
<li><a
href="https://github.com/lib/pq/commit/0d209810a155b9b8a173ab6d5da332f8c6cbc2c9"><code>0d20981</code></a>
Don't move pq.Error to pqerror.Error</li>
<li><a
href="https://github.com/lib/pq/commit/433213859e656dfe7dbba17b2838839e03a43ca2"><code>4332138</code></a>
Add pqerror package</li>
<li><a
href="https://github.com/lib/pq/commit/620d6d50817f9c4dcbfcbfeadb12ec552b636bf3"><code>620d6d5</code></a>
Make tests run faster</li>
<li><a
href="https://github.com/lib/pq/commit/dc8ff5d519b00bfa67626e68ea1ff3fdde0cc1b2"><code>dc8ff5d</code></a>
Implement connection service file</li>
<li>Additional commits viewable in <a
href="https://github.com/lib/pq/compare/v1.11.2...v1.12.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/lib/pq&package-manager=go_modules&previous-version=1.11.2&new-version=1.12.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details><hr>This is an automatic backport of pull request cometbft#5713 done
by [Mergify](https://mergify.com).

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: aljo242 <[email protected]>
Co-authored-by: mattac21 <[email protected]>

* chore: changelog updates for release (cometbft#5836)

---

#### PR checklist

- [ ] Tests written/updated
- [ ] Changelog entry added in `CHANGELOG.md`
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments

* test(consensus): fix flaky TestByzantinePrevoteEquivocation (backport cometbft#5814) (cometbft#5840)

## Summary
Fix the failing CI at
https://github.com/cometbft/cometbft/actions/runs/25421557069/job/74564693795?pr=5837

`TestByzantinePrevoteEquivocation` was sporadically timing out on CI
under the `-race` detector. The root cause was goroutine leaks:
subscriptions were created with `context.Background()`, so the
subscriber goroutines had no clean exit path when a block with evidence
never arrived — they blocked forever on `sub.Out()`, leaked across
tests, and exhausted resources on the runner.

## Changes

- Replace `for range sub.Out()` with a `select` that also handles
`sub.Canceled()`, so goroutines exit cleanly when the eventbus stops
during test cleanup
- Add `subErrCh` to surface unexpected subscription cancellation errors
instead of silently swallowing them

## Test plan

- [x] `go test ./consensus/... -run TestByzantinePrevoteEquivocation -v
-count=1` passes locally
- [x] CI passing<hr>This is an automatic backport of pull request cometbft#5814
done by [Mergify](https://mergify.com).

Co-authored-by: songgaoye <[email protected]>

* test(consensus): fix cs.GetRoundState deadlock after ensureNewProposal (backport cometbft#5815) (cometbft#5842)

The same deadlock pattern existed across multiple consensus tests in
`state_test.go`, `replay_test.go`, and `node_test.go`:

- The consensus goroutine holds `cs.mtx` while publishing a vote event
  and blocks until the test drains it.
- The test calls `cs.GetRoundState()` (which acquires `cs.mtx`) between
  receiving the proposal event and draining the vote channel.
- Both sides wait on each other until `go test -timeout` aborts the run.

**Fix:** make `ensureNewProposal` return the `types.BlockID` from the
`EventDataCompleteProposal` it already reads. All call sites that only
needed `ProposalBlock.Hash()` and `ProposalBlockParts.Header()` now use
`blockID.Hash` and `blockID.PartSetHeader` directly. For sites that need
the full `ProposalBlock` (e.g. `Time`, `Txs`) but only use it after
channel drains, `GetRoundState()` is deferred to after those drains.

**Files fixed:**
- `consensus/common_test.go`: `ensureNewProposal` now returns
`types.BlockID`
- `consensus/state_test.go`: 13 call sites fixed across 11 tests
- `consensus/replay_test.go`: 6 call sites fixed in
`setupChainWithChangingValidators`
- `node/node_test.go`: 4 tests fixed to not bind the hardcoded GRPC port
36658,
  preventing address-in-use failures when tests run in parallel

#### PR checklist

- [x] Tests written/updated
- [ ] Changelog entry added in `CHANGELOG.md`
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments<hr>This is an automatic backport of pull request cometbft#5815 done by
[Mergify](https://mergify.com).

Co-authored-by: songgaoye <[email protected]>

* fix(mempool): fix setRecheckFull/setDone race causing spurious ErrRecheckFull (backport cometbft#5837) (cometbft#5844)

* fix(blocksync): validate blocksync response sender and signature count (backport cometbft#5860) (cometbft#5862)

---

Adds additional validation to blocksync, ensuring _before response
unmarshalling_ that we have made a `BlockRequest` to the peer that is
sending us a `BlockResponse` recently, and also that the response
contains a valid amount of commit signatures (not > MaxVoteCount). To do
this preunmarshal validation, we have added a `MsgBytesFilter` interface
that `Reactors` can implement. Currently only `BLOCKSYNC` does. The
`FilterMsgBytes` function is called for both comet P2P and libp2p
implementations, inside of the `onReceive` function when setting up a
peer for comet p2p, and inside of `handleStream` for libp2p, just before
unmarshalling the message in both.

#### PR checklist

- [x] Tests written/updated
- [x] Changelog entry added in `CHANGELOG.md`
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
<hr>This is an automatic backport of pull request cometbft#5860 done by
[Mergify](https://mergify.com).

Co-authored-by: mattac21 <[email protected]>

* feat(consensus): additional validation for vote ext signatures (backport cometbft#5873) (cometbft#5876)

<hr>This is an automatic backport of pull request cometbft#5873 done by
[Mergify](https://mergify.com).

Co-authored-by: Dmitry S <[email protected]>
Co-authored-by: Alex | Cosmos Labs <[email protected]>

* test(types): clarify EventBusBufferCapacity test intent (cometbft#5886)

improves the test added in cometbft#5883:

- rename `cap` → `bufCap` (shadows the builtin `cap` function)
- add a comment explaining why the server is intentionally not started
(blocking is on the `s.cmds` channel level, not subscriber delivery)
- use `range bufCap` loop instead of hardcoded publish calls
- collapse final assertion to one line

---------

Co-authored-by: jay.tseng <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Vlad J <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Dmitry S <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matt Acciai <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: songgaoye <[email protected]>
Co-authored-by: Alex | Cosmos Labs <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Eric Warehime <[email protected]>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: songgaoye <[email protected]>
peternose pushed a commit to oasisprotocol/cometbft that referenced this pull request Jun 5, 2026
peternose added a commit to oasisprotocol/cometbft that referenced this pull request Jun 5, 2026
aljo242 pushed a commit to rach-id/cometbft that referenced this pull request Jun 15, 2026
…ahead

After cometbft#5803 added the `peer.base > pool.height` filter in
updateMaxPeerHeight, peers whose lowest stored block is above the one we
need are excluded from maxPeerHeight. When every connected peer falls
into that bucket, maxPeerHeight collapses to 0 — and the existing
`pool.maxPeerHeight == 0 || …` shortcut in IsCaughtUp then declared the
node caught up, prematurely flipping it from blocksync to consensus even
though no peer could actually serve the next block.

Distinguish the two cases that produce maxPeerHeight == 0:

  1. Fresh network — every peer reports height 0. We are caught up to
     the network and should switch to consensus.
  2. Stalled — peers report blocks but every base is ahead of
     pool.height. We are not caught up and must stay in blocksync.

Introduces anyPeerHasBlocks() (peer.mtx-locked helper) and uses it as
the tiebreaker when maxPeerHeight is 0. Adds two regression tests:
TestBlockPoolIsCaughtUpAllPeersPrunedAhead and
TestBlockPoolIsCaughtUpFreshNetwork.

Refs cometbft#5801
aljo242 pushed a commit to rach-id/cometbft that referenced this pull request Jun 15, 2026
…ahead

After cometbft#5803 added the `peer.base > pool.height` filter in
updateMaxPeerHeight, peers whose lowest stored block is above the one we
need are excluded from maxPeerHeight. When every connected peer falls
into that bucket, maxPeerHeight collapses to 0 — and the existing
`pool.maxPeerHeight == 0 || …` shortcut in IsCaughtUp then declared the
node caught up, prematurely flipping it from blocksync to consensus even
though no peer could actually serve the next block.

Distinguish the two cases that produce maxPeerHeight == 0:

  1. Fresh network — every peer reports height 0. We are caught up to
     the network and should switch to consensus.
  2. Stalled — peers report blocks but every base is ahead of
     pool.height. We are not caught up and must stay in blocksync.

Introduces anyPeerHasBlocks() (peer.mtx-locked helper) and uses it as
the tiebreaker when maxPeerHeight is 0. Adds two regression tests:
TestBlockPoolIsCaughtUpAllPeersPrunedAhead and
TestBlockPoolIsCaughtUpFreshNetwork.

Refs cometbft#5801
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v0.38.x Tell Mergify to backport the PR to v0.38.x backport-to-v0.39.x Tell Mergify to backport the PR to v0.39.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants