Skip to content

docs(consensus): add source-derived consensus protocol specification - #1562

Merged
lklimek merged 12 commits into
v1.8-devfrom
docs/consensus-protocol-spec
Nov 4, 2026
Merged

lklimek merged 12 commits into
v1.8-devfrom
docs/consensus-protocol-spec

Conversation

@Claudius-Maginificent

@Claudius-Maginificent Claudius-Maginificent commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: Replaces the outdated, Tendermint-era consensus docs with a formal specification of the Tenderdash consensus protocol derived from the current source code.

User story

As a protocol engineer or auditor, I want an accurate, formal description of how Tenderdash consensus actually behaves, to reason about safety, liveness and edge cases without reverse-engineering internal/consensus.

Scenario

Base flow

A reader opens spec/consensus/ or docs/tendermint-core/consensus/ to understand how a height is decided.

Actual behavior

The existing docs describe upstream Tendermint (BFT time, priority-based proposer selection, unlock on nil polka, timeoutCommit, LastCommit vote sets, an ABCI Commit call) and contradict the Tenderdash implementation (LLMQ quorum thresholds, BLS threshold signatures, rotation-based proposer selection, no unlock, commit-message following for non-validators).

Expected behavior

One source-derived specification covers the primary flow and all alternative flows / edge cases, with mermaid diagrams and citations to the implementing functions; overlapping docs are removed, reduced to pointers, or corrected.

Detailed discussion

What was done

New spec under spec/consensus/ (consensus.md rewritten in place as the index):

  • consensus.md — terminology, system model, round state, step state diagram, invariants, threshold recovery, timeouts.
  • consensus-happy-path.md — primary flow for a height with sequence diagram and ABCI calls.
  • consensus-transitions.md — guards / actions / postconditions for every step action, timer semantics, vote dispatch tables, prevote / precommit / proposal-acceptance flowcharts.
  • consensus-alternative-flows.md — ~45 alternative flows and edge cases across 16 areas.
  • consensus-commit.md — local and peer commits, parking, commit candidates, expectations, gossip.
  • consensus-recovery.md — WAL, handshake cases, crash windows, block-sync handover.
  • consensus-known-issues.md — behaviour that diverges from the intended algorithm or looks like a bug (e.g. an untimely ValidBlock is never re-proposed; RoundStepPrecommitWait is never entered). Documented only; no code changed.

The spec describes the code with #1565 applied (ExtendVote rejects DEFAULT vote extensions); #1564 is already in v1.8-dev. Merge #1565 first.

Deduplication of existing docs:

  • Deleted (superseded): spec/consensus/creating-proposal.md, docs/tendermint-core/consensus/reactor.md, docs/tendermint-core/consensus/proposer-based-timestamps.md.
  • Reduced to a pointer: docs/tendermint-core/consensus/README.md.
  • Rewritten from code: spec/consensus/proposer-selection.md.
  • Corrected / linked: spec/consensus/{readme,signing,wal,bft-time}.md, spec/README.md, spec/core/data_structures.md, spec/p2p/messages/consensus.md, spec/abci++/abci++_tmint_expected_behavior.md.
  • ADRs, RFCs, DoS design specs/runbooks and the consensus paper are untouched.

Testing

  • markdownlint (repo config) clean on all touched files.
  • All mermaid diagrams render with mermaid-cli 11.4.2.
  • Relative links and anchors checked by script: no new breakages.

Breaking changes

None (documentation only).

Prior work

Attribution

🤖 Generated with Claude Code

https://claude.ai/code/session_01N1Z1FkN122DviTj4d53v59

PR Hygiene · 937c823

  • Bots — thepastaclaw ✓
  • Self-review — not asked of a bot author
  • Build green
  • Approvals
    • files with no dedicated owner (docs/tendermint-core/consensus/README.md, docs/tendermint-core/consensus/proposer-based-timestamps.md, docs/tendermint-core/consensus/reactor.md and 17 more) — approved by lklimek

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Replace the stale Tendermint-era consensus description with a specification
derived from internal/consensus: step state machine, primary flow of a
height, formal transition table (guards/actions/postconditions), prevote and
precommit decision procedures, alternative flows and edge cases, commit
handling (local and peer commits, parking, candidates, gossip), recovery
(WAL, handshake, block-sync handover) and a known-issues section. Every
non-trivial rule cites its implementing function; diagrams are mermaid.

Deduplicate against existing docs: rewrite spec/consensus/readme.md and the
proposer-selection page from code; reduce docs/tendermint-core/consensus to
a pointer and delete its stale reactor and PBTS overviews; delete
creating-proposal.md (covered by the happy path); mark bft-time.md as
historical; correct the timestamp statements in signing.md and
core/data_structures.md; fix the WAL page's obsolete references; align the
ABCI++ expected-behaviour page with the removed Commit method.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N1Z1FkN122DviTj4d53v59
@coderabbitai

coderabbitai Bot commented Oct 22, 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

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 22, 2026
@github-actions

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@thepastaclaw

thepastaclaw commented Oct 22, 2026 •

Copy link
Copy Markdown

✅ Final review complete — Phase 1 only — no blockers (commit 937c823) · triage: trivial

@github-actions

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

…lied

Assumes #1564: a freshly built block is proposed with POLRound = -1. The
known issue now covers the remaining divergence: an untimely ValidBlock is
never re-proposed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N1Z1FkN122DviTj4d53v59
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Final validation — Phase 1 + Phase 2

The documentation rewrite contains several protocol-level inaccuracies at the ABCI, nil-round, error-classification, recovery, proposal-retargeting, and vote-extension boundaries. These should be corrected before merging; the technical CI checks are successful, while PR Hygiene remains pending. The POLRound description also depends on commit e5d0536, which is not an ancestor of this head.

🔴 5 blocking | 🟡 4 suggestion(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This is a large, intricate documentation diff that directly rewrites the consensus protocol specification, including proposer selection, voting, quorum thresholds, commit handling, recovery, and peer-facing consensus behavior, so its correctness materially affects a critical consensus surface.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — tenderdash-consensus-security (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `spec/abci++/abci++_tmint_expected_behavior.md`:
- [BLOCKING] spec/abci++/abci++_tmint_expected_behavior.md:240-242: Do not describe FinalizeBlock as returning AppHash
  ResponseFinalizeBlock contains only retain_height and propose_next_block_immediately; it has no AppHash field. Tenderdash receives and validates the application hash through the earlier proposal-processing responses, while FinalizeBlock is responsible for applying and persisting the block state. This migration instruction tells application authors to return a value that the method cannot carry.

In `spec/consensus/consensus-alternative-flows.md`:
- [BLOCKING] spec/consensus/consensus-alternative-flows.md:16-21: Remove the prevote-wait timeout from the all-nil proposer-failure flow
  When every validator prevotes nil, TwoThirdsMajority returns the nil BlockID. addVoteDispatchPrevoteMw immediately dispatches EnterPrecommit for a current-round nil majority; it does not enter PrevoteWait or wait for voteTimeout(r). PrevoteWait is used only when there is +2/3-any voting power without a block majority. The prose and sequence diagram therefore add a timeout that does not occur and misstate the failed-round transition.
- [SUGGESTION] spec/consensus/consensus-alternative-flows.md:229-233: Mark DEFAULT vote extensions as unsupported
  Although DEFAULT exists in the enum, VoteExtension.Validate explicitly rejects it, and MakeQuorumSigns excludes non-threshold-recoverable extensions from the signing items. Presenting DEFAULT as an available validator-signed extension type can cause an application to return extensions that peers reject through VoteMessage.ValidateBasic; the FilePV signing path can also index the shorter filtered signature list with the unfiltered extension list. Document only THRESHOLD_RECOVER and THRESHOLD_RECOVER_RAW as supported extension types.

In `spec/consensus/consensus-transitions.md`:
- [BLOCKING] spec/consensus/consensus-transitions.md:366-371: Classify malformed application AppHash responses as fatal processing errors
  A malformed AppHash in ResponseProcessProposal is rejected by ResponseProcessProposal.Validate and then returned by BlockExecutor.ProcessProposal as an ordinary validation error before the ErrInvalidBlock wrapper is reached. ensureProcess preserves that classification, so prevoter.handleError takes its unknown-error panic path rather than signing a nil prevote. The specification must distinguish an invalid application response from a valid response whose contents disagree with the block header; the same incorrect classification appears in consensus-alternative-flows.md lines 99-104.

In `spec/consensus/consensus-recovery.md`:
- [BLOCKING] spec/consensus/consensus-recovery.md:78-80: Split crash recovery at SaveBlock rather than EndHeightMessage
  The first recovery row currently includes a crash after SaveBlock has persisted height h but before EndHeightMessage is written. In that window the block store is already one height ahead of state and the application, and startup uses the ABCI handshake ApplyBlock path. The WAL-replay row should be limited to crashes before the block is persisted; the post-SaveBlock/pre-marker window belongs in the handshake row.

In `spec/consensus/consensus.md`:
- [BLOCKING] spec/consensus/consensus.md:209-210: Qualify the one-proposal invariant to account for authenticated retargeting
  Proposaler.Set ignores a proposal only while the current proposal slot remains occupied. A current-round polka for a different block invokes retargetTo, whose dropStaleProposal clears the old proposal without advancing the round; a matching proposal for the retargeted block can then be accepted in that same round. Thus the first verifying proposal does not universally win. State the occupied-slot rule together with the authenticated retarget and block-mismatch exceptions, and correct the equivalent unconditional statements in consensus-transitions.md and consensus-alternative-flows.md.
- [SUGGESTION] spec/consensus/consensus.md:223-226: Qualify WAL synchronization as best-effort on the proposal path
  EnterProposeAction attempts FlushAndSync before creating a proposal, but when synchronization fails it only logs the error and still calls proposalCreator.Create. The vote-signing path does return on synchronization failure, so successful WAL durability is the normal ordering rather than an unconditional invariant for every signature. Document the proposal-path exception and qualify the corresponding statement in consensus-recovery.md.

In `spec/consensus/proposer-selection.md`:
- [SUGGESTION] spec/consensus/proposer-selection.md:17-20: Restrict the proposer fairness guarantee to within-height rotation
  The unconditional R2 claim is false across every consecutive window of |V| elections. In the v0 selector, a height can have one proposer at round 0, a different proposer at round 1, and then derive the latter proposer again at the next height's round 0 because the previous commit round is subtracted. The documented reconstruction formula permits sequences such as B,B,C,D for a four-validator stable set. State the narrower within-height rotation guarantee or list the additional assumptions needed for cross-height fairness.

In `spec/consensus/consensus-happy-path.md`:
- [SUGGESTION] spec/consensus/consensus-happy-path.md:157-160: Spec documents POLRound=-1 for fresh blocks but head code always uses ValidRound (unmerged #1564)
  At this head, Proposaler.Create builds a fresh block when checkValidBlock fails but still calls makeProposal with rs.ValidRound unconditionally. Commit e5d05362c changes this by setting polRound to -1 for a freshly built block, but that commit is not an ancestor of the reviewed head. Because the specification is intentionally written for the post-#1564 behavior, this dependency must be merged first or the text must clearly remain conditional; otherwise the published documentation contradicts the implementation at this head. The same claim is repeated in consensus-alternative-flows.md and consensus-known-issues.md.

Comment thread spec/consensus/consensus-transitions.md Resolved
Comment thread spec/consensus/consensus-recovery.md Resolved
Comment thread spec/consensus/consensus.md Resolved
Comment thread spec/consensus/consensus.md Resolved
Comment thread spec/consensus/proposer-selection.md Resolved
Comment thread spec/consensus/consensus-happy-path.md Resolved
@github-actions

Copy link
Copy Markdown

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Oct 22, 2026
@github-actions

Copy link
Copy Markdown

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

…urce

- FinalizeBlock: ResponseFinalizeBlock carries no AppHash; the hash comes
  from PrepareProposal/ProcessProposal.
- All-nil prevotes dispatch EnterPrecommit directly; PrevoteWait only on
  +2/3-any without a majority (prose and sequence diagram).
- ProcessProposal: a malformed application response (UNKNOWN status, wrong
  AppHash size, mismatched tx_results) is a plain error and panics; only
  REJECT and ErrInvalidBlock lead to a nil prevote.
- Crash windows: a crash after SaveBlock belongs to the ABCI-handshake row,
  with or without EndHeightMessage; note the catchupReplay error path.
- Invariant "one proposal per round" qualified: retargetTo/dropStaleProposal
  frees the slot on an authenticated polka or commit for another block.
- WAL sync before signing is best-effort on the proposal path; the vote
  path returns on failure.
- Proposer fairness (R2) restricted to within-height rotation, with the v0
  and v1 cross-height behaviour spelled out.
- Vote extensions: only THRESHOLD_RECOVER(_RAW) are supported; DEFAULT is
  rejected by VoteExtension.Validate.
- Known issues: DEFAULT extension from ExtendVote is not rejected before
  signing (FilePV index mismatch); unreachable AppHash size check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N1Z1FkN122DviTj4d53v59
@github-actions

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Oct 22, 2026
@github-actions
github-actions Bot requested a review from shumkov October 31, 2026 12:25
- validator hashes: describe ValidatorSet.Hash and ProTxHash ordering
- block time: replace the median check with the validated time rules
- PBTS links: mark the design documents as historical and link current rules

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed ready-for-human PR Hygiene: bots done, author self-reviewed, awaiting human review labels Oct 31, 2026
@Claudius-Maginificent

Copy link
Copy Markdown
Collaborator Author

Fixed in 16c743118: the median step is gone, and the checklist now matches validateBlock, requiring time after the previous block above the initial height and not before genesis at it (spec/core/data_structures.md:116).

🤖 Co-authored by Claudius the Magnificent AI Agent

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review — Final review — Phase 1 only (trivial change)

Verified the documentation findings at head 16c7431 and revalidated all 17 prior findings; all 17 are fixed, including the merge-first dependency now present in v1.8-dev. Three non-blocking documentation inconsistencies remain in pages this PR rewrites or designates as protocol references. Current code checks pass; only PR Hygiene remains pending, and the supplied base-drift evidence reports no conflicting files.

🟡 3 suggestion(s)

Review provenance

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.1-sol (agent: sol-gate-verifier, role: final-verifier)

  • Triage: trivial by gpt-6.1-sol (effort low) — The diff changes only documentation and does not alter executable consensus rules, cryptography, networking, or storage behavior.
  • Phase 1 reviewers: glm-5.3-flash — general (completed, effort high); agent phase1-reviewer, glm-5.3-flash — tenderdash-consensus-security (completed, effort high); agent phase1-reviewer
  • Phase 1 model: glm-5.3-flash — zai quota: 5h 99% left, weekly 74% left; passed over gemini-3.8-flash-high (antigravity quota lookup failed)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-gate-verifier
  • Phase 2 reviewers: not run (triage rated this change trivial); this review comments and never approves
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `docs/tendermint-core/consensus/README.md`:
- [SUGGESTION] docs/tendermint-core/consensus/README.md:29-33: Qualify the docs-tree PBTS pointer as historical design material
  This rewritten entry point still identifies the linked PBTS design document as "the timestamp algorithm", whereas the specification-side pointers now correctly label it historical. The target document describes BFTTime as the current implementation and derives block time from precommit timestamps. Tenderdash instead uses genesis time at the initial height and the proposer's local clock thereafter (`State.makeBlockTime`), with proposal timeliness checked separately. Point this entry page to the implementation-specific timestamp rules and apply the same historical qualifier used in the spec index.

In `spec/p2p/messages/consensus.md`:
- [SUGGESTION] spec/p2p/messages/consensus.md:142-152: Align the consensus wire reference with HasVote and commit messages
  The new specification explicitly delegates the message wire format to this page, but its Message table names field 7 `received_vote`/`ReceivedVote` and stops at field 9. The actual oneof in `proto/tendermint/consensus/types.proto` names field 7 `has_vote`/`HasVote` and includes `commit` at field 10 and `has_commit` at field 11. The section above likewise describes HasVote under the wrong name. These are pre-existing omissions, but correcting the wire reference is within this PR's stated replacement of contradictory upstream documentation and is needed for its new commit-gossip specification. Rename the section and row, and document both commit message variants and their fields. A table-only replacement would leave missing section anchors, so no partial replacement is supplied.

In `spec/core/data_structures.md`:
- [SUGGESTION] spec/core/data_structures.md:245-250: Replace the residual upstream Vote fields with Tenderdash's data model
  This corrected data-structure reference still contradicts the source-derived signing specification. `types.Vote` has no Timestamp or ValidatorAddress: it carries ValidatorProTxHash, ValidatorIndex, BlockSignature and VoteExtensions. The protobuf vote likewise carries a repeated list of typed VoteExtension values, not the singular Extension/ExtensionSignature byte slices documented here, and BLS signatures are 96 bytes rather than fewer than 64. The adjacent CanonicalVote example also retains a timestamp absent from the actual canonical protobuf. Update these descriptions together so readers do not derive incompatible vote encodings or validation rules. The same upstream identity mismatch remains in the Header table at line 139: Tenderdash uses the 32-byte ProposerProTxHash, not a 20-byte ProposerAddress. These factual corrections fit the PR's explicit goal of correcting this reference alongside the new consensus specification.

Comment thread spec/p2p/messages/consensus.md Resolved
Comment thread spec/core/data_structures.md Resolved
@github-actions

Copy link
Copy Markdown

Ready for review — files with no dedicated owner: lklimek or shumkov.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human PR Hygiene: bots done, author self-reviewed, awaiting human review and removed waiting-bots Waiting for the review bots to report on this head labels Oct 31, 2026
- data structures: describe Tenderdash Header, BlockID, Part, Commit, Vote,
  VoteExtension, CanonicalVote, Proposal, ValidatorSet, Validator and params
- remove CommitSig and LightClientAttackEvidence, which no longer exist
- consensus messages: rename ReceivedVote to HasVote, add Commit, HasCommit
  and VoteSetMaj23.block_id, and correct field types and descriptions
- consensus docs entry page: mark the PBTS pointer as historical

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed ready-for-human PR Hygiene: bots done, author self-reviewed, awaiting human review labels Oct 31, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review — Final review — Phase 1 only (trivial change)

Verified the documentation corrections at head 937c823 and reconciled all 20 prior findings; no in-scope findings remain. The #1564 fix is in this head and the #1565 prerequisite is merged into the target branch; the supplied base-drift evidence reports no merge conflicts. Current CI build, unit tests, e2e tests, vet, and lint checks pass; PR Hygiene remains pending.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.1-sol (agent: sol-gate-verifier, role: final-verifier)

  • Triage: trivial by gpt-6.1-sol (effort low) — The diff changes only documentation and does not alter executable consensus rules, cryptography, networking, or storage behavior.
  • Phase 1 reviewers: glm-5.3-flash — general (completed, effort high); agent phase1-reviewer, glm-5.3-flash — tenderdash-consensus-security (completed, effort high); agent phase1-reviewer
  • Phase 1 model: glm-5.3-flash — zai quota: 5h 99% left, weekly 69% left; passed over gemini-3.8-flash-high (antigravity quota lookup failed)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-gate-verifier
  • Phase 2 reviewers: not run (triage rated this change trivial); this review comments and never approves
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@github-actions

Copy link
Copy Markdown

Ready for review — files with no dedicated owner: lklimek or shumkov.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human PR Hygiene: bots done, author self-reviewed, awaiting human review and removed waiting-bots Waiting for the review bots to report on this head labels Oct 31, 2026
@lklimek
lklimek enabled auto-merge (squash) November 4, 2026 07:17
@lklimek
lklimek dismissed thepastaclaw’s stale review November 4, 2026 07:18

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Policy satisfied — this can merge.
Full checklist in the description.

@github-actions github-actions Bot removed the ready-for-human PR Hygiene: bots done, author self-reviewed, awaiting human review label Nov 4, 2026
@lklimek
lklimek merged commit 577d91d into v1.8-dev Nov 4, 2026
32 checks passed
@lklimek
lklimek deleted the docs/consensus-protocol-spec branch November 4, 2026 07:19
QuantumExplorer added a commit that referenced this pull request Nov 4, 2026
Brings in the source-derived consensus specification (#1562).

Conflict in spec/abci++/abci++_tmint_expected_behavior.md: v1.8-dev drops
the Commit call from the ABCI grammar, and this branch adds check-commit
and apply-randomness. The resolution keeps both, and notes that from
consensus version 2 the state FinalizeBlock persists has the root
ApplyBlockRandomness returned.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
QuantumExplorer added a commit that referenced this pull request Nov 4, 2026
Brings in the source-derived consensus specification (#1562).

Conflict in spec/abci++/abci++_tmint_expected_behavior.md: v1.8-dev drops
the Commit call from the ABCI grammar, and this branch adds check-commit
and apply-randomness. The resolution keeps both, and notes that from
consensus version 2 the state FinalizeBlock persists has the root
ApplyBlockRandomness returned.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
lklimek added a commit that referenced this pull request Nov 26, 2026
* ci: re-pin PR Hygiene (#1505)

* ci: re-pin PR Hygiene (#1508)

* test(node): wait for goroutines before first-commit cleanup (#1507)

Wait for remaining node goroutines before removing temporary files and
use an ephemeral P2P port in the first-commit startup regression test.

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

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

* ci: re-pin PR Hygiene (#1510)

* ci: re-pin PR Hygiene (#1511)

* ci: re-pin PR Hygiene (#1514)

* ci: run Claudius review only after tests.yml is green (#1512)

* ci: run Claudius review only after tests.yml is green

Add a wait-for-tests gate job that polls the Test workflow run for the
PR head SHA. The review job runs only when tests concluded successfully;
failed/cancelled tests skip the review, a timeout fails the gate.

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

* ci: harden wait-for-tests gate per review

- Surface skipped review via ::warning:: and step summary
- Scope run lookup to the PR head branch
- Fail fast if no tests.yml run appears within 15 min
- Retry transient gh run list failures instead of aborting

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

* ci: let claudius-review label trigger review on draft PRs

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

* ci: ignore draft status for Claudius review triggers

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

---------

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

* ci: Claudius review on push/label only, cancel stale runs per PR (#1516)

* ci: cancel stale Claudius review runs on new push

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

* ci: simplify review concurrency to one group per PR

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

* ci: trigger Claudius review only on push or claudius-review label

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

---------

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

* ci: re-pin PR Hygiene (#1517)

* ci: re-pin PR Hygiene and wake it on a hand-over (#1518)

* ci: re-pin PR Hygiene (#1519)

* ci: re-pin PR Hygiene engine to 3b98772

* build(deps): Bump github.com/golangci/golangci-lint/v2 (#1522)

Bumps [github.com/golangci/golangci-lint/v2](https://github.com/golangci/golangci-lint) from 2.13.2 to 2.14.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v2.13.2...v2.14.0)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint/v2
  dependency-version: 2.14.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>

* ci: post Claudius reviews as the claudbot GitHub App (#1525)

Mint a repository-scoped App token after the test gate and restrict the
workflow token to read-only contents. Pin the review action to include
trusted review identification and required App-token validation from
lklimek/claudius-review-action#19 and #20. Document repository setup.

Port dashpay/dash-evo-tool#1037 while retaining Tenderdash's concurrency
control across the test gate and review.

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

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

* chore(lint): pin golangci-lint to v2.14.0 everywhere and migrate to gomodguard_v2 (#1524)

CI floated on v2.13 while go.mod required v2.14.0, so formatter output
differed between CI and local runs. Pin the exact version in the workflow
and Makefile, and move the deprecated gomodguard config to gomodguard_v2.


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

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

* chore: use main version of claudius-review-action (#1526)

* fix(consensus): verify commit vote extensions before a commit is taken (#1520)

* test: reproduce commit extension and proposer validation gaps

Add intentionally failing tests for stripped and duplicated commit extensions,
RAW extension context binding, a known but incorrect header proposer, and
repeated proposer capture through stored block metadata.

Keep production behavior unchanged pending remediation. The RAW signing test
is a diagnostic probe, not a requirement to break Core-compatible signatures.

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

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

* fix: verify commit vote extensions before persistence

Validate the complete threshold vote-extension vector through ABCI after ProcessProposal and before storing or finalizing blocks across consensus, block sync, and replay paths.

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

* test: separate proposer regressions from commit extension fix

Keep the unrelated red proposer tests on test/proposer-header-regressions.
PR #1509 now contains only the commit extension fix and its regression tests.

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

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

* test(blocksync): assert commit extensions are verified before SaveBlock

Replace the pasted permissive VerifyVoteExtension stubs with a shared
acceptCommitExtensions helper. Given SaveBlock expectations, it makes each
wait for the commit-vector check, so moving the check after persistence
fails the applier tests instead of passing silently.

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

* fix(consensus): recover the height after commit extensions are rejected

A commit whose extensions the application REJECTs used to strand its
height: peers that sent a commit while the rejected one was parked mark
this node as holding one and never resend, and forcing the step back to
Precommit made every queued timeout a no-op.

- TryAddCommit keeps commits that arrive while another is parked as
  unverified replacement candidates: one slot per peer, capped at 32,
  discarded on height change, retried in arrival order (so WAL replay is
  deterministic).
- After a REJECT, ApplyCommit tries those candidates through the normal
  TryAddCommit verification, then the node's own +2/3 precommits for the
  block, and failing both schedules a precommit-wait timeout so the node
  moves to the next round, which makes peers gossip their commits again.
  Recovery is iterative; a rejected commit is never relayed.
- tryFinalizeCommit returns the ApplyCommit error instead of dropping it.
- The ApplyCommit step transition shared with EnterCommit becomes
  StateData.enterApplyCommit; a peer's rejected commit no longer rewrites
  the round's step.

Tests pin the Marvin stall scenario, the own-quorum fallback, the real
tryFinalizeCommit path, the round-change fallback, replay, no relay of
rejected commits, and the previously surviving mutants M8/M9/M10.

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

* docs(abci): document commit verification in VerifyVoteExtension

The proto (source of truth, regenerated: types.pb.go and api.md change in
comments only) and the ABCI++ spec pages now describe both kinds of
request: an empty validator_pro_tx_hash verifies a commit's
threshold-recoverable extension vector after ProcessProposal, which the
application must compare exactly. REJECT semantics are spelled out per
path (consensus replacement or round change, block sync peer drop and
refetch, replay start-up failure), the request table gains the missing
round field and correct field numbers, and the expected-behavior call
counts, grammar and trivial-app rule include the commit call.

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

* fix(consensus): synchronize committed state reads in block executor

Use the locked state snapshot for proposal creation and processing. Add a
regression test exercising both paths during concurrent state updates.

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

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

* fix(p2p): avoid holding PEX lock while querying peer manager

Read peer capacity before locking PEX so peer updates can drain while
PeerManager.Ready holds its mutex during broadcast. Reproduce the blocked
update path in a concurrency regression test.

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

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

* fix(ci): authenticate GitHub requests when installing buf

Pass the workflow token to buf-setup-action to avoid anonymous API rate
limits preventing protobuf lint from starting.

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

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

* fix(consensus): harden rejected commit recovery

Advance rounds directly after application rejection, avoid blaming the block-part peer, and expose rejection metrics across consensus and block sync.

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

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

* fix: retain processed proposals when retrying rejected commits

Generate e2e vote extensions for the requested initial height. Retain block-sync
ProcessProposal output across semantic rejection and keep the downloaded block
and processed context during consensus round fallback. Sequence discard/save
before recovery and clarify the upgrade and historical replay requirements.

Add initial-height, retry, cache-invalidation and round-retention regressions.

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

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

* refactor: retain processed blocks within round entry

Make KeepProcessedBlock preserve both the block and its ProcessProposal result
inside EnterNewRoundAction, removing caller-side restoration. Cover direct
round entry and rejection recovery with automatic proposing enabled for both
proposer roles. Remove ineffective fixture configuration and document why
replaying unchecked historical extensions intentionally stops on 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: avoid competing proposals during commit recovery

Keep the propose timeout while suppressing proposal creation for a retained
committed block. Include height, round and hash in commit extension errors
on every verification path. Cover queued future-round recovery with a test.

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

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

* docs: mark commit verification upgrade requirements unreleased

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

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

* fix: suppress competing proposals for held committed blocks

Release queued candidates after accepting a height. Clarify rollback and
startup replay behavior, and remove unreachable rejection log classification.

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): recover rejected commits without changing rounds

A peer resending an authentic commit with stripped extensions made the
node advance one round per rejection, retaining vote sets and growing
timeouts without bound. Recovery no longer changes the round; instead no
honest commit can be lost, so re-gossip is unnecessary:

- commit candidates keep one slot per connected peer (no fixed cap);
  disconnected peers' slots are freed on the next add, using the peer
  lanes' live sessions; replayed and local entries are exempt
- queued commits prepay their verification in their own scheduler turn,
  and recovery retries them uncharged, so recovery never spends budget
  out of turn and cannot starve the message the scheduler reserved for
- a commit that still fails for want of budget is retained in its
  sender's slot for the next recovery (prepaid retries never re-queue)
- remove KeepProcessedBlock / SkipProposalCreation; keep the EnterPropose
  skip for a held committed block, needed by the future-round commit path

Docs describe the remaining stall: with no pending timeout, progress
waits for a commit from a peer that has not sent one or reconnects.

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

* refactor(consensus): verify commit extensions before a commit is taken

Ask the application to accept a commit's extension vector in TryAddCommit,
right after the held block is processed, so a rejection is an ordinary
verification error: nothing is saved, parked or recovered, the round stays,
and the sender is not evicted. ApplyCommit, AddCommit, EnterCommit,
EnterPropose and StateData return to their v1.8-dev shape.

- A future-round commit whose block is held is checked before its round is
  entered, so a rejection changes no round.
- Commits arriving while one is parked awaiting its block are authenticated
  on arrival (threshold signature, charged in-turn) and kept one slot per
  connected peer. When the block completes, the parked commit and then the
  queued ones are checked in order; the first accepted is applied. If all
  are rejected the block takes the ordinary path, which lets a held +2/3
  precommit quorum finish the height.
- The commit built from the node's own precommits is checked in
  tryFinalizeCommit; a rejection logs an error and persists nothing.

Drops the recovery loop, Prepaid budget flag, budget-exhausted retention,
ApplyCommitEvent.Rejected/FromOwnPrecommits and the proposer skip, and
consolidates the recovery and queue tests into commit_extensions_test.go.

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

* docs(abci): regenerate api.md from proto

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

* fix(consensus): try parked commits a round at a time

Commits for the same block may differ only in round, and the held block is
processed once per round. Trying queued candidates in raw arrival order could
switch back to a round already processed, re-running ProcessProposal for the
same height and round, which apps such as kvstore reject as a duplicate call,
so an honest commit could fail on a processing error.

selectParkedCommit now groups candidates by round: the round already
processed for the held block first, then each other round in order of first
appearance, keeping arrival order within a round.

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

* refactor(blocksync): reuse ProcessProposal result by header and round

Replace the processedBlock/processedRound cache key with the same check
consensus' ensureProcess uses: a ProcessProposal-sourced
CurrentRoundState that MatchesBlock(header, round). The commit is
authenticated for the block before processing, so the header identifies
it.

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

* fix(kvstore): allow re-processing a round after another round

Drive keeps one execution context per height and re-executes a round when
ProcessProposal comes back to it after another round. The reference app
rejected any second ProcessProposal for a round at a height, which is
stricter than Drive and turned a legitimate re-process into a node panic.
Duplicate detection now errors only on consecutive calls for the same
round. A replaced round state is closed.

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

* fix(consensus): drop repeated commits and reuse extension verdicts

A commit equal to the parked one or a queued one (same height, round,
BlockID and extension vector) is now dropped before its threshold signature
is verified and takes no candidate slot. The application's verdict on a
commit extension vector is kept for the height (at most 64 entries), and a
vector it already rejected is refused before the block is processed again,
so an alternating flood of rejected commits cannot re-execute the block per
message. Only ACCEPT/REJECT verdicts are cached.

Adds regression tests for the own-quorum fallback after commits rejected at
two rounds (with an app that refuses only an immediate repeat, like kvstore)
and for block sync processing a round again after another one. Documents
that CurrentRoundState must match the application's latest ProcessProposal.

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

* docs(abci): align commit-extension docs with the code

- UPGRADING, spec and proto: a future-round commit whose block is not held
  still moves the round; UNKNOWN counts as REJECT; handshake catch-up is
  named apart from WAL replay; ProcessProposal may be called again for a
  round after another one; FinalizeBlock needs a prior commit check; add
  "before you upgrade" guidance, the metric and the own-commit log line;
  list THRESHOLD_RECOVER_RAW. Regenerate types.pb.go and api.md.
- CommitVerifyFailures help text covers own and block-sync commits; the
  metric is listed in docs/nodes/metrics.md.
- Handshake catch-up gives the same rollback hint whether the rejected
  block is replayed or applied by syncStateAt.
- Block sync labels the metric through the exported
  consensus.CommitVerifyFailureReason instead of a literal.
- Refresh stale comments in TryAddCommit, TryFinalizeCommit,
  selectParkedCommit, ApplyBlock and FinalizeBlock.

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

* fix(consensus): do not propose over a held future-round commit

A future-round commit whose block is held is verified, which runs
ProcessProposal for the commit's round, before the node enters that round.
If the node proposed that round, EnterPropose then replaced the processed
result with a PrepareProposal one, and applying the commit had to run
ProcessProposal for the same round again: an application that refuses an
immediate repeat (kvstore) failed it and mustEnsureProcess panicked, and
Drive would lose its execution context for the round.

EnterPropose now skips proposal creation while a commit for a held block
is about to be applied, as a non-proposer would.

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

* docs(consensus): explain the held future-commit rollback

Document why clearing stateData.Commit is the whole rollback when a
held future-round commit is rejected: the retarget done beforehand
keeps a held block, and can only drop a Proposal differing in state ID,
which the block check rejects anyway.

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

* fix(consensus): dedup queued commits only within the sender's own slot

A commit equal to one another peer had queued was dropped, so the authentic
commit could live only in an attacker's slot: the attacker parks a stripped
commit, queues the authentic one, then replaces its slot or disconnects and
the authentic commit is gone, stalling the height. A copy is now skipped only
when it equals the parked commit, which is always tried and cannot be
displaced, or the commit the same sender already queued. A copy of another
peer's commit is verified, charged to its sender and takes its own slot; the
verdict cache still keeps the application from judging a vector twice.

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

* fix(kvstore): re-execute a repeated ProcessProposal for the same block

Block sync can process a block, have the commit's extensions rejected and
hand over to consensus, which starts without that result and processes the
same block for the same round again. kvstore refused any immediate repeat of
a round, so the authentic commit could not be applied. Drive v4.1.1 drops its
context and re-executes on a repeat with the same block hash and errors only
for the same round with a different hash; kvstore, and so the e2e app, now
do the same, closing the replaced round state.

Document the contract on RequestProcessProposal (regenerated types.pb.go and
api.md), in the ABCI++ methods spec, UPGRADING and at ensureProcess; model
it in the consensus and block sync test executors. UPGRADING also describes
the per-sender commit dedup.

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

* docs(consensus): state why copies of the parked commit are skipped

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

* fix(consensus): bound commit-forced re-execution with ExtendVote expectations

A commit's extension list shape is signed by nothing beyond each entry's
own signature: order, count and duplication, a THRESHOLD_RECOVER entry's
sign request ID, and any app-supplied sign request ID (bound to no height
or round) can all vary under one genuine block signature. The 64-entry
verdict cache could therefore be outrun: a peer alternating fresh vectors
of two genuine rounds made the held block run ProcessProposal on every
delivery.

Replace the cache with per-height expectations keyed by (block, round),
learned from the application's ExtendVote after the first rejection at
that block and round (read-only; no ExtendVote on the happy path). A
commit that would need its block processed again for its round is refused,
without ProcessProposal or an ABCI call, when its vector differs from the
expected one or is the expected one and was rejected. Commits of the round
processed last still go to VerifyVoteExtension. Forced ProcessProposals per
height are bounded by 2*G plus the finalizing one, G being the foreign
rounds holding a block-signature-valid commit for the held block,
independent of peers and vectors.

Restore the application to the node's own round before verifying a peer
precommit's extensions and before ExtendVote on the relock path: a rejected
foreign-round commit left it on another round, where Drive fails
ExtendVote and Tenderdash panics.

Log sm.ErrCommitExtensionsRejected from peer commits at debug
(isPeerFloodableError); the rejection of the node's own commit stays at
Error.

Document the ExtendVote contract (side-effect free, returns exactly the
vector commit-level VerifyVoteExtension accepts, may run on any node) in
the ABCI spec, proto and UPGRADING.

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

* test(consensus): assert commit checks run in the commit round's context

The commit-checking executor now fails a commit-level VerifyVoteExtension
unless the application last processed the commit's block for its round, and
a FinalizeBlock whose round state or last ProcessProposal is for another
round. TestForeignRoundCommitsCannotForceReprocessing gets an ample
verification budget: it sends more commits than the rate-limited budget
admits on a slow run, and what it tests is the expectations bound.

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

* refactor(consensus): reuse processedFor for the round processed last

selectParkedCommit and ensureOwnRound restated processedFor's condition.
Also name the quorum hash among what commits with equal keys may differ in.

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

* docs(abci): refuse by expectation only commits needing re-processing

A commit of the round processed last still goes to the application, whatever
its vector; say so where the ExtendVote expectation is documented.

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

* perf(consensus): check the cheap conditions first in ensureOwnRound

It runs for every peer precommit; the block is hashed only once another round
was processed last.

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

* style(rpc): apply Go 1.27 gofmt to mempool.go

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

* Revert "style(rpc): apply Go 1.27 gofmt to mempool.go"

The gofmt run by golangci-lint in CI rejects the reindented block, so
restore the v1.8-dev formatting.

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

* fix(consensus): forget the processed round when ProcessProposal fails

A failed ProcessProposal left CurrentRoundState naming the round processed
before, while the application (Drive) may already have dropped that context.
A later commit for that round then skipped ProcessProposal, and a rejected
vector sent the node to ExtendVote on a missing context, which panics. The
stale state also made ensureOwnRound retry ProcessProposal for every resent
peer precommit.

ensureProcess now clears CurrentRoundState on failure, and
verifyCommitExtensions asks ExtendVote only while the block is known to be
processed for the commit's round.

The foreign-round flood test now interleaves peer precommits and pins the
exact ProcessProposal sequence, 2·G, in place of a bound that could not fail.

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

* docs(abci): state when ExtendVote serves as the commit oracle

ExtendVote is asked for a commit's expected vector only after a commit-level
VerifyVoteExtension rejection that follows ProcessProposal of that block and
round, and an invalid response is as fatal as an ABCI error. Say so in the
proto, api.md, the methods spec and UPGRADING, including the "When does
Tenderdash call it?" section, and stop calling the extension uninterpreted.

Restore the non-determinism allowance for extensions that are not
threshold-recoverable, consistently with the application requirements.

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

* docs(consensus): state why a cleared round state is safe to leave

Every reader of CurrentRoundState's fields runs right after a successful
ensureProcess. After a failure, ensureOwnRound lets a peer precommit reach
VerifyVoteExtension without a known context. That is not fatal, and Drive
checks only the height and rejects without an execution context.

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

---------

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

* chore: align PR template with TL;DR / user story / scenario structure (#1529)

Restructure the pull request template to lead with a plain-language
summary (TL;DR, user story, scenario) before the technical detailed
discussion. Drop the checklist section.

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

* chore(ci): run PR Hygiene's engine from master (#1528)

The caller pinned the shared engine to one commit, so every engine fix
needed a re-pin here before it took effect. The engine is now named by
`master` of dashpay/stale_prs_are_bad — the protected branch the review
policy is already read from — and the reusable workflow still requires
the commit it runs to be merged there (dashpay/stale_prs_are_bad#73).

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

* feat(mempool)!: return cached CheckTx rejection for resubmitted transactions (#1530)

* feat(mempool)!: return cached CheckTx rejection for resubmitted txs

With keep-invalid-txs-in-cache enabled, a rejected transaction stays in the
mempool cache, so resubmitting it over RPC returned "tx already exists in
cache" and hid the reason it was rejected.

The cache now keeps the rejecting CheckTx response (code, codespace, info,
data; at most 2048 bytes per entry) next to the transaction hash. A local
caller that resubmits such a transaction gets that response back instead of
ErrTxInCache. Peers, accepted transactions and committed transactions still
get ErrTxInCache.

BREAKING CHANGE: broadcast_tx, broadcast_tx_sync and broadcast_tx_commit
return the original CheckTx rejection instead of the "Tx already exists in
cache" error when a previously rejected transaction is resubmitted and
keep-invalid-txs-in-cache is true.

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

* fix(mempool): keep stale CheckTx rejections out of the cache

A CheckTx that the application rejected could record its rejection after
Update had already committed the same transaction, because no lock is held
between the ABCI call and addNewTransaction. The cache now marks committed
entries and ignores rejections for them.

A peer without a reserved mempool ID has SenderID 0, the same as a local
caller, so it took the replay path. Local callers are now also required to
have an empty SenderNodeID.

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

* fix(mempool): do not replay a rejection for a pending transaction

A pending transaction can lose its cache entry to LRU eviction, get checked
again on resubmission and be rejected, while the original stays in the
mempool. A later local submission then replayed that rejection. A
transaction found in the mempool now always returns ErrTxInCache.

Also document the RPC behavior change in UPGRADING.md.

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

---------

Co-authored-by: Lukasz Klimek <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* chore(deps): update Go to 1.27.2 and compatible tooling (#1545)

Align Go pins across CI, the BLS action, Dockerfiles and documentation,
including the vet workflow left on Go 1.26.6.

Pin golangci-lint v2.15.0 in CI, Makefile and go.mod, and update its
required module graph. Upgrade govulncheck to v1.9.0.

Upgrade both mockery pins to v3.8.1 for Go 1.27.2 export-data support
and regenerate mocks. The generated changes only mark mock constructors
and cleanup callbacks as test helpers; protobuf output is unchanged.

Validation: build, lint, vet, vulncheck, mock/protobuf generation and
selected race tests pass. One initial wall-clock load assertion failed;
the consensus package passes on retry and the isolated load test passes
10/10 runs on both Go 1.27.1 and Go 1.27.2.

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

Co-authored-by: Codex GPT-6 <[email protected]>

* build(deps): Bump super-linter/super-linter from 8.7.0 to 9.0.0 (#1533)

Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 8.7.0 to 9.0.0.
- [Release notes](https://github.com/super-linter/super-linter/releases)
- [Changelog](https://github.com/super-linter/super-linter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/super-linter/super-linter/compare/4ce20838b8ab83717e78138c5b3a1407148e0918...2da136927bd4a73596db63044b504547c62cb854)

---
updated-dependencies:
- dependency-name: super-linter/super-linter
  dependency-version: 9.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* build(deps): bump github.com/prometheus/common to 0.72.1 (#1542)

Update Prometheus common with parser/JSON improvements and request-header isolation. Upstream source, registry checksums and release notes audited; refreshed CI, diagnostic test retry and PR Hygiene passed.

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

* build(deps): Bump github.com/oasisprotocol/oasis-core/go (#1531)

Bumps [github.com/oasisprotocol/oasis-core/go](https://github.com/oasisprotocol/oasis-core) from 0.2601.0 to 0.2603.0.
- [Release notes](https://github.com/oasisprotocol/oasis-core/releases)
- [Changelog](https://github.com/oasisprotocol/oasis-core/blob/master/CHANGELOG.md)
- [Commits](https://github.com/oasisprotocol/oasis-core/compare/go/v0.2601.0...go/v0.2603.0)

---
updated-dependencies:
- dependency-name: github.com/oasisprotocol/oasis-core/go
  dependency-version: 0.2602.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>

* build(deps): bump github.com/moby/sys/user to 0.4.1 (#1544)

Update the transitive test dependency to fix CVE-2026-61801 and numeric identity validation. Upstream production changes, tags, registry origins and checksums audited; refreshed CI and PR Hygiene passed with owner approval.

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

* build(deps): bump github.com/prometheus/client_golang (#1538)

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.24.1 to 1.25.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.25.0/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.24.1...v1.25.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-version: 1.25.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>

* build(deps): Bump github.com/fxamacker/cbor/v2 from 2.9.4 to 2.9.6 (#1539)

Bumps [github.com/fxamacker/cbor/v2](https://github.com/fxamacker/cbor) from 2.9.4 to 2.9.6.
- [Release notes](https://github.com/fxamacker/cbor/releases)
- [Commits](https://github.com/fxamacker/cbor/compare/v2.9.4...v2.9.6)

---
updated-dependencies:
- dependency-name: github.com/fxamacker/cbor/v2
  dependency-version: 2.9.6
  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>

* fix(consensus)!: validate fresh block proposer before prevoting (#1527)

* fix(consensus): validate fresh block proposer before prevoting

Reject fresh proposals whose header names a validator other than the
scheduled round proposer before ProcessProposal. Preserve reproposals
with their original header and existing POL vote checks.

Cover predecessor capture, later rounds and valid or invalid POLs;
correct existing fixtures to use the proposing validator's identity.

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

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

* ci: upload encrypted Claudius review transcripts

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

---------

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

* build(deps): Bump actions/create-github-app-token from 3.2.0 to 3.3.0 (#1557)

Bumps [actions/create-github-app-token](https://github.com/actions/create-github-app-token) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Changelog](https://github.com/actions/create-github-app-token/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/create-github-app-token/compare/bcd2ba49218906704ab6c1aa796996da409d3eb1...64ab729a6294000f5aa4a4bc0b73d1f32bc45510)

---
updated-dependencies:
- dependency-name: actions/create-github-app-token
  dependency-version: 3.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>

* chore(deps): update Go to 1.27.3 (#1558)

Align the module, CI/BLS workflows, Docker images and documentation on
Go 1.27.3, including its crypto/x509 certificate distrust security fix.
Retain compatible tooling from the Go 1.27.2 update.

Validation: native BLS binary build, four-package race/deadlock tests,
pinned linter, workflow actionlint and unchanged mock generation pass.

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

Co-authored-by: Codex GPT-6 <[email protected]>

* fix(blocksync): keep healthy peers during slow local application (#1548)

* fix(blocksync): keep healthy peers during slow local application

Use request failures and existing deadlines to judge peer health. Remove the
byte-rate filter measured at application dequeue, which could exclude healthy
small-block peers permanently and hand sync over far below the chain tip.

Cover slow consumption, continued scheduling, and consensus handoff with a
deterministic regression. Preserve timeout retries, failure thresholds and
pending limits, and clarify the historical reactor documentation.

Fixes #1534

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

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

* test(blocksync): remove unused receive-rate clock override

Keep the synchronizer fake clock without mutating the unused flowrate global.

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

---------

Co-authored-by: OpenAI GPT-6 Astra <[email protected]>

* build(deps): Bump github.com/bufbuild/buf from 1.73.0 to 1.74.0 (#1556)

Bumps [github.com/bufbuild/buf](https://github.com/bufbuild/buf) from 1.73.0 to 1.74.0.
- [Release notes](https://github.com/bufbuild/buf/releases)
- [Changelog](https://github.com/bufbuild/buf/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bufbuild/buf/compare/v1.73.0...v1.74.0)

---
updated-dependencies:
- dependency-name: github.com/bufbuild/buf
  dependency-version: 1.74.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>

* fix(consensus): never extend a relock precommit without ProcessProposal for the round (#1523)

* fix(consensus): never extend a relock precommit without ProcessProposal for the round

A validator locked on block B that saw +2/3 prevotes for B in a later round r
precommitted B straight from the relock branch of enterPrecommit, calling
ExtendVote(B, r) without ProcessProposal for (B, r) ever having run. Dash Drive
only extends votes for the exact (height, round, hash) it last processed and
errors otherwise, and Tenderdash panics on that error. Two reachable paths:

- Different proposal: the polka for B arrives while the validator is still in
  round r-1 and skips it into round r (so the polka retarget does not run),
  then an equivocating proposer's block X completes. The last processed
  proposal is X@r.
- Same block, late proposal: the proposal for B misses timeoutPropose, the
  validator prevotes nil without processing it, and the polka for B arrives
  after the block completes. The last processed proposal is B@r' for an
  earlier round.

Relock now shares the lock path: it runs only when this round's proposal is
the locked block, and first ensures ProcessProposal ran for this round and
validates the block. When the polka is for the locked block but this round's
proposal is another block, the validator precommits nil and keeps its lock.
This follows Tendermint's rule (paper, line 36), which needs a PROPOSAL for v
in round r before precommitting v.

Safety: a nil precommit is always safe, the lock and LockedRound stay unchanged,
and nothing advances the round. Liveness: the nil path needs an equivocating
proposer, because honest validators prevote only the proposal they received.
Validators that did receive B still precommit it. At worst it costs one round,
and the next proposer re-proposes its valid block. Relock also updates
ValidBlock/ValidRound now, as the lock path already did.

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

* fix(consensus): keep ValidBlock untouched on relock

Relock no longer calls updateValidBlock, which keeps the diff to the relock
path minimal. The polka and the proposal block are both for this round, and
whichever arrived last has already made the block valid for this round:
addVoteUpdateValidBlockMw if the polka came last, ProposalCompletedAction if
the block did. The late-proposal regression test asserts ValidRound and
ValidBlock after relocking.

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

* fix(consensus): require complete proposal ID before relocking

Reject relock proposals whose full BlockID differs from the prevote polka,
even if their legacy block hashes match. Preserve the existing lock and
precommit nil before proposal processing can reject the altered chain lock.

Cover matching and mismatching proposals arriving after the polka, including
same-hash blocks and ValidBlock updates on successful relock.

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

* test(consensus): subscribe to relock proposal timeout after round zero

Subscribe after the round-zero precommit so an earlier propose timeout cannot
remain queued for the round-one assertion.

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

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

* fix(consensus): bind relocks and processing to complete block identities

Remember the complete BlockID behind successful ProcessProposal results so
same-output replacement proposals cannot reuse another block's context.
Use the complete identity for prevotes, locks and valid-block updates.

Cover same-round replacement before ExtendVote, same-hash identities,
part-set replacements, legitimate cached reuse and both relock arrival orders.

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

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

---------

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

* fix(consensus): propose a freshly built block without POL round (#1564)

* test(consensus): reproduce fresh proposal block carrying ValidRound as POLRound

When the held ValidBlock is untimely, Proposaler.Create builds a fresh
block but still signs the proposal with POLRound = rs.ValidRound. The
POL round then vouches for a polka on a different block, so receivers
prevote nil and the round is wasted.

The new test asserts the correct behaviour (POLRound == -1 for a fresh
block) and fails on current code: expected -1, actual 0.

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

* fix(consensus): propose a freshly built block without POL round

When the held ValidBlock is no longer usable (untimely, or at the initial
height not dated at genesis time), Proposaler.Create builds a new block but
still signed the proposal with POLRound = rs.ValidRound. Receivers check the
polka at POLRound against the proposed block; that polka is for the old
ValidBlock, so every validator - the proposer included - prevoted nil and
the round was wasted.

A freshly built block has no polka behind it, so it is now proposed with
POLRound = -1. ValidRound is used only when ValidBlock itself is
re-proposed.

TestDecide case #0 pinned the old behaviour (nil ValidBlock, stale
ValidRound 0, expected POLRound 0) and now expects -1. A new state-machine
test, TestProposeNewBlockOverUntimelyValidBlock, drives a node holding an
untimely, unlocked valid block to its proposer round and checks it prevotes
its own fresh block instead of nil.

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

---------

Co-authored-by: Lukasz Klimek <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* chore(ci): migrate proto lint to buf-action and take buf version from go.mod (#1561)

* chore(ci): migrate proto lint to buf-action and take buf version from go.mod

bufbuild/buf-setup-action and bufbuild/buf-lint-action are archived and
deprecated in favor of bufbuild/buf-action. The workflow also pinned buf
1.59.0 while `make proto-*` and check-generated use the version from
go.mod, so CI linted with a different buf than developers.

Read the buf version from go.mod, run only the lint step of buf-action,
and also trigger on buf.yaml/buf.lock/go.mod changes so buf bumps are
linted.

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

* chore(ci): run proto lint when its workflow changes

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

---------

Co-authored-by: Lukasz Klimek <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(blocksync): schedule peers by active response service (#1549)

* fix(blocksync): keep healthy peers during slow local application

Use request failures and existing deadlines to judge peer health. Remove the
byte-rate filter measured at application dequeue, which could exclude healthy
small-block peers permanently and hand sync over far below the chain tip.

Cover slow consumption, continued scheduling, and consensus handoff with a
deterministic regression. Preserve timeout retries, failure thresholds and
pending limits, and clarify the historical reactor documentation.

Fixes #1534

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

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

* test(blocksync): remove unused receive-rate clock override

Keep the synchronizer fake clock without mutating the unused flowrate global.

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

* fix(blocksync): schedule peers by active response service

Measure the union of client-admitted unanswered requests, credit validated
blocks and bytes before result buffering, and use bounded cooldown probes to
reduce sustained slow service without disconnecting or hiding available heights.

Settle observations once across early replies, cancellation and timeout, and
register requests before publishing them to avoid losing an early response.
Keep existing hard deadlines, failure handling and backlog limits.

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

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

---------

Co-authored-by: OpenAI GPT-6 Astra <[email protected]>

* feat(evidence)!: follow live chain evidence settings (#1547)

* feat(evidence)!: disable evidence on zero-byte chains

Derive evidence wiring from persisted consensus state or genesis. Use a
stateless disabled pool, omit the evidence database/reactor/channel, and
return an explicit disabled error from evidence submissions.

Reject zero/positive mode transitions in shared consensus updates and in
state-sync snapshot validation before chunk application. Cover startup,
persisted restart, RPC, block validity, and enabled-mode compatibility.

BREAKING CHANGE: InitChain and proposal consensus updates cannot switch
evidence.max_bytes between zero and positive.

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

* fix(evidence): support consensus-driven runtime mode changes

Keep evidence wiring available across live consensus parameter updates while
making disabled admission, conflict collection and gossip inexpensive. Preserve
block validation and committed markers, restore pool state after state sync,
and serialize pool operations with transitions and database shutdown.

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

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

* refactor(evidence): separate buffer and state lock ownership

Protect the consensus buffer exclusively with the operation mutex and keep
state snapshots responsive during buffered evidence processing. Preserve
operation serialization through admission, transitions and shutdown.

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

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

* fix(node): skip evidence pool update when state sync falls back without a snapshot

The post-state-sync hook also runs on the errNoSnapshots fallback, which
hands over the unchanged local state OnStart already gave the evidence
pool. Pool.Update panics on a non-advancing height (0 <= 0 on a fresh
node), so a state-sync node finding no snapshots crashed instead of
falling back to block sync. Update the pool only when the handoff
advances its height, and extract the hook so the fallback is covered by
a regression test.

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

* fix(evidence): flush buffered conflicting votes before disabling evidence

Conflicting votes accepted by ReportConflictingVotes during the last
enabled height wait in the consensus buffer for that height's finalized
state. When the height's commit disabled evidence, Update cleared the
buffer without processing it, permanently losing those proofs. Process
the buffer with the finalized state on the enabled-to-disabled
transition, while conflicts reported once disabled stay rejected.

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

---------

Co-authored-by: GPT-6.1 Codex <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(service)!: share worker lifecycle for consensus shutdown (#1513)

* fix(consensus): wait for receive routine during shutdown

Join the receive routine before State.Wait returns and cancel its context
on explicit Stop. This prevents node cleanup racing in-flight consensus
file writes. Add a regression test for the shutdown contract.

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

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

* fix(service)!: share worker lifecycle for consensus shutdown

Port the focused lifecycle core from #1515, replacing the local State wait workaround while retaining other service ownership mechanisms.

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

* fix(consensus): preserve in-flight work during manual shutdown

Keep processing on the State parent's lifetime while canceling intake, and
let handoff callers cancel their wait without abandoning reactor-owned work.
Document the global cancellation contract, cleanup ownership and migration
boundaries; harden context lookup and close logjack's group on return.

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

* fix(cli): wait for node shutdown with a bounded grace period

Join node cleanup after cancellation with a configurable shutdown deadline.
Return an error on timeout without bypassing service joins or store ordering.
Organize BaseService startup into lock-scoped lifecycle phases.

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

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

* fix(service): cancel the attempt before deferred shutdown hooks

Stop during startup publishes the stop request, releases the lifecycle
lock and only then cancels the attempt context. If OnStart returned in
that window, Start ran OnStop on a still-live context, breaking the
cancellation-before-OnStop contract. finishStop now cancels first;
cancellation is idempotent.

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

* fix(blocksync): join the synchronizer drain before reactor shutdown completes

On node cancellation the Synchronizer's own stop can win the race and
block in OnStop until in-flight block application returns. The reactor's
Stop call then returned immediately, so reactor Wait could release store
teardown while Apply was still running. The reactor now waits for the
Synchronizer after stopping it.

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

* fix(blocksync): join the synchronizer regardless of the sync flag

poolRoutine clears blockSyncFlag after a Stop that returns early when
the synchronizer's own cancellation-driven stop is still draining, so a
flag-gated join in reactor OnStop could be skipped and reactor Wait
could release store teardown before the consumer finished. OnStop now
stops and waits for any constructed synchronizer; both calls are no-ops
for one that never started. The regression now also runs poolRoutine
through the handover before reactor shutdown.

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

* fix(privval): make the signer's initial connect request cancellation-aware

SignerListenerEndpoint.OnStart sent its first connection request on an
unbuffered channel unconditionally. With Stop now cancelling OnStart's
context, serviceLoop can exit on ctx.Done before taking the request,
leaving Start blocked forever and OnStop never run. The send now also
selects on ctx.Done and returns nil, so the regular shutdown path still
releases the listener and ping ticker.

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

* test(consensus): close the unstarted WAL group in TestWALSearchForEndHeight

OpenGroup detaches the head AutoFile worker from the caller's context,
so the never-started WAL leaked its timer/SIGHUP worker. Register the
group's Close as cleanup and take the leak snapshot at test start so
the check covers the WAL's lifetime.

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

* fix(service): reject canceled contexts at worker admission

Parent cancellation closes the attempt context before the async watcher
takes the lifecycle lock and publishes stopping. In that window Go still
admitted work, e.g. a consensus handoff that could reach State.Start
during shutdown. Go now also refuses a canceled ctx under the lock.

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

---------

Co-authored-by: OpenAI GPT-6 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(abci): reject DEFAULT vote extensions returned by ExtendVote (#1565)

VoteExtension.Validate rejects the DEFAULT type and MakeQuorumSigns signs
only threshold-recoverable extensions, but NewVoteExtensionsFromABCIExtended
accepted DEFAULT. The vote then reached the signer with more extensions than
sign items: FilePV indexed past the signature list and panicked, and the
DashCore signer wrote signatures into the wrong extensions.

Reject DEFAULT when converting the application's ExtendVote response, so
BlockExecutor.ExtendVote fails with a clear error before signing.


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

Co-authored-by: Lukasz Klimek <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* refactor(db)!: own GoLevelDB and memory database adapters (#1551) (#1566)

* refactor(db)!: own GoLevelDB and memory database adapters

Retain the GoLevelDB, MemDB and PrefixDB adapters from cometbft-db v1.0.4
under libs/db, with their license, provenance and contract tests. Upstream
plans to retire the shared wrapper and discourages new dependencies on it.

Preserve engine versions, persistence behavior, node configuration and SQL
indexing while removing unused backend registrations and dependencies.
Verify old-to-local-to-old persisted data compatibility and storage race tests.

BREAKING CHANGE: exported DB APIs now use Tenderdash's libs/db interfaces;
custom providers must update imports or adapt their Batch/Iterator return types.

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

* fix(db): retain upstream attribution and modification notices

Mark the eight modified upstream files and preserve cometbft-db's tm-db
ancestry while retaining the original Apache license verbatim.

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

* fix(db): release debug iterators and characterize empty values

Release the GoLevelDB Print iterator before returning. Replace the skipped
empty-value check with explicit backend Get/Has expectations and document
the inherited difference tracked in issue #1554.

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

---------

Backport of #1551 (cherry picked from commit cb7c8e8ee36df450c2264599658b5b0969e0d6c8)
to v1.8-dev. Also point the v1.8-dev-only evidence, consensus and node
tests at libs/db, and keep go.mod/go.sum at the v1.8-dev versions.

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

* refactor(indexer)!: remove PostgreSQL event sink (#1553)

* refactor(db)!: own GoLevelDB and memory database adapters

Retain the GoLevelDB, MemDB and PrefixDB adapters from cometbft-db v1.0.4
under libs/db, with their license, provenance and contract tests. Upstream
plans to retire the shared wrapper and discourages new dependencies on it.

Preserve engine versions, persistence behavior, node configuration and SQL
indexing while removing unused backend registrations and dependencies.
Verify old-to-local-to-old persisted data compatibility and storage race tests.

BREAKING CHANGE: exported DB APIs now use Tenderdash's libs/db interfaces;
custom providers must update imports or adapt their Batch/Iterator return types.

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

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

* refactor(indexer)!: remove PostgreSQL event indexing

Remove the optional SQL event sink, configuration field, reindex selection,
driver registration and Docker-dependent test infrastructure. Validate all
selectors before opening sinks, preserving KV/null behavior and accepting
Dashmate's unused legacy psql-conn key through the existing config parser.

Keep KV event-bus indexing and search coverage runnable without Docker, and
remove unused SQL dependencies. Existing PostgreSQL data is untouched.

Depends on #1551; this branch is stacked on refactor/local-db.

BREAKING CHANGE: psql event export and TxIndexConfig.PsqlConn are removed.
Operators must explicitly select kv or null; SQL consumers need another
export path. There is no automatic migration or silent fallback.

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

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

* fix(db): retain upstream attribution and modification notices

Mark the eight modified upstream files and preserve cometbft-db's tm-db
ancestry while retaining the original Apache license verbatim.

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

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

* fix(db): release debug iterators and characterize empty values

Release the GoLevelDB Print iterator before returning. Replace the skipped
empty-value check with explicit backend Get/Has expectations and document
the inherited difference tracked in issue #1554.

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

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

* refactor(db)!: own GoLevelDB and memory database adapters (#1551)

* refactor(db)!: own GoLevelDB and memory database adapters

Retain the GoLevelDB, MemDB and PrefixDB adapters from cometbft-db v1.0.4
under libs/db, with their license, provenance and contract tests. Upstream
plans to retire the shared wrapper and discourages new dependencies on it.

Preserve engine versions, persistence behavior, node configuration and SQL
indexing while removing unused backend registrations and dependencies.
Verify old-to-local-to-old persisted data compatibility and storage race tests.

BREAKING CHANGE: exported DB APIs now use Tenderdash's libs/db interfaces;
custom providers must update imports or adapt their Batch/Iterator return types.

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

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

* fix(db): retain upstream attribution and modification notices

Mark the eight modified upstream files and preserve cometbft-db's tm-db
ancestry while retaining the original Apache license verbatim.

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

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

* fix(db): release debug iterators and characterize empty values

Release the GoLevelDB Print iterator before returning. Replace the skipped
empty-value check with explicit backend Get/Has expectations and document
the inherited difference tracked in issue #1554.

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

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

---------

Co-authored-by: Codex GPT-6 <[email protected]>
Co-authored-by: Claude GPT-6 <[email protected]>

---------

Co-authored-by: Codex GPT-6 <[email protected]>
Co-authored-by: Claude GPT-6 <[email protected]>

* docs(consensus): add source-derived consensus protocol specification (#1562)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Lukasz Klimek <[email protected]>

* build(deps): Bump docker/login-action from 4.6.0 to 4.7.0 (#1571)

Bumps [docker/login-action](https://github.com/docker/login-action) from 4.6.0 to 4.7.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v4.6.0...v4.7.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 4.7.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>

* build(deps): Bump google.golang.org/grpc from 1.83.2 to 1.85.0 (#1580)

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.83.2 to 1.85.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.83.2...v1.85.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-version: 1.85.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>

* build(deps): Bump github.com/prometheus/common from 0.72.1 to 0.73.1 (#1581)

Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.72.1 to 0.73.1.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/common/compare/v0.72.1...v0.73.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-version: 0.73.1
  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>

* build(deps): Bump github.com/bufbuild/buf from 1.74.0 to 1.75.0 (#1570)

Bumps [github.com/bufbuild/buf](https://github.com/bufbuild/buf) from 1.74.0 to 1.75.0.
- [Release notes](https://github.com/bufbuild/buf/releases)
- [Changelog](https://github.com/bufbuild/buf/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bufbuild/buf/compare/v1.74.0...v1.75.0)

---
updated-dependencies:
- dependency-name: github.com/bufbuild/buf
  dependency-version: 1.75.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>

* build(deps): Bump github.com/fxamacker/cbor/v2 from 2.9.6 to 2.10.0 (#1579)

Bumps [github.com/fxamacker/cbor/v2](https://github.com/fxamacker/cbor) from 2.9.6 to 2.10.0.
- [Release notes](https://github.com/fxamacker/cbor/releases)
- [Commits](https://github.com/fxamacker/cbor/compare/v2.9.6...v2.10.0)

---
updated-dependencies:
- dependency-name: github.com/fxamacker/cbor/v2
  dependency-version: 2.10.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>

* ci(docker): pin actions to commit SHAs and restrict token permissions (#1589)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-au…
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.

3 participants