Skip to content

chore(release): update changelog and bump version to 1.8.0 - #1477

Merged
lklimek merged 58 commits into
masterfrom
release_1.8.0
Sep 16, 2026
Merged

lklimek merged 58 commits into
masterfrom
release_1.8.0

Conversation

@lklimek

@lklimek lklimek commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Release new Tenderdash version

What was done?

  • Updated changelog
  • Bumped packages version

How Has This Been Tested?

None

Breaking Changes

None

Checklist:

  • I have performed a self-review of the generated changelog
  • I have checked that P2PProtocol in version/version.go is bumped if needed
  • I have checked that BlockProtocol in version/version.go is bumped if needed
  • I have checked that ABCISemVer in version/version.go is bumped if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

dependabot Bot and others added 30 commits August 25, 2026 10:49
Bumps [docker/login-action](https://github.com/docker/login-action) from 4.5.2 to 4.6.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@v4.5.2...v4.6.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 4.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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]>
… docs refresh (#1425)

* docs(nodes): rewrite state-sync guide to match Dash-specific implementation

The guide still documented the upstream trust anchor settings (trust_height, trust_hash, trust_period) which were removed in 33cda2d, and used underscore key names that do not match the actual dashed config keys. Rewrite it to document the real [statesync] options (enable, use-p2p, rpc-servers, discovery-time, retries, temp-dir, chunk-request-timeout, fetchers), including the block-sync fallback when retries are exhausted, the two-server minimum for rpc-servers when use-p2p=false, the 5s minimum for chunk-request-timeout, and the fact that Dash needs no trust anchors because light blocks are verified via Dash Core quorum threshold signature verification.

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

* docs(nodes): drop removed trust-* keys from statesync config reference

The [statesync] section still listed trust-height, trust-hash and trust-period, which were removed from the config in 33cda2d (Tenderdash verifies light blocks via Dash Core quorum verification and needs no trust anchors). Replace them with the retries option so the section matches the template generated by config/toml.go.

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

* docs(spec): update state sync wire spec to content-addressed chunk model

The spec still described the upstream format/index/chunks model. Rewrite it to match the shipped proto (proto/tendermint/statesync/types.proto and proto/tendermint/abci/types.proto): snapshots carry version + hash with no format or chunk count, chunks are content-addressed by chunk_id with the snapshot hash as the initial chunk, fetching is driven by next_chunks in ResponseApplySnapshotChunk, and restoration terminates on the COMPLETE_SNAPSHOT result. Also correct message names (SnapshotsRequest/SnapshotsResponse), field numbers, drop the stale Message oneof section that no longer exists in the proto, and note that light block verification uses Dash Core quorum signature verification instead of upstream trust anchors.

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

* fix(node): error on full node without core-rpc-host instead of panicking

makeNode's ModeFull branch eagerly constructed core.NewMockClient(..., privValidator, false) when [priv-validator] core-rpc-host was empty, but privValidator is only assigned in the ModeValidator branch, so it was always nil there and NewMockClient panicked with the unhelpful message 'localPV must be set'. Every full node started without core-rpc-host hit this panic at construction time.

A hard configuration error was chosen over a lazy failure because no supported configuration can break: the panic fired unconditionally and eagerly for this mode/config combination, so any setup that would now receive the error was already unable to start. All e2e manifests exercised in CI (dashcore.toml, rotate.toml, statesync-backfill.toml) set privval_protocol = 'dashcore' on their full nodes, which populates core-rpc-host; ci.toml's full01 omits it but ci.toml is not in the CI matrix and would have panicked. No node package tests construct ModeFull nodes, and all other NewMockClient callers pass a non-nil private validator.

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

* fix(statesync): add operator guidance to swallowed backfill failure log

When backfill fails after a successful snapshot restore, the reactor proceeds optimistically by design, but the log line gave the operator no hint of the consequences or of what to do. Expand the error-level message to explain that the node lacks historical light blocks within the evidence age and may be unable to validate evidence of misbehavior committed before the snapshot height, and to suggest checking connectivity to peers retaining older blocks or re-syncing from a more recent snapshot. The proceed-optimistically behavior is unchanged.

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

* fix(node): validate full-node core-rpc-host before opening resources

The check only needs cfg.Mode and cfg.PrivValidator.CoreRPCHost, so run it at the top of makeNode: previously it fired after the block/state stores and event sinks were opened and returned without the registered closers, leaking DB handles and LevelDB locks to in-process callers who retry. Also narrow the comment: the Dash Core RPC client feeds only the state sync light client providers; evidence verification checks validator-set signatures locally.

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

* test(node): full node without core-rpc-host fails cleanly without leaks

Pins that the constructor returns an error naming core-rpc-host (no panic), leaves the data directory untouched, and that an immediate retry gets the same config error rather than a DB-lock error from leaked handles.

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

* docs(nodes): fix state sync retries=0 semantics and document full-node core-rpc-host

retries=0 with a nonzero discovery-time retries indefinitely and never falls back to block sync (syncer.SyncAny only exits via errNoSnapshots when retries are exhausted or discovery is disabled), so stop claiming it disables retries; align the config template and struct comment too. Document that full nodes must set [priv-validator] core-rpc-host to start, include it in both examples, and scope the snapshot-serving claim to full/validator nodes since seed nodes only run PEX.

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

* fix(statesync): make backfill-failure remediation actionable

Retrying state sync after a backfill failure requires stopping the node and resetting both the tenderdash data directory and the application state, because the state store was already bootstrapped at the snapshot height and state sync is skipped on any nonzero height. Say so instead of suggesting a bare restart.

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

---------

Co-authored-by: Claude Fable 5 <[email protected]>
…imeouts in reactor test (#1418)

* test(consensus): restore real timeout ticker in TestReactorValidatorSetChanges

The test drove its 7-node network with newMockTickerFunc(true), which
forwards only RoundStepNewHeight timeouts and only the first one; every
other scheduled timeout is discarded. That leaves the network without
timeoutPropose, without timeoutPrevoteWait/timeoutPrecommitWait and,
after the first height, without timeoutNewHeight — so consensus has no
way to change round and no way to start a height it committed without
receiving a peer commit. Any perturbation is therefore permanent, and
the test hangs until its 2-minute context deadline.

Both observed CI failure shapes follow from this. A proposal delayed
past MessageDelay+Precision makes every validator prevote nil, and the
round change that would recover never fires. Separately, a node that
applies a commit itself sits at RoundStepNewHeight forever; when it is
the next proposer, nobody proposes and nobody times out waiting.

Restore the real ticker, which "chore(consensus): stabilize consensus
algorithm (#284)" had already established before #1204 reverted it, and
give rounds enough wall clock to complete on a loaded runner. Round
timeouts only fire when the network stalls, so larger values cost
nothing on the healthy path, while 2s/1s makes a starved CI runner
abandon rounds it would have completed, leaving it to churn instead of
converge.

Verified with go test -race -count=10: the old code fails 1/10 on an
idle 16-core host, reproducing the CI signature exactly (all seven nodes
report a waitForAndValidateBlock deadline, one with "subscription
terminated by publisher"); the new code passes 20/20 over two such runs.
Under three concurrent copies of the test the pass rate rises from 10/18
to 14/15.

Refs #1405

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

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

* fix(consensus): bound catch-up block-part resends to one pass per interval

GossipBlockPartsForCatchup never marks catch-up parts as delivered, so
prs.ProposalBlockParts.Not().PickRandom() keeps finding the same index
missing and the part is re-sent on every gossip tick. The loop ends only
when our own view of the peer's height advances, and the traffic it
generates delays exactly the NewRoundStep messages that would advance it.

Measured in a 7-node race-enabled reactor test: 1091 height-11 block
parts pushed at a node that had already reached height 12, every one
discarded, against 9 completed proposal blocks in the same window. The
live round cannot assemble its proposal, every validator prevotes nil,
and the height churns rounds until the test deadline. The same loop
drives the part-set-header mismatch branch, which logs at error level on
every tick without sending anything.

Bound it to one part-set pass per catchupResendInterval. A pass spends
one send per part; once complete, further ticks are skipped until the
interval elapses, then a new pass begins. A peer that silently dropped
its parts is therefore still served repeatedly for as long as it stays
behind, so the wedge fixed in #1365 stays fixed, while a peer we only
believe to be lagging costs one pass rather than one send per tick.
Parts are still never marked delivered, keeping that guarantee
independent of PeerState bookkeeping — which is unreliable here, since
SetHasProposalBlockPart ignores updates whose round differs from the
peer's current round and catch-up passes the committed block's round.

At 4 concurrent race-enabled copies of TestReactorValidatorSetChanges,
where the unbounded loop passes 2/16, this passes 16/16 — matching a
full revert of the resend behaviour while keeping its protection. Also
18/18 at 3 concurrent copies and 10/10 unloaded. Wasted catch-up parts
drop from 164592 to 2845 per batch (a revert scores 2736), and the
wedge precondition "Commit came in before proposal" occurs 632 times
across those runs with zero wedges.

The two tests from #1365 now assert the bounded contract: parts are
still never marked delivered, no resend occurs inside the interval, and
a resend follows once the clock advances past it.

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

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

* fix(consensus): budget catch-up passes by missing parts, not bit-array size

beginCatchupAttempt sized a catch-up pass with
prs.ProposalBlockParts.Size(), the length of the peer's bit-array, while
GossipBlockPartsForCatchup draws indices from
prs.ProposalBlockParts.Not().PickRandom() — the unset bits alone. A peer
reporting all but one part present therefore had every draw in the pass
return that same index, so the one missing part was re-sent once per
entry in the array before the interval pause.

That bit-array arrives from the network. NewValidBlockMessage.
ValidateBasic checks only that its length equals
BlockPartSetHeader.Total, never the bit pattern, and
PeerState.ApplyNewValidBlockMessage installs it wholesale. A peer can
thus pick the amplification factor, up to MaxBlockPartsCount (1601)
sends of a single part per interval, which largely defeats the bound.

Budget on the number of parts the peer reports missing instead, and
return early when none are. CountTrueBits has no nil receiver guard,
unlike Size, so the nil bit-array is rejected first; the sole production
caller already checks it, but the previous Size call was nil-safe and
that property is worth keeping.

The bound can now only tighten: missing is at most the array length, and
is equal to it in the common case where a lagging peer holds none of the
parts, so catch-up throughput for genuinely lagging peers is unchanged.

Adds a regression case for a bit-array with a single unset bit, which
draws 3 sends per pass before this change and 1 after, plus a case for a
peer that reports the complete part set, which must open no pass at all.

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

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

* fix(consensus): fix the catch-up pass budget against peer bitmap swaps

beginCatchupAttempt derived the pass threshold from
prs.ProposalBlockParts on every call while catchupAttempts and
catchupRetryAt persisted across calls, so the peer that owns that
bit-array could move the threshold out from under the counter. Two ways,
both reachable through NewValidBlockMessage, whose ValidateBasic checks
only the array's length:

Lowering the reported missing count to the number of sends already made
takes the "pass spent" branch while catchupRetryAt is still zero, because
that field was only assigned once the counter reached the earlier, larger
threshold. The wait is then measured against the zero time, the counter
resets and sending continues. Repeating one decrement at a time
telescopes into roughly N^2/2 sends before any wait applies.

Raising it afterwards is simpler still: the counter no longer meets the
threshold, so the branch holding the deadline check is skipped entirely
and a deadline already set is stepped over.

Draw from a remaining-budget counter instead. Opening a pass fixes both
the budget and the deadline together, and the budget only counts down, so
neither can be re-derived from anything the peer sends mid-pass. There is
no longer a state where a pass is spent but no deadline exists.

The height reset stays: ApplyNewRoundStepMessage drops any message that
does not advance the peer's height/round/step, so a peer cannot replay it
to reopen passes, and it can only keep doing so by advancing out of the
catch-up window. Removing it would instead make every legitimately
advancing peer wait an interval per height.

Sends per interval remain bounded by the block's real part count:
ensurePeerPartSetHeader rejects a fabricated part-set header, so a peer
inflating the count buys early exits rather than sends.

The regression test drops the reported count to the sends already made
and then raises it again, drawing 5 sends from a 3-send pass before this
change and 3 after. TestGossiper, TestPeerGossipWorker and
TestReactorValidatorSetChanges pass; 16/16 at 4 concurrent race-enabled
copies with wasted catch-up parts at 3002 against 2845 before, so the
storm bound is unchanged.

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

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

* fix(consensus): end a catch-up pass that cannot send

beginCatchupAttempt charged a budget slot before loadMeta, the part-set
header check and loadPart, none of which ended the pass when they failed.
The peer supplies both the missing bit-array a pass is budgeted from and
the part-set header those checks run against, and ValidateBasic accepts
any well-formed pair, so it could open a maximum-size pass under a header
matching no stored block.

That bought two things. A pass that can never send charged a block-store
read and an error log to every gossip tick for its whole budget - roughly
160s at the production 100ms cadence - and since the retry deadline was
armed when the pass opened, it had long expired by the time the budget
ran out, so the next pass began immediately and the interval never
throttled anything. The same inflated budget also survived the peer
replacing its state, at the same height, with the stored block's real
header and a single missing part: the budget is deliberately not
re-derived once a pass is open, so the remainder landed as duplicate
sends of that one part.

Move the send into sendCatchupBlockPart and abandon the pass, arming a
fresh retry deadline, whenever it reports that no part reached the peer.
A pass now costs at most one failed attempt per interval, and only a pass
that got as far as sending keeps its budget.

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

* fix(consensus): close catch-up pass gaps thepastaclaw flagged as still exploitable

Two gaps let a peer defeat the catch-up throttle this PR is adding:

- beginCatchupAttempt armed catchupRetryAt when a pass opened. A pass with
  enough missing parts to span more gossip ticks than catchupResendInterval
  takes longer than the interval to exhaust its budget, so the deadline had
  already elapsed by the time the pass finished - the next tick reopened a
  fresh pass with no quiet gap at all. Arm the deadline when the pass's last
  attempt is spent instead.

- The pass budget was fixed at open and never revisited downward. A peer
  fully controls ProposalBlockParts over the wire (NewValidBlockMessage.
  ValidateBasic checks only length, ApplyNewValidBlockMessage installs it
  wholesale) and can open a pass reporting many parts missing, then swap in
  a bit-array with only one unset bit — every remaining budgeted attempt
  then draws that same index, funding repeated duplicate sends of it.
  Clamp the remaining budget down whenever the peer's current missing count
  drops below it; never raise it back up.

Adds regression tests for both: a 6-part pass ticked across
catchupResendInterval to show the deadline is measured from the pass's last
send, and a 5-part pass whose bitmap shrinks mid-pass to show the budget
clamps to the peer's current report. Both fail against the pre-fix code.

Addresses thepastaclaw findings on PR #1418.

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

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

* perf(consensus): avoid a full bit-array copy to count missing catch-up parts

beginCatchupAttempt derived the peer's missing-part count via
Not().CountTrueBits(), which allocates and copies the whole
(peer-controlled, up to MaxBlockPartsCount) bit-array on every gossip tick
just to count it. sendCatchupBlockPart already performs its own
Not().PickRandom() when a send actually happens, so this was a second,
avoidable full-array allocation on every tick regardless of whether a send
occurs. Derive the same count as size minus set bits instead.

Addresses a copilot review comment on PR #1418.

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

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

* fix(consensus): honor catch-up send failures, close height-advance evasion

Layers on top of review-stream's retryAt-at-close and downward-clamp
fix in beginCatchupAttempt. Distinct fixes:

- syncProposalBlockPart (pre-existing, untouched elsewhere in this PR)
  unconditionally returned nil, so a failed send never reached
  endCatchupPass despite the caller's contract assuming it would.
  sendCatchupBlockPart now reports success as a bool instead of an
  error nobody was meant to inspect, and its "no missing part" branch
  can no longer be hit (the comment claiming otherwise was already
  false: prs is a fresh per-tick deep copy nothing else can mutate).
- A peer's height advancing reset the retry deadline as well as the
  budget, granting a free pass on every height step; only the budget
  resets now.
- The three catch-up fields were guarded only by a comment claiming a
  single caller, despite the same *msgGossiper being shared across
  three concurrent handler goroutines; a mutex now guards them
  structurally.
- Documented the rate limit's actual scope (per gossip worker, not per
  peer -- a reconnect gets a fresh one) on the Gossiper interface and
  the actual tick-to-interval relationship on catchupResendInterval,
  both previously undocumented.

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

* docs(consensus): fix stale catch-up comment in dataGossipHandler

GossipBlockPartsForCatchup is rate-limited and returns without sending
on most ticks, so "block parts already delivered" no longer describes
what happened before the unconditional GossipCommit call on the same
branch.

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

* fix(consensus): propagate the real send error from syncProposalBlockPart

syncProposalBlockPart unconditionally returned nil regardless of the
underlying send's actual result, so sendCatchupBlockPart's error check
against it (added in the prior commit) was dead code: a send that
never reached the peer was indistinguishable from one that did, and
endCatchupPass never fired for that failure mode -- the pass kept
spending its budget one failed attempt per tick instead of ending on
the first one, exactly the spin endCatchupPass exists to prevent.

Fix at the source: return g.sync's result directly and drop the
now-redundant local log, since both callers already log a non-nil
error themselves. The other caller, GossipProposalBlockParts, only
ever logged this error and took no other action, so propagating it
for real is behavior-preserving there.

Regression test advances a fake clock across many ticks with every
send forced to fail and asserts exactly one block-part read per
catchupResendInterval, not one per tick; confirmed failing (5 reads
instead of 1) against the pre-fix code.

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

* fix(consensus): arm catch-up retry deadline when a peer's height advance interrupts a live pass

A peer that advances its reported height mid-pass (before the pass
exhausts its own budget) reset catchupRemaining to 0 without arming
catchupRetryAt, since the deadline was only ever armed when a pass
ran its budget down naturally. A peer whose height ticks forward
every gossip tick therefore got a fresh full-budget pass every tick
forever, completely bypassing catchupResendInterval for the common
multi-part-block case. Arm the deadline on the height-change branch
too whenever a pass was actually in flight, matching the same
invariant beginCatchupAttempt's normal exhaustion path already
upholds. Document that invariant on the struct fields it protects.

Also, while re-auditing this function for the same iteration:
- stop re-deriving the budget from a peer-controlled bit-array once a
  pass is open (now g.catchupRemaining = min(g.catchupRemaining,
  missing), replacing an equivalent but more verbose branch)
- de-duplicate the block-store-failure error logs in
  sendCatchupBlockPart; blockRepository.loadMeta/loadPart already log
  the failure, so the caller's second log was pure noise
- correct sendCatchupBlockPart's doc (it reports handoff to the p2p
  channel, not peer delivery) and give its error log a distinct
  message from GossipProposalBlockParts's
- correct the Gossiper interface, catchupResendInterval, and
  endCatchupPass doc comments, which described a flat one-send-per-
  interval bound that does not hold for multi-part blocks

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

* test(consensus): pin the height-advance throttle bug and fix stale/weak catch-up assertions

- Add TestGossipBlockPartsForCatchupHeightAdvanceInterruptingPassIsThrottled,
  a regression test for the height-advance bug fixed in gossiper.go:
  confirmed RED (20 sends) against the pre-fix code via git stash, GREEN
  (1 send) after the fix.
- Rename/rewrite TestGossipBlockPartsForCatchupBudgetIsFixedAtPassOpen to
  TestGossipBlockPartsForCatchupBudgetIsNeverRaisedMidPass: the old
  sequence never actually drove catchupRemaining below the reported
  missing count it then 'raised', so the raise-attempt it claimed to
  guard against was a no-op the test would pass on regardless. The new
  version forces a real clamp (5-part block, drop to 1 missing after two
  sends) before attempting to raise the count back up, and asserts the
  raise is not honored before the interval elapses.
- Strengthen TestGossipBlockPartsForCatchupPeerHasEveryPart with an
  explicit AssertNotCalled, so it fails loudly instead of silently if a
  send is ever wired in for a peer that already has every part.
- Update the two wantLog assertions in TestGossipBlockPartsForCatchup
  that still expected the removed 'couldn't find a block meta/part'
  caller-side logs; the block-store-failure messages they should match
  are now blockRepository's own 'failed to load block meta'/'failed to
  load block part'.

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

* fix(consensus): share one clock between msgGossiper and its peerGossipWorker

newPeerGossipWorker constructed two independent clockwork.NewRealClock()
instances for what is meant to be one gossip worker's shared notion of
time. They agree in practice (both wrap wall-clock time), but nothing
enforces that, and it defeats point-in-time comparisons in tests that
inject a single fake clock expecting both call sites to observe it.
Construct one clock and pass it to both.

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

* docs(consensus): correct dataGossipHandler's stale catch-up rate-limit comment

The comment described GossipBlockPartsForCatchup as rate-limited and a
no-op on most ticks, which held before this PR's changes but not after:
a pass now spends one send per tick for as many ticks as the peer
reports parts missing, and the quiet gap applies only between passes,
not on most individual ticks. Reword to match.

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

* docs(config): cross-reference PeerGossipSleepDuration's coupling to the catch-up throttle

PeerGossipSleepDuration sets the tick rate that
internal/consensus/gossiper.go's catchupResendInterval throttle is
metered against: configuring it above that fixed interval silently
disables the throttle. Document the coupling at both the struct field
and the generated TOML template so an operator tuning gossip cadence
sees the side effect.

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

* perf(consensus): skip the missing-part scan while a catch-up pass is backed off

beginCatchupAttempt computed missing (Size() - CountTrueBits(), an O(bits)
scan of the peer-controlled ProposalBlockParts array) unconditionally, even
on ticks that are going to return false immediately because the pass is
still within catchupRetryAt's backoff. At production defaults most gossip
ticks land in backoff (a pass's quiet interval is ~5x the gossip cadence),
so this scanned a bit-array up to MaxBlockPartsCount long on nearly every
tick for no reason.

Move the backoff check ahead of the scan: when no pass is open and the
retry deadline hasn't elapsed, return early without touching
ProposalBlockParts at all. The scan still runs whenever it can affect the
outcome - opening a new pass, or clamping an active one's budget down to a
shrunk missing count.

Addresses a copilot review comment on PR #1418.

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

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

* fix(consensus): close an open catch-up pass when the peer reports it complete

beginCatchupAttempt returned early on missing == 0 without touching
catchupRemaining/catchupRetryAt. When that happened mid-pass
(catchupRemaining > 0, budget not yet exhausted), the pass stayed open
indefinitely: noOpenPass would keep evaluating false forever, so the
backoff check above it — which only runs while no pass is open — was
skipped on every later tick regardless of elapsed time. A peer could freeze
catchupRemaining above zero by reporting a complete part set whenever it
liked, then resume sending immediately the next time it reported parts
missing, with no retry interval honored at all.

Close the pass in that case too: zero the remaining budget and arm the
retry deadline, matching what happens when a send fails or a height change
interrupts a pass. Only do this when a pass was actually open; a peer that
has simply always reported a complete set must not have a wait imposed on
it.

Also corrects a stale doc comment on PeerGossipSleepDuration added by the
same throttle: catchupResendInterval is a fixed quiet gap that does not
scale with the gossip tick duration, it only fits more ticks into that same
window.

Adds a regression test that opens a pass, spends one send, has the peer
report complete, then report missing again on the same simulated instant -
asserting no send until the retry interval elapses. Fails against the
pre-fix code (an immediate second send).

Addresses copilot review comments on PR #1418.

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

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

* docs(consensus): reclassify the missing==0 mid-pass fix as CPU-amplification, not a throttle bypass

df8a6057c's commit message and code comments described the missing==0
mid-pass fix as letting a peer "resume sending... with no retry interval
honored at all", which reads as a flooding/throttle-bypass concern. On
closer trace (independently by team-lead and grumpy-stream) that's not
accurate: catchupRemaining only ever counts down, never up, so total sends
per pass are identically bounded by the budget fixed at pass open whether
or not this fix exists. Nothing here lets a peer exceed that budget or the
one-send-per-tick ceiling.

The actual defect is CPU amplification: leaving a pass open indefinitely
(via alternating missing==0 reports) keeps noOpenPass false forever, which
permanently defeats 3b9463dd0's backoff-skip check - the O(bits) scan of
the peer-controlled, up-to-MaxBlockPartsCount bit-array then runs on every
single gossip tick instead of being skipped during backoff, for as long as
the peer holds the pass open this way. It also predates this PR: grumpy
traced the same missing==0 short-circuit in the 5978b27 baseline and
both its parent commits, so this isn't new here - it only started costing
more once 3b9463dd0 added a backoff-skip path for it to defeat.

Also records a deliberate behavior change for honest peers: closing the
pass on missing==0 means a peer that legitimately completes its part set
and later falls behind again now waits out one catchupResendInterval
before catch-up resumes, rather than resuming on its very next report.
Accepted: a peer that just reported complete is not starving, and the
wait is negligible against block time.

No functional change from df8a6057c - comments only, on both the fix and
its regression test.

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

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

* fix(consensus): end a catch-up pass when a block-store read panics

GossipBlockPartsForCatchup only called endCatchupPass() on a normal false
return from sendCatchupBlockPart. But sendCatchupBlockPart's block-store
reads (blockRepository.loadMeta/loadPart, wrapping LoadBlockMeta/
LoadBlockPart) panic deliberately on a decode or read failure rather than
returning an error - runGossipHandler recovers that panic per gossip tick,
logs a full stack, and keeps ticking, same as it does for every other
peer-facing panic path in the node.

A panic there unwinds straight past the if-check, so endCatchupPass()
never runs and the pass stays open with its remaining budget intact. Since
the peer controls both the height and the missing bitmap a pass is
budgeted on, a peer that names a height whose stored record is corrupt or
unreadable gets a fresh attempt - and a fresh panic, and a fresh
full-stack log - on every tick for the rest of the pass's budget (up to
~160s for a maximum-size 1,601-part report at the default cadence) instead
of ending on the first failed attempt like every other failure mode this
PR's earlier commits already cover.

Settle the attempt in a defer instead of an if-check on the return value,
so panic unwinding also reaches it. sendCatchupBlockPart's own return
value still selects the fast path (success needs no settlement); the defer
only changes what happens when it doesn't get the chance to return at all.

Adds a regression test using a block-store mock that panics on
LoadBlockMeta, asserting exactly one read (and thus one panic) per pass
rather than one per tick for the whole budget - mirrors
TestGossipBlockPartsForCatchupSendFailureEndsPass's structure for the
already-covered normal-failure case. Confirmed failing (2+ reads instead
of 1) against the pre-fix code.

Addresses a thepastaclaw blocking finding on PR #1418.

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

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

* fix(consensus): don't throttle a genuinely-advancing peer's next catch-up pass

25da4c2 removed the unconditional catchupRetryAt clear from the
height-change branch to close a bypass, and ea2b81498 later armed it
properly for a pass genuinely interrupted mid-flight (catchupRemaining > 0).
The catchupRemaining == 0 case was never revisited: a deadline armed by the
OLD height (by exhausting its own budget, or by the peer reporting
complete) silently carried forward and throttled the NEW height's first
pass by up to catchupResendInterval, for a peer that isn't replaying
anything and owes nothing - it's genuinely further along. Catch-up is the
only path offered to a peer at a different height than ours (regular
gossip requires equal heights), so this taxes every honestly-advancing
lagging peer once per height. This throttle does not exist on
origin/v1.7-dev; it's a cost this PR's own commits introduced.

Naively clearing catchupRetryAt whenever catchupRemaining == 0 at a height
change (the obvious fix) reopens a worse gap than intended, though: it
cannot tell "the previous pass genuinely finished" apart from "an
INTERMEDIATE height in a rapid chain never got a chance to open a pass at
all, and is still serving an earlier interruption's penalty" - both look
identical (remaining == 0) at the moment of the next height change. Verified
by writing TestGossipBlockPartsForCatchupHeightAdvanceInterruptingPassIsThrottled
first: a naive version of this fix turns its pinned 1 send across 20 rapid
height-hops into 10, because every OTHER hop's remaining == 0 came from the
previous hop being blocked, not from a pass finishing.

Track WHY catchupRetryAt is currently armed instead: catchupRetrySticky is
true when the deadline covers unrendered service (a pass interrupted before
exhausting its own budget, or a failed attempt via endCatchupPass) and must
survive a height change - including a chain of several - and false when the
pass closed because it had genuinely nothing left to do (spent its own
budget in full, or the peer reported complete). The height-change branch
only clears catchupRetryAt when it's non-sticky (or already elapsed);
otherwise it's left untouched, whatever height change caused it to be
checked.

This does still leave a bounded gap in the non-sticky case, stated
explicitly in the code rather than glossed: a peer can open a pass, let it
close cleanly (one real send, e.g. by reporting a single missing part),
then immediately claim a new height and repeat, getting one send per gossip
tick indefinitely instead of one pass per interval. Bounded to at most 1
send/PeerGossipSleepDuration tick (10/s, ~640KB/s of block parts at
production defaults), because CompareHRS enforces monotonic height only (no
replay or ping-ponging) and ensurePeerPartSetHeader requires the real,
currently-stored PartSetHeader for each claimed height (a mismatch ends the
pass via the now-sticky endCatchupPass, costing a full interval rather than
a send). Sustaining it requires marching forward through genuine,
still-retained history, capped by blockStoreBase - no worse than the
pre-#1365 catch-up rate this codebase already tolerated in production.
Accepted as strictly cheaper than taxing every honestly-advancing lagging
peer by up to 500ms per height; a verified-progress-gated redesign that
closes it for real is tracked as follow-up, not done here.

Two new regression tests, both proven against the pre-fix code:
- TestGossipBlockPartsForCatchupCleanHeightAdvanceIsNotThrottled: a
  single-part pass closes cleanly, the peer immediately claims a new
  height with a fresh block - asserts an immediate send, not a
  catchupResendInterval wait. RED before this fix.
- TestGossipBlockPartsForCatchupHeightAdvanceInterruptingPassIsThrottled
  (existing, extended doc comment): still asserts full throttling across
  20 rapid, always-interrupted height hops - GREEN before this fix, and
  the guard that caught the naive version's regression above.

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

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

* fix(consensus): start the catch-up quiet gap after the send, not before it

beginCatchupAttempt armed catchupRetryAt from a timestamp taken on entry,
before the caller had even reached sendCatchupBlockPart. The p2p channel
applies backpressure on that very goroutine, so a slow send burned its own
duration out of the quiet gap it was supposed to precede - the slower the
peer's channel, the weaker the throttle.

It now reports the pass's last slot to the caller instead of arming the
deadline itself, and GossipBlockPartsForCatchup settles the pass from a fresh
clock reading once the send returns. endCatchupPass and the new
completeCatchupPass share settleCatchupPass, keeping one place where a drawn
attempt closes a pass.

The window where the pass is spent but its deadline is not yet armed keeps the
documented invariant (a stale deadline with catchupRemaining == 0 is legal) and
is unobservable: the single per-peer goroutine is inside the send for all of
it, so no further attempt and no height change can run before it settles.

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

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](docker/setup-buildx-action@v4.2.0...v4.3.0)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-version: 4.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Bumps [github.com/fxamacker/cbor/v2](https://github.com/fxamacker/cbor) from 2.9.2 to 2.9.3.
- [Release notes](https://github.com/fxamacker/cbor/releases)
- [Commits](fxamacker/cbor@v2.9.2...v2.9.3)

---
updated-dependencies:
- dependency-name: github.com/fxamacker/cbor/v2
  dependency-version: 2.9.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: lklimek <[email protected]>
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.82.1 to 1.83.2.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.82.1...v1.83.2)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-version: 1.83.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/golangci/golangci-lint/v2](https://github.com/golangci/golangci-lint) from 2.12.2 to 2.13.2.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/main/CHANGELOG.md)
- [Commits](golangci/golangci-lint@v2.12.2...v2.13.2)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint/v2
  dependency-version: 2.13.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/go-pkgz/jrpc](https://github.com/go-pkgz/jrpc) from 0.4.0 to 0.4.2.
- [Release notes](https://github.com/go-pkgz/jrpc/releases)
- [Commits](go-pkgz/jrpc@v0.4.0...v0.4.2)

---
updated-dependencies:
- dependency-name: github.com/go-pkgz/jrpc
  dependency-version: 0.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Three manifest-parsing errors in LoadTestnet formatted the result of the
failed strconv.Atoi rather than the input that failed it. Atoi returns 0
on error, so every malformed key in validator_updates, chain_lock_updates
and consensus_version_updates was reported as height 0 — the same message
for any typo, never naming the key the operator had to go and correct.

Print heightStr, which is the map key that failed to parse. Every other
parse error in the repository already quotes the offending string this
way; these three were the exception.

The chain-lock loop also carried the validator loop's wording, so a bad
chain_lock_updates key sent the reader to the wrong manifest section.

`go test` runs a subset of `go vet` before building, and its printf check
rejects %q with an int argument, so test/e2e/pkg failed to build and
`go test ./...` could not pass on a clean checkout. That is a consequence
of the same defect: the argument was wrong, not the verb.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
`make lint` ran golangci-lint unfiltered over the whole repository. That
repository carries several hundred pre-existing findings, so the target
could not exit 0 on a clean checkout of any branch and was unusable as a
gate. CI meanwhile filters with --new-from-rev against the pull request's
target branch and reports only findings on lines the branch changed, so
the two disagreed about what "lint passes" means -- and the local one was
the one contributors could not act on.

`make lint` now runs what CI runs. The unfiltered view keeps its value for
anyone reducing the backlog, so it stays as `make lint-all` rather than
being deleted.

The version pinned here was v2.8 while CI resolves v2.12, which is two
minors of new rules apart; a local run could pass a gate CI then failed.
Both now name the same floating minor, so a patch release moves them
together.

LINT_BASE selects the base ref and is overridable for other release lines.
Its default is a fixed ref rather than the current branch's upstream: a
gate whose scope changes per contributor is not a gate. Both git
preconditions are checked before the linter starts, because a missing ref
or a shallow clone otherwise surfaces as a puzzling lint result rather
than as the git problem it is.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
BASE_BRANCH was left behind when the protobuf generation targets that read
it were removed. Nothing in the repository references it; the only mention
is its own declaration.

It is not inert. Being `?=`, an exported BASE_BRANCH from a contributor's
environment silently takes effect, and its default names a branch six
release lines old. A variable that looks like the base-ref setting for the
lint target, but is not read by it, is a trap for whoever adjusts it next
and finds the gate unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
ValidatorAddress.Hostname holds a bare IPv6 literal when the address was
given as one -- url.Hostname() strips the brackets, and types has a test
asserting tcp://[::1]:26656 parses to "::1". Joining that to a port with
fmt.Sprintf("%s:%d") produces "::1:26656", which is not a malformed
rendering of an address but a string that denotes nothing.

net.JoinHostPort brackets a v6 literal and leaves a v4 one untouched, so
the output is byte-identical for every address that works today. It is
also what this repository already does everywhere else, including
ValidatorAddress.String() ten lines from the field it reads and both
dial sites in internal/p2p; this call was the one place that disagreed
with its own type.

This does not make IPv6 work here. The dial network is "tcp4", so a v6
host is now refused on address family rather than failing on a nonsense
address -- a truthful error instead of a confusing one. Whether node-ID
resolution should support IPv6 validators, as the rest of p2p does, is a
question about connection establishment and is left alone deliberately.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
The Test workflow derives its package list from `go list` filtered on
.TestGoFiles, so a package without tests is never compiled there and the
vet subset `go test` runs never sees it. Lint reports only findings on
changed lines, so anything long-standing in such a package is filtered out
there too. Three formatting errors in test/e2e/pkg survived six years in
that gap, and a `go test ./...` on a clean checkout could not pass because
of them.

Add a Vet workflow running `go vet ./...` across the whole module, and a
`make vet` target for it to call so the local and CI invocations cannot
drift -- the divergence between `make lint` and the lint workflow is what
hid the same class of defect on the other side.

The job has no trigger filter. Each existing filter is defensible on its
own and the defect fell through all of them together, so a gate whose
purpose is catching what they miss does not get one; it costs about a
minute of runner time, in parallel with the test shards, and is bounded by
a compile the other workflows already perform.

The Go version is pinned exactly rather than to a range. vet's diagnostics
differ between toolchain releases, and a floating version would let this
gate change what it enforces with no change to the repository.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
* 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]>
* fix(consensus): bound catch-up block-part resends and restore round timeouts in reactor test (#1418)

* test(consensus): restore real timeout ticker in TestReactorValidatorSetChanges

The test drove its 7-node network with newMockTickerFunc(true), which
forwards only RoundStepNewHeight timeouts and only the first one; every
other scheduled timeout is discarded. That leaves the network without
timeoutPropose, without timeoutPrevoteWait/timeoutPrecommitWait and,
after the first height, without timeoutNewHeight — so consensus has no
way to change round and no way to start a height it committed without
receiving a peer commit. Any perturbation is therefore permanent, and
the test hangs until its 2-minute context deadline.

Both observed CI failure shapes follow from this. A proposal delayed
past MessageDelay+Precision makes every validator prevote nil, and the
round change that would recover never fires. Separately, a node that
applies a commit itself sits at RoundStepNewHeight forever; when it is
the next proposer, nobody proposes and nobody times out waiting.

Restore the real ticker, which "chore(consensus): stabilize consensus
algorithm (#284)" had already established before #1204 reverted it, and
give rounds enough wall clock to complete on a loaded runner. Round
timeouts only fire when the network stalls, so larger values cost
nothing on the healthy path, while 2s/1s makes a starved CI runner
abandon rounds it would have completed, leaving it to churn instead of
converge.

Verified with go test -race -count=10: the old code fails 1/10 on an
idle 16-core host, reproducing the CI signature exactly (all seven nodes
report a waitForAndValidateBlock deadline, one with "subscription
terminated by publisher"); the new code passes 20/20 over two such runs.
Under three concurrent copies of the test the pass rate rises from 10/18
to 14/15.

Refs #1405

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

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

* fix(consensus): bound catch-up block-part resends to one pass per interval

GossipBlockPartsForCatchup never marks catch-up parts as delivered, so
prs.ProposalBlockParts.Not().PickRandom() keeps finding the same index
missing and the part is re-sent on every gossip tick. The loop ends only
when our own view of the peer's height advances, and the traffic it
generates delays exactly the NewRoundStep messages that would advance it.

Measured in a 7-node race-enabled reactor test: 1091 height-11 block
parts pushed at a node that had already reached height 12, every one
discarded, against 9 completed proposal blocks in the same window. The
live round cannot assemble its proposal, every validator prevotes nil,
and the height churns rounds until the test deadline. The same loop
drives the part-set-header mismatch branch, which logs at error level on
every tick without sending anything.

Bound it to one part-set pass per catchupResendInterval. A pass spends
one send per part; once complete, further ticks are skipped until the
interval elapses, then a new pass begins. A peer that silently dropped
its parts is therefore still served repeatedly for as long as it stays
behind, so the wedge fixed in #1365 stays fixed, while a peer we only
believe to be lagging costs one pass rather than one send per tick.
Parts are still never marked delivered, keeping that guarantee
independent of PeerState bookkeeping — which is unreliable here, since
SetHasProposalBlockPart ignores updates whose round differs from the
peer's current round and catch-up passes the committed block's round.

At 4 concurrent race-enabled copies of TestReactorValidatorSetChanges,
where the unbounded loop passes 2/16, this passes 16/16 — matching a
full revert of the resend behaviour while keeping its protection. Also
18/18 at 3 concurrent copies and 10/10 unloaded. Wasted catch-up parts
drop from 164592 to 2845 per batch (a revert scores 2736), and the
wedge precondition "Commit came in before proposal" occurs 632 times
across those runs with zero wedges.

The two tests from #1365 now assert the bounded contract: parts are
still never marked delivered, no resend occurs inside the interval, and
a resend follows once the clock advances past it.

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

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

* fix(consensus): budget catch-up passes by missing parts, not bit-array size

beginCatchupAttempt sized a catch-up pass with
prs.ProposalBlockParts.Size(), the length of the peer's bit-array, while
GossipBlockPartsForCatchup draws indices from
prs.ProposalBlockParts.Not().PickRandom() — the unset bits alone. A peer
reporting all but one part present therefore had every draw in the pass
return that same index, so the one missing part was re-sent once per
entry in the array before the interval pause.

That bit-array arrives from the network. NewValidBlockMessage.
ValidateBasic checks only that its length equals
BlockPartSetHeader.Total, never the bit pattern, and
PeerState.ApplyNewValidBlockMessage installs it wholesale. A peer can
thus pick the amplification factor, up to MaxBlockPartsCount (1601)
sends of a single part per interval, which largely defeats the bound.

Budget on the number of parts the peer reports missing instead, and
return early when none are. CountTrueBits has no nil receiver guard,
unlike Size, so the nil bit-array is rejected first; the sole production
caller already checks it, but the previous Size call was nil-safe and
that property is worth keeping.

The bound can now only tighten: missing is at most the array length, and
is equal to it in the common case where a lagging peer holds none of the
parts, so catch-up throughput for genuinely lagging peers is unchanged.

Adds a regression case for a bit-array with a single unset bit, which
draws 3 sends per pass before this change and 1 after, plus a case for a
peer that reports the complete part set, which must open no pass at all.

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

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

* fix(consensus): fix the catch-up pass budget against peer bitmap swaps

beginCatchupAttempt derived the pass threshold from
prs.ProposalBlockParts on every call while catchupAttempts and
catchupRetryAt persisted across calls, so the peer that owns that
bit-array could move the threshold out from under the counter. Two ways,
both reachable through NewValidBlockMessage, whose ValidateBasic checks
only the array's length:

Lowering the reported missing count to the number of sends already made
takes the "pass spent" branch while catchupRetryAt is still zero, because
that field was only assigned once the counter reached the earlier, larger
threshold. The wait is then measured against the zero time, the counter
resets and sending continues. Repeating one decrement at a time
telescopes into roughly N^2/2 sends before any wait applies.

Raising it afterwards is simpler still: the counter no longer meets the
threshold, so the branch holding the deadline check is skipped entirely
and a deadline already set is stepped over.

Draw from a remaining-budget counter instead. Opening a pass fixes both
the budget and the deadline together, and the budget only counts down, so
neither can be re-derived from anything the peer sends mid-pass. There is
no longer a state where a pass is spent but no deadline exists.

The height reset stays: ApplyNewRoundStepMessage drops any message that
does not advance the peer's height/round/step, so a peer cannot replay it
to reopen passes, and it can only keep doing so by advancing out of the
catch-up window. Removing it would instead make every legitimately
advancing peer wait an interval per height.

Sends per interval remain bounded by the block's real part count:
ensurePeerPartSetHeader rejects a fabricated part-set header, so a peer
inflating the count buys early exits rather than sends.

The regression test drops the reported count to the sends already made
and then raises it again, drawing 5 sends from a 3-send pass before this
change and 3 after. TestGossiper, TestPeerGossipWorker and
TestReactorValidatorSetChanges pass; 16/16 at 4 concurrent race-enabled
copies with wasted catch-up parts at 3002 against 2845 before, so the
storm bound is unchanged.

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

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

* fix(consensus): end a catch-up pass that cannot send

beginCatchupAttempt charged a budget slot before loadMeta, the part-set
header check and loadPart, none of which ended the pass when they failed.
The peer supplies both the missing bit-array a pass is budgeted from and
the part-set header those checks run against, and ValidateBasic accepts
any well-formed pair, so it could open a maximum-size pass under a header
matching no stored block.

That bought two things. A pass that can never send charged a block-store
read and an error log to every gossip tick for its whole budget - roughly
160s at the production 100ms cadence - and since the retry deadline was
armed when the pass opened, it had long expired by the time the budget
ran out, so the next pass began immediately and the interval never
throttled anything. The same inflated budget also survived the peer
replacing its state, at the same height, with the stored block's real
header and a single missing part: the budget is deliberately not
re-derived once a pass is open, so the remainder landed as duplicate
sends of that one part.

Move the send into sendCatchupBlockPart and abandon the pass, arming a
fresh retry deadline, whenever it reports that no part reached the peer.
A pass now costs at most one failed attempt per interval, and only a pass
that got as far as sending keeps its budget.

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

* fix(consensus): close catch-up pass gaps thepastaclaw flagged as still exploitable

Two gaps let a peer defeat the catch-up throttle this PR is adding:

- beginCatchupAttempt armed catchupRetryAt when a pass opened. A pass with
  enough missing parts to span more gossip ticks than catchupResendInterval
  takes longer than the interval to exhaust its budget, so the deadline had
  already elapsed by the time the pass finished - the next tick reopened a
  fresh pass with no quiet gap at all. Arm the deadline when the pass's last
  attempt is spent instead.

- The pass budget was fixed at open and never revisited downward. A peer
  fully controls ProposalBlockParts over the wire (NewValidBlockMessage.
  ValidateBasic checks only length, ApplyNewValidBlockMessage installs it
  wholesale) and can open a pass reporting many parts missing, then swap in
  a bit-array with only one unset bit — every remaining budgeted attempt
  then draws that same index, funding repeated duplicate sends of it.
  Clamp the remaining budget down whenever the peer's current missing count
  drops below it; never raise it back up.

Adds regression tests for both: a 6-part pass ticked across
catchupResendInterval to show the deadline is measured from the pass's last
send, and a 5-part pass whose bitmap shrinks mid-pass to show the budget
clamps to the peer's current report. Both fail against the pre-fix code.

Addresses thepastaclaw findings on PR #1418.

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

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

* perf(consensus): avoid a full bit-array copy to count missing catch-up parts

beginCatchupAttempt derived the peer's missing-part count via
Not().CountTrueBits(), which allocates and copies the whole
(peer-controlled, up to MaxBlockPartsCount) bit-array on every gossip tick
just to count it. sendCatchupBlockPart already performs its own
Not().PickRandom() when a send actually happens, so this was a second,
avoidable full-array allocation on every tick regardless of whether a send
occurs. Derive the same count as size minus set bits instead.

Addresses a copilot review comment on PR #1418.

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

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

* fix(consensus): honor catch-up send failures, close height-advance evasion

Layers on top of review-stream's retryAt-at-close and downward-clamp
fix in beginCatchupAttempt. Distinct fixes:

- syncProposalBlockPart (pre-existing, untouched elsewhere in this PR)
  unconditionally returned nil, so a failed send never reached
  endCatchupPass despite the caller's contract assuming it would.
  sendCatchupBlockPart now reports success as a bool instead of an
  error nobody was meant to inspect, and its "no missing part" branch
  can no longer be hit (the comment claiming otherwise was already
  false: prs is a fresh per-tick deep copy nothing else can mutate).
- A peer's height advancing reset the retry deadline as well as the
  budget, granting a free pass on every height step; only the budget
  resets now.
- The three catch-up fields were guarded only by a comment claiming a
  single caller, despite the same *msgGossiper being shared across
  three concurrent handler goroutines; a mutex now guards them
  structurally.
- Documented the rate limit's actual scope (per gossip worker, not per
  peer -- a reconnect gets a fresh one) on the Gossiper interface and
  the actual tick-to-interval relationship on catchupResendInterval,
  both previously undocumented.

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

* docs(consensus): fix stale catch-up comment in dataGossipHandler

GossipBlockPartsForCatchup is rate-limited and returns without sending
on most ticks, so "block parts already delivered" no longer describes
what happened before the unconditional GossipCommit call on the same
branch.

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

* fix(consensus): propagate the real send error from syncProposalBlockPart

syncProposalBlockPart unconditionally returned nil regardless of the
underlying send's actual result, so sendCatchupBlockPart's error check
against it (added in the prior commit) was dead code: a send that
never reached the peer was indistinguishable from one that did, and
endCatchupPass never fired for that failure mode -- the pass kept
spending its budget one failed attempt per tick instead of ending on
the first one, exactly the spin endCatchupPass exists to prevent.

Fix at the source: return g.sync's result directly and drop the
now-redundant local log, since both callers already log a non-nil
error themselves. The other caller, GossipProposalBlockParts, only
ever logged this error and took no other action, so propagating it
for real is behavior-preserving there.

Regression test advances a fake clock across many ticks with every
send forced to fail and asserts exactly one block-part read per
catchupResendInterval, not one per tick; confirmed failing (5 reads
instead of 1) against the pre-fix code.

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

* fix(consensus): arm catch-up retry deadline when a peer's height advance interrupts a live pass

A peer that advances its reported height mid-pass (before the pass
exhausts its own budget) reset catchupRemaining to 0 without arming
catchupRetryAt, since the deadline was only ever armed when a pass
ran its budget down naturally. A peer whose height ticks forward
every gossip tick therefore got a fresh full-budget pass every tick
forever, completely bypassing catchupResendInterval for the common
multi-part-block case. Arm the deadline on the height-change branch
too whenever a pass was actually in flight, matching the same
invariant beginCatchupAttempt's normal exhaustion path already
upholds. Document that invariant on the struct fields it protects.

Also, while re-auditing this function for the same iteration:
- stop re-deriving the budget from a peer-controlled bit-array once a
  pass is open (now g.catchupRemaining = min(g.catchupRemaining,
  missing), replacing an equivalent but more verbose branch)
- de-duplicate the block-store-failure error logs in
  sendCatchupBlockPart; blockRepository.loadMeta/loadPart already log
  the failure, so the caller's second log was pure noise
- correct sendCatchupBlockPart's doc (it reports handoff to the p2p
  channel, not peer delivery) and give its error log a distinct
  message from GossipProposalBlockParts's
- correct the Gossiper interface, catchupResendInterval, and
  endCatchupPass doc comments, which described a flat one-send-per-
  interval bound that does not hold for multi-part blocks

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

* test(consensus): pin the height-advance throttle bug and fix stale/weak catch-up assertions

- Add TestGossipBlockPartsForCatchupHeightAdvanceInterruptingPassIsThrottled,
  a regression test for the height-advance bug fixed in gossiper.go:
  confirmed RED (20 sends) against the pre-fix code via git stash, GREEN
  (1 send) after the fix.
- Rename/rewrite TestGossipBlockPartsForCatchupBudgetIsFixedAtPassOpen to
  TestGossipBlockPartsForCatchupBudgetIsNeverRaisedMidPass: the old
  sequence never actually drove catchupRemaining below the reported
  missing count it then 'raised', so the raise-attempt it claimed to
  guard against was a no-op the test would pass on regardless. The new
  version forces a real clamp (5-part block, drop to 1 missing after two
  sends) before attempting to raise the count back up, and asserts the
  raise is not honored before the interval elapses.
- Strengthen TestGossipBlockPartsForCatchupPeerHasEveryPart with an
  explicit AssertNotCalled, so it fails loudly instead of silently if a
  send is ever wired in for a peer that already has every part.
- Update the two wantLog assertions in TestGossipBlockPartsForCatchup
  that still expected the removed 'couldn't find a block meta/part'
  caller-side logs; the block-store-failure messages they should match
  are now blockRepository's own 'failed to load block meta'/'failed to
  load block part'.

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

* fix(consensus): share one clock between msgGossiper and its peerGossipWorker

newPeerGossipWorker constructed two independent clockwork.NewRealClock()
instances for what is meant to be one gossip worker's shared notion of
time. They agree in practice (both wrap wall-clock time), but nothing
enforces that, and it defeats point-in-time comparisons in tests that
inject a single fake clock expecting both call sites to observe it.
Construct one clock and pass it to both.

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

* docs(consensus): correct dataGossipHandler's stale catch-up rate-limit comment

The comment described GossipBlockPartsForCatchup as rate-limited and a
no-op on most ticks, which held before this PR's changes but not after:
a pass now spends one send per tick for as many ticks as the peer
reports parts missing, and the quiet gap applies only between passes,
not on most individual ticks. Reword to match.

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

* docs(config): cross-reference PeerGossipSleepDuration's coupling to the catch-up throttle

PeerGossipSleepDuration sets the tick rate that
internal/consensus/gossiper.go's catchupResendInterval throttle is
metered against: configuring it above that fixed interval silently
disables the throttle. Document the coupling at both the struct field
and the generated TOML template so an operator tuning gossip cadence
sees the side effect.

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

* perf(consensus): skip the missing-part scan while a catch-up pass is backed off

beginCatchupAttempt computed missing (Size() - CountTrueBits(), an O(bits)
scan of the peer-controlled ProposalBlockParts array) unconditionally, even
on ticks that are going to return false immediately because the pass is
still within catchupRetryAt's backoff. At production defaults most gossip
ticks land in backoff (a pass's quiet interval is ~5x the gossip cadence),
so this scanned a bit-array up to MaxBlockPartsCount long on nearly every
tick for no reason.

Move the backoff check ahead of the scan: when no pass is open and the
retry deadline hasn't elapsed, return early without touching
ProposalBlockParts at all. The scan still runs whenever it can affect the
outcome - opening a new pass, or clamping an active one's budget down to a
shrunk missing count.

Addresses a copilot review comment on PR #1418.

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

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

* fix(consensus): close an open catch-up pass when the peer reports it complete

beginCatchupAttempt returned early on missing == 0 without touching
catchupRemaining/catchupRetryAt. When that happened mid-pass
(catchupRemaining > 0, budget not yet exhausted), the pass stayed open
indefinitely: noOpenPass would keep evaluating false forever, so the
backoff check above it — which only runs while no pass is open — was
skipped on every later tick regardless of elapsed time. A peer could freeze
catchupRemaining above zero by reporting a complete part set whenever it
liked, then resume sending immediately the next time it reported parts
missing, with no retry interval honored at all.

Close the pass in that case too: zero the remaining budget and arm the
retry deadline, matching what happens when a send fails or a height change
interrupts a pass. Only do this when a pass was actually open; a peer that
has simply always reported a complete set must not have a wait imposed on
it.

Also corrects a stale doc comment on PeerGossipSleepDuration added by the
same throttle: catchupResendInterval is a fixed quiet gap that does not
scale with the gossip tick duration, it only fits more ticks into that same
window.

Adds a regression test that opens a pass, spends one send, has the peer
report complete, then report missing again on the same simulated instant -
asserting no send until the retry interval elapses. Fails against the
pre-fix code (an immediate second send).

Addresses copilot review comments on PR #1418.

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

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

* docs(consensus): reclassify the missing==0 mid-pass fix as CPU-amplification, not a throttle bypass

df8a6057c's commit message and code comments described the missing==0
mid-pass fix as letting a peer "resume sending... with no retry interval
honored at all", which reads as a flooding/throttle-bypass concern. On
closer trace (independently by team-lead and grumpy-stream) that's not
accurate: catchupRemaining only ever counts down, never up, so total sends
per pass are identically bounded by the budget fixed at pass open whether
or not this fix exists. Nothing here lets a peer exceed that budget or the
one-send-per-tick ceiling.

The actual defect is CPU amplification: leaving a pass open indefinitely
(via alternating missing==0 reports) keeps noOpenPass false forever, which
permanently defeats 3b9463dd0's backoff-skip check - the O(bits) scan of
the peer-controlled, up-to-MaxBlockPartsCount bit-array then runs on every
single gossip tick instead of being skipped during backoff, for as long as
the peer holds the pass open this way. It also predates this PR: grumpy
traced the same missing==0 short-circuit in the 5978b27 baseline and
both its parent commits, so this isn't new here - it only started costing
more once 3b9463dd0 added a backoff-skip path for it to defeat.

Also records a deliberate behavior change for honest peers: closing the
pass on missing==0 means a peer that legitimately completes its part set
and later falls behind again now waits out one catchupResendInterval
before catch-up resumes, rather than resuming on its very next report.
Accepted: a peer that just reported complete is not starving, and the
wait is negligible against block time.

No functional change from df8a6057c - comments only, on both the fix and
its regression test.

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

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

* fix(consensus): end a catch-up pass when a block-store read panics

GossipBlockPartsForCatchup only called endCatchupPass() on a normal false
return from sendCatchupBlockPart. But sendCatchupBlockPart's block-store
reads (blockRepository.loadMeta/loadPart, wrapping LoadBlockMeta/
LoadBlockPart) panic deliberately on a decode or read failure rather than
returning an error - runGossipHandler recovers that panic per gossip tick,
logs a full stack, and keeps ticking, same as it does for every other
peer-facing panic path in the node.

A panic there unwinds straight past the if-check, so endCatchupPass()
never runs and the pass stays open with its remaining budget intact. Since
the peer controls both the height and the missing bitmap a pass is
budgeted on, a peer that names a height whose stored record is corrupt or
unreadable gets a fresh attempt - and a fresh panic, and a fresh
full-stack log - on every tick for the rest of the pass's budget (up to
~160s for a maximum-size 1,601-part report at the default cadence) instead
of ending on the first failed attempt like every other failure mode this
PR's earlier commits already cover.

Settle the attempt in a defer instead of an if-check on the return value,
so panic unwinding also reaches it. sendCatchupBlockPart's own return
value still selects the fast path (success needs no settlement); the defer
only changes what happens when it doesn't get the chance to return at all.

Adds a regression test using a block-store mock that panics on
LoadBlockMeta, asserting exactly one read (and thus one panic) per pass
rather than one per tick for the whole budget - mirrors
TestGossipBlockPartsForCatchupSendFailureEndsPass's structure for the
already-covered normal-failure case. Confirmed failing (2+ reads instead
of 1) against the pre-fix code.

Addresses a thepastaclaw blocking finding on PR #1418.

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

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

* fix(consensus): don't throttle a genuinely-advancing peer's next catch-up pass

25da4c2 removed the unconditional catchupRetryAt clear from the
height-change branch to close a bypass, and ea2b81498 later armed it
properly for a pass genuinely interrupted mid-flight (catchupRemaining > 0).
The catchupRemaining == 0 case was never revisited: a deadline armed by the
OLD height (by exhausting its own budget, or by the peer reporting
complete) silently carried forward and throttled the NEW height's first
pass by up to catchupResendInterval, for a peer that isn't replaying
anything and owes nothing - it's genuinely further along. Catch-up is the
only path offered to a peer at a different height than ours (regular
gossip requires equal heights), so this taxes every honestly-advancing
lagging peer once per height. This throttle does not exist on
origin/v1.7-dev; it's a cost this PR's own commits introduced.

Naively clearing catchupRetryAt whenever catchupRemaining == 0 at a height
change (the obvious fix) reopens a worse gap than intended, though: it
cannot tell "the previous pass genuinely finished" apart from "an
INTERMEDIATE height in a rapid chain never got a chance to open a pass at
all, and is still serving an earlier interruption's penalty" - both look
identical (remaining == 0) at the moment of the next height change. Verified
by writing TestGossipBlockPartsForCatchupHeightAdvanceInterruptingPassIsThrottled
first: a naive version of this fix turns its pinned 1 send across 20 rapid
height-hops into 10, because every OTHER hop's remaining == 0 came from the
previous hop being blocked, not from a pass finishing.

Track WHY catchupRetryAt is currently armed instead: catchupRetrySticky is
true when the deadline covers unrendered service (a pass interrupted before
exhausting its own budget, or a failed attempt via endCatchupPass) and must
survive a height change - including a chain of several - and false when the
pass closed because it had genuinely nothing left to do (spent its own
budget in full, or the peer reported complete). The height-change branch
only clears catchupRetryAt when it's non-sticky (or already elapsed);
otherwise it's left untouched, whatever height change caused it to be
checked.

This does still leave a bounded gap in the non-sticky case, stated
explicitly in the code rather than glossed: a peer can open a pass, let it
close cleanly (one real send, e.g. by reporting a single missing part),
then immediately claim a new height and repeat, getting one send per gossip
tick indefinitely instead of one pass per interval. Bounded to at most 1
send/PeerGossipSleepDuration tick (10/s, ~640KB/s of block parts at
production defaults), because CompareHRS enforces monotonic height only (no
replay or ping-ponging) and ensurePeerPartSetHeader requires the real,
currently-stored PartSetHeader for each claimed height (a mismatch ends the
pass via the now-sticky endCatchupPass, costing a full interval rather than
a send). Sustaining it requires marching forward through genuine,
still-retained history, capped by blockStoreBase - no worse than the
pre-#1365 catch-up rate this codebase already tolerated in production.
Accepted as strictly cheaper than taxing every honestly-advancing lagging
peer by up to 500ms per height; a verified-progress-gated redesign that
closes it for real is tracked as follow-up, not done here.

Two new regression tests, both proven against the pre-fix code:
- TestGossipBlockPartsForCatchupCleanHeightAdvanceIsNotThrottled: a
  single-part pass closes cleanly, the peer immediately claims a new
  height with a fresh block - asserts an immediate send, not a
  catchupResendInterval wait. RED before this fix.
- TestGossipBlockPartsForCatchupHeightAdvanceInterruptingPassIsThrottled
  (existing, extended doc comment): still asserts full throttling across
  20 rapid, always-interrupted height hops - GREEN before this fix, and
  the guard that caught the naive version's regression above.

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

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

* fix(consensus): start the catch-up quiet gap after the send, not before it

beginCatchupAttempt armed catchupRetryAt from a timestamp taken on entry,
before the caller had even reached sendCatchupBlockPart. The p2p channel
applies backpressure on that very goroutine, so a slow send burned its own
duration out of the quiet gap it was supposed to precede - the slower the
peer's channel, the weaker the throttle.

It now reports the pass's last slot to the caller instead of arming the
deadline itself, and GossipBlockPartsForCatchup settles the pass from a fresh
clock reading once the send returns. endCatchupPass and the new
completeCatchupPass share settleCatchupPass, keeping one place where a drawn
attempt closes a pass.

The window where the pass is spent but its deadline is not yet armed keeps the
documented invariant (a stale deadline with catchupRemaining == 0 is legal) and
is unobservable: the single per-peer goroutine is inside the send for all of
it, so no further attempt and no height change can run before it settles.

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

---------

Co-authored-by: Claude Opus 5 <[email protected]>
(cherry picked from commit 9bf9a0b)

* fix(consensus): check that a proposal's block ID describes its block

A Proposal carries a BlockID and a proposer signature over it. The BlockID
has three fields, and until the block arrives none of them can be checked
against anything: PartSetHeader is validated implicitly, because the parts
have to assemble under it, but Hash and StateID are taken on the proposer's
word. RoundState.BlockID() then hands that BlockID, unexamined, to the
prevote signer.

So a proposer can gossip a genuine block and sign a BlockID that does not
describe it. Every node that receives the block assembles it, finds nothing
that disagrees, and signs a prevote for the proposer's value. A commit forms
over a BlockID no node ever verified.

The height that commit seals is fine: finalization derives the BlockID from
the block itself, so the committed state records the real one. The next
height is not. Its LastCommit carries the BlockID the votes actually signed,
and validation compares that against the previous height's recorded value.
They differ, and neither can be revised -- one is persisted state, the other
is sealed by a threshold signature over a finalized height. Every proposer
at every subsequent round fails the same comparison. The chain does not
recover, and restarting does not help.

An honest proposer derives its BlockID from the block and the parts it is
gossiped in, so once the block is assembled the claim is exactly checkable.
Two changes, at the two points that matter:

- When the part set completes, compare the Proposal's BlockID against the
  one derived from the block just assembled. On disagreement the block is
  kept -- it is the bytes, and they are what they are -- and the Proposal is
  dropped with its receive time, which leaves the proposal incomplete so the
  round prevotes nil and moves on. A round is a cheap price; the alternative
  is signing the value that ends the chain.
- RoundState.BlockID() returns the BlockID derived from the block and parts
  whenever it holds them, and falls back to the Proposal's only when there
  is no block to derive from. The check above is what reports the lie; this
  is what keeps an unexamined claim from reaching a signature by some other
  route.

Honest operation is unaffected, and that is measured rather than argued. An
instrumented build that compared the two values at every block completion,
without acting on the result, recorded 767 agreements and no disagreement
across the consensus suite, replay included. Forging one StateID byte in the
derived value turned all 778 of them into disagreements, so the comparison
was in a position to report one.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
(cherry picked from commit 2c2a8f6)

* fix(consensus): check a commit's state ID against the block it commits

A commit names a block by hash, part set header and state ID. Before
applying one, a node checks that the block it holds matches the first two
and never looks at the third. A commit that agrees on hash and part set
header while naming a different state ID is therefore applied against this
block, and then recorded carrying its own BlockID.

That record is what the next height is validated against. Its LastCommit
holds the BlockID the votes signed; the previous height's committed state
holds the one derived from the block. They disagree, and neither side can be
revised: one is sealed by a threshold signature over a finalized height, the
other is persisted state. Every proposer at every subsequent round fails the
same comparison, and restarting changes nothing.

Ask the third field. It is asked separately from the other two, rather than
as one comparison over the whole BlockID, so an operator is told which field
disagreed instead of only that something did.

The three checks move into verifyCommitBlock. That is an extraction made for
testability and worth naming as such: reaching them previously required an
ABCI client, because the surrounding function hands the block to the
application immediately afterwards. Separated, each field's rejection is
tested directly, with a nil executor so that a test which stops rejecting
panics rather than passing quietly.

Making the new comparison tautological fails exactly one subtest across the
package, and nothing else notices.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
(cherry picked from commit 665ff68)

* fix(consensus): drop a disagreeing proposal instead of rejecting the block

Two checks in addProposalBlockPart detect the same condition -- a Proposal
that disagrees with the block just assembled -- and they disagreed about the
remedy. The block ID check drops the proposal and keeps the block. The core
chain locked height comparison returned an error, which discards the block.

Discarding it is terminal. AddPart consumes the part before either check runs,
and PartSet.AddPart returns (false, nil) for a part it already holds
(types/part_set.go), so the completion branch is guarded by `added &&
IsComplete()` and is never re-entered. The part that completed the set is
spent, the block is never assigned, and nothing assembles it again. Replay
feeds the same sequence to the same rejection, so restarting does not clear it.

Make the two agree: on disagreement the proposal is dropped and the block is
kept. That is what gives the round its way back, and the mechanism is not
tidiness. Proposaler.Set returns early while rs.Proposal is non-nil, so a
second proposal for the same height and round is discarded unread -- clearing
the field is the only thing that lets the honest copy be accepted. Re-delivery
is ordinary behaviour rather than luck: shouldProposalBeGossiped sends when
`!prs.Proposal`, and that flag is set only by the sender in updatePeerProposal
after its own send, so every honest validator that lost the race still believes
we lack the proposal and keeps offering it.

Dropping is safe because the block is checked without reference to any
proposal. StateData.isValidForPrevote calls sm.ValidateBlockChainLock before
the node prevotes, comparing the block's own core chain locked height against
state, and it guards Proposal == nil explicitly, so a cleared proposal makes
the round prevote nil and advance rather than panic.

The remedy does not depend on knowing what caused the disagreement, which is
the property worth having: a proposer can build the value wrongly, and any peer
relaying the message can raise it, because CanonicalizeProposal omits the dash
fields from what the proposer signs while state_proposaler.go enforces only a
lower bound. One test covers both because the code cannot distinguish them and
is not required to.

The part set header, not the block hash, decides whether the proposal describes
these bytes: CoreChainLockedHeight reaches Header.Hash() through cdcEncode,
which has no uint32 case and contributes an empty leaf for every value, so two
blocks differing only in that field share a hash. That predicate selects which
diagnosis is reported rather than the outcome, and it is commented as such.

An earlier version of this change gated the comparison and left it terminal.
That closes the cases where the proposal describes different bytes and does
nothing when a relayed proposal names this block with the field altered, since
the part set header still matches. It is recorded here so the narrower shape is
not reintroduced as an obvious hardening.

Measured over the consensus suite: the two values agree 778 times and disagree
3, all at height one and off by one. Every disagreement was attributed by
capturing a stack at the comparison. One comes from the reactor test that
installs a proposer proposing an incorrect chain lock height; the other two are
the tests added here, which construct the disagreement deliberately -- including
the reversed case, a proposal claiming a higher chain lock than the block it
names, which is this commit's own fixture rather than anything arising at
genesis.

So the pre-existing suite contains exactly one disagreement, produced by a
deliberately byzantine proposer, and none from an honest flow. The suite also
passes with the mismatch made non-fatal, so nothing depended on the rejection.

Dropping discards ProposalReceiveTime with the proposal, so timeliness is
re-evaluated against the re-delivered copy and a slow re-delivery can still
cost that round. That cost is per round and self-clearing, and keeping the two
paths identical is worth more than softening it here.

The proposal is cleared inline rather than through a helper shared with the
block ID check above. The duplication is deliberate: that check is a cherry
pick, and keeping it byte-comparable with the branch it came from is worth more
on a release branch than removing four lines. The helper belongs where the code
is native.

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

* test(p2p): draw distinct addresses in TestConnTracker loops

TestConnTracker/BaseSmall/AddingMany failed in CI with "expected: 100,
actual: 99". It is not a timing flake: randLocalIPv4 returns
127.<r>.<r>.<r> where randByte is rand.Intn(math.MaxUint8), so the three
random octets span 255^3 = 16,581,375 addresses. connTrackerImpl.Len is
len(rat.cache) and the cache is keyed by address, so two equal draws
collapse into one entry and the count comes up short. AddConn also
returns an error for the duplicate, but the loop discards it with `_ =`,
so nothing reports the real cause.

Measured over 1,000,000 simulated runs of the 100-draw loop: 298
collided, i.e. once in ~3,356 runs, matching the analytic
100*99/(2*255^3). Four loops in this test draw that way (AddingMany and
Cycle, each under both the BaseSmall and BaseLarge factories), so the
observed rate is closer to once in ~840 CI runs. Cycle is the worse of
the two — a collision re-adds an address inside the window, so AddConn
errors and trips require.NoError directly rather than only skewing a
count. VeryShort draws ten and is exposed the same way.

The fix already exists in this file: seqIPv4 ("deterministic, distinct
IPv4 address for the given index") was added alongside the tests in
#1356, which draw 21,000 addresses and would collide with near-certainty,
but it was never applied to the pre-existing loops. Use it in all three
loops that need distinct addresses. randLocalIPv4 stays for
RepeatedAdding and Window, which each need exactly one address and are
collision-immune, and its doc comment now states when it is safe to use
so the next reader does not reintroduce the defect.

Verified by mutation rather than by re-running until green: collapsing
the address space to 3^3 = 27 (below the 100 drawn, so a collision is
forced by pigeonhole) reproduces the exact CI signature on the pre-fix
code — AddingMany "expected: 100, actual: 27" under both factories, plus
Cycle and VeryShort — while the post-fix code passes ten consecutive runs
at that same collapsed space. Run in an isolated module containing only
conn_tracker.go and its test, since the package's BLS cgo dependency is
not buildable in this environment.

Not changed, but noted: randByte is rand.Intn(math.MaxUint8), which
yields 0..254 and never 255. It is inert for the two remaining
single-address callers and is left alone to keep this change scoped.

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

* fix(consensus): validate block IDs across message ordering

Check commits against assembled blocks before application and persistence,
including commit-first and locally assembled commit paths. Propagate apply
errors before broadcasting a commit or advancing the round. Validate late
proposals against retained blocks while allowing matching replacements.

Add failing-first regressions with signed commits and proposal controls.

Co-Authored-By: Codex GPT-6 <[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]>
…1437)

* fix(consensus): do not apply a commit whose block we no longer hold

AddCommitAction asks proposalUpdater.updateStateData to reconcile the
round state with the commit being applied. When the node is holding some
block other than the committed one, that function clears ProposalBlock,
points the part set at the committed block and returns nil -- it is
reporting "we do not have this block, I have set up to fetch it, keep
waiting". AddCommitAction ignored the distinction and dispatched
ApplyCommitEvent regardless, which reads the block it just cleared and
hands the round state to mustEnsureProcess. The nil block reaches
ProcessProposal and the process dies on the first field access.

The sequence is remotely reachable. A node holding a parked commit --
ordinary catch-up state -- that advances a round and then assembles a
different block will crash. A commit attests its own round only, so a
proposal for a later round naming another block is not refused, and the
round's designated proposer can therefore choose to cause this. It is a
crash, not a stall: the node exits rather than falling behind.

Return without applying when the block is gone. The completing part of
the committed block dispatches this event again, so the commit is
applied when its own block arrives, which is what the parked commit was
waiting for in the first place.

Also refuse a nil block in ensureProcess rather than passing it on. This
is defence in depth and not the fix: mustEnsureProcess panics on any
error, so on its own it converts a nil dereference into a panic one line
later -- verified by removing the AddCommitAction guard, which turns the
crash into "panic: proposal block is not set: height 1, round 0". The
guard goes above the condition rather than inside it because both
operands can reach the block: the || short-circuits when the round state
did not come from ProcessProposal, so the nil reaches ProcessProposal,
and when it did not short-circuit MatchesBlock dereferences the block one
frame earlier. Guarding either site alone leaves the other live.

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

* fix(consensus): discard stale proposal when fetching committed block

* fix(consensus): ignore conflicting proposals during commit recovery

* fix(consensus): use committed block header during recovery

---------

Co-authored-by: Claude Opus 5 <[email protected]>
* fix(consensus): apply late commits for completed blocks

Validate and apply retained blocks when commit confirmation arrives after
conflicting proposal metadata has been dropped, including during propose.
Cover arrival order, round differences and invalid commit rejection.

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

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

* fix(consensus): fetch committed block when retained parts differ

Keep immediate validation for matching retained parts and preserve download selection for an authenticated different block. Cover current and earlier rounds, propose-step arrival, and invalid signatures.

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

---------

Co-authored-by: Codex <[email protected]>
Retain Go 1.27.1 while incorporating v1.8-dev dependency updates,
Docker actions, and state-sync changes.

Co-Authored-By: OpenAI GPT-6 <[email protected]>

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

chore: sync v1.7.1-dev.2 into v1.8-dev
build(ci): make the local and CI quality gates actually check what they claim
Bumps [golang.org/x/time](https://github.com/golang/time) from 0.15.0 to 0.16.0.
- [Commits](golang/time@v0.15.0...v0.16.0)

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

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.55.0 to 0.56.0.
- [Commits](golang/crypto@v0.55.0...v0.56.0)

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

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.47.0 to 0.48.0.
- [Commits](golang/sys@v0.47.0...v0.48.0)

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

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

Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.70.1 to 0.71.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/CHANGELOG.md)
- [Commits](prometheus/common@v0.70.1...v0.71.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-version: 0.71.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…6.3 (#1448)

Bumps [github.com/prometheus/client_model](https://github.com/prometheus/client_model) from 0.6.2 to 0.6.3.
- [Release notes](https://github.com/prometheus/client_model/releases)
- [Commits](prometheus/client_model@v0.6.2...v0.6.3)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_model
  dependency-version: 0.6.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.22.0 to 0.23.0.
- [Commits](golang/sync@v0.22.0...v0.23.0)

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

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…by SHA (#1450)

* ci: replace abandoned github/super-linter fork with upstream, pinned by SHA

github/super-linter is an abandoned fork of super-linter/super-linter,
791 commits behind upstream and frozen at tag v7 since 2024-08-29 with
no v8 tag ever published. Its v7 coordinates fall inside the affected
range of CVE-2026-25761 (HIGH, CVSS 8.8: command injection via a
crafted filename), and the upstream fix (8.3.1) was never backported
to the fork, making the vulnerability unpatchable on this dependency's
current coordinates.

Switch to the canonical super-linter/super-linter, pinned by commit SHA
to v8.7.0. Also:
- add fetch-depth: 0 to the checkout step, required since super-linter
  v6.0.0 added an unconditional git-repo validation that fails on a
  shallow clone (this is also what breaks CI on dependabot PR #1443,
  which attempted the in-place v5->v7 bump on this fork)
- add a workflow-level `permissions: contents: read` block, matching
  the other workflows in this repo (govulncheck.yml, check-generated.yml)

Verified against docs/upgrade-guide.md at v8.7.0: none of the env vars
this workflow sets (VALIDATE_ALL_CODEBASE, DEFAULT_BRANCH, GITHUB_TOKEN,
VALIDATE_MD, VALIDATE_OPENAPI, VALIDATE_YAML, YAML_CONFIG_FILE) were
renamed or removed across v5->v6->v7->v8.

Supersedes dependabot PR #1443, which is unfixable by rebase (the CI
failure is structural: dependabot cannot edit the checkout step).

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

* Update permissions for markdown linter workflow

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
…tension-count mismatch, patch grpc CVE (#1451)

* fix(statesync): bound backfill fetch-ahead of verification

blockQueue.nextHeight allocated the next height to fetch without reference
to how far verification had progressed, tracking only what had been fetched.
Fetching a light block costs a round trip while verifying one costs a BLS
commit check on a single serialized loop, so peers serving faster than this
node verifies grew the fetched-but-unverified backlog in the unbounded
pending map across the entire backfill span - a memory-exhaustion vector on
the long backfill a new node joining an established chain performs.

Bound the heights that may be allocated but not yet verified, scaled to the
fetcher count so the pipeline still saturates its workers. Heights needing a
re-fetch are exempt: they are already counted against the bound and the
verify loop cannot advance past them, so withholding one would deadlock the
run the bound exists to protect.

Measured with the backpressure probe over spans of 200, 800 and 3200: peak
fetch-ahead depth falls from 159 to 16 at span 200 and stays at 16 for every
larger span, where it previously tracked the span. Run duration and blocks
served over the span are unchanged, so the happy path pays nothing.

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

* fix(statesync): don't disconnect a peer over a vote-extension count mismatch

backfill treated every error from ValidatorSet.VerifyCommit as grounds to
disconnect the peer that supplied the commit. types.ErrVoteExtensionCountMismatch
does not deserve that: an honest peer relaying a commit whose vote-extension
configuration differs from this node's reaches it, which is an application
disagreement rather than a forged signature.

verifyCommit already leaves that error untyped for exactly this reason, and
internal/consensus evicts only on the typed ErrInvalidCommitSignature. Backfill
is the error's only untrusted-input path, so disconnecting here defeated the
whole carve-out. Score the peer down instead, matching the severity the
neighbouring refusals already use for causes an honest peer can produce.

The peer is still withdrawn from the run, which is what keeps the run healthy,
and every other verification failure still costs the connection.

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

* chore(deps): update google.golang.org/grpc to v1.83.2

v1.82.1 is affected by CVE-2026-84304: internal/transport stores each
fragmented HTTP/2 DATA frame as a separate recvMsg, so an unauthenticated
peer multiplexing streams of one-byte frames exhausts heap while staying
inside the flow-control windows. This repo exposes gRPC servers in
abci/server and privval/grpc, so the path is reachable.

Fixed upstream in v1.83.1 by receive-buffer compaction; v1.83.2 is the
latest patch of that minor and adds rejection of requests carrying neither
:authority nor Host. Release notes for v1.83.0 through v1.83.2 record no
breaking API changes, and this repo uses only NewServer, NewClient and
generated stubs.

Pulls in transitive updates to golang.org/x/crypto, x/net and x/text.

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

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
lklimek and others added 24 commits September 9, 2026 16:47
chore: merge v1.7-dev into v1.8-dev
…itch for profiling (#1430)

* perf(blocksync): per-stage apply histograms and an unsafe-no-fsync switch for profiling

Block sync reported a single exec number covering both ABCI calls, our own durable writes, the mempool update and the event publish. This adds two Prometheus histograms, state_block_apply_stage_duration and consensus_block_sync_apply_stage_duration, labelled by stage, so a slow sync can be attributed to signature verification, the application, disk or block fetching without a profiler. The verify stage is split into the commit signature check and block validation, and the applier records the idle time between blocks.

It also adds unsafe-no-fsync to config: block store and state store writes then return before reaching disk. On macOS Go's File.Sync issues F_FULLFSYNC, about 7 ms per call, and three of them per block hide everything else in a profile. The policy is a constructor option on both stores, applied only where the node builds them, and logged prominently at startup. Rollback, reindex and inspect keep durable writes.

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

* fix: correct block sync idle timing and stabilize stage test

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
Keep burst assertions independent of wall-clock refill under race instrumentation
or scheduler delays. Assert exact initial budgets for prevotes and precommits.

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

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

* fix(consensus): verify a peer commit against its own block ID

StateData.verifyCommit checked a peer-sent commit's threshold signature
against the BlockID of a proposal we happen to hold. A node that is behind
holds a proposal the network never committed, so the genuine commit that
would catch it up failed verification and the node stayed stuck. A forged
signature for a block we did not propose was, conversely, dismissed as a
mere block-ID mismatch and never evicted its sender.

The signature only ever covers the commit's own BlockID, so it is now
always verified against that. A verified commit for a block other than
ours is catch-up traffic and takes the same path as a commit that arrives
before any proposal: the commit is kept, the part set is prepared for the
committed block, and proposal state describing the dead block is dropped,
since Proposaler.Set would otherwise ignore the real proposal and the
committed block's parts would be rejected against the stale one.

Fixes #1414

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

* fix(consensus): decide commit adoption per BlockID, not part set header

A +2/3 prevote majority for a block we do not hold points
ProposalBlockParts at that block and drops ProposalBlock, but leaves
Proposal alone (addVoteUpdateValidBlockMw). A Proposal describing a block
the network dropped therefore coexists with a part set already collecting
the committed one, and adoptCommit's single part-set-header guard read
that matching header as proof the whole round state was in order. It is
not: the header commits to the block's bytes and says nothing about which
Proposal object happens to be lying around next to it. So the stale
Proposal survived, and the node stalled at that height in either of two
ways.

If the block was still incomplete, its completing part was checked
against the stale Proposal's core chain locked height and rejected. A
part set completes exactly once, so nothing re-entered that path, and the
commit parked by adoptCommit made every later commit a no-op.

If the block was already assembled, verifyCommit compared the commit to
the stale Proposal, called it someone else's block and returned false -
with the committed block sitting in ProposalBlock, complete, and no part
left that could trigger another attempt.

Staleness of the Proposal is now decided by the commit's full BlockID,
independently of the part set: the part set keeps its own header guard,
because parts already collected under the committed block's header are
that block's parts and discarding them would only force the whole block
to be fetched again. That part-set preservation is the split's operative
effect, and it is what the stall above needs to recover.

The converse case - a Proposal that does describe the committed block
surviving a part set that does not - is not reachable, and an earlier
version of this message wrongly claimed it as a benefit. adoptCommit runs
only after a Proposal matching the commit has already returned true, so
on the same-round path the Proposal it sees never matches; on the
future-round path EnterNewRound clears Proposal, ProposalReceiveTime,
ProposalBlock and ProposalBlockParts unconditionally in the very next
dispatch. The two criteria are stated independently because they answer
different questions, not because that case occurs.

verifyCommit additionally accepts a commit whose block it already holds
assembled and under the commit's own part set header. That is the
assembled block proving the match on its own, so the branch stays
side-effect-free like the proposal-match branch above it: parking the
commit before TryAddCommitAction has run ProcessProposal and validation
would let a validation failure gate every later commit at that height.

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

* refactor(consensus): name what commit verification decides

verifyCommit no longer answers one question. It checks the threshold
signature, then decides whether the round state can act on the commit.
Rename it readyToApplyCommit and document what it decides. The doc added
here says a false return with a nil error means "authentic, but parked",
which is one of that return's two meanings: the function also returns it
for a commit that is not for this height, which is ignored before any
signature is checked and is not parked at all. The commit
"fix(consensus): decide commit readiness on the block, not on a proposal"
states both. Rewrite
adoptCommit's doc to name both of its guards separately -- a Proposal
goes on a full BlockID mismatch, the block and its parts only on a
part-set-header mismatch -- and to record that EnterNewRound owns the
reset for any round above zero, so the preservation reaches the caller
on the same-round path alone.

"Do we already hold this block?" was answered four ways across the
package; proposalUpdater.updateStateData returned early when either the
block hashed to the commit or the part set carried its header. Extract
StateData.holdsBlock, which requires both, and use it there and in
readyToApplyCommit.

Requiring both changes each arm, and an earlier version of this message
described only the first:

  - the block hashes to the commit but the part set carries another
    header. This returned early and left the round state in the shape
    finalizeCommit panics on. It now rebuilds the part set.
  - the part set carries the commit's header but no block has assembled
    from it yet -- parts collected for the committed block, still
    arriving. This returned early and kept them. It now rebuilds the part
    set, discarding them, and the block must be fetched again from the
    first part.

The second arm is a loss of collected parts on a path that had none
before. It costs a re-fetch, not the height: the rebuilt set accepts the
same parts as they are re-gossiped. It was not noticed when this change
was made, and was found three commits later; the commit
"refactor(consensus): give the round-state retarget a single owner"
restores the two-guard split.

Checking the signature against the commit's own BlockID makes
ValidatorSet.verifyCommit's BlockID guard tautological, so every peer
commit for the current height that clears ValidateBasic now reaches the
quorum-hash and vote-extension-count rejections and spends a pairing on
the way. Neither rejection was classified:
loggingMiddleware wrote an Error line per message and no eviction
followed. Give the quorum-hash disagreement a type so it can be matched
at all, add both to isPeerFloodableError, and pin the remaining bound
with a test that a spent verification budget refuses the commit.

Also: the log line claiming a block "we proposed" describes one the node
merely received; both adoptCommit lines lacked height and round; one key
was camelCase among snake_case; two messages were capitalised among
lower-case neighbours.

Tests: add the untested forged-signature-on-future-round combination,
an end-to-end future-round commit through the real Controller (the part set
is retargeted, then wiped on the round change, then rebuilt -- correct only
by that ordering, and previously unexercised), and extract
the setup the two integration tests duplicated. Drop the eviction
assertion that reached through handleCommitVerifyError, which has its own
tests, and keep the error-type assertion readyToApplyCommit owns.

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

* fix(consensus): apply a commit on the block we hold, not the round step

TryAddCommitAction parked a verified commit whenever the round step had
not passed Propose, on the assumption that the block was still to come.
A node that never received the proposal cannot leave RoundStepPropose --
isProposalComplete requires a Proposal, and ProposalCompletedAction
advances the step only when it is true -- while its block arrives by
gossip after a polka all the same. The part set completes exactly once
and every later commit is short-circuited by the parked one, so a commit
held back on the step is held back for good. That is the lagging-node
profile of #1414, on a path the fix for it did not
reach.

Key the early return on the question the parking is actually about:
whether we hold the block the commit names. Reaching that line already
implies we do -- verifyCommit returns true only after ProposalBlock is
non-nil, the part-set header matches, the hash matches, and the block
has been processed and validated -- so the guard is deliberately
redundant. It states the condition instead of inheriting it from another
function, which is what let the step stand in for it in the first place.

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

* fix(consensus): drop a proposal the round has moved past at its source

A +2/3 prevote majority for a block we do not hold repoints
ProposalBlockParts at that block and leaves Proposal describing the one
the network dropped. enterPrecommit does the same. Every consumer of the
resulting inconsistency then has to work around it, and the one that
does not -- the core chain locked height check on the completing block
part -- rejects the real block's last part. A part set completes exactly
once, so nothing re-enters that path: the node stalls at the height
holding the very block it needs, with no commit required to trigger it.

Clear the Proposal and its receive time at both retarget sites. The
criterion for staleness is the whole BlockID, since a part set header
that happens to match says nothing about the hash or the state ID, and a
Proposal that does describe the repointed block survives with its receive
time, so its timeliness is not lost.

Where the criterion is applied differs by site, and an earlier version of
this message said it did not. adoptCommit asks it of every commit it
adopts. The two retarget sites here ask it only inside the branch that
rebuilds the part set, so a Proposal for another block survives whenever
that block's part set header happens to equal the retargeted one. One
definition, three call sites, two of them reached conditionally.

Consequences worth stating plainly:

Dropping the Proposal makes isProposalComplete false, so a completing
block no longer advances the step out of Propose and a nil prevote waits
for timeoutPropose instead. Same vote, later, bounded. The commit-apply
path no longer depends on the step, so it is unaffected.

Proposaler.Set gates only on rs.Proposal != nil, so this adds one more
moment where a second proposal for the round can be installed. Against a
validator node, a designated proposer that equivocates can put a
proposal for another block in front of the completing part and reproduce
the rejection above. That leaves the height in a terminal condition: the
node cannot finish it on its own.

That terminal condition is not new, and it was reachable accidentally,
with no attacker at all, before this change -- any polka retarget whose
stale proposal disagreed on the core chain locked height reached it,
which is the stall this series exists to fix. What changes here is who
can reach it: an accident becomes an equivocating proposer. The
validator path is also the only one missing the rule, since
verifyProposalForNonValidatorSet already refuses a proposal that
disagrees with a parked commit.

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

* fix(consensus): refuse a proposal that disagrees with a parked commit

A commit we have verified fixes which block the round produced, and the
round state is collecting that block's parts. A proposal naming another
block cannot be acted on: installed, it makes the completing part of the
committed block fail the core chain locked height check, and a part set
completes exactly once.

The rule already exists. verifyProposalForNonValidatorSet refuses such a
proposal for a node outside the validator set, where a commit is the only
thing that can attest a proposal at all. A validator checks the proposer
signature instead and never applied the rule, so the round's proposer
could equivocate -- a second proposal, for another block, in the round
the commit names -- and strand the node on a block it can no longer
assemble.

Lift the check into verifyProposal, above the branch that splits the two
cases, so it governs both paths. The non-validator function is left with
the rule that is unambiguously its own: with no proposer public key, a
proposal with no commit to vouch for it cannot be verified at all. It no
longer performs the BlockID comparison itself, and so accepts on a
precondition its caller established -- on the one path in this file where
no signature is checked at all. An earlier version of this message
presented that as a tidy division of rules rather than as what it is.

The check sits above the verification budget, so a refusal spends no
permit; the data channel's rate limit is what bounds how many a sender can
force. Each one costs a BlockID comparison and the proposer lookup
performed to name the sender in its log line. An earlier version of this
message noted only that no signature check is paid for.

What it does not reject, which is most of what happens: with no parked
commit the first condition returns and nothing changes, and that is the
state for essentially every proposal in normal operation. A proposal
naming the block the parked commit fixed is the one the node is waiting
for and is accepted with its receive time. A commit attests its own
height and round only.

This closes the second of the two ways into the stall this series
addresses, and the two are closed by different commits:

  - the accidental variant, where a polka retarget leaves a proposal
    describing a block the network dropped, is closed by clearing that
    proposal at the retarget sites
  - the attacker variant, where the designated proposer equivocates into
    the window that clearing opens, is closed here

Both remove ways of reaching the underlying state. Recovery from that
state remains limited.

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

* refactor(consensus): give the round-state retarget a single owner

Four call sites repointed ProposalBlockParts at a block the node does not
hold, each open-coding the same three-part update: adoptCommit, the polka
handler in addVoteUpdateValidBlockMw, EnterPrecommitAction.Execute and
proposalUpdater.updateStateData. They did not agree. Only two marked block
gossip as started; one nilled ProposalBlock on a part-set-header mismatch
rather than a hash mismatch; and updateStateData repointed the part set
while leaving the Proposal in place, which is the state that makes the
committed block's completing part fail its core chain locked height check
and stalls the height for good (#1414).

StateData.retargetTo now owns the invariant and all four sites call it, so
the part set cannot be repointed without the Proposal being reconsidered.
Each of the three fields is judged on its own criterion: the Proposal on
the whole BlockID, the assembled block on the hash, the part set on the
part set header, which keeps parts already collected for the target block
instead of discarding them. Callers pass a reason so the shared log lines
still name their source.

Three behaviours change as a consequence:

- adoptCommit drops the assembled block when its hash does not match,
  where before it kept a mismatched block whenever the part set header
  happened to agree. replaceProposalBlockOnLockedBlock can produce that
  combination.
- The stale Proposal is dropped at all four sites, not at two of them.
- Block gossip is marked as started at all four sites.

TestEnterCommitDropsProposalForAnotherBlock covers the commit-application
site, which had no drop at all, and
TestEnterCommitKeepsPartsAlreadyCollectedForTheCommittedBlock pins the
part preservation that the uniform rewrite would otherwise be free to lose.
Both fail before this change.

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

* fix(consensus): keep a proposal and the block parts in agreement

Two rules met in the middle of the same state. A proposal was refused when
it disagreed with a parked commit, but not when it disagreed with a part
set already under way; and a completed part set was judged against whatever
Proposal the round held, whether or not that Proposal described the block
that had just been assembled. Between them a node could install a proposal
for one block while collecting another, and then reject the block it had
asked for over the unrelated proposal's core chain locked height. A part set
completes exactly once and EnterNewRound does not rebuild it, so the height
is lost with blocksync the only way back (#1414).

A part set header is a Merkle root over exactly one block's bytes, so a set
already under way fixes its block as firmly as a commit does. Proposal
admission now asks both questions, under the wider name
checkProposalAgainstRoundState, and the two refusals stay distinct:
contradicting a verified threshold signature is a different observation
about the sender than naming a block the round cannot assemble. This is the
check the TODO in Proposaler.Set asked for, so that comment goes.

The core chain locked height comparison now runs only against a Proposal
naming the assembled block. Against any other proposal the two headers have
no reason to agree, and the comparison rejects a block the node requested.
That path should now be unreachable, which is why it is worth closing:
it is the step that turns an inconsistency into a lost height.

TestProposalDisagreeingWithCollectedPartsIsRefused covers the route no
commit is involved in, TestAssembledBlockIsNotJudgedByAnUnrelatedProposal
the rejection itself, and TestRoundStateRefusalNamesWhatFixedTheBlock pins
which observation refuses, since the dispatcher swallows the error. All
three fail before this change.
TestProposalAgreeingWithCollectedPartsIsAccepted guards the other
direction: an instrumented run of the package shows the new refusal firing
twice in total, both times in a test that intends it, and never in the
honest multi-node tests.

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

* fix(consensus): decide commit readiness on the block, not on a proposal

readyToApplyCommit accepted a commit outright whenever the round held a
Proposal naming the same block. A Proposal attests which block the round is
collecting, not that the block has arrived, so the checks behind that
acceptance then found no block and returned unverified — and the commit was
dropped rather than parked. The node ends up waiting for a commit the
network has already sent it. The one remaining question is whether the block
is held, so that is the only question asked.

Two more places treated a value as evidence of something it does not
establish:

- updateValidBlock copied ProposalReceiveTime into ValidBlockRecvTime
  unconditionally. That time is cleared whenever a proposal stops describing
  the block the round is collecting, so it is zero whenever no live proposal
  dates the block the round holds, and the zero time is not timely:
  this node would refuse to propose the block it holds as valid. A zero now
  falls back to the time the block was learned.
- verifyProposalForNonValidatorSet accepted on a comparison its caller had
  made. There is no proposer public key outside the validator set and so no
  signature check on that path at all, which makes the commit comparison the
  whole attestation; it is repeated where the acceptance happens rather than
  inherited.

The guard in TryAddCommitAction cannot fire — prepareCommitForApply has
already established that the block is held — so it now says so and logs at
Error, which is what reaching it would mean. The proposer is resolved once
in verifyProposal and passed down, replacing a second lookup that existed
only to decorate a Debug line and treated its own failure as non-fatal
twelve lines from where the same failure aborts.

The verifyCommit fixture built its proposal block as a bare header. Such a
block hashes to nil, so every "do we hold this block" comparison in that
table was vacuous; it now builds real blocks with real part sets, and asserts
that they hash. That is what makes the first change above testable at all.

Naming and comments follow the code: holdsProposalBlock says which of the
round state's three block slots it reads, prepareCommitForApply says that it
processes and validates the block rather than only checking a signature, the
readyToApplyCommit doc states a contract per return path instead of
describing one of them, and the fixture and the test that names the
contract are renamed to the function they call. Two further test
identifiers in the same file still carry the old name; the commit
"fix(consensus): keep the assembled block tied to the parts it came from"
renames those and corrects this doc's claim that every non-nil error
identifies the sender, which is not true of a local budget refusal. The shared fixture is named for the commit it builds rather than
for the first scenario that used it, its part size has a name and its
"more than one part" requirement is asserted once in the constructor instead
of at five call sites, and the helpers it travels with live beside it.
Also two staticcheck QF1008 hits in tests, and the log-key and errors.New
conventions the rest of state_try_add_commit.go already follows.

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

* fix(consensus): keep the assembled block tied to the parts it came from

Giving the retarget one owner, in the commit "refactor(consensus): give
the round-state retarget a single owner", also split a coupling that had
been structural. adoptCommit dropped the assembled block whenever it
replaced the part set; retargetTo judged the two independently, so a block
whose hash matched could survive a part set being replaced beneath it.

The round state then reports holding a block over a set with nothing in it:
holdsProposalBlock is true, which admits the commit, and finalizeCommit's
guards pass -- one asks the block's hash, the other the part set header,
which the fresh set carries by construction. Neither asks whether the set
has any parts in it. Nothing does until SaveBlock, which panics on an
incomplete one. No
live route reaches that combination today. It was reachable only because
nothing prevented it, and nothing needed the freedom: a block exists only
because its part set completed, so it belongs to that set.

The block is dropped with the set it came from, and a block that disagrees
with a part set being kept is dropped on its own. Part preservation is
untouched, since that only ever concerned the case where the header matches.

Two more places read a value as evidence for a block it does not describe:

- updateValidBlock dated the valid block with ProposalReceiveTime whenever
  it was set. On the polka path the Proposal can name a different block --
  the retarget on the next statement drops it as stale for exactly that
  reason -- and its receive time measures the arrival of something else.
  Only a proposal naming the block being made valid dates it now.
- readyToApplyCommit's doc attributed every non-nil error to the sender.
  ErrVerificationBudgetExhausted is a local refusal and attributes nothing.

The retarget reason becomes a type with four constants rather than four
string literals, and the two commit-driven reasons say which parks a commit
and which applies one. Two test identifiers still carried the name the
series removed from the function they call, and both call readyToApplyCommit
directly. verifyProposalForNonValidatorSet takes the round state by pointer,
as the check beside it does.

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

* fix(consensus): make a silent commit rejection observable

A node whose validator set has gone stale disagrees with every commit the
network produces on the quorum hash. Each rejection is logged at debug,
because that class is reachable by an honest peer and an error line per
message is a flood amplifier. The node then finalizes nothing and says
nothing, and the only surviving signal is that the height stops moving.

Count commit verification failures by the class of refusal. The classes
separate what they say about this node from what they say about the sender:
a quorum-hash disagreement usually means our validator set is stale, a
forged threshold signature means the sender is dishonest, an exhausted
budget means neither and is already counted on its own. A sustained rate on
the first is alertable without restoring the log line.

The same debug treatment was reaching messages this node produced. The
floodable classes describe what a peer can force; on our own message they
describe a local fault -- a proposal of ours refused means this node has
stopped being able to propose -- so those are logged at warn. Anything
outside those classes still logs at error, from any sender, as before.

Three properties were relied on without being written down:

- retargetTo repoints the round state at a BlockID and must only be given
  one the round has +2/3 evidence for. A BlockID named by a single peer
  would let that peer discard the parts and the proposal this round has
  collected. Every caller satisfies this and nothing checks it.
- Block gossip receive latency is measured from one timestamp shared across
  heights and rounds, so a retarget elsewhere restarts the clock the next
  observation is measured against. retargetTo marks it only where it replaces
  the part set: a retarget that keeps the set is not starting to fetch
  anything, and marking there would report less time than the block took.
- The polka site calls updateValidBlock before retargetTo, and the order is
  load-bearing: the retarget can drop the assembled block and replace the
  part set, and updateValidBlock copies both into ValidBlock and
  ValidBlockParts.

The two handleCommitVerifyError tests that build the action directly now
supply metrics. The queue stays optional, which is what they were written
to pin; the metric is not, and every production construction has one.

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

* fix(consensus): drop a stale proposal when a locked block satisfies the commit

Four sites repoint the round state at a block through retargetTo, which
drops a Proposal describing something else. A fifth does not.
replaceProposalBlockOnLockedBlock installs LockedBlock and LockedBlockParts
directly when the commit names the block this round locked, and that is an
ordinary relock rather than an exotic state. Its caller then finds the block
already held and returns before the retarget runs, so a Proposal for another
block survives the round being repointed -- the inconsistency this series
removes everywhere else (#1414).

The drop moves to the writer. The locked block and its parts are installed
together and already satisfy the commit, so there is nothing else for the
retarget to do there; what is missing is the one part of it that concerns
the Proposal rather than the block.

No live route turns this into a stall today: the assembled-block path is
guarded where the completing part would be judged, and this path bypasses
incremental part gossip entirely. It is the fifth instance of one defect,
which is reason enough.

Seven places write the proposal block slots. This one and retargetTo are the
two that repoint the round state at a block it was not already collecting,
and both now reconsider the Proposal. The other five cannot leave one behind:
updateToState and EnterNewRoundAction clear the Proposal, its receive time,
the block and the part set together; TryAddCommitAction and Proposaler.Set
build a part set only when there is none, the first straight after
EnterNewRound has cleared all four and the second having just admitted the
Proposal against that round state; and addProposalBlockPart assigns the block
the current part set completed into, which is the invariant rather than a
threat to it.

Also a test for the retarget branch that runs when the part set already
carries the target header and the block does not match it. That branch had
no coverage: deleting it left the whole package green.

Commit rejection classes are asserted against wrapped errors as well as bare
ones. Every one of them reaches the classifier wrapped by readyToApplyCommit,
so matching on the bare error would file all of them under "other" and the
counter would read zero while the condition it exists to expose fires.

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

* docs(consensus): say when the gossip clock restarts, and which sites the reasons name

Two comments claimed more than the code does.

retargetTo's doc said every path through it marks the start of block gossip.
MarkBlockGossipStarted is inside the branch that replaces the part set, so
two of three paths do not mark, and the claim was never true. The behaviour
is right and the doc now says why: there is one gossip clock, and restarting
it on a retarget that keeps the part set would discard the time a fetch
already under way has spent, making the latency histogram report less than
the block took to arrive. That is the property a reader of this comment is
trying to establish, so the comment was wrong in the one way that matters.

TestRetargetToRestartsTheGossipClockOnlyWhenTheSetIsReplaced pins it from
both sides. Marking on every path -- making the old claim true -- fails it,
and nothing else in the package notices.

retargetReason's doc counted four reasons and attributed all of them to
retargetTo's log lines. There are five, and the fifth names the one site
that repoints the round state without going through retargetTo at all.

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

* fix(consensus): exempt replay from the local-fault warning

A floodable rejection of a message this node produced is a local fault:
our own proposal refused means the node has stopped being able to propose,
and debug buries it. Replay is not that. It re-plays what already happened
and says nothing about what the node can do now, so warning there fires on
every restart and teaches an operator to ignore the line. Every other
replay-sensitive decision in this file already reads envelope.fromReplay;
this one did not.

TestLoggingMiddlewareSeparatesLocalFaultsFromReplay covers all three
senders. Removing the exemption fails the replay case and nothing else.

Also record at the round assignment in readReplayMessage that it bypasses
EnterNewRound, which is what clears the proposal, its receive time, the
block and the part set together -- so an earlier round's part set outlives
the round it belonged to, and proposal admission judges the next proposal
against it.

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

* test(consensus): let the commit table express a partly-agreeing block ID

The table drew its proposal and commit block IDs from two independent
factory.MakeBlockID() values and chose the round state's block and part set
from the whole BlockID at once. Every row was therefore either "the same
block" or "a different block", and no row could describe a BlockID that
agrees on one field and not the others.

That mattered for one assertion in particular. "A proposal the network did
not commit must not block the real one" reads as a general claim, but every
adopted row reached it with a part set whose header differed from the
commit's, which is the only case the drop used to cover. The assertion held
by arrangement rather than by coverage, and six rows including an explicit
forgery case made it look thorough.

Choose the block by hash and the part set by header, independently, and add
the row that combination now permits: a proposal agreeing with the commit on
the part set header alone. That is the shape a stale proposal hides behind,
because the round is already collecting the committed block's parts, so
every test of the header is satisfied while the proposal still names another
block. Restoring the conditional drop fails this row and no other.

The budget parameter is nil throughout, which is deliberate: the budget path
has its own test rather than a column here.

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

* fix(consensus): set the commit only once it is going to be dispatched

The guard that rejects a commit verified against a block the round state
does not hold ran after `stateData.Commit` was already assigned. On that
branch the round kept a commit it never dispatched: `Commit != nil` is
what stops a later commit being reconsidered, so the round would wait for
an event that no longer had a sender.

Moving the assignment below the guard leaves nothing behind when the guard
fires. The assignment still precedes the dispatch, so nothing changes on
the path that dispatches; the two orderings differ only on the rejecting
branch, which `prepareCommitForApply` makes unreachable today. The guard
exists so that a later change there cannot silently reopen it, and this
completes the defence it describes.

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

* style(consensus): reach embedded fields directly in the block-part guard

The three lines this branch adds to addProposalBlockPart spell out the
embedded field before the one they want — `stateData.RoundState.Proposal`
and `block.Header.CoreChainLockedHeight` — copying the style of the
surrounding logging calls. staticcheck's QF1008 rejects them.

`StateData` embeds `cstypes.RoundState` and declares no `Proposal` of its
own; `Block` embeds `Header` and `Data`, and `CoreChainLockedHeight` is
declared only in `Header`. Both shortened forms therefore resolve to the
same fields with nothing shadowed or ambiguously promoted.

The neighbouring logging calls use the long form too, but they predate
this branch and the gate filters per changed line, so they stay as they
are: a lint fix should not become a file-wide reformat.

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

* fix(consensus): preserve pending commit downloads across rounds

Keep the authenticated commit's collected block parts when a round advances,
announce the download target through valid-block gossip, and apply a retained
complete block when a future-round commit arrives. Mark pending committed
targets so peers can accept their announcements across round changes.

Cover partial downloads through timeouts, peer-state target updates, and
complete future-round blocks with focused consensus tests.

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

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

* test(consensus): expect retained commit downloads after round changes

Update the later-round proposal test to require preservation of the pending
commit's part set and early rejection of unrelated proposals and parts.
Keep its final assertions that the committed block advances the height.

Validated the full internal/consensus/... suite with race and deadlock checks,
and golangci-lint on the changed code.

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

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

* fix(consensus): reject commit hashes inconsistent with retained parts

Reject authenticated commits conflicting with an assembled block under the same complete part set before parking or changing rounds. Restore late-commit rejection assertions and keep retargeting fixtures consistent with block assembly.

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

* fix(consensus): announce pending target after peer round reset

Publish the new round step before its pending block target so automatic or delayed proposal entry cannot erase the target in peer state. Cover both event streams with auto-propose enabled and verify same-height block-part gossip remains eligible.

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

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Preserve Origin-less clients and reuse RPC origin matching without implicit same-host trust for the light proxy.

Co-authored-by: Codex <[email protected]>
…-sync handover (#1416)

* fix(blocksync): don't persist a block the application refused

The applier saved a block to the block store and only then handed it to
the application. An application that refuses the block - and one holding
a stale execution context for that height does refuse it - left the store
one height ahead of a block it never processed, and every later start had
the handshake re-process that block through the same application, so the
node could not restart its way out (#1413).

ApplyBlock is now run as its two halves with the store advanced between
them: ProcessProposal, where an application refuses a block and nothing
has been persisted yet, then SaveBlock, then FinalizeBlock, where the
application commits. Saving before the commit is what keeps the store
from falling behind the application or the state, a case the handshake
rejects outright, while a store one ahead is one it recovers from.

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

* fix(blocksync): keep syncing when the tip is out of consensus catch-up's reach

The wall-clock backstop handed a node over to consensus after ten minutes
without progress however far behind it was. What follows that handover is
consensus catch-up, which moves about one block per gossip cycle: it
closes a gap of a few blocks in seconds and a gap of thousands never, and
in the meantime the node sits in the validator set at heights the network
committed long ago (#1413).

The backstop now applies only within maxCatchupGap of the highest height
any peer claims. Further back, block sync keeps retrying and logs the
distance every interval - the only route to the tip that exists. A stall
on a block no peer can serve still ends block sync as before, so a node
that genuinely has nowhere to fetch from is unaffected.

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

* fix(consensus): don't propose after a block-sync handover while still behind

Block sync hands over to consensus even when it never reached the tip,
and nothing told consensus about it. A long-lived validator handed a
historical height is very likely the genuine proposer of the next height
too, so it proposed a block built from present-day application state; the
real block for that height then collided with it, and the node could not
restart its way out (#1413).

A handover that leaves the node provably behind - block sync stopped
while a peer claimed a height above ours - now holds back proposals until
something says the node reached the network: a peer reporting a height no
higher than its own, or a block committed through consensus while no peer
reports one. Voting and following consensus are untouched, and a
suppressed round times out and rolls on like any other silent proposer.

Only a handover can start the window, and it closes for good, so a peer
lying about its height can neither open one nor reopen one - it can only
hold a window the node already entered open while it stays connected. A
node no peer claims to be ahead of, a solo validator or a fresh network,
never enters it at all.

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

* fix(blocksync): preserve handover evidence and validate before persistence

Carry the observed target into consensus independently of the sync verdict,
read state after stopping block sync, and bound proposal suppression based
on unverified peer heights. Validate application responses before saving.
Keep commit verification intact; its memoization is handled in PR #1427.

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

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

* fix(blocksync): use servable peer heights for stall fallback

Keep the highest observed peer height as the handover target, but calculate
the stall gap only from peers able to serve the required block. Cover range
eligibility, receive-rate filtering, busy peers, and concurrent snapshots.

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]>
…tus (#1426)

* fix(statesync): implement missing Metricer methods and keep metrics after sync

The state-sync counters surfaced by the /status RPC were never usable: *statesync.Reactor did not implement SnapshotChunksCount()/SnapshotChunksTotal(), so it silently failed to satisfy the Metricer interface, and the remaining getters read through r.syncer, which syncComplete() nils the moment a sync ends - so even a wired-up reactor would report zeros for the rest of the process lifetime.

- Implement SnapshotChunksCount()/SnapshotChunksTotal(), sourced from the syncer's chunk queue while a sync is active (chunks are content-addressed and discovered incrementally, so the total is the number of distinct chunks seen so far), and add a compile-time var _ Metricer assertion so the interface can no longer drift.
- Snapshot the sync's final values (total snapshots, avg chunk time, snapshot height, chunk counts) into Reactor fields under r.mtx before syncComplete() drops the syncer; getters read the live syncer during a sync and the snapshot afterwards. The syncer likewise records the queue's final chunk counts before dropping it at the end of Sync().
- Fix data races: backfilledBlocks/backfillBlockTotal were written without r.mtx while the Metricer getters read them under RLock; the writes now take the lock. The syncer's avgChunkTime/lastSyncedSnapshotHeight were similarly read across goroutines; they are now accessed atomically, and TotalSnapshots() now uses a locked pool.Len() instead of reading the pool map directly.

Persisting the completed-sync record across process restart is deliberately out of scope: it needs a state-store change, which is a design decision left to maintainers.

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

* fix(node): wire the statesync reactor into the RPC env as StateSyncMetricer

The statesync reactor was constructed and dropped straight into node.services with no reference kept, so env.StateSyncMetricer was never assigned anywhere and /status unconditionally skipped the state-sync counters. Keep a reference and expose it on rpcEnv, mirroring how ConsensusReactor and BlockSyncReactor are wired.

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

* docs(rpc): remove phantom snapshot_chunks_total field from openapi

The SyncInfo Go struct has no snapshot_chunks_total field; the openapi schema documented one that /status never returns. Remove it to match the actual response.

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

* test(statesync): cover the Metricer surface and /status metrics wiring

- TestReactorMetricer exercises every Metricer getter across the sync lifecycle: zeros before any sync, live syncer values during a sync (snapshot pool, chunk queue counts), and persistence of the snapshotted values after releaseChunkQueue and syncComplete drop the syncing objects.
- TestReactor_Sync now asserts that a completed end-to-end sync leaves the final metrics readable (snapshot height, snapshot/chunk counts, avg chunk time) after the syncer is gone.
- TestStatusStateSyncMetrics verifies /status copies the metrics from a wired StateSyncMetricer into sync_info.
All run under go test -race.

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

* docs(statesync): clarify metric accessor invariants from review

Note that syncer.snapshots is set once at construction (why TotalSnapshots reads it without s.mtx), and that the test stub's SnapshotChunksTotal only satisfies the interface since SyncInfo has no such field.

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

* fix(statesync): count discovered snapshots cumulatively for /status

TotalSnapshots previously returned the snapshot pool size, which shrinks on rejections and peer disconnects; a peer leaving between the restore and syncComplete (e.g. during backfill) zeroed the metric this PR exists to fix. Back it with an atomic counter incremented when AddSnapshot accepts a new snapshot, and pin in the metrics test that the value survives emptying the pool.

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

* test(node): assert the statesync reactor is wired as the RPC StateSyncMetricer

Removing the rpcEnv.StateSyncMetricer wiring kept every existing test green; TestNodeStartStop now fails if the /status metrics source is unplugged.

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

* refactor(statesync): drop unused SnapshotChunksTotal and use typed atomics

SnapshotChunksTotal was left on the Metricer interface when the snapshot_chunks_total RPC field was removed in #663; nothing consumes it and chunks are discovered incrementally, so it is not a usable progress denominator. Remove it along with the chunkQueue.TotalChunksCount and snapshotPool.Len plumbing that only existed to serve it.

Switch the syncer's lock-free counters to atomic.Int64, matching the evidence pool and p2p rate limiter, so the alignment guarantee is structural rather than by comment. Drop the stale snapshots != nil guard in TotalSnapshots, and make tests read the metrics through the accessors instead of raw fields.

* docs(rpc): describe the state sync fields in sync_info

These fields carry real values now, and chunk_process_avg_time is a nanosecond duration serialized as a string, which is not guessable from the schema.

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: lklimek <[email protected]>
…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]>
* feat(ci): route PR reviews through the shared ownership policy

Pin the shared Platform evaluator while keeping repository policy local. Leave custom policy writes opt-in and preserve existing protections for staged activation.

Validation: policy schema and paths, generated CODEOWNERS and Actionlint. Shared evaluator94 tests and policy CI passed. Application builds omitted because only workflow and ownership configuration changed.

* fix(ci): pin the reviewed policy engine with feedback fixes

* ci: read the review policy from dashpay/stale_prs_are_bad

The policy is no longer copied here; the caller pins the shared engine in
dashpay/stale_prs_are_bad and the engine reads this repository's policy live
from that repository's protected branch. CODEOWNERS is regenerated from it:
the fallback now names this repository's own owner instead of the Platform
leads.

The pin references the engine PR head and is re-pinned to its merge commit
before activation.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: generate a single wildcard CODEOWNERS rule

GitHub honours only the last matching pattern, so the duplicate `*` line was
redundant at best and misleading at worst.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: pin the shared review engine to its merge commit

dashpay/stale_prs_are_bad#5 landed as 25b9369077ef6394ffb5491be718a6f0740e6088.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: re-pin the shared review engine

dashpay/stale_prs_are_bad#7 landed as cc4d18484ceabf121886e47606b4b10628aafefa.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: receive review events directly and re-pin the shared engine

The policy workflow now listens for pull_request_review itself, so the no-op
signal workflow is gone. dashpay/stale_prs_are_bad#8 landed as d2978b05a15c8e29091958b0fa57b90a5ed5ff3b.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
The engine commit now lives only in the workflow reference; the callee reads
it from there, so the two could no longer disagree. dashpay/stale_prs_are_bad#9
landed as a95eab4ec0938e9022edd0c82591d052408a38a5.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
The engine understands per-repository required_bots and publishes its status
as `PR Hygiene`. dashpay/stale_prs_are_bad#10 and #11 landed as 36581c5a53672f06faf8ad2dc1c33b3ec5481d55.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Drafts now record their state in the commit status without opening a comment.
dashpay/stale_prs_are_bad#13 landed as 750eec13bc5e5f9c704f1a610aed51d376513fa2.

Co-authored-by: Claude Opus 5 (1M context) <[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]>

* 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]>
* ci(e2e): restore Go cache, export docker cache once, drop .git from image

Shorten the critical rotate leg of the e2e workflow without changing what
is tested:

- Run actions/setup-go after checkout so its module/build cache is keyed
  from repository files and actually restores (it never did: go.mod was
  not checked out yet). Use a dedicated key (go.sum, test/e2e/Makefile,
  BLS headers) instead of the go.mod hash shared with tests.yml and
  lint.yml, whose caches hold -race and lint artifacts. BLS headers are
  keyed because the Go build cache does not track cgo's C dependencies.
  Gate it like the other build steps.
- Export the GHA docker layer cache from the dashcore leg only; both legs
  still read it.
- Exclude .git from the E2E image build context via a Dockerfile-specific
  ignore file. The root .dockerignore keeps .git: DOCKER/Dockerfile stamps
  the release version with `git describe`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(e2e): run per-node subtests in parallel

testNode ran every node subtest sequentially, so the e2e test phase grew
linearly with the node count (~93 s on the 13 stateful nodes of rotate).
Run them in parallel, capped at 4 via -test.parallel in the runner. That
bounds RPC load on 4-vCPU CI runners and matches their default GOMAXPROCS.

Coverage is unchanged: the same tests, nodes and assertions, and
top-level tests stay sequential.

- testNode calls t.Parallel() in each node subtest. Its doc comment now
  says the callback must use the ctx it is given (the caller's deferred
  cancel has already run) and treat captured data as read-only.
- TestApp_Tx guards its shared *rand.Rand with a mutex; it is not safe
  for concurrent use.

History: t.Parallel() was part of testNode originally. Upstream tendermint
#7516 (09aa100, "e2e: constrain test parallelism and reporting")
removed it together with adding -test.v and sorting nodes, without
stating a reason. #7523 (ac57896) then introduced the shared *rand.Rand
that relied on sequential subtests. Shared test state (testnet and block
caches, node sort) is only touched from parent test bodies, and node
subtests only read shared data.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(e2e): note the pending -race check for parallel node subtests

The parallel node subtests were checked for data races by code review
only; a local -race run against a testnet could not be scheduled. Leave a
TODO in testNode so the check isn't forgotten.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(e2e): remove completed race verification TODO

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Progress now reports a green check instead of a permanent amber one, queued
runs are no longer cancelled by events on other pull requests, and a bare
`/self-reviewed` attests to everything pushed so far.

dashpay/stale_prs_are_bad#15 and #16 landed as 8e36bbdd8daaeab02c108b976348fefaf7defba7.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Create the send queue and register peer channels before PeerStatusUp so
subscribers can send immediately without losing their first message.

Add a deterministic regression test that pauses queue creation and checks
that readiness is published only once the outgoing route exists.

Co-authored-by: Codex <[email protected]>
…he test networks (#1460)

* chore(e2e): allow pinning node containers to host CPUs via E2E_CPUSET

Lets a developer approximate the 4 vCPU CI runner on a larger host when
measuring e2e timing. Unset (default) leaves the compose file unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(e2e): report quorum type by LLMQ name in the mock Dash Core

The e2e mock Core server answered `quorum info` with the numeric LLMQ type
("100"), while Dash Core returns the LLMQ name ("llmq_test"). Since #1442,
state sync authenticates the light block validator set against `quorum info`
and parses the type with btcjson.GetLLMQType, so every e2e state sync
rejected every snapshot, fell back to block sync at height 1, stalled there
for the 60s sync timeout and only then caught up through consensus. That
added minutes to every CI run and left the state sync restore path untested.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(e2e): serve complete quorum info from the mock Dash Core

State sync (#1442) authenticates a light block's validator set against
Dash Core `quorum info`: the threshold public key as hex and every member
with its public key share, the signed proposer included. The e2e mock only
knew the local node's own share and printed the threshold key in the PubKey
String() form, so authentication still failed after the quorum type fix.

Build every quorum of the validator set schedule the runner already writes
to app.toml and serve it in full, the way Dash Core would. The FilePV path,
kept for quorums outside the schedule, reports the threshold key as hex.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(p2p): register every reactor channel with the transport up front

Reactors open their channels in OnStart, after the router already accepts
and dials peers, and an MConn connection is created with the channel
descriptors registered at that moment. A peer that spoke early on a channel
the connection did not know - typically a seed sending a PEX request right
after the handshake - was dropped with "unknown channel". Behind a
rate-limited, connection-capped seed this left nodes peerless until block
sync's 60s timeout, stalled the first heights and failed e2e runs.

Create the transport with every descriptor the node's reactors open (the
seed: PEX only). Until a reactor opens its channel the router drops that
channel's messages instead of the connection. AddChannelDescriptors skips
channel IDs already registered, and Dial reads the descriptors under the
transport mutex like Accept does.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(e2e): start a start_at node once the chain reaches its height

The start_at barrier waited for every running node to reach the height. A
node still looking for peers - common behind the connection-capped seed in
the CI networks - held back every later node for up to block sync's 60s
timeout, and when it made no progress for 60s the runner reported the
healthy chain as "stalled" and failed the run.

Wait for the chain instead: any started node with state at the height. The
lagging nodes keep catching up in the background, and the runner still
waits for every node to reach the target height before perturbing and
testing, so the same nodes, modes and sync paths are exercised.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(node): register each p2p channel descriptor exactly once

p2p.ChannelDescriptors already merges the consensus and state sync
descriptor sets, so also iterating those two sets handed the transport
21 descriptors for 13 channel IDs. Every connection then built two
conn.MConnection channels per duplicated ID, of which channelsIdx keeps
whichever the non-stable sort left last - the other one is allocated,
counted against the connection's send queues, and never receives.

Pull in only p2p.ChannelDescriptors, and sort with slices.SortFunc to
match the package's import style.

Rework the accompanying test into a unit test that no longer starts a
node: it derives the expectation from makeNodeInfo / makeSeedNodeInfo
rather than a second hand-kept channel list, covers validator, full and
seed mode, and asserts the descriptor set is exactly the advertised set
(plus p2p.ErrorChannel, which the p2p client opens lazily and which is
deliberately never advertised) with no ID registered twice.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(p2p): pin descriptor identity in AddChannelDescriptors

The previous assertions could not fail: the transport was constructed
with a len == cap slice literal, so any append - in place or not - would
have reallocated and left the snapshot untouched, and assert.Equal
compares descriptors by value, so keeping the duplicate instead of the
first registration went unnoticed.

Give the initial slice spare capacity, so an in-place append really
would write into the array the snapshot shares, and assert pointer
identity with assert.Same for both the retained first registration and
the snapshot's element.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* refactor(node): derive the advertised channels from the registered ones

makeNodeInfo listed the advertised channels by hand, so the node kept
three hand-maintained channel lists (up-front descriptors, validator
NodeInfo, seed NodeInfo) that matched only because each was edited in
step. They fail closed but silently when they drift: Router.OpenChannel
never consults the transport's list, it only adds to it, so a channel
missing up front still opens and only peers that speak on it over a
connection established earlier get dropped.

Derive both NodeInfo channel lists from channelDescriptors and document
why p2p.ErrorChannel is left out - nothing is ever sent to a peer on it,
it only carries p2p.PeerError to the router, which evicts the peer
locally. The advertised IDs are unchanged in every mode.

Assert the invariant per mode (validator, full, seed) against the
descriptor sets the p2p client and the consensus, state sync, evidence
and PEX reactors actually pass to OpenChannel, instead of against a
literal maintained in the test file.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* feat(p2p): warn when a channel is registered after transport creation

A channel the transport was not created with is a gap in the node's
up-front channel list, and it is otherwise invisible: opening the channel
succeeds, no test fails, and only peers that speak on it over a
connection established earlier are dropped as protocol violators.

Log it as a warning - not an error - since the legacy p2p test harness
opens channels ad hoc, and MemoryTransport.AddChannelDescriptors is a
no-op, so nothing else changes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(blocksync): retry missing blocks without waiting for peer timeout

Resolve NoBlockResponse as a typed request failure and retain a peer's
unavailable history across status refreshes. Requeue the missing height
without penalizing or disconnecting the peer, allowing another source to
serve it immediately.

Cover immediate response handling, retry selection, request accounting,
status refreshes, reordered replies, and mismatched heights.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: Codex <[email protected]>
…1458)

* ci: restore the Go cache in build, govulncheck and check-generated

actions/setup-go ran before actions/checkout in these workflows, so its
cache step found no go.mod/go.sum and skipped the Go module and build cache
restore entirely ("Restore cache failed: Dependencies file is not found").
Every run compiled from scratch.

- run setup-go after checkout (and after get-diff-action where present)
- skip setup-go when the job's GIT_DIFF gate is empty, so skipped jobs don't
  download a cache they never use
- key each workflow's cache on go.sum plus the workflow file, and in
  check-generated on each job's tool config (.mockery.yaml / buf.*), so
  these caches don't collide with the tests.yml/lint.yml cache key

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: re-run check-mocks when its workflow file changes

get-diff-action's FILES input matches bare file names anywhere in the tree,
so the full path `.github/workflows/check-generated.yml` never matched and
edits to this workflow never triggered the mock check. List the path under
PATTERNS (minimatch globs) instead.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: include mockery and buf config files in check-generated patterns

check-mocks and check-proto skip their generation checks when only
.mockery.yaml or a Buf config file (buf.yaml, buf.gen.yaml, buf.lock)
changes, since GIT_DIFF stays empty and both setup-go and the
verification step are skipped. Add these files (and the workflow file
itself for check-proto, matching check-mocks) to PATTERNS.

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

* proto: regenerate .pb.go from current toolchain

The check-proto CI job never ran on this branch's own workflow-file
change until PATTERNS was widened to cover it (see previous commit),
which surfaced generated code drift accumulated since the gogoproto
fork bump in go.mod (unrelated PR #1189). Diff is purely cosmetic:
regenerated gzipped FileDescriptorProto bytes and a comment-formatting
change from the current protoc-gen-gogofaster/buf versions; no field,
method, or wire-format changes (verified via `git diff --unified=0`
with the descriptor-byte and comment-only lines filtered out).

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
The engine can now ask a silent review bot once and stop waiting for it, and
no longer treats a bot objection raised against an earlier commit as an
outstanding one. dashpay/stale_prs_are_bad#17 landed as 64edd771b8a560c82f0351058eebadf2df94cdd9.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…g for transactions (#1466)

* chore(proto): regenerate protobuf code with the current toolchain

The committed files were generated with Go 1.23; go.mod now requires 1.27 and
the check-generated workflow regenerates with it, so the gzipped descriptors
and blank comment lines differ. No .proto changed in this commit.

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

* feat(abci): let the application ask for the next block without waiting for transactions

Add ResponseFinalizeBlock.propose_next_block_immediately. When the application
sets it, round 0 of the next height enters the propose step as soon as the
commit timeout has passed instead of waiting for transactions or the
create-empty-blocks-interval, the same as if a transaction were in the mempool.

The hint is local to the node and never part of consensus: it is not compared
between validators, only the proposer of the next height acts on it, a
non-proposer that is still waiting on its interval accepts the early proposal
as usual, and it is consumed once and not persisted, so a restart falls back
to the configured wait.

Dash Platform needs this for withdrawals: the block that pools a withdrawal
leaves the untied transaction in a queue that the next block signs, and on an
idle chain that next block only came after the empty-block interval.

ABCISemVer 1.3.0 -> 1.4.0 (additive response field). FinalizeBlock on the
state executor now also returns the application's response so the consensus
engine can read the hint; block sync and replay ignore it.

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

* chore(mocks): use mockery's import alias in the executor mock

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

* test(e2e): exercise propose_next_block_immediately in the dashcore testnet

The kvstore application gains propose_next_block_immediately, which sets the
hint in every FinalizeBlock response. The manifest gains create_empty_blocks
(consensus create-empty-blocks of every node) and
propose_next_block_immediately. The dashcore CI testnet turns empty blocks off
and the hint on, so the chain only keeps moving without transactions because
of the hint; TestApp_ProposeNextBlockImmediately asserts that empty blocks
above the initial height exist, which is impossible without it.

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

* test(e2e): count blocks without mempool transactions, not empty blocks

The e2e application adds its extensionSum transaction to every proposal once
vote extensions are enabled, so no block is ever empty. Count blocks above the
initial height whose only transaction is that one, and also watch the chain
grow while nothing submits transactions.

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

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
Ignores comments the engine never reads, rebuilds an author review slots with
one query instead of two requests per pull request, reads collaborator access
once per run, and sweeps hourly.

dashpay/stale_prs_are_bad#20, #21, #22 and #24 landed as c115fa43691c6de989bd224989899d44f76bab89.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
The hourly sweep repairs pull requests whose events were missed. Its rotation
cursor was bucketed by 15 minutes while the sweep runs hourly, so it advanced
four batches per sweep and covered one; where the number of open pull requests
shared a factor with that overshoot the same six were swept for ever.

dashpay/stale_prs_are_bad#25 landed as 8192c065b4960cddb2244702ed1a1a9d7b8bed3c.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
A concurrency group holds one pending run and cancels it when the next event
arrives, so a burst of events on one pull request cancelled the middle ones and
a cancelled run renders as a failed check. Runs now queue in arrival order.

dashpay/stale_prs_are_bad#26 and #27 landed as b378d1d7f9c3949a5f73822362ca02d251ab8141.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@lklimek lklimek added this to the v1.8 milestone Sep 16, 2026
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 745adcaf-8885-4476-97ef-5b2599f6c7cd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Sep 16, 2026 •

Copy link
Copy Markdown

🕓 Queued for automated review — 29th in line, estimated start in ~1.9 h (commit bd3a5ab)
Estimated review time once started: ~10 min (two-phase automated review; median of recent runs).

  • Request priority review — click to move this review to the front of the queue.

@lklimek
lklimek merged commit b277e2c into master Sep 16, 2026
22 of 24 checks passed
@lklimek
lklimek deleted the release_1.8.0 branch September 16, 2026 08:23
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.

6 participants