Conversation
|
⛔ Final review complete — 2 blocking finding(s) (commit 6f720da) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 2 only (queue backlog)
Changes requested: 4 blockers
- Snapshot promotion can succeed after an EvoDB iterator read error —
src/evo/evodb.cpp:104-128(new)
Impact: A local LevelDB read or corruption error during promotion can leave the background EvoDB partially copied while the promotion marker still causes the node to adopt it. MergeSnapshotfails thread-safety-enabled builds —src/evo/evodb.cpp:107(new)
Impact: ASAN, TSAN, fuzz, multiprocess, and macOS source builds fail before producing binaries because the new promotion path violates the project's lock annotations.- The test Evo-chainstate factory fails thread-safety compilation —
src/test/util/setup_common.cpp:401-402(new)
Impact: ASAN, TSAN, fuzz, multiprocess, and macOS builds fail while compiling the test utilities because the factory callback's lock assertion is not understood across the erasedstd::functionboundary. - Runtime snapshot activation leaves network services bound to the background Evo state —
src/init.cpp:2325-2335(new)
Impact: After a node activates a snapshot throughloadtxoutset, incoming InstantSend locks and quorum data requests continue using managers stopped at the background chainstate's base and can be rejected or unavailable.
This change moves Evo-derived state into per-chainstate bundles and adds runtime AssumeUTXO activation across networks. CI has failed ASAN, TSAN, and macOS build checks on thread-safety diagnostics; cppcheck also fails on an unchanged pre-existing warning, while several other build checks remain in progress.
🔴 4 blocking | 🟡 1 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Review fixups remain as permanent commits in the branch history
Impact: The merged history leaves two explicit corrective commits attached to the same Evo-history feature, splitting its implementation and test corrections across review-cleanup commits.
<commit:86070815fba>:1
Commits 86070815fba and 7cc3b523d5e are both explicitly titled fixup! for 8750e75aae7 and only adjust that feature's implementation and functional coverage. Fold them into 8750e75aae7 or rewrite the feature commit with the final contents before merging so the permanent history contains independently meaningful commits.
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: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 4: 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 very large, cross-cutting change modifies consensus validation and peer-facing block/transaction processing in validation.cpp, validation.h, node/chainstate.cpp, and related Evo snapshot serialization and storage migration paths. - Phase 1 reviewers: not run (skipped for throughput: 12 PRs queued, above the 10 limit)
- Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- 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,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/evodb.cpp`:
- [BLOCKING] src/evo/evodb.cpp:104-128: Snapshot promotion can succeed after an EvoDB iterator read error
Impact: A local LevelDB read or corruption error during promotion can leave the background EvoDB partially copied while the promotion marker still causes the node to adopt it.
A failed iterator is treated as normal end-of-database because the loop only checks `Valid()`. If LevelDB stops iteration with an error, the code writes `EVODB_SNAPSHOT_PROMOTION` and returns success after copying only a prefix of the snapshot records; any earlier batches may already have been committed. On restart, the pending marker allows promotion to finish with incomplete derived Evo state. Check `it->HasError()` after the loop and refuse to write the promotion marker when it is set, leaving the operation retryable.
- [BLOCKING] src/evo/evodb.cpp:107: `MergeSnapshot` fails thread-safety-enabled builds
Impact: ASAN, TSAN, fuzz, multiprocess, and macOS source builds fail before producing binaries because the new promotion path violates the project's lock annotations.
The `MergeSnapshot` declaration only declares `!cs`, but the implementation's `LOCK2(cs, snapshot.cs)` also calls `MaybeCheckNotHeld(snapshot.cs)`. Clang therefore reports that the call requires the missing negative capability `!snapshot.cs`; the CI logs show this error at `src/evo/evodb.cpp:107` with `-Werror`. Represent both database mutexes consistently in the function's lock contract and verify all affected build configurations.
In `src/test/util/setup_common.cpp`:
- [BLOCKING] src/test/util/setup_common.cpp:401-402: The test Evo-chainstate factory fails thread-safety compilation
Impact: ASAN, TSAN, fuzz, multiprocess, and macOS builds fail while compiling the test utilities because the factory callback's lock assertion is not understood across the erased `std::function` boundary.
The lambda is assigned while `cs_main` is held, but `AssertLockHeld(::cs_main)` is checked in the lambda body after the callback has been type-erased into `std::function`; the analyzer cannot infer that every invocation is made under the required lock. CI reports `setup_common.cpp:402` as requiring exclusive ownership of `cs_main`. Move the assertion to a call site whose lock contract is visible to the analyzer, or otherwise express the callback's lock requirement without weakening the constructor's actual locking contract.
In `src/init.cpp`:
- [BLOCKING] src/init.cpp:2325-2335: Runtime snapshot activation leaves network services bound to the background Evo state
Impact: After a node activates a snapshot through `loadtxoutset`, incoming InstantSend locks and quorum data requests continue using managers stopped at the background chainstate's base and can be rejected or unavailable.
`SetActiveChainstate()` at `src/validation.cpp:6835` updates the active chainstate and active-Evo pointer, but the long-lived `NetInstantSend` and `NetQuorum` handlers constructed here retain references to `*chainman.ActiveEvo().qman`, `dmnman`, and `qsnapman` from startup. Their processing paths use those member references rather than resolving the current active Evo state, so runtime activation leaves them querying the background Evo managers, which do not derive the snapshot chain's post-base commitments. `CDSNotificationInterface` and `CGovernanceManager` have the same fixed-manager pattern. Rebind these services during the active-chainstate switch or make their per-operation accesses resolve through `ChainstateManager::ActiveEvo()` before exposing runtime snapshot activation.
In `<commit:86070815fba>`:
- [SUGGESTION] <commit:86070815fba>:1: Review fixups remain as permanent commits in the branch history
Impact: The merged history leaves two explicit corrective commits attached to the same Evo-history feature, splitting its implementation and test corrections across review-cleanup commits.
Commits `86070815fba` and `7cc3b523d5e` are both explicitly titled `fixup!` for `8750e75aae7` and only adjust that feature's implementation and functional coverage. Fold them into `8750e75aae7` or rewrite the feature commit with the final contents before merging so the permanent history contains independently meaningful commits.
a3613a3 to
d0ddc69
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 consolidates per-chainstate Evo ownership and adds mainnet/testnet AssumeUTXO pins while reverting temporary snapshot duty-gating changes. The CI snapshot shows regular and ARM64 builds passing, but the ASAN, TSAN, fuzz, macOS, and multiprocess Clang-based builds fail; the source test job remains in progress.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(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.
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: Clang builds fail because the Evo-diff repair callback captures an unused node
Impact: Every Clang configuration compiled with warnings as errors fails before producing a binary, including the ASAN, TSAN, fuzz, macOS, and multiprocess builds.
src/init.cpp:2660
The current head cannot build on these configurations: CI reports -Wunused-lambda-capture for the node capture at src/init.cpp:2660. During normal startup, the EvoDB repair callback now obtains both special_tx and dmnman through chainman.ActiveEvo(), so the callback no longer references node; the capture was left behind when commit bb533216696 changed those accesses. Remove node from the capture list.
[&chainman]
source: muse-spark-1.3-contributor (phase1-reviewer: general); 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); 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 large, intricate diff changes consensus validation and persistent chainstate/EvoDB snapshot storage in validation.cpp, node/chainstate.cpp, evo/snapshot.cpp, and related serialization paths, including peer-facing snapshot data handling and funds-related UTXO state. - 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)
- New since the last final review (
a3613a3f): 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. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
d0ddc69 to
cacf1d9
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 preserves the per-chainstate Evo-state design and differs from the previously reviewed implementation only by removing an unused lambda capture in src/init.cpp. Build, lint, cppcheck, and completed Linux, Windows, macOS, ARM64, fuzz, and nowallet checks pass; ASAN, TSAN, and multiprocess test jobs remain in progress.
🔴 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: 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 large, intricate diff changes consensus validation and snapshot/EvoDB storage migration paths in validation.cpp, node/chainstate.cpp, and evo/snapshot.cpp, directly affecting peer-facing block processing and persisted chainstate correctness. - 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. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
…_tx_count, Improve wallet RPC errors 9d2d9f7 rpc: Include assumeutxo as a failure reason of rescanblockchain 595edee test, assumeutxo: import descriptors during background sync d73ae60 rpc: Improve importdescriptor RPC error messages 27f99b6 validation: Don't assume m_chain_tx_count in GuessVerificationProgress 42d5d53 interfaces: Add helper function for wallet on pruning Pull request description: GuessVerificationProgress() can legitimately see a block without a transaction count, e.g. a wallet rescan below a snapshot base, so it returns 0 with a debug log instead of an Assume. importdescriptors and rescanblockchain name the assumeutxo background sync as the likely cause when blocks are unavailable. Dash adaptations: - 42d5d53 (Chain::getPruneHeight) is not ported: it needs GetPruneHeight() from bitcoin#29668, which this tree lacks. rescanblockchain therefore reports pruning whenever the node has pruned, as before; a node with a snapshot chainstate never prunes here, so the assumeutxo message is unaffected. - m_chain_tx_count is nChainTx in this tree; the log names dashd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… successful 52482cb test: Check datadir cleanup after assumeutxo was successful (Fabian Jahr) Pull request description: I noticed that the proper datadir cleanup after a successful restart of an assumutxo node does not seem to be covered in our tests. This is added here. ACKs for top commit: l0rinc: utACK 52482cb mabu44: Re-ACK 52482cb Prabhat1308: re-ACK [`52482cb`](bitcoin@52482cb) TheCharlatan: Re-ACK 52482cb Tree-SHA512: cc941afeba250050eaccf5112255d961253fec9b2683545454a0d2fbe4d542178394b301d169a9dd79edbf6b5d478d95282727dbb0aca96ee79d4cd1ff80f19b
… promoted bitcoin#33604 is not adopted. Before the restart that promotes a validated snapshot, Dash cannot disconnect below the base's carried Evo state, so downloading from such peers only stalls and churns the chain. bitcoin#29519's refusal, which keys on the snapshot base, already lasts until promotion here, because no snapshot base exists after the promoting restart. Its test is replaced by this one. The snapshot node, validated but not yet restarted, still reports its snapshot base in getchainstates. It refuses a peer whose more-work chain forks below the base, without an Evo state error, and keeps its tip. The restart promotes it, so getchainstates no longer reports a snapshot base, and it then reorgs to that chain below the old base, through the validated chainstate's Evo state. The fork is mined to a fresh address: with the mock time fixed, the usual address would rebuild the block just invalidated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bitcoin#29519's download refusal only covers FindNextBlocksToDownload. A chain forking below the snapshot base still reaches the snapshot chainstate's candidates when its blocks arrive another way (direct fetch of a short fork, submitblock, blocks already on disk) once their parents below the base are linked, which the background chainstate's progress provides. The snapshot chainstate then disconnected its blocks down towards the base until it stalled on Evo state below the base that it does not have, before or after background validation reached the base, and reconnected them. FindMostWorkChain now passes over candidates that do not descend from the base while the snapshot chainstate's chain contains it. They stay in setBlockIndexCandidates, and after the restart that promotes the snapshot there is no base and the node follows them. The test submits a more-work chain forking below the base to a snapshot node whose background chainstate has not reached the base, and to one that has validated it; both keep their tip without disconnecting a block. After the promoting restart the node downloads a block of that chain it has not seen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5cd5794 test: verify node state after restart in assumeutxo Pull request description: Replace the TODO after the restart during background sync with checks of the chainstates and of wallet loading, which still needs the blocks below the snapshot. Dash adaptations: - The pruned-node rows that use the same error helper are absent: a node does not load snapshots with -prune in this tree. - A blank line precedes the nested helper, for this tree's flake8 (E306). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o.py faa68ed test: Fix intermittent issue in wallet_assumeutxo.py Pull request description: -stopatheight may let a few more blocks through during shutdown. Sync the node to the pause height with submitblock instead of restarting it, and unload the wallets so the loading checks still apply. Dash adaptations: - setup_network() keeps its form; the pruned-node rows are absent, as for bitcoin#34286. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xo.py faf71d6 test: [refactor] Use verbosity=0 named arg 99996f6 test: Fix intermittent issue in feature_assumeutxo.py Pull request description: Sync n1 to the pause height with submitblock instead of a -stopatheight restart, which could stop a few blocks later than expected. Dash adaptations: - The blockfile segmentation checks between the two hunks are absent, as the segmentation is not part of this tree (bitcoin#27596's commit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mainnet at height 2579482 and testnet at height 1599687, each with the UTXO set hash, the v4 evo section hash, the chain transaction count and the base block hash of a dumptxoutset run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…twork With pinned snapshots for mainnet and testnet, loadtxoutset is useful outside regtest. Drop the regtest-only guards of loadtxoutset and getchainstates and list them, together with dumptxoutset, in the blockchain category instead of hiding them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…testnet Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validation reads the evo snapshot section when it loads and completes a snapshot, which adds two include cycles through evo/snapshot; they are listed as expected. Also drops a duplicate include.
This reverts commit 8010353. A masternode refuses to start with a snapshot chainstate until a restart has promoted it, and snapshot activation refuses a masternode, so DKG participation and quorum signing never run beside an unvalidated snapshot: the production gate, its RPC error and the masternode status field are dead code.
…ion is incomplete" This reverts commit 7230da6 (dashpay#8049), together with the phase abort dashpay#7456 put in WaitForNextPhase for the same case. A masternode refuses to start with a snapshot chainstate until a restart has promoted it, and snapshot activation refuses a masternode, so the DKG phase threads never run beside an unvalidated snapshot and both gates are dead code.
…shot chainstate The unit tests of the evo section stopped at its encoding. These cover what a section must carry and what is refused (planned quarters, modifiers and bootstrap sets, the credit window, the base coinbase and its ChainLock, the MNHF record, scan coverage), what a snapshot chainstate answers below its base (unavailable, never absent or guessed), every field only the completion rebuild can catch, local failures at completion, and stalls on state the snapshot does not carry. The scenarios are pasta's, from the stack this one replaces, moved onto fixtures that seed a chainstate's own Evo state. Co-authored-by: pasta <pasta@dashboost.org>
… node feature_assumeutxo_dash.py compared the importer's masternode lists and quorums with its own other answers only. Compare them with a fully synced node at four points of the snapshot's life (above the base, with the background part-way, validated but unpromoted, and promoted), and let the promoted node rejoin the network: it verifies a lock signed after the load and mines a block the network ChainLocks.
b331924 to
6f720da
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Changes requested: 2 blockers
- The published mainnet and testnet checksums identify files the new loader cannot read —
doc/design/assumeutxo.md:15-19(thread, carried)
Impact: An operator following the documented download instructions cannot verify and load a snapshot matching either published file checksum. - A truncated snapshot marker prevents startup even with reindex enabled —
src/init.cpp:2018-2019(thread, carried)
Impact: After an interrupted snapshot-marker write, an operator cannot recover with either-reindexor-reindex-chainstatewithout manually repairing the datadir.
New on this head: This head is the rebased per-chainstate AssumeUTXO/Evo implementation, with the retained snapshot tests and the newly merged wallet operator-key behavior interacting with background-chainstate notifications. All completed build, test, lint, Cppcheck, and platform checks succeeded; multiprocess lint remains in progress.
🔴 2 blocking | 🟡 7 suggestion(s)
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: The snapshot-section commit does not explain its change to deployment lookups
Impact: A maintainer tracing versionbits behavior cannot tell from the commit message why a snapshot-builder commit changes deployment-state evaluation.
<commit:4c494abf498>:1
The commit changes GetStateFor() so always-active and never-active deployments return before SignalHeight() reads the EHF signal record, but its message only describes building, validating, seeding, and dry-running the snapshot section. Explain that this lookup ordering is required so constant deployments do not require an MNHF signal record on a chainstate with limited history, or split the behavior change into a separately described commit.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
🟡 Suggestion: Two extracted AssumeUTXO tests fail at the commits that introduce them
Impact: A maintainer bisecting the series encounters failing functional tests at two intermediate commits even though the final head passes.
<commit:b1257ab920e>:1
At b1257ab920e, the duplicate-load test expects a detailed reason that this revision's RPC does not yet return; the RPC still returns only Unable to load UTXO snapshot followed by the path. At 3fc3af6e2c9, the less-work test reads self.pin before authorize_snapshot() assigns that attribute in a23fe5be835. Make each test use only the error surface and fixture state available at the commit that introduces it.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
Still open from earlier rounds (7)
- 🟡 Suggestion: Devnet returns a generic RPC error for snapshots from a recognized network —
src/node/utxo_snapshot.h:88-93(thread) - 🟡 Suggestion: Correcting an Evo pin before restart can let stale snapshot records pass validation —
src/validation.cpp:7437-7440(thread) - 🔴 Blocking: The published mainnet and testnet checksums identify files the new loader cannot read —
doc/design/assumeutxo.md:15-19(thread) - 🟡 Suggestion: A Platform quorum lookup can use the old EvoDB with the new snapshot tip —
src/node/interfaces.cpp:741-744(thread) - 🔴 Blocking: A truncated snapshot marker prevents startup even with reindex enabled —
src/init.cpp:2018-2019(thread) - 🟡 Suggestion: A snapshot node can compute different members for the same quorum after its work block arrives —
src/llmq/utils.cpp:654-658(thread) - 🟡 Suggestion: A wrong carried credit balance can override the balance in a downloaded block —
src/evo/creditpool.cpp:374-380(thread)
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 restored wallet can reissue a rotated operator key even after background sync finishes
Impact: A wallet restored from a mnemonic during snapshot sync can issue an operator key index that was already assigned and rotated away below the snapshot base.
src/wallet/wallet.cpp:1683-1687
blockConnected() returns immediately for ChainstateRole::BACKGROUND, so it skips AdvanceOperatorKeyCounter() for provider transactions in the background history. This matters for a controller wallet loaded before loadtxoutset: a key in its lookahead window may have been assigned in the history that the background chainstate later downloads, while the tip masternode list no longer contains that rotated key. Promotion does not replay those background blocks, so getnewoperatorkey can issue the old index after completion. Preserve the background early return for wallet balances and tip tracking, but inspect provider transactions under cs_wallet and advance the operator-key counter before returning.
source: 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 large, intricate diff changes consensus validation and snapshot/storage serialization, including peer-facing quorum and AssumeUTXO state handling in files such as src/validation.cpp, src/evo/snapshot.cpp, and src/evo/snapshot_chain.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)
- New since the last final review (
b3319246): 1 suggestion(s) on unchanged code listed as follow-up candidates - 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:4c494abf498>`:
- [SUGGESTION] <commit:4c494abf498>:1: The snapshot-section commit does not explain its change to deployment lookups
Impact: A maintainer tracing versionbits behavior cannot tell from the commit message why a snapshot-builder commit changes deployment-state evaluation.
The commit changes `GetStateFor()` so always-active and never-active deployments return before `SignalHeight()` reads the EHF signal record, but its message only describes building, validating, seeding, and dry-running the snapshot section. Explain that this lookup ordering is required so constant deployments do not require an MNHF signal record on a chainstate with limited history, or split the behavior change into a separately described commit.
In `<commit:b1257ab920e>`:
- [SUGGESTION] <commit:b1257ab920e>:1: Two extracted AssumeUTXO tests fail at the commits that introduce them
Impact: A maintainer bisecting the series encounters failing functional tests at two intermediate commits even though the final head passes.
At `b1257ab920e`, the duplicate-load test expects a detailed reason that this revision's RPC does not yet return; the RPC still returns only `Unable to load UTXO snapshot ` followed by the path. At `3fc3af6e2c9`, the less-work test reads `self.pin` before `authorize_snapshot()` assigns that attribute in `a23fe5be835`. Make each test use only the error surface and fixture state available at the commit that introduces it.
In `src/node/utxo_snapshot.h`:
- [SUGGESTION] src/node/utxo_snapshot.h:88-93: Devnet returns a generic RPC error for snapshots from a recognized network
(carried; thread: https://github.com/dashpay/dash/pull/8284#discussion_r4756075270)
In `src/validation.cpp`:
- [SUGGESTION] src/validation.cpp:7437-7440: Correcting an Evo pin before restart can let stale snapshot records pass validation
(carried; thread: https://github.com/dashpay/dash/pull/8284#discussion_r4756075261)
In `doc/design/assumeutxo.md`:
- [BLOCKING] doc/design/assumeutxo.md:15-19: The published mainnet and testnet checksums identify files the new loader cannot read
(carried; thread: https://github.com/dashpay/dash/pull/8284#discussion_r4756075225)
In `src/node/interfaces.cpp`:
- [SUGGESTION] src/node/interfaces.cpp:741-744: A Platform quorum lookup can use the old EvoDB with the new snapshot tip
(carried; thread: https://github.com/dashpay/dash/pull/8284#discussion_r4752258815)
In `src/init.cpp`:
- [BLOCKING] src/init.cpp:2018-2019: A truncated snapshot marker prevents startup even with reindex enabled
(carried; thread: https://github.com/dashpay/dash/pull/8284#discussion_r4752258750)
In `src/llmq/utils.cpp`:
- [SUGGESTION] src/llmq/utils.cpp:654-658: A snapshot node can compute different members for the same quorum after its work block arrives
(carried; thread: https://github.com/dashpay/dash/pull/8284#discussion_r4744681926)
In `src/evo/creditpool.cpp`:
- [SUGGESTION] src/evo/creditpool.cpp:374-380: A wrong carried credit balance can override the balance in a downloaded block
(carried; thread: https://github.com/dashpay/dash/pull/8284#discussion_r4744681921)
…credit window and base coinbase e124bf4 fix(versionbits): do not read EHF signals for a deployment that is always or never active (Konstantin Akimov) 307b2d2 fix(evo): carry the snapshot's masternode ids into the validating chainstate's at promotion (Konstantin Akimov) b848fc3 evo: build, validate and seed the evo snapshot section against the chain (Konstantin Akimov) 388708e llmq: expose the score modifier a v20 work block gives (Konstantin Akimov) 987a692 llmq: seed carried mined commitments and report unreadable index entries (Konstantin Akimov) 53c1dee dbwrapper: expose read errors of a transaction iterator (Konstantin Akimov) fdefa7b feat(evo): carry the header-proven base coinbase and use it for B+1 ChainLock checks (Konstantin Akimov) edfa844 feat(evo): carry and consume the credit-pool window (Konstantin Akimov) ffe3cbc llmq: carried quorum snapshots and modifiers of a snapshot chainstate (Konstantin Akimov) ba67475 evo: v4 evo snapshot section (Konstantin Akimov) 5d5f5a9 partial Merge bitcoin#31197: refactor: mining interface 30955 followups (Konstantin Akimov) e5d407e partial Merge bitcoin#30955: Mining interface: getCoinbaseMerklePath() and submitSolution() (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented A snapshot chainstate has no Evo history at or below its base, so the snapshot must carry the Evo state the next blocks need: the masternode list, quorums and their rotation dependencies, the credit-pool window, the base coinbase for the ChainLock check of the block after the base, and the MNHF signals. This PR defines that v4 Evo section and how it is built from a chain, checked against the headers and seeded into a snapshot chainstate; #7601 wires it into `dumptxoutset` and loading. **AssumeUTXO stack** (merge in this order): #8286 → #7593 → #8271 → #7601 → #8272 → #8078 → #8273 → #8079 → #8276. The whole stack is in #8284. ## What was done? Rebuilt on #8286: each `Chainstate` owns its Evo state, and `evo::StateOrigin` tells a manager whether its state was derived from genesis or seeded from a snapshot, so nothing here reads through an EvoDB view. 1. **partial bitcoin#30955** and 2. **partial bitcoin#31197.** `TransactionMerklePath()` moves from `merkle_tests.cpp` into `consensus/merkle`, for the merkle branch of the base coinbase. Only the `consensus/merkle` and `merkle_tests` hunks are ported: the rest of both PRs is the Mining interface, which Dash does not have. 3. **evo: v4 evo snapshot section.** Per LLMQ type the section adds the bootstrap work blocks of the base's cycle and the next one, and it carries the base coinbase with its merkle branch and the credit-pool window ending at the base. Masternodes are numbered by the rank of their proTxHash, because a node's internal ids depend on its history; `CanonicalMNListHash()` covers neither the ids nor the registration counter. 4. **llmq: carried quorum snapshots and modifiers of a snapshot chainstate.** A rotation quarter recomputed at or below the base is checked against the carried one and never stored; a cycle missing its quarter is reported as locally unavailable. 5. **feat(evo): carry and consume the credit-pool window.** At or below the base the pool reads the carried window entries, so asset-unlock limits above the base need no block bodies below it. 6. **feat(evo): carry the header-proven base coinbase and use it for B+1 ChainLock checks.** `CheckCbTxBestChainlock()` and the miner read the parent's ChainLock through `GetCoinbaseChainlock()`, which answers from the carried base coinbase and reports any other block a snapshot chainstate lacks as unavailable. The ChainLock the check remembers moves from a function static into the chainstate's processor. 7. **dbwrapper: expose read errors of a transaction iterator**, 8. **llmq: seed carried mined commitments and report unreadable index entries**, 9. **llmq: expose the score modifier a v20 work block gives.** What the exporter and seeding need from the commitment index and the modifier calculation. 10. **evo: build, validate and seed the evo snapshot section against the chain.** `BuildEvoSnapshot()` derives the section from the chain, `ValidateEvoSnapshotAgainstChain()` and `PreflightEvoSnapshot()` check it against the headers, `SeedEvoSnapshotState()` writes it into a snapshot chainstate. 11. **fix(evo): carry the snapshot's masternode ids into the validating chainstate's at promotion.** Promotion rewrites the snapshot chainstate's lists and diffs to the ids of the list the background chainstate derived at the base, and fails when it cannot read the snapshot chainstate's base list. 12. **fix(versionbits): do not read EHF signals for a deployment that is always or never active.** Such a deployment's state is fixed by its parameters, so `GetStateFor()` answers before it asks for the signal record of a block. **What to focus on:** the section's validation rules (`EvoSnapshot::Validate`, `ValidateEvoSnapshotAgainstChain`) and the size caps on decoding. ## How Has This Been Tested? `evo_snapshot_tests` gets 24 cases. Two pin the format (`populated_v4_golden_value`, `base_coinbase_codec_bounds`). The others build a section from a mined chain, check it against the headers and seed it into an empty Evo state: the `planner_*` cases cover the carried rotation quarters and bootstrap work blocks, `chain_validation_*` the exact planned sets, `credit_window_*` the pool above the base, `base_coinbase_*` the header proof and the ChainLock of the block after the base, `mnhf_*` the signal record, and `constant_ehf_deployments_never_read_signals` the versionbits fix. `merkle_tests` uses the moved `TransactionMerklePath()`. ## Breaking Changes None with a single chainstate. Nothing here is reachable until a snapshot carrying the section can be loaded, later in the stack. ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(if you have permission to set one)_ Top commit has no ACKs. Tree-SHA512: 77ebc7230f34ced023e68b0d370f8b699d7c48a10819687f4c8e6feb4c568d3e8b2c939a4ec3dbcc04a45590a4c2e61538de68a549fb1109ca00b9325b411c75
|
This pull request has conflicts, please rebase. |
…r the snapshot view cb75188 feat(llmq): prove ChainLock and asset-unlock scan coverage (Konstantin Akimov) 302da3d fix(llmq): exact work modifiers and no silent degradation in a snapshot chainstate (Konstantin Akimov) Pull request description: ## 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 `Chainstate` owns its Evo state, and a manager asks the `evo::StateOrigin` of its own chainstate whether a height is at or below a snapshot base, so nothing here reads through an EvoDB view. 1. **fix(llmq): exact work modifiers and no silent degradation in a snapshot chainstate.** - From v20 a quorum's score modifier comes from the ChainLock in its work block's coinbase. It is read from the block when the node has it, otherwise from the value the snapshot carried; a snapshot chainstate with neither raises `WorkBlockModifierUnavailableError`. - Rotation quarter computation receives the modifier its members were selected with, and a carried-only cycle missing an applicable quarter is reported unavailable instead of computing from fewer quarters. - `HasMinedCommitment()` and the mined-commitment scans raise `BlockDataUnavailableError` at 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()`). 2. **feat(llmq): prove ChainLock and asset-unlock scan coverage.** - The quorum manager of a snapshot chainstate proves the whole requested prefix of a scan from the original cutoff with `ProveScan()` and caches only proven prefixes. - Export and load prove every ChainLock and asset-unlock scan the base's successor can make from the carried sequences (`CheckEvoSnapshotScanCoverage()`); the exporter also checks the proven vectors against its complete commitment index. - These errors are not `std::exception`s, 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 `BlockDataReadError` in 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_tests` gets 10 cases on a seeded Evo state: - where a modifier comes from: `work_block_modifiers_are_exact_in_a_snapshot_chainstate`; - what is unavailable and never absent: `missing_quarters_in_the_snapshot_view`, `uncarried_quorums_are_unavailable_not_absent`, `rotating_scans_never_return_a_short_vector`; - what the carried sequences prove: `scans_prove_their_prefix_in_the_snapshot_view`, `carried_scans_answer_what_the_base_successor_reads`, `rotating_types_enabled_after_the_base_read_empty`; - the gate: `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_index` additionally checks that a missing carried quarter is unavailable. `llmq_blockprocessor_tests`: `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. ## Breaking Changes None. The snapshot paths are not reachable until a snapshot carrying the section can be loaded, later in the stack. ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(if you have permission to set one)_ Top commit has no ACKs. Tree-SHA512: 50cbcc4e09e9249e66c7ce7ac3ab2fda4f7be9659c5aee50ae6bb37e227409f986687ccda56408a803c3bb3df90242c9188277f3096fdcbe1914efcd85899511
…ching evo pin 55166ae fix(llmq): keep computed quorum members per chainstate (Konstantin Akimov) 68f6de1 feat(validation): require a matching evo pin; add regtest -assumeutxodata (pasta) 618a159 feat(rpc): emit the v4 evo section in dumptxoutset (pasta) aef312d partial Merge bitcoin#33026: test, refactor: Embedded ASMap [1/3]: Selected minor preparatory work (Konstantin Akimov) f79cb87 partial Merge bitcoin#26606: wallet: Implement independent BDB parser (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented #7593 defines the v4 evo section and #8271 makes its coverage provable, but nothing writes the section, and a loading node has no way to tell whether the Evo state a file carries is the one that was reviewed. A snapshot of a Dash chain is useless without that state: a chainstate at a DIP3-active base cannot validate the blocks above it from coins alone. **AssumeUTXO stack** (merge in this order): #8286, #7593 and #8271 are merged; this PR is next, then #8272 → #8078 → #8273 → #8079 → #8276. The whole stack is in #8284. ## What was done? Built on #8286, #7593 and #8271: each `Chainstate` owns its Evo state, so `dumptxoutset` builds the section from the dumped chainstate's own managers and nothing here reads through an EvoDB view. 1. **partial bitcoin#26606** (`ca18aea5c4` only) and **partial bitcoin#33026** (`b7af960eb8`, `7f318e1dd0`): `AutoFile::seek()`, `tell()` and `size()`, which the snapshot loader needs to tell whether anything follows the coins. `seek()` and `tell()` use `FileSeek64()`/`FileTell64()` like the rest of `AutoFile` in Dash. Not ported: the BDB wallet parser of bitcoin#26606, and the asmap and `wallet/migrate.cpp` parts of bitcoin#33026. 2. **feat(rpc): emit the v4 evo section in dumptxoutset.** - `dumptxoutset` builds the section at the same `cs_main`-pinned point as the coins cursor, checks it against the chain (`PreflightEvoSnapshot()`; load does not run this check until #8272 seeds the section), appends it after the last coin as `[marker][EvoSnapshot]` and reports a summary of it in a new `evo` object. - A base the section cannot represent, or a section failing those checks, is an RPC error. So is dumping while an unvalidated snapshot chainstate is active, which lacks the history below its base (`EnsureEvoHistoryAvailable()`). - Snapshot load decodes a trailing section and requires it to end the file. It reads through `evo::EvoSnapshotFileReader`, which reports the bytes left in the file: the section's bit-set decoders bound declared sizes by that (`SizedStream`), and upstream's `AutoFile::size()` is the size of the whole file. A UTXO-only file still loads. - Completion of a snapshot with DIP3 active at its base returns the new `SnapshotCompletionResult::EVO_DATA_UNAVAILABLE`: nothing compares the section yet, so the snapshot stays in use, unvalidated, and is never promoted. Startup treats that result like a skipped completion. 3. **feat(validation): require a matching evo pin; add regtest -assumeutxodata.** - A DIP3-active base requires the section and a non-null pinned evo hash that the decoded section matches; a non-null pin requires a section. A pre-DIP3 UTXO-only snapshot loads as before. - The pin comes only from chainparams or, on regtest, from the hidden `-assumeutxodata=<height>:<hash_serialized>:<evo_hash>:<nchaintx>:<blockhash>`. Each such entry is bound to its base block, and the option authorizes nothing on other networks. 4. **fix(llmq): keep computed quorum members per chainstate.** `GetAllQuorumMembers()` cached members in process-wide statics, and computing them is also what stores a rotation cycle's quarters in the EvoDB. Members one chainstate computed made the other skip the computation, and with it the write. The caches now belong to each chainstate's `CQuorumSnapshotManager`. **Not a complete lifecycle on its own.** The decoded section is checked against its pin and then dropped; #8272 seeds it into the snapshot chainstate and compares it at completion, and until then a DIP3-active snapshot is never validated. Only C++ tests can activate a snapshot at this layer: `loadtxoutset` arrives later in the stack. **Two new include cycles.** `validation` now includes `evo/snapshot` to decode the section, which adds two expected entries to `lint-circular-dependencies.py`: `evo/creditpool -> validation -> evo/snapshot -> evo/creditpool` and `evo/snapshot -> llmq/commitment -> validation -> evo/snapshot`. The only new edge is `validation -> evo/snapshot`; the other two are old. `evo/creditpool` and `llmq/commitment` include `validation.h` only to reach consensus params, the block manager and the notifications through a `ChainstateManager`, plus one V24 deployment check in `creditpool` that needs its versionbits cache. Plan: pass those pieces in directly, `llmq/commitment` first, as a separate refactoring PR; the V24 check goes away when V24 is buried. That removes these two cycles together with the existing ones through the same two edges. **What to focus on:** the pin rules in `PopulateAndValidateSnapshot()` and the format of `-assumeutxodata`. ## How Has This Been Tested? - `feature_assumeutxo_dash.py` (new) dumps a rotating-quorum chain at a base before its own cycle's mining window and at the block before the next cycle. It checks the carried rotation cycles and bootstrap work entries against the dependency rule, the credit-pool window length, the base coinbase, that the reported hash is the SHA256 of the section bytes in the file, and that a second node at the same tip dumps the same section. - `validation_chainstatemanager_tests`: `chainstatemanager_evo_snapshot_requires_its_pin` (new, on the new `EvoSnapshotTestSetup`, a deterministic DIP3/v20 chain with four masternodes) refuses a base without an entry, a null pin, a pin bound to another block, a missing section, a section differing from its pin, a byte after the section and a partial marker after the coins, each checked by its log message; the honest snapshot activates and, with background validation already at the base, is not validated (`EVO_DATA_UNAVAILABLE`). - `validation_tests`: `assumeutxodata_option` (new) checks a parsed entry, that the built-in entries stay, that the option authorizes nothing on mainnet and testnet, and seven malformed or duplicate values. - `streams_tests`: the upstream `AutoFile::size()` checks in `xor_file` and the case `size_preserves_position` come with the backport. - `rpc_dumptxoutset.py` follows the new file hash and checks the `evo` summary of a pre-DIP3 dump. The per-chainstate member caches have no test of their own here: two chainstates computing the same cycle are first reachable in #8272. ## Breaking Changes The file `dumptxoutset` writes now ends with the evo section, and its result has a new `evo` object. No such file can be loaded on mainnet or testnet: no network pins an evo hash until #8276. ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(if you have permission to set one)_ ACKs for top commit: knst: utACK 55166ae Tree-SHA512: 16d7c76698806f5f43f124dacdbc228627c10d7898314dbceb813353c3913ff04dc55a706873ac27c7e6c23787bd6a243d2c6364e9aa32b11a99ff5fbd9d842a
…t at completion 15996de fix(validation): keep snapshot cleanup and completion's local-failure path on read errors (pasta) 9772cb7 feat(validation): rebuild and compare the full evo section at completion (pasta) 26d1985 fix(validation): keep the validated chainstate's block candidates when a snapshot is rejected (pasta) 862f00e feat(validation): seed the evo section into the snapshot chainstate (pasta) Pull request description: # Issue being fixed or feature implemented After #7601 a snapshot's evo section is checked against its pin and then dropped: a snapshot chainstate at a DIP3-active base has none of the Evo state the blocks above its base need, and such a snapshot is never validated. The section has to be loaded into the snapshot chainstate, and background validation has to confirm that it is what the node derives itself. **AssumeUTXO stack** (merge in this order): #8286, #7593, #8271 and #7601 are merged, then this PR → #8078 → #8273 → #8079 → #8276. The whole stack is in #8284. ## What was done? Built on #8286, #7593, #8271 and #7601: each `Chainstate` owns its Evo state, so the section is seeded into the snapshot chainstate's own EvoDB and a rejected snapshot takes that EvoDB with it. There is no unpublished generation and nothing to publish or roll back. 1. **feat(validation): seed the evo section into the snapshot chainstate.** - Loading writes the pinned section into the snapshot chainstate's EvoDB through each manager's seeding entry point (`SeedEvoSnapshotState()`), then runs the chain checks export runs (`PreflightEvoSnapshot()`), reading deployment state at or below the base from the carried signal record. - Before activation a dry run (`DryRunEvoSnapshot()`) computes from the seeded state alone every quorum the chainstate may need at or right after the base. Any failure rejects the snapshot. - The shared block index is changed only after these checks, so a refused section leaves it as it was. A load that throws is cleaned up like a refused one before the exception is passed on. - An unpinned section before DIP3 carries nothing needed and is ignored. - The comparison of the serialized masternode list at completion is removed, with `GetDeterministicMNListHash()`. A snapshot numbers its masternodes by the rank of their proTxHash and a chainstate by registration order, so with a seeded list the two serializations differ even when they agree on every masternode. 2. **fix(validation): keep the validated chainstate's block candidates when a snapshot is rejected.** The rejection makes the background chainstate active, but its candidates held only the base and its ancestors, so the next `CheckBlockIndex()` aborted. Inherited from bitcoin#25740; Bitcoin Core still has it. 3. **feat(validation): rebuild and compare the full evo section at completion.** - When background validation reaches the base, completion rebuilds the whole section from the background chainstate's Evo state (`BuildEvoSnapshot()`) and requires its hash to be the pinned one. This replaces the gate of #7601 that never validated a DIP3-active snapshot. - A disagreement rejects the snapshot (`EVO_STATE_MISMATCH`). Data the background chainstate still lacks leaves the snapshot in use, unvalidated (`EVO_DATA_UNAVAILABLE`). Unreadable or inconsistent local state, or an internal error, stops the node and keeps the snapshot (the new `EVO_LOCAL_FAILURE` and `EVO_INTERNAL_ERROR`); `SnapshotCompletionStopMessage()` tells the operator how to recover, at completion and at startup. - An EvoDB whose best block is not its chainstate's coins tip is such a local failure now; it used to reject the snapshot. **What to focus on:** the order of seeding, preflight and dry run in `PopulateAndValidateSnapshot()`, and how completion classifies a failed rebuild. ## How Has This Been Tested? `validation_chainstatemanager_tests`, on the `EvoSnapshotTestSetup` of #7601: - `chainstatemanager_evo_snapshot_cold_load` (new): a node with only the headers loads the snapshot, extends it past the next rotation cycle from the carried state alone, validates it in the background and promotes it at the next start. Before that, a pinned section whose base coinbase the header does not prove is refused and leaves the block index untouched. - `chainstatemanager_evo_snapshot_completion_rejects_a_lying_section` (new): a pinned section that every load check accepts, with a credit-pool limit the chain does not derive, is rejected at completion and the node continues on the validated chain. - `chainstatemanager_evo_snapshot_requires_its_pin`: the honest snapshot now has its masternode list at the base and is validated where it used to stay unvalidated. - `chainstatemanager_snapshot_completion_incorrect_base_mn_list` is removed with the comparison it triggered. ## Breaking Changes None. Only C++ tests can activate a snapshot at this layer; `loadtxoutset` arrives later in the stack. ## Checklist: - [x] I have performed a self-review of my own code - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: knst: utACK 15996de Tree-SHA512: 4919d6b05f2211b4b73411fd739741cf9dd824229268e18638e12e32ff98d0b97e640688ada4faa541b3d7076d51cbc33b0c818302dcaf8089093d7d183f4698
Issue being fixed or feature implemented
The AssumeUTXO stack (#8238 → #7887 → #8270 → #7593 → #8271 → #7601 → #8272 → #8078 → #8273 → #8079 → #8276, on top of the merged #8237) lets a node load a UTXO snapshot together with the Evo state at its base, sync to the tip from there and validate the history in the background. It keeps both chainstates' Evo state in one EvoDB: #8237 splits it into generations, the managers stay singletons, and the view a call reads is resolved from the calling thread's open EvoDB transaction or a default identity. That design is what makes the rest of the stack necessary: #8238 partitions every Evo-derived cache by view, #7887 binds non-active paths and dispatcher boundaries to a view, #8270 rejects unbound reads and stops reads of a rejected generation, and every consumer of the 110 manager call sites has to know which view it reads.
This PR replaces the stack, on a design in which the Evo state that is derived from a chain belongs to the chainstate that derived it. Each
Chainstateowns its own EvoDB and its own masternode list, quorum snapshot, quorum block processor, quorum manager (its chain part), credit pool, MNHF and special-transaction managers. There are no views, no identities and no cache partitions, and a rejected snapshot just drops its chainstate and EvoDB. It covers everything the stack delivers, including the mainnet and testnet pins of #8276.What was done?
Key decisions
EvoChainState: one bundle perChainstate(EvoDB,CDeterministicMNManager,CQuorumSnapshotManager,CQuorumBlockProcessor,CQuorumManager,CSpecialTxProcessorwith the credit pool and MNHF managers), built by aChainstateManagerfactory. The background chainstate keepsevodb/, and a snapshot chainstate usesevo_snapshot/.ChainstateManager::ActiveEvo(). These arePeerManager, signing, the InstantSend and quorum net handlers, ChainLocks, governance, the DS notification interface, the CoinJoin client, RPC, the miner and the mempool (the mempool's MN manager is rebound when a chainstate takes it).CConnman, which does not know validation, takes a callback returning the masternode list at the tip. The InstantSend lock DB and the ChainLocks store are shared facts about the block tree, one per node, likenode::BlockManager.evo::StateOrigin(snapshot base hash and height) tells each manager whether its state starts at genesis or at a snapshot base. At or below the base, a snapshot chainstate reads what the snapshot carried, and anything else it lacks is reported as locally unavailable (BlockDataUnavailableError), never as an invalid block. Where the node has the block body, it must agree with the carried value; a disagreement raisesSnapshotStateMismatchError.-assumeutxodata. Loading seeds the section into the snapshot chainstate's own EvoDB, checks it against the headers and dry-runs every quorum the chainstate may need right after the base.AdoptNumbering(), as pasta's 4328fcc does for generations), and the lists it carried below the base are dropped, because the background chainstate has its own for every block below the base.ChainstateManager::CloseEvoState()) where develop reset the node-wide managers, before the directory locks are released for a Dash-Qt restart and before the block index is freed.EHFSignalRouterinChainstateManager), instead of a single global MNHF manager.-watchquorumsduties are refused while a snapshot chainstate exists, and loading a snapshot is refused on a masternode and on a-watchquorumsnode. The masternode and quorum-watching services therefore never run beside a second chainstate, and may keep references to the Evo state they started with.loadtxoutsetactivates the snapshot at runtime (assumeutxo (2) bitcoin/bitcoin#27596), with no restart.Taken from the stack as is (commits authored by pasta, identical changes)
loadtxoutsetreturns the precise reason a snapshot was refused instead of logging it, including the Dash-specific reasons. validation: fix m_best_header tracking and BLOCK_FAILED_CHILD assignment bitcoin/bitcoin#30666 in place of "fix(validation): restore the best header when blocks are reconsidered":RecalculateBestHeader()also skips headers behind a ChainLock conflict and runs fromResetBlockFailureFlags(), which InstantSend and ChainLock enforcement call as well as the RPC; its follow-ups validation: stricter internal handling of invalid blocks bitcoin/bitcoin#31405 and validation: set BLOCK_FAILED_CHILD correctly bitcoin/bitcoin#31835 are not included. The tests of test, assumeutxo: Add test to ensure failure when mempool not empty bitcoin/bitcoin#29394 and test: Wait for local services to update in feature_assumeutxo bitcoin/bitcoin#30880, which were folded into the assumeutxo: Check snapshot base block is not in invalid chain bitcoin/bitcoin#30267 and Fix peers abruptly disconnecting from AssumeUTXO nodes during IBD bitcoin/bitcoin#30807 backports, as their own commits, and those of test: Assumeutxo: snapshots with less work should not be loaded bitcoin/bitcoin#29428, test: Assumeutxo: ensure failure when importing a snapshot twice bitcoin/bitcoin#29973 and test: Check datadir cleanup after assumeutxo was successful bitcoin/bitcoin#32033. test: Assumeutxo with more than just coinbase transactions bitcoin/bitcoin#29354 is covered by the two extra-transaction heights the assumeutxo (2) bitcoin/bitcoin#27596 backport already mines, and test: remove unnecessary m_best_header setting hack in feature_assumeutxo.py bitcoin/bitcoin#32746 removes a workaround Dash never had.Taken from the stack and adapted to the per-chainstate design (authored by pasta)
loadtxoutset): no EvoDB identity switch or dispatch turns at activation.feature_assumeutxo_dash.py(extended with protx diff/listdiff across the base).Re-implemented on the new design (co-authored with pasta)
SeedScanCoverage,ProvenNeverMined,ProveScan).dumptxoutsetemits the v4 section; matching evo pin; regtest-assumeutxodata.RestoreBlockIndexCandidates().Dropped from the stack
Reverted or removed from develop
EraseMinedCommitmentIfUnreferencedgoes too, since each chainstate erases its own commitments. 8010353 (masternode duty gate, thequorumParticipationfield ofmasternode status, the quorum-signing RPC error) and the DKG phase abort inWaitForNextPhaseare reverted.RecordBackgroundMNListHash) is replaced byCEvoDB::MergeSnapshot()/FinishPromotion(), and the separate MN-list comparison at completion (GetDeterministicMNListHash()) is removed: the rebuilt evo section contains that list. Its upstream backports are kept.Unique to this PR (no counterpart in the stack)
EvoChainState, the chainstate factory,ActiveEvo()read per call by the node-wide services, mempool MN-manager rebinding,evo::StateOrigin.evo_snapshot/directory lifecycle: removed at startup when no snapshot chainstate is active, and on reindex.CQuorumSnapshotManager::m_members_cache). The process-wide statics let one chainstate skip the computation, and with it the storage of rotation quarters, for the other.-watchquorumswith a snapshot chainstate, at startup and inloadtxoutset.CEvoDB::MergeSnapshot()/FinishPromotion()andCDeterministicMNManager::AdoptNumbering().CDBTransactioniterator error forwarding.lint-circular-dependencies.py.Known limits
merge_snapshot_and_finish_promotion), not by a chainstate-level test.rpc_dumptxoutset.pyexpects the same hash).How Has This Been Tested?
Unit tests
validation_chainstatemanager_testschainstatemanager_evo_state_is_per_chainstate: each chainstate gets its own Evo state.chainstatemanager_snapshot_init_missing_evo_state: startup with a snapshot chainstate and noevo_snapshot/asks for a reindex.chainstatemanager_evo_snapshot_requires_its_pin: a section without its pin, a missing section and a section differing from its pin are refused.chainstatemanager_evo_snapshot_cold_load: a headers-only node loads the snapshot, extends it past the next rotation cycle from the carried state alone, completes background validation and promotes at restart; the promoted masternode lists carry the internal ids of the chain the snapshot was dumped from.chainstatemanager_evo_snapshot_completion_rejects_a_lying_section: a pinned section that passes every load check but carries a credit-pool value the chain does not derive is rejected at completion.chainstatemanager_snapshot_cleanup_resumes_merged_promotion,chainstatemanager_snapshot_cleanup_refuses_promotion_without_its_coins: a promotion interrupted after the Evo merge resumes, and is not finished on coins it was not merged for.evo_db_testsmerge_snapshot_and_finish_promotion: an interrupted merge reruns, and the best block stays at the base until the promotion finishes.open_transaction_belongs_to_its_thread.evo_snapshot_tests(31 cases): what a section must carry and what is refused (theplanner_*cases,chain_validation_*, unsupported bases,credit_window_*,base_coinbase_*,mnhf_*, scan coverage and proofs), and what a snapshot chainstate answers below its base: unavailable, never absent or guessed.validation_chainstatemanager_tests(15 cases): every tampered field that only the completion rebuild catches (..._completion_rebuild_{indexes,signal,quarter,credit_history},..._completion_checks_carried_modifiers), local failures at completion that keep the snapshot, an honest completion across a restart, stalls (chainstatemanager_evo_stall_*,..._stall_keeps_best_header,..._stalled_chainlock_enforcement_stops,..._missing_seed_stalls), and refused loads (..._needs_more_work_than_the_active_chain,..._refused_when_loaded,..._refuses_an_unreadable_input).llmq_blockprocessor_tests/scan_proofs_agree_with_full_scans,rotating_scan_counterexample_is_not_covered.evo_snapshot_tests/base_coinbase_codec_bounds,populated_v4_golden_value.evo_islock_tests/discarded_lock_is_not_served.validation_tests/assumeutxodata_option.evo_db_tests: all generation, identity, marker and journaled-promotion cases.validation_chainstatemanager_tests:chainstatemanager_evodb_reorg_erase_guard,chainstatemanager_mined_commitment_is_chain_aware,chainstatemanager_snapshot_init_missing_evodb_marker,chainstatemanager_snapshot_completion_without_base_list_marker,chainstatemanager_snapshot_completion_incorrect_base_mn_list,chainstatemanager_snapshot_cleanup_{keeps_earlier_invalid_dir,keeps_live_snapshot_dir,overlap_promote_equals_discard,recovers_prepared_promotion,recovers_promoted_swap,recovers_rejection_before_rename},chainstatemanager_snapshot_promotion_crash_{after_collect,after_merge,mid_merge}.evo_snapshot_tests:populated_v3_golden_value,reconstruction_horizon_height_enumeration(v3 only).ActiveEvo()instead of node-wide managers): the evo, llmq, coinjoin, governance and wallet unit tests and the test utilities (setup_common,chainstate.h,masternode,validation, newutil/evo_snapshot.h).Functional tests
feature_assumeutxo.py,wallet_assumeutxo.py(bitcoin backports with their follow-ups);feature_assumeutxo_dash.py(end-to-end on a masternode network: dump, load, the masternode list at the tip following a snapshot loaded without a restart, sync, completion, promotion, Evo history requests refused until completion, protx diff/listdiff across the base against a node that never loaded a snapshot, the masternode lists and quorums at the tip compared with that node at four points of the snapshot's life, an EHF signal for an unused bit mined in the base block, and the promoted node verifying a new InstantSend lock and mining a block the network ChainLocks);feature_assumeutxo_refusals.py(pruned, masternode,-watchquorums, legacy indexes; at load and at startup).rpc_dumptxoutset.py: the expected file hash, now with the v4 evo section, and theevosummary fields.rpc_invalidateblock.py: the best header is restored on reconsider.wait_until_helper_internalrename (AssumeUTXO follow-ups bitcoin/bitcoin#28562) infeature_llmq_dkg_intake.py,p2p_platform_ban.py,p2p_quorum_data.py.Breaking Changes
masternode statusno longer has thequorumParticipationfield, and quorum signing RPCs no longer return the "disabled until snapshot background validation completes" error. Both were introduced by feat: assumeutxo M2 — EvoDB multi-chainstate isolation and subsystem gating #7456 and are unreleased.evodb/) reports a missing snapshot Evo state at startup and needs-reindex.getchainstatesreturns a list of chainstates (assumeutxo: change getchainstates RPC to return a list of chainstates bitcoin/bitcoin#28590).loadtxoutset,getchainstatesanddumptxoutsetare no longer hidden, andloadtxoutsetandgetchainstateswork on mainnet and testnet (feat: pin AssumeUTXO snapshots for mainnet and testnet #8276).dumptxoutsetreports anevosummary.protx diff, quorum and rotation info) and over P2P (getmnlistd,getqrinfo).-masternodeblsprivkeyor-watchquorumstogether with an unpromoted snapshot chainstate is a startup error, andloadtxoutsetis refused on masternodes,-watchquorumsnodes, pruned nodes and with-addressindex,-spentindexor-timestampindex.Checklist: