Repository navigation
feat: seed the evo snapshot section safely and rebuild it at completion - #8272
PastaPastaPasta wants to merge 62 commits into
Conversation
|
This pull request has conflicts, please rebase. |
|
✅ Final review complete — no blockers (commit 2bf1541) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 2 only (queue backlog)
Changes requested: 5 blockers
- Snapshot validation is skipped until restart when NORMAL reaches the base before the switch —
src/validation.cpp:6775-6780(new)
Impact: A node that reaches the base during snapshot preparation can keep using snapshot state that disagrees with state it has already validated. - A crash after the snapshot base marker is synced can abort the next startup —
src/validation.cpp:6697-6702(new)
Impact: A node loading a snapshot ahead of its downloaded block bodies can fail to restart if it stops after the base marker is synced but before the block index is flushed. - Coins left by an interrupted load can make a valid snapshot fail on retry —
src/node/chainstate.cpp:453-465(new)
Impact: An operator who restarts after an interrupted load can retain an unused coins database and then have a valid snapshot at a different authorized base rejected. - Failed database opens leak resources that the new LeakSanitizer rule hides —
test/sanitizer_suppressions/lsan:5-8(new)
Impact: The new failed-open test leaves three LevelDB option allocations unreleased, and the suppression also hides matching leaks from other database opens. - A background coins read error can make completion reject a good snapshot —
src/validation.cpp:7434-7455(new; not shown inline, see below)
Impact: If a LevelDB checksum or I/O error interrupts the background UTXO scan, the node can quarantine a valid snapshot and revert to the database it could not fully read.
The two new commits seed and dry-run Evo state in an unpublished generation, then rebuild the section from NORMAL state at snapshot completion. Linux and ASan builds and tests, lint, and Cppcheck passed; the Windows, TSan, and multiprocess builds and the no-wallet tests were still pending. The stack has four merge conflicts with develop.
🔴 5 blocking | 🟡 4 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: A background coins read error can make completion reject a good snapshot
Impact: If a LevelDB checksum or I/O error interrupts the background UTXO scan, the node can quarantine a valid snapshot and revert to the database it could not fully read.
src/validation.cpp:7434-7455
Completion preserves the snapshot only when ComputeUTXOStats() returns no result. The coins cursor does not expose CDBIterator::HasError(), so a LevelDB scan that skips records or stops early can still yield a successful hash of a partial set. That sends a local read failure down the HASH_MISMATCH path, which rejects the snapshot and shuts down. Propagate iterator status through the coins cursor and fail the stats scan before finalizing the hash. The malformed-coin test covers a GetValue() decode failure, not an iterator error.
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) — The two new commits change the persistent chainstate migration in src/validation.cpp’s ValidatedSnapshotCleanup, where flush ordering and EvoDB marker promotion must remain consistent across crashes. - Phase 1 reviewers: not run (skipped for throughput: 15 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/validation.cpp`:
- [BLOCKING] src/validation.cpp:6775-6780: Snapshot validation is skipped until restart when NORMAL reaches the base before the switch
Impact: A node that reaches the base during snapshot preparation can keep using snapshot state that disagrees with state it has already validated.
`SnapshotSwitchRefusal()` permits NORMAL's tip to equal the base, but activation then reports success without comparing the two states. The connect that reached the base ran while NORMAL was still active, so it skipped `MaybeCompleteSnapshotValidation()`. After the switch, newly arriving descendants are not eligible for background validation, so they do not trigger a retry. The switch-gap test reaches this case but calls `Complete()` itself. Run completion at the handoff when NORMAL is already at the base, handle the result before reporting success, and test that both a match and a disagreement are handled without an explicit completion call.
- [BLOCKING] src/validation.cpp:6697-6702: A crash after the snapshot base marker is synced can abort the next startup
Impact: A node loading a snapshot ahead of its downloaded block bodies can fail to restart if it stops after the base marker is synced but before the block index is flushed.
Startup can recognize a snapshot whose block index is not ready to use it. `WriteSnapshotBaseBlockhash()` syncs the marker before the loop that sets `nTx` and `BLOCK_ASSUMED_VALID`, and the index is flushed later. If the base header was already on disk but its block was not, startup reconstructs a zero `nChainTx` for the base. `LoadBlockIndex()` still admits the base as a background candidate, and `FindMostWorkChain()` asserts `HaveTxsDownloaded()` before checking for missing block data. Make recovery finish index preparation before candidate admission, or journal the handoff so this state cannot be resumed. The existing post-publication failpoint stops before the base-marker write and does not cover this window.
- [BLOCKING] src/validation.cpp:7434-7455: A background coins read error can make completion reject a good snapshot
Impact: If a LevelDB checksum or I/O error interrupts the background UTXO scan, the node can quarantine a valid snapshot and revert to the database it could not fully read.
Completion preserves the snapshot only when `ComputeUTXOStats()` returns no result. The coins cursor does not expose `CDBIterator::HasError()`, so a LevelDB scan that skips records or stops early can still yield a successful hash of a partial set. That sends a local read failure down the `HASH_MISMATCH` path, which rejects the snapshot and shuts down. Propagate iterator status through the coins cursor and fail the stats scan before finalizing the hash. The malformed-coin test covers a `GetValue()` decode failure, not an iterator error.
- [SUGGESTION] src/validation.cpp:6641-6645: An overlapping snapshot load can undo the first load's state
Impact: If two callers try to activate on-disk snapshots concurrently, the second can clear the first attempt's Evo state or request a shutdown when it cannot delete the open database.
The initial `SnapshotBlockhash()` check only detects an installed chainstate. A second call can pass it while the first owns the snapshot LevelDB; when the second open fails, its catch block runs cleanup against the manager's shared capture plan and generation, then attempts to destroy the first call's still-locked directory. This head has no production caller of `ActivateSnapshot()`, so this is an API hazard rather than an exposed RPC race. Give the manager a single activation reservation under `cs_main` before resizing caches or opening the database, and release it on every exit.
In `src/node/chainstate.cpp`:
- [BLOCKING] src/node/chainstate.cpp:453-465: Coins left by an interrupted load can make a valid snapshot fail on retry
Impact: An operator who restarts after an interrupted load can retain an unused coins database and then have a valid snapshot at a different authorized base rejected.
Startup cleans up the Evo state but leaves the unmarked `chainstate_snapshot` database available for reuse. Before publication, startup collects the unpublished generation without leaving a rejected record; after publication but before the base-marker write, startup discards the markers only after the recovery pass that handles rejected directories. In either case, the next activation opens that same database with `should_wipe=false`. It writes the incoming coins but does not erase old outpoints absent from the new snapshot, such as coins spent between the two bases, so its UTXO hash can fail. Remove the abandoned directory once recovery has ruled out a live snapshot or promotion, or guarantee a fresh database for the next load. Extend `CrashDuringActivation` to check the directory and retry at a different authorized base.
In `test/sanitizer_suppressions/lsan`:
- [BLOCKING] test/sanitizer_suppressions/lsan:5-8: Failed database opens leak resources that the new LeakSanitizer rule hides
Impact: The new failed-open test leaves three LevelDB option allocations unreleased, and the suppression also hides matching leaks from other database opens.
`GetOptions()` allocates a block cache, filter policy, and logger before `DB::Open()`. The missing-manifest test makes the open fail, then `HandleError()` throws before `CDBWrapper` finishes construction. Only `~CDBWrapper()` deletes those objects; unwinding the context with its raw pointers does not. Give the context RAII ownership of the resources, remove `leak:GetOptions`, and keep the failed-open test.
In `src/evo/snapshot_chain.cpp`:
- [SUGGESTION] src/evo/snapshot_chain.cpp:1002-1004: The dry run accepts mined commitments that refer to members the seeded view cannot supply
Impact: A pinned section with inconsistent historical membership can pass activation even though its seeded view cannot supply every member named by a carried commitment.
`DryRunEvoSnapshot()` discards the member vector returned for each active or safety commitment, and a short or empty vector need not throw. Preflight checks the encoded bitset lengths, but not whether the set bits refer to computed members. Ordinary `CFinalCommitment::Verify()` rejects `validMembers` or `signers` bits beyond the computed vector. Reuse the non-signature membership checks for carried mined commitments without imposing that requirement on cycles with no mined commitment.
In `src/evo/creditpool.h`:
- [SUGGESTION] src/evo/creditpool.h:207-208: The credit-pool manager exposes a process-wide cache reset solely for one test fixture
Impact: A simulated restart depends on a public production method to clear state that survives the manager being reconstructed.
`ClearBlockDataCacheForTesting()` is called only by `DropEvoCaches()` in the chainstate-manager tests. It clears a function-static parsed-block cache, not an instance's cache. Tie the cache to the component the fixture reconstructs so a restart simulation naturally starts cold, or keep the reset in test-only access rather than making it part of the manager's public API.
In `src/warnings.cpp`:
- [SUGGESTION] src/warnings.cpp:37-51: The snapshot-publication commit also changes warning lifetime on nodes without a snapshot
Impact: A maintainer tracing why a successful GUI read now clears a pruning warning cannot review or revert that behavior independently of snapshot publication.
Commit `24c53dabe35` changes existing Evo warnings from a shared miscellaneous warning to per-operation warnings, clears them on a successful read, and changes when the GUI is notified. `evo_state_unavailable_is_contained` verifies the new behavior before it creates a snapshot generation. Split the warning storage, interface changes, and corresponding assertions into a prerequisite commit so the activation and completion commits can use the policy without burying the standalone behavior change.
| LogPrintf("[snapshot] successfully activated snapshot %s\n", base_blockhash.ToString()); | ||
| LogPrintf("[snapshot] (%.2f MB)\n", | ||
| m_snapshot_chainstate->CoinsTip().DynamicMemoryUsage() / (1000 * 1000)); | ||
|
|
||
| this->MaybeRebalanceCaches(); | ||
| return true; |
There was a problem hiding this comment.
⏭️ Deferred (maintainer decision; not blocking) at
17f8d275; see the replies below.
🔴 Blocking: Snapshot validation is skipped until restart when NORMAL reaches the base before the switch
Impact: A node that reaches the base during snapshot preparation can keep using snapshot state that disagrees with state it has already validated.
SnapshotSwitchRefusal() permits NORMAL's tip to equal the base, but activation then reports success without comparing the two states. The connect that reached the base ran while NORMAL was still active, so it skipped MaybeCompleteSnapshotValidation(). After the switch, newly arriving descendants are not eligible for background validation, so they do not trigger a retry. The switch-gap test reaches this case but calls Complete() itself. Run completion at the handoff when NORMAL is already at the base, handle the result before reporting success, and test that both a match and a disagreement are handled without an explicit completion call.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
There was a problem hiding this comment.
Not changing this in #8272. Nothing at this head calls ActivateSnapshot() outside the unit tests; loadtxoutset arrives in #8078. #8078's bitcoin#27596 commit (457fdae, with upstream's "validation: do not activate snapshot if behind active chain") replaces this check with SnapshotActivationRefusal(). That function refuses the switch unless the base has more work than NORMAL's tip (SnapshotHasMoreWork()), and the base itself counts. So a node whose NORMAL chainstate reached the base while the snapshot was being prepared refuses the load. It never switches into a state where completion can only run at the next restart. The switch-gap test then hides the base tip at the switch (ActivateWithBaseHidden, the same change), as upstream's tests do. Running completion at the handoff would only serve the window between these two PRs, and that window has no caller.
🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.
There was a problem hiding this comment.
Deferred (re-reviewed at 17f8d275): The handoff gap is intentionally handled by the stacked activation-refusal change in #8078, which refuses a snapshot unless its base has more work than the active NORMAL tip and therefore prevents switching after NORMAL has already reached the base.
| // If not in-memory, persist the base blockhash for use during subsequent | ||
| // initialization. | ||
| if (!in_memory && !node::WriteSnapshotBaseBlockhash(*snapshot_chainstate)) { | ||
| cleanup(); | ||
| return false; | ||
| } |
There was a problem hiding this comment.
⏭️ Deferred (maintainer decision; not blocking) at
17f8d275; see the replies below.
🔴 Blocking: A crash after the snapshot base marker is synced can abort the next startup
Impact: A node loading a snapshot ahead of its downloaded block bodies can fail to restart if it stops after the base marker is synced but before the block index is flushed.
Startup can recognize a snapshot whose block index is not ready to use it. WriteSnapshotBaseBlockhash() syncs the marker before the loop that sets nTx and BLOCK_ASSUMED_VALID, and the index is flushed later. If the base header was already on disk but its block was not, startup reconstructs a zero nChainTx for the base. LoadBlockIndex() still admits the base as a background candidate, and FindMostWorkChain() asserts HaveTxsDownloaded() before checking for missing block data. Make recovery finish index preparation before candidate admission, or journal the handoff so this state cannot be resumed. The existing post-publication failpoint stops before the base-marker write and does not cover this window.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
There was a problem hiding this comment.
Not changing this in #8272. Like the previous finding, it needs an ActivateSnapshot() caller, and there is none at this head. The window also predates this PR: before it, the transaction counts were faked in PopulateAndValidateSnapshot(), but they still reached disk only through the MaybeRebalanceCaches() flush after WriteSnapshotBaseBlockhash(), as in upstream v26.
#8078 closes it with the upstream changes it backports. bitcoin#27596 (457fdae, "populate nChainTx value for assumedvalid chainstates") makes BlockManager::LoadBlockIndex() set the base's nChainTx from the pin whenever a snapshot is detected, whatever the stored record says. FindMostWorkChain() then finds HaveNumChainTxs() true for a base without its body and drops the candidate as missing data. Further up the stack, bitcoin#29370 (aab46c0, in #8079) removes the faked nTx and BLOCK_ASSUMED_VALID. From then on the loop after the marker write only marks entries dirty and sets the unpersisted nChainTx, so a crash there leaves the on-disk index exactly as a completed activation would.
🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.
There was a problem hiding this comment.
Deferred (re-reviewed at 17f8d275): The crash window after the base marker is synced is intentionally handled by the stacked AssumeUTXO backports in #8078 and its related follow-up, which reconstruct the assumed chain transaction count and prevent an incomplete base from being admitted as usable.
| } catch (...) { | ||
| LOCK(::cs_main); | ||
| cleanup(); | ||
| throw; | ||
| } |
There was a problem hiding this comment.
⏭️ Deferred (maintainer decision; not blocking) at
17f8d275; see the replies below.
🟡 Suggestion: An overlapping snapshot load can undo the first load's state
Impact: If two callers try to activate on-disk snapshots concurrently, the second can clear the first attempt's Evo state or request a shutdown when it cannot delete the open database.
The initial SnapshotBlockhash() check only detects an installed chainstate. A second call can pass it while the first owns the snapshot LevelDB; when the second open fails, its catch block runs cleanup against the manager's shared capture plan and generation, then attempts to destroy the first call's still-locked directory. This head has no production caller of ActivateSnapshot(), so this is an API hazard rather than an exposed RPC race. Give the manager a single activation reservation under cs_main before resizing caches or opening the database, and release it on every exit.
source: gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
There was a problem hiding this comment.
This is already handled further up the stack: #8273's 6b50ba7 (fix(validation): serialize snapshot activations) adds an activation reservation that the manager takes before resizing caches or opening the database and releases on every exit. A second caller is refused with "Another snapshot activation is in progress" before it touches the capture plan, the generation or the directory. As you note, nothing at this head calls ActivateSnapshot() outside the unit tests, loadtxoutset arrives in #8078, and the reservation follows in #8273, the PR stacked directly on it.
🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.
There was a problem hiding this comment.
Deferred (re-reviewed at 17f8d275): The overlapping activation hazard remains outside this head's implementation, but stacked follow-up #8273 adds the activation reservation before shared state or the snapshot directory is touched and releases it on every exit.
c94ce54 to
4f5041e
Compare
|
On the body-only finding (a background coins read error can make completion reject a good snapshot): fixed in 4f5041e.
🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta. |
|
This pull request has conflicts, please rebase. |
1 similar comment
|
This pull request has conflicts, please rebase. |
4f5041e to
17f8d27
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 seeds snapshots through an unpublished Evo generation and now rebuilds and compares the complete retained Evo section at validation completion, while also detecting LevelDB cursor read errors during UTXO hashing. ClangFormat, main, title validation, and other completed code checks pass; the review check remains in progress and the skip-condition check is queued, with no failed code checks reported.
🟡 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.
Still open from earlier rounds (3)
- 🟡 Suggestion: The snapshot-publication commit also changes warning lifetime on nodes without a snapshot —
src/warnings.cpp:37-51(thread) - 🟡 Suggestion: The credit-pool manager exposes a process-wide cache reset solely for one test fixture —
src/evo/creditpool.h:207-208(thread) - 🟡 Suggestion: The dry run accepts mined commitments that refer to members the seeded view cannot supply —
src/evo/snapshot_chain.cpp:1006-1017(thread)
Review provenance
Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: 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, intricate AssumeUTXO/Evo snapshot validation change affecting chainstate initialization, persistence, and completion checks, but the diff does not directly change consensus rules, funds movement, cryptography, peer-facing deserialization, or a storage migration. - Phase 1 reviewers: not run (skipped for throughput: 14 PRs queued, above the 10 limit)
- 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 `src/warnings.cpp`:
- [SUGGESTION] src/warnings.cpp:37-51: The snapshot-publication commit also changes warning lifetime on nodes without a snapshot
(carried; thread: https://github.com/dashpay/dash/pull/8272#discussion_r4724482996)
In `src/evo/creditpool.h`:
- [SUGGESTION] src/evo/creditpool.h:207-208: The credit-pool manager exposes a process-wide cache reset solely for one test fixture
(carried; thread: https://github.com/dashpay/dash/pull/8272#discussion_r4724482992)
In `src/evo/snapshot_chain.cpp`:
- [SUGGESTION] src/evo/snapshot_chain.cpp:1006-1017: The dry run accepts mined commitments that refer to members the seeded view cannot supply
(carried; thread: https://github.com/dashpay/dash/pull/8272#discussion_r4724482987)
| LogPrintf("[snapshot] successfully activated snapshot %s\n", base_blockhash.ToString()); | ||
| LogPrintf("[snapshot] (%.2f MB)\n", | ||
| m_snapshot_chainstate->CoinsTip().DynamicMemoryUsage() / (1000 * 1000)); | ||
|
|
||
| this->MaybeRebalanceCaches(); | ||
| return true; |
There was a problem hiding this comment.
Deferred (re-reviewed at 17f8d275): The handoff gap is intentionally handled by the stacked activation-refusal change in #8078, which refuses a snapshot unless its base has more work than the active NORMAL tip and therefore prevents switching after NORMAL has already reached the base.
| // If not in-memory, persist the base blockhash for use during subsequent | ||
| // initialization. | ||
| if (!in_memory && !node::WriteSnapshotBaseBlockhash(*snapshot_chainstate)) { | ||
| cleanup(); | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Deferred (re-reviewed at 17f8d275): The crash window after the base marker is synced is intentionally handled by the stacked AssumeUTXO backports in #8078 and its related follow-up, which reconstruct the assumed chain transaction count and prevent an incomplete base from being admitted as usable.
| } catch (...) { | ||
| LOCK(::cs_main); | ||
| cleanup(); | ||
| throw; | ||
| } |
There was a problem hiding this comment.
Deferred (re-reviewed at 17f8d275): The overlapping activation hazard remains outside this head's implementation, but stacked follow-up #8273 adds the activation reservation before shared state or the snapshot directory is touched and releases it on every exit.
… promotion Read the snapshot's and the background chainstate's list at the base through a transaction of each identity, which is never committed, instead of a scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seed through the open transaction of the view, and read a view in tests through a transaction of its identity, instead of a scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r B+1 ChainLock checks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bootstrap work Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rive the stage below it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rive the stage below it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bootstrap work Seeding a mined commitment changes the commitment mined for its base, so it drops that base's qc-hash entry like ProcessCommitment does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bootstrap work dashpay#8263 caches the active quorum set by block, so a fixture that replaces the LLMQ types after building its chain drops the view caches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dashpay#8263 caches the active quorum set by block, so a fixture that replaces the LLMQ types after building its chain drops the view caches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rive the stage below it dashpay#8263 caches the active quorum set by block, so a fixture that replaces the LLMQ types after building its chain drops the view caches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…napshot view A v20 score modifier commits to the work block's coinbase ChainLock. When the block cannot be read, the ordinary calculation silently uses the block-hash modifier instead, and so did the prediction path (ComputeQuorumMembersFromWorkBlock), even where the snapshot carries the exact value. In the snapshot view that computes different members than the network without any error. One resolver, keyed by (type, work block), now serves GetHashModifier(), quarter decoding and the prediction path: it returns the seeded value or the block's own, checks them against each other when both exist (SnapshotStateMismatchError), and raises BlockDataUnavailableError when it has neither, in every view: NORMAL no longer guesses the block-hash modifier for a work block it pruned. A work block the node has but cannot read raises BlockDataReadError in either view; the resolver and the exporter's ExactWorkModifier() read its status and position in one cs_main scope. llmq::utils::GetQuorumModifierForWorkBlock() exposes the resolver. A quorum object computed its members eagerly, so without that fallback a pruned node could no longer build one for an old quorum, and would stall on an MNHF signal it signed: LLMQ_400_85's active quorums reach further back than a pruned node keeps. Where NORMAL cannot resolve the work block's modifier (WorkBlockModifierUnavailableError), a quorum is now built from its mined commitment alone. It verifies signatures with the commitment's key, and CQuorum::Members(), which replaces the public member vector, raises BlockDataUnavailableError for it, as do IsMember(), IsValidMember() and GetMemberIndex(), so nothing reads a guessed or empty list. Such a quorum takes no verification vector or contributions from QDATA, is not queued for key-share warming, and has no contributions for the old-data cleanup to keep. Commitment verification and quorum rotation still need the members and stay unavailable without them. The quorum health figures of the GUI and quorum listextended count such a quorum's commitment member slots. Such a quorum is kept out of the quorum and scan caches, so once its work block is downloaded again the next lookup computes its members. A work block pruned between reading its status and reading its data counts as one this node does not have, not as a read error. A release note describes the change for pruned nodes. The snapshot view raised unavailable for any quarter missing at or below the base. Only an applicable one (rotation and the type enabled at that cycle) is an input the ordinary computation stored; a missing inapplicable quarter keeps the legacy break there, as NORMAL does, so a cycle near rotation's start still reconstructs. Both the resolver and the exporter compute a v20 work block's modifier from its data through llmq::utils::GetWorkBlockModifier(), and every caller of the resolver goes through llmq::utils::GetQuorumModifierForWorkBlock(). The member-computation fixtures live in evo_snapshot_tests.cpp, so the tests do too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ScanQuorums() and ScanCommitments() read the mined-commitment index. In the snapshot view that index holds only the carried commitments at or below the base, so a scan reaching past them returned a short or (with rotation) a different vector, and quorum selection for a ChainLock or an asset unlock silently disagreed with the network. A carried scan sequence (the type's history without rotation, one quorum index with it) ends either in END, when the canonical selection carries fewer records than it takes (K, or two per index), or in UNKNOWN. A missing index is END; a rotating type without rotation at the base has an empty indexed family. TraverseScanSequences() replays the ordinary selection over such sequences (newest first, or rank by rank in ascending index order) and proves the identical vector, including a legitimately short history, or reports that an UNKNOWN end was reached first. Export and load apply one gate: every ChainLock verification scan for the heights B + 1 may certify (from the base's certified height, or from genesis when it certifies none; none at all without v20 at B + 1) with n = a and SIGN_HEIGHT_OFFSET, and the Platform asset-unlock scan at B with n = a + 1, must be proven from the section; the exporter also compares the proven vectors with its full index. Coverage only grows with the cutoff for a fixed type and count, so only the first start of each enablement context is proven. Bases that fail are refused. At runtime, the snapshot view's scans call CQuorumManager::ProveScan() over the view's commitment index, whose ends are recorded locally at seeding (ScanCoverageRecord, never on the wire). Every request proves its own prefix: cached prefixes are proven ones, a shorter cache entry is re-proven from the original cutoff instead of continued, there is no keepOldConnections warm-up to fail a covered smaller request, and an uncovered prefix raises BlockDataUnavailableError, as does a proven quorum this node fails to build. So does a scan from a cutoff that is not on the view's chain, checked again after the quorums are built, since the view's index describes only that chain. A commitment-index read error raises BlockDataReadError instead of proving the records read before it. Records above the base extend the sequences. CQuorumBlockProcessor::SequenceEnd() is the one answer to how a view's history of a scan sequence ends, and both ProveScan() and the height-index primitives' short-scan gate (RequireSatisfiedScan) read it. It is END: - in NORMAL, and in a snapshot view whose base precedes DIP3, which hold every commitment mined on their chain; - for a family the type never writes. A type is indexed exactly when it rotates, and a rotating type is enabled exactly when rotation is at its cycle base, so a rotating type read non-indexed before DIP0024 (a base before activation) is empty; - where the seeded coverage says so: a type the payload omits (disabled at B with no history, e.g. one enabled only later), an under-filled type, or a quorum index that never formed one. A short scan ending there is an answer, so B + 1 reads what NORMAL reads. Anywhere else it stalls, as a need deeper than the payload carries does. END rests on the carried counts, which only the mandatory evo-hash pin binds. RequireSatisfiedScan keeps the header check that a type enabled at neither end of the missing range has nothing in it; both checks now run with the EvoDB lock released. The shared quorum and commitment scan (ScanMined) and ProveScan() normalize the start with one NormalizeScanStart(), and in the snapshot view the shared scan takes the proven path for both result types. Lookups by quorum hash follow the same rule. An MNHF signal may be signed by any historical quorum of its type. In the snapshot view HasMinedCommitment raises BlockDataUnavailableError (the chainstate stalls) for a quorum at or below the base without a commitment, unless headers and the carried sequences prove it was never mined: not on the base's chain, not a quorum height of an enabled type, or no older than the oldest carried record of an ending or newest-first sequence. Such a miss stays a plain miss, so a block relying on that quorum is still invalid. RequireSatisfiedScan's rule is ShortScanIsComplete(). getPlatformQuorum reads its window with these height-index walkers, so a sequence whose recorded coverage ends lets a hash that is no block of the active chain below the height be INVALID, and one whose end is unknown makes the lookup UNAVAILABLE. getPlatformQuorum over a seeded generation: carried commitments are found at the base; a window reaching past the oldest carried one stays unavailable for carried quorums in it, quorums NORMAL would find there and unmined ones alike; a window full again from commitments above the base, or a history whose seeded coverage ends, makes an unmined hash invalid once a ChainLock anchors it, while a carried quorum that has left the window stays unavailable; after promotion NORMAL decides. Promotion, also interrupted and resumed, copies no seed-only record (modifiers, credit window, base coinbase, scan coverage) into NORMAL. With the quorum keys, the key-only quorum test also checks that a pruned node accepts an MNHF signal its quorum signed. The proven path keeps the rule of dashpay#8102: it proves the scan under the same cs_main hold that checks the cutoff is on the snapshot chainstate's chain, and caches the result only if the cutoff is still on it when the result is stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r the snapshot view Seed through the open transaction of the view, and read a view in tests through a transaction of its identity, instead of a scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seed through the open transaction of the view, and read a view in tests through a transaction of its identity, instead of a scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VerifySig takes check_sigs since dashpay#8269. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dumptxoutset builds the evo section from the dumped chainstate's own view at the same cs_main-pinned point as the coins cursor, appends it after the last coin as [marker][EvoSnapshot], and reports a summary of it. A base the section cannot represent (for example a needed rotation quarter is missing, or the ChainLock scans cannot be proven), or a section failing the chain checks a loading node applies, is an RPC error. PreflightEvoSnapshot() is the one chain check export and load share: ValidateEvoSnapshotAgainstChain() and, once DIP3 is active at the base, VerifyEvoSnapshotBaseBlock(). It reads the calling thread's Evo view, so the exporter runs it on NORMAL and the loader in the generation it seeds. Snapshot load decodes a trailing section and requires it to end the file; a UTXO-only file still loads. The section is not used yet. Until a later commit compares the whole section at completion, a DIP3-active snapshot is never validated or promoted: completion returns the new EVO_DATA_UNAVAILABLE, which startup treats like a skip. feature_assumeutxo_dash.py dumps a rotating-quorum chain at a base before its own cycle's mining window and at the block before the next cycle, and checks the carried rotation cycles and bootstrap entries against the dependency rule, the credit-pool window length, the base coinbase, and that the reported hash is the SHA256 of the section bytes in the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…data A DIP3-active snapshot base now requires the evo section and a non-null pinned evo hash that the decoded section matches, and a non-null pin requires a section. The pin comes only from chainparams or, on regtest, from the new -assumeutxodata=<height>:<hash_serialized>:<evo_hash>:<nchaintx>:<blockhash> option, never from the file. Each such entry is bound to its base block, and the option authorizes nothing on other networks. A pre-DIP3 UTXO-only snapshot loads as before. EvoSnapshotTestSetup is a deterministic DIP3/v20 chain with four fixed-key masternodes whose base at 219 is pinned through -assumeutxodata. The pin is the SHA256 of the section as a test-side assembler writes the format table field by field, and the section holds what the fixture implies (its masternodes, quarters and credit window). A null pin, a UTXO-only file, and a section with a substituted field that every later check accepts are each refused before any generation is created. The honest snapshot activates, and with background validation already at its base it is still not validated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ddress AbandonedSpendRestoresActiveMasternodeCollateralLock holds cs_main while GetListAtChainTip() copies the masternode list into a temporary on the stack, locking the temporary's m_cached_sml_mutex. Other wallet tests, such as scan_for_wallet_transactions_abort and wallet_sync_tx_invalid_state_test, lock the cs_wallet of a CWallet on the stack before cs_main. libstdc++ never passes its mutexes to pthread_mutex_destroy, so TSan keeps each lock order for the stack address after the object is gone. When two of these mutexes land at the same address, TSan reports a lock-order inversion with cs_main, although the two "mutexes" are different objects (a plain mutex and a recursive_mutex). Whether the addresses collide depends only on stack layout, so any change to the size of a test's locals can expose it. The next commit grows ActiveEvoViewScope by one pointer, which makes the linux64_tsan unit tests report it, paired with a different wallet test at different layers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read the dumped chainstate's view through a transaction of its identity, which is never committed, instead of a scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…umeutxodata The test loads a snapshot as any caller does, without an active-chain turn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…publish After the pin check, snapshot load seeds the section into the new unpublished generation and, in that generation's view, runs the chain checks export runs (PreflightEvoSnapshot(): exact equality with the planned dependency sets, provable ChainLock and asset-unlock scans, the credit-pool window, and the anchor to the base header through the coinbase merkle proof and CbTx). Deployment state at or below the base then comes from the carried signal record, never from history a node with only the headers lacks: such a node could not load a base whose next cycle reads work data at or below it. Load then dry-runs the quorum member computations the snapshot chainstate may need at or right after the base from the seeded state alone: every carried quorum, the base's cycle, and the next cycle when its work block is at or below the base (refused if a v20 work block's members cannot be computed). Once DIP3 is active the snapshot-side base MN-list marker is the carried list's. The active chainstate keeps running whenever activation releases cs_main. Preparation therefore first flushes it, coins before Evo state, so the NORMAL records it then commits never reach disk ahead of the coins, and registers the base before releasing cs_main: until the switch the active chainstate records the base's MN list as the background chainstate would. Activation then waits, at most a few seconds, for the dispatch turns of other threads to end (so its caller must not hold cs_main), and switches in one cs_main hold: the mempool must still be empty, the active tip must be the base or have less work than it (an equal-work sibling at the base height would be loaded as the background tip at the next startup, whose completion would then reject the snapshot), and no block of the base's chain may be invalid or conflict with a ChainLock; only then are the generation published (with the markers and the encoded section, retained in the lifecycle metadata), the base recorded in the snapshot directory and the block index faked, and the snapshot view told its tip before it becomes the default. A turn still running in NORMAL finishes there. A turn counts itself without a lock; one that ends takes the waiter's mutex and notifies only while activation waits. Every failure before the switch, from opening the snapshot's coins database on, undoes the generation, the caches and the directory; none leaves faked block-index state behind. Rejection, completion and cleanup flush each chainstate's coins, checked, before syncing its Evo state. A local Evo state error while populating (state this node cannot derive or read) refuses the snapshot as bad input does, instead of escaping activation. On restart, an unpublished generation is collected as before; a published one is used only while its retained section still decodes and matches the pin of its base. A snapshot coins directory that no chainstate uses, because its load never recorded the base block, is removed: a later load would otherwise open it and add its coins to the old ones, so the UTXO hash of a snapshot at another base would fail. evo/snapshot_chain.cpp joins the kernel sources, since validation now calls it. A DIP3-active snapshot is still never validated or promoted. The unknown-version warning check, where it needs Evo state the chainstate lacks, is skipped instead of escaping block connection. The "snapshot state unavailable" warning no longer takes the single misc warning slot. Each failing interfaces:: operation has its own, which goes on its next success. Setting or clearing one notifies the GUI only when the warnings change, so an operation the GUI keeps polling while it fails notifies once. A simulated restart in the tests drops the Evo view caches, as a real one does: their tips point into the block index it unloads. Tests, on the deterministic DIP3 fixture, and on a variant whose quorums really form (commitments signed with the fixture's operator keys and a quorum key it keeps, ChainLocks and asset unlocks signed with that key); a node "with only the headers" also starts with an empty NORMAL EvoDB: - a node with only the headers loads the snapshot and connects, across a restart, the blocks a synced node mined up to B+P+2, through the next cycle; members of the base and next cycle match the synced node's; - such a node loads the section a synced node dumps at every base of a 24-block cycle, including those inside the next cycle's work window; - a work-block body the node has but cannot read refuses the load cleanly; - at the block before the next cycle, the bootstrapped next cycle's members are predicted from the seeded state and match the synced node's; - a crash after seeding, before or after publication, leaves no live generation and no snapshot coins directory after restart; NORMAL carries on, and a snapshot at the next block, which spends one of the crashed load's coins, then loads; - right after activation the snapshot view serves the base's MN list as its tip list; - the switch is refused when the active chainstate meanwhile took a mempool transaction, the base's chain became invalid, the chainstate moved to a sibling of the base with the same work, or it went past the base, and a snapshot coins database that fails to open fails the load; each time the node is left as before, and the load then succeeds at the base; - the switch waits for a dispatch turn that ends within the bound; one that outlives it carries on in NORMAL without failing or stopping the node; - a load refused by its dry run on a node with only the headers marks no block assumed-valid and fakes no transaction count; - a crash right after preparing restarts without an Evo/coins mismatch, although the chainstate had connected blocks since its last flush; - a carried credit-window record that has gone missing stalls the chainstate with a local error, without marking the block invalid; - a retained section that no longer matches the pin is refused at startup; - with real quorums, the next cycle's signed commitments, verified against members from the carried quarters (including the base cycle's), and the ChainLocks in every coinbase are accepted, and stay in the snapshot view, for a base right before the next cycle and for one five blocks after its own cycle, before the next cycle's work block; - each quorum cache the snapshot chainstate warms at or below the base (quarters, members, quorums, quorum and commitment scans, mined-commitment blocks, commitment indexes, CbTx commitment hashes, the remembered coinbase ChainLock) stays in its view: NORMAL finds nothing there or cannot tell until it has connected those blocks, then answers as the synced node did, also when the snapshot view holds a different commitment; - with a rotating index whose DKG fails for ten cycles, the members of its ten- and eleven-cycle-old quorums are computed at activation, with cold caches, as the synced node's; the ten-cycle-old quarter, only an output, is not kept, and without a quarter they need the members are unavailable; - on a node without the base body, the block after the base, building on the real ChainLock the carried base coinbase holds, connects; - withdrawals at exactly the limit, before the base and across a restart and the window edge after it, are accepted; on both sides of that edge anything above the synced node's limit, and a carried index, are rejected; - a rejected snapshot's commitments are rebuilt by NORMAL from the blocks; - NORMAL's MN-list cache stays bounded during a long background sync; - background validation reaching the base validates nothing yet; - an unknown bit active, and warned about, on the synced node: once that node, still holding NORMAL's warning-cache states, loads a snapshot without the bodies below its base, the snapshot chainstate computes the states itself from the headers and the carried signal record, and warns too. A failed database open threw out of CDBWrapper's constructor before its destructor could free the LevelDB cache, filter policy, logger and environment. LevelDBContext now owns and frees them, so the failed-open test runs under LeakSanitizer without a suppression. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Completion now rebuilds the entire evo section from the state background validation derived and requires its hash to equal the retained section's, which must still equal the pin. This replaces the interim refusal to validate a DIP3-active snapshot. The rebuild and the shared preflight report why they failed: missing input, local corruption, an internal error, or a disagreement (at export, where nothing is compared, a base the section cannot be built for). Only a disagreement rejects the snapshot (EVO_STATE_MISMATCH). Missing input (EVO_DATA_UNAVAILABLE) leaves it neither validated nor rejected, with a warning that says the next restart retries. Data this node has but cannot read or finds inconsistent (a retained section that is gone, does not decode or no longer matches its pin, which startup checked; an unreadable body; EvoDB best blocks that differ from their coins tips) stops the node with EVO_LOCAL_FAILURE, and an internal error (including a missing record of the background chainstate's list at the base) with EVO_INTERNAL_ERROR; neither rejects the snapshot, and startup then fails with the same advice instead of retrying at every restart. The advice says that -reindex-chainstate discards the snapshot. A coin of the background chainstate that cannot be read, so that its UTXO set hash cannot be computed, is local corruption too, and so is a read error LevelDB reports for the coins scan: it skips a table block that fails its checksum, so the scan now checks the cursor's error state (CCoinsViewCursor::HasError()) and fails instead of hashing the rest. Upstream rejects the snapshot there, which would leave the node on the coins it cannot read and tell the user the snapshot was invalid; this is a deliberate divergence. A snapshot still in use that cannot be rejected stops the node rather than being kept. A base before DIP3 that retained a section, which needs no pin, is rebuilt and compared too: promotion never compares a seeded record with NORMAL's, so it relies on this check for every one. The inputs only block bodies provide (the v20 work-block modifiers, the credit-pool window, the base coinbase and its branch, and the base's credit pool, which folds in blocks back to the last pool on disk) are captured as the background chainstate connects those blocks, in its block transaction, or at activation for blocks it has already connected; activation refuses a base whose such body is gone. The capture plan refuses a credit window reaching below genesis, since the chain checks run only after it. The rebuild prefers the captures over the bodies. A local Evo error while capturing the base pool stalls the background chainstate as other local Evo errors do. Capturing follows the registered plan, so a block the still-active chainstate connects between preparation and the switch is captured too. Since promotion repeats completion at the next startup, the captures stay until promotion; they are also dropped on rejection, when activation fails (after flushing that chainstate's coins), and at startup when no generation is live or the one left never activated (after a crash before or after publication). No prune lock is kept for them: it would not cover what either chainstate reads, and pruning is to be refused while a snapshot is in use. The MN-list work captures and the old comparison block that the design removes do not exist on this base; the existing base MN-list marker comparison is kept. Tests, on the deterministic DIP3 fixture, with sections pinned as they are: - a mutated currentLimit, credit-pool index range, signal height, rotation quarter bit or credit-window entry passes every load gate and the snapshot chainstate's own blocks, and is rejected only at completion, with no block marked invalid; a wrong modifier is, on a node without the work-block bodies at load; - a corrupted capture is a mismatch; a missing one whose block is gone is missing input with a warning naming the retry, after which completion succeeds once the body is back; activation refuses a base whose connected input body is gone; with real quorums, completion succeeds from the captures alone once every body at or below the base is gone and the caches are cold, both for those activation wrote on a synced node (a withdrawal in the window) and for those the background chainstate of a node with only the headers wrote as it connected the blocks, across a restart; - the honest run on a node with only the headers completes across a restart and dropped caches; the background chainstate announces none of the MN-list changes it connects and its ForceSignalDBUpdate writes only its own view; the captures last until promotion; NORMAL consumers read the promoted MN list and credit pool; - a published generation is refused after a V24 min_activation_height change, naming the generation, base, phase and recovery and saying the changed part is unknown, with nothing changed on disk; so is a promotion interrupted mid-merge, whose failing recovery names the way out; both resume under the original configuration; - blocks the still-active chainstate connects between preparation and the switch, through the base, are captured and its base list recorded, so completion succeeds; - a crash right after a refused switch restarts without an Evo/coins mismatch, although the chainstate connected blocks meanwhile; - an unreadable body, a changed retained section and mismatched best blocks stop the node as local corruption, an internal error and a missing base list record as internal errors, none rejecting the snapshot; startup then fails the same way, fails as local corruption on an unreadable background coin and on a coins table block that fails its checksum, and promotes once the data is whole again; - with real quorums: a carried safety commitment with another public key, signature or mined block in the same window is rejected only at completion; the honest section completes, the next cycle's mined commitment is NORMAL's after promotion, and a quorum-signed signal for an unused bit mined at the base is carried raw and kept by promotion; - a crash before or after publication leaves no captures after restart; - a chainstate stalled on a missing carried record stays there past completion, and after the restart that promotes the snapshot the block connects. The completion warning and its clear raise the GUI alert through the new kernel::Notifications::evoStateWarningChanged(), which node::KernelNotifications forwards to uiInterface.NotifyAlertChanged() without -alertnotify, only when the warning changes. The alert counts in chainstatemanager_evo_snapshot_completion_uses_the_captures pin one alert for the warning and one for its clear: they are parity checks, not tests that fail without a fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, then publish There are no active-chain turns to wait for: a read that the switch overtakes reads the new active view from then on. The handoff wait, its timeout, the thread-local turn list and the tests of the wait are gone; a test checks that an overtaken reader finds the seeded list at the base. The seeded state is checked and dry-run through a SNAPSHOT transaction that is never committed. Activation sets the default identity before it delivers the snapshot tip, so that delivery reads the snapshot view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…completion Completion rebuilds the section from NORMAL through a NORMAL transaction that is never committed, and the capture paths write through the NORMAL transaction they open, instead of a scope. Tests serve a view as the active one (ReadIn) instead of binding a scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, then publish A failed LevelDB write throws rather than returning false. In a failed activation's cleanup, a throwing AbandonSnapshotGeneration skipped the removal of the snapshot coins directory and left the generation bound, so a retry in the same run opened the old directory. Catch it, revoke the generation for the rest of the run, stop the node and go on with the directory. A throwing CollectRejectedGenerations is only logged, as its false return is. At completion, a throw from the final EvoDB sync skipped the fatal error that a false return gets, and escaped into ConnectTip. Handle it the same way. The rejection failpoint now covers AbandonSnapshotGeneration too, and a new failpoint makes synced CommitRootTransaction calls throw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…completion - A throw while erasing the captured evo inputs in a failed activation's cleanup is logged like a false return, so the rest of the cleanup still runs. - Completion requires the retained section whenever the base is pinned, as activation and startup do; a pinned pre-DIP3 base no longer skips the rebuild when the record is missing. - The retained section is read once, and a LevelDB read error is this node's corruption (EVO_LOCAL_FAILURE), as is one while reading the capture plan for the rebuild. - The EvoDB best-block markers are checked before any Evo comparison, so Evo state read from an inconsistent EvoDB cannot reject the snapshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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 the final activation-cleanup and completion-validation corrections, including handling EvoDB write failures, pinned retained sections, local read failures, and marker ordering. ClangFormat and policy checks pass; container build jobs remain queued and the review check is still in progress, with no failed code check reported.
🟡 6 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.
6 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Twelve explicit fixup commits leave incomplete changes in permanent history
Impact: The permanent PR history leaves reviewers and future bisects on intermediate AssumeUTXO and Evo states rather than on complete logical changes.
<commit:c5468d77b>:1
The current range still contains 45 fixup! or amend! commits among 62 PR commits, including the latest activation and completion corrections. These commits repair feature commits before they have shipped and do not represent useful independent historical states. Autosquash the corrections into their substantive commits before merging.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
🟡 Suggestion: Activation-cleanup corrections remain separate from the seeding feature commit
Impact: The seeding feature's complete cleanup behavior is split across review-only commits, so blame and bisect identify an incomplete activation implementation first.
<commit:0732efb1f06>:1
The activation-cleanup corrections remain in b4330b6b55d and 9cbe438a745 rather than in the seeding commit 84521b98401. The throwing-Abandon handling, revocation, directory cleanup, and related logging are corrections to that feature and have no durable meaning as separate release history. Fold them into the seeding commit before merge.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
🟡 Suggestion: Completion-validation corrections remain separate from the Evo comparison feature commit
Impact: The completion feature appears incomplete until later fixups add its local-corruption handling and ordering guarantees.
<commit:dc39d0e945a>:1
The completion corrections remain in 918f649f2cd and 2bf15411297 after b82106546a3. The pinned-base gate, retained-section read classification, marker ordering, and capture-plan exception handling all repair the same completion feature and should be folded into its substantive commit so the history presents one complete validation policy.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
🟡 Suggestion: Completion-validation corrections remain separate from the Evo comparison feature commit
Impact: The permanent history continues to expose a review-stage completion implementation that was immediately superseded by later corrections.
<commit:12ce91ec955>:1
The retained-section, marker-ordering, and error-handling changes are still represented by standalone fixups after b82106546a3, specifically 918f649f2cd and 2bf15411297. This is the same artificial seam identified previously; fold both corrections into the completion feature commit before merging.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
🟡 Suggestion: Activation-cleanup corrections remain separate from the seeding feature commit
Impact: Blame and bisect on the seeding path first expose activation cleanup without the fixes required for failed EvoDB writes and generation revocation.
<commit:d5cf7b51fe6>:1
The current stack still keeps the activation cleanup in the standalone b4330b6b55d fixup after 84521b98401, with the related follow-up in 9cbe438a745. These changes belong to the seeding feature and should be incorporated into its substantive commit before merging.
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.2-astra (phase2-reviewer: general, dash-core-commit-history)
🟡 Suggestion: Twelve explicit fixup commits leave incomplete changes in permanent history
Impact: The full AssumeUTXO stack remains difficult to audit and bisect because dozens of review-stage corrections would become permanent commits.
<commit:7ee8a15b7b3>:1
An independent count of the current PR range still finds 45 explicit fixup! or amend! commits among 62 commits, including the four late corrections for seeding and completion. Autosquash the full stack so each substantive commit contains its final behavior rather than preserving intermediate review states.
source: muse-spark-1.3-contributor (phase1-reviewer: general); 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: muse-spark-1.3-contributor (agent: phase1-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 large diff changes consensus-adjacent Evo snapshot validation and persistent chainstate/EvoDB publication and rebuild logic in src/evo/snapshot_chain.cpp, src/evo/evodb.cpp, and validation.cpp, including storage-state transitions whose correctness affects accepted snapshot 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 (
8e526bf8): 1 follow-up candidate(s) already listed by an earlier review, not repeated; 1 finding(s) judged fixed earlier and raised again on unchanged lines kept settled - 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:c5468d77b>`:
- [SUGGESTION] <commit:c5468d77b>:1: Twelve explicit fixup commits leave incomplete changes in permanent history
Impact: The permanent PR history leaves reviewers and future bisects on intermediate AssumeUTXO and Evo states rather than on complete logical changes.
The current range still contains 45 `fixup!` or `amend!` commits among 62 PR commits, including the latest activation and completion corrections. These commits repair feature commits before they have shipped and do not represent useful independent historical states. Autosquash the corrections into their substantive commits before merging.
In `<commit:0732efb1f06>`:
- [SUGGESTION] <commit:0732efb1f06>:1: Activation-cleanup corrections remain separate from the seeding feature commit
Impact: The seeding feature's complete cleanup behavior is split across review-only commits, so blame and bisect identify an incomplete activation implementation first.
The activation-cleanup corrections remain in `b4330b6b55d` and `9cbe438a745` rather than in the seeding commit `84521b98401`. The throwing-Abandon handling, revocation, directory cleanup, and related logging are corrections to that feature and have no durable meaning as separate release history. Fold them into the seeding commit before merge.
In `<commit:dc39d0e945a>`:
- [SUGGESTION] <commit:dc39d0e945a>:1: Completion-validation corrections remain separate from the Evo comparison feature commit
Impact: The completion feature appears incomplete until later fixups add its local-corruption handling and ordering guarantees.
The completion corrections remain in `918f649f2cd` and `2bf15411297` after `b82106546a3`. The pinned-base gate, retained-section read classification, marker ordering, and capture-plan exception handling all repair the same completion feature and should be folded into its substantive commit so the history presents one complete validation policy.
In `<commit:12ce91ec955>`:
- [SUGGESTION] <commit:12ce91ec955>:1: Completion-validation corrections remain separate from the Evo comparison feature commit
Impact: The permanent history continues to expose a review-stage completion implementation that was immediately superseded by later corrections.
The retained-section, marker-ordering, and error-handling changes are still represented by standalone fixups after `b82106546a3`, specifically `918f649f2cd` and `2bf15411297`. This is the same artificial seam identified previously; fold both corrections into the completion feature commit before merging.
In `<commit:d5cf7b51fe6>`:
- [SUGGESTION] <commit:d5cf7b51fe6>:1: Activation-cleanup corrections remain separate from the seeding feature commit
Impact: Blame and bisect on the seeding path first expose activation cleanup without the fixes required for failed EvoDB writes and generation revocation.
The current stack still keeps the activation cleanup in the standalone `b4330b6b55d` fixup after `84521b98401`, with the related follow-up in `9cbe438a745`. These changes belong to the seeding feature and should be incorporated into its substantive commit before merging.
In `<commit:7ee8a15b7b3>`:
- [SUGGESTION] <commit:7ee8a15b7b3>:1: Twelve explicit fixup commits leave incomplete changes in permanent history
Impact: The full AssumeUTXO stack remains difficult to audit and bisect because dozens of review-stage corrections would become permanent commits.
An independent count of the current PR range still finds 45 explicit `fixup!` or `amend!` commits among 62 commits, including the four late corrections for seeding and completion. Autosquash the full stack so each substantive commit contains its final behavior rather than preserving intermediate review states.
Issue being fixed or feature implemented
Loading the Evo section must not leave half-seeded state behind, and background validation must confirm that the carried section matches what the node derives itself.
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, which merged #8235, so #8237 is now the bottom layer.Update (2026-11-29). CodeRabbit review fixes, as fixups:
0732efb1f0activation cleanup continues when an EvoDB write throws (generation revoked, directory removed, node stops), and a throwing final EvoDB sync at completion is handled like a failed one;dc39d0e945completion requires the retained section for any pinned base, a failed read of it is local corruption, and the EvoDB best-block markers are checked before any comparison that could reject the snapshot.What was done?
Update (2026-11-28). Rebased onto develop
c0ccc288b1and the reshaped #8235, with the review fixes below. The stall-specific tests and warning sources that used to be in these commits (stalls_on_the_way_back, the stall-warning checks inmissing_seed_stalls,EvoStallWarningSource) moved to #8078 with the stall bookkeeping;kernel::Notifications::evoStateWarningChanged()stays here, for the completion warning. Rebased onto develop 7f4b217 (#8256: DataStream/HashWriter/NetMsg conversions squashed into the commits that introduced the code). Following knst's review of #8237: publication no longer records a configuration fingerprint, and the section and capture keys are renamed toassumeutxo_evo_sectionandassumeutxo_capture. With the per-key seed comparison gone, completion now rebuilds and compares the section of every generation that retained one, also at a pre-DIP3 base (checking the pin only where the loader requires one), since that was the one promotion path without a full check. The deployment-change refusal test is replaced bychainstatemanager_evo_snapshot_interrupted_promotion_resumes, and a test helper's implicit signed truncation that UBSan reported is fixed. No change to this PR's own commits in the CodeRabbit round; rebased onto the fixups below it.New on top of #7601:
84a84e9d4ffeat(validation): seed into an unpublished generation, dry-run, then publish. The section is seeded into an unpublished generation, a dry run computes the members the snapshot chainstate may need from the seeded state alone, and only then is it published; a failure leaves nothing behind. Review fixes: startup removes a snapshot coins directory that no chainstate uses (a load that crashed before recording its base), so a later load at another base does not add its coins to the old ones;LevelDBContextowns and frees the database, cache, filter policy, logger and environment, so a failed open leaks nothing, and theleak:GetOptionsLeakSanitizer suppression is gone.8e8bbcd162feat(validation): rebuild and compare the full evo section at completion. When background validation reaches the base, the node rebuilds the section from its own NORMAL state and compares hashes; a mismatch rejects the snapshot throughHandleSnapshotStateMismatch. Review fix: the coins scan checks the cursor's read-error state (CCoinsViewCursor::HasError()), so a table block LevelDB skipped stops the node with the "UTXO set cannot be read" advice instead of rejecting a good snapshot asHASH_MISMATCH.What to focus on: the publish ordering and the completion comparison.
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).chainstatemanager_evo_snapshot_completion_stops_on_local_failuresgains a corrupted-table-block case; without theHasError()check the snapshot is rejected to_INVALID.leak:GetOptionssuppression randbwrapper_tests,evo_db_tests,coins_tests,interfaces_testsandvalidation_chainstatemanager_tests(which includes the failed-open case) with no errors and no LeakSanitizer report. It was not repeated after the rebase.To test:
ctest --test-dir build -R "evo_db|validation_chainstatemanager".Breaking Changes
None with a single chainstate. Nothing here is reachable on mainnet or testnet: snapshots can only be loaded on regtest until the network pins (#8276) land.
Checklist:
🤖 Generated with Claude Code