Skip to content

fix(types): validate quorum threshold against canonical LLMQ type (#1314) - #1328

Merged
lklimek merged 13 commits into
v1.6-devfrom
fix/valset-validate-quorum-type-aware
Jun 12, 2026
Merged

lklimek merged 13 commits into
v1.6-devfrom
fix/valset-validate-quorum-type-aware

Conversation

@lklimek

@lklimek lklimek commented Jun 9, 2026 •

Copy link
Copy Markdown
Collaborator

Why this PR exists

  • Problem: Since v1.5.0, ValidatorSet.ValidateBasic() rejects a legitimate 8-of-12 llmq_devnet_platform quorum. The threshold (8×100 = 800) is exactly 2/3 of total power (1200), but the default branch requires >(2/3)+1 = 801, so the node restart-loops on replay.
  • What breaks without it: A devnet/platform node handed the quorum Dash Core actually forms (8-of-12) never starts — error on replay: validator set updates: voting threshold 800 of quorum with power 1200 MUST be at least 2/3*1200+1 = 801.
  • Relationship: Alternative to fix(types): don't reject valid Platform quorums (8-of-12) in ValidateBasic #1315. fix(types): don't reject valid Platform quorums (8-of-12) in ValidateBasic #1315 fixes the symptom by deleting the entire threshold switch, which also removes the lower-bound floor — letting an unknown/custom quorum with a sub-2/3 (or near-zero) threshold pass ValidateBasic and then finalize blocks at that threshold (the value feeds the live commit gate in vote_set.go, where crossing it recovers the BLS threshold signature that is the commit). This PR fixes the bug while keeping that floor where BFT safety needs it.

Issue being fixed or feature implemented

Fixes #1314.

The rigid size-based threshold rule contradicts both the canonical LLMQ quorum definitions (Dash Core forms DEVNET_PLATFORM as 8-of-12) and the field's own proto contract, which states the threshold "is determined based on the LLMQ quorum type defined for the network, with a fall back to 2/3 + 1".

What was done?

Replaced the rigid switch len(vals.Validators) threshold check with type-aware validation:

  1. Explicit override — voting_power_threshold set (>0): accept any 0 < t ≤ total. The operator/dev escape hatch from feat: allow defining validator power threshold in consensus params #1052, recorded on-chain for accountability; the operator owns any reduced safety margin.
  2. Recognized LLMQ type (param unset): require the threshold to equal the quorum type's canonical threshold — trusts Dash Core's definition and accepts DEVNET_PLATFORM 8-of-12.
  3. Unknown/custom type: keep the strict size-based floor (==total for 1–2; ≥2/3 for 3; >(2/3)+1 for 4+) — preserves production safety where there is no canonical definition to trust.

Added a startup / consensus-param-change warning (internal/consensus/state_data.go) via the new ValidatorSet.BelowStrictThreshold() helper: whenever the active voting threshold sits below the strict 2/3+1 BFT bound — a dev/test quorum such as 8-of-12, or a deliberately-lowered voting_power_threshold — the node logs a Warn. Visibility without rejection; log-only, no state/determinism impact, no per-block spam (fires only at start and on quorum/threshold change).

Docs: documented voting_power_threshold in spec/core/data_structures.md (previously undocumented) and corrected the proto comment; added a CHANGELOG entry.

ValidateBasic is a local, non-hashed gate (absent from ToProto), so this is not consensus-breaking and needs no ABCI bump. The change only loosens validation (recognized + dev/test quorums) — apart from a defensive canonical-mismatch guard — so it cannot reject a validator set that previously passed.

How Has This Been Tested?

  • make build (BLS + binary) and go test ./types/... ./internal/consensus/... — green.
  • New table-driven tests: DEVNET_PLATFORM 8/12 accepted; recognized production type 100_67 accepted and 50_60 accepted at canonical; unknown-type threshold 800 rejected / 801 accepted; explicit override accepted; BelowStrictThreshold boundary cases (8/12 → true, 100_67 → false, override 800 → true, 900 → false).
  • gofmt -s, golangci-lint (0 new issues), and make proto-gen (no diff — the proto comment edit is a codegen no-op) all clean.

Breaking Changes

None. ValidateBasic is a local, non-hashed validation gate — no wire/ABCI change, no version bump. The change relaxes validation for recognized and dev/test quorums and retains the strict floor for unknown types.

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

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Co-authored by Claudius the Magnificent AI Agent

Summary by CodeRabbit

  • Bug Fixes

    • Validator voting-threshold validation now follows quorum-type definitions with an explicit override path; validator-set updates also trigger when thresholds change and logging warns if thresholds fall below strict safety bounds.
  • Documentation

    • Expanded validator parameter docs describing threshold semantics, override behavior, canonical vs unknown quorum handling, and validation rules.
  • Tests

    • Added end-to-end and unit tests covering quorum-type behavior, override semantics, strict-floor enforcement, threshold-change handling, and copy-preservation.

lklimek and others added 4 commits June 9, 2026 17:32
ValidatorSet.ValidateBasic enforced a rigid size-based 2/3+1 voting-power
floor that wrongly rejected legitimate dev/test quorums whose canonical
threshold sits at or below 2/3 -- notably llmq_devnet_platform (8-of-12,
exactly 2/3), breaking DEVNET_PLATFORM networks.

Replace the rigid switch with a quorum-type-aware decision:
  1. Reject impossible thresholds (non-positive, or above total power).
  2. If VotingPowerThreshold is explicitly set, trust it (the #1052
     single-node/dev escape hatch).
  3. Otherwise the threshold derives from the quorum type:
     - recognized type: it MUST equal the canonical type definition;
     - unknown/custom type: keep the strict size-based 2/3 production
       floor, since we have no canonical definition to trust.

This loosens validation for recognized dev/test types while preserving
the strict floor exactly where BFT safety demands it (unknown types).
ValidateBasic is a local gate (not hashed, not in ToProto), so this
cannot fork a running chain.

Add the isDevOrTestQuorum classifier and table-driven tests covering the
DEVNET_PLATFORM fix, explicit override, and strict-floor branches.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Polish pass on the #1314 quorum-type-aware ValidateBasic change following QA:

- Remove the dead isDevOrTestQuorum classifier and its test. The dev/test
  distinction only mattered for an operator warning, but ValidateBasic is a
  pure domain method with no reachable logger; wiring one in would mean
  invasive plumbing (logger field / signature change / package global) into
  types/, a pure types package. The reduced-margin caveat belongs in operator
  docs instead. No dead code, no unfulfilled TODO markers.
- Document the recognized-type canonical-mismatch guard as defense-in-depth:
  it is unreachable when the threshold derives from the type (param unset),
  and exists for future callers that set the threshold independently.
- Add recognized PRODUCTION type coverage (100_67 above 2/3, 50_60 below 2/3
  accepted as canonical) so production types are proven to validate through
  the recognized-type branch.
- Make each test's quorum type explicit and fix misleading comments that
  relied on the LLMQType_5_60 == LLMQType_TEST alias coincidence.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…r_threshold override

Update ValidatorParams documentation in params.proto and spec/core/data_structures.md
to accurately describe the type-aware threshold validation introduced by the fix for
issue #1314 (DEVNET_PLATFORM 8-of-12 rejection):
- recognized LLMQ types use their canonical threshold (fixes #1314)
- unknown/custom types fall back to the strict >2/3 size-based floor
- explicit operator overrides (from #1052) accept any value in (0, totalPower]

Adds operator guidance on the footgun: the override path has no 2/3 floor, so
values below 2/3 of total power reduce BFT safety and should only be used in
controlled dev/test environments.

Note: make proto-gen must be run to sync params.pb.go from the updated .proto.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…1314)

Quorums whose voting threshold sits at or below the strict 2/3+1 bound are
accepted (DEVNET_PLATFORM 8/12, or an explicit operator VotingPowerThreshold
override), but operators got no signal that fault tolerance was reduced.

Emit a one-shot Warn at the consensus lifecycle layer (updateToState), where
the validator set is installed at start and on quorum/valset change. The
trigger is broadened to also fire on a VotingPowerThreshold-only consensus-
param change (same QuorumHash), so a lowered override is never silent. The
log fires only when the active set actually changes, never per block.

ValidateBasic stays pure: the warning lives in the lifecycle layer, not the
validation method. Add ValidatorSet.BelowStrictThreshold reusing the exact
(totalPower*2)/3+1 floor from validateThreshold, with unit tests.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@lklimek, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 36 minutes and 19 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 559004e2-e107-431b-89df-717735c31445

📥 Commits

Reviewing files that changed from the base of the PR and between 8b9bef7 and fc75808.

📒 Files selected for processing (4)
  • internal/state/current_round_state.go
  • internal/state/current_round_state_test.go
  • types/validator_set.go
  • types/validator_set_test.go
📝 Walkthrough

Walkthrough

This PR refactors validator-set quorum threshold validation to consult canonical LLMQ type definitions and honor explicit VotingPowerThreshold overrides, adds a strict-floor helper and exported query methods, monitors threshold changes in consensus state, updates docs/proto/spec for voting_power_threshold semantics, and expands test coverage.

Changes

Quorum Threshold Validation and Monitoring

Layer / File(s) Summary
Threshold validation refactoring
types/validator_set.go
ValidateBasic delegates to new validateThreshold() helper that honors explicit VotingPowerThreshold overrides, consults llmq.QuorumParams for canonical thresholds, enforces strict floors for unknown types via validateStrictFloor(), and exposes StrictVotingPowerFloor() and BelowStrictThreshold(); Copy() now preserves VotingPowerThreshold.
Threshold validation test coverage
types/validator_set_test.go
Adds end-to-end and white-box tests covering canonical quorum thresholds, explicit override behavior and precedence, strict-floor fallback for unknown quorum types, validateStrictFloor() boundaries, BelowStrictThreshold() outcomes, and Copy() preserving the override.
Validator state monitoring integration
internal/consensus/state_data.go
updateToState() triggers validator updates when VotingPowerThreshold differs (in addition to QuorumHash) and logs warnings when the new threshold is below the strict 2/3+1 BFT safety bound, including quorum type, threshold, total power, and computed strict floor.
Documentation and changelog
proto/tendermint/types/params.proto, spec/core/data_structures.md, CHANGELOG.md
Proto comments and spec updated to document voting_power_threshold semantics (explicit override vs unset canonical derivation vs unknown-type strict floors); changelog records the bugfix addressing regressions for dev/test quorums.

🎯 3 (Moderate) | ⏱️ ~25 minutes

"I hopped through logs and code so tight,
I nudged the thresholds back to right,
Dev nets hum and tests all cheer,
Nodes start up without the fear —
🐇✨"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(types): validate quorum threshold against canonical LLMQ type (#1314)' accurately and concisely summarizes the main change: fixing ValidatorSet validation to check quorum thresholds against canonical LLMQ type definitions rather than a rigid size-based floor.
Linked Issues check ✅ Passed The pull request fully implements all primary coding objectives from issue #1314: type-aware threshold validation with operator override support, strict floor enforcement for unknown types, canonical threshold matching for recognized types, logging warnings below strict threshold, and comprehensive test coverage.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #1314: validator threshold validation logic, related documentation updates (proto comments, spec), test coverage, and changelog entry. No unrelated changes were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/valset-validate-quorum-type-aware

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 and usage tips.

@lklimek
lklimek marked this pull request as ready for review June 10, 2026 14:06
@lklimek
lklimek requested a review from QuantumExplorer as a code owner June 10, 2026 14:06
@lklimek
lklimek requested a review from Copilot June 10, 2026 14:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a regression in ValidatorSet.ValidateBasic() where legitimate Dash LLMQ quorums (notably llmq_devnet_platform 8-of-12) were rejected due to an overly rigid > 2/3 + 1 threshold rule. The update makes threshold validation quorum-type-aware (canonical thresholds for recognized LLMQ types, strict floor for unknown types, and an explicit operator override path), and adds a startup/param-change warning when operating below the strict 2/3+1 BFT bound.

Changes:

  • Reworked validator-set threshold validation to use canonical LLMQ quorum definitions when the quorum type is recognized, while preserving a strict safety floor for unknown/custom types.
  • Added BelowStrictThreshold() and a warning in consensus state initialization/update when the active threshold is below the strict 2/3+1 bound.
  • Added unit tests plus documentation/proto comment updates and a changelog entry.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
types/validator_set.go Introduces type-aware threshold validation and BelowStrictThreshold() helper.
types/validator_set_test.go Adds table-driven coverage for threshold validation branches and BelowStrictThreshold().
internal/consensus/state_data.go Logs a warning when the validator set’s effective threshold is below the strict 2/3+1 bound (on startup / validator updates).
spec/core/data_structures.md Documents voting_power_threshold behavior and validation rules.
proto/tendermint/types/params.proto Updates the field comment for voting_power_threshold to match the new validation semantics.
CHANGELOG.md Adds an Unreleased bug-fix entry describing the validation change.

Comment thread types/validator_set.go Resolved
Comment thread types/validator_set.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/consensus/state_data.go`:
- Around line 275-279: The warning currently recomputes the strict-floor with
(validators.TotalVotingPower()*2)/3+1 which can diverge from the canonical logic
used by BelowStrictThreshold(); replace that inline formula with the canonical
strict-floor value used by BelowStrictThreshold() by calling the same
helper/selector used there (e.g., the
validators.Strict.../StrictThreshold/StrictVotingPower function that
BelowStrictThreshold() relies on) and pass that result as "strict_floor" so the
logger and BelowStrictThreshold() report the identical threshold.

In `@types/validator_set.go`:
- Around line 501-503: ValidatorSet.Copy() currently omits the
VotingPowerThreshold field so clones lose any explicit threshold override,
changing behavior of methods like BelowStrictThreshold() and
QuorumVotingThresholdPower(); update ValidatorSet.Copy() to copy the
VotingPowerThreshold (and any related threshold fields) from the receiver into
the new ValidatorSet instance so cloned sets preserve the effective voting
threshold and semantics.
- Around line 203-218: The code only enforces the canonical threshold from
llmq.QuorumParams(vals.QuorumType) but not the canonical member count, allowing
non-canonical sizes (e.g., DEVNET_PLATFORM labeled sets with 20 validators) to
pass; after calling llmq.QuorumParams and before accepting the canonical
threshold, compute the expected total voting power from the returned canonical
member count (e.g., wantTotalPower := int64(typeMembers) *
DefaultDashVotingPower where typeMembers is the first return from
llmq.QuorumParams) and validate that totalPower equals wantTotalPower, returning
an error if it does not; keep the existing threshold check (using typeThreshold)
and only accept the recognized type when both totalPower and threshold match the
canonical values to ensure vals.QuorumType and the set size are consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8cdcb95b-45a7-4039-a30f-e8bc819aae0f

📥 Commits

Reviewing files that changed from the base of the PR and between 297c65c and 1cb0d01.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • internal/consensus/state_data.go
  • proto/tendermint/types/params.proto
  • spec/core/data_structures.md
  • types/validator_set.go
  • types/validator_set_test.go

Comment thread internal/consensus/state_data.go Resolved
Comment thread types/validator_set.go Resolved
Comment thread types/validator_set.go Resolved
Co-authored-by: Copilot Autofix powered by AI <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread types/validator_set.go Resolved
Co-authored-by: Copilot Autofix powered by AI <[email protected]>

@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.

Code Review

The quorum-type-aware ValidateBasic fix, the Copy() preservation of VotingPowerThreshold, and the new below-strict-floor warning are correct and well-scoped. One real consensus-state gap remains: the same-quorum validator-update path in valsetUpdate now drops a fresh params.VotingPowerThreshold for the next height because Copy() carries the previous explicit threshold and UpdateWithChangeSet does not overlay the new param. Smaller items: one misleading error message and one undocumented new rejection path (oversized recognized-type set).

🔴 1 blocking | 🟡 2 suggestion(s) | 💬 1 nitpick(s)

1 additional finding(s) omitted (not in diff).

🤖 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 `internal/state/current_round_state.go`:
- [BLOCKING] internal/state/current_round_state.go:323-347: Same-quorum validator update path silently drops params.VotingPowerThreshold for the next height
  valsetUpdate applies params.VotingPowerThreshold only in the else branch (no validator updates). When validatorUpdates are present AND the quorum hash is unchanged, UpdateWithChangeSet runs but the new params.VotingPowerThreshold is never overlaid. Because this PR makes Copy() preserve VotingPowerThreshold (validator_set.go:396), nValSet now carries the previous explicit threshold and ValidateBasic() will pass with the stale value while ConsensusParamUpdates already record the new one. Concretely: a height that returns both same-quorum validator updates and Validator.VotingPowerThreshold = 900 (was 800) will persist NextConsensusParams=900 but build the next HeightVoteSet's commit gate at 800. The new-quorum branch passes &params to NewValidatorSetCheckPublicKeys and the no-update branch already applies the override — the same-quorum branch needs the same overlay before ValidateBasic().

In `types/validator_set.go`:
- [SUGGESTION] types/validator_set.go:191-194: Error message says both values must be positive, but the branch fires when either is non-positive
  This case triggers on `totalPower <= 0 || threshold <= 0` but the message reads "total voting power %d and threshold %d must both be positive". On the existing "zero total power rejected" test path, the derived threshold is 100, so the error reports e.g. `total voting power 0 and threshold 100 must both be positive`, which is incorrect about the threshold component. Reword to match the OR semantics.
- [SUGGESTION] types/validator_set.go:213-216: New over-subscribed rejection should be called out in CHANGELOG and PR description
  The PR description and CHANGELOG state the change "only loosens validation" and "cannot reject a validator set that previously passed." The new `vals.Size() > typeMembers` guard is a legitimate, consensus-safe second rejection path (an oversized DEVNET_PLATFORM set would drop the live commit gate below 2/3), but it is unmentioned. Operators of tooling that assembles non-canonical recognized-type sets should not discover this on upgrade. Document the new rejection alongside the existing canonical-threshold-mismatch note.

Comment thread types/validator_set.go Resolved
Comment thread types/validator_set.go Resolved
Comment thread types/validator_set.go Resolved
@lklimek
lklimek force-pushed the fix/valset-validate-quorum-type-aware branch from c3fbb6b to d5676f2 Compare June 12, 2026 11:07
Copy() now preserves VotingPowerThreshold, which activated a latent bug in
valsetUpdate: the same-quorum-with-updates branch ran UpdateWithChangeSet but
never overlaid the new params.VotingPowerThreshold, so the returned set kept the
previous height's threshold while NextConsensusParams recorded the new one. The
live commit gate (QuorumVotingThresholdPower -> vote_set.go) then tallied votes
against a stale threshold for one height.

Mirror the override the no-updates branch already applies, placed before
ValidateBasic so the explicit-override validation checks the value the chain
will actually use. The new-quorum branch already passes &params, so only this
branch was affected.

Adds a white-box regression test exercising all three valsetUpdate branches; the
same-quorum sub-case returned the stale threshold before this fix.

Refs #1328.

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

lklimek commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the catch on the same-quorum params.VotingPowerThreshold drop — verified and fixed.

Verification: Independently reproduced it with a white-box test against branch 1 of valsetUpdate. With a new threshold of 150, the returned set carried the stale 200 from Copy(), and QuorumVotingThresholdPower() gated at 200 — confirming the live commit gate diverges from the persisted NextConsensusParams for one height. Severity HIGH (network-wide-deterministic so no inter-node fork; silent because Hash() doesn't cover the threshold; self-heals after ~1 height) — BLOCKING justified, and notably it's this PR's Copy() preservation that activates the otherwise-dormant path.

Fix (4e67f8b): added the params.VotingPowerThreshold overlay after UpdateWithChangeSet and before ValidateBasic(), mirroring the no-updates branch. Added regression test TestValsetUpdateOverlaysVotingPowerThreshold (same-quorum case + else/new-quorum controls) — fails without the fix (returns 200), passes with it (150).

🤖 Co-authored by Claudius the Magnificent AI Agent

…itive" misnomer

The OR condition fires when *either* value is non-positive, so "must both
be positive" could mislead (the other operand might be fine).  Changed to
"> 0" which is phrasing-neutral w.r.t. which operand triggered.

Refs: thepastaclaw review thread on validator_set.go:194 (PR #1328)

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

@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.

Code Review

The PR's same-quorum overlay fix (4e67f8b) closes the prior blocking gap and is well covered by TestValsetUpdateOverlaysVotingPowerThreshold. One residual consistency gap: VotingPowerThreshold is now identity-relevant (preserved by Copy, used in updateToState) but ValidatorSet.Equals still ignores it. No callers exercise that today, so it's a latent foot-gun rather than an active bug.

🟡 1 suggestion(s)

1 additional finding(s) omitted (not in diff).

🤖 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 `types/validator_set.go`:
- [SUGGESTION] types/validator_set.go:256-281: ValidatorSet.Equals ignores VotingPowerThreshold even though Copy and state_data updateToState now treat it as identity-relevant
  This PR elevates VotingPowerThreshold to a first-class part of the ValidatorSet's effective identity: Copy() at types/validator_set.go:396 preserves it (with a regression test), and internal/consensus/state_data.go:271 explicitly compares `s.Validators.VotingPowerThreshold != validators.VotingPowerThreshold` to detect threshold flips on the same quorum. Equals() here compares only ThresholdPublicKey, QuorumHash, QuorumType and per-validator bytes, so two sets that differ only in VotingPowerThreshold compare equal. No current caller in the consensus hot path uses Equals (grep finds no `*ValidatorSet.Equals(` invocations), so this is latent rather than an active bug — but it leaves the public API of the struct this PR just hardened inconsistent with its own internal change-detection logic. Future callers that reach for Equals to detect 'meaningful change to the active commit gate' would silently miss the override flip this PR's state_data.go change was added to catch.

@thepastaclaw

Copy link
Copy Markdown

✅ Review complete (commit 4e67f8b)

… consistency

Not a behavioral fix — Equals has no callers and threshold propagates
correctly elsewhere. This makes the method honest about what constitutes
ValidatorSet identity, so any future caller gets the correct answer
without a surprise.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@lklimek
lklimek enabled auto-merge (squash) June 12, 2026 14:16
@lklimek
lklimek merged commit 7a1848c into v1.6-dev Jun 12, 2026
31 of 37 checks passed
@lklimek
lklimek deleted the fix/valset-validate-quorum-type-aware branch June 12, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Platform quorum (llmq_devnet_platform) rejected since v1.5.0: 8-of-12 threshold fails ValidateBasic's 2/3+1 check

3 participants