Skip to content

build(deps): Bump golang.org/x/crypto from 0.54.0 to 0.55.0 - #1410

Closed
dependabot[bot] wants to merge 2 commits into
v1.7-devfrom
dependabot/go_modules/golang.org/x/crypto-0.55.0
Closed

dependabot[bot] wants to merge 2 commits into
v1.7-devfrom
dependabot/go_modules/golang.org/x/crypto-0.55.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Bumps golang.org/x/crypto from 0.54.0 to 0.55.0.

Commits
  • f44d03d go.mod: update golang.org/x dependencies
  • 5ed4944 crypto/internal/poly1305: provide optimised assembly for riscv64
  • b07833c ssh: return window credit for discarded extended data
  • d701c51 acme: fix nil pointer dereference in pebble test error reporting
  • 999d053 ssh: fix parsing of GSSAPI payloads offering multiple mechanisms
  • 90f76b8 ssh: reject certificate signature keys before recursing
  • b53964a ssh: permit empty but non-nil HostKeyAlgorithms, KeyExchanges, Ciphers, MACs
  • 626e40f ssh: drain stderr on forwarded TCP and Unix channels
  • 31914c6 x509roots/fallback: update bundle
  • f2135b8 all: clean up minor issues found by staticcheck
  • Additional commits viewable in compare view

@dependabot dependabot Bot added the dependencies Pull requests that update a dependency file label Aug 18, 2026
@dependabot dependabot Bot added the dependencies Pull requests that update a dependency file label Aug 18, 2026
@dependabot
dependabot Bot changed the base branch from v1.6-dev to v1.7-dev August 25, 2026 08:36
@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator

Dependency Security Review — golang.org/x/crypto 0.54.0 → 0.55.0

Verdict: SAFE. Merge it once CI stops sulking. The red X's on this PR are not this bump's fault, and I have receipts for that.

Change Summary

Package golang.org/x/crypto 0.54.0 → 0.55.0 (direct)
Bundled golang.org/x/text 0.40.0 → 0.41.0 (indirect)
Commits 21
Files changed 40 (+1268 / −261)
Nature Routine maintenance + ssh hardening. Zero CVE/GHSA fixes.

The x/text bump isn't dependabot freelancing — x/crypto v0.55.0's own go.mod moves its indirect x/text require from 0.40.0 to 0.41.0. It also requires x/net v0.57.0, which this repo already pins. No downgrades, no conflicts.

Diff Integrity

Cloned upstream and checked the actual history rather than trusting the changelog:

  • Tag integrity: v0.55.0 → f44d03d253a1503e51b059ca880867c51d878242, exactly the commit the PR description's changelog links. No moved tag.
  • Checksums: go mod verify → all modules verified. Hashes agree with go.sum and the Go checksum DB.
  • Undocumented content: none. All 21 commits map to the published compare view.
  • Install/lifecycle hooks: none — Go modules have no install hooks, and no CI/release workflow files changed.
  • Obfuscation: the only opaque blob is x509roots/fallback/bundle/bundle.der, the routine CA bundle refresh. Generated artifact, opaque before this update too, and outside our build graph.
  • Diff shape: proportionate. Big-ish for a point release, but it's ssh/ hardening, which tracks the post-0.52 audit wave.

Clean. Nothing here calls the trustworthiness of the update into question.

Known Vulnerabilities

OSV.dev queried for both modules. Nothing affects 0.54.0 or 0.55.0.

Module Highest fixed version across all advisories 0.55.0 / 0.41.0 impacted?
golang.org/x/crypto 0.52.0 No
golang.org/x/text 0.39.0 No

One open-ended advisory exists — GO-2026-5932 (x/crypto/openpgp is unmaintained and unsafe by design, no fixed version). Not applicable: openpgp is not in our build graph.

Unregistered security fixes — worth naming, because automated scanners are blind to these. v0.55.0 lands several hardening changes in ssh/ with no GHSA/CVE assigned: reject certificate signature keys before recursing, enforce the source-address critical option for all auth callbacks, reject a present-but-empty source-address option, fully initialise channels before adding them to chanList (race), make channel.close idempotent, sanitise error messages. Good fixes. None reachable from this repo — see below.

Codebase Impact Assessment

This is where the review gets pleasantly boring. go list -deps ./... gives the real answer, not grep:

x/crypto packages in our build graph: argon2, bcrypt, blake2b, blowfish, chacha20, chacha20poly1305, curve25519, hkdf, internal/alias, internal/poly1305, nacl/box, nacl/secretbox, pbkdf2, ripemd160, salsa20/salsa, sha3.

Directories touched by v0.55.0: acme/, internal/poly1305/, ocsp/, ssh/, ssh/agent/, x509roots/fallback/, go.mod/go.sum.

Intersection: internal/poly1305 only. 39 of 40 changed files are outside anything we compile. Notably ssh/ — where all the interesting hardening lives — is not in our graph at all.

And the one in-graph change is a no-op for us. The entire internal/poly1305 delta is riscv64 support:

mac_noasm.go: //go:build (!amd64 && !loong64 && !ppc64le && !ppc64 && !riscv64 && !s390x) || !gc || purego
sum_asm.go:   //go:build gc && !purego && (amd64 || loong64 || ppc64 || ppc64le || riscv64)

plus a new sum_riscv64.s. On amd64, sum_asm.go was selected before and is selected now. On arm64, mac_noasm.go was selected before and is selected now. Zero behavioural delta on any architecture we ship. Our chacha20poly1305 in internal/p2p/conn/secret_connection.go and privval/secret_connection.go gets byte-identical code.

Same story for x/text: secure/precis is the only package with a functional change (a genuine short-destination-buffer fix in the Nickname profile) and it is not in our build graph.

Consumer Package used Affected by this bump?
internal/p2p/conn/secret_connection.go chacha20poly1305, curve25519, hkdf, nacl/box No
privval/secret_connection.go chacha20poly1305, curve25519, hkdf, nacl/box No
crypto/secp256k1/secp256k1.go ripemd160 No

The Red CI — Not This PR's Doing

govulncheck — pre-existing, toolchain-level, and identical on the base branch.

All 6 reported vulnerabilities are in the Go standard library, none in x/crypto or x/text:

ID Package Found in Fixed in
GO-2026-6218 net/url go1.26.5 go1.26.6
GO-2026-6091 html/template go1.26.5 go1.26.6
GO-2026-6090 crypto/tls go1.26.5 go1.26.6
GO-2026-6089 net/http go1.26.5 go1.26.6
GO-2026-5972 encoding/asn1 go1.26.5 go1.26.6
GO-2026-5026 net/http go1.26.5 go1.26.6

The v1.7-dev push run 32049450842 reports the same six IDs, in the same order. This bump neither introduces them nor could have fixed them — it's a x/crypto bump and these are stdlib findings. The actual fix is bumping the CI Go toolchain to 1.26.6, which is a separate PR and explains why #1412 and #1411 are red the same way.

tests (01) — flaky, not caused by the bump. --- FAIL: TestWALRoundsSkipper (60.03s), waited too long for tendermint to produce 5 blocks. Evidence:

  • The v1.7-dev push run 32049450794 fails the same tests (01) job on the same internal/consensus package, with a different timing test (TestReactorValidatorSetChanges, 120.09s).
  • Locally on this PR head: -run TestWALRoundsSkipper -count=5 → 5/5 pass.
  • Causally impossible anyway: the only in-graph x/crypto change is a riscv64 build tag that resolves identically on amd64.

tests (03) / tests (04) hit the 6h job ceiling — infrastructure, not code.

Library Audit Findings

Severity Finding Location CWE
INFO x/crypto/openpgp permanently unfixed (GO-2026-5932) n/a — not in build graph —
INFO Several ssh/ hardening fixes shipped without GHSA/CVE; scanner-invisible ssh/ — not in build graph —

No CRITICAL / HIGH / MEDIUM / LOW findings applicable to this codebase.

Risk Assessment

Overall: Safe.

  • Diff integrity clean — tag matches published commit, checksums verified, nothing undocumented, no hooks, no exfil paths.
  • No known vulnerability affects either old or new version.
  • 39 of 40 changed files are outside our build graph; the 40th is architecture-gated to riscv64.
  • Upstream CVE discipline is good, but the unregistered ssh/ hardening means scanner silence ≠ safety for projects that do use x/crypto/ssh. Not us.

Verification

go mod verify                                          → all modules verified
go test ./internal/p2p/conn/... ./privval/... \
        ./crypto/secp256k1/...                         → ok (exit 0)
  internal/p2p/conn   ok  21.496s
  privval             ok   2.726s
  privval/grpc        ok   0.210s
  crypto/secp256k1    ok   0.113s
go test ./internal/consensus/ -run TestWALRoundsSkipper -count=5
                                                       → ok 12.732s (exit 0, 0/5 failures)

Run locally on cbfd1d7 with the repo's Makefile CGO flags against a freshly built dashbls.

Recommendations

  1. Merge this PR on its own merits — the dependency change itself is clean.
  2. Do not merge while CI is red. Rebasing onto current v1.7-dev is requested below; the tests (01) flake should clear on a re-run.
  3. govulncheck will stay red until the Go toolchain moves to 1.26.6. That is a separate, higher-value fix and it currently blocks build(deps): Bump golang.org/x/crypto from 0.54.0 to 0.55.0 #1410, build(deps): Bump github.com/stretchr/testify from 1.11.1 to 1.12.1 #1411 and build(deps): Bump golang.org/x/net from 0.57.0 to 0.58.0 #1412 alike. Worth its own PR rather than being re-litigated on every dependabot bump.
  4. Long-term: TestWALRoundsSkipper and TestReactorValidatorSetChanges are wall-clock-bound consensus tests that fail under CI load. They are burning reviewer attention on unrelated PRs and deserve either generous deadlines or a deflake.

🤖 Co-authored by Claudius the Magnificent AI Agent

@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator

@dependabot rebase

@dependabot @github

dependabot Bot commented on behalf of github Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Sorry, only users with push access can use that command.

@lklimek

lklimek commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

