Repository navigation
feat: exact work modifiers and scan coverage proofs under the snapshot view - #8271
PastaPastaPasta merged 2 commits into
Conversation
|
This pull request has conflicts, please rebase. |
|
✅ Final review complete — no blockers (commit cb75188) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Changes requested: 2 blockers
- An unreadable commitment index can make a snapshot node reject a valid block —
src/llmq/quorumsman.cpp:225-233(new)
Impact: A snapshot node validating a block can reject a valid ChainLock or asset unlock when a local EvoDB read failure leaves its quorum scan incomplete. - A snapshot scan can return replacement-branch quorums for a disconnected block —
src/llmq/quorumsman.cpp:328-336(new)
Impact: After a reorg, a snapshot node processing a delayed tip update can use the wrong quorum set for connection management, and a ChainLock lookup that races the reorg can verify against the wrong set.
The two commits on top of #7593 make quorum work modifiers exact, preserve public-key verification when pruning makes membership unavailable, and add scan coverage proofs for ChainLocks and asset unlocks. The stack conflicts with current develop and needs a rebase. Lint, cppcheck, the standard Linux build and tests, and the ASan build passed; ASan tests and other build variants are pending.
🔴 2 blocking | 🟡 5 suggestion(s) | 💬 1 nitpick(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: The work-modifier subject hides the change for ordinary pruned nodes
Impact: A maintainer looking through git log --oneline for the change in ordinary pruning behavior can miss the relevant commit.
<commit:06b53bc3769>:1
The subject ends with “under the snapshot view,” but the commit also removes the guessed block-hash modifier in NORMAL and preserves signature verification there with key-only quorums. Keep the changes together and use a subject that covers both views, such as fix(llmq): never guess a quorum modifier when the work block is missing.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The two new commits intricately change which quorum state validation can rely on:ResolveWorkBlockModifierinsrc/llmq/utils.cppchanges how quorum-selection inputs are derived and when they are unavailable, whileCheckScanCoverageinsrc/evo/snapshot_chain.cppgates snapshot acceptance on complete ChainLock and asset-unlock scan coverage. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); 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(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `src/llmq/quorumsman.cpp`:
- [BLOCKING] src/llmq/quorumsman.cpp:225-233: An unreadable commitment index can make a snapshot node reject a valid block
Impact: A snapshot node validating a block can reject a valid ChainLock or asset unlock when a local EvoDB read failure leaves its quorum scan incomplete.
Block validation can mistake a local read failure for evidence that the signing quorum was never in the scan window. Both index readers can return the records collected before a value or iterator read failure, but `ProveScanFromCutoff` does not pass their `unreadable` output parameter. `TraverseScanSequences` then accepts a short sequence marked `END`, even though `END` only describes the history carried at seeding. `VerifyAssetUnlockSig` rejects a signing quorum omitted from that result as `bad-assetunlock-too-old-quorum`; coinbase ChainLock verification can likewise reject the block if the scan omits its signer. Check the read result before traversal and propagate a local-state error without caching the result, as the export coverage check already does.
- [BLOCKING] src/llmq/quorumsman.cpp:328-336: A snapshot scan can return replacement-branch quorums for a disconnected block
Impact: After a reorg, a snapshot node processing a delayed tip update can use the wrong quorum set for connection management, and a ChainLock lookup that races the reorg can verify against the wrong set.
The snapshot scan still returns a purportedly proven result when `IsOnViewChain` is false; that check only prevents a cache write. `NetQuorum::UpdatedBlockTip` can supply a disconnected tip from a queued notification, and `ChainlockHandler::ProcessNewChainLock` captures its signing start before calling verification. If the branches share a quorum base but differ in which commitment was mined, the view's height index describes the replacement branch, yet its quorum-base height still resolves on the disconnected branch. Require the normalized cutoff to be on the indexed chain before proving a cache miss, and ensure that materializing the result uses the same chain evidence before returning it.
- [SUGGESTION] src/llmq/quorumsman.cpp:107-110: Quorum membership can stay unavailable after the pruned work block is restored
Impact: A pruned-node operator who successfully restores a non-rotating quorum's work block with `getblockfrompeer` can still see `quorum info` fail until cache eviction or restart.
Restoring the work block makes exact membership computable again, but the first lookup while it was missing cached a key-only `CQuorum` with immutable member state. `ReceivedBlockTransactions` restores `BLOCK_HAVE_DATA`, while `GetQuorum` still returns the old object without checking the work block. The quorum scan cache can retain the same object independently. Keep temporary membership failures out of both caches, or invalidate or upgrade those entries when their missing inputs become available.
In `src/llmq/utils.cpp`:
- [SUGGESTION] src/llmq/utils.cpp:121-128: Concurrent pruning can make a quorum lookup report a disk read error
Impact: A pruned-node operator querying an old quorum while its work block is being pruned can receive a read error instead of the missing-data result.
`ModifierFromWorkBlockData` records `BLOCK_HAVE_DATA` and the file position under `cs_main`, then reads after releasing the lock. An RPC lookup such as `quorum info` does not hold an outer `cs_main` lock, so pruning can clear the flag and unlink the file before the read. The resulting `BlockDataReadError` also prevents the resolver from using a seeded modifier if one exists. This is not a validation shutdown race: the block-validation callers already hold `cs_main`. Keep the status and read consistent, or recheck the status and position on failure so a pruned block is treated as absent, not unreadable.
In `src/rpc/quorums.cpp`:
- [SUGGESTION] src/rpc/quorums.cpp:176-179: The same underfilled quorum can report lower health after pruning
Impact: RPC and GUI users on pruned nodes can see worse health than archival-node users for the same quorum even though its valid members have not changed.
`quorum listextended` divides by the number of selected members when available, but by the configured slot count for key-only quorums. `CalculateQuorum` can return fewer members than the configured capacity, and commitment verification allows the remaining slots to be clear. Three valid members in a quorum with four configured slots can therefore be reported as either 100% or 75%. `getQuorumStats` in `src/node/interfaces.cpp` uses the same fallback. Use one documented denominator consistently, or report member-based health as unavailable while retaining the exact valid-member count.
In `src/evo/snapshot.h`:
- [SUGGESTION] src/evo/snapshot.h:902-906: Three new public helpers expose paths that production callers bypass
Impact: Tests rely on extra public entry points for scan coverage and modifier resolution instead of the entry points used in production.
`CheckEvoSnapshotScanCoverage` is only called by `evo_snapshot_tests.cpp`; the loader calls `CheckScanCoverage` directly. Likewise, only tests call `CQuorumManager::ProveScan` and `utils::GetQuorumModifierForWorkBlock`, while production calls their internal implementations. This goes against the project's convention not to add public helpers solely for tests. Where the signatures fit, use the shared entry point in production; otherwise exercise the behavior through the existing production API.
In `<commit:06b53bc3769>`:
- [SUGGESTION] <commit:06b53bc3769>:1: The work-modifier subject hides the change for ordinary pruned nodes
Impact: A maintainer looking through `git log --oneline` for the change in ordinary pruning behavior can miss the relevant commit.
The subject ends with “under the snapshot view,” but the commit also removes the guessed block-hash modifier in `NORMAL` and preserves signature verification there with key-only quorums. Keep the changes together and use a subject that covers both views, such as `fix(llmq): never guess a quorum modifier when the work block is missing`.
In `doc/release-notes-7593.md`:
- [NITPICK] doc/release-notes-7593.md:4-7: The pruning release note attributes this PR's changes to #7593
Impact: Release-note readers are directed to the preceding PR rather than the PR that changes behavior on pruned nodes.
The file is added by `06b53bc3769`, one of the two commits new in #8271, and both entries describe behavior introduced by that commit. `doc/developer-notes.md` names release-note files by the PR that introduces them. Use `doc/release-notes-8271.md` and update the references in the note.
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.
- Pruned nodes can serve an unverified null ChainLock in a masternode-list diff — In
NORMAL,BuildQuorumChainlockInfotreats a missing work block as a null coinbase ChainLock and serializes it that way, even when the coinbase carried a certificate. Clients can receive the wrong input for computing quorum members. Both the serving behavior and the test that expectsNORMALto answer without the work block predate this PR's two commits.- Follow-up: Use explicit ChainLock availability in a follow-up for
protx diffandGETMNLISTDIFF, rather than serializing a null signature when the work block is missing.
- Follow-up: Use explicit ChainLock availability in a follow-up for
497c5a3 to
2d3cdf6
Compare
|
This pull request has conflicts, please rebase. |
1 similar comment
|
This pull request has conflicts, please rebase. |
2d3cdf6 to
db8d807
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (queue backlog)
New on this head: This head adds snapshot-view scan coverage proofs, propagates unreadable-index errors through proven scans, and tightens exact quorum work-modifier handling for pruned nodes. The main check passed; ClangFormat and skip-condition checks remain queued, with no failed code checks reported.
🟡 1 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Reviewers and release-note readers can miss that this commit also changes quorum behavior for ordinary pruned nodes, not only for the snapshot view.
<commit:eb43f652ba0142748e84c511edf88c356d09a429>:1
The subject remains fix(llmq): exact work modifiers and no silent degradation under the snapshot view, but the commit also removes the block-hash fallback in NORMAL and changes quorum info, memberof, and selectquorum behavior when a pruned node lacks a work block. Update the subject to mention pruned nodes or NORMAL-view behavior so the scope of this breaking change is visible in the commit history.
source: gpt-6.2-astra (phase2-reviewer: general)
Follow-up candidates (optional) (1)
New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.
🟡 Suggestion: A commitment-index read failure can still make snapshot validation reject a valid block
Impact: A node with an unreadable local commitment index can reject a valid successor block as consensus-invalid when validating its coinbase quorum merkle root.
src/llmq/blockprocessor.cpp:939-946
A peer-supplied valid block can be rejected when a local EvoDB commitment-index read fails during CalcCbTxMerkleRootQuorums. That function calls GetQcHashes, which calls GetMinedAndActiveCommitmentsUntilBlock; both its rotating path through GetLastMinedCommitmentsByQuorumIndexUntilBlock and its non-rotating path through GetMinedCommitmentsUntilBlock omit the unreadable output argument. The walkers therefore return the records collected before the failed value or iterator read, then call RequireSatisfiedScan; a seeded END marker accepts the shortened result. GetQcHashes hashes that partial quorum set, and the block is rejected with bad-cbtx-quorummerkleroot. Propagate the unreadable state through these shared callers and raise BlockDataReadError before constructing or caching the quorum hash set, just as ProveScanFromCutoff now does.
source: gpt-6.2-astra (phase2-reviewer: general)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This is a large, intricate diff that changes consensus-critical snapshot, deterministic-masternode, quorum, ChainLock, asset-unlock, validation, and peer-facing data-processing paths, including signature and quorum work-modifier handling in files such as src/llmq/utils.cpp and src/evo/snapshot.cpp. - Phase 1 reviewers: not run (skipped for throughput: 14 PRs queued, above the 10 limit)
- New since the last final review (
497c5a3a): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 not confirmed (no longer blocking) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `<commit:eb43f652ba0142748e84c511edf88c356d09a429>`:
- [SUGGESTION] <commit:eb43f652ba0142748e84c511edf88c356d09a429>:1: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Reviewers and release-note readers can miss that this commit also changes quorum behavior for ordinary pruned nodes, not only for the snapshot view.
The subject remains `fix(llmq): exact work modifiers and no silent degradation under the snapshot view`, but the commit also removes the block-hash fallback in NORMAL and changes `quorum info`, `memberof`, and `selectquorum` behavior when a pruned node lacks a work block. Update the subject to mention pruned nodes or NORMAL-view behavior so the scope of this breaking change is visible in the commit history.
|
This pull request has conflicts, please rebase. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This head adds exact quorum work-modifier handling and proves ChainLock and asset-unlock scan coverage under the snapshot view, with follow-up test/view corrections included in the stack. Lint, cppcheck, clang-format, and completed cache/container checks pass; source and ASAN builds remain in progress and several platform cache checks are queued.
🟡 2 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Git history readers may miss that ordinary pruned nodes now retain key-only quorums and make membership unavailable until a pruned work block is restored.
<commit:a547e8476fd>:1
The permanent subject is framed around exact modifiers under the snapshot view, but the commit also removes the block-hash fallback in NORMAL and changes quorum membership behavior for pruned work blocks. Reword the subject so the user-visible ordinary-pruned-node behavior is discoverable from git log and blame.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
🟡 Suggestion: Review-only fixup commits remain in the permanent history
Impact: The final history presents corrections to the exact-modifier and scan-coverage implementations as separate incomplete milestones, making blame and bisect show intermediate states that were never intended to stand alone.
<commit:1d11b6fa0e5>:1
Both 1d11b6fa0e5 and 37009f260ac are explicit fixup! commits that amend the two substantive LLMQ commits immediately before them. Autosquash each into its target commit before merging so the permanent history contains the completed implementations as coherent logical changes.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This is a large, intricate change that directly alters consensus-critical quorum work-modifier resolution and ChainLock/asset-unlock coverage behavior in files such as src/llmq/utils.cpp, src/llmq/blockprocessor.cpp, and src/validation.cpp. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); 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(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `<commit:a547e8476fd>`:
- [SUGGESTION] <commit:a547e8476fd>:1: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Git history readers may miss that ordinary pruned nodes now retain key-only quorums and make membership unavailable until a pruned work block is restored.
The permanent subject is framed around exact modifiers under the snapshot view, but the commit also removes the block-hash fallback in NORMAL and changes quorum membership behavior for pruned work blocks. Reword the subject so the user-visible ordinary-pruned-node behavior is discoverable from `git log` and blame.
In `<commit:1d11b6fa0e5>`:
- [SUGGESTION] <commit:1d11b6fa0e5>:1: Review-only fixup commits remain in the permanent history
Impact: The final history presents corrections to the exact-modifier and scan-coverage implementations as separate incomplete milestones, making blame and bisect show intermediate states that were never intended to stand alone.
Both `1d11b6fa0e5` and `37009f260ac` are explicit `fixup!` commits that amend the two substantive LLMQ commits immediately before them. Autosquash each into its target commit before merging so the permanent history contains the completed implementations as coherent logical changes.
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.
- A global ChainLock cache lets one Evo view bypass another view's signature check — This is a real dual-chainstate hazard:
0621e1d32aereplaces the per-viewEvoViewCachewith one process-global entry, so averified_hereresult produced under oneqmanview can be reused by the other view when the samepindexis validated. However, that commit is a fixup on #8237'sfix(evo): partition Evo-derived caches by view, not one of #8271's two new commits; the PR description explicitly limits this PR's new work to the exact-modifier and scan-coverage commits.- Follow-up: #8237 should retain or otherwise correctly partition the previous-coinbase ChainLock verification cache by Evo view.
thepastaclaw
left a comment
There was a problem hiding this comment.
CI failed after approval — commit 37009f2
The standing review approved this commit; this follow-up moves the verdict to COMMENT: checks that failed after the review look related to this change.
Failing checks:
win64-build / Build source(failure)linux64_tsan-build / Build source(failure)
Why they look related: The TSAN check explicitly reports evo_snapshot_tests failing, and this PR substantially changes snapshot implementation and tests, including coverage-gate behavior. The Windows check reports 10 test failures in a broad suite; although the tail shows no assertions, the PR changes wallet, interfaces, and related code paths, so it plausibly affects those tests rather than being clearly infrastructure-related.
Nothing was re-reviewed: the findings of the standing review are unchanged. The next push gets a full review; a re-run that passes does not restore the approval.
Review provenance
Source: CI-check lane gpt-6.2-sol (agent: triage); no reviewer or verifier lanes ran for this follow-up
- Verdict moved because CI failed on this commit after the review; failure logs read: 2 GitHub Actions job(s)
37009f2 to
80ad884
Compare
…B generation 1370095 refactor(evo): check that tip-based Evo reads serve only the active chainstate (Konstantin Akimov) fed70e8 feat(evo): store snapshot-identity state in a generation namespace with journaled promotion (pasta) 5bb5947 refactor(validation): reject the snapshot when its Evo state disagrees with derived state (pasta) 7736bbe refactor(validation): move the invalid-snapshot handler into a ChainstateManager method (pasta) adf5ec4 feat(dbwrapper): report LevelDB iterator read errors (pasta) 0867b0c refactor(evo): add EvoDB view tokens (pasta) c04d41b refactor(llmq): stop writing the unused q_bbu2 best-block key (pasta) Pull request description: ## Issue being fixed or feature implemented While an AssumeUTXO snapshot chainstate and the background chainstate run together, both write Evo state (masternode lists, quorum commitments, the credit pool, EHF signals) into one EvoDB keyspace. State the snapshot chainstate writes can then be read by background validation, which can make it mark valid blocks invalid, and a rejected snapshot leaves its records behind. **AssumeUTXO stack** (merge in this order; each PR holds the commits of the ones below it): #8237 → #8238 → #7887 → #8270 → #7593 → #8271 → #7601 → #8272 → #8078 → #8273 → #8079 → #8276. Every layer stays a draft until the one below it merges; review only the commits listed as new. The stack is rebased onto develop `b2d64c27c7` (#8235 merged at `6dee23aa4f`; #8274's test fix and #8264 since), so #8237 is the bottom layer. The layers above still carry this PR's commits in their pre-squash form, with the same tree, until each is restacked. New on top of develop: the seven commits below. With no snapshot loaded it changes no behaviour, and no snapshot can be loaded before #8078. ## What was done? 1. **`c04d41bdc7` refactor(llmq): stop writing the unused q_bbu2 best-block key.** `CQuorumBlockProcessor` wrote its last processed block to `q_bbu2` on every block; only `UpgradeDB()` read it, and that was removed in v20.1. 2. **`0867b0cdf1` refactor(evo): add EvoDB view tokens.** An immutable token (EvoDB, identity, generation, base). `CEvoDB::CurrentView()` resolves it to the transaction the calling thread holds open, otherwise the default identity, which belongs to the active chainstate. `ViewFor()` names the view of a given chainstate. Nothing uses the tokens yet, so behaviour is unchanged. 3. **`adf5ec4f13` feat(dbwrapper): report LevelDB iterator read errors.** LevelDB skips a table block that fails its checksum and reports the failure only through the iterator's status, so a walk that stops on `!Valid()` cannot tell the end of the data from records it never saw. `CDBIterator::HasError()` exposes that status. 4. **`7736bbeb74` refactor(validation): move the invalid-snapshot handler into a ChainstateManager method.** A pure move, so the next commit can call it from the chainstate boundary. 5. **`5bb5947148` refactor(validation): reject the snapshot when its Evo state disagrees with derived state.** `evo::SnapshotStateMismatchError` is Evo state a snapshot carries that disagrees with state this node derives itself. The chainstate boundary hands it to `ChainstateManager::HandleSnapshotStateMismatch`, which reverts to the background chainstate, discards the snapshot's EvoDB markers and shuts down, as a failed completion check does; completion now uses the same handler. `ConnectTip` rolls back the block's EvoDB transaction before it classifies the error, so a mismatch raised mid-connect can reject the snapshot. With no usable snapshot active, or with an EvoDB transaction still open, the block fails with the new `LocalEvoStateResult::MISMATCH` local error instead. A rejection raised while `ActivateBestChainStep` connects a block clears the disconnect pool of the transactions of the blocks it disconnected, as the rejected chainstate handed its mempool back. Nothing throws the new error until the next commit. 6. **`fed70e8c00` feat(evo): store snapshot-identity state in a generation namespace with journaled promotion.** - Snapshot-chainstate writes go to a per-generation key prefix, with no read fallback to NORMAL. - Rejecting a snapshot marks its generation in the same synced batch that discards the markers; the generation is collected once the snapshot's coins directory has been set aside, so a crash in between still finishes at startup. An earlier `chainstate_snapshot_INVALID` directory is kept. - Promotion after background validation is a journaled merge that resumes after a crash at any phase; after a crash between the coins renames and the merge, startup checks the generation's base height against the block index first. - Seeded keys are recorded in a manifest and never copied into NORMAL, which derives that state itself; where both hold a key, the records must be equal or the promotion fails. - Promotion, collection and generation loading check the iterator status before each key and at the end, and stop with their journal and records in place. - Startup refuses, before changing anything on disk, a promotion journal without its matching record (and the reverse), a live generation without its dual-chainstate marker, a base height that differs from the block index, and a generation of another schema version. - A snapshot in progress from a datadir that predates this change is detected, and startup suggests `-reindex-chainstate`. 7. **`1370095ea8` refactor(evo): check that tip-based Evo reads serve only the active chainstate** (knst). Adds `Assume(ReadsActiveView())` to the masternode list at the chain tip and to the mined-commitment lookup against the active chain. If a consensus path starts reading the tip again from inside another chainstate's transaction, debug and fuzz builds catch it. ## How Has This Been Tested? On Linux x86_64 (Debug, GCC 13, depends), this head builds and all 185 unit and utility test binaries pass (`ctest`). The same holds at every layer head from #8237 to #8272 and at #8078, and at the top of the stack the AssumeUTXO, InstantSend, ChainLock, pruning and invalidation functional tests pass. New tests are in `evo_db_tests` and `validation_chainstatemanager_tests`: rejection isolation with snapshot-written masternode-list, credit-pool and EHF records and NORMAL reconstruction after rejection and restart; promotion crash recovery at each phase, including an interrupt at every batch boundary; a promotion over a corrupt table block (refused, journal and generation kept); the startup refusals above; startup recovery of each interrupted directory rename, including a completed swap whose generation's base height disagrees with the block index (`chainstatemanager_snapshot_cleanup_recovers_completed_swap`). ## Breaking Changes None with a single chainstate. A datadir with a regtest snapshot chainstate in progress from before this change needs `-reindex-chainstate`. ## Checklist: - [x] I have performed a self-review of my own code - [x] I have added or updated relevant unit/integration/functional/e2e tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Top commit has no ACKs. Tree-SHA512: 85df0ba826154ce7be2929dd114c3f087b6ab1ba7c6e4f6b436bf7db3abeea42a2f7b207fb1d17d501ae4dd24339f2ef54ef8fa61d5399c2aa07d0755aaf05fe
80ad884 to
bf22d2d
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This head is a clean rebase that preserves the exact work-modifier and scan-coverage behavior, with the latest changes scoping test seeding and reads through the active transaction/view. No code checks have failed; lint, formatting, cppcheck, and cache checks pass, while several platform and source-build jobs remain in progress.
🟡 2 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Review-only fixup commits remain in the permanent history
Impact: The merged history exposes review corrections as standalone milestones, making git log, blame, and bisect harder to interpret.
<commit:fe0016f404c>:1
The current stack still contains standalone fixup! commits: fe0016f404c amends bcb13cd198d, and bf22d2dc819 amends fcf38a22b09. These commits only contain corrections to the preceding LLMQ changes, so readers see incomplete logical milestones followed by review patches. Autosquash each correction into its target before merging so every permanent commit is self-consistent.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general)
🟡 Suggestion: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Readers searching history for the changed RPC and membership behavior on ordinary pruned nodes can miss the user-visible breaking change.
<commit:bcb13cd198d>:1
The current subject remains fix(llmq): exact work modifiers and no silent degradation under the snapshot view, but the commit also removes the block-hash fallback in NORMAL, retains key-only quorums, and makes membership-dependent RPCs unavailable until a pruned work block returns. The body and release note describe this behavior, but the subject does not expose it to readers using git log or blame. Reword the subject to identify both snapshot-view and ordinary pruned-node behavior.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This is a large, intricate change that alters consensus-adjacent snapshot validation and ChainLock/asset-unlock scan behavior in files such as src/evo/snapshot.cpp and src/llmq/blockprocessor.cpp, including quorum/signature-related state resolution and failure handling. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); 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(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `<commit:fe0016f404c>`:
- [SUGGESTION] <commit:fe0016f404c>:1: Review-only fixup commits remain in the permanent history
Impact: The merged history exposes review corrections as standalone milestones, making git log, blame, and bisect harder to interpret.
The current stack still contains standalone `fixup!` commits: `fe0016f404c` amends `bcb13cd198d`, and `bf22d2dc819` amends `fcf38a22b09`. These commits only contain corrections to the preceding LLMQ changes, so readers see incomplete logical milestones followed by review patches. Autosquash each correction into its target before merging so every permanent commit is self-consistent.
In `<commit:bcb13cd198d>`:
- [SUGGESTION] <commit:bcb13cd198d>:1: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Readers searching history for the changed RPC and membership behavior on ordinary pruned nodes can miss the user-visible breaking change.
The current subject remains `fix(llmq): exact work modifiers and no silent degradation under the snapshot view`, but the commit also removes the block-hash fallback in NORMAL, retains key-only quorums, and makes membership-dependent RPCs unavailable until a pruned work block returns. The body and release note describe this behavior, but the subject does not expose it to readers using git log or blame. Reword the subject to identify both snapshot-view and ordinary pruned-node behavior.
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This rebase updates the surrounding Evo helpers without changing exact quorum work-modifier resolution or ChainLock and asset-unlock scan coverage, and the head merges cleanly with develop. ClangFormat and the current lint job passed; the earlier multiprocess lint and cache-pruning jobs were cancelled before running any steps, and build and test results remain pending.
🟡 2 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Operators scanning one-line commit history can miss that quorum membership RPCs now report unavailable data on ordinary pruned nodes when a required work block is missing.
<commit:7f34105f0e9>:1
The subject ends with “under the snapshot view,” but the change also affects nodes that have never loaded a snapshot. In NORMAL, GetQuorumModifierForWorkBlock no longer substitutes a block-hash modifier when the work block is pruned, and BuildQuorumFromCommitment keeps a key-only quorum instead of returning guessed members. The commit body and release note explain this; use a subject that also covers both views, such as fix(llmq): never guess missing work modifiers.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
🟡 Suggestion: Review-only fixup commits remain in the permanent history
Impact: If merged as-is, developers bisecting the LLMQ changes can land on intermediate commits that reference the removed EvoViewScope API.
<commit:2b749cc1864>:1
Neither LLMQ implementation commit is self-contained on the rebased stack. 7f34105f0e9 still uses EvoViewScope in its tests, and 4b238f9dbdd also uses it in SeedScanCoverage. The two trailing fixups replace those references with the existing ReadIn test helper and RequireTransactionView for seeding. Autosquash 2b749cc1864 into 7f34105f0e9 and b26f404d148 into 4b238f9dbdd before merging, so each commit carries its own API adaptation.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This is a large, intricate change to consensus-sensitive state and validation paths, including asset-unlock scanning and ChainLock/quorum handling in functions such as CheckScanCoverage and ProveScan in src/evo/snapshot.cpp and src/chainlock/handler.cpp. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); 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(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `<commit:7f34105f0e9>`:
- [SUGGESTION] <commit:7f34105f0e9>:1: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Operators scanning one-line commit history can miss that quorum membership RPCs now report unavailable data on ordinary pruned nodes when a required work block is missing.
The subject ends with “under the snapshot view,” but the change also affects nodes that have never loaded a snapshot. In NORMAL, `GetQuorumModifierForWorkBlock` no longer substitutes a block-hash modifier when the work block is pruned, and `BuildQuorumFromCommitment` keeps a key-only quorum instead of returning guessed members. The commit body and release note explain this; use a subject that also covers both views, such as `fix(llmq): never guess missing work modifiers`.
In `<commit:2b749cc1864>`:
- [SUGGESTION] <commit:2b749cc1864>:1: Review-only fixup commits remain in the permanent history
Impact: If merged as-is, developers bisecting the LLMQ changes can land on intermediate commits that reference the removed `EvoViewScope` API.
Neither LLMQ implementation commit is self-contained on the rebased stack. `7f34105f0e9` still uses `EvoViewScope` in its tests, and `4b238f9dbdd` also uses it in `SeedScanCoverage`. The two trailing fixups replace those references with the existing `ReadIn` test helper and `RequireTransactionView` for seeding. Autosquash `2b749cc1864` into `7f34105f0e9` and `b26f404d148` into `4b238f9dbdd` before merging, so each commit carries its own API adaptation.
|
This pull request has conflicts, please rebase. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (queue backlog)
New on this head: The PR adds exact quorum work-modifier resolution and proves ChainLock and asset-unlock scan coverage under the snapshot view. Since the prior review, the current head adds only test transaction-view updates and the VerifySig check-sigs argument; build and test jobs are skipped, ClangFormat checks remain queued, and the review check is still in progress.
🟡 2 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Review-only fixup commits remain in the permanent history
Impact: Maintainers and future debuggers must reconstruct the final behavior from standalone review patches instead of one coherent logical commit.
<commit:91b917b7a6b>:1
The current stack still ends with standalone fixup! commits: 91b917b7a6b amends the work-modifier implementation, while 0bcfb27d435 and 93c2e4ed30e amend the scan-coverage implementation. These changes only complete the substantive commits immediately before them, so leaving them separate makes git log, git blame, and git bisect show incomplete milestones followed by review-only corrections. Autosquash each fixup into its corresponding substantive commit before merging.
source: gpt-6.2-astra (phase2-reviewer: general)
🟡 Suggestion: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Operators and maintainers searching permanent history for changed quorum behavior on pruned nodes may miss that membership-dependent lookups remain unavailable until the work block is restored.
<commit:0f3f2764024>:1
The subject of 0f3f2764024 is framed around exact modifiers under the snapshot view, but the implementation also changes NORMAL behavior: it removes the block-hash fallback for pruned work blocks, retains key-only quorums, and makes membership-dependent lookups unavailable until the work block returns. The body and release note explain this behavior, but it is not discoverable from the subject in git log, blame, or release-history searches. Reword the subject to cover missing or pruned work blocks as well as snapshot-view modifier accuracy.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The large, intricate diff changes quorum member selection and work modifiers in src/llmq/utils.cpp and src/llmq/quorumsman.cpp, directly affecting quorum cryptographic key/member handling and ChainLock/asset-unlock signature processing. - Phase 1 reviewers: not run (skipped for throughput: 12 PRs queued, above the 10 limit)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `<commit:91b917b7a6b>`:
- [SUGGESTION] <commit:91b917b7a6b>:1: Review-only fixup commits remain in the permanent history
Impact: Maintainers and future debuggers must reconstruct the final behavior from standalone review patches instead of one coherent logical commit.
The current stack still ends with standalone `fixup!` commits: `91b917b7a6b` amends the work-modifier implementation, while `0bcfb27d435` and `93c2e4ed30e` amend the scan-coverage implementation. These changes only complete the substantive commits immediately before them, so leaving them separate makes `git log`, `git blame`, and `git bisect` show incomplete milestones followed by review-only corrections. Autosquash each fixup into its corresponding substantive commit before merging.
In `<commit:0f3f2764024>`:
- [SUGGESTION] <commit:0f3f2764024>:1: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Operators and maintainers searching permanent history for changed quorum behavior on pruned nodes may miss that membership-dependent lookups remain unavailable until the work block is restored.
The subject of `0f3f2764024` is framed around exact modifiers under the snapshot view, but the implementation also changes NORMAL behavior: it removes the block-hash fallback for pruned work blocks, retains key-only quorums, and makes membership-dependent lookups unavailable until the work block returns. The body and release note explain this behavior, but it is not discoverable from the subject in `git log`, blame, or release-history searches. Reword the subject to cover missing or pruned work blocks as well as snapshot-view modifier accuracy.
|
This pull request has conflicts, please rebase. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: The rebased head retains the exact LLMQ work-modifier and scan-coverage changes; the current-round commits only update test call sites for the VerifySig and EvoDB view API changes. ClangFormat, title, milestone, and metadata checks pass; build and test jobs are skipped or cancelled, while the review check remains in progress, with no failed code check reported.
🟡 2 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Operators and maintainers searching git history for the changed behavior on ordinary pruned nodes may miss that missing work blocks now leave quorums key-only and make membership RPCs unavailable.
<commit:125b5fec46a>:1
The permanent subject of 125b5fe still frames the change as exact modifiers under the snapshot view, although the commit also removes the block-hash fallback in NORMAL, retains key-only quorums, and changes membership behavior until a pruned work block returns. The body and release note explain the breaking behavior, but readers using git log, blame, or bisect will not find it from the subject; reword the subject to cover the missing-work-block or pruned-node behavior as well.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-sol (phase2-reviewer: dash-core-commit-history)
🟡 Suggestion: Review-only fixup commits remain in the permanent history
Impact: Readers of the permanent develop history see incomplete LLMQ milestones followed by review patches, making git bisect and git blame less self-contained.
<commit:d7e2fecd850>:1
The current stack still exposes three review-only corrections: d7e2fec is a fixup for the modifier change, while 32302a5 and b9deac4 are fixups for the scan-coverage feature. Each only adjusts the preceding LLMQ implementation or its tests and has no independent long-term purpose; autosquash d7e2fec into 125b5fe and 32302a5 plus b9deac4 into 581e2d9 before merging.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-sol (phase2-reviewer: dash-core-commit-history)
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: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — This is a large, cross-cutting change affecting snapshot storage, quorum calculations, ChainLock and asset-unlock scanning, RPC behavior, and extensive tests, but the diff does not directly change consensus rules, funds movement, cryptography, signature/key handling, peer-facing deserialization, or storage migrations. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); 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(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `<commit:125b5fec46a>`:
- [SUGGESTION] <commit:125b5fec46a>:1: The work-modifier subject hides the change for ordinary pruned nodes
Impact: Operators and maintainers searching git history for the changed behavior on ordinary pruned nodes may miss that missing work blocks now leave quorums key-only and make membership RPCs unavailable.
The permanent subject of 125b5fec46a still frames the change as exact modifiers under the snapshot view, although the commit also removes the block-hash fallback in NORMAL, retains key-only quorums, and changes membership behavior until a pruned work block returns. The body and release note explain the breaking behavior, but readers using git log, blame, or bisect will not find it from the subject; reword the subject to cover the missing-work-block or pruned-node behavior as well.
In `<commit:d7e2fecd850>`:
- [SUGGESTION] <commit:d7e2fecd850>:1: Review-only fixup commits remain in the permanent history
Impact: Readers of the permanent develop history see incomplete LLMQ milestones followed by review patches, making git bisect and git blame less self-contained.
The current stack still exposes three review-only corrections: d7e2fecd850 is a fixup for the modifier change, while 32302a5fa5c and b9deac40f32 are fixups for the scan-coverage feature. Each only adjusts the preceding LLMQ implementation or its tests and has no independent long-term purpose; autosquash d7e2fecd850 into 125b5fec46a and 32302a5fa5c plus b9deac40f32 into 581e2d9339d before merging.
|
This pull request has conflicts, please rebase. |
This force-push moves the PR onto #8286 and the new #7593. It keeps the two commits of the previous head Where each commit of the previous head went
The three fixups of the previous head are folded in. Reading the range-diff. Different on purpose
Tests. 13 of the 17 cases are carried over ( |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: The rebase moves exact quorum work modifiers and scan proofs onto chainstate-owned Evo state. It preserves the block-hash fallback for missing work blocks on genesis-derived chainstates and adds an export-and-load coverage check for ChainLock and asset-unlock scans. GitHub reports no failed code checks on this head; Linux, no-wallet, ASan, TSan, multiprocess, and lint checks passed.
🟡 5 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
3 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: A snapshot quorum cache hit can leave the background chainstate without a rotation quarter
Impact: Once seeded snapshots are loadable, background validation can skip storing a rotation quarter and compute the next cycle's members from incomplete history.
src/llmq/utils.cpp:757-762
The background chainstate can reach the next rotation cycle without the preceding quarter in its own EvoDB. The previous head partitioned both member caches by Evo view; the rebase replaced them with process-wide caches keyed only by quorum type and block hash or cycle/index. When the loader calls DryRunEvoSnapshot before the background chainstate has connected a carried cycle, the dry run fills those caches even though StoreSnapshotForBlock does not write that quarter to the background database. Later, ProcessBlock calls PreComputeQuorumMembers with reset_cache=false; either cache hit returns before the background manager can store the quarter. On the next cycle, ComputeQuorumMembersByQuarterRotation breaks at the missing quarter on genesis-derived state and builds from fewer quarters. The loader does not call the dry run on this head, so this is non-blocking here. Use the chainstate-owned caches already implemented by 28af321c618 in #8284 before enabling snapshot loading.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
🟡 Suggestion: A snapshot-backed masternode-list diff can report no ChainLock for a certified work block
Impact: If a snapshot node serves a diff that introduces a quorum whose certified work block is missing locally, the requester can receive a null signature instead of an unavailable-data response.
src/evo/smldiff.cpp:97-101
A successful quorum lookup no longer means the work-block coinbase is readable: this PR lets GetQuorum build members using a carried modifier. For a readable diff target whose new quorum references an absent pre-base work block, BuildQuorumChainlockInfo then independently calls GetNonNullCoinbaseChainlock, which returns nullopt on a missing body. The diff records a default signature and reports success. Before exposing this path, have the diff builder consult the owning chainstate's GetCoinbaseChainlock and decline UNAVAILABLE without scoring the peer, or retain the serving guard that refuses these requests while background validation is incomplete, as #8273 does. Neither requires changing the legacy answer for genesis-derived pruned nodes.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
🟡 Suggestion: The modifier commit says genesis-derived answers are unchanged when unreadable blocks now raise an error
Impact: A maintainer investigating BlockDataReadError on a node that has never loaded a snapshot can miss the commit that introduced it.
<commit:0558f4ef333>:1
The commit body says genesis-derived state keeps its answers, but the old reader returned nullopt when a work-block read failed and the modifier fell back to the block hash. The new reader raises BlockDataReadError if the block is still marked present, before checking FromSnapshot(). The commit's test expects that error in both chainstates. Narrow the wording: genesis-derived state keeps the block-hash fallback for a missing work block; a block marked present but unreadable is a read error in either chainstate.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The diff is large and intricate and changes consensus-critical quorum selection, ChainLock-derived work modifiers, mined-commitment lookups, snapshot persistence, and peer-facing signature/lock handling in files such as src/llmq/quorumsman.cpp, src/llmq/blockprocessor.cpp, and src/evo/snapshot.cpp. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); 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(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `src/llmq/utils.cpp`:
- [SUGGESTION] src/llmq/utils.cpp:757-762: A snapshot quorum cache hit can leave the background chainstate without a rotation quarter
Impact: Once seeded snapshots are loadable, background validation can skip storing a rotation quarter and compute the next cycle's members from incomplete history.
The background chainstate can reach the next rotation cycle without the preceding quarter in its own EvoDB. The previous head partitioned both member caches by Evo view; the rebase replaced them with process-wide caches keyed only by quorum type and block hash or cycle/index. When the loader calls `DryRunEvoSnapshot` before the background chainstate has connected a carried cycle, the dry run fills those caches even though `StoreSnapshotForBlock` does not write that quarter to the background database. Later, `ProcessBlock` calls `PreComputeQuorumMembers` with `reset_cache=false`; either cache hit returns before the background manager can store the quarter. On the next cycle, `ComputeQuorumMembersByQuarterRotation` breaks at the missing quarter on genesis-derived state and builds from fewer quarters. The loader does not call the dry run on this head, so this is non-blocking here. Use the chainstate-owned caches already implemented by `28af321c618` in #8284 before enabling snapshot loading.
- [SUGGESTION] src/llmq/utils.cpp:109: Each successful work-block read hashes the header twice
Impact: A node rebuilding quorum members performs a redundant X11 header hash for every work block read by the modifier resolver.
`ReadBlockFromDisk(block, block_pos)` already computes the header hash to check proof of work and returns it in an `std::optional<uint256>`. The rebased condition discards that result and hashes the header again. Compare the returned hash directly, as the previous head did; both a failed read and a mismatched hash still enter the pruning recheck.
In `src/instantsend/net_instantsend.cpp`:
- [SUGGESTION] src/instantsend/net_instantsend.cpp:149-153: InstantSend can drop valid locks after a live snapshot switch
Impact: After a live snapshot load, a node can drop a valid InstantSend lock while its background chainstate is still catching up, even though the active chainstate has the signing quorum.
The new local-state catch does not help when the lookup returns no quorum. On the rebased chainstate-owned stack, `init.cpp` passes `NetInstantSend` the quorum manager active at startup, and `SetActiveChainstate` does not rebind that reference. `BuildVerificationBatch` can then choose a signing start on the snapshot chain but look up the quorum in the background manager. If the background index has not reached the commitment, the lookup can return null and the batch marks the lock bad. Resolve the active manager for both lookup branches and capture it together with the signing start under `cs_main`. The per-call lookup in `138f902189a` on #8284 addresses the stale reference; capturing both together also keeps them consistent across the switch. This head does not expose live snapshot loading.
In `src/evo/smldiff.cpp`:
- [SUGGESTION] src/evo/smldiff.cpp:97-101: A snapshot-backed masternode-list diff can report no ChainLock for a certified work block
Impact: If a snapshot node serves a diff that introduces a quorum whose certified work block is missing locally, the requester can receive a null signature instead of an unavailable-data response.
A successful quorum lookup no longer means the work-block coinbase is readable: this PR lets `GetQuorum` build members using a carried modifier. For a readable diff target whose new quorum references an absent pre-base work block, `BuildQuorumChainlockInfo` then independently calls `GetNonNullCoinbaseChainlock`, which returns `nullopt` on a missing body. The diff records a default signature and reports success. Before exposing this path, have the diff builder consult the owning chainstate's `GetCoinbaseChainlock` and decline `UNAVAILABLE` without scoring the peer, or retain the serving guard that refuses these requests while background validation is incomplete, as #8273 does. Neither requires changing the legacy answer for genesis-derived pruned nodes.
In `<commit:0558f4ef333>`:
- [SUGGESTION] <commit:0558f4ef333>:1: The modifier commit says genesis-derived answers are unchanged when unreadable blocks now raise an error
Impact: A maintainer investigating `BlockDataReadError` on a node that has never loaded a snapshot can miss the commit that introduced it.
The commit body says genesis-derived state keeps its answers, but the old reader returned `nullopt` when a work-block read failed and the modifier fell back to the block hash. The new reader raises `BlockDataReadError` if the block is still marked present, before checking `FromSnapshot()`. The commit's test expects that error in both chainstates. Narrow the wording: genesis-derived state keeps the block-hash fallback for a missing work block; a block marked present but unreadable is a read error in either chainstate.
| llmq::CQuorumCPtr quorum; | ||
| try { | ||
| quorum = llmq_params.useRotation ? llmq::SelectQuorumForSigning(llmq_params, m_qman, id, pindex_start) | ||
| : m_qman.GetQuorum(llmq_params.type, islock->cycleHash); | ||
| } catch (const evo::LocalStateError& e) { |
There was a problem hiding this comment.
🟡 Suggestion: InstantSend can drop valid locks after a live snapshot switch
Impact: After a live snapshot load, a node can drop a valid InstantSend lock while its background chainstate is still catching up, even though the active chainstate has the signing quorum.
The new local-state catch does not help when the lookup returns no quorum. On the rebased chainstate-owned stack, init.cpp passes NetInstantSend the quorum manager active at startup, and SetActiveChainstate does not rebind that reference. BuildVerificationBatch can then choose a signing start on the snapshot chain but look up the quorum in the background manager. If the background index has not reached the commitment, the lookup can return null and the batch marks the lock bad. Resolve the active manager for both lookup branches and capture it together with the signing start under cs_main. The per-call lookup in 138f902189a on #8284 addresses the stale reference; capturing both together also keeps them consistent across the switch. This head does not expose live snapshot loading.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
| return std::nullopt; | ||
| } | ||
| } | ||
| if (!any) break; |
There was a problem hiding this comment.
nit: replace ret.size() < count to any
bool any{false};
for (size_t rank{0}; !any; ++rank) {
....
}
|
This pull request has conflicts, please rebase. |
…ot chainstate At or below its base a snapshot chainstate has no bodies of work blocks and only the newest mined commitments each scan sequence needs. Answering from what is there would silently compute other quorum members than the network. From v20 a quorum's score modifier comes from the ChainLock in its work block's coinbase. It now comes from the block when this node has it, otherwise from the value the snapshot carried, and a snapshot chainstate with neither raises WorkBlockModifierUnavailableError. Rotation quarter computation receives the modifier it already selected members with, so a rebuilt quarter indexes the same order, and a carried-only cycle missing an applicable quarter is reported unavailable instead of computing from fewer quarters. HasMinedCommitment() raises BlockDataUnavailableError for a quorum at or below the base unless headers and the carried sequences prove it was never mined, and a scan that comes up short raises it unless the sequence provably ends there, recorded per type by SeedScanCoverage() when the snapshot is seeded from the carried commitment counts, EvoSnapshotScanCoverage(). TraverseScanSequences() replays the scan order over the carried sequences. State derived from genesis keeps the block-hash modifier of a work block it does not have. A work block marked as stored that cannot be read raises BlockDataReadError in either kind of chainstate, where the modifier used to fall back to the block hash. work_block_modifiers_are_exact_in_a_snapshot_chainstate covers where the modifier comes from, and planner_follows_an_isolated_failed_dkg_index now checks that a missing carried quarter is unavailable. Co-authored-by: pasta <[email protected]>
A quorum scan resumes below the last cached result and builds what the commitment index returns, and in a snapshot chainstate that index below the base is only the carried history: a resumed or short scan could return fewer quorums than exist. A snapshot chainstate's manager instead proves the whole requested prefix from the original cutoff with ProveScan(), raising BlockDataUnavailableError when the carried sequences do not cover it, and caches only proven prefixes read on its own chainstate's chain. NormalizeScanStart() is the cutoff computation shared by both paths. The first block above the base needs two such scans answered from carried commitments alone: ChainLock verification and the asset-unlock quorum check. CheckEvoSnapshotScanCoverage() proves every scan the base's successor can make from the carried sequences; export and load apply it, and the exporter also checks the proven vectors against its complete commitment index. A scan that cannot be proven raises an error that is no std::exception, so the callers outside validation and RPC handle it where they call: InstantSend lock verification, recovered signature verification and its getdata lookup drop the item without scoring the peer, the coinbase ChainLock of a block notified after a snapshot was loaded is skipped, and the quorum lookups of the node interface report nothing. scan_proofs_agree_with_full_scans compares a proven scan with a scan over the complete commitment history, with and without rotation, and rotating_scan_counterexample_is_not_covered pins a rotating history whose short scan cannot be proven. The evo_snapshot_tests cases cover what a seeded Evo state proves, what is unavailable and never absent, and the gate at export and load. Co-authored-by: pasta <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: The rebased PR now consists of two substantive commits implementing snapshot-specific quorum modifier resolution and carried scan-coverage proofs, with the prior fixups folded in. Lint, cppcheck, and completed Linux, Windows, ARM, fuzz, and container builds succeeded; macOS, sanitizer, and test jobs were still in progress, while the completed code checks had no failures.
🟡 3 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: A snapshot-backed masternode-list diff can report no ChainLock for a certified work block
Impact: A snapshot-backed node serving getmnlistdiff or protx diff can return a default ChainLock signature for a post-v20 quorum whose work-block body is unavailable, producing an incomplete but apparently successful response.
src/evo/smldiff.cpp:97-101
The diff builder still stores a default-constructed signature whenever GetNonNullCoinbaseChainlock(blockman, pWorkBaseBlockIndex) returns std::nullopt. That helper returns null both for a genuinely pre-v20 block and when a post-v20 block body cannot be read. This PR makes the active quorum manager snapshot-backed after activation, so the missing-body case is reachable for historical work blocks carried only as snapshot metadata. Distinguish the known pre-v20 null certificate from unavailable post-v20 block data and return the existing block-data-unavailable sentinel without penalizing the requesting peer.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general)
🟡 Suggestion: A snapshot quorum cache hit can leave the background chainstate without a rotation quarter
Impact: When both chainstates are loaded, quorum membership computed from one Evo view can be returned to the other view, causing wrong members or suppressing the local-unavailable error for missing carried history.
src/llmq/utils.cpp:757-781
mapQuorumMembers and mapIndexedQuorumMembers remain process-static and are keyed only by quorum type plus block or cycle hash. The same block hashes exist in the background and snapshot histories, but their UtilParameters can expose different deterministic-masternode and carried-quarter histories. A snapshot lookup can therefore cache a carried-only result that a background lookup reuses, or a full-history result can mask the snapshot path's missing-quarter error. Include the Evo view/origin in the cache key or make these caches owned by the corresponding quorum manager or Evo chainstate.
source: muse-spark-1.3-contributor (phase1-reviewer: general)
Still open from earlier rounds (1)
- 🟡 Suggestion: InstantSend can drop valid locks after a live snapshot switch —
src/instantsend/net_instantsend.cpp:149-153(thread)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — This is a large, intricate change to quorum selection, ChainLock and asset-unlock scan coverage, signature verification, and snapshot-state lookups in consensus- and cryptography-sensitive code, particularly src/llmq/quorumsman.cpp and src/llmq/blockprocessor.cpp. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); 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(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— dash-core-commit-history (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `src/evo/smldiff.cpp`:
- [SUGGESTION] src/evo/smldiff.cpp:97-101: A snapshot-backed masternode-list diff can report no ChainLock for a certified work block
Impact: A snapshot-backed node serving `getmnlistdiff` or `protx diff` can return a default ChainLock signature for a post-v20 quorum whose work-block body is unavailable, producing an incomplete but apparently successful response.
The diff builder still stores a default-constructed signature whenever `GetNonNullCoinbaseChainlock(blockman, pWorkBaseBlockIndex)` returns `std::nullopt`. That helper returns null both for a genuinely pre-v20 block and when a post-v20 block body cannot be read. This PR makes the active quorum manager snapshot-backed after activation, so the missing-body case is reachable for historical work blocks carried only as snapshot metadata. Distinguish the known pre-v20 null certificate from unavailable post-v20 block data and return the existing block-data-unavailable sentinel without penalizing the requesting peer.
In `src/llmq/utils.cpp`:
- [SUGGESTION] src/llmq/utils.cpp:757-781: A snapshot quorum cache hit can leave the background chainstate without a rotation quarter
Impact: When both chainstates are loaded, quorum membership computed from one Evo view can be returned to the other view, causing wrong members or suppressing the local-unavailable error for missing carried history.
`mapQuorumMembers` and `mapIndexedQuorumMembers` remain process-static and are keyed only by quorum type plus block or cycle hash. The same block hashes exist in the background and snapshot histories, but their `UtilParameters` can expose different deterministic-masternode and carried-quarter histories. A snapshot lookup can therefore cache a carried-only result that a background lookup reuses, or a full-history result can mask the snapshot path's missing-quarter error. Include the Evo view/origin in the cache key or make these caches owned by the corresponding quorum manager or Evo chainstate.
In `src/instantsend/net_instantsend.cpp`:
- [SUGGESTION] src/instantsend/net_instantsend.cpp:149-153: InstantSend can drop valid locks after a live snapshot switch
(carried; thread: https://github.com/dashpay/dash/pull/8271#discussion_r4764237141)
Issue being fixed or feature implemented
At or below its base a snapshot chainstate has only the commitments and work-block data its snapshot carried. A quorum score modifier, a mined-commitment lookup or a quorum scan that reaches further would silently return a partial answer there, and the node would compute different quorum members than the network.
AssumeUTXO stack (merge in this order): #8286 and #7593 are merged; this PR is next, then #7601 → #8272 → #8078 → #8273 → #8079 → #8276. The whole stack is in #8284.
What was done?
Built on #8286 and #7593: each
Chainstateowns its Evo state, and a manager asks theevo::StateOriginof its own chainstate whether a height is at or below a snapshot base, so nothing here reads through an EvoDB view.WorkBlockModifierUnavailableError.HasMinedCommitment()and the mined-commitment scans raiseBlockDataUnavailableErrorat or below the base unless headers and the carried scan sequences prove the answer. Seeding records per type where each carried sequence provably ends (SeedScanCoverage()).ProveScan()and caches only proven prefixes.CheckEvoSnapshotScanCoverage()); the exporter also checks the proven vectors against its complete commitment index.std::exceptions, so the callers outside validation and RPC handle them where they call: InstantSend lock and recovered signature verification drop the item without scoring the peer, and the node interface reports nothing.State derived from genesis keeps the block-hash modifier of a work block the node does not have. A work block marked as stored that cannot be read is a
BlockDataReadErrorin either kind of chainstate, where the modifier used to fall back to the block hash.What to focus on: the coverage gate (
CheckScanCoverage) and which lookups now throw instead of degrading.How Has This Been Tested?
evo_snapshot_testsgets 10 cases on a seeded Evo state:work_block_modifiers_are_exact_in_a_snapshot_chainstate;missing_quarters_in_the_snapshot_view,uncarried_quorums_are_unavailable_not_absent,rotating_scans_never_return_a_short_vector;scans_prove_their_prefix_in_the_snapshot_view,carried_scans_answer_what_the_base_successor_reads,rotating_types_enabled_after_the_base_read_empty;scan_coverage_gates_export_and_load,chainlock_coverage_starts_at_the_certified_height,asset_unlocks_signed_by_the_previous_platform_quorum.planner_follows_an_isolated_failed_dkg_indexadditionally checks that a missing carried quarter is unavailable.llmq_blockprocessor_tests:scan_proofs_agree_with_full_scanscompares a proven scan with a scan over the complete commitment history, with and without rotation, androtating_scan_counterexample_is_not_coveredpins a rotating history whose short scan cannot be proven.Breaking Changes
None. The snapshot paths are not reachable until a snapshot carrying the section can be loaded, later in the stack.
Checklist: