Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
🕓 Review not started yet because this PR is a draft.
Commit d306401. Normal review starts when eligible; priority review starts as soon as a slot is available. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Consensus version 0 now selects the sole validator after a quorum rotation instead of dereferencing a missing second validator. Larger sets and consensus versions 1 and 2 keep their existing selection rules. All six test shards, both end-to-end jobs, the Linux build, vet, and lint passed on this head; the PastaClaw review check is still pending.
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.2-sol(effort low) — The change is a small, contained fix in proposerFromStore that handles empty and single-validator sets while preserving the existing selection rule for larger sets. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort high); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(zai below 15% reserve: 5h 100% left, weekly 0% left) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— tenderdash-consensus-security (completed, effort medium); agentphase2-reviewer
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- In-place validator removals can prevent consensus from advancing — When an ABCI update retains the quorum hash,
UpdateWithChangeSetpreserves the old proposer index. If the set shrinks past that index,ValidateBasicrejects the update before proposer selection. Even if the index stays in bounds, an otherwise valid update that retains the quorum hash and threshold key leavesValidatorSet.Hash()unchanged. If the update removed the previous block's proposer, the selector tries to restore a validator who is no longer in the set, and consensus initialization fails. Both paths predate this PR.- Follow-up: Track this in a separate issue and follow-up PR. Define how to update the proposer index after an in-place membership change and how to select the next proposer deterministically when the previous proposer was removed. Cover live transitions and restart.
After a quorum rotation, heightProposerSelector.proposerFromStore picks the validator at index 1, preserving historical behaviour. A validator set with one member has no index 1, so GetByIndex returned nil and the node crashed with a nil pointer dereference (CONSENSUS FAILURE). Wrap the index to the set size, so a one-member set selects its only validator and larger sets keep index 1. An empty set returns an error instead of panicking. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Choose the proposer index by validator set size directly, so gosec G115 has no narrowing conversion to flag. Co-Authored-By: Claude Opus 5.5 <[email protected]>
18c25f2 to
d306401
Compare
TL;DR: A network whose validator set shrinks to a single validator keeps producing blocks instead of crashing every node.
User story
As a Dash Platform node operator, I want my node to keep running when the validator quorum rotates to a single member, so a small or test network does not halt.
Scenario
Base flow
Actual behavior
Every node crashes with
CONSENSUS FAILURE!!! ... nil pointer dereferenceand the network halts.Expected behavior
The only validator becomes the proposer and the network continues.
Detailed discussion
What was done
heightProposerSelector.proposerFromStore(internal/consensus/versioned/selectproposer/height_proposer.go): after a quorum rotation it picks the validator at index 1, deliberately preserving historical behaviour for consensus compatibility. A one-member set has no index 1, soGetByIndex(1)returned nil and the node crashed.TestProposerSelectionQuorumRotation: quorum rotation into sets of 1 and 2 validators, consensus versions 0–2, and the following heights and rounds. It reproduced the panic before the fix.Evidence: a local e2e run (dev at
831bbeaf6and1871893d0) rotated to[validator_update.1010] validator05 = 100and every node crashed inproposerFromStore.Stacked on #1642; the stacked PR above it removes the unused
cie2e network.Out of scope:
ValidatorSet.proposerIndexis not clamped when a set shrinks in place with the same quorum hash (types/validator_set.go,updateWithChangeSet). This is pre-existing and found in review; it is a separate follow-up.Known limitations: None.
Testing
go test -race -p 2 -count=1 ./internal/consensus/versioned/...: pass. The new test failed (panic) before the fix.go veton the package: pass.make lint LINT_BASE=3382eff1areports only the local libpcap typecheck (the gosec G115 finding from review is fixed).Breaking changes
None.
🤖 Co-authored by Claudius the Magnificent AI Agent
🤖 Generated with Claude Code