Repository navigation
fix(drive-abci): verify vote extensions against the withdrawals of their own round - #5010
Conversation
…eir own round The unsigned withdrawal transactions a proposal asks validators to sign carry its chain-locked core height as their request height. When a new chain lock arrives between two rounds of one height, the later proposal asks for signatures on different transactions. verify_vote_extension accepted votes of any round but compared them with the last proposal this node processed, so a valid precommit of the other round was rejected and dropped, which can cost an extra round while withdrawals are queued. process_proposal now keeps the withdrawal transactions of every proposal it accepts at the current height, by round and block hash, and finalize_block clears them. A vote is compared with the proposal of its own round and block and still rejected on a mismatch. A vote for a block this node has not accepted is accepted, as the ABCI++ spec asks: Tenderdash checked its signatures, this node only signs in extend_vote, Tenderdash recovers threshold signatures only from identical extensions holding the quorum threshold, and finalize_block still matches the recovered extensions against this node's own withdrawals. The handler is not versioned and touches no state, so there is no version gate. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: dashpay/platform/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (12)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe application now records unsigned withdrawal transactions for accepted proposals by height, round, and block hash. Vote-extension verification checks the record for the request’s exact height, round, and block hash. Block finalization clears the records. ChangesWithdrawal vote verification
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant process_proposal
participant UnsignedWithdrawalTxsByRound
participant verify_vote_extension
participant finalize_block
process_proposal->>UnsignedWithdrawalTxsByRound: Store accepted proposal withdrawals by height, round, and block hash
verify_vote_extension->>UnsignedWithdrawalTxsByRound: Look up withdrawals using request height, round, and block hash
UnsignedWithdrawalTxsByRound-->>verify_vote_extension: Return matching withdrawals or no match
verify_vote_extension-->>verify_vote_extension: Compare vote extensions with recorded withdrawals
finalize_block->>UnsignedWithdrawalTxsByRound: Clear all stored rounds
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking defect is established. The behavior of votes received before proposal acceptance remains unverified against the pinned Tenderdash version. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Matching votes to their own proposal addresses the reported round-to-round mismatch. The new requirement that this node must already have accepted that exact proposal can also reject an otherwise valid vote, potentially delaying consensus. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
|
✅ Final review complete — no blockers (commit dfd9c09) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
At c75ff0b, the per-round cache fixes cross-round withdrawal comparisons, but accepting votes on a cache miss introduces a blocking denial-of-service path. Inspection of the pinned Tenderdash implementation confirms that stripping extensions preserves vote authentication and can produce a commit that Platform cannot finalize. The test-helper suggestion was dropped because the fixtures serve different purposes and do not require matching values.
🔴 1 blocking
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: architecture-layering); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: security-auditor); reviewer 5: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 6: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 7: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)
- Triage:
criticalbygpt-6-astra(effort low) — The diff intricately changes consensus vote acceptance in packages/rs-drive-abci/src/abci/handler/verify_vote_extension.rs, including accepting unrecognized proposals' withdrawal extensions, with round-specific state maintained across process_proposal and finalize_block. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— architecture-layering (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— security-auditor (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 13% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6-astra— final-verifier; agentastra-verifier - Phase 2 reviewers:
gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort xhigh); agentphase2-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 `packages/rs-drive-abci/src/abci/handler/verify_vote_extension.rs`:
- [BLOCKING] packages/rs-drive-abci/src/abci/handler/verify_vote_extension.rs:81-83: Accepting unchecked votes lets peers strip extensions and poison the commit
When a block contains withdrawals, a gossip peer can copy honest precommits, remove their entire extension list, and deliver them before the target processes that proposal. No validator key is required: in the pinned Tenderdash commit b277e2c7b73037a34fd350e3417110f018f1e647, `Vote.ToCanonicalVote` excludes extensions, and `QuorumSignData.VerifyVoteExtensions` succeeds for an empty list. This new cache-miss branch accepts those modified votes; the previous handler rejected votes without an execution context and rejected empty extensions against nonempty withdrawals.
Threshold grouping does not authenticate the omission. `VoteSet.canonicalVoteExtensionGroup` counts the stripped votes toward the empty-vector group, allowing recovery of a valid block signature with no withdrawal extensions. Subsequently received originals cannot repair the vote set: `VoteSet.addVote` treats the same validator/block signature as a duplicate regardless of its extensions.
Once the proposal arrives, `ProcessProposal` computes its withdrawals but does not revalidate those admitted votes. Tenderdash's `ApplyCommitAction.Execute` saves the commit before finalization. Platform then returns `VoteExtensionMismatchReceived` because the recovered extensions are empty, and Tenderdash panics on the finalization error, leaving the invalid-for-Platform commit saved for replay. An unprivileged peer that wins delivery ahead of the proposal can therefore halt the target without forging a signature or controlling quorum voting power. Do not let unchecked votes enter the recoverable vote set: defer admission until the complete extension vector can be validated, or require cryptographic authentication of that complete vector before enabling this fallback. Finalization checks protect withdrawal integrity but occur too late to prevent this denial of service.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…accepted A precommit's block signature does not cover its vote extensions, and Platform's withdrawal extensions carry a sign request id that binds their signatures to neither height nor round. A relaying peer can therefore strip some or all of a precommit's extensions, or swap in the same validator's extensions from another round, and the vote still verifies in Tenderdash. Accepting such a vote for a block this node has not accepted could let extensions other than the block's reach the recovery threshold, and the commit they form would then fail in finalize_block. A vote is now accepted only when its extensions exactly match the withdrawal transactions this node built for the same height, round and block. Everything else is rejected, including a vote for a round whose proposal has not reached this node yet, as it was before when no block execution context existed. Comparing a vote for an unprocessed round with another round's withdrawals, as the previous handler did, accepted transplanted extensions; that is closed too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Verified the complete PR diff at dfd9c09: the prior unchecked-vote admission vulnerability is fixed, and no actionable in-scope findings remain. Independent validation passed 13 verifier/cache/finalization unit tests, 6 round-isolation/proposal-collision strategy tests, and git diff --check; the worktree remains unchanged. A separately verified, pre-existing direct-commit denial-of-service path is retained for internal follow-up and does not block this PR.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: architecture-layering); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: security-auditor); reviewer 5: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 6: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 7: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); reviewer 9: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 10: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); reviewer 12: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)
- Triage:
criticalbygpt-6-astra(effort low) — The diff intricately changes consensus vote acceptance in packages/rs-drive-abci/src/abci/handler/verify_vote_extension.rs by binding withdrawal extensions to height-, round-, and block-specific proposal records whose lifecycle spans process_proposal and finalize_block. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— architecture-layering (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— security-auditor (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 13% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6-astra— final-verifier; agentastra-verifier - Phase 2 reviewers:
gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 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.
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.
- Validate received commits' complete extension vectors before persistence — The pinned Tenderdash source routes CommitMessage through TryAddCommitAction without calling verify_vote_extension. A peer can strip all threshold vote extensions from an otherwise valid commit: the block signature does not authenticate that list, and extension verification succeeds when both derived extension and signature lists are empty. ApplyCommitAction saves the commit before Platform rejects the missing withdrawals in finalize_block_proposal, after which Tenderdash panics, leaving the modified commit persisted for replay. This direct-commit path and persistence ordering predate the PR and are unchanged by it.
- Follow-up: Track a separate security fix that validates received commits' complete extension vectors against the executed block before persistence, with a regression delivering a stripped commit before the honest original.
|
Bots are done — your move: post |
…epted The exception accepted an empty vote for a block this node had not accepted when a block accepted at the same height had no withdrawals and no protocol upgrade was pending. It relied on every round of a height dequeuing the same withdrawals, which holds for the current block pipeline but is enforced by nothing, and a change to when expired withdrawals are re-queued would break it silently. A vote for a block this node has not accepted is rejected again, as #5010 does; the cost is that a node that has not processed a later round's block yet waits for the commit at heights without withdrawals. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Issue being fixed or feature implemented
Each block dequeues up to 4 queued credit withdrawals and turns them into unsigned Core asset unlock transactions.
build_unsigned_transactionwrites the proposal's chain-locked core height into each one asrequest_height,extend_voteasks validators to sign them in their precommit vote extensions, andfinalize_blockbroadcasts them.verify_vote_extensionchecked only that a vote's height matched the block execution context, and accepted any round because "withdrawal transactions to sign are the same for any round of the same height". It then compared the vote with the withdrawal transactions of the last proposal this node processed.That assumption does not hold when a height goes past round 0 and a new chain lock arrives between rounds. The next proposer uses the newer core height, so its withdrawal transactions have a different
request_heightand a different txid. A valid precommit from a validator that holds the other round's proposal was then rejected, with an ERROR log (votes extensions ... mismatch). In the other direction, a vote for a round this node had not processed yet was accepted whenever its extensions matched the last proposal, although nothing showed they were the ones signed for that round.The effect is liveness only, and only while withdrawals are queued (with none queued both sides are empty and match). A rejected precommit does not count, so a round can fail to gather enough votes and Tenderdash moves on to another round (the dashmate base genesis uses a 10 s + 1 s per round vote timeout). There is no app hash effect and no fund risk.
What was done?
Withdrawals are kept per round.
UnsignedWithdrawalTxsByRoundholds the unsigned withdrawal transactions of every proposal this node accepted at the current height, keyed by round, with the block hash.process_proposalrecords the accepted proposal after every Accept, andfinalize_blockclears the record once the height is decided. It lives on the ABCI application next to the block execution context (a newBlockExecutionApplication::unsigned_withdrawal_txs_by_round). It is node memory, not consensus state.Each vote is verified against its own round.
verify_vote_extensionnow:The misleading "same for any round" comment is gone.
What Tenderdash does (v1.8.0, the version rs-tenderdash-abci v1.8.0 is built from and dashmate runs)
addVoteValidateVoteMw,addVoteVerifyVoteExtensionMw, wired at L66-L74). So precommits of a round this node has not processed, earlier or later, do reach the app.CanonicalVote), and each extension is checked on its own against the extensions the vote carries (quorum_sign_data.go L60-L124). Platform's extensions carry a sign request id, and a raw threshold extension with one is bound to neither height nor round (ThresholdRawVoteExtension.SignItem). So a precommit whose extensions were dropped, or replaced with the same validator's extensions from another round, still verifies.invalid vote extension(execution.go L669-L695): the vote is dropped and not added to the vote set, and the peer is not penalised (voteMessageHandler).VoteSetBits), and a peer then sends the ones it lacks (ApplyVoteSetBitsMessage). A node that falls behind catches up through the commit.canonicalVoteExtensionGroup). A vote with different extensions is kept, but its shares are never mixed in, and recovery waits until such a group exists (vote_set.go L436-L452).ApplyCommitcallsmustEnsureProcess, which re-runs ProcessProposal when the last one was for another round (state_apply_commit.go L61,ensureProcess). Sofinalize_block_proposalnever sees a round mismatch from this, and it keeps matching the commit's threshold vote extensions against its own withdrawal transactions for the decided block.Why a vote for a block this node has not accepted is rejected
Without the block, the node cannot tell which transactions the vote should carry, and nothing in the vote shows its extensions are the ones the validator signed for that block: they may have been dropped in part or entirely, reordered, or taken from the same validator's vote in another round, and the vote still verifies. If enough such votes were counted, a group with extensions other than the block's could reach the recovery threshold, and the commit it forms would then fail in
finalize_block, which matches the recovered extensions against its own withdrawal transactions. Accepting only extensions that exactly match what this node built for that height, round and block rules this out, including for the vote the previous handler accepted because it matched the last proposal. The cost is that a vote arriving before its block is dropped, which Tenderdash can make up by sending it again.What differs between rounds
process_proposalreplaces the block execution context for each new round, and each proposal runs in a fresh transaction on the same committed state. The rounds of one height dequeue the same queued withdrawals and use the same validator set quorum hash; what changes with a newer chain lock isrequest_height, and with it the txid validators sign.Before / after
A height where round 0 was proposed at chain-locked core height 1000 and round 1 at 1001, with one withdrawal queued. This node processed round 0, then round 1. Another validator's round 0 precommit then arrives, carrying the round 0 extension (txid of the transaction with
request_height1000).Before:
After:
And with only round 0 processed, a round 1 precommit carrying the round 0 extension:
No version gate
The handler is not versioned and touches no state: it only decides which precommits this node counts. Mixed old and new nodes differ only in which votes they accept, and the app hash cannot change.
How Has This Been Tested?
verify_vote_extensionunit tests, rewritten around the per-round record: a round 0 vote at the older core height is accepted after round 1 was processed at a newer one, and round 1's vote too; a round 0 vote carrying round 1's withdrawals, made-up bytes, no extensions, only some of them or them reordered is rejected; votes for another height, for a round or a block this node has not accepted (with honest, stripped or another round's extensions) and before any proposal of the height are rejected.UnsignedWithdrawalTxsByRoundunit tests: rounds kept apart, a round's block replaced, a new height starts empty,clearforgets everything.finalize_blocktest: finalizing a height clears the record.vote_extension_round_tests, through the real handlers: after a short chain with one queued withdrawal,process_proposalruns round 0 at the last chain-locked core height and round 1 at the next one,extend_votegives the two different extensions each round signs, andverify_vote_extensionaccepts each round's own, and rejects round 1's extensions in a round 0 vote. Before round 1 is processed, it rejects a round 1 vote carrying round 0's extensions and a round 0 vote without extensions.verify_vote_extension.rsreverted): the round 1 vote carrying round 0's extensions comes back as Accept, and with that assertion out of the way the round 0 precommit comes back as Reject after round 1 was processed.cargo test -p drive-abci --lib -- abci:: unsigned_withdrawal_txs_by_round(129 passed),cargo test -p drive-abci --lib -- withdrawal(199 passed),cargo test -p drive-abci --test strategy_tests -- vote_extension_round_tests process_proposal_collision_tests(6 passed),cargo clippy -p drive-abci --all-features --all-targets -- -D warnings,cargo fmt --all -- --check. The full workspace suite is left to CI.Breaking Changes
None.
BlockExecutionApplicationgains a required method; its only implementors are the ABCI applications in drive-abci.Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
dfd9c09/self-reviewedWhen every box is checked the
PR Hygienecheck passes and this can merge.Summary by CodeRabbit