@dependabot rebase

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.54.0 to 0.55.0.
- [Commits](golang/crypto@v0.54.0...v0.55.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.55.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot
dependabot Bot force-pushed the dependabot/go_modules/golang.org/x/crypto-0.55.0 branch from cbfd1d7 to d7f715e Compare August 25, 2026 09:21
@lklimek lklimek mentioned this pull request Aug 25, 2026
1 of 5 tasks
lklimek added a commit that referenced this pull request Aug 26, 2026
govulncheck fails identically on v1.7-dev and every open PR branch
(#1412, #1411, #1410) with 6 Go standard-library findings, all
"Found in: go1.26.5 / Fixed in: go1.26.6":

- GO-2026-6218 (net/url)
- GO-2026-6091 (html/template)
- GO-2026-6090 (crypto/tls)
- GO-2026-6089 (net/http, x2)
- GO-2026-5972 (encoding/asn1)

Reachable from our TLS/RPC/HTTP server and Dash Core client paths
(same call sites as PR #1395). Bumping the pinned toolchain from
1.26.5 to 1.26.6 turns govulncheck green everywhere at once and
unblocks #1412, #1411, #1410.

Mirrors PR #1395's pattern (1.26.4 -> 1.26.5): pure patch-release
toolchain swap, no language/API changes, same 16 files touched
(go.mod, CI workflow go-version pins, Dockerfiles, docs).

Verified locally with go1.26.6: go build ./... succeeds, and
govulncheck ./... reports 0 vulnerabilities (down from 6).


Claude-Session: https://claude.ai/code/session_01RoXmbFrVf1BqVW1BHZv6Va

Co-authored-by: Claude Sonnet 5 <[email protected]>
@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator

🔒 Dependency Security Audit — golang.org/x/crypto 0.54.0 → 0.55.0

Audited on the merge result, Sergeant Major. Verified twice, and the second pass is the one that counts.

Verdict: SAFE TO MERGE. This bump is a net security improvement. The failing check is not this PR's doing.


1. Change Summary

Item Value
Repo diff go.mod (2 lines) + go.sum (4 lines) — no source files touched ✅
Direct bump golang.org/x/crypto 0.54.0 → 0.55.0
Bundled bump golang.org/x/text 0.40.0 → 0.41.0 (indirect)
Upstream commits 21 non-merge commits, 40 files, +1268/−261
Nature Maintenance + security release (SSH hardening, one CVE fix)

The x/text movement is not an unexplained rider: x/crypto v0.55.0's own go.mod raises golang.org/x/text to v0.41.0 (commit f44d03d, "go.mod: update golang.org/x dependencies"). Accounted for.

2. Diff Integrity — CLEAN

Supply-chain checks performed independently of the changelog, because a changelog is a claim, not evidence:

Check Result
Tag ↔ commit integrity v0.55.0 → f44d03d253a1503e51b059ca880867c51d878242 ✅
Proxy origin hash (proxy.golang.org) f44d03d2… — identical ✅
go.sum h1 vs. sum.golang.org transparency log x/[email protected] and x/[email protected] both match byte-for-byte ✅
Undocumented commits/files None — every file maps to a listed commit ✅
Install / build / release hooks Zero changes to .github/, Makefile, or any script ✅
New network calls, env-var reads, exfil paths None ✅
Obfuscated / encoded blobs in source None. The only binary delta is x509roots/fallback/bundle.der, a pre-existing generated CA bundle — and it is not in our build graph ✅
Diff shape vs. claimed change type Proportionate: 802 of 1268 insertions are tests; functional source change is small ✅

No moved tags, no mystery contributors, no hooks. The update itself is trustworthy.

3. Known Vulnerabilities

Sources checked: OSV.dev (API query), Go vuln DB, GitHub Advisories, upstream commit archaeology.

ID Alias Affects 0.54.0? Affects 0.55.0? Reachable here?
GO-2026-6303 CVE-2026-56854 YES Fixed No — x/crypto/ssh absent from build graph
GO-2026-5932 openpgp unmaintained-by-design Yes Yes No — x/crypto/openpgp absent from build graph
golang.org/x/text v0.41.0 — — No known vulns n/a

Note the direction of travel: we are currently sitting on a version with a live CVE. CVE-2026-56854 — source-address critical option not enforced for non-public-key auth callbacks — is fixed by this PR. We are unaffected in practice, but merging retires the advisory from the ledger rather than carrying it.

Unregistered security fixes (no CVE assigned — automated scanners are blind to these; found by reading the commits):

  • 90f76b8 — ssh: reject certificate signature keys before recursing. Nested certificate chains recursed per level, exhausting the goroutine stack: fatal stack overflow that recover cannot catch (x/crypto/ssh: unbounded recursion parsing nested certificate signature keys golang/go#80414). Unauthenticated remote DoS, CWE-674.
  • b9229ec — ssh: reject a present but empty source-address critical option. Empty value was treated as absent, i.e. "allow from anywhere" where the operator meant "deny all". Fail-open authorization, CWE-863.
  • e8ad5cb — ssh: initialize new channels fully before adding them to chanList. Data race publishing a channel before localId/maxIncomingPayload were set.
  • 999d053 — ssh: fix parsing of GSSAPI payloads offering multiple mechanisms.
  • 0f039f3 / b27e150 — error-message sanitization; no connection teardown on unparseable public key.

All confined to ssh/. See §4.

4. Reachability — What Actually Reaches Our Binary

Resolved from the real build graph (go list -deps ./...), not from import grep:

In graph: argon2, bcrypt, blake2b, blowfish, chacha20, chacha20poly1305, curve25519, hkdf, internal/alias, internal/poly1305, nacl/box, nacl/secretbox, pbkdf2, ripemd160, salsa20/salsa, sha3.

Not in graph: ssh, openpgp, acme, ocsp, x509roots — count = 0.

Every single functional change in this release lands in acme/, ocsp/, ssh/, x509roots/ … except one:

internal/poly1305/mac_noasm.go  |   2 +-   build tag: add !riscv64
internal/poly1305/sum_asm.go    |   2 +-   build tag: add riscv64
internal/poly1305/sum_riscv64.s | 158 +    new assembly

internal/poly1305 is on our path — it backs chacha20poly1305, which secures internal/p2p/conn/secret_connection.go and privval/secret_connection.go. So I read it rather than waving it through:

  • The two build-tag edits are exact complements (sum_asm.go gains riscv64; mac_noasm.go gains !riscv64). No architecture is left with both implementations or neither. Verified by inspection of both tags.
  • On amd64/arm64 — every platform this project ships — the selected implementation is byte-identical to 0.54.0. The new assembly is inert.
  • The Poly1305 MAC used by our secret-connection handshake is therefore unchanged code on unchanged inputs.

chacha20poly1305, curve25519, hkdf, nacl/box, ripemd160, chacha20, internal/alias: zero diff between the two tags. Confirmed by explicit path-scoped diff, not assumed.

5. Codebase Compliance

Area Status
Cryptographic primitives in use (chacha20poly1305, curve25519, hkdf, nacl/box) Unchanged upstream — no behavioural delta
secret_connection.go (p2p + privval) Not affected
crypto/secp256k1 (ripemd160) Not affected
CI govulncheck on this head PASS ✅
Lock/manifest hygiene go.sum entries verified against checksum DB ✅
go mod verify All modules verified ✅
go mod tidy -diff Empty — no missing entries, no orphan/stale go.sum lines ✅
Toolchain go.mod declares go 1.26.6; x/crypto v0.55.0 needs go 1.25.0 — satisfied ✅
Repo-local pins (AGENTS.md, .github/dependabot.yml, Makefile, tools/tools.go) No pin on x/crypto/x/text, no vendor dir, nothing to update ✅

6. CI Assessment — tests (01) failure is NOT caused by this bump

--- FAIL: TestAllowVoteChannelMessage_ChargesVerificationCost (0.16s)
    internal/consensus/vote_rate_limit_test.go:133
    Error:    "8" is not less than or equal to "7"
    Messages: maximum-cost precommits admitted must be bounded by burst/cost

Evidence, in order of weight:

  1. No causal path exists. The test exercises internal/consensus vote rate limiting, built on golang.org/x/time/rate — a different module entirely. x/crypto contributes nothing to that code path, and as established in §4 the only x/crypto change on our build graph is riscv64 assembly that is not even compiled on the CI runner.
  2. The test is a wall-clock race against itself. rate.Limiter refills on real time. The assertion allows voteRateBurst/maxPeerMessageCost + 1 = 7 admissions, budgeting exactly one token of refill slack; the loop runs 5000 iterations under -race. On a slow or contended runner the loop takes long enough to accrue a second token — hence 8. The failure mode is off-by-one-token, which is precisely the signature of clock drift, not of a changed dependency.
  3. The test is byte-identical on the base branch (origin/v1.7-dev, introduced in 57a6f5e14) and untouched by this PR.
  4. Every other check is green, including govulncheck, golangci-lint, both e2e suites, and test shards 00 and 02–05.

Conclusion: pre-existing timing-sensitive flake. Unrelated to this dependency bump.

⚠️ Deferred finding, surfaced rather than buried (LOW — likelihood 0.4, impact 0.1, relevance 0.1): TestAllowVoteChannelMessage_ChargesVerificationCost is genuinely flaky under CI load and will keep ambushing unrelated PRs. It is out of scope here, but "out of scope" is not a plan — it warrants its own issue. Suggested fix: inject a fake clock, or assert against elapsed time rather than a fixed +1 token of slack.


7. Risk Assessment

Overall rating: SAFE. 🍬

  • Supply-chain integrity verified against the Go checksum transparency log and the module proxy origin hash — independent of anything dependabot or the changelog asserted.
  • Zero functional change reaches this project's compiled code.
  • Retires a live CVE (CVE-2026-56854) plus five unregistered SSH security fixes from our dependency ledger, all unreachable here — pure upside, no exposure.
  • Repo diff is manifest-only, exactly as a dependabot gomod bump should be.

Recommendation: merge, once CI has been given a fair second run. The red check is a flake in unrelated consensus test code, not a regression from x/crypto.

Trust nothing until verified. This one has been verified. 🍬

🤖 Co-authored by Claudius the Magnificent AI Agent

@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator

@dependabot rebase

@dependabot @github

dependabot Bot commented on behalf of github Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Sorry, only users with push access can use that command.

@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator

🔬 Follow-up — CI flake independently reproduced, and a rebase is now required

1. The tests (01) failure is confirmed pre-existing and unrelated. Not inferred this time — reproduced.

Running the unmodified PR branch under scheduling pressure (-race -count=200, GOGC=1, GOMAXPROCS=2, taskset -c 0,1, plus background CPU load) reproduced the failure with no source change of any kind — and worse than CI's:

"10" is not less than or equal to "7"

CI saw 8; forced contention yields 10. Mechanism confirmed by reading the code: newRateLimitedReactor (internal/consensus/vote_rate_limit_test.go:20-26) passes no client.WithRateLimitClock, so client.RateLimit (internal/p2p/client/ratelimit.go:97) meters against clockwork.NewRealClock(). The bound voteRateBurst/maxPeerMessageCost+1 = 200/33+1 = 7 assumes the bucket never refills during a 5000-iteration loop — but at 600 tok/s, one extra 33-token admission needs only ~55 ms of wall clock leaking into that loop. A GC pause covers it.

Also verified: golang.org/x/time (which actually provides the rate.Limiter) is untouched by this PR — still v0.15.0. And every file on the failing test's call path (vote_rate_limit_test.go, reactor.go, verification_budget.go, message_cost.go, ratelimit.go) is byte-identical to v1.7-dev. This is the base branch's flake, carried through unmodified.

The sibling test TestVoteRateBurstDoesNotScaleWithLimit in the same file already uses the fix pattern — client.WithRateLimitClock(clockwork.NewFakeClock()). This test simply doesn't. That is the remedy, in a separate PR.

2. This PR has since gone CONFLICTING. Not from anything in the bump — #1424, #1421 and #1433 landed on v1.7-dev at 14:35–14:40 UTC and moved go.sum underneath it. A rebase is needed before this can merge.

@dependabot rebase was attempted and declined ("only users with push access can use that command"), so this needs a maintainer with push access to issue it.

The security verdict is unchanged: SAFE. Supply chain verified against the checksum transparency log, zero functional change reaches this project's compiled code, and the bump retires a live CVE. Nothing here argues against merging — only the stale go.sum and a flaky test stand in the way, and neither is this dependency's doing. 🍬

🤖 Co-authored by Claudius the Magnificent AI Agent

@lklimek

lklimek commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@dependabot recreate

@dependabot @github

dependabot Bot commented on behalf of github Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Looks like golang.org/x/crypto is up-to-date now, so this is no longer needed.

@dependabot dependabot Bot closed this Sep 3, 2026
@dependabot
dependabot Bot deleted the dependabot/go_modules/golang.org/x/crypto-0.55.0 branch September 3, 2026 07:05
lklimek added a commit that referenced this pull request Sep 7, 2026
* chore(deps): bump Go to 1.26.6 (#1417)

govulncheck fails identically on v1.7-dev and every open PR branch
(#1412, #1411, #1410) with 6 Go standard-library findings, all
"Found in: go1.26.5 / Fixed in: go1.26.6":

- GO-2026-6218 (net/url)
- GO-2026-6091 (html/template)
- GO-2026-6090 (crypto/tls)
- GO-2026-6089 (net/http, x2)
- GO-2026-5972 (encoding/asn1)

Reachable from our TLS/RPC/HTTP server and Dash Core client paths
(same call sites as PR #1395). Bumping the pinned toolchain from
1.26.5 to 1.26.6 turns govulncheck green everywhere at once and
unblocks #1412, #1411, #1410.

Mirrors PR #1395's pattern (1.26.4 -> 1.26.5): pure patch-release
toolchain swap, no language/API changes, same 16 files touched
(go.mod, CI workflow go-version pins, Dockerfiles, docs).

Verified locally with go1.26.6: go build ./... succeeds, and
govulncheck ./... reports 0 vulnerabilities (down from 6).

Claude-Session: https://claude.ai/code/session_01RoXmbFrVf1BqVW1BHZv6Va

Co-authored-by: Claude Sonnet 5 <[email protected]>
(cherry picked from commit 0a7a33e)

* ci(lint): bump golangci-lint from v2.12 to v2.13

golangci-lint v2.12.2 (the latest v2.12.x, matching the current
floating `version: v2.12` selector) panics rather than reporting
findings when analyzing this codebase under Go 1.27.1: the bundled
staticcheck analyzer (honnef.co/go/[email protected]) crashes its SSA/IR
builder with "unexpected expr: *ast.KeyValueExpr" while building IR
for the stdlib package internal/poll. Confirmed deterministic
(reproduced twice) and not a stale-binary artifact (rebuilt
golangci-lint v2.12.2 from source with the go1.27.1 toolchain itself,
same panic). Isolating the culprit with --disable=staticcheck makes
the panic disappear and returns 0 issues, but disabling staticcheck
in CI is rejected as a fix: it is the linter catching the QF1008
class, and turning it off to land a version bump would trade a real
gate for a green tick.

golangci-lint v2.13.0 shipped 2026-08-19, the same day as Go 1.27.0 —
the 2.13 line is Go 1.27-compatible where 2.12 predates Go 1.27
entirely. Measured v2.13.2 (the latest v2.13.x) built fresh with both
toolchains: no panic and 0 --new-from-rev findings at go1.26.6 and at
go1.27.1. The two changes are independent, so this commit lands ahead
of and does not depend on the Go 1.27.1 bump that follows it — every
intermediate commit in this branch keeps the lint job runnable.

Kept the existing floating-minor pin convention (`v2.13`, not an
exact `v2.12.2`-style pin): the crash was caused by the minor version
predating Go 1.27, not by floating within a minor, so an exact pin
would have failed identically and there is no reason to change the
convention in response to a problem it did not cause.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj

* chore(mockery): bump to v3.7.4 and regenerate

The `check-mocks` CI job pins `mockery=3.7.0` (released 2026-03-06,
five months before Go 1.27.0). Under a go1.27.1 toolchain, mockery
3.7.0 fails outright rather than producing a diff:

    internal error: package "github.com/dashpay/tenderdash/libs/ds"
    without types was imported from "github.com/dashpay/tenderdash/libs/store"

This is mockery's bundled golang.org/x/tools/go/packages loader
failing to attach type information to a transitively-imported
package when driven by the newer toolchain — not a defect in this
repository's source. Reproduced locally under the exact conditions
CI runs (GOTOOLCHAIN=local, the go1.27.1 binary setup-go installs,
no auto-download); the CI log itself can't show this, since the
generation step runs `make mockery 2>/dev/null` and discards stderr
— anyone hitting this in CI needs to reproduce it locally to see
anything past "exit code 2".

mockery v3.7.4 (released 2026-08-23, four days after Go 1.27.0)
fixes it: same reproduction conditions, clean exit. Measured it under
both go1.26.6 and go1.27.1 and got byte-identical regenerated output
either way — the interface{}->any / parameter-naming differences
below come entirely from mockery's own codegen version, not from
which Go toolchain drives it. That's what makes this commit stand on
its own ahead of the Go 1.27.1 bump that follows it in this branch,
rather than being a consequence of it.

Bumped both pin sites: check-generated.yml's MOCKERY and
scripts/mockery_generate.sh's VERSION. The version bump and the
regenerated mocks can't be split into separate commits: CI
regenerates and diffs in the same step, so a pin bump without
regenerated mocks leaves check-mocks red (diff appears), and
regenerated mocks without the pin bump leaves it red too (CI
regenerates with 3.7.0 and hits the error above again).

Regenerated all mocks under mockery v3.7.4 (`make mockery`). The
diff is mechanical and cosmetic only, inspected file-by-file rather
than trusted from the diffstat: every change is either
`interface{}` -> `any` in generated _Expecter method signatures (Go
1.18+ built-in alias, identical type), or a generated parameter name
recovering the interface's real source name where 3.7.0 fell back to
a generic placeholder (`v`, `vs`, `context1`). No method set changed,
no mock behavior changed. Confirmed behaviorally rather than just by
reading the diff: `go build ./...` is clean with the regenerated
mocks in place, and `go test ./internal/consensus/... -count=1` is
green (one run hit the already-known-flaky TestByzantinePrevoteEquivocation
from this task's original brief; a second run was clean, consistent
with that test's known ~18% flake rate and unrelated to this change).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj

* test(rpc): close idle client connections in TestMaxOpenConnections

Go 1.27 changed HTTP/1 Response.Body.Close() to automatically drain
any unread content, up to a conservative limit, to allow the
underlying connection to be reused (see the "net/http" section of
the Go 1.27 release notes). TestMaxOpenConnections never reads its
response bodies before closing them, so under Go 1.27 the requests
it makes leave healthy, idle keep-alive connections sitting in the
client's pool instead of being closed outright as they were under
Go 1.26. Those idle connections keep the corresponding server-side
handler goroutines parked in a read wait, which the leaktest check
registered at the top of the test flags as leaked:

    leaktest: leaked goroutine: ... [IO wait]:
        ... net/http.(*conn).serve ...
        created by net/http.(*Server).Serve

This is not a defect in the server's shutdown path, and reading the
response body before closing it does not fix it — 1.27 already
drains it for you, which is the entire behavior change; an explicit
drain reaches the identical end state (healthy, pooled connection,
server goroutine still parked). Confirmed by testing it directly:
draining the body explicitly still leaks 100% of the time under
go1.27.1.

Fixed by sharing one Client across the request goroutines (http.Client
is safe for concurrent use) and calling its CloseIdleConnections after
they've all completed, before the leaktest check fires. This does not
change what the test measures: instrumented it locally to confirm
peak concurrent open connections still reaches exactly `max` with the
shared client, matching the per-goroutine-client version — concurrent
in-flight requests still each need their own connection regardless of
pooling, since pooling only affects connections after they go idle.

Verified at both go1.26.6 and go1.27.1 (5 consecutive runs each,
clean at both, plus one run with -race): this fix is a general test
correctness improvement, not conditional on either toolchain, which
is why it lands ahead of the Go 1.27.1 bump in this branch rather
than after it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj

* test(rpc): assert on our own error family, not stdlib phrasing

TestRPCParams and TestParseURI/Decode asserted on the stdlib's exact
wording for a malformed json.Number ("invalid number literal" /
"invalid number"). That wording changed between Go versions — under
Go 1.27 it reads "cannot unmarshal string ... into Go value of type
json.Number: invalid syntax" instead — which breaks the assertion
even though the actual behavior (the malformed input is still
rejected, with the same RPC error code) hasn't changed at all.

Traced the code path rather than guessing a new substring:
RPCFunc.parseParams wraps every parameter-decode failure via
invalidParamsError(), which always builds an rpctypes.RPCError with
Code: CodeInvalidParams and Message: CodeInvalidParams.String() —
our own constant, literally "Invalid params", unconditionally. Only
RPCError.Data ever carries the wrapped stdlib error text. Asserting
on "Invalid params" instead of the stdlib phrase pins our own
contract (this rejection landed in the invalid-params family) rather
than a description we don't own and that a future Go release is free
to reword again.

This is also a stronger assertion than the one it replaces: the old
substring match could not distinguish an invalid-params rejection
from any other error that happened to contain the same words,
whereas the new one names the specific error family.

Checked for the same pattern elsewhere before touching only these
two sites: types/genesis_test.go:164 pins a different stdlib JSON
error string ("cannot unmarshal string into Go struct field ... of
type int64"), but that's the struct-field type-mismatch error class,
not the json.Number-literal class this Go release changed, and it
already passes clean under go1.27.1 (16/16 subtests) — confirmed by
running it, not assumed. Two sites, not a repo-wide problem.

Verified at both go1.26.6 and go1.27.1 (all TestRPCParams and
TestParseURI subtests green at both, full package test suite green
at go1.26.6): version-neutral, so this lands ahead of the Go 1.27.1
bump rather than after it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj

* chore(deps): bump Go to 1.27.1

Follow-on to the previous two commits: with golangci-lint on v2.13
(previous commit), it is safe to move the pinned Go toolchain past
1.26.6 to 1.27.1. This is a minor-version bump, not a patch bump —
Go 1.26.6 -> 1.27.1 crosses a Go release boundary, so the "no
language/API changes" claim that held for the 1.26.5 -> 1.26.6 patch
swap does not carry here and was verified fresh rather than assumed.

Verified for the full three-commit stack (this commit on top of the
golangci-lint v2.13 bump on top of the Go 1.26.6 cherry-pick):

- go build ./... clean.
- go vet ./... reports the same 4 findings, byte-for-byte, before and
  after this commit (3x fmt.Errorf %q in test/e2e/pkg/testnet.go, 1x
  IPv6 address format in dash/quorum/nodeid_resolver.go) — all
  pre-existing and unrelated to this change. No new vet strictness
  under Go 1.27.
- govulncheck ./... reports the same finding sets before and after:
  0 stdlib vulnerabilities affecting our code, and the same 4
  dependency-only findings our code doesn't call (GO-2026-6355,
  GO-2026-6354, GO-2026-6303, GO-2026-5932) on both sides.
- golangci-lint v2.13.2 (what the v2.13 selector resolves to) with
  --new-from-rev=origin/v1.7-dev: 0 issues, no panic.
- go test ./internal/consensus/... -count=1, twice: both green
  (61.1s, 69.0s) on the final three-commit stack.
- GOTOOLCHAIN=auto correctly resolves and downloads go1.27.1 from
  this module's go.mod, confirmed via `go version` run from inside
  the module.

What moved, reported rather than fixed:

- golangci-lint's gofmt formatter (.golangci.yml formatters.enable)
  flags one pre-existing, untouched file — internal/rpc/core/
  mempool.go:149 — as differently formatted under Go 1.27.1's
  bundled gofmt than under 1.26.6's (a multi-value return with a
  composite literal inside a select/case reindents differently).
  --new-from-rev correctly excludes it since the affected line isn't
  part of any diff in this branch, so no CI gate fails on it. It is
  an active check, not an absent one — it simply isn't triggered
  against a line this branch touches. Left unformatted: out of scope
  for a toolchain-pin change.
- During earlier measurement (not the two required runs above, both
  of which were clean), one go1.27.1 run of
  `go test ./internal/consensus/...` hit a failure in
  TestPoC_HeightVoteSet_UnboundedRoundAllocation (retained 308 bytes
  per message against a <149 threshold), not one of the two
  previously-known flaky tests in this package. Isolated reruns of
  just this test passed 5/5 under go1.27.1 and 3/3 under go1.26.6.
  The 1.26.6 baseline never ran this test under equivalent
  full-package concurrent load, so this is not a like-for-like
  comparison between Go versions — left unresolved and not claimed
  to be version-related.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj

* style: reformat mempool.go for Go 1.27's gofmt

Go 1.27's gofmt reindents a multi-value return containing a composite
literal inside a select/case block differently than Go 1.26's gofmt
does: the composite literal body and the trailing fmt.Errorf
continuation drop one level of indentation. Formatted here with the
go1.27.1 toolchain's own gofmt -w -s (`go env GOROOT`'s bin/gofmt
under this branch's now-pinned toolchain) — the same flags
`make format`'s gofmt step uses; `-s` (simplify) produces an
identical diff to plain gofmt here, so it isn't smuggling in any
rewrite beyond the reindent.

Ran the full-repository gofmt -l -s sweep under go1.27.1 first, using
make format's own exclusions (skip *.pb.go, *pb_test.go, .git) rather
than fixing only the single file golangci-lint's filtered lint run
had named: internal/rpc/core/mempool.go was the only file the sweep
flagged, before and after -s. Did not run the rest of `make format`
(golines, goimports) since those are separate tools operating on
unrelated lines (line-wrapping, import grouping) — out of scope for
a pure gofmt-drift fix.

This repository has no standalone gofmt gate that this drift was
failing: .golangci.yml's `formatters.enable` list does include gofmt
(a distinct section from `linters.enable` in golangci-lint v2's
config schema — it is an active check, not an absent one), but the
one finding it produced was on a line outside any diff in this
branch, so `--new-from-rev` filtered it and no CI gate was failing.
`make format` itself writes rather than checks, so it enforces
nothing on its own either. This commit removes latent formatting
drift ahead of it mattering, not a fix for a red gate.

Confirmed asymmetric in both directions: after this reformat,
`gofmt -l -s` is clean under go1.27.1 (this branch's pinned
toolchain) but go1.26.6's gofmt now wants the same lines re-indented
back the other way. Anyone building this file with a local Go 1.26.x
toolchain and running gofmt/make format against it will see a diff
again — expected, since the two Go versions' gofmt disagree on this
construct in both directions, and this branch is pinned to 1.27.1.

No logic changes: the diff is pure reindentation of already-existing
lines, confirmed via `gofmt -d` before applying.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
lklimek added a commit that referenced this pull request Sep 11, 2026
…Commit token (#1456)

* feat(types): add CommitVerification, a typed proof of commit verification

VerifyCommitSignatures verifies a commit exactly as ValidatorSet.VerifyCommit
does and, on success, returns a CommitVerification recording the chain,
height, block ID, quorum, threshold key and the signed digests and signatures
it checked. ValidatorSet.VerifyCommitUnlessVerified skips the threshold
verification only when a verification covers exactly those inputs. Anything
else, including the zero value, falls through to the unchanged verifyCommit,
so its typed errors (ErrInvalidCommitSignature versus the untyped
vote-extension count mismatch and budget exhaustion) are preserved.

verifyCommit is split into commitSignData and verifyCommitReportingSigns with
every error path unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>

* refactor(state): replace commit-verification memo with typed CommitVerification token

BlockExecutor.VerifyCommit returns a types.CommitVerification instead of
recording it in a private two-slot memo. ValidateBlock,
ValidateBlockWithRoundState, FinalizeBlock and ApplyBlock take the
verification of block.LastCommit explicitly. Block sync's applier threads the
verification of each commit one block forward; consensus and the replayer pass
the zero value and verify in full as before. The
state_last_commit_verification_skipped metric keeps its meaning.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(consensus): deflake TestWALRoundsSkipper

The WAL generator node is the only validator, so it proposes every round,
and replayPrevoter makes heights 3 to 5 commit only at round 10. The test
genesis gives round 10 a 30.5ms propose timeout. On a loaded runner (-race,
-coverprofile, several packages at once) that timer fires before the node's
own proposal is complete, so it prevotes nil and moves to round 11:
- at height 5, stopConsensusAtHeight(5, 11) halts consensus and the test
  times out after 60s ("waited too long for tendermint to produce 5
  blocks"), which is the failure seen on #1391, #1393 and #1410;
- at height 3 or 4, the commit lands past maxRound and the round assertion
  fails.

Give the generator a 10s propose timeout. With a single proposer, a round
moves on as soon as the proposal is complete, so a longer timeout only
removes the race. UnsafeProposeTimeoutOverride is node-local and not a
consensus parameter, so the blocks are unchanged.

TestWALRoundsSkipperSlowProposer pins this. Its app holds PrepareProposal at
round 10 for three times the genesis propose timeout. Without the override
it fails every run; with it, it passes every run.

Once the test survives load, a second pre-existing flake surfaces. The
replaying State and its WAL keep running after Stop/Wait: receiveRoutine
exits only when it sees its context cancelled, and the services' ctx
watchers log asynchronously. Their logs through NewTestingLogger then land
after the test completes and panic the binary ("Log in goroutine after
TestWALRoundsSkipper has completed"). The test now logs through a writer
that is muted, under a lock, by its first-registered cleanup.

Co-Authored-By: Claude Opus 5 <[email protected]>

* refactor(types): turn CommitVerification into VerifiedCommit

types.CommitVerification only carried proof metadata, checked against a
commit passed alongside it. It becomes types.VerifiedCommit: the commit
itself plus an optional proof.

    type VerifiedCommit struct {
        commit *Commit       // the caller's pointer, the subject only
        proof  *commitProof  // nil: no proof
    }

commitProof keeps the nine fields CommitVerification recorded, with their
doc comments.
- VerifyCommitSignatures keeps its signature, checks and errors. It returns
  the commit with a proof on success, and the zero VerifiedCommit on failure.
- NewUnverifiedCommit(commit) builds the no-proof variant. The zero value is
  NewUnverifiedCommit(nil).
- Commit() returns the embedded pointer. Its doc spells out that it is not
  evidence and must never be validated in place of the commit actually
  received.
- checkMatches moves to *commitProof and treats a nil receiver as "nothing
  was verified". It compares commit content only, never pointer identity.
- errCommitVerificationMismatch becomes errCommitProofMismatch.

Only the parameter types change at the call sites. block.LastCommit is
still read from the block, and the current-height commit parameter of
ApplyBlock/FinalizeBlock is untouched. Consensus (finalize, validate),
ProcessProposal and the replayer pass NewUnverifiedCommit(block.LastCommit);
the block-sync applier keeps the zero value where it holds no commit. Mocks
are regenerated with mockery v3.7.4.

Tests:
- the types tests are renamed to VerifiedCommit;
- the proof-mutation test pins with require.Same that the embedded commit
  aliases the caller's pointer;
- a new case shows that a VerifiedCommit without proof, even one holding
  the very commit being verified, never skips verification;
- the new TestBlockApplierSkipsTheLastCommitItVerified drives three blocks
  through a real executor and asserts LastCommitVerificationSkipped reaches
  0, 2 and 4. It fails if the applier hands the next block the commit
  without its proof;
- metricspy gains a Counter for it.

Co-Authored-By: Claude Opus 5 <[email protected]>

* chore: retrigger CI

GitHub Actions never picked up 0eccc06 (no check-suite created for it
after 45+ minutes, unlike every prior push on this branch) — pushing an
empty commit to force a fresh push event.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(types): drop NewUnverifiedCommit, the only way to fake a VerifiedCommit

NewUnverifiedCommit let any caller wrap an arbitrary commit into a value of
a type named VerifiedCommit while attaching no proof at all -- a naming
trap, and unused by anything that reads Commit(): nothing outside tests
ever called it. The four call sites that used it to signal "no proof held"
never read the commit back off the value either; they only pass it into
VerifyCommitUnlessVerified, which already falls through to a full
verification on any proof-less value, zero value included.

Remove the constructor. The zero value is now the only proof-less
VerifiedCommit that code outside types can produce, and it is the only one
that matters in practice: consensus, the replayer and block sync's
ProcessProposal path all switch to it. The still-exported Commit() and the
commit field stay -- VerifyCommitSignatures is still the only way to end up
with a VerifiedCommit that names a real commit, and it always pairs one
with its proof.

TestUnverifiedCommitMatchesNothing keeps its "holds the exact commit but no
proof" case as an in-package struct literal: a white-box test proving the
mismatch check would still refuse to skip verification even in that
stronger, no-longer-reachable-from-outside scenario.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
lklimek added a commit that referenced this pull request Sep 11, 2026
…LastCommit (#1427)

* perf(blocksync): verify a commit once, not again as the next block's LastCommit

Block sync threshold-verifies the commit for block N in blockApplier.verify, and
one height later the same commit comes back as block N+1's LastCommit and is
verified a second time inside validateBlock. Every commit was verified twice, a
block apart, at roughly 1.9 ms each.

The applier now records what it verified through a new Executor.NoteVerifiedCommit
and validateBlock takes a lastCommitVerified hint. The skip fires only on an exact
match of every input ValidatorSet.verifyCommit reads: chain ID, height, block ID,
quorum type, quorum hash, threshold public key, and a byte-identical marshalled
commit. Marshalling rather than using Commit.Hash() matters, because that hash
only covers ThresholdBlockSignature and would miss Round and the vote extensions.
Anything short of a full match falls through to a real verification.

The note is stored after ApplyBlock returns, not before: both places that would
re-verify this commit run while the *next* block is applied, so writing it earlier
would overwrite the entry they are still reading for the current block and the
skip would never fire. The validator set is captured before ApplyBlock, which
reassigns e.state.

The consensus path never calls NoteVerifiedCommit, so the memo stays nil there and
nothing changes. It is an atomic.Pointer written and read whole, never
read-modify-write, and blockApplier.Apply is serialised under its own mutex.

Replaying mainnet, the applier's verify stage goes from 3.61 ms to 1.84 ms a block.

* perf(state): skip the second LastCommit verification when the memo proves it ran (#1428)

ValidateBlockWithRoundState verifies block.LastCommit even though the ValidateBlock
call at the top of the same function normally does it. That second verification is
load-bearing rather than redundant: ValidateBlock short-circuits on blockExec.cache,
which is keyed on the block hash alone and carries no promise about the state the
earlier validation ran against. Removing it outright breaks TestStateProposalTime.

So gate it on the memo added in the previous change instead of on the cache. The
skip happens only when this exact commit was already verified against identical
inputs — same chain ID, height, block ID, quorum type, quorum hash, threshold
public key and byte-identical marshalled commit. That is a property of the data,
not of the cache, so it holds no matter which path populated the cache.

Replaying mainnet, this stage goes from 1.81 ms a block to 0.007 ms. Together with
the previous change block sync performs one threshold verification per block
instead of three.

* test(state): cover the verified-commit memo directly

TestLastCommitAlreadyVerified checks the memo matches only on a full match of every input VerifyCommit reads, and falls through when the chain ID, height, block ID, quorum type, quorum hash, threshold key or any commit field differs. TestApplyBlockSkipsVerifiedLastCommit drives a real BlockExecutor with genuine BLS commits through ApplyBlock: a noted commit is not threshold-verified again, a forged commit that was never noted is rejected, and a memo for a different commit does not cover a forged one.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* test(state): fold the ApplyBlock drive into the memo fixture

Replace the blockAndID closure with a fixture method so each subtest reads as note-then-assert, use slices.Clone for the vote extensions, and move the cache comment above the call it explains.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* refactor(state): verify commits through the executor so the memo cannot be fed unverified ones

NoteVerifiedCommit took the caller's word that a commit had been verified. Replace it with Executor.VerifyCommit, which runs the threshold verification itself and remembers the result only on success. The block sync applier now verifies through it; nothing else can write the memo.

The memo keeps the two most recent commits instead of one: VerifyCommit for commit N runs before block N is validated, and block N's LastCommit is commit N-1, so both must be present. This also removes the ordering constraint that forced the applier to record the note only after ApplyBlock returned.

Every slice-backed field in the memo is now an owned copy, so mutation of the validator set, block ID or commit after verification cannot change what it matches. validateBlock takes the hint as a closure, so the memo is consulted only after ValidateBasic and the cheaper header checks. A new state_last_commit_verification_skipped counter makes the skip observable, and a marshal failure on the memo path is logged instead of swallowed.

* refactor(state): replace commit-verification memo with typed VerifiedCommit token (#1456)

* feat(types): add CommitVerification, a typed proof of commit verification

VerifyCommitSignatures verifies a commit exactly as ValidatorSet.VerifyCommit
does and, on success, returns a CommitVerification recording the chain,
height, block ID, quorum, threshold key and the signed digests and signatures
it checked. ValidatorSet.VerifyCommitUnlessVerified skips the threshold
verification only when a verification covers exactly those inputs. Anything
else, including the zero value, falls through to the unchanged verifyCommit,
so its typed errors (ErrInvalidCommitSignature versus the untyped
vote-extension count mismatch and budget exhaustion) are preserved.

verifyCommit is split into commitSignData and verifyCommitReportingSigns with
every error path unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>

* refactor(state): replace commit-verification memo with typed CommitVerification token

BlockExecutor.VerifyCommit returns a types.CommitVerification instead of
recording it in a private two-slot memo. ValidateBlock,
ValidateBlockWithRoundState, FinalizeBlock and ApplyBlock take the
verification of block.LastCommit explicitly. Block sync's applier threads the
verification of each commit one block forward; consensus and the replayer pass
the zero value and verify in full as before. The
state_last_commit_verification_skipped metric keeps its meaning.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(consensus): deflake TestWALRoundsSkipper

The WAL generator node is the only validator, so it proposes every round,
and replayPrevoter makes heights 3 to 5 commit only at round 10. The test
genesis gives round 10 a 30.5ms propose timeout. On a loaded runner (-race,
-coverprofile, several packages at once) that timer fires before the node's
own proposal is complete, so it prevotes nil and moves to round 11:
- at height 5, stopConsensusAtHeight(5, 11) halts consensus and the test
  times out after 60s ("waited too long for tendermint to produce 5
  blocks"), which is the failure seen on #1391, #1393 and #1410;
- at height 3 or 4, the commit lands past maxRound and the round assertion
  fails.

Give the generator a 10s propose timeout. With a single proposer, a round
moves on as soon as the proposal is complete, so a longer timeout only
removes the race. UnsafeProposeTimeoutOverride is node-local and not a
consensus parameter, so the blocks are unchanged.

TestWALRoundsSkipperSlowProposer pins this. Its app holds PrepareProposal at
round 10 for three times the genesis propose timeout. Without the override
it fails every run; with it, it passes every run.

Once the test survives load, a second pre-existing flake surfaces. The
replaying State and its WAL keep running after Stop/Wait: receiveRoutine
exits only when it sees its context cancelled, and the services' ctx
watchers log asynchronously. Their logs through NewTestingLogger then land
after the test completes and panic the binary ("Log in goroutine after
TestWALRoundsSkipper has completed"). The test now logs through a writer
that is muted, under a lock, by its first-registered cleanup.

Co-Authored-By: Claude Opus 5 <[email protected]>

* refactor(types): turn CommitVerification into VerifiedCommit

types.CommitVerification only carried proof metadata, checked against a
commit passed alongside it. It becomes types.VerifiedCommit: the commit
itself plus an optional proof.

    type VerifiedCommit struct {
        commit *Commit       // the caller's pointer, the subject only
        proof  *commitProof  // nil: no proof
    }

commitProof keeps the nine fields CommitVerification recorded, with their
doc comments.
- VerifyCommitSignatures keeps its signature, checks and errors. It returns
  the commit with a proof on success, and the zero VerifiedCommit on failure.
- NewUnverifiedCommit(commit) builds the no-proof variant. The zero value is
  NewUnverifiedCommit(nil).
- Commit() returns the embedded pointer. Its doc spells out that it is not
  evidence and must never be validated in place of the commit actually
  received.
- checkMatches moves to *commitProof and treats a nil receiver as "nothing
  was verified". It compares commit content only, never pointer identity.
- errCommitVerificationMismatch becomes errCommitProofMismatch.

Only the parameter types change at the call sites. block.LastCommit is
still read from the block, and the current-height commit parameter of
ApplyBlock/FinalizeBlock is untouched. Consensus (finalize, validate),
ProcessProposal and the replayer pass NewUnverifiedCommit(block.LastCommit);
the block-sync applier keeps the zero value where it holds no commit. Mocks
are regenerated with mockery v3.7.4.

Tests:
- the types tests are renamed to VerifiedCommit;
- the proof-mutation test pins with require.Same that the embedded commit
  aliases the caller's pointer;
- a new case shows that a VerifiedCommit without proof, even one holding
  the very commit being verified, never skips verification;
- the new TestBlockApplierSkipsTheLastCommitItVerified drives three blocks
  through a real executor and asserts LastCommitVerificationSkipped reaches
  0, 2 and 4. It fails if the applier hands the next block the commit
  without its proof;
- metricspy gains a Counter for it.

Co-Authored-By: Claude Opus 5 <[email protected]>

* chore: retrigger CI

GitHub Actions never picked up 0eccc06 (no check-suite created for it
after 45+ minutes, unlike every prior push on this branch) — pushing an
empty commit to force a fresh push event.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(types): drop NewUnverifiedCommit, the only way to fake a VerifiedCommit

NewUnverifiedCommit let any caller wrap an arbitrary commit into a value of
a type named VerifiedCommit while attaching no proof at all -- a naming
trap, and unused by anything that reads Commit(): nothing outside tests
ever called it. The four call sites that used it to signal "no proof held"
never read the commit back off the value either; they only pass it into
VerifyCommitUnlessVerified, which already falls through to a full
verification on any proof-less value, zero value included.

Remove the constructor. The zero value is now the only proof-less
VerifiedCommit that code outside types can produce, and it is the only one
that matters in practice: consensus, the replayer and block sync's
ProcessProposal path all switch to it. The still-exported Commit() and the
commit field stay -- VerifyCommitSignatures is still the only way to end up
with a VerifiedCommit that names a real commit, and it always pairs one
with its proof.

TestUnverifiedCommitMatchesNothing keeps its "holds the exact commit but no
proof" case as an in-package struct literal: a white-box test proving the
mismatch check would still refuse to skip verification even in that
stronger, no-longer-reachable-from-outside scenario.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>

* perf(state): offer the verified LastCommit to ProcessProposal

Since block sync validates the app response through
ProcessProposal(verify=true), ValidateBlockWithRoundState runs there with
a hard-coded zero proof, so every synced block threshold-verified its
LastCommit once more even though the applier already held the proof.

ProcessProposal takes lastCommit and forwards it to the verify branch.
The block applier hands it the proof it carries forward; consensus and
the replayer hold none and pass the zero value. ApplyBlock passes its own
lastCommit through for uniformity; it is unread with verify unset.

TestBlockApplierSkipsTheLastCommitItVerified now expects three skips per
height after the first, and fails against the previous commit.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(state): trim the ApplyBlock LastCommit verification tests

- Count skipped verifications with metricspy.Counter instead of a local
  duplicate of it.
- Drop the subtest applying a forged commit with the verification
  VerifyCommit returned on rejecting it: that verification is the zero
  value, already pinned by "rejected commit yields no verification" and
  TestVerifiedCommitKeepsTheVerifyCommitErrors, and a forged LastCommit
  without proof is pinned by "unverified forged commit is rejected".
- TestApplyBlockSkipsVerifiedLastCommit covers ApplyBlock only; block sync
  no longer calls it, so point to the block sync pin instead.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: lklimek <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
lklimek added a commit that referenced this pull request Sep 14, 2026
* test(consensus): deflake TestWALRoundsSkipper

The WAL generator node is the only validator, so it proposes every round,
and replayPrevoter makes heights 3 to 5 commit only at round 10. The test
genesis gives round 10 a 30.5ms propose timeout. On a loaded runner (-race,
-coverprofile, several packages at once) that timer fires before the node's
own proposal is complete, so it prevotes nil and moves to round 11:
- at height 5, stopConsensusAtHeight(5, 11) halts consensus and the test
  times out after 60s ("waited too long for tendermint to produce 5
  blocks"), which is the failure seen on #1391, #1393 and #1410;
- at height 3 or 4, the commit lands past maxRound and the round assertion
  fails.

Give the generator a 10s propose timeout. With a single proposer, a round
moves on as soon as the proposal is complete, so a longer timeout only
removes the race. UnsafeProposeTimeoutOverride is node-local and not a
consensus parameter, so the blocks are unchanged.

TestWALRoundsSkipperSlowProposer pins this. Its app holds PrepareProposal at
round 10 for three times the genesis propose timeout. Without the override
it fails every run; with it, it passes every run.

Once the test survives load, a second pre-existing flake surfaces. The
replaying State and its WAL keep running after Stop/Wait: receiveRoutine
exits only when it sees its context cancelled, and the services' ctx
watchers log asynchronously. Their logs through NewTestingLogger then land
after the test completes and panic the binary ("Log in goroutine after
TestWALRoundsSkipper has completed"). The test now logs through a writer
that is muted, under a lock, by its first-registered cleanup.

Co-Authored-By: Claude Opus 5 <[email protected]>

* test(consensus): wait for WAL replay writes before cleanup

Stop replay processing after the required block commits, or when the test
returns early. Wait for the replay stop predicate before shutting down its
WAL and message queue so temporary directories are removed after writes end.

Validated both WAL rounds skipper tests with -race -tags=deadlock -count=30.

Co-Authored-By: Codex <[email protected]>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants