Skip to content

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

Merged
swift1337 merged 2 commits into
v0.39.xfrom
v0.39.x-pr-5802
May 5, 2026
Merged

swift1337 merged 2 commits into
v0.39.xfrom
v0.39.x-pr-5802

Conversation

@swift1337

Copy link
Copy Markdown
Member

Backport #5802

Closes STACK-2402

@linear

linear Bot commented May 5, 2026

Copy link
Copy Markdown

@swift1337
swift1337 changed the base branch from main to v0.39.x May 5, 2026 13:22
@swift1337
swift1337 marked this pull request as ready for review May 5, 2026 13:23
Comment thread CHANGELOG.md Resolved
@greptile-apps

greptile-apps Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This backport introduces CheckTx retry support by replacing the synchronous TxCache seen-cache with a new generic LRU-backed guard.Guard, and by scheduling delayed eviction (via ForgetAfter) for rejected transactions so that RPC clients can resubmit them after a cooldown period. Non-retryable errors are forgotten after the full check_tx_retry_delay (default 5 s) while retryable errors use a tenth of that window (500 ms).

Confidence Score: 4/5

Safe to merge; all findings are P2 (comment accuracy and a known scalability trade-off)

No P0/P1 bugs found. The goroutine-per-rejection pattern is bounded by the LRU capacity and acknowledged with a TODO. The misleading "blocking" comment and the under-described config field are cosmetic issues that don't affect correctness.

internal/guard/guard.go — the ForgetAfter goroutine-per-call pattern warrants a follow-up ticket before the LRU size is tuned to very large values

Important Files Changed

Filename Overview
internal/guard/guard.go New generic LRU-backed deduplication guard; ForgetAfter spawns one goroutine per call with an acknowledged TODO about scalability
mempool/app_mempool.go Replaces TxCache with the new Guard; adds forgetTx for delayed cache eviction on rejected/retryable CheckTx and InsertTx calls; misleading "blocking" comment on forgetTx
config/config.go Adds CheckTxRetryDelay field with a 5 s default; comment describes only the CheckTx use-case, omitting the InsertTx retry path
internal/guard/guard_test.go Comprehensive unit tests for all Guard methods including async removal; covers edge cases (zero/negative capacity, zero/negative duration)
mempool/app_mempool_test.go Tests updated to cover retryable vs non-retryable CheckTx/InsertTx paths and async guard eviction; uses require.Eventually correctly for async assertions
config/toml.go Adds check_tx_retry_delay TOML template entry matching the new config field
CHANGELOG.md Changelog entry added under FEATURES for the CheckTx retry support

Sequence Diagram

sequenceDiagram
    participant Client as RPC Client
    participant Mempool as AppMempool
    participant Guard as guard.Guard (LRU)
    participant App as ABCI App

    Client->>Mempool: CheckTx(tx)
    Mempool->>Guard: Guard(tx.Key())
    alt already seen
        Guard-->>Mempool: false
        Mempool-->>Client: ErrSeenTx
    else not seen
        Guard-->>Mempool: true (added)
        Mempool->>App: CheckTx(tx) [goroutine]
        App-->>Mempool: ResponseCheckTx
        Mempool->>Client: callback(res)
        alt res.Code == OK
            Note over Guard: key stays in LRU
        else res.Code is retryable
            Mempool->>Guard: ForgetAfter(key, delay/10) goroutine sleeps 500ms
        else res.Code is non-retryable error
            Mempool->>Guard: ForgetAfter(key, delay) goroutine sleeps 5s
        end
    end

    Note over Client,Guard: After delay elapses, client may retry the same tx
Loading

Reviews (1): Last reviewed commit: "fix(mempool): allow CheckTx retries" | Re-trigger Greptile

Comment thread mempool/app_mempool.go Resolved
Comment thread internal/guard/guard.go Resolved
Comment thread config/config.go Resolved
@swift1337
swift1337 added this pull request to the merge queue May 5, 2026
Merged via the queue into v0.39.x with commit fabf8c2 May 5, 2026
34 checks passed
@swift1337
swift1337 deleted the v0.39.x-pr-5802 branch May 5, 2026 14:20
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants