Skip to content

fix(consensus): preserve catch-up allowance for rejected votes - #1479

Merged
lklimek merged 3 commits into
v1.8-devfrom
fix/verify-catchup-vote-before-slot
Sep 21, 2026
Merged

lklimek merged 3 commits into
v1.8-devfrom
fix/verify-catchup-vote-before-slot

Conversation

@lklimek

@lklimek lklimek commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

TL;DR: Rejected future-round votes no longer consume the allowance needed for a validator's later valid catch-up vote.

User story

As a validator operator, I want catch-up capacity to be charged only for admitted votes, to achieve reliable consensus recovery when peers relay malformed votes.

Scenario

Base flow

A lagging node receives future-round votes naming a validator while trying to catch up with consensus.

Actual behavior

Two votes that fail signature or proof verification can consume that validator's two-round allowance. A later valid vote for another future round is then rejected as unwanted.

Expected behavior

Rejected votes leave no round or allowance entry. Successfully admitted votes retain the existing two-round limit.

Detailed discussion

Issue being fixed or feature implemented

HeightVoteSet.addVote permanently created a catch-up round and charged the claimed validator before the vote's signature, verification budget, or proof was accepted.

What was done?

  • New catch-up rounds remain provisional under the existing height vote set lock.
  • The existing vote verification and insertion path still runs exactly once.
  • A provisional round and its allowance entry are retained only when the first vote is actually added.
  • Rejection removes only the newly created provisional round; existing rounds and votes remain unchanged.
  • The two-round quota, errors, verification budgets, public APIs, and wire behavior remain unchanged.

How Has This Been Tested?

Regression tests first demonstrated allowance consumption after invalid signatures, denied verification budgets, and mismatched proofs. Focused coverage now includes both prevotes and precommits, valid verified votes, existing-round preservation, the two-round ceiling, concurrent admission, and the consensus action path.

go test -race -tags=deadlock -p 1 ./internal/consensus/types ./internal/consensus -run 'TestHeightVoteSet|TestPeerCatchupRounds|TestPoC_HeightVoteSet|TestAddVote' -count=1

The focused golangci-lint v2.13.2 run reported zero new issues, and git diff --check passed.

Breaking Changes

None. This changes only accounting for votes that were rejected and never admitted.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation — no public API or configuration changed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Co-authored by Claudius the Magnificent AI Agent

Retain a provisional catch-up round and charge its validator's allowance
only after its first vote is admitted. Preserve the existing verification
paths, error results and two-round quota under the height vote set lock.

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

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

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

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

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 681cf253-bd84-4d70-9384-845649d5b259

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

❤️ Share

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

@thepastaclaw

thepastaclaw commented Sep 16, 2026 •

Copy link
Copy Markdown

✅ Final review complete — no blockers (commit 1207045) · triage: low · Phase 2 only (queue backlog)

@lklimek
lklimek marked this pull request as ready for review September 17, 2026 06:42
@lklimek
lklimek requested a review from shumkov as a code owner September 17, 2026 06:42
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

PR Hygiene

State: ready-to-merge · commit 1207045fa4a1907c959ba6a28039afb67522916a

  • All policy requirements are satisfied

Self-review is an author attestation that you have read the diff:
/self-reviewed — covers everything pushed so far; post it again after a new push.

This check passes when the policy is satisfied; the repository decides whether merging requires it.

@github-actions

Copy link
Copy Markdown

@thepastaclaw review

No review for 9dab1662 yet, so PR Hygiene is asking once. If nothing arrives, the requirement is dropped for this commit and the pull request is labelled bot-review-missed.

@github-actions

Copy link
Copy Markdown

@thepastaclaw review

No review for 1207045f yet, so PR Hygiene is asking once. If nothing arrives, the requirement is dropped for this commit and the pull request is labelled bot-review-missed.

@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 2 only (queue backlog)

Verified the changes at 1207045; no actionable in-scope defects were found. Newly allocated catch-up rounds remain provisional under the existing lock, rejected votes leave no retained round or allowance entry, and successful admission preserves the two-round quota and existing verification paths. Focused tests for both consensus packages passed with CGO/BLS, the race detector, and the deadlock build tag; git diff --check passed and the worktree remains clean.

Review provenance

Source: reviewer 1: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6-astra (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)

  • Triage: low by gpt-6-astra (effort low) — The production change is a small, contained update to HeightVoteSet.addVote that retains catch-up rounds and charges allowance only after successful admission under the existing lock, without changing verification logic or consensus rules, and the remaining changes are regression tests.
  • Phase 1 reviewers: not run (skipped for throughput: 22 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6-astra — final-verifier; agent astra-verifier
  • Phase 2 reviewers: gpt-6-astra — general (completed, effort medium); agent phase2-reviewer, gpt-6-astra — tenderdash-consensus-security (completed, effort medium); agent phase2-reviewer

@github-actions github-actions Bot added the waiting-self-review Waiting for the author to post /self-reviewed label Sep 20, 2026
@lklimek

lklimek commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator Author

/self-reviewed

@github-actions github-actions Bot added ready-to-merge and removed waiting-self-review Waiting for the author to post /self-reviewed labels Sep 21, 2026
@lklimek
lklimek merged commit 3eb3a23 into v1.8-dev Sep 21, 2026
21 checks passed
@lklimek
lklimek deleted the fix/verify-catchup-vote-before-slot branch September 21, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants