Repository navigation
fix(consensus): replay blocks with their historical quorum - #1567
Conversation
Reload the validator set at a replayed height when its commit belongs to an older quorum than the persisted state. Otherwise ProcessProposal sends the latest quorum to the application and changes withdrawal transaction hashes, preventing FinalizeBlock from accepting the historical commit. Cover unchanged quorums, rotation, missing history, and preservation of the latest state. The regression fails on master before this fix. <sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub> Co-Authored-By: Codex <[email protected]>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
✅ Final review complete — no blockers (commit db56225) · triage: low |
Merge the new PR base and use Tenderdash's internal database package in the regression test. Preserve the base branch's commit-extension checks. <sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub> Co-Authored-By: Codex <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The historical-quorum lookup is correctly scoped to application-only replay, selects validators for the replayed height, and preserves the caller's latest state. No blocking defects were verified; one non-blocking suggestion remains to exercise quorum-sensitive behavior through the complete replay loop. Static verification was performed at db56225 without running builds or tests; current CI reports successful build, test shards, rotation and Dash Core e2e tests, lint, and vet, with only PR Hygiene pending.
🟡 1 suggestion(s)
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — The diff adds a small, contained historical-validator lookup in replayBlock with focused regression tests, rather than a large or intricate change to consensus rules. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 99% left, weekly 59% left; passed overgemini-3.8-flash-high(antigravity quota lookup failed) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— tenderdash-consensus-security (completed, effort medium); 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 `internal/consensus/replay_quorum_test.go`:
- [SUGGESTION] internal/consensus/replay_quorum_test.go:45: Add a quorum-sensitive regression through the complete replay loop
The new regression verifies the historical quorum by calling replayBlock directly for a single height. Existing TestBlockReplayerReplay and TestHandshakeReplayAll exercise the production replay loop, including validator changes in the handshake tests, but their kvstore application's ProcessProposal does not consume or assert RequestProcessProposal.QuorumHash. Consequently, those tests do not pin the per-height quorum delivered when several blocks are replayed across a rotation. Add a Replay-level variant with a quorum-checking application that asserts the expected quorum at every replayed height, including heights on both sides of the rotation. This would supplement the focused unit test with coverage of block/seen-commit selection and iteration wiring; it is not a blocker for the current implementation.
|
Bots are done — your move: post |
|
/self-reviewed |
|
Policy satisfied — this can merge. |
…-consensus-ccf700 v1.8-dev was renamed to dev; this brings in the two commits since then (#1552 dev branch and release workflow, #1567 replay with historical quorum). No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
TL;DR: Allow a restarted node to replay older blocks across a signing-group change without repeatedly failing on withdrawals.
User story
As a node operator, I want recovery after a restart to rebuild older withdrawals correctly, so the node can resume processing blocks.
Scenario
A node restarts with its application a few blocks behind the stored chain, across a change of signing group. Recovery currently uses the newer group to rebuild older withdrawals, changes their hashes, and fails on every restart. It should use the group that signed the replayed block.
Detailed discussion
Issue being fixed or feature implemented
Application-only replay passes the latest persisted state to
BlockExecutor.ProcessProposal, which readsQuorumHashfromstate.Validators. Drive includes that quorum hash in unsigned withdrawal transactions, so replay across a quorum rotation changes their txids and vote extensions.What was done?
When the state's quorum differs from the replayed commit's quorum,
replayBlockloads the validator set for the replayed height before callingProcessProposal. Missing historical validators stop replay before any ABCI call; the latest state remains unchanged.Targets
v1.8-dev. Normal finalization waits for the application before saving Tenderdash state; replay intentionally supports an older application state. This fix handles that recovery case and does not explain how the reported application fell behind. Its database was unavailable, so the exact reported transaction hashes were not independently reproduced.How Has This Been Tested?
replay_quorum_test.gocovers unchanged quorums, rotation, missing history, and preservation of the latest state.go test -race -tags=deadlock -p 1 ./internal/consensus -run '^Test(ReplayUsesHistoricalQuorumAfterRotation|ReplayRejectsCommitExtensionsBeforeFinalize|BlockReplayerReplay|HandshakeReplay(All|Some))$' -count=1../internal/consensus, with--new-from-rev=origin/v1.8-dev: 0 issues.TestBlockReplayerReplay: passed, including application state six blocks behind the stored chain.gofmtandgit diff --check: passed.Breaking Changes
None.
Checklist
Attribution
🤖 Co-authored by Claudius the Magnificent AI Agent
-count=1`.
./internal/consensus, with--new-from-rev=origin/master: 0 issues.TestBlockReplayerReplay: passed, including application state six blocks behind the stored chain.gofmtandgit diff --check: passed.Breaking Changes
None.
Checklist
Attribution
🤖 Co-authored by Claudius the Magnificent AI Agent
PR Hygiene ·
db56225When every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